sys-libs/efivar: Sync with gentoo

It's from gentoo commit 61b08b5693a678f15e7858ed5bb11974a5565878.
This commit is contained in:
Krzesimir Nowak 2022-02-25 16:27:00 +01:00
parent 9c48249fce
commit ee84550a81
10 changed files with 256 additions and 56 deletions

View File

@ -1,2 +1,2 @@
DIST efivar-30.tar.bz2 73202 BLAKE2B 6b146cb6d664e3419361e72ab6fd1578522e7fc219613ae21566cb40a700fe70f18750cc753338faca2ad078e2bc933fb33a3a4cdfb148eabb0fc71b1319fb71 SHA512 0a6d7175762011c3fc67b531d3d19a45e82195c729b9ff498be02b3a6a73f6c3c4f9e14a27470c6744b741d7d54db9ef24c7882639af25fca1034b7b9f641b39 DIST efivar-37.tar.bz2 109431 BLAKE2B 813d477d31562b773f6e19f20e9e237b94beed437ce221771770e7d46ff0e657530285f035dc942cc20609185be92dc50319bfe8e10dee642c8bd88403ef6ffe SHA512 305a82ed103c7e3d8f723934019d552677c73558768dd5341f87d0364f5c60824d24f5a8e1bf90075e825908085083d4ecdccec5ac757fd38ee6ac8fea28c3e4
DIST efivar-31.tar.bz2 82404 BLAKE2B d339aa8ab7dcd6a60cb067fccfbc2c42407fba211ca96eb39f227d57e9403462505940f427651dfaffa8272c9edfe70898f181b9f6ecddbae4745eb3262de949 SHA512 5055f690fd99cf59895dcf3d11103494d917d4923567626f0bee816ea5e4dd56cec23627ede5f21bdc57b7306522471ad19cc8ab22ae94591dbd1925c084f163 DIST efivar-38.tar.bz2 320221 BLAKE2B 0b96f3d71ddc2246e6a11a5cd32af3d007823c4a283186a428c3f145cd74425a31bd22c4671ad1ab252a3c572991bb1698381cb8bdf51efcbebd62befdc6c070 SHA512 c2f17297c863ece134a9dd758d237fd2df8c8d072f87af1d0bf2bcf9acfc7a53c25597f03fd4fb8cc664b205743d4ffa0ef1b068d0f73c58fa573d40993f3155

View File

@ -1,49 +0,0 @@
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=6
inherit flag-o-matic toolchain-funcs
DESCRIPTION="Tools and library to manipulate EFI variables"
HOMEPAGE="https://github.com/rhinstaller/efivar"
SRC_URI="https://github.com/rhinstaller/efivar/releases/download/${PV}/${P}.tar.bz2"
LICENSE="GPL-2"
SLOT="0/1"
KEYWORDS="amd64 ~arm64 ia64 x86"
RDEPEND="dev-libs/popt"
DEPEND="${RDEPEND}
>=sys-kernel/linux-headers-3.18
virtual/pkgconfig
"
src_prepare() {
default
sed -i -e s/-Werror// gcc.specs || die
}
src_configure() {
tc-export CC
# https://github.com/rhinstaller/efivar/issues/64
append-cflags -flto
tc-ld-disable-gold
export libdir="/usr/$(get_libdir)"
unset LIBS # Bug 562004
}
src_compile() {
# Avoid building static binary/libs
opts=(
BINTARGETS=efivar
STATICLIBTARGETS=
)
emake "${opts[@]}"
}
src_install() {
emake "${opts[@]}" DESTDIR="${D}" install
}

View File

@ -1,9 +1,9 @@
# Copyright 1999-2017 Gentoo Foundation # Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2 # Distributed under the terms of the GNU General Public License v2
EAPI=6 EAPI=6
inherit flag-o-matic toolchain-funcs inherit toolchain-funcs
DESCRIPTION="Tools and library to manipulate EFI variables" DESCRIPTION="Tools and library to manipulate EFI variables"
HOMEPAGE="https://github.com/rhinstaller/efivar" HOMEPAGE="https://github.com/rhinstaller/efivar"
@ -11,7 +11,7 @@ SRC_URI="https://github.com/rhinstaller/efivar/releases/download/${PV}/${P}.tar.
LICENSE="GPL-2" LICENSE="GPL-2"
SLOT="0/1" SLOT="0/1"
KEYWORDS="amd64 ~arm64 ~ia64 x86" KEYWORDS="amd64 ~arm arm64 ~ia64 ~ppc64 ~riscv x86"
RDEPEND="dev-libs/popt" RDEPEND="dev-libs/popt"
DEPEND="${RDEPEND} DEPEND="${RDEPEND}
@ -19,13 +19,18 @@ DEPEND="${RDEPEND}
virtual/pkgconfig virtual/pkgconfig
" "
PATCHES=(
"${FILESDIR}"/${PN}-37-ia64-relro.patch
)
src_prepare() { src_prepare() {
default default
sed -i -e s/-Werror// gcc.specs || die sed -i -e 's/-Werror //' gcc.specs || die
} }
src_configure() { src_configure() {
tc-export CC tc-export CC
export CC_FOR_BUILD=$(tc-getBUILD_CC)
tc-ld-disable-gold tc-ld-disable-gold
export libdir="/usr/$(get_libdir)" export libdir="/usr/$(get_libdir)"
unset LIBS # Bug 562004 unset LIBS # Bug 562004

View File

@ -0,0 +1,62 @@
# Copyright 2014-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
inherit toolchain-funcs
DESCRIPTION="Tools and library to manipulate EFI variables"
HOMEPAGE="https://github.com/rhinstaller/efivar"
SRC_URI="https://github.com/rhinstaller/efivar/releases/download/${PV}/${P}.tar.bz2"
LICENSE="GPL-2"
SLOT="0/1"
KEYWORDS="~amd64 ~arm ~arm64 ~ia64 ~ppc64 ~riscv ~x86"
IUSE="test"
RESTRICT="!test? ( test )"
BDEPEND="
app-text/mandoc
test? ( sys-boot/grub:2 )
"
RDEPEND="
dev-libs/popt
"
DEPEND="${RDEPEND}
>=sys-kernel/linux-headers-3.18
virtual/pkgconfig
"
src_prepare() {
local PATCHES=(
"${FILESDIR}"/efivar-38-ia64-relro.patch
"${FILESDIR}"/efivar-38-march-native.patch
"${FILESDIR}"/efivar-38-Makefile-dep.patch
"${FILESDIR}"/efivar-38-binutils-2.36.patch
)
default
}
src_configure() {
unset CROSS_COMPILE
export COMPILER=$(tc-getCC)
export HOSTCC=$(tc-getBUILD_CC)
tc-ld-disable-gold
export libdir="/usr/$(get_libdir)"
# https://bugs.gentoo.org/562004
unset LIBS
# Avoid -Werror
export ERRORS=
if [[ -n ${GCC_SPECS} ]]; then
# The environment overrides the command line.
GCC_SPECS+=":${S}/src/include/gcc.specs"
fi
# Used by tests/Makefile
export GRUB_PREFIX=grub
}

View File

@ -0,0 +1,37 @@
https://github.com/rhboot/efivar/pull/164
https://bugs.gentoo.org/749963
From: Sergei Trofimovich <slyfox@gentoo.org>
Date: Mon, 19 Oct 2020 19:05:01 +0100
Subject: [PATCH] gcc.specs: drop --fatal-warnings from linker options (ia64
compatibility)
```
$ LANG=C make HOSTCC=x86_64-pc-linux-gnu-gcc CC=ia64-unknown-linux-gnu-gcc HOST_ARCH=ia64
ia64-unknown-linux-gnu-gcc ... \
-o libefivar.so ...
/usr/libexec/gcc/ia64-unknown-linux-gnu/ld: warning: -z relro ignored
collect2: error: ld returned 1 exit status
make[1]: *** [/home/slyfox/dev/git/efivar/src/include/rules.mk:32: libefivar.so] Error 1
```
ia64 (and a few others) binutils target does not support '-z relro' and always
issues a warning. --fatal-warnings spec option turns the build into always failing one.
The change drops `--fatal-warnings` options from gcc.spec entirely.
Reported-by: Émeric Maschino
Bug: https://bugs.gentoo.org/749963
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
--- a/gcc.specs
+++ b/gcc.specs
@@ -11,7 +11,7 @@
+ %(efivar_cpp_options) -Wmaybe-uninitialized -fno-merge-constants -fvisibility=hidden %{!r:%{!fpie:%{!fPIE:%{!fpic:%{!fPIC:%{!fno-pic:-fPIE}}}}}}
*self_spec:
-+ %{!shared:%{!static:%{!r:-pie}}} %{static:-Wl,-no-fatal-warnings -Wl,-static -static -Wl,-z,relro,-z,now}
++ %{!shared:%{!static:%{!r:-pie}}} %{static:-Wl,-static -static -Wl,-z,relro,-z,now}
*link:
-+ %{!static:--fatal-warnings} --no-undefined-version --no-allow-shlib-undefined --add-needed -z now --build-id %{!static:%{!shared:-pie}} %{shared:-z relro} %{static:%<pie}
++ --no-undefined-version --no-allow-shlib-undefined --add-needed -z now --build-id %{!static:%{!shared:-pie}} %{shared:-z relro} %{static:%<pie}

View File

@ -0,0 +1,33 @@
From 847856cd72088fd5f2349be858745c632c46b6c8 Mon Sep 17 00:00:00 2001
From: Mike Gilbert <floppym@gentoo.org>
Date: Mon, 17 Jan 2022 11:42:53 -0500
Subject: [PATCH] Adjust dependency for libefivar and libefiboot objects
Depending on 'prep' causes all objects to be rebuilt every time 'make'
is invoked.
Depending on '$(GENERATED_SOURCES)' causes a build failure because
guid-symbols.c gets passed to the compiler due to a rule in rules.mk.
Depend on 'include/efivar/efivar-guids.h' directly to avoid these
issues.
Fixes: https://github.com/rhboot/efivar/issues/199
Signed-off-by: Mike Gilbert <floppym@gentoo.org>
---
src/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Makefile b/src/Makefile
index 0e423c44..c6006ebf 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -85,7 +85,7 @@ $(MAKEGUIDS_OUTPUT) : guids.txt
prep : makeguids $(GENERATED_SOURCES)
-$(LIBEFIVAR_OBJECTS) $(LIBEFIBOOT_OBJECTS) : prep
+$(LIBEFIVAR_OBJECTS) $(LIBEFIBOOT_OBJECTS) : include/efivar/efivar-guids.h
libefivar.a : | $(GENERATED_SOURCES)
libefivar.a : $(patsubst %.o,%.static.o,$(LIBEFIVAR_OBJECTS))

View File

@ -0,0 +1,30 @@
From 197a0874ea4010061b98b4b55eff65b33b1cd741 Mon Sep 17 00:00:00 2001
From: Robbie Harwood <rharwood@redhat.com>
Date: Mon, 17 Jan 2022 12:34:55 -0500
Subject: [PATCH] Add -T workaround for GNU ld 2.36
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
Resolves: #195
---
src/include/workarounds.mk | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/include/workarounds.mk b/src/include/workarounds.mk
index 31188342..143e7902 100644
--- a/src/include/workarounds.mk
+++ b/src/include/workarounds.mk
@@ -4,12 +4,12 @@
LD_FLAVOR := $(shell $(LD) --version | grep -E '^(LLD|GNU ld)'|sed 's/ .*//g')
LD_VERSION := $(shell $(LD) --version | grep -E '^(LLD|GNU ld)'|sed 's/.* //')
-# I haven't tested 2.36 here; 2.35 is definitely broken and 2.37 seems to work
+# 2.35 is definitely broken and 2.36 seems to work
LD_DASH_T := $(shell \
if [ "x${LD_FLAVOR}" = xLLD ] ; then \
echo '-T' ; \
elif [ "x${LD_FLAVOR}" = xGNU ] ; then \
- if echo "${LD_VERSION}" | grep -q -E '^2\.3[789]|^2\.[456789]|^[3456789]|^[[:digit:]][[:digit:]]' ; then \
+ if echo "${LD_VERSION}" | grep -q -E '^2\.3[6789]|^2\.[456789]|^[3456789]|^[[:digit:]][[:digit:]]' ; then \
echo '-T' ; \
else \
echo "" ; \

View File

@ -0,0 +1,45 @@
From 145c6593fa9206cc27229a9a40c49e4bed046739 Mon Sep 17 00:00:00 2001
From: Sergei Trofimovich <slyfox@gentoo.org>
Date: Mon, 19 Oct 2020 19:05:01 +0100
Subject: [PATCH] gcc.specs: drop --fatal-warnings from linker options (ia64
compatibility)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
```
$ LANG=C make HOSTCC=x86_64-pc-linux-gnu-gcc CC=ia64-unknown-linux-gnu-gcc HOST_ARCH=ia64
ia64-unknown-linux-gnu-gcc ... \
-o libefivar.so ...
/usr/libexec/gcc/ia64-unknown-linux-gnu/ld: warning: -z relro ignored
collect2: error: ld returned 1 exit status
make[1]: *** [/home/slyfox/dev/git/efivar/src/include/rules.mk:32: libefivar.so] Error 1
```
ia64 (and a few others) binutils target does not support '-z relro' and always
issues a warning. --fatal-warnings spec option turns the build into always failing one.
The change drops `--fatal-warnings` option from gcc.spec entirely.
Rejected upstream in https://github.com/rhboot/efivar/pull/164.
Reported-by: Émeric Maschino
Bug: https://bugs.gentoo.org/749963
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
---
src/include/gcc.specs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/include/gcc.specs b/src/include/gcc.specs
index ef28e2b..4deead5 100644
--- a/src/include/gcc.specs
+++ b/src/include/gcc.specs
@@ -5,4 +5,4 @@
+ %{!shared:%{!static:%{!r:-pie}}} %{static:-Wl,-no-fatal-warnings -Wl,-static -static -Wl,-z,relro,-z,now} -grecord-gcc-switches
*link:
-+ %{!static:--fatal-warnings} --no-undefined-version --no-allow-shlib-undefined --add-needed -z now --build-id %{!static:%{!shared:-pie}} %{shared:-z relro} %{static:%<pie}
++ --no-undefined-version --no-allow-shlib-undefined --add-needed -z now --build-id %{!static:%{!shared:-pie}} %{shared:-z relro} %{static:%<pie}
--
2.34.1

View File

@ -0,0 +1,37 @@
From 43d19f297548208ce549fd87faa41e6bb86bf9c3 Mon Sep 17 00:00:00 2001
From: Mike Gilbert <floppym@gentoo.org>
Date: Mon, 17 Jan 2022 10:13:31 -0500
Subject: [PATCH] Drop "-march=native" from HOST flags
GCC does not support -march=native on some targets (ia64, riscv).
The performance enhancement for makeguids isn't worth the trouble it
causes.
Bug: https://bugs.gentoo.org/831334
Signed-off-by: Mike Gilbert <floppym@gentoo.org>
---
src/include/defaults.mk | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/src/include/defaults.mk b/src/include/defaults.mk
index 632b1551..9024a3a1 100644
--- a/src/include/defaults.mk
+++ b/src/include/defaults.mk
@@ -71,16 +71,10 @@ override SOFLAGS = $(_SOFLAGS) \
-Wl,--version-script=$(MAP) \
$(call family,SOFLAGS)
-HOST_ARCH=$(shell uname -m)
-ifneq ($(HOST_ARCH),ia64)
- HOST_MARCH=-march=native
-else
- HOST_MARCH=
-endif
HOST_CPPFLAGS ?= $(CPPFLAGS)
override _HOST_CPPFLAGS := $(HOST_CPPFLAGS)
override HOST_CPPFLAGS = $(_HOST_CPPFLAGS) \
- -DEFIVAR_BUILD_ENVIRONMENT $(HOST_MARCH)
+ -DEFIVAR_BUILD_ENVIRONMENT
HOST_CFLAGS_GCC ?=
HOST_CFLAGS_CLANG ?=
HOST_CFLAGS ?= $(CFLAGS) $(call family,HOST_CFLAGS)

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> <!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata> <pkgmetadata>
<maintainer type="person"> <maintainer type="person">
<email>floppym@gentoo.org</email> <email>floppym@gentoo.org</email>