Gentoo Archives: gentoo-commits

From: Fabian Groffen <grobian@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/proj/prefix:master commit in: scripts/
Date: Tue, 09 Jan 2018 14:12:36
Message-Id: 1515507135.82c620cc013e6e4f7953745de1372bf8b350ee06.grobian@gentoo
1 commit: 82c620cc013e6e4f7953745de1372bf8b350ee06
2 Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
3 AuthorDate: Tue Jan 9 14:12:15 2018 +0000
4 Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
5 CommitDate: Tue Jan 9 14:12:15 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=82c620cc
7
8 scripts/bootstrap-prefix: add some fixes for powerpc-apple-darwin9
9
10 These fixes (with in tree fixes) allow to advance to stage3 with
11 llvm-3.4.2, libcxx-3.5.1, cmake and ninja installed.
12
13 scripts/bootstrap-prefix.sh | 65 +++++++++++++++++++++++++++++++++++----------
14 1 file changed, 51 insertions(+), 14 deletions(-)
15
16 diff --git a/scripts/bootstrap-prefix.sh b/scripts/bootstrap-prefix.sh
17 index f475083486..02c7e45148 100755
18 --- a/scripts/bootstrap-prefix.sh
19 +++ b/scripts/bootstrap-prefix.sh
20 @@ -249,11 +249,10 @@ configure_toolchain() {
21 local cdep="3.5.9999"
22 compiler_stage1+="
23 dev-libs/libffi
24 - <sys-devel/llvm-3.5
25 + <sys-devel/llvm-${cdep}
26 <sys-libs/libcxx-headers-${cdep}
27 <sys-libs/libcxxabi-${cdep}
28 <sys-libs/libcxx-${cdep}
29 - <sys-devel/llvm-${cdep}
30 <sys-devel/clang-${cdep}"
31 fi
32
33 @@ -1361,6 +1360,10 @@ do_emerge_pkgs() {
34 echo "USE=${myuse[*]} PKG=${pkg}"
35 (
36 unset CFLAGS CXXFLAGS
37 + [[ -n ${OVERRIDE_CFLAGS} ]] \
38 + && export CFLAGS=${OVERRIDE_CFLAGS}
39 + [[ -n ${OVERRIDE_CXXFLAGS} ]] \
40 + && export CXXFLAGS=${OVERRIDE_CXXFLAGS}
41 PORTAGE_CONFIGROOT="${EPREFIX}" \
42 PORTAGE_SYNC_STALE=0 \
43 FEATURES="-news ${FEATURES}" \
44 @@ -1453,13 +1456,24 @@ bootstrap_stage2() {
45 # unless we only build the buildtool, bug #603012
46 echo "dev-util/cmake -server" >> "${ROOT}"/tmp/etc/portage/package.use
47
48 - # <glibc-2.5 does not understand .gnu.hash, use
49 - # --hash-style=both to produce also sysv hash.
50 - EXTRA_ECONF="--disable-bootstrap $(rapx --with-linker-hash-style=both)" \
51 - MYCMAKEARGS="-DCMAKE_USE_SYSTEM_LIBRARY_LIBUV=OFF" \
52 - GCC_MAKE_TARGET=all \
53 - PYTHON_COMPAT_OVERRIDE=python2.7 \
54 - emerge_pkgs --nodeps ${compiler_stage1} || return 1
55 + for pkg in ${compiler_stage1} ; do
56 + # <glibc-2.5 does not understand .gnu.hash, use
57 + # --hash-style=both to produce also sysv hash.
58 + EXTRA_ECONF="--disable-bootstrap $(rapx --with-linker-hash-style=both)" \
59 + MYCMAKEARGS="-DCMAKE_USE_SYSTEM_LIBRARY_LIBUV=OFF" \
60 + GCC_MAKE_TARGET=all \
61 + TPREFIX="${ROOT}" \
62 + PYTHON_COMPAT_OVERRIDE=python2.7 \
63 + emerge_pkgs --nodeps ${pkg} || return 1
64 +
65 + if [[ "${pkg}" == *sys-devel/llvm* || ${pkg} == *sys-devel/clang* ]] ;
66 + then
67 + # we need llvm/clang ASAP for libcxx* doesn't build
68 + # without C++11
69 + [[ -x ${ROOT}/tmp/usr/bin/clang ]] && CC=clang
70 + [[ -x ${ROOT}/tmp/usr/bin/clang++ ]] && CXX=clang++
71 + fi
72 + done
73
74 if [[ ${CHOST} == *darwin* ]] ; then
75 # we use Clang as our toolchain compiler, so we need to make
76 @@ -1604,6 +1618,19 @@ bootstrap_stage3() {
77 # in addition, avoid collisions
78 rm -Rf "${ROOT}"/tmp/usr/lib/python2.7/site-packages/clang
79
80 + # llvm-3.5 doesn't find c++11 headers/lib by default, make it so
81 + if [[ ${CHOST} == *-darwin9 ]] ; then
82 + export OVERRIDE_CXXFLAGS="-I${ROOT}/tmp/usr/include/c++/v1 -fPIC"
83 + # -fPIC is here because we need it, but the toolchain doesn't
84 + # default to it (like for x86_64)
85 + export OVERRIDE_CFLAGS="-fPIC"
86 + # replace GCC's libstdc++ with libcxx (super hack!)
87 + ( cd "${ROOT}"/tmp/usr/lib/gcc/${CHOST}/4.2.1 \
88 + && ! test -e libstdc++.6.0.9.dylib-gcc \
89 + && mv libstdc++.6.0.9.dylib{,-gcc} \
90 + && ln -s ../../../libc++.1.dylib libstdc++.6.0.9.dylib )
91 + fi
92 +
93 RAP_DLINKER=$(echo "${ROOT}"/$(get_libdir)/ld*.so.[0-9])
94 # try to get ourself out of the mudd, bug #575324
95 EXTRA_ECONF="--disable-compiler-version-checks $(rapx --disable-lto)" \
96 @@ -2085,7 +2112,15 @@ continue. Please execute:
97 xcode-select -s /Library/Developer/CommandLineTools
98 and try running me again.
99 EOF
100 - exit 1
101 + if ! xcode-select -p > /dev/null && [[ ${CHOST} == powerpc* ]]; then
102 + # ancient Xcode (3.0/3.1)
103 + cat << EOF
104 +
105 +Ok, this is an old system, let's just try and see what happens.
106 +EOF
107 + else
108 + exit 1
109 + fi
110 fi
111 fi
112 echo
113 @@ -2394,10 +2429,12 @@ EOF
114 # deal with the bash-constructs we use in stage3 and onwards
115 hash -r
116
117 - if ! [[ -x ${EPREFIX}/usr/bin/gcc \
118 - || -x ${EPREFIX}/usr/bin/clang \
119 - || -x ${EPREFIX}/tmp/usr/bin/gcc \
120 - || -x ${EPREFIX}/tmp/usr/bin/clang ]] \
121 + # stage 2 on Darwin gets llvm/clang, so we must not get confused
122 + # when we find gcc there (it's needed to bootstrap llvm)
123 + local compiler=gcc
124 + [[ ${CHOST} == *-darwin* ]] && compiler=clang
125 + if ! [[ -x ${EPREFIX}/usr/bin/${compiler} \
126 + || -x ${EPREFIX}/tmp/usr/bin/${compiler} ]] \
127 && ! ${BASH} ${BASH_SOURCE[0]} "${EPREFIX}" stage2_log ; then
128 # stage 2 fail
129 cat << EOF