diff options
author | V3n3RiX <venerix@koprulu.sector> | 2023-03-12 18:13:14 +0000 |
---|---|---|
committer | V3n3RiX <venerix@koprulu.sector> | 2023-03-12 18:13:14 +0000 |
commit | f1ced5f5f09c4d27185e6986a465f7bc3b828c65 (patch) | |
tree | bb4a65f6889f3cbcc2f8e5053b624f23291d7921 /sys-kernel/linux-firmware/linux-firmware-99999999.ebuild | |
parent | 70d27c1344f6a6a51e11c610966542333b6f432a (diff) |
gentoo auto-resync : 12:03:2023 - 18:13:14
Diffstat (limited to 'sys-kernel/linux-firmware/linux-firmware-99999999.ebuild')
-rw-r--r-- | sys-kernel/linux-firmware/linux-firmware-99999999.ebuild | 58 |
1 files changed, 46 insertions, 12 deletions
diff --git a/sys-kernel/linux-firmware/linux-firmware-99999999.ebuild b/sys-kernel/linux-firmware/linux-firmware-99999999.ebuild index 6eb5ade58607..47424bcb967c 100644 --- a/sys-kernel/linux-firmware/linux-firmware-99999999.ebuild +++ b/sys-kernel/linux-firmware/linux-firmware-99999999.ebuild @@ -29,13 +29,16 @@ LICENSE="GPL-2 GPL-2+ GPL-3 BSD MIT || ( MPL-1.1 GPL-2 ) redistributable? ( linux-fw-redistributable BSD-2 BSD BSD-4 ISC MIT ) unknown-license? ( all-rights-reserved )" SLOT="0" -IUSE="compress initramfs +redistributable savedconfig unknown-license" -REQUIRED_USE="initramfs? ( redistributable )" +IUSE="compress-xz compress-zstd initramfs +redistributable savedconfig unknown-license" +REQUIRED_USE="initramfs? ( redistributable ) + ?? ( compress-xz compress-zstd )" RESTRICT="binchecks strip test unknown-license? ( bindist )" -BDEPEND="initramfs? ( app-arch/cpio )" +BDEPEND="initramfs? ( app-arch/cpio ) + compress-xz? ( app-arch/xz-utils ) + compress-zstd? ( app-arch/zstd )" #add anything else that collides to this RDEPEND="!savedconfig? ( @@ -61,12 +64,24 @@ RDEPEND="!savedconfig? ( QA_PREBUILT="*" pkg_setup() { - if ! use compress ; then - return + if use compress-xz || use compress-zstd ; then + if ! linux_config_exists; then + eerror "Unable to check your kernel for compressed firmware support" + else + 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 "You kernel does not support ZSTD-compressed firmware files" + fi + fi + linux-info_pkg_setup + fi fi - - local CONFIG_CHECK="~FW_LOADER_COMPRESS" - linux-info_pkg_setup } pkg_pretend() { @@ -310,15 +325,34 @@ src_install() { find * ! -type d >> "${S}"/${PN}.conf || die save_config "${S}"/${PN}.conf - if use compress ; then + if use compress-xz || use compress-zstd; then + einfo "Compressing firmware ..." + local target + 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 + + # rename symlinks while IFS= read -r -d '' f; do + # skip symlinks pointing to directories + [[ -d ${f} ]] && continue + target=$(readlink "${f}") - ln -sf "${target}".xz "${f}" || die - mv "${f}" "${f}".xz || die + [[ $? -eq 0 ]] || die + ln -sf "${target}".${ext} "${f}" || die + mv -T "${f}" "${f}".${ext} || die done < <(find . -type l -print0) || die find . -type f ! -path "./amd-ucode/*" -print0 | \ - xargs -0 -P $(makeopts_jobs) -I'{}' xz -T1 -C crc32 '{}' || die + xargs -0 -P $(makeopts_jobs) -I'{}' ${compressor} '{}' || die + fi popd &>/dev/null || die |