From 5ec88f908e1fdfab546e15c0ff48731541909be7 Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Sun, 31 Aug 2025 10:32:40 +0200 Subject: [PATCH] app-admin/coreboot-utils-25.06: version bump fixes for -Oz compilation Closes: https://bugs.gentoo.org/961917 Signed-off-by: Fabian Groffen --- app-admin/coreboot-utils/Manifest | 1 + .../coreboot-utils-25.06.ebuild | 67 +++++++++++++++++++ .../files/coreboot-utils-25.06-Oz.patch | 13 ++++ .../files/coreboot-utils-25.06-includes.patch | 13 ++++ 4 files changed, 94 insertions(+) create mode 100644 app-admin/coreboot-utils/coreboot-utils-25.06.ebuild create mode 100644 app-admin/coreboot-utils/files/coreboot-utils-25.06-Oz.patch create mode 100644 app-admin/coreboot-utils/files/coreboot-utils-25.06-includes.patch diff --git a/app-admin/coreboot-utils/Manifest b/app-admin/coreboot-utils/Manifest index 3a7daa58eb9ac..24c91200d58fc 100644 --- a/app-admin/coreboot-utils/Manifest +++ b/app-admin/coreboot-utils/Manifest @@ -1 +1,2 @@ +DIST coreboot-25.06.tar.xz 65295812 BLAKE2B 71d88e8f886df117768aa9d8f8913c9bef4c981b36c7eefd37e00d0ce746a588b6fc6aa658be59d141010e3ef1726ee492b52d87d9b4ace7a74dce78361bc1d2 SHA512 380546ee0353098065e824f1ae3f7fca012bb23adf47432b0b598a64ac6940d71035f8614f39ecb48f444c854bf532096c66149c26134ff1ed9ec14f7a836a22 DIST coreboot-4.18.tar.xz 57868424 BLAKE2B 981d8c1cf007be15a85d5860dcfcfa6fa637f66438ff4ef6619491aaf0192e622bfbe9608deb13a975d899c94430bc3d1f0eb3a5a3dc6598f49a726b8ff641e1 SHA512 b363850d31074950bc710bd0a47a896a6c6ef23c53d720ae90ec2257697a3eeeb211e163199064b5e532e5b1e86cdecf997276d742435deeaaacfb19b83f4e6d diff --git a/app-admin/coreboot-utils/coreboot-utils-25.06.ebuild b/app-admin/coreboot-utils/coreboot-utils-25.06.ebuild new file mode 100644 index 0000000000000..3b28476f39c04 --- /dev/null +++ b/app-admin/coreboot-utils/coreboot-utils-25.06.ebuild @@ -0,0 +1,67 @@ +# Copyright 2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit toolchain-funcs + +DESCRIPTION="A selection from coreboot/utils useful in general" +HOMEPAGE="https://www.coreboot.org/" +SRC_URI="https://coreboot.org/releases/coreboot-${PV}.tar.xz" +S="${WORKDIR}/coreboot-${PV}" + +LICENSE="GPL-2+ GPL-2" +SLOT="0" +KEYWORDS="~amd64" + +DEPEND="sys-apps/pciutils + sys-libs/zlib" +RDEPEND="${DEPEND}" + +PATCHES=( + "${FILESDIR}"/${PN}-25.06-includes.patch + "${FILESDIR}"/${PN}-25.06-Oz.patch +) + +# selection from README.md that seem useful outside coreboot +coreboot_utils=( + #cbfstool has textrels and is not really necessary outside coreboot + cbmem + ifdtool + intelmetool + inteltool + me_cleaner + nvramtool + pmh7tool + superiotool +) + +src_prepare() { + default + # drop some CFLAGS that hurt compilation on modern toolchains or + # force optimisation + # can't do this in one sed, because it all happens back-to-back + for e in '-O[01234567s]' '-g' '-Werror' '-ansi' '-pendantic' ; do + sed -i -e 's/\( \|=\)'"${e}"'\( \|$\)/\1/g' util/*/Makefile* \ + || die + done +} + +src_compile() { + tc-export CC + export HOSTCFLAGS="${CFLAGS}" + for tool in ${coreboot_utils[*]} ; do + [[ -f util/${tool}/Makefile ]] || continue + emake -C util/${tool} V=1 + done +} + +src_install() { + exeinto /usr/sbin + for tool in ${coreboot_utils[*]} ; do + [[ -e util/${tool}/${tool} ]] && doexe util/${tool}/${tool} + [[ -e util/${tool}/${tool}.py ]] && doexe util/${tool}/${tool}.py + [[ -e util/${tool}/${tool}.8 ]] && doman util/${tool}/${tool}.8 + [[ -d util/${tool}/man ]] && doman util/${tool}/man/*.[12345678] + done +} diff --git a/app-admin/coreboot-utils/files/coreboot-utils-25.06-Oz.patch b/app-admin/coreboot-utils/files/coreboot-utils-25.06-Oz.patch new file mode 100644 index 0000000000000..e37ceb4b37ec8 --- /dev/null +++ b/app-admin/coreboot-utils/files/coreboot-utils-25.06-Oz.patch @@ -0,0 +1,13 @@ +Bug: https://bugs.gentoo.org/961917 + +--- a/util/inteltool/cpu.c ++++ b/util/inteltool/cpu.c +@@ -53,7 +53,7 @@ + return ret; + } + +-inline cpuid_result_t cpuid_ext(int op, unsigned int ecx) ++inline static cpuid_result_t cpuid_ext(int op, unsigned int ecx) + { + cpuid_result_t result; + diff --git a/app-admin/coreboot-utils/files/coreboot-utils-25.06-includes.patch b/app-admin/coreboot-utils/files/coreboot-utils-25.06-includes.patch new file mode 100644 index 0000000000000..88717659849db --- /dev/null +++ b/app-admin/coreboot-utils/files/coreboot-utils-25.06-includes.patch @@ -0,0 +1,13 @@ +fix compilation when CFLAGS is set (which in Gentoo it always is) + +--- a/util/intelmetool/Makefile ++++ b/util/intelmetool/Makefile +@@ -7,6 +7,8 @@ + INSTALL ?= /usr/bin/env install + PREFIX ?= /usr/local + CFLAGS ?= -O0 -g -Wall -Wextra -Wno-unused-parameter -Wno-sign-compare -Wno-unused-function \ ++# \ on prev and next line for patch ++CFLAGS += \ + -I $(TOP)/src/commonlib/bsd/include + LDFLAGS += -lpci -lz +