Gentoo Archives: gentoo-dev

From: Sam James <sam@g.o>
To: gentoo-dev@l.g.o
Cc: cross@g.o, base-system@g.o, chewi@g.o, Sam James <sam@g.o>
Subject: [gentoo-dev] [PATCH 1/4] autotools.eclass: don't inject -I${SYSROOT} to aclocal
Date: Mon, 17 Jan 2022 11:10:21
Message-Id: 20220117110950.139015-1-sam@gentoo.org
1 When -I${SYSROOT} is injected, it'll override the default of -Im4, which
2 results in trying to install macros to ${SYSROOT} (a sandbox violation)
3 when they can't be found.
4
5 From aclocal(1):
6 ```
7 -I DIR add directory to search list for .m4 files
8
9 --install
10 copy third-party files to the first -I directory
11 ```
12
13 The first directry is normally -Im4 if anything, whereas when injected
14 (when ${SYSROOT} is defined), it ends up being ${SYSROOT}, not m4 (so
15 we try to copy macros to somewhere outside of the build directory).
16
17 In EAPI 7+, this is almost always the case! We don't generally expect
18 to find macros (particularly things like autoconf-archive) in ${SYSROOT}
19 because that's for DEPEND-class dependencies, then they end up being
20 copied in unnecessarily and wrongly.
21
22 We could drop this just for < EAPI 7, but I'm not sure there's much
23 point there either. As Chewi observed in bug 677002, you can't
24 assume they'll be present in ${SYSROOT} anyway, and frankly,
25 the cross-compilation (and --root, --sysroot, and so on) situation
26 is rather bleak for earlier EAPIs, which is why we did all that
27 work for 7.
28
29 Bug: https://bugs.gentoo.org/710792
30 Closes: https://bugs.gentoo.org/677002
31 Closes: https://bugs.gentoo.org/738918
32 Thanks-to: James Le Cuirot <chewi@g.o>
33 Signed-off-by: Sam James <sam@g.o>
34 ---
35 eclass/autotools.eclass | 8 +-------
36 1 file changed, 1 insertion(+), 7 deletions(-)
37
38 diff --git a/eclass/autotools.eclass b/eclass/autotools.eclass
39 index 95c92cc6df8ca..e2572290f0cbe 100644
40 --- a/eclass/autotools.eclass
41 +++ b/eclass/autotools.eclass
42 @@ -1,4 +1,4 @@
43 -# Copyright 1999-2021 Gentoo Authors
44 +# Copyright 1999-2022 Gentoo Authors
45 # Distributed under the terms of the GNU General Public License v2
46
47 # @ECLASS: autotools.eclass
48 @@ -666,12 +666,6 @@ autotools_m4sysdir_include() {
49 # First try to use the paths the system integrator has set up.
50 local paths=( $(eval echo ${AT_SYS_M4DIR}) )
51
52 - if [[ ${#paths[@]} -eq 0 && -n ${SYSROOT} ]] ; then
53 - # If they didn't give us anything, then default to the SYSROOT.
54 - # This helps when cross-compiling.
55 - local path="${SYSROOT}/usr/share/aclocal"
56 - [[ -d ${path} ]] && paths+=( "${path}" )
57 - fi
58 _autotools_m4dir_include "${paths[@]}"
59 }
60
61 --
62 2.34.1

Replies