Gentoo Archives: gentoo-dev

From: Benda Xu <heroxbd@g.o>
To: gentoo-dev@l.g.o
Cc: Benda Xu <heroxbd@g.o>
Subject: [gentoo-dev] [PATCH 5/7] toolchain.eclass: Prepend/strip EPREFIX.
Date: Sun, 08 Jan 2017 05:47:07
Message-Id: 1483854247-10948-6-git-send-email-heroxbd@gentoo.org
In Reply to: [gentoo-dev] [PATCH 0/7] RFC1: toolchain.eclass prefix support by Benda Xu
1 Directory prefixify part 3.
2
3 Raw directories are prepended by EPREFIX. Directories passed to
4 ebuild helpers are EPREFIX stripped.
5 ---
6 eclass/toolchain.eclass | 34 +++++++++++++++++-----------------
7 1 file changed, 17 insertions(+), 17 deletions(-)
8
9 diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
10 index 17950c1..f54316c 100644
11 --- a/eclass/toolchain.eclass
12 +++ b/eclass/toolchain.eclass
13 @@ -93,7 +93,7 @@ fi
14
15 export GCC_FILESDIR=${GCC_FILESDIR:-${FILESDIR}}
16
17 -PREFIX=${TOOLCHAIN_PREFIX:-/usr}
18 +PREFIX=${TOOLCHAIN_PREFIX:-${EPREFIX}/usr}
19
20 if tc_version_is_at_least 3.4.0 ; then
21 LIBPATH=${TOOLCHAIN_LIBPATH:-${PREFIX}/lib/gcc/${CTARGET}/${GCC_CONFIG_VER}}
22 @@ -1267,7 +1267,7 @@ toolchain_src_configure() {
23 echo "${S}"/configure "${confgcc[@]}"
24 # Older gcc versions did not detect bash and re-exec itself, so force the
25 # use of bash. Newer ones will auto-detect, but this is not harmeful.
26 - CONFIG_SHELL="/bin/bash" \
27 + CONFIG_SHELL="${EPREFIX}/bin/bash" \
28 bash "${S}"/configure "${confgcc[@]}" || die "failed to run configure"
29
30 # return to whatever directory we were in before
31 @@ -1703,11 +1703,11 @@ toolchain_src_install() {
32 if [[ -f ${CTARGET}-${x} ]] ; then
33 if ! is_crosscompile ; then
34 ln -sf ${CTARGET}-${x} ${x}
35 - dosym ${BINPATH}/${CTARGET}-${x} \
36 + dosym ${BINPATH#${EPREFIX}}/${CTARGET}-${x} \
37 /usr/bin/${x}-${GCC_CONFIG_VER}
38 fi
39 # Create versioned symlinks
40 - dosym ${BINPATH}/${CTARGET}-${x} \
41 + dosym ${BINPATH#${EPREFIX}}/${CTARGET}-${x} \
42 /usr/bin/${CTARGET}-${x}-${GCC_CONFIG_VER}
43 fi
44
45 @@ -1745,11 +1745,11 @@ toolchain_src_install() {
46 fi
47 fi
48 has noinfo ${FEATURES} \
49 - && rm -r "${D}/${DATAPATH}"/info \
50 - || prepinfo "${DATAPATH}"
51 + && rm -r "${D}${DATAPATH}"/info \
52 + || prepinfo "${DATAPATH#${EPREFIX}}"
53 has noman ${FEATURES} \
54 - && rm -r "${D}/${DATAPATH}"/man \
55 - || prepman "${DATAPATH}"
56 + && rm -r "${D}${DATAPATH}"/man \
57 + || prepman "${DATAPATH#${EPREFIX}}"
58 fi
59 # prune empty dirs left behind
60 find "${D}" -depth -type d -delete 2>/dev/null
61 @@ -1999,7 +1999,7 @@ copy_minispecs_gcc_specs() {
62 create_gcc_env_entry hardenednossp
63 fi
64 create_gcc_env_entry vanilla
65 - insinto ${LIBPATH}
66 + insinto ${LIBPATH#${EPREFIX}}
67 doins "${WORKDIR}"/specs/*.specs || die "failed to install specs"
68 # Build system specs file which, if it exists, must be a complete set of
69 # specs as it completely and unconditionally overrides the builtin specs.
70 @@ -2014,21 +2014,21 @@ gcc_slot_java() {
71 local x
72
73 # Move Java headers to compiler-specific dir
74 - for x in "${D}"${PREFIX}/include/gc*.h "${D}"${PREFIX}/include/j*.h ; do
75 - [[ -f ${x} ]] && mv -f "${x}" "${D}"${LIBPATH}/include/
76 + for x in "${D}${PREFIX}"/include/gc*.h "${D}${PREFIX}"/include/j*.h ; do
77 + [[ -f ${x} ]] && mv -f "${x}" "${D}${LIBPATH}"/include/
78 done
79 for x in gcj gnu java javax org ; do
80 if [[ -d ${D}${PREFIX}/include/${x} ]] ; then
81 - dodir /${LIBPATH}/include/${x}
82 - mv -f "${D}"${PREFIX}/include/${x}/* "${D}"${LIBPATH}/include/${x}/
83 - rm -rf "${D}"${PREFIX}/include/${x}
84 + dodir /${LIBPATH#${EPREFIX}}/include/${x}
85 + mv -f "${D}${PREFIX}"/include/${x}/* "${D}${LIBPATH}"/include/${x}/
86 + rm -rf "${D}${PREFIX}"/include/${x}
87 fi
88 done
89
90 if [[ -d ${D}${PREFIX}/lib/security ]] || [[ -d ${D}${PREFIX}/$(get_libdir)/security ]] ; then
91 - dodir /${LIBPATH}/security
92 - mv -f "${D}"${PREFIX}/lib*/security/* "${D}"${LIBPATH}/security
93 - rm -rf "${D}"${PREFIX}/lib*/security
94 + dodir /${LIBPATH#${EPREFIX}}/security
95 + mv -f "${D}${PREFIX}"/lib*/security/* "${D}${LIBPATH}"/security
96 + rm -rf "${D}${PREFIX}"/lib*/security
97 fi
98
99 # Move random gcj files to compiler-specific directories
100 --
101 2.8.3