Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-devel/gdb/
Date: Sat, 04 Mar 2023 02:30:06
Message-Id: 1677896973.7766b01c2f7ac6856cd21f8261b631bb88060bda.sam@gentoo
1 commit: 7766b01c2f7ac6856cd21f8261b631bb88060bda
2 Author: James Le Cuirot <chewi <AT> gentoo <DOT> org>
3 AuthorDate: Sun Feb 26 23:42:33 2023 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Sat Mar 4 02:29:33 2023 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7766b01c
7
8 sys-devel/gdb: Fix cross-compiling (properly) and prefix sysroot
9
10 https://github.com/gentoo/gentoo/pull/25896 tried to address cross-compiling in
11 the wrong way by setting the runtime sysroot and the libdir. The build uses the
12 latter to find dependent libraries by default, a common technique in GNU
13 software.
14
15 This behaviour can be avoided by passing the "without-prefix" configure option
16 for each library, allowing the runtime sysroot and the libdir to be set as they
17 should be. Contrary to what you might expect, the sysroot should actually not be
18 set at all except when building cross-*/gdb, otherwise the paths get double
19 prefixed at runtime.
20
21 gdb's configure script also has a --with-build-sysroot option that should be set
22 to assist with cross-compiling. This does not influence runtime behaviour.
23
24 The includedir for cross-*/gdb has been changed to prevent it from installing
25 under /usr/${CTARGET}, where installed headers would collide with those from a
26 cross-compiled sys-devel/gdb build. /usr/include/${CTARGET}/gdb is consistent
27 with the files we install under /usr/share, as well as the scheme we use for
28 multilib headers, e.g. /usr/include/i686-pc-linux-gnu.
29
30 Closes: https://bugs.gentoo.org/896008
31 Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org>
32 Closes: https://github.com/gentoo/gentoo/pull/29819
33 Signed-off-by: Sam James <sam <AT> gentoo.org>
34
35 .../gdb/{gdb-13.1.ebuild => gdb-13.1-r1.ebuild} | 23 +++++++++++-----------
36 sys-devel/gdb/gdb-9999.ebuild | 23 +++++++++++-----------
37 2 files changed, 22 insertions(+), 24 deletions(-)
38
39 diff --git a/sys-devel/gdb/gdb-13.1.ebuild b/sys-devel/gdb/gdb-13.1-r1.ebuild
40 similarity index 93%
41 rename from sys-devel/gdb/gdb-13.1.ebuild
42 rename to sys-devel/gdb/gdb-13.1-r1.ebuild
43 index d356d5e3ecab..bc86849c6276 100644
44 --- a/sys-devel/gdb/gdb-13.1.ebuild
45 +++ b/sys-devel/gdb/gdb-13.1-r1.ebuild
46 @@ -160,21 +160,13 @@ src_configure() {
47 # But the check does not quite work on i686: bug #760926.
48 $(use_enable cet)
49
50 - # We need to set both configure options, --with-sysroot and --libdir,
51 - # to fix cross build issues that happen when configuring gmp.
52 - # We explicitly need --libdir. Having only --with-sysroot without
53 - # --libdir would not fix the build issues.
54 - # For some reason, it is not enough to set only --with-sysroot,
55 - # also not enough to pass --with-gmp-xxx options.
56 - --with-sysroot="${ESYSROOT}"
57 - --libdir="${ESYSROOT}/usr/$(get_libdir)"
58 + # Helps when cross-compiling. Not to be confused with --with-sysroot.
59 + --with-build-sysroot="${ESYSROOT}"
60 )
61
62 - local sysroot="${EPREFIX}/usr/${CTARGET}"
63 -
64 is_cross && myconf+=(
65 - --with-sysroot="${sysroot}"
66 - --includedir="${sysroot}/usr/include"
67 + --with-sysroot="\${prefix}/${CTARGET}"
68 + --includedir="\${prefix}/include/${CTARGET}"
69 --with-gdb-datadir="\${datadir}/gdb/${CTARGET}"
70 )
71
72 @@ -211,6 +203,13 @@ src_configure() {
73 $(use_with xxhash)
74 $(use_with guile)
75 $(use_with zstd)
76 +
77 + # Find libraries using the toolchain sysroot rather than the configured
78 + # prefix. Needed when cross-compiling.
79 + #
80 + # Check which libraries to apply this to with:
81 + # "${S}"/gdb/configure --help | grep without-lib | sort
82 + --without-lib{babeltrace,expat,gmp,iconv,ipt,lzma,mpfr,xxhash}-prefix
83 )
84
85 if use sparc-solaris || use x86-solaris ; then
86
87 diff --git a/sys-devel/gdb/gdb-9999.ebuild b/sys-devel/gdb/gdb-9999.ebuild
88 index d356d5e3ecab..bc86849c6276 100644
89 --- a/sys-devel/gdb/gdb-9999.ebuild
90 +++ b/sys-devel/gdb/gdb-9999.ebuild
91 @@ -160,21 +160,13 @@ src_configure() {
92 # But the check does not quite work on i686: bug #760926.
93 $(use_enable cet)
94
95 - # We need to set both configure options, --with-sysroot and --libdir,
96 - # to fix cross build issues that happen when configuring gmp.
97 - # We explicitly need --libdir. Having only --with-sysroot without
98 - # --libdir would not fix the build issues.
99 - # For some reason, it is not enough to set only --with-sysroot,
100 - # also not enough to pass --with-gmp-xxx options.
101 - --with-sysroot="${ESYSROOT}"
102 - --libdir="${ESYSROOT}/usr/$(get_libdir)"
103 + # Helps when cross-compiling. Not to be confused with --with-sysroot.
104 + --with-build-sysroot="${ESYSROOT}"
105 )
106
107 - local sysroot="${EPREFIX}/usr/${CTARGET}"
108 -
109 is_cross && myconf+=(
110 - --with-sysroot="${sysroot}"
111 - --includedir="${sysroot}/usr/include"
112 + --with-sysroot="\${prefix}/${CTARGET}"
113 + --includedir="\${prefix}/include/${CTARGET}"
114 --with-gdb-datadir="\${datadir}/gdb/${CTARGET}"
115 )
116
117 @@ -211,6 +203,13 @@ src_configure() {
118 $(use_with xxhash)
119 $(use_with guile)
120 $(use_with zstd)
121 +
122 + # Find libraries using the toolchain sysroot rather than the configured
123 + # prefix. Needed when cross-compiling.
124 + #
125 + # Check which libraries to apply this to with:
126 + # "${S}"/gdb/configure --help | grep without-lib | sort
127 + --without-lib{babeltrace,expat,gmp,iconv,ipt,lzma,mpfr,xxhash}-prefix
128 )
129
130 if use sparc-solaris || use x86-solaris ; then