# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4

PortSystem          1.0

name                riscv-linux-kernel-headers-5.10
version             5.10.252
categories          cross devel
license             GPL-2
maintainers         {pguyot @pguyot} openmaintainer

description         Linux 5.10 kernel headers for RISC-V cross compilation
long_description    Sanitized Linux 5.10 kernel headers for RISC-V cross \
                    compilation. These headers are needed to build a C \
                    library (glibc, musl, or uClibc-ng) targeting Linux \
                    on RISC-V processors.

homepage            https://www.kernel.org/
master_sites        https://cdn.kernel.org/pub/linux/kernel/v5.x/
distname            linux-${version}
use_xz              yes

checksums           rmd160  f3d2b9cf6662cf4a61b6d9d4bff4c5b2aa77035f \
                    sha256  34b3fbe2c9eeb767fc7eea4b9516e0dd44b79401ceb13e41713096b8eb270afb \
                    size    120859296

depends_build       port:gmake \
                    port:gsed

use_configure       no

build {}

livecheck.type      regex
livecheck.url       https://cdn.kernel.org/pub/linux/kernel/v5.x/
livecheck.regex     linux-(5\\.10\\.\\d+)\\.tar\\.xz

destroot {
    # The kernel header install scripts require GNU sed
    file mkdir ${workpath}/bin
    file link -symbolic ${workpath}/bin/sed ${prefix}/bin/gsed
    system -W ${worksrcpath} \
        "env PATH=${workpath}/bin:$env(PATH) \
        ${prefix}/bin/gmake ARCH=riscv headers_install \
            INSTALL_HDR_PATH=${destroot}${prefix}/share/${name}"
}
