aboutsummaryrefslogtreecommitdiffstats
path: root/main/linux-firmware/APKBUILD
blob: febc6fb76bdb09c93f03e55ca99a6f19f3a3d699 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# Contributor: William Pitcock <nenolod@dereferenced.org>
# Contributor: Oliver Smith <ollieparanoid@bitmessage.ch>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=linux-firmware
pkgver=20180615
pkgrel=1
pkgdesc="firmware files for linux"
#url="http://git.kernel.org/?p=linux/kernel/git/dwmw2/linux-firmware.git;a=summary"
url="http://git.kernel.org/?p=linux/kernel/git/firmware/linux-firmware.git;a=summary"
arch="all"
license="custom:multiple"
makedepends=
install=""
provides="linux-firmware-any"
provider_priority=1
options="!strip !check"
source="http://dev.alpinelinux.org/archive/$pkgname/$pkgname-${pkgver}.tar.gz
	https://github.com/RPi-Distro/firmware-nonfree/raw/master/brcm/brcmfmac43430-sdio.txt
	https://github.com/RPi-Distro/firmware-nonfree/raw/master/brcm/brcmfmac43430-sdio.bin
"

_giturl="git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git"
_upload=dev.alpinelinux.org:/archive/$pkgname/

_builddir="$srcdir"/$pkgname-$pkgver

# Put /lib/firmware/* folders in subpackages
_folders="3com acenic adaptec advansys amd-ucode amdgpu ar3k ath10k ath6k
	ath9k_htc atmel atusb av7110 bnx2 bnx2x brcm carl9170fw cavium cis cpia2 cxgb3
	cxgb4 dabusb dsp56k e100 edgeport emi26 emi62 ene-ub6250 ess go7007 i915 imx
	intel isci kaweth keyspan keyspan_pda korg libertas liquidio matrox mellanox
	moxa mrvl mwl8k mwlwifi myricom netronome nvidia ositech qca qcom qed qlogic
	r128 radeon rockchip rsi rtl8192e rtl_bt rtl_nic rtlwifi sb16 slicoss sun sxg
	tehuti ti-connectivity ti-keystone tigon ttusb-budget ueagle-atm vicam vxge yam
	yamaha"
subpackages="$pkgname-other $pkgname-none"
depends="linux-firmware-other=$pkgver-r$pkgrel"
for i in $_folders; do
	subpackages="$pkgname-$i:folder $subpackages"
	depends="$pkgname-$i=$pkgver-r$pkgrel $depends"
done

snapshot() {
	local _date=$(date +%Y%m%d)
	local _pkg=$pkgname-$_date.tar.gz
	mkdir -p "$srcdir"
	cd "$srcdir"
	rm -rf "$pkgname"
	git clone --depth=1 --bare $_giturl
	git --git-dir ${_giturl##*/} archive -o $_pkg \
		--prefix=$pkgname-$_date/ HEAD
	msg "New snapshot: $_pkg"
	if [ -n "$_upload" ]; then
		msg "Uploading to $_upload"
		scp $_pkg $_upload && abump $pkgname-$_date
	fi
}

package() {
	cd "${_builddir}"
	make DESTDIR="${pkgdir}" FIRMWAREDIR="/lib/firmware" install
	for i in brcmfmac43430-sdio.txt brcmfmac43430-sdio.bin; do
		install -Dm 644 "$srcdir/$i" "$pkgdir/lib/firmware/brcm/$i"
	done
	rm -f "${pkgdir}/usr/lib/firmware/{Makefile,README,configure,GPL-3}"
}

folder() {
	local folder=${subpkgname##linux-firmware-}
	pkgdesc="firmware files for linux ($folder folder)"
	depends=""
	provides="linux-firmware-any"
	provider_priority=

	# 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
	local leftover=""
	local i
	for i in "$pkgdir"/lib/firmware/*; do
		[ -d "$i" ] && leftover="$leftover $(basename $i)"
	done
	if [ "$leftover" != "" ]; then
		local fixed
		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=""
	provides="linux-firmware-any"
	provider_priority=
	mkdir -p "$subpkgdir"/
	mv "$pkgdir"/lib "$subpkgdir"/
}

none() {
	# dummy package with no firmware
	pkgdesc="Empty linux firwmare package for those who does not need any firmware"
	provider_priority=
	provides="linux-firmware-any"
	depends=
	mkdir -p "$subpkgdir"
}


sha512sums="37572701d6e7be63dfb026f8a23fee345da1e1b191f02cc80d5f323537d544b325d484517966226a6e87d9b3c3741311ad7c6f2b15253b0a88f6875794f8c824  linux-firmware-20180615.tar.gz
d3c9ae08bbb2323b4737d65a0416702c92eb52f9c395c8da6be00eb2f1d68efcb2dcb88e357adaf2130dafab32378b13d0a56c37bb647af145e5029e23744e08  brcmfmac43430-sdio.txt
6c60b5c6df7265b9daa5dad6e409ed27fa8f4d3b2e80500d5af73d47dba9d00b2e384f43f086cb3d6b594412463857733bce78af623c573a200308508321bb25  brcmfmac43430-sdio.bin"