summaryrefslogblamecommitdiff
path: root/user/linux-firmware/APKBUILD
blob: 2042843ec0c0db5317094e1c77540f4fa20dfcf4 (plain) (tree)







































































                                                                                                                                                                             
# Contributor: Ariadne Conill <nenolod@dereferenced.org>
# Contributor: Oliver Smith <ollieparanoid@bitmessage.ch>
# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: Síle Ekaterin Liszka <sheila@vulpine.house>
pkgname=linux-firmware
pkgver=20241210
pkgrel=0
pkgdesc="firmware files for linux"
url="http://git.kernel.org/?p=linux/kernel/git/firmware/linux-firmware.git;a=summary"
arch="all"
options="!strip !check !dbg"
license="custom:multiple"
depends=""
makedepends="rdfind"
source="https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/snapshot/$pkgname-$pkgver.tar.gz"
# Put /lib/firmware/* folders in subpackages
_folders="3com acenic adaptec advansys airoha amd amd-ucode amdgpu amdnpu 
amdtee amlogic amphion ar3k arm ath10k ath11k ath12k ath6k ath9k_htc atmel 
atusb av7110 bnx2 bnx2x brcm cadence cavium cirrus cis cnm cpia2 cxgb3 cxgb4 
cypress dabusb dpaa2 dsp56k e100 edgeport emi26 emi62 ene-ub6250 ess go7007 
i915 imx inside-secure intel isci ixp4xx kaweth keyspan keyspan_pda korg 
libertas liquidio matrox mediatek mellanox meson microchip moxa mrvl mwl8k 
mwlwifi myricom netronome nvidia nxp ositech powervr qca qcom qed qlogic r128 
radeon realtek rockchip rsi rtl_bt rtl_nic rtlwifi rtw88 rtw89 sb16 slicoss sun 
sxg tehuti ti ti-connectivity ti-keystone tigon ttusb-budget ueagle-atm vicam 
vxge wfx xe yam yamaha"
subpackages="$pkgname-other"
depends="linux-firmware-other"
for i in $_folders; do
    subpackages="$pkgname-$i:folder $subpackages"
    depends="$pkgname-$i $depends"
done

package() {
    make DESTDIR="${pkgdir}" FIRMWAREDIR="/lib/firmware" install
	make DESTDIR="${pkgdir}" FIRMWAREDIR="/lib/firmware" dedup
    rm -f "${pkgdir}/usr/lib/firmware/{Makefile,README,configure,GPL-3}"
}

folder() {
    folder=${subpkgname##linux-firmware-}
    pkgdesc="firmware files for linux ($_folder folder)"
    depends=""

    # Move /lib/firmware/$folder (case insensitive)
    mkdir -p "$subpkgdir/lib/firmware"
    mv "$(find "$pkgdir/lib/firmware" -iname "$folder" -type d)" \
        "$subpkgdir/lib/firmware"
}

other() {
    # Requires subfolders to be split in subpackages
    leftover=""
    for i in "$pkgdir"/lib/firmware/*; do
        [ -d "$i" ] && leftover="$leftover $(basename $i)"
    done
    if [ "$leftover" != "" ]; then
        error "Not all subfolders have been moved to subpackages!"
        error "Fix this by adjusting _folders as follows:"
        fixed="$(echo $_folders$leftover | tr " " "\n" | tr '[A-Z]' '[a-z]' | sort)"
        echo "_folders=\"$(printf "$fixed" | tr "\n" " ")\"" | fold -s
        return 1
    fi

    # Move /lib/firmware (which doesn't have subfolders now)
    pkgdesc="firmware files for linux (uncategorized)"
    depends=""
    mkdir -p "$subpkgdir"/
    mv "$pkgdir"/lib "$subpkgdir"/
}

sha512sums="75e2d7383e209c2f787a4369e171e2d9bd16dc9cc1cd74920874d1dc56a950df95981be942fd7aa95620ef18da3e50d0fd95886c1497c91c4e54f564fe381fc3  linux-firmware-20241210.tar.gz"