1 |
commit: 0af56bfa67625683611aee6b65262c0a9743df98 |
2 |
Author: Benda Xu <heroxbd <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Jul 7 02:09:52 2016 +0000 |
4 |
Commit: Benda XU <heroxbd <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Jul 7 02:40:57 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=0af56bfa |
7 |
|
8 |
scripts/bootstrap-prefix.sh: support sys-libs/glibc. |
9 |
- lto of gcc should be disabled. ld points to the host dynamic |
10 |
loader and gcc points to the RAP one, ld cannot load the gcc |
11 |
lto plugin. |
12 |
|
13 |
- stage tools should be used first in stage3. |
14 |
|
15 |
- makeinfo, perl are faked. |
16 |
|
17 |
- no need to copy libgcc on RAP. |
18 |
ld.so of glibc does that. |
19 |
|
20 |
- install texinfo for glibc. |
21 |
|
22 |
- stage3 linker can only be compiled after compiler. |
23 |
|
24 |
otherwise stage2 gcc will mix host glibc headers with those of |
25 |
stage3. |
26 |
|
27 |
scripts/bootstrap-prefix.sh | 104 ++++++++++++++++++++++++++++++++++---------- |
28 |
1 file changed, 81 insertions(+), 23 deletions(-) |
29 |
|
30 |
diff --git a/scripts/bootstrap-prefix.sh b/scripts/bootstrap-prefix.sh |
31 |
index 45c2552..9e3e4fd 100755 |
32 |
--- a/scripts/bootstrap-prefix.sh |
33 |
+++ b/scripts/bootstrap-prefix.sh |
34 |
@@ -1286,9 +1286,11 @@ bootstrap_stage2() { |
35 |
emerge_pkgs --nodeps "${pkgs[@]}" || return 1 |
36 |
|
37 |
# Build a linker and compiler that live in ${ROOT}/tmp, but |
38 |
- # produce binaries in ${ROOT}. |
39 |
+ # produce binaries in ${ROOT}. Debian multiarch supported by RAP |
40 |
+ # needs ld to support sysroot. |
41 |
USE="${USE} -cxx" \ |
42 |
TPREFIX="${ROOT}" \ |
43 |
+ EXTRA_ECONF=$(rapx --with-sysroot=/) \ |
44 |
emerge_pkgs --nodeps ${linker} || return 1 |
45 |
|
46 |
# gmp has cxx flag enabled by default. When dealing with a host |
47 |
@@ -1296,6 +1298,7 @@ bootstrap_stage2() { |
48 |
# package.use to disable in the temporary prefix. |
49 |
echo "dev-libs/gmp -cxx" >> "${ROOT}"/tmp/etc/portage/package.use |
50 |
|
51 |
+ BOOTSTRAP_RAP_STAGE2=yes \ |
52 |
EXTRA_ECONF="--disable-bootstrap" \ |
53 |
GCC_MAKE_TARGET=all \ |
54 |
TPREFIX="${ROOT}" \ |
55 |
@@ -1322,7 +1325,7 @@ bootstrap_stage2() { |
56 |
# multilib.eclass -- can't blame it at this point really) |
57 |
# do it ourselves here to make the bootstrap continue |
58 |
( cd "${ROOT}"/tmp/usr/bin && ln -s clang ${CHOST}-clang && ln -s clang++ ${CHOST}-clang++ ) |
59 |
- else |
60 |
+ elif ! is-rap ; then |
61 |
# make sure the EPREFIX gcc shared libraries are there |
62 |
mkdir -p "${ROOT}"/usr/${CHOST}/lib/gcc |
63 |
cp "${ROOT}"/tmp/usr/${CHOST}/lib/gcc/* "${ROOT}"/usr/${CHOST}/lib/gcc |
64 |
@@ -1363,6 +1366,8 @@ bootstrap_stage3() { |
65 |
unset CC CXX |
66 |
|
67 |
emerge_pkgs() { |
68 |
+ # stage3 tools should be used first. |
69 |
+ DEFAULT_PATH="${ROOT}"$(echo /{,tmp/}{,usr/}{s,}bin | sed "s, ,:${ROOT},g") \ |
70 |
EPREFIX="${ROOT}" \ |
71 |
do_emerge_pkgs "$@" |
72 |
} |
73 |
@@ -1370,25 +1375,63 @@ bootstrap_stage3() { |
74 |
# GCC sometimes decides that it needs to run makeinfo to update some |
75 |
# info pages from .texi files. Obviously we don't care at this |
76 |
# stage and rather have it continue instead of abort the build |
77 |
- export MAKEINFO="echo makeinfo GNU texinfo 4.13" |
78 |
- |
79 |
- # Build a native compiler. |
80 |
- pkgs=( |
81 |
- $([[ ${CHOST} == *-aix* ]] && echo dev-libs/libiconv ) # bash dependency |
82 |
- sys-libs/ncurses |
83 |
- sys-libs/readline |
84 |
- app-shells/bash |
85 |
- sys-apps/sed |
86 |
- app-arch/xz-utils |
87 |
- sys-apps/gentoo-functions |
88 |
- sys-apps/baselayout-prefix |
89 |
- sys-devel/m4 |
90 |
- sys-devel/flex |
91 |
- sys-devel/binutils-config |
92 |
- sys-libs/zlib |
93 |
- ${linker} |
94 |
- ) |
95 |
- emerge_pkgs --nodeps "${pkgs[@]}" || return 1 |
96 |
+ [[ -x "${ROOT}"/usr/bin/makeinfo ]] || cat > "${ROOT}"/usr/bin/makeinfo <<-EOF |
97 |
+ #!${ROOT}/bin/bash |
98 |
+ echo "makeinfo GNU texinfo 4.13" |
99 |
+ for a in \$@; do |
100 |
+ case \$a in |
101 |
+ --*) f=\$(echo "\$a" | sed -r 's,--.*=(.*),\1,') ;; |
102 |
+ -*) ;; |
103 |
+ *) f=\$a ;; |
104 |
+ esac |
105 |
+ [[ -e \$f ]] || touch \$f |
106 |
+ done |
107 |
+ EOF |
108 |
+ chmod +x "${ROOT}"/usr/bin/makeinfo |
109 |
+ export INSTALL_INFO="${ROOT}"/usr/bin/makeinfo |
110 |
+ |
111 |
+ if is-rap ; then |
112 |
+ # We need ${ROOT}/usr/bin/perl to merge glibc. |
113 |
+ if [[ ! -x "${ROOT}"/usr/bin/perl ]]; then |
114 |
+ # trick "perl -V:apiversion" check of glibc-2.19. |
115 |
+ echo -e "#!${ROOT}/bin/sh\necho 'apiversion=9999'" > "${ROOT}"/usr/bin/perl |
116 |
+ chmod +x "${ROOT}"/usr/bin/perl |
117 |
+ fi |
118 |
+ # Tell dynamic loader the path of libgcc_s.so of stage2 |
119 |
+ if [[ ! -f "${ROOT}"/etc/ld.so.conf.d/stage2.conf ]]; then |
120 |
+ mkdir -p "${ROOT}"/etc/ld.so.conf.d |
121 |
+ dirname $(gcc -print-libgcc-file-name) > "${ROOT}"/etc/ld.so.conf.d/stage2.conf |
122 |
+ fi |
123 |
+ |
124 |
+ pkgs=( |
125 |
+ sys-apps/baselayout |
126 |
+ sys-apps/gentoo-functions |
127 |
+ sys-kernel/linux-headers |
128 |
+ sys-libs/glibc |
129 |
+ sys-libs/zlib |
130 |
+ ) |
131 |
+ |
132 |
+ BOOTSTRAP_RAP=yes \ |
133 |
+ emerge_pkgs --nodeps "${pkgs[@]}" || return 1 |
134 |
+ else |
135 |
+ pkgs=( |
136 |
+ $([[ ${CHOST} == *-aix* ]] && echo dev-libs/libiconv ) # bash dependency |
137 |
+ sys-libs/ncurses |
138 |
+ sys-libs/readline |
139 |
+ app-shells/bash |
140 |
+ sys-apps/sed |
141 |
+ app-arch/xz-utils |
142 |
+ sys-apps/gentoo-functions |
143 |
+ sys-apps/baselayout-prefix |
144 |
+ sys-devel/m4 |
145 |
+ sys-devel/flex |
146 |
+ sys-devel/binutils-config |
147 |
+ sys-libs/zlib |
148 |
+ ${linker} |
149 |
+ ) |
150 |
+ |
151 |
+ emerge_pkgs --nodeps "${pkgs[@]}" || return 1 |
152 |
+ fi |
153 |
|
154 |
# On some hosts, gcc gets confused now when it uses the new linker, |
155 |
# see for instance bug #575480. While we would like to hide that |
156 |
@@ -1403,11 +1446,23 @@ bootstrap_stage3() { |
157 |
( cd "${ROOT}"/usr/bin && test ! -e python && ln -s "${ROOT}"/tmp/usr/bin/python2.7 ) |
158 |
# in addition, avoid collisions |
159 |
rm -Rf "${ROOT}"/tmp/usr/lib/python2.7/site-packages/clang |
160 |
+ |
161 |
+ RAP_DLINKER=$(echo "${ROOT}"/$(get_libdir)/ld*.so.[0-9]) |
162 |
# try to get ourself out of the mudd, bug #575324 |
163 |
- EXTRA_ECONF="--disable-compiler-version-checks" \ |
164 |
+ EXTRA_ECONF="--disable-compiler-version-checks $(rapx --disable-lto)" \ |
165 |
+ LDFLAGS="${LDFLAGS} $(rapx -Wl,--dynamic-linker=${RAP_DLINKER})" \ |
166 |
emerge_pkgs --nodeps ${compiler} || return 1 |
167 |
- ( cd "${ROOT}"/usr/bin && test ! -e python && rm -f python2.7 ) |
168 |
+ # undo libgcc_s.so path of stage2 |
169 |
|
170 |
+ rm -f "${ROOT}"/etc/ld.so.conf.d/stage2.conf |
171 |
+ if is-rap ; then |
172 |
+ "${ROOT}"/usr/sbin/ldconfig |
173 |
+ # should be linked against stage3 zlib, and can only |
174 |
+ # be compiled after gcc has the headers of Prefix glibc. |
175 |
+ emerge_pkgs --nodeps sys-devel/binutils-config ${linker} || return 1 |
176 |
+ fi |
177 |
+ |
178 |
+ ( cd "${ROOT}"/usr/bin && test ! -e python && rm -f python2.7 ) |
179 |
# Use $ROOT tools where possible from now on. |
180 |
rm -f "${ROOT}"/bin/sh |
181 |
ln -s bash "${ROOT}"/bin/sh |
182 |
@@ -1479,6 +1534,9 @@ bootstrap_stage3() { |
183 |
CPPFLAGS="-DGNUSTEP_BASE_VERSION" \ |
184 |
CFLAGS= CXXFLAGS= USE="-git" emerge -u system || return 1 |
185 |
|
186 |
+ # TODO, glibc should depend on texinfo |
187 |
+ is-rap && { emerge sys-apps/texinfo || return 1; } |
188 |
+ |
189 |
# remove anything that we don't need (compilers most likely) |
190 |
emerge --depclean |