public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Benda XU" <heroxbd@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/proj/prefix:rap0 commit in: scripts/
Date: Wed, 15 Jun 2016 11:32:46 +0000 (UTC)	[thread overview]
Message-ID: <1465990356.161adbdc1301c4bc05ac230be97640ca13cbdd9b.heroxbd@gentoo> (raw)

commit:     161adbdc1301c4bc05ac230be97640ca13cbdd9b
Author:     Benda Xu <heroxbd <AT> gentoo <DOT> org>
AuthorDate: Sat May 28 07:03:25 2016 +0000
Commit:     Benda XU <heroxbd <AT> gentoo <DOT> org>
CommitDate: Wed Jun 15 11:32:36 2016 +0000
URL:        https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=161adbdc

scripts/bootstrap-prefix.sh: support sys-libs/glibc.

  - lto of gcc should be disabled. ld points to the host dynamic
    loader and gcc points to the RAP one, ld cannot load the gcc
    lto plugin.

  - stage tools should be used first in stage3.

  - makeinfo, perl are faked.

  - no need to copy libgcc on RAP.
    ld.so of glibc does that.

  - install texinfo for glibc.

  - stage3 linker can only be compiled after compiler.

    otherwise stage2 gcc will mix host glibc headers with those of
    stage3.

 scripts/bootstrap-prefix.sh | 104 ++++++++++++++++++++++++++++++++++----------
 1 file changed, 81 insertions(+), 23 deletions(-)

diff --git a/scripts/bootstrap-prefix.sh b/scripts/bootstrap-prefix.sh
index 6d52f19..d6e5d6b 100755
--- a/scripts/bootstrap-prefix.sh
+++ b/scripts/bootstrap-prefix.sh
@@ -1285,9 +1285,11 @@ bootstrap_stage2() {
 	emerge_pkgs --nodeps "${pkgs[@]}" || return 1
 	
 	# Build a linker and compiler that live in ${ROOT}/tmp, but
-	# produce binaries in ${ROOT}.
+	# produce binaries in ${ROOT}. Debian multiarch needs ld to
+	# support sysroot
 	USE="${USE} -cxx" \
 	TPREFIX="${ROOT}" \
+	EXTRA_ECONF="--with-sysroot=/" \
 	emerge_pkgs --nodeps ${linker} || return 1
 
 	# gmp has cxx flag enabled by default. When dealing with a host
@@ -1295,6 +1297,7 @@ bootstrap_stage2() {
 	# package.use to disable in the temporary prefix.  
 	echo "dev-libs/gmp -cxx" >> "${ROOT}"/tmp/etc/portage/package.use
 
+	BOOTSTRAP_RAP_STAGE2=yes \
 	EXTRA_ECONF="--disable-bootstrap" \
 	GCC_MAKE_TARGET=all \
 	TPREFIX="${ROOT}" \
@@ -1321,7 +1324,7 @@ bootstrap_stage2() {
 		# multilib.eclass -- can't blame it at this point really)
 		# do it ourselves here to make the bootstrap continue
 		( cd "${ROOT}"/tmp/usr/bin && ln -s clang ${CHOST}-clang && ln -s clang++ ${CHOST}-clang++ )
-	else
+	elif ! is-rap ; then
 		# make sure the EPREFIX gcc shared libraries are there
 		mkdir -p "${ROOT}"/usr/${CHOST}/lib/gcc
 		cp "${ROOT}"/tmp/usr/${CHOST}/lib/gcc/* "${ROOT}"/usr/${CHOST}/lib/gcc
@@ -1360,6 +1363,8 @@ bootstrap_stage3() {
 	unset CC CXX
 
 	emerge_pkgs() {
+		# stage3 tools should be used first.
+		DEFAULT_PATH=$(echo "${ROOT}"/{,tmp/}{,usr/}{s,}bin | tr ' ' ':') \
 		EPREFIX="${ROOT}" \
 		do_emerge_pkgs "$@"
 	}
@@ -1367,25 +1372,63 @@ bootstrap_stage3() {
 	# GCC sometimes decides that it needs to run makeinfo to update some
 	# info pages from .texi files.  Obviously we don't care at this
 	# stage and rather have it continue instead of abort the build
-	export MAKEINFO="echo makeinfo GNU texinfo 4.13"
-	
-	# Build a native compiler.
-	pkgs=(
-		$([[ ${CHOST} == *-aix* ]] && echo dev-libs/libiconv ) # bash dependency
-		sys-libs/ncurses
-		sys-libs/readline
-		app-shells/bash
-		sys-apps/sed
-		app-arch/xz-utils
-		sys-apps/gentoo-functions
-		sys-apps/baselayout-prefix
-		sys-devel/m4
-		sys-devel/flex
-		sys-devel/binutils-config
-		sys-libs/zlib
-		${linker}
-	)
-	emerge_pkgs --nodeps "${pkgs[@]}" || return 1
+	[[ -x "${ROOT}"/usr/bin/makeinfo ]] || cat > "${ROOT}"/usr/bin/makeinfo <<EOF
+#!${ROOT}/bin/bash
+echo "makeinfo GNU texinfo 4.13"
+for a in \$@; do
+case \$a in
+--*) f=\$(echo "\$a" | sed -r 's,--.*=(.*),\1,') ;;
+-*) ;;
+*) f=\$a ;;
+esac
+[[ -e \$f ]] || touch \$f
+done
+EOF
+	chmod +x "${ROOT}"/usr/bin/makeinfo
+	export INSTALL_INFO="${ROOT}"/usr/bin/makeinfo
+
+	if is-rap ; then
+		# We need ${ROOT}/usr/bin/perl to merge glibc.
+		if [[ ! -x "${ROOT}"/usr/bin/perl ]]; then
+			# trick "perl -V:apiversion" check of glibc-2.19.
+			echo -e "#!${ROOT}/bin/sh\necho 'apiversion=9999'" > "${ROOT}"/usr/bin/perl
+			chmod +x "${ROOT}"/usr/bin/perl
+		fi
+		# Tell dynamic loader the path of libgcc_s.so of stage2
+		if [[ ! -f "${ROOT}"/etc/ld.so.conf.d/stage2.conf ]]; then
+			mkdir -p "${ROOT}"/etc/ld.so.conf.d
+			dirname $(gcc -print-libgcc-file-name) > "${ROOT}"/etc/ld.so.conf.d/stage2.conf
+		fi
+
+		pkgs=(
+			sys-apps/baselayout
+			sys-apps/gentoo-functions
+			sys-kernel/linux-headers
+			sys-libs/glibc
+			sys-libs/zlib
+		)
+
+		BOOTSTRAP_RAP=yes \
+		emerge_pkgs --nodeps "${pkgs[@]}" || return 1
+	else
+		pkgs=(
+			$([[ ${CHOST} == *-aix* ]] && echo dev-libs/libiconv ) # bash dependency
+			sys-libs/ncurses
+			sys-libs/readline
+			app-shells/bash
+			sys-apps/sed
+			app-arch/xz-utils
+			sys-apps/gentoo-functions
+			sys-apps/baselayout-prefix
+			sys-devel/m4
+			sys-devel/flex
+			sys-devel/binutils-config
+			sys-libs/zlib
+			${linker}
+		)
+
+		emerge_pkgs --nodeps "${pkgs[@]}" || return 1
+	fi
 
 	# On some hosts, gcc gets confused now when it uses the new linker,
 	# see for instance bug #575480.  While we would like to hide that
@@ -1400,11 +1443,23 @@ bootstrap_stage3() {
 	( cd "${ROOT}"/usr/bin && test ! -e python && ln -s "${ROOT}"/tmp/usr/bin/python2.7 )
 	# in addition, avoid collisions
 	rm -Rf "${ROOT}"/tmp/usr/lib/python2.7/site-packages/clang
+
+	RAP_DLINKER=$(echo "${ROOT}"/$(get_libdir)/ld*.so.[0-9])
 	# try to get ourself out of the mudd, bug #575324
-	EXTRA_ECONF="--disable-compiler-version-checks" \
+	EXTRA_ECONF="--disable-compiler-version-checks $(rapx --disable-lto)" \
+	LDFLAGS="${LDFLAGS} $(rapx -Wl,--dynamic-linker=${RAP_DLINKER})" \
 	emerge_pkgs --nodeps ${compiler} || return 1
-	( cd "${ROOT}"/usr/bin && test ! -e python && rm -f python2.7 )
+	# undo libgcc_s.so path of stage2
 
+	rm -f "${ROOT}"/etc/ld.so.conf.d/stage2.conf
+	if is-rap ; then
+		"${ROOT}"/usr/sbin/ldconfig
+		# should be linked against stage3 zlib, and can only
+		# be compiled after gcc has the headers of Prefix glibc.
+		emerge_pkgs --nodeps sys-devel/binutils-config ${linker} || return 1
+	fi
+
+	( cd "${ROOT}"/usr/bin && test ! -e python && rm -f python2.7 )
 	# Use $ROOT tools where possible from now on.
 	rm -f "${ROOT}"/bin/sh
 	ln -s bash "${ROOT}"/bin/sh
@@ -1476,6 +1531,9 @@ bootstrap_stage3() {
 	CPPFLAGS="-DGNUSTEP_BASE_VERSION" \
 	CFLAGS= CXXFLAGS= USE="-git" emerge -u system || return 1
 
+	# TODO, glibc should depend on texinfo
+	is-rap && { emerge sys-apps/texinfo || return 1; }
+
 	# remove anything that we don't need (compilers most likely)
 	emerge --depclean
 


             reply	other threads:[~2016-06-15 11:33 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-15 11:32 Benda XU [this message]
  -- strict thread matches above, loose matches on Subject: below --
2016-07-02  1:33 [gentoo-commits] repo/proj/prefix:rap0 commit in: scripts/ Benda XU
2016-06-15 11:32 Benda XU
2016-06-15 11:32 Benda XU
2016-06-15 11:32 Benda XU
2016-06-15 11:32 Benda XU
2016-06-15 11:32 Benda XU
2016-06-15 11:32 Benda XU
2016-06-15 11:32 Benda XU
2016-06-15 11:32 Benda XU
2016-06-15 11:32 Benda XU
2016-06-15 11:32 Benda XU
2016-06-15 11:32 Benda XU
2016-06-15 11:32 Benda XU
2016-06-15 10:12 [gentoo-commits] repo/proj/prefix:master " Benda XU
2016-06-15 11:32 ` [gentoo-commits] repo/proj/prefix:rap0 " Benda XU
2016-06-15  8:04 Benda XU
2016-06-15  8:04 Benda XU
2016-06-15  8:04 Benda XU
2016-06-15  8:04 Benda XU
2016-06-15  8:04 Benda XU
2016-06-15  8:04 Benda XU
2016-06-15  8:04 Benda XU
2016-06-15  8:04 Benda XU
2016-06-15  8:04 Benda XU
2016-06-15  8:04 Benda XU
2016-06-15  8:04 Benda XU
2016-06-15  8:04 Benda XU
2016-06-15  8:04 Benda XU
2016-06-15  8:04 Benda XU
2016-06-15  8:04 Benda XU
2016-06-15  8:04 Benda XU
2016-06-15  8:04 Benda XU
2016-06-15  7:58 [gentoo-commits] repo/proj/prefix:master " Benda XU
2016-06-15  8:04 ` [gentoo-commits] repo/proj/prefix:rap0 " Benda XU
2016-06-15  0:35 Benda XU
2016-06-15  0:35 Benda XU
2016-06-10  3:29 Benda XU
2016-06-10  3:29 Benda XU
2016-06-10  3:29 Benda XU
2016-06-10  3:29 Benda XU
2016-06-10  3:29 Benda XU
2016-06-10  3:29 Benda XU
2016-06-10  3:29 Benda XU
2016-06-10  3:29 Benda XU
2016-06-10  3:29 Benda XU
2016-06-10  3:29 Benda XU
2016-06-10  3:29 Benda XU
2016-06-10  3:29 Benda XU
2016-06-10  3:29 Benda XU
2016-06-10  3:29 Benda XU
2016-06-10  3:29 Benda XU
2016-06-10  3:29 Benda XU
2016-06-10  3:29 Benda XU
2016-06-10  3:29 Benda XU
2016-06-10  3:29 Benda XU
2016-06-10  3:29 Benda XU
2016-06-10  3:29 Benda XU
2016-06-08  1:10 Benda XU
2016-06-08  1:10 Benda XU
2016-06-08  1:10 Benda XU
2016-06-08  1:10 Benda XU
2016-06-08  1:10 Benda XU
2016-06-04  7:29 Benda XU

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1465990356.161adbdc1301c4bc05ac230be97640ca13cbdd9b.heroxbd@gentoo \
    --to=heroxbd@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox