Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / development / libraries / libbacktrace / 0001-libbacktrace-avoid-libtool-wrapping-tests.patch
blob3ee3198cb2291db8e333589fd5274278e5da5117
1 From 1cf6b108882669f1b20c18fb5f2d6dff0fc83296 Mon Sep 17 00:00:00 2001
2 From: Jan Tojnar <jtojnar@gmail.com>
3 Date: Sat, 24 Dec 2022 15:31:51 +0100
4 Subject: [PATCH 1/4] libbacktrace: avoid libtool wrapping tests
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
9 When `--enable-shared` is used, libtool will produce shell scripts
10 instead of programs, preventing separate debug info from being generated:
12 objcopy --only-keep-debug btest btest_gnudebuglink.debug
13 objcopy: btest: file format not recognized
14 make[2]: *** [Makefile:2615: btest_gnudebuglink] Error 1
16 Let’s make it properly set rpath with `-no-install` flag,
17 so that wrappers are not needed, as mentioned on
18 https://autotools.info/libtool/wrappers.html
19 ---
20 Makefile.am | 28 +++++++++++++++++++++++-----
21 1 file changed, 23 insertions(+), 5 deletions(-)
23 diff --git a/Makefile.am b/Makefile.am
24 index c53cbae..6eab991 100644
25 --- a/Makefile.am
26 +++ b/Makefile.am
27 @@ -107,6 +107,8 @@ check_DATA =
28 # Flags to use when compiling test programs.
29 libbacktrace_TEST_CFLAGS = $(EXTRA_FLAGS) $(WARN_FLAGS) -g
31 +libbacktrace_TEST_LDFLAGS = -no-install
33 if USE_DSYMUTIL
35 %.dSYM: %
36 @@ -171,48 +173,56 @@ xcoff_%.c: xcoff.c
38 test_elf_32_SOURCES = test_format.c testlib.c
39 test_elf_32_CFLAGS = $(libbacktrace_TEST_CFLAGS)
40 +test_elf_32_LDFLAGS = $(libbacktrace_TEST_LDFLAGS)
41 test_elf_32_LDADD = libbacktrace_noformat.la elf_32.lo
43 BUILDTESTS += test_elf_32
45 test_elf_64_SOURCES = test_format.c testlib.c
46 test_elf_64_CFLAGS = $(libbacktrace_TEST_CFLAGS)
47 +test_elf_64_LDFLAGS = $(libbacktrace_TEST_LDFLAGS)
48 test_elf_64_LDADD = libbacktrace_noformat.la elf_64.lo
50 BUILDTESTS += test_elf_64
52 test_macho_SOURCES = test_format.c testlib.c
53 test_macho_CFLAGS = $(libbacktrace_TEST_CFLAGS)
54 +test_macho_LDFLAGS = $(libbacktrace_TEST_LDFLAGS)
55 test_macho_LDADD = libbacktrace_noformat.la macho.lo
57 BUILDTESTS += test_macho
59 test_xcoff_32_SOURCES = test_format.c testlib.c
60 test_xcoff_32_CFLAGS = $(libbacktrace_TEST_CFLAGS)
61 +test_xcoff_32_LDFLAGS = $(libbacktrace_TEST_LDFLAGS)
62 test_xcoff_32_LDADD = libbacktrace_noformat.la xcoff_32.lo
64 BUILDTESTS += test_xcoff_32
66 test_xcoff_64_SOURCES = test_format.c testlib.c
67 test_xcoff_64_CFLAGS = $(libbacktrace_TEST_CFLAGS)
68 +test_xcoff_64_LDFLAGS = $(libbacktrace_TEST_LDFLAGS)
69 test_xcoff_64_LDADD = libbacktrace_noformat.la xcoff_64.lo
71 BUILDTESTS += test_xcoff_64
73 test_pecoff_SOURCES = test_format.c testlib.c
74 test_pecoff_CFLAGS = $(libbacktrace_TEST_CFLAGS)
75 +test_pecoff_LDFLAGS = $(libbacktrace_TEST_LDFLAGS)
76 test_pecoff_LDADD = libbacktrace_noformat.la pecoff.lo
78 BUILDTESTS += test_pecoff
80 test_unknown_SOURCES = test_format.c testlib.c
81 test_unknown_CFLAGS = $(libbacktrace_TEST_CFLAGS)
82 +test_unknown_LDFLAGS = $(libbacktrace_TEST_LDFLAGS)
83 test_unknown_LDADD = libbacktrace_noformat.la unknown.lo
85 BUILDTESTS += test_unknown
87 unittest_SOURCES = unittest.c testlib.c
88 unittest_CFLAGS = $(libbacktrace_TEST_CFLAGS)
89 +unittest_LDFLAGS = $(libbacktrace_TEST_LDFLAGS)
90 unittest_LDADD = libbacktrace.la
92 BUILDTESTS += unittest
93 @@ -253,7 +263,7 @@ if HAVE_OBJCOPY_DEBUGLINK
95 b2test_SOURCES = $(btest_SOURCES)
96 b2test_CFLAGS = $(libbacktrace_TEST_CFLAGS)
97 -b2test_LDFLAGS = -Wl,--build-id
98 +b2test_LDFLAGS = -Wl,--build-id $(libbacktrace_TEST_LDFLAGS)
99 b2test_LDADD = libbacktrace_elf_for_test.la
101 check_PROGRAMS += b2test
102 @@ -263,7 +273,7 @@ if HAVE_DWZ
104 b3test_SOURCES = $(btest_SOURCES)
105 b3test_CFLAGS = $(libbacktrace_TEST_CFLAGS)
106 -b3test_LDFLAGS = -Wl,--build-id
107 +b3test_LDFLAGS = -Wl,--build-id $(libbacktrace_TEST_LDFLAGS)
108 b3test_LDADD = libbacktrace_elf_for_test.la
110 check_PROGRAMS += b3test
111 @@ -276,6 +286,7 @@ endif HAVE_ELF
113 btest_SOURCES = btest.c testlib.c
114 btest_CFLAGS = $(libbacktrace_TEST_CFLAGS) -O
115 +btest_LDFLAGS = $(libbacktrace_TEST_LDFLAGS)
116 btest_LDADD = libbacktrace.la
118 BUILDTESTS += btest
119 @@ -330,6 +341,7 @@ endif HAVE_DWZ
121 stest_SOURCES = stest.c
122 stest_CFLAGS = $(libbacktrace_TEST_CFLAGS)
123 +stest_LDFLAGS = $(libbacktrace_TEST_LDFLAGS)
124 stest_LDADD = libbacktrace.la
126 BUILDTESTS += stest
127 @@ -352,6 +364,7 @@ if HAVE_ELF
129 ztest_SOURCES = ztest.c testlib.c
130 ztest_CFLAGS = $(libbacktrace_TEST_CFLAGS) -DSRCDIR=\"$(srcdir)\"
131 +ztest_LDFLAGS = $(libbacktrace_TEST_LDFLAGS)
132 ztest_LDADD = libbacktrace.la
133 ztest_alloc_LDADD = libbacktrace_alloc.la
135 @@ -371,6 +384,7 @@ BUILDTESTS += ztest_alloc
137 zstdtest_SOURCES = zstdtest.c testlib.c
138 zstdtest_CFLAGS = $(libbacktrace_TEST_CFLAGS) -DSRCDIR=\"$(srcdir)\"
139 +zstdtest_LDFLAGS = $(libbacktrace_TEST_LDFLAGS)
140 zstdtest_LDADD = libbacktrace.la
141 zstdtest_alloc_LDADD = libbacktrace_alloc.la
143 @@ -392,6 +406,7 @@ endif HAVE_ELF
145 edtest_SOURCES = edtest.c edtest2_build.c testlib.c
146 edtest_CFLAGS = $(libbacktrace_TEST_CFLAGS)
147 +edtest_LDFLAGS = $(libbacktrace_TEST_LDFLAGS)
148 edtest_LDADD = libbacktrace.la
150 BUILDTESTS += edtest
151 @@ -422,6 +437,7 @@ BUILDTESTS += ttest
153 ttest_SOURCES = ttest.c testlib.c
154 ttest_CFLAGS = $(libbacktrace_TEST_CFLAGS) -pthread
155 +ttest_LDFLAGS = $(libbacktrace_TEST_LDFLAGS)
156 ttest_LDADD = libbacktrace.la
158 if USE_DSYMUTIL
159 @@ -460,12 +476,12 @@ if HAVE_COMPRESSED_DEBUG
161 ctestg_SOURCES = btest.c testlib.c
162 ctestg_CFLAGS = $(libbacktrace_TEST_CFLAGS)
163 -ctestg_LDFLAGS = -Wl,--compress-debug-sections=zlib-gnu
164 +ctestg_LDFLAGS = -Wl,--compress-debug-sections=zlib-gnu $(libbacktrace_TEST_LDFLAGS)
165 ctestg_LDADD = libbacktrace.la
167 ctesta_SOURCES = btest.c testlib.c
168 ctesta_CFLAGS = $(libbacktrace_TEST_CFLAGS)
169 -ctesta_LDFLAGS = -Wl,--compress-debug-sections=zlib-gabi
170 +ctesta_LDFLAGS = -Wl,--compress-debug-sections=zlib-gabi $(libbacktrace_TEST_LDFLAGS)
171 ctesta_LDADD = libbacktrace.la
173 BUILDTESTS += ctestg ctesta
174 @@ -474,7 +490,7 @@ if HAVE_COMPRESSED_DEBUG_ZSTD
176 ctestzstd_SOURCES = btest.c testlib.c
177 ctestzstd_CFLAGS = $(libbacktrace_TEST_CFLAGS)
178 -ctestzstd_LDFLAGS = -Wl,--compress-debug-sections=zstd
179 +ctestzstd_LDFLAGS = -Wl,--compress-debug-sections=zstd $(libbacktrace_TEST_LDFLAGS)
180 ctestzstd_LDADD = libbacktrace.la
182 BUILDTESTS += ctestzstd
183 @@ -521,6 +537,7 @@ endif
185 mtest_SOURCES = mtest.c testlib.c
186 mtest_CFLAGS = $(libbacktrace_TEST_CFLAGS) -O
187 +mtest_LDFLAGS = $(libbacktrace_TEST_LDFLAGS)
188 mtest_LDADD = libbacktrace.la
190 BUILDTESTS += mtest
191 @@ -553,6 +570,7 @@ if HAVE_ELF
193 xztest_SOURCES = xztest.c testlib.c
194 xztest_CFLAGS = $(libbacktrace_TEST_CFLAGS) -DSRCDIR=\"$(srcdir)\"
195 +xztest_LDFLAGS = $(libbacktrace_TEST_LDFLAGS)
196 xztest_LDADD = libbacktrace.la
198 xztest_alloc_SOURCES = $(xztest_SOURCES)
200 2.38.1