summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAzamat H. Hackimov <azamat.hackimov@gmail.com>2023-05-06 15:29:23 +0300
committerJoonas Niilola <juippis@gentoo.org>2023-07-14 09:50:36 +0300
commit17deab41969ff9d7326e723f06a2576cdc76186a (patch)
tree02767440a8180b603b01b967faa32c1f1170edf9 /sys-firmware
parentapp-editors/vscodium: drop 1.79.0.23159 (diff)
downloadgentoo-17deab41969ff9d7326e723f06a2576cdc76186a.tar.gz
gentoo-17deab41969ff9d7326e723f06a2576cdc76186a.tar.bz2
gentoo-17deab41969ff9d7326e723f06a2576cdc76186a.zip
sys-firmware/broadcom-bt-firmware: compression support
Add compression support wih xz or zstd. Co-authored-by: Florian Schmaus <flo@geekplace.eu> Signed-off-by: Azamat H. Hackimov <azamat.hackimov@gmail.com> Signed-off-by: Joonas Niilola <juippis@gentoo.org>
Diffstat (limited to 'sys-firmware')
-rw-r--r--sys-firmware/broadcom-bt-firmware/broadcom-bt-firmware-12.0.1.1105_p4-r1.ebuild63
-rw-r--r--sys-firmware/broadcom-bt-firmware/metadata.xml4
2 files changed, 67 insertions, 0 deletions
diff --git a/sys-firmware/broadcom-bt-firmware/broadcom-bt-firmware-12.0.1.1105_p4-r1.ebuild b/sys-firmware/broadcom-bt-firmware/broadcom-bt-firmware-12.0.1.1105_p4-r1.ebuild
new file mode 100644
index 000000000000..e5bbdc369275
--- /dev/null
+++ b/sys-firmware/broadcom-bt-firmware/broadcom-bt-firmware-12.0.1.1105_p4-r1.ebuild
@@ -0,0 +1,63 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+inherit linux-info multiprocessing
+
+DESCRIPTION="Broadcom Bluetooth firmware"
+HOMEPAGE="https://github.com/winterheart/broadcom-bt-firmware"
+SRC_URI="https://github.com/winterheart/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="broadcom_bcm20702 MIT"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc64 ~x86"
+# Re-use compress-* USE flags from sys-kernel/linux-firmware.
+IUSE="compress-xz compress-zstd"
+REQUIRED_USE="?? ( compress-xz compress-zstd )"
+
+BDEPEND="
+ compress-xz? ( app-arch/xz-utils )
+ compress-zstd? ( app-arch/zstd )
+"
+
+pkg_setup() {
+ if use compress-xz || use compress-zstd ; then
+ local CONFIG_CHECK
+
+ if kernel_is -ge 5 19; then
+ use compress-xz && CONFIG_CHECK="~FW_LOADER_COMPRESS_XZ"
+ use compress-zstd && CONFIG_CHECK="~FW_LOADER_COMPRESS_ZSTD"
+ else
+ use compress-xz && CONFIG_CHECK="~FW_LOADER_COMPRESS"
+ if use compress-zstd; then
+ eerror "Kernels <5.19 do not support ZSTD-compressed firmware files"
+ fi
+ fi
+ linux-info_pkg_setup
+ fi
+}
+
+src_install() {
+ insinto /lib/firmware
+ doins -r brcm
+
+ if use compress-xz || use compress-zstd; then
+ pushd "${ED}/lib/firmware/brcm" &>/dev/null || die
+ einfo "Compressing firmware ..."
+ local ext
+ local compressor
+
+ if use compress-xz; then
+ ext=xz
+ compressor="xz -T1 -C crc32"
+ elif use compress-zstd; then
+ ext=zst
+ compressor="zstd -15 -T1 -C -q --rm"
+ fi
+ find . -type f -print0 | \
+ xargs -0 -P $(makeopts_jobs) -I'{}' ${compressor} '{}'
+ assert
+ popd &>/dev/null || die
+ fi
+ dodoc DEVICES.md README.md
+}
diff --git a/sys-firmware/broadcom-bt-firmware/metadata.xml b/sys-firmware/broadcom-bt-firmware/metadata.xml
index 3a69026d5f46..1d4e71fe4818 100644
--- a/sys-firmware/broadcom-bt-firmware/metadata.xml
+++ b/sys-firmware/broadcom-bt-firmware/metadata.xml
@@ -12,4 +12,8 @@
<upstream>
<remote-id type="github">winterheart/broadcom-bt-firmware</remote-id>
</upstream>
+<use>
+ <flag name="compress-xz">Compress firmware using xz (<pkg>app-arch/xz-utils</pkg>) before installation</flag>
+ <flag name="compress-zstd">Compress firmware using zstd (<pkg>app-arch/zstd</pkg>) before installation</flag>
+</use>
</pkgmetadata>