1 |
|
# Copyright 1999-2022 Gentoo Authors
|
|
1 |
# Copyright 1999-2023 Gentoo Authors
|
2 |
2 |
# Distributed under the terms of the GNU General Public License v2
|
3 |
3 |
|
4 |
|
EAPI=7
|
|
4 |
EAPI=8
|
|
5 |
inherit linux-info multiprocessing
|
5 |
6 |
|
6 |
7 |
DESCRIPTION="Broadcom Bluetooth firmware"
|
7 |
8 |
HOMEPAGE="https://github.com/winterheart/broadcom-bt-firmware"
|
... | ... | |
9 |
10 |
|
10 |
11 |
LICENSE="broadcom_bcm20702 MIT"
|
11 |
12 |
SLOT="0"
|
12 |
|
KEYWORDS="amd64 ~ppc64 x86"
|
13 |
|
IUSE=""
|
|
13 |
KEYWORDS="~amd64 ~ppc64 ~x86"
|
|
14 |
# Re-use compress-* USE flags from sys-kernel/linux-firmware.
|
|
15 |
IUSE="compress-xz compress-zstd"
|
|
16 |
REQUIRED_USE="?? ( compress-xz compress-zstd )"
|
|
17 |
|
|
18 |
BDEPEND="
|
|
19 |
compress-xz? ( app-arch/xz-utils )
|
|
20 |
compress-zstd? ( app-arch/zstd )
|
|
21 |
"
|
|
22 |
|
|
23 |
pkg_setup() {
|
|
24 |
if use compress-xz || use compress-zstd ; then
|
|
25 |
local CONFIG_CHECK
|
|
26 |
|
|
27 |
if kernel_is -ge 5 19; then
|
|
28 |
use compress-xz && CONFIG_CHECK="~FW_LOADER_COMPRESS_XZ"
|
|
29 |
use compress-zstd && CONFIG_CHECK="~FW_LOADER_COMPRESS_ZSTD"
|
|
30 |
else
|
|
31 |
use compress-xz && CONFIG_CHECK="~FW_LOADER_COMPRESS"
|
|
32 |
if use compress-zstd; then
|
|
33 |
eerror "Kernels <5.19 do not support ZSTD-compressed firmware files"
|
|
34 |
fi
|
|
35 |
fi
|
|
36 |
linux-info_pkg_setup
|
|
37 |
fi
|
|
38 |
}
|
14 |
39 |
|
15 |
40 |
src_install() {
|
16 |
41 |
insinto /lib/firmware
|
17 |
42 |
doins -r brcm
|
|
43 |
|
|
44 |
if use compress-xz || use compress-zstd; then
|
|
45 |
pushd "${ED}/lib/firmware/brcm" &>/dev/null || die
|
|
46 |
einfo "Compressing firmware ..."
|
|
47 |
local ext
|
|
48 |
local compressor
|
|
49 |
|
|
50 |
if use compress-xz; then
|
|
51 |
ext=xz
|
|
52 |
compressor="xz -T1 -C crc32"
|
|
53 |
elif use compress-zstd; then
|
|
54 |
ext=zst
|
|
55 |
compressor="zstd -15 -T1 -C -q --rm"
|
|
56 |
fi
|
|
57 |
find . -type f -print0 | \
|
|
58 |
xargs -0 -P $(makeopts_jobs) -I'{}' ${compressor} '{}'
|
|
59 |
assert
|
|
60 |
popd &>/dev/null || die
|
|
61 |
fi
|
|
62 |
dodoc DEVICES.md README.md
|
18 |
63 |
}
|