diff options
author | Andreas Grapentin <andreas@grapentin.org> | 2018-03-02 10:18:13 +0100 |
---|---|---|
committer | Andreas Grapentin <andreas@grapentin.org> | 2018-03-02 10:20:27 +0100 |
commit | c9805714753fb67b1d76422b19d88fb5fee8105a (patch) | |
tree | 7d9b6f330a7e11971561a9f41d98cfc80fd766ff /src/stage1 | |
parent | 5577b3ef45ca721f18e8b56fe2cc7be671b04630 (diff) |
bootstrapping ada, and pausing multilib builds
Diffstat (limited to 'src/stage1')
-rwxr-xr-x | src/stage1/stage1.sh | 66 | ||||
-rw-r--r-- | src/stage1/toolchain-pkgbuilds/binutils/PKGBUILD.in | 27 | ||||
-rw-r--r-- | src/stage1/toolchain-pkgbuilds/gcc-bootstrap/PKGBUILD.in | 15 | ||||
-rw-r--r-- | src/stage1/toolchain-pkgbuilds/gcc/PKGBUILD.in | 13 | ||||
-rw-r--r-- | src/stage1/toolchain-pkgbuilds/glibc/PKGBUILD.in | 101 |
5 files changed, 139 insertions, 83 deletions
diff --git a/src/stage1/stage1.sh b/src/stage1/stage1.sh index b4dfd5e..4d7424f 100755 --- a/src/stage1/stage1.sh +++ b/src/stage1/stage1.sh @@ -25,6 +25,8 @@ msg "Entering Stage 1" # set a bunch of convenience variables _builddir="$topbuilddir"/stage1 _srcdir="$topsrcdir"/stage1 +_pkgdest="$_builddir"/packages +_logdest="$_builddir"/makepkglogs function check_toolchain() { echo -n "checking for $CHOST binutils ... " @@ -35,7 +37,7 @@ function check_toolchain() { echo -n "checking for $CHOST gcc ... " local _have_gcc - type -p $CHOST-gcc >/dev/null && _have_gcc=yes || _have_gcc=no + type -p $CHOST-g++ >/dev/null && _have_gcc=yes || _have_gcc=no echo $_have_gcc [ "x$_have_gcc" == "xyes" ] || return 1 @@ -49,7 +51,7 @@ function check_toolchain() { echo -n "checking for $CHOST glibc ... " local _have_glibc - [ -e "$_sysroot"/lib/libc.so.6 ] && _have_glibc=yes || _have_glibc=no + [ -e "$_sysroot"/usr/lib/libc.so.6 ] && _have_glibc=yes || _have_glibc=no echo $_have_glibc [ "x$_have_glibc" == "xyes" ] || return 1 } @@ -58,13 +60,15 @@ function check_toolchain() { if check_toolchain; then exit 0; fi # check for required programs in $PATH to build the toolchain +check_exe gnatmake check_exe makepkg check_exe pacman check_exe sed check_exe sudo # create required directories -mkdir -p "$_builddir" +mkdir -p "$_logdest" "$_pkgdest" +chown $SUDO_USER "$_logdest" "$_pkgdest" # create a sane makepkg.conf cat "$_srcdir"/makepkg.conf.in > "$_builddir"/makepkg.conf @@ -75,32 +79,52 @@ CPPFLAGS="$(source /etc/makepkg.conf && echo $CPPFLAGS)" CFLAGS="$(source /etc/makepkg.conf && echo $CFLAGS)" CXXFLAGS="$(source /etc/makepkg.conf && echo $CXXFLAGS)" LDFLAGS="$(source /etc/makepkg.conf && echo $LDFLAGS)" +LOGDEST="$_logdest" +PKGDEST="$_pkgdest" EOF +_srcdest="$(source /etc/makepkg.conf && echo $SRCDEST || true)" +[ -z "$_srcdest" ] || echo "SRCDEST=\"$_srcdest\"" >> "$_builddir"/makepkg.conf + # build and install the toolchain packages for pkg in binutils linux-libre-api-headers gcc-bootstrap glibc gcc; do - msg "makepkg: $CHOST-$pkg" - rm -rf "$_builddir"/$CHOST-$pkg - mkdir -p "$_builddir"/$CHOST-$pkg - cp "$_srcdir"/toolchain-pkgbuilds/$pkg/PKGBUILD.in "$_builddir"/$CHOST-$pkg/PKGBUILD - pushd "$_builddir"/$CHOST-$pkg >/dev/null - - # substitute architecture variables - sed -i "s#@CHOST@#$CHOST#; \ - s#@CARCH@#$CARCH#; \ - s#@LINUX_ARCH@#$LINUX_ARCH#" \ - PKGBUILD - - # build the package - chown -R $SUDO_USER . - sudo -u $SUDO_USER makepkg -C --config "$_builddir"/makepkg.conf \ - 2>&1 | tee makepkg.log + echo -n "checking for $CHOST-$pkg ... " + _pkgfile=$(find $_pkgdest -regex "^.*/$CHOST-$pkg-[^-]*-[^-]*-[^-]*\.pkg\.tar\.xz\$") + [ -n "$_pkgfile" ] && _have_pkg=yes || _have_pkg=no + echo $_have_pkg + + if [ "x$_have_pkg" == "xno" ]; then + msg "makepkg: $CHOST-$pkg" + rm -rf "$_builddir"/$CHOST-$pkg + mkdir -p "$_builddir"/$CHOST-$pkg + cp "$_srcdir"/toolchain-pkgbuilds/$pkg/PKGBUILD.in "$_builddir"/$CHOST-$pkg/PKGBUILD + pushd "$_builddir"/$CHOST-$pkg >/dev/null + + # substitute architecture variables + sed -i "s#@CHOST@#$CHOST#; \ + s#@CARCH@#$CARCH#; \ + s#@LINUX_ARCH@#$LINUX_ARCH#; \ + s#@GCC_MARCH@#${GCC_MARCH:-}#; \ + s#@GCC_MABI@#${GCC_MABI:-}#; \ + s#@MULTILIB@#${MULTILIB:-disable}#; \ + s#@GCC_32_MARCH@#${GCC_32_MARCH:-}#; \ + s#@GCC_32_MABI@#${GCC_32_MABI:-}#; \ + s#@CARCH32@#${CARCH32:-}#; \ + s#@CHOST32@#${CHOST32:-}#" \ + PKGBUILD + + # build the package + chown -R $SUDO_USER . + sudo -u $SUDO_USER makepkg -LC --config "$_builddir"/makepkg.conf + + popd >/dev/null + fi # install the package set +o pipefail - yes | pacman -U $CHOST-$pkg-*.pkg.tar.xz + _pkgfile=$(find $_pkgdest -regex "^.*/$CHOST-$pkg-[^-]*-[^-]*-[^-]*\.pkg\.tar\.xz\$" | head -n1) + yes | pacman -U "$_pkgfile" set -o pipefail - popd >/dev/null done # final sanity check diff --git a/src/stage1/toolchain-pkgbuilds/binutils/PKGBUILD.in b/src/stage1/toolchain-pkgbuilds/binutils/PKGBUILD.in index d7061f1..23333f3 100644 --- a/src/stage1/toolchain-pkgbuilds/binutils/PKGBUILD.in +++ b/src/stage1/toolchain-pkgbuilds/binutils/PKGBUILD.in @@ -24,35 +24,17 @@ prepare() { build() { cd binutils-$pkgver - if [ "${CARCH}" != "i686" ]; - then - # enabling gold linker at i686 makes the install fail - enable_gold='--enable-gold' - fi - ./configure --target=$_target \ - --with-sysroot=/usr/$_target \ --prefix=/usr \ - --disable-multilib \ - --with-gnu-as \ - --with-gnu-ld \ + --with-sysroot=/usr/$_target \ + --@MULTILIB@-multilib \ + --disable-werror \ --disable-nls \ - --enable-ld=default \ - $enable_gold \ - --enable-plugins \ - --enable-deterministic-archives + --with-expat=yes \ make } -check() { - cd binutils-$pkgver - - # unset LDFLAGS as testsuite makes assumptions about which ones are active - # do not abort on errors - manually check log files - make -k LDFLAGS="" check || true -} - package() { cd binutils-$pkgver @@ -60,7 +42,6 @@ package() { # Remove file conflicting with host binutils and manpages for MS Windows tools rm "$pkgdir"/usr/share/man/man1/$_target-{dlltool,nlmconv,windres,windmc}* - # Remove info documents that conflict with host version rm -r "$pkgdir"/usr/share/info } diff --git a/src/stage1/toolchain-pkgbuilds/gcc-bootstrap/PKGBUILD.in b/src/stage1/toolchain-pkgbuilds/gcc-bootstrap/PKGBUILD.in index 6062457..72b25ae 100644 --- a/src/stage1/toolchain-pkgbuilds/gcc-bootstrap/PKGBUILD.in +++ b/src/stage1/toolchain-pkgbuilds/gcc-bootstrap/PKGBUILD.in @@ -2,7 +2,7 @@ _target=@CHOST@ pkgname=$_target-gcc-bootstrap -pkgver=7.3.1 +pkgver=7.3.0 _islver=0.18 pkgrel=1 _snapshot=7-20180215 @@ -54,13 +54,14 @@ build() { CXXFLAGS=${CXXFLAGS/-pipe/} $srcdir/$_basedir/configure \ + --target=$_target \ --prefix=/usr \ + --libdir=/usr/lib \ + --libexecdir=/usr/lib \ --program-prefix=$_target- \ --with-local-prefix=/usr/$_target \ - --with-sysroot=/usr/$_target \ --with-build-sysroot=/usr/$_target \ - --libdir=/usr/lib --libexecdir=/usr/lib \ - --target=$_target --host=$CHOST --build=$CHOST \ + --with-sysroot=/usr/$_target \ --with-newlib \ --without-headers \ --disable-shared \ @@ -74,9 +75,11 @@ build() { --disable-libquadmath \ --disable-libgomp \ --disable-nls \ + --@MULTILIB@-multilib \ + --with-abi=@GCC_MABI@ \ + --with-arch=@GCC_MARCH@ \ --disable-bootstrap \ - --enable-checking=release \ - --disable-multilib + --enable-checking=release make inhibit-libc=true all-gcc make inhibit-libc=true all-target-libgcc diff --git a/src/stage1/toolchain-pkgbuilds/gcc/PKGBUILD.in b/src/stage1/toolchain-pkgbuilds/gcc/PKGBUILD.in index aa2e768..b8c3142 100644 --- a/src/stage1/toolchain-pkgbuilds/gcc/PKGBUILD.in +++ b/src/stage1/toolchain-pkgbuilds/gcc/PKGBUILD.in @@ -54,24 +54,27 @@ build() { CXXFLAGS=${CXXFLAGS/-pipe/} $srcdir/$_basedir/configure \ + --target=$_target \ --prefix=/usr \ + --libdir=/usr/lib \ + --libexecdir=/usr/lib \ --program-prefix=$_target- \ --with-local-prefix=/usr/$_target \ - --with-sysroot=/usr/$_target \ --with-build-sysroot=/usr/$_target \ - --libdir=/usr/lib --libexecdir=/usr/lib \ - --target=$_target --host=$CHOST --build=$CHOST \ + --with-sysroot=/usr/$_target \ --with-system-zlib \ --enable-shared \ --enable-tls \ - --enable-languages=c,c++,fortran \ + --enable-languages=c,c++,fortran,ada \ --disable-libmudflap \ --disable-libssp \ --disable-libquadmath \ --disable-nls \ --disable-bootstrap \ --enable-checking=release \ - --disable-multilib + --@MULTILIB@-multilib \ + --with-abi=@GCC_MABI@ \ + --with-arch=@GCC_MARCH@ make } diff --git a/src/stage1/toolchain-pkgbuilds/glibc/PKGBUILD.in b/src/stage1/toolchain-pkgbuilds/glibc/PKGBUILD.in index de9aeb3..bfb44ce 100644 --- a/src/stage1/toolchain-pkgbuilds/glibc/PKGBUILD.in +++ b/src/stage1/toolchain-pkgbuilds/glibc/PKGBUILD.in @@ -17,53 +17,98 @@ sha1sums=('1f7a9c43026484943ef7cf6885f2176a2bc1e093' validpgpkeys=(7273542B39962DF7B299931416792B4EA25340F8) # "Carlos O'Donell <carlos@systemhalted.org>" prepare() { - mkdir -p glibc-build + mkdir -p glibc-build lib32-glibc-build } build() { - cd glibc-build + local _configure_flags=( + --prefix=/usr + --disable-werror + --enable-shared + --enable-obsolete-rpc + --with-headers=/usr/$_target/include + --@MULTILIB@-multilib + --enable-kernel=3.0.0 + ) + + cd "$srcdir/glibc-build" - echo "slibdir=/lib" >> configparms - echo "rtlddir=/lib" >> configparms - echo "sbindir=/bin" >> configparms - echo "rootsbindir=/bin" >> configparms + echo "slibdir=/usr/lib" >> configparms + echo "rtlddir=/usr/lib" >> configparms + echo "sbindir=/usr/bin" >> configparms + echo "rootsbindir=/usr/bin" >> configparms - # remove hardening options for building libraries - export CFLAGS="${CFLAGS/-fstack-protector-strong}" - export CFLAGS="${CFLAGS/-fno-plt}" - export CXXFLAGS="${CFLAGS/-fstack-protector-strong}" - export CXXFLAGS="${CFLAGS/-fno-plt}" - unset LD_LIBRARY_PATH + # remove fortify for building libraries + CPPFLAGS=${CPPFLAGS/-D_FORTIFY_SOURCE=2/} export BUILD_CC=gcc - export CC=${_target}-gcc - export CXX=${_target}-g++ + export CC="${_target}-gcc -march=@GCC_MARCH@ -mabi=@GCC_MABI@" export AR=${_target}-ar export RANLIB=${_target}-ranlib - ../glibc-$pkgver/configure \ - --prefix=/usr \ - --target=$_target \ + CFLAGS="$CFLAGS -mcmodel=medlow -g -O2 -march=@GCC_MARCH@ -mabi=@GCC_MABI@" \ + ASFLAGS="$ASFLAGS -mcmodel=medlow -march=@GCC_MARCH@ -mabi=@GCC_MABI@" \ + "$srcdir/glibc-$pkgver/configure" \ --host=$_target \ - --build=$CHOST \ --libdir=/usr/lib \ --libexecdir=/usr/lib \ - --with-headers=/usr/$_target/include \ - --with-bugurl=https://bugs.archlinux.org/ \ - --enable-add-ons \ - --enable-obsolete-rpc \ - --enable-kernel=3.0.0 \ - --enable-bind-now \ - --disable-profile \ - --enable-shared \ - --disable-multilib \ - --disable-werror + ${_configure_flags[@]} + + # build libraries with fortify disabled + echo "build-programs=no" >> configparms + make + + # re-enable fortify for programs + sed -i "/build-programs=/s#no#yes#" configparms + + echo "CC += -D_FORTIFY_SOURCE=2" >> configparms + echo "CXX += -D_FORTIFY_SOURCE=2" >> configparms + make + + [ "x@MULTILIB@" == "xenable" ] || return 0 + + cd "$srcdir/lib32-glibc-build" + export CC="${_target}-gcc -march=@GCC_32_MARCH@ -mabi=@GCC_32_MABI@" + echo "slibdir=/usr/lib32" >> configparms + echo "rtlddir=/usr/lib32" >> configparms + echo "sbindir=/usr/bin" >> configparms + echo "rootsbindir=/usr/bin" >> configparms + + # remove fortify for building libraries + CPPFLAGS=${CPPFLAGS/-D_FORTIFY_SOURCE=2/} + CFLAGS=${CFLAGS/-fno-plt/} + CXXFLAGS=${CXXFLAGS/-fno-plt/} + + CFLAGS="$CFLAGS -mcmodel=medlow -g -O2 -march=@GCC_32_MARCH@ -mabi=@GCC_32_MABI@" \ + ASFLAGS="$ASFLAGS -mcmodel=medlow -march=@GCC_32_MARCH@ -mabi=@GCC_32_MABI@" \ + "$srcdir/glibc-$pkgver/configure" \ + --host=@CHOST32@ \ + --libdir=/usr/lib32 \ + --libexecdir=/usr/lib32 \ + ${_configure_flags[@]} + + # build libraries with fortify disabled + echo "build-programs=no" >> configparms + make + + # re-enable fortify for programs + sed -i "/build-programs=/s#no#yes#" configparms + + echo "CC += -D_FORTIFY_SOURCE=2" >> configparms + echo "CXX += -D_FORTIFY_SOURCE=2" >> configparms make + } package() { cd glibc-build make install_root=$pkgdir/usr/$_target install + + [ "x@MULTILIB@" == "xenable" ] || return 0 + + cd lib32-glibc-build + + make install_root=$pkgdir/usr/$_target install } |