summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2023-06-10 22:09:17 +0100
committerSam James <sam@gentoo.org>2023-06-10 22:11:22 +0100
commit26ab8afac246ad7858468bc8b72b58e4ce7ea9c9 (patch)
tree8edafa766c1a6cc6e37ddc970184912721e6797b /dev-util/libtree
parentdev-libs/libcbor: drop 0.9.0, 0.10.1 (diff)
downloadgentoo-26ab8afac246ad7858468bc8b72b58e4ce7ea9c9.tar.gz
gentoo-26ab8afac246ad7858468bc8b72b58e4ce7ea9c9.tar.bz2
gentoo-26ab8afac246ad7858468bc8b72b58e4ce7ea9c9.zip
dev-util/libtree: fix tests w/ modern c
Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'dev-util/libtree')
-rw-r--r--dev-util/libtree/files/libtree-3.1.1-modern-c.patch75
-rw-r--r--dev-util/libtree/libtree-3.1.1.ebuild6
2 files changed, 80 insertions, 1 deletions
diff --git a/dev-util/libtree/files/libtree-3.1.1-modern-c.patch b/dev-util/libtree/files/libtree-3.1.1-modern-c.patch
new file mode 100644
index 000000000000..371f0a8bcb63
--- /dev/null
+++ b/dev-util/libtree/files/libtree-3.1.1-modern-c.patch
@@ -0,0 +1,75 @@
+https://github.com/haampie/libtree/commit/eb56287c1b4eb3b267524ab1e6e31f042b713395
+
+From eb56287c1b4eb3b267524ab1e6e31f042b713395 Mon Sep 17 00:00:00 2001
+From: Florian Weimer <fweimer@redhat.com>
+Date: Sun, 15 Jan 2023 22:49:37 +0100
+Subject: [PATCH] Avoid implicit function declarations in tests (#84)
+
+Future compilers are likely to reject implicit function declarations
+by default, causing these tests to fail. Also replace () with (void)
+where appropriate in the changed tests.
+--- a/tests/01_origin/Makefile
++++ b/tests/01_origin/Makefile
+@@ -7,13 +7,13 @@ LD_LIBRARY_PATH=
+ all: check
+
+ liba.so:
+- echo 'int f(){return 1;}' | $(CC) -shared -Wl,-soname,$@ -o $@ -nostdlib -x c -
++ echo 'int f(void){return 1;}' | $(CC) -shared -Wl,-soname,$@ -o $@ -nostdlib -x c -
+
+ exe_rpath: liba.so
+- echo 'int _start(){return f();}' | $(CC) -o $@ -Wl,--no-as-needed -Wl,--disable-new-dtags '-Wl,-rpath,$$ORIGIN' -Wno-implicit-function-declaration -nostdlib liba.so -x c -
++ echo 'int f(void); int _start(void){return f();}' | $(CC) -o $@ -Wl,--no-as-needed -Wl,--disable-new-dtags '-Wl,-rpath,$$ORIGIN' -Wno-implicit-function-declaration -nostdlib liba.so -x c -
+
+ exe_runpath: liba.so
+- echo 'int _start(){return f();}' | $(CC) -o $@ -Wl,--no-as-needed -Wl,--enable-new-dtags '-Wl,-rpath,$$ORIGIN' -Wno-implicit-function-declaration -nostdlib liba.so -x c -
++ echo 'int f(void); int _start(void){return f();}' | $(CC) -o $@ -Wl,--no-as-needed -Wl,--enable-new-dtags '-Wl,-rpath,$$ORIGIN' -Wno-implicit-function-declaration -nostdlib liba.so -x c -
+
+ check: exe_rpath exe_runpath
+ ../../libtree exe_rpath
+--- a/tests/02_rpath_of_parents_parent/Makefile
++++ b/tests/02_rpath_of_parents_parent/Makefile
+@@ -8,13 +8,13 @@ LD_LIBRARY_PATH=
+ all: check
+
+ libb.so:
+- echo 'int g(){return 1;}' | $(CC) -shared -Wl,-soname,$@ -o $@ -nostdlib -x c -
++ echo 'int g(void){return 1;}' | $(CC) -shared -Wl,-soname,$@ -o $@ -nostdlib -x c -
+
+ liba.so: libb.so
+- echo 'int f(){return g();}' | $(CC) -shared -Wl,--no-as-needed -Wl,-soname,$@ -o $@ -Wno-implicit-function-declaration libb.so -nostdlib -x c -
++ echo 'int g(void); int f(void){return g();}' | $(CC) -shared -Wl,--no-as-needed -Wl,-soname,$@ -o $@ -Wno-implicit-function-declaration libb.so -nostdlib -x c -
+
+ exe: liba.so
+- echo 'int _start(){return f();}' | $(CC) -o $@ -Wl,--no-as-needed -Wl,--disable-new-dtags '-Wl,-rpath,$$ORIGIN' '-Wl,-rpath-link,$(CURDIR)' -Wno-implicit-function-declaration -nostdlib -L. -la -x c -
++ echo 'int f(void); int _start(){return f();}' | $(CC) -o $@ -Wl,--no-as-needed -Wl,--disable-new-dtags '-Wl,-rpath,$$ORIGIN' '-Wl,-rpath-link,$(CURDIR)' -Wno-implicit-function-declaration -nostdlib -L. -la -x c -
+
+ check: exe liba.so
+ ! ../../libtree liba.so # should not find libb.so
+--- a/tests/04_rpath_over_env_over_runpath/Makefile
++++ b/tests/04_rpath_over_env_over_runpath/Makefile
+@@ -13,19 +13,19 @@ dir:
+ mkdir $@
+
+ dir/liba.so: dir
+- echo 'int a(){return 42;}' | $(CC) -shared -Wl,-soname,$(@F) -Wl,--no-as-needed -o $@ -nostdlib -x c -
++ echo 'int a(void){return 42;}' | $(CC) -shared -Wl,-soname,$(@F) -Wl,--no-as-needed -o $@ -nostdlib -x c -
+
+ dir/libb.so: dir/liba.so
+- echo 'int b(){return a();}' | $(CC) -shared -Wl,-soname,$(@F) -Wl,--no-as-needed -Wl,--disable-new-dtags '-Wl,-rpath,$$ORIGIN' -Wno-implicit-function-declaration -o $@ -nostdlib dir/liba.so -x c -
++ echo 'int a(void); int b(void){return a();}' | $(CC) -shared -Wl,-soname,$(@F) -Wl,--no-as-needed -Wl,--disable-new-dtags '-Wl,-rpath,$$ORIGIN' -Wno-implicit-function-declaration -o $@ -nostdlib dir/liba.so -x c -
+
+ libb.so:
+ echo 'int b(){return 10;}' | $(CC) -shared -Wl,-soname,$(@F) -Wl,--no-as-needed -o $@ -Wno-implicit-function-declaration -nostdlib -x c -
+
+ exe_rpath: libb.so
+- echo 'int _start(){return b();}' | $(CC) -Wl,--no-as-needed -Wl,--disable-new-dtags "-Wl,-rpath,$(CURDIR)" libb.so -o $@ -Wno-implicit-function-declaration -nostdlib -x c -
++ echo 'int b(void); int _start(void){return b();}' | $(CC) -Wl,--no-as-needed -Wl,--disable-new-dtags "-Wl,-rpath,$(CURDIR)" libb.so -o $@ -Wno-implicit-function-declaration -nostdlib -x c -
+
+ exe_runpath: libb.so
+- echo 'int _start(){return b();}' | $(CC) -Wl,--no-as-needed -Wl,--enable-new-dtags "-Wl,-rpath,$(CURDIR)" libb.so -o $@ -Wno-implicit-function-declaration -nostdlib -x c -
++ echo 'int b(void); int _start(void){return b();}' | $(CC) -Wl,--no-as-needed -Wl,--enable-new-dtags "-Wl,-rpath,$(CURDIR)" libb.so -o $@ -Wno-implicit-function-declaration -nostdlib -x c -
+
+ check: exe_rpath exe_runpath dir/libb.so
+ ../../libtree exe_rpath
+
diff --git a/dev-util/libtree/libtree-3.1.1.ebuild b/dev-util/libtree/libtree-3.1.1.ebuild
index 6ed6a5aae88a..78f8742c0517 100644
--- a/dev-util/libtree/libtree-3.1.1.ebuild
+++ b/dev-util/libtree/libtree-3.1.1.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
@@ -13,6 +13,10 @@ LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64"
+PATCHES=(
+ "${FILESDIR}"/${P}-modern-c.patch
+)
+
src_configure() {
tc-export CC
}