diff -u slackware64-14.2.patcharm/source/d/binutils/binutils.SlackBuild.nocross slackware64-14.2.patcharm/source/d/binutils/binutils.SlackBuild --- slackware64-14.2.patcharm/source/d/binutils/binutils.SlackBuild.nocross 2018-08-26 17:57:43.555339386 +0200 +++ slackware64-14.2.patcharm/source/d/binutils/binutils.SlackBuild 2018-08-23 16:52:33.626670069 +0200 @@ -27,6 +27,12 @@ VERSION=${VERSION:-$(echo $PKGNAM-*.tar.xz | rev | cut -f 3- -d . | cut -f 1 -d - | rev)} BUILD=${BUILD:-3} +CROSS32=0 +if echo "$*" | grep -qw -- --cross32 ; then + PKGNAM=$PKGNAM-cross32 + CROSS32=1 +fi + # Automatically determine the architecture we're building on: MARCH=$( uname -m ) if [ -z "$ARCH" ]; then @@ -58,6 +64,8 @@ # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46770 NO_INITFINI=" --disable-initfini-array " +TARCH=$ARCH + if [ "$ARCH" = "i586" ]; then SLKCFLAGS="-O2 -march=i586 -mtune=i686" # The config option below is currently needed to compile on x86: @@ -78,16 +86,23 @@ SLKCFLAGS="-O2 -march=armv7-a -mfpu=vfpv3-d16" LIBDIRSUFFIX="" elif [ "$ARCH" = "aarch64" ]; then - SLKCFLAGS="-O2" - LIBDIRSUFFIX="64" + if [ $CROSS32 -eq 0 ]; then + SLKCFLAGS="-O2" + LIBDIRSUFFIX="64" + else + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" + TARCH="armv7hl" + fi else SLKCFLAGS=${SLKCFLAGS:-"-O2"} LIBDIRSUFFIX=${LIBDIRSUFFIX:-""} + TARCH=${TARCH:-"$ARCH"} fi -case "$ARCH" in - arm*) TARGET=$ARCH-slackware-linux-gnueabi ;; - *) TARGET=$ARCH-slackware-linux ;; +case "$TARCH" in + arm*) TARGET=$TARCH-slackware-linux-gnueabi ;; + *) TARGET=$TARCH-slackware-linux ;; esac CWD=$(pwd) @@ -139,6 +154,7 @@ fi # Build for an x86 glibc2-based Linux system: +if [ $CROSS32 -eq 0 ]; then CFLAGS="$SLKCFLAGS" \ ./configure \ --prefix=/usr \ @@ -158,11 +174,21 @@ $WERROR \ --build=$TARGET \ || exit 1 +else + ./configure \ + --prefix=/usr \ + --libdir=/usr/lib$LIBDIRSUFFIX \ + --enable-static \ + --target=$TARGET \ + || exit 1 +fi make clean || exit 1 make $NUMJOBS || make || exit 1 make install DESTDIR=$PKG || exit 1 +if [ $CROSS32 -eq 0 ]; then + # Differentiate between BSD strings and GNU strings ( cd $PKG/usr/bin ; mv strings strings-GNU ) ( cd $PKG/usr/man/man1 ; mv strings.1 strings-GNU.1 ) @@ -184,10 +210,16 @@ if [ -r $PKG/usr/bin/$DEFAULT_LD ]; then ( cd $PKG/usr/bin ; rm -f ld ; ln -sf $DEFAULT_LD ld ) fi + +fi # CROSS32 + find $PKG | xargs file | grep -e "executable" -e "shared object" \ | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null + +if [ $CROSS32 -eq 0 ]; then + # Remove some unneeded man pages, and then compress the rest rm -f $PKG/usr/man/man1/{dlltool,windres}.1 ( cd $PKG/usr/man @@ -215,12 +247,17 @@ chown -R root:root $PKG/usr/doc/binutils-$VERSION +else # CROSS32 + # Remove man/info/locale: + rm -rf $PKG/usr/share +fi # CROSS32 + # Add slack-desc: mkdir -p $PKG/install -cat $CWD/slack-desc > $PKG/install/slack-desc +cat $CWD/slack-desc | sed "s/^binutils/$PKGNAM/" > $PKG/install/slack-desc cd $PKG -/sbin/makepkg -l y -c n $TMP/binutils-$VERSION-$ARCH-$BUILD.txz +/sbin/makepkg -l y -c n $TMP/$PKGNAM-$VERSION-$ARCH-$BUILD.txz cat << EOF diff -u slackware64-14.2.patcharm/source/d/gcc/gcc.SlackBuild.nocross slackware64-14.2.patcharm/source/d/gcc/gcc.SlackBuild --- slackware64-14.2.patcharm/source/d/gcc/gcc.SlackBuild.nocross 2017-12-13 22:50:50.083390444 +0100 +++ slackware64-14.2.patcharm/source/d/gcc/gcc.SlackBuild 2017-12-30 01:58:22.424944162 +0100 @@ -56,6 +56,14 @@ VERSION=${VERSION:-$(echo $PKGNAM-*.tar.xz | rev | cut -f 3- -d . | cut -f 1 -d - | rev)} BUILD=${BUILD:-3} +CROSS32=0 +BUILD_JAVA=1 +if echo "$*" | grep -qw -- --cross32 ; then + CROSS32=1 + PKGNAM=$PKGNAM-cross32 + BUILD_JAVA=0 +fi + # How many jobs to run in parallel: NUMJOBS=${NUMJOBS:-" -j 7 "} @@ -70,6 +78,8 @@ export ARCH fi +TARCH=$ARCH + if [ "$ARCH" = "i386" ]; then SLKCFLAGS="-O2 -march=i386 -mcpu=i686" LIBDIRSUFFIX="" @@ -102,7 +112,12 @@ #SLKCFLAGS="-O3 -march=armv8-a -mfpu=neon-fp-armv8" SLKCFLAGS="-O3" LIBDIRSUFFIX="64" - LIB_ARCH=aarch64 + if [ $CROSS32 -eq 0 ]; then + LIB_ARCH=aarch64 + else + TARCH="armv7hl" + LIB_ARCH="$TARCH" + fi elif [ "$ARCH" = "mips64el" ]; then SLKCFLAGS="-O3 -march=mips64r2 -mabi=64" LIBDIRSUFFIX="64" @@ -110,12 +125,13 @@ else SLKCFLAGS=${SLKCFLAGS:-"-O2"} LIBDIRSUFFIX=${LIBDIRSUFFIX:-""} - LIB_ARCH=${LIB_ARCH:-"$ARCH"} + TARCH=${TARCH:-"$ARCH"} + LIB_ARCH=${LIB_ARCH:-"$TARCH"} fi -case "$ARCH" in - arm*) TARGET=$ARCH-slackware-linux-gnueabi ;; - *) TARGET=$ARCH-slackware-linux ;; +case "$TARCH" in + arm*) TARGET=$TARCH-slackware-linux-gnueabi ;; + *) TARGET=$TARCH-slackware-linux ;; esac CWD=$(pwd) @@ -142,14 +159,14 @@ # Insert package descriptions: mkdir -p $PKG{1,2,3,4,5,6,7,8}/install -cat $CWD/slack-desc.gcc > $PKG1/install/slack-desc -cat $CWD/slack-desc.gcc-g++ > $PKG2/install/slack-desc -cat $CWD/slack-desc.gcc-gfortran > $PKG3/install/slack-desc -cat $CWD/slack-desc.gcc-gnat > $PKG4/install/slack-desc -cat $CWD/slack-desc.gcc-java > $PKG5/install/slack-desc -cat $CWD/slack-desc.gcc-objc > $PKG6/install/slack-desc -# cat $CWD/slack-desc.gcc-g++-gch > $PKG7/install/slack-desc -cat $CWD/slack-desc.gcc-go > $PKG8/install/slack-desc +cat $CWD/slack-desc.gcc | sed "s/^gcc/$PKGNAM/" > $PKG1/install/slack-desc +cat $CWD/slack-desc.gcc-g++ | sed "s/^gcc/$PKGNAM/" > $PKG2/install/slack-desc +cat $CWD/slack-desc.gcc-gfortran | sed "s/^gcc/$PKGNAM/" > $PKG3/install/slack-desc +cat $CWD/slack-desc.gcc-gnat | sed "s/^gcc/$PKGNAM/" > $PKG4/install/slack-desc +cat $CWD/slack-desc.gcc-java | sed "s/^gcc/$PKGNAM/" > $PKG5/install/slack-desc +cat $CWD/slack-desc.gcc-objc | sed "s/^gcc/$PKGNAM/" > $PKG6/install/slack-desc +# cat $CWD/slack-desc.gcc-g++-gch | sed "s/^gcc/$PKGNAM/" > $PKG7/install/slack-desc +cat $CWD/slack-desc.gcc-go | sed "s/^gcc/$PKGNAM/" > $PKG8/install/slack-desc cd $TMP tar xvf $CWD/gcc-$VERSION.tar.?z || exit 1 @@ -175,7 +193,6 @@ exit 0 fi -BUILD_JAVA=1 # Use an antlr runtime to compile javadoc. # The runtime can be obtained from: @@ -191,7 +208,6 @@ --with-antlr-jar=$ANTLJAR \ --enable-java-awt=gtk \ --disable-gtktest" - if echo "$*" | grep -qw -- --nojava ; then # Java requires GTK+2/libart: do not build when bootstrapping BUILD_JAVA=0 @@ -205,6 +221,8 @@ cp $CWD/ecj-4.9.jar gcc-$VERSION/ecj.jar fi +if [ $CROSS32 -eq 0 ]; then + # install docs ( cd gcc-$VERSION # Smite the fixincludes: @@ -447,6 +465,8 @@ ) || exit 1 fi +fi # CROSS32 + # build gcc ( mkdir gcc.build.lnx; cd gcc.build.lnx; @@ -460,24 +480,24 @@ # Correct me if my take on this is wrong. # --with-cpu=$ARCH - if [ "$ARCH" == "armv7hl" ]; then + if [ "$TARCH" == "armv7hl" ]; then GCC_ARCHOPTS="--with-tune=cortex-a8 --with-arch=armv7-a --with-float=hard --with-fpu=vfpv3-d16 --with-abi=aapcs-linux" - elif [ "$ARCH" == "arm" ]; then + elif [ "$TARCH" == "arm" ]; then GCC_ARCHOPTS="--with-arch=armv5te --with-float=soft" - elif [ "$ARCH" == "aarch64" ]; then + elif [ "$TARCH" == "aarch64" ]; then GCC_ARCHOPTS="--with-arch=armv8-a" - elif [ "$ARCH" == "mips" ]; then + elif [ "$TARCH" == "mips" ]; then GCC_ARCHOPTS="--with-arch=mips32r2" - elif [ "$ARCH" == "mipsel" ]; then + elif [ "$TARCH" == "mipsel" ]; then GCC_ARCHOPTS="--with-arch=mips32r2" - elif [ "$ARCH" == "mips64el" ]; then + elif [ "$TARCH" == "mips64el" ]; then GCC_ARCHOPTS="--with-arch=mips64r2 --with-abi=64 --disable-multilib" - elif [ "$ARCH" == "sparc" ]; then + elif [ "$TARCH" == "sparc" ]; then GCC_ARCHOPTS="--with-cpu=leon3 --with-float=hard --disable-multilib --disable-libitm" - elif [ "$ARCH" == "sparc64" ]; then + elif [ "$TARCH" == "sparc64" ]; then GCC_ARCHOPTS="--with-cpu=ultrasparc --with-float=hard --disable-multilib" - elif [ `echo "$ARCH" | grep -cE '^i.86$'` -gt 0 ]; then - GCC_ARCHOPTS="--with-arch=$ARCH" + elif [ `echo "$TARCH" | grep -cE '^i.86$'` -gt 0 ]; then + GCC_ARCHOPTS="--with-arch=$TARCH" else GCC_ARCHOPTS="--disable-multilib" fi @@ -483,6 +503,8 @@ # NOTE: For Slackware 15.0, look into removing --with-default-libstdcxx-abi=gcc4-compatible, # which will then require rebuilding all C++ libraries. That is, if there's any benefit. + if [ $CROSS32 -eq 0 ]; then + CFLAGS="$SLKCFLAGS" \ CXXFLAGS="$SLKCFLAGS" \ ../gcc-$VERSION/configure --prefix=/usr \ @@ -536,6 +558,36 @@ make install DESTDIR=$PKG1 + else # CROSS32 + + CFLAGS="$SLKCFLAGS" \ + CXXFLAGS="$SLKCFLAGS" \ + ../gcc-$VERSION/configure --prefix=/usr \ + --libdir=/usr/lib$LIBDIRSUFFIX \ + --enable-static \ + --enable-shared \ + --enable-bootstrap \ + --enable-libstdcxx-time \ + --enable-checking=release \ + --enable-languages=c,c++ \ + --enable-libstdcxx-dual-abi \ + --with-default-libstdcxx-abi=gcc4-compatible \ + --disable-install-libiberty \ + --disable-libssp \ + --with-newlib \ + --verbose \ + $GCC_ARCHOPTS \ + --target=${TARGET} \ + || exit 1 + + make $NUMJOBS all-host + + make install-host DESTDIR=$PKG1 + + fi # CROSS32 + +if [ $CROSS32 -eq 0 ]; then + # KLUDGE ALERT # These *gdb.py files are causing ldconfig to complain, so they are going # to be REMOVED for now... at some point, they might be moved somewhere @@ -548,7 +600,7 @@ fi # Make our 64bit gcc look for 32bit gcc binaries in ./32 subdirectory: -if [ "$LIBDIRSUFFIX" = "64" ]; then +if [ "$TARCH" = "x86_64" -o "$TARCH" = "aarch64" ]; then sed -i 's#;.\(:../lib !m64 m32;\)$#;32\1#' \ $PKG1/usr/lib${LIBDIRSUFFIX}/gcc/${TARGET}/${VERSION}/specs fi @@ -559,10 +611,12 @@ chmod 755 $PKG1/usr/lib${LIBDIRSUFFIX}/libgcc_s.so.1 +if [ $BUILD_JAVA -eq 1 ]; then # The (huge) static GNU java libraries are not packaged. In nearly all # cases one or more dependencies will not be available as static anyway. rm -f $PKG1/usr/lib${LIBDIRSUFFIX}/libgcj.a rm -f $PKG1/usr/lib${LIBDIRSUFFIX}/libgcj-tools.a +fi # BUILD_JAVA # Fix stuff up: ( cd $PKG1/usr/info ; rm dir ; gzip -9 * ) @@ -613,6 +667,21 @@ ln -sf gcc.1.gz cc.1.gz ) +else # CROSS32 + +( cd $PKG1/usr/bin + ln -sf ${TARGET}-gcc ${TARGET}-cc + + # Remove libcc1 since already installed in native gcc + cd $PKG1/usr + rm -f lib$LIBDIRSUFFIX/libcc1* + + # Remove man/info/locale + rm -rf $PKG1/usr/share +) + +fi # CROSS32 + ## build the txz package #( # cd $PKG1; @@ -629,14 +698,23 @@ mv $PKG1/usr/bin/*++* usr/bin mkdir -p usr/include mv $PKG1/usr/include/c++ usr/include + if [ ${TARCH::3} = "xppc" ]; then + ( cd usr/include/c++/$VERSION/$TARGET/bits + zcat $CWD/powerpc64_long_double_compat.patch.gz | patch -p7 --verbose + ) + fi mkdir -p usr/lib${LIBDIRSUFFIX} mv $PKG1/usr/lib${LIBDIRSUFFIX}/*++* usr/lib${LIBDIRSUFFIX} mkdir -p usr/libexec/gcc/$TARGET/$VERSION mv $PKG1/usr/libexec/gcc/$TARGET/$VERSION/cc1plus usr/libexec/gcc/$TARGET/$VERSION/cc1plus - mkdir -p usr/man/man1 - mv $PKG1/usr/man/man1/*++* usr/man/man1 + if [ $CROSS32 -eq 0 ]; then + mkdir -p usr/man/man1 + mv $PKG1/usr/man/man1/*++* usr/man/man1 + fi ) +if [ $CROSS32 -eq 0 ]; then + # gcc-gfortran: ( cd $PKG3 mkdir -p usr/bin @@ -831,6 +909,8 @@ mv $PKG1/usr/man/man1/gofmt.1.gz usr/man/man1 ) || exit 1 +fi # CROSS32 + # Filter all .la files (thanks much to Mark Post for the sed script): ( cd $TMP for file in $(find . -type f -name "*.la") ; do @@ -852,21 +932,26 @@ done ( cd $PKG1 - makepkg -l y -c n $TMP/gcc-$VERSION-$ARCH-$BUILD.txz ) + makepkg -l y -c n $TMP/$PKGNAM-$VERSION-$ARCH-$BUILD.txz ) ( cd $PKG2 - makepkg -l y -c n $TMP/gcc-g++-$VERSION-$ARCH-$BUILD.txz ) + makepkg -l y -c n $TMP/$PKGNAM-g++-$VERSION-$ARCH-$BUILD.txz ) + +if [ $CROSS32 -eq 0 ]; then + ( cd $PKG3 - makepkg -l y -c n $TMP/gcc-gfortran-$VERSION-$ARCH-$BUILD.txz ) + makepkg -l y -c n $TMP/$PKGNAM-gfortran-$VERSION-$ARCH-$BUILD.txz ) ( cd $PKG4 - makepkg -l y -c n $TMP/gcc-gnat-$VERSION-$ARCH-$BUILD.txz ) + makepkg -l y -c n $TMP/$PKGNAM-gnat-$VERSION-$ARCH-$BUILD.txz ) ( cd $PKG5 - makepkg -l y -c n $TMP/gcc-java-$VERSION-$ARCH-$BUILD.txz ) + makepkg -l y -c n $TMP/$PKGNAM-java-$VERSION-$ARCH-$BUILD.txz ) ( cd $PKG6 - makepkg -l y -c n $TMP/gcc-objc-$VERSION-$ARCH-$BUILD.txz ) + makepkg -l y -c n $TMP/$PKGNAM-objc-$VERSION-$ARCH-$BUILD.txz ) #( cd $PKG7 -# makepkg -l y -c n $TMP/gcc-g++-gch-$VERSION-$ARCH-$BUILD.txz ) +# makepkg -l y -c n $TMP/$PKGNAM-g++-gch-$VERSION-$ARCH-$BUILD.txz ) ( cd $PKG8 - makepkg -l y -c n $TMP/gcc-go-$VERSION-$ARCH-$BUILD.txz ) + makepkg -l y -c n $TMP/$PKGNAM-go-$VERSION-$ARCH-$BUILD.txz ) + +fi # CROSS32 echo echo "Slackware GCC package build complete!"