#!/bin/bash # GCC package build script (written by volkerdi@slackware.com) # # Copyright 2003, 2004 Slackware Linux, Inc., Concord, California, USA # Copyright 2005, 2006, 2007, 2009 Patrick J. Volkerding, Sebeka, Minnesota, USA # All rights reserved. # # Redistribution and use of this script, with or without modification, is # permitted provided that the following conditions are met: # # 1. Redistributions of this script must retain the above copyright # notice, this list of conditions and the following disclaimer. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # # # Modified by Stuart Winter for Slackware ARM. # 30-May-04 # Notes: # [1] Some parts of the gcc suite do not work for ARM so they are currently # missing; this isn't an oversight on my part - they simply don't work! ;-) # Record toolchain & other info for the build log: slackbuildinfo # Paths to skeleton port's source & real Slackware source tree: export CWD=$SLACKSOURCE/$PKGSERIES/$PKGNAM # Determine the CFLAGS for the known architectures. If you specify -mtune=xscale # for ARM then the build breaks. # Also disable libspp (Stack Protector) because with gcc 4.2.3, code compiled # with it tends to segfault. Unfortunately, many newer releases of sources # check for -fstack-protector & use it if available; glibc is one of these. case $ARCH in arm) export SLKCFLAGS="-O2 -march=armv4t" # "--with-arch" sets the gcc defaults # Disable stack protector for gcc < 4.4.2 since it caused segfaults. # export ARCH_CONFARGS="--disable-libssp --disable-sjlj-exceptions --enable-mpfr --with-arch=armv4t" export ARCH_CONFARGS="--with-arch=armv4t" # --enable-libffi ;; esac # We only use the slack-desc files from the Slackware source tree. #CWD=$SLACKSOURCE/d/gcc #if [ ! -d "$CWD" ]; then # echo "ERROR: Cannot find original Slackware source dir $CWD" # echo " you would miss the slack-desc files." # exit 1 #fi PORTCWD=$PWD # The new toolchain's name: # We suffix "gnueabi" to tell gcc that we want to build a compiler that # builds for the EABI by default. TARGET=$ARCH-slackware-linux-gnueabi # Temporary build location. This should *NOT* be a directory # path a non-root user could create later... # grr - this got annoying actually - deleting /gcc-foo -- and # nobody should have write access to /root. rm -rf $TMP/build-$PKGNAM* export TMPBUILD=$TMP/build-$PKGNAM export PKG=$TMP/package-$PKGNAM rm -rf $TMP/package-gcc* # clear other gcc named packages mkpkgdirs # Delete & re-create temporary directories then cd into $TMPBUILD # This is the main DESTDIR target: PKG1=$TMP/package-gcc # These are the directories to build other packages in: PKG2=$TMP/package-gcc-g++ PKG3=$TMP/package-gcc-gfortran PKG4=$TMP/package-gcc-gnat PKG5=$TMP/package-gcc-java PKG6=$TMP/package-gcc-objc PKG7=$TMP/package-gcc-g++-gch mkdir -p $PKG{1,2,3,4,5,6,7}/install # Install the descriptions: ( cd $CWD install -vpm644 slack-desc.gcc $PKG1/install/slack-desc install -vpm644 slack-desc.gcc-g++ $PKG2/install/slack-desc install -vpm644 slack-desc.gcc-gfortran $PKG3/install/slack-desc install -vpm644 slack-desc.gcc-gnat $PKG4/install/slack-desc install -vpm644 slack-desc.gcc-java $PKG5/install/slack-desc install -vpm644 slack-desc.gcc-objc $PKG6/install/slack-desc # install -vpm644 slack-desc.gcc-g++-gch $PKG7/install/slack-desc ) # Create doc dirs: mkdir -vpm755 $PKG{1,2,3,4,5,6,7}/usr/doc/gcc-$VERSION # Extract source: echo "Unpacking gcc source..." tar xf $CWD/gcc-$VERSION.tar.?z* || exit 1 # Copy ecj.jar into the TLD of the source. Needed for java compiler. # This can be retrieved from ftp://sourceware.org/pub/java cp $CWD/ecj-4.3.jar gcc-$VERSION/ecj.jar # If we get libjava errors during the compile, this is because ejc is broken # as was the case with 4.4.2. # Renaming it out of the way causes the gcc bootstrapping procedure to # work around it. # mv -fv /usr/bin/gjar /usr/bin/gjar.broken # Extract the Debian patch set: ( cd gcc-$VERSION zcat $PORTCWD/sources/gcc*diff* | patch -p1 pushd debian/patches rm -fv ada-gcc-name.diff # don't want to change the name of ada # A mix of ARM patches and official bug fixes. # For ARM in particular, http://www.mail-archive.com/gcc-bugs@gcc.gnu.org/msg274189.html for patchf in \ svn*update* \ ada* \ *arm* \ libjava* \ gcj-*.diff \ pr*diff* \ rev146451.diff ; do popd 2> /dev/null # little hack auto_apply_patch debian/patches/$patchf # || exit 1 # don't exit because *arm* matches libjava*arm* & we don't want to fail because of this done # The svn-updates patch takes care of the broken .java file, but doesn't # replace the broken .class file. # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39177 # 4.4.2's broken class file: # 4.4.2 shipped: a3a12857829f1739f08180d611a1c599 # Working: b6ff2978d1a31f73fb1c329b1f0a70c7 # 4.4.3 shipped: c22245cb46f366aefaa046a721622f2e # if [ "$( md5sum $PORTCWD/sources/Creator.class )" != "$( md5sum libjava/classpath/tools/classes/gnu/classpath/tools/jar/Creator.class )" ]; then # mv -fv libjava/classpath/tools/classes/gnu/classpath/tools/jar/Creator.class libjava/classpath/tools/classes/gnu/classpath/tools/jar/Creator.class.broken # install -vpm644 -o0 -g0 $PORTCWD/sources/Creator.class libjava/classpath/tools/classes/gnu/classpath/tools/jar/ # fi # Apply patches from Gentoo: # tar xvvf $PORTCWD/sources/gcc-$VERSION-patches-*.tar.* # for i in patch/*.patch ; do # auto_apply_patch $i || exit 1 # done # Fix perms/owners slackhousekeeping ) || exit 1 # install docs ( cd gcc-$VERSION # Smite the fixincludes: zcat $CWD/gcc-no_fixincludes.diff.gz | patch -p1 --verbose || exit 1 mkdir -p $PKG1/usr/doc/gcc-$VERSION cp -favv \ BUGS COPYING* \ ChangeLog.tree-ssa FAQ INSTALL \ LAST_UPDATED MAINTAINERS \ README* *.html \ $PKG1/usr/doc/gcc-$VERSION # We will keep part of these, but they are really big... if [ -r ChangeLog ]; then DOCSDIR=$(echo $PKG1/usr/doc/gcc-$VERSION) cat ChangeLog | head -n 1000 > $DOCSDIR/ChangeLog touch -r ChangeLog $DOCSDIR/ChangeLog fi if [ -r NEWS ]; then DOCSDIR=$(echo $PKG1/usr/doc/gcc-$VERSION) cat NEWS | head -n 1000 > $DOCSDIR/NEWS touch -r NEWS $DOCSDIR/NEWS fi mkdir -p $PKG1/usr/doc/gcc-${VERSION}/gcc ( cd gcc cp -favv \ ABOUT* COPYING* LANG* ONEWS README* SERVICE \ $PKG1/usr/doc/gcc-$VERSION/gcc mkdir -p $PKG3/usr/doc/gcc-${VERSION}/gcc/fortran ( cd fortran if [ -r ChangeLog ]; then cat ChangeLog | head -n 1000 > $PKG3/usr/doc/gcc-$VERSION/gcc/fortran/ChangeLog touch -r ChangeLog $PKG3/usr/doc/gcc-$VERSION/gcc/fortran/ChangeLog fi ) mkdir -p $PKG4/usr/doc/gcc-${VERSION}/gcc/ada ( cd ada cp -favv \ ChangeLog.tree-ssa \ $PKG4/usr/doc/gcc-$VERSION/gcc/ada if [ -r ChangeLog ]; then cat ChangeLog | head -n 1000 > $PKG4/usr/doc/gcc-$VERSION/gcc/ada/ChangeLog touch -r ChangeLog $PKG4/usr/doc/gcc-$VERSION/gcc/ada/ChangeLog fi ) mkdir -p $PKG5/usr/doc/gcc-${VERSION}/gcc/java ( cd java cp -favv \ ChangeLog.tree-ssa \ $PKG5/usr/doc/gcc-${VERSION}/gcc/java if [ -r ChangeLog ]; then cat ChangeLog | head -n 1000 > $PKG5/usr/doc/gcc-${VERSION}/gcc/java/ChangeLog touch -r ChangeLog $PKG5/usr/doc/gcc-${VERSION}/gcc/java/ChangeLog fi ) mkdir -p $PKG6/usr/doc/gcc-${VERSION}/gcc/objc ( cd objc cp -favv \ README* \ $PKG6/usr/doc/gcc-${VERSION}/gcc/objc if [ -r ChangeLog ]; then cat ChangeLog | head -n 1000 > $PKG6/usr/doc/gcc-${VERSION}/gcc/objc/ChangeLog touch -r ChangeLog $PKG6/usr/doc/gcc-${VERSION}/gcc/objc/ChangeLog fi ) ) mkdir -p $PKG3/usr/doc/gcc-${VERSION}/libgfortran ( cd libgfortran if [ -r ChangeLog ]; then cat ChangeLog | head -n 1000 > $PKG3/usr/doc/gcc-${VERSION}/libgfortran/ChangeLog touch -r ChangeLog $PKG3/usr/doc/gcc-${VERSION}/libgfortran/ChangeLog fi ) mkdir -p $PKG3/usr/doc/gcc-${VERSION}/libada ( cd libada if [ -r ChangeLog ]; then cat ChangeLog | head -n 1000 > $PKG3/usr/doc/gcc-${VERSION}/libada/ChangeLog touch -r ChangeLog $PKG3/usr/doc/gcc-${VERSION}/libada/ChangeLog fi ) mkdir -p $PKG5/usr/doc/gcc-${VERSION}/libffi ( cd libffi cp -favv \ ChangeLog.libgcj ChangeLog.v1 \ LICENSE* README* \ $PKG5/usr/doc/gcc-${VERSION}/libffi if [ -r ChangeLog ]; then cat ChangeLog | head -n 1000 > $PKG5/usr/doc/gcc-${VERSION}/libffi/ChangeLog touch -r ChangeLog $PKG5/usr/doc/gcc-${VERSION}/libffi/ChangeLog fi ) mkdir -p $PKG5/usr/doc/gcc-${VERSION}/libjava ( cd libjava cp -favv \ COPYING* HACKING LIBGCJ_LICENSE \ NEWS README* THANKS \ $PKG5/usr/doc/gcc-${VERSION}/libjava if [ -r ChangeLog ]; then cat ChangeLog | head -n 1000 > $PKG5/usr/doc/gcc-${VERSION}/libjava/ChangeLog touch -r ChangeLog $PKG5/usr/doc/gcc-${VERSION}/libjava/ChangeLog fi ) mkdir -p $PKG1/usr/doc/gcc-${VERSION}/libmudflap ( cd libmudflap if [ -r ChangeLog ]; then cat ChangeLog | head -n 1000 > $PKG1/usr/doc/gcc-${VERSION}/libmudflap/ChangeLog touch -r ChangeLog $PKG1/usr/doc/gcc-${VERSION}/libmudflap/ChangeLog fi ) mkdir -p $PKG1/usr/doc/gcc-${VERSION}/libgomp ( cd libgomp if [ -r ChangeLog ]; then cat ChangeLog | head -n 1000 > $PKG1/usr/doc/gcc-${VERSION}/libgomp/ChangeLog touch -r ChangeLog $PKG1/usr/doc/gcc-${VERSION}/libgomp/ChangeLog fi ) mkdir -p $PKG6/usr/doc/gcc-${VERSION}/libobjc ( cd libobjc if [ -r ChangeLog ]; then cat ChangeLog | head -n 1000 > $PKG6/usr/doc/gcc-${VERSION}/libobjc/ChangeLog touch -r ChangeLog $PKG6/usr/doc/gcc-${VERSION}/libobjc/ChangeLog fi cp -favv \ README* THREADS* \ $PKG6/usr/doc/gcc-${VERSION}/libobjc ) mkdir -p $PKG2/usr/doc/gcc-${VERSION}/libstdc++-v3 ( cd libstdc++-v3 cp -favv \ README* \ docs/html/faq \ $PKG2/usr/doc/gcc-${VERSION}/libstdc++-v3 if [ -r ChangeLog ]; then cat ChangeLog | head -n 1000 > $PKG2/usr/doc/gcc-${VERSION}/libstdc++-v3/ChangeLog touch -r ChangeLog $PKG2/usr/doc/gcc-${VERSION}/libstdc++-v3/ChangeLog fi ) ) # Put "ada" back when I can! # # build gcc mkdir gcc.build.lnx cd gcc.build.lnx BOOT_CFLAGS="$SLKCFLAGS" \ STAGE1_CFLAGS="$SLKCFLAGS" \ CFLAGS="$SLKCFLAGS" \ CXXFLAGS="$SLKCFLAGS" \ LIBCFLAGS="$SLKCFLAGS" \ LIBCXXFLAGS="$SLKCFLAGS" \ GCJFLAGS="$SLKCFLAGS" \ ../gcc-$VERSION/configure $ARCH_CONFARGS \ --prefix=/usr \ --libdir=/usr/lib$LIBDIRSUFFIX \ --enable-bootstrap \ --enable-checking=release \ --with-system-zlib \ --disable-libunwind-exceptions \ --with-python-dir=/lib$LIBDIRSUFFIX/python2.6/site-packages \ --enable-shared \ --enable-languages=c,c++,fortran,java,objc \ --enable-threads=posix \ --enable-__cxa_atexit \ --enable-libssp \ --with-gnu-ld \ --verbose \ --host=$TARGET \ --build=$TARGET \ --target=$TARGET || exit 1 # Start the build: # BOOT_CFLAGS="$SLKCFLAGS -fno-stack-protector" \ # STAGE1_CFLAGS="$SLKCFLAGS -fno-stack-protector" \ # Hard code the number of parallel jobs here rather than use $NUMJOBS # This is because the bootstrap compiler is build on the x86 cluster, but # the new compiler is run natively, so -j11 is a bit too much for a single ARM core. make -j2 \ BOOT_CFLAGS="$SLKCFLAGS" \ STAGE1_CFLAGS="$SLKCFLAGS" \ CFLAGS="$SLKCFLAGS" \ CXXFLAGS="$SLKCFLAGS" \ LIBCFLAGS="$SLKCFLAGS" \ LIBCXXFLAGS="$SLKCFLAGS" \ GCJFLAGS="$SLKCFLAGS" \ bootstrap || exit 1 # gnat does not work on ARM, but it doesn't mean we can't try and build it. # We'll just delete the 812byte .tgz we make later :-) # One day we'll find that it works and we will rejoice. ( cd gcc # make gnatlib GNATLIBCFLAGS="-g $SLKCFLAGS" # make gnatlib GNATLIBCFLAGS="$SLKCFLAGS" # make -j2 gnatlib # This wants a shared -ladd2line? #make gnatlib-shared make gnatlib GNATLIBCFLAGS="$SLKCFLAGS" CFLAGS="$SLKCFLAGS" \ CXXFLAGS="$SLKCFLAGS" \ make -j2 gnattools ) # Build info pages: make info # Set GCCCHECK=something to run the tests if [ ! -z $GCCCHECK ]; then make check fi # To begin, install the whole thing into one package. We split up later. make install DESTDIR=$PKG1 # Be sure the "specs" file is installed. There was an issue with that on 4.1.1: if [ ! -r $PKG1/usr/lib${LIBDIRSUFFIX}/gcc/${ARCH}-slackware-linux-gnueabi/${VERSION}/specs ]; then echo "************************************************************************" echo "************************* MISSING SPECS FILE ***************************" echo "************************************************************************" echo "************************************************************************" set -x cat stage1-gcc/specs > $PKG1/usr/lib${LIBDIRSUFFIX}/gcc/${ARCH}-slackware-linux-gnueabi/${VERSION}/specs set +x fi make -i install-info DESTDIR=$PKG1 # make ada.install-common DESTDIR=$PKG1 make install-gnatlib DESTDIR=$PKG1 chmod 755 $PKG1/usr/lib${LIBDIRSUFFIX}/libgcc_s.so.1 # This is provided by binutils, so delete it here: rm -f $PKG1/usr/lib${LIBDIRSUFFIX}/libiberty.a # Fix stuff up: ( cd $PKG1 slackgzpages -i mkdir -p lib cd lib ln -sf /usr/bin/cpp . ) ( cd $PKG1/usr/bin mv g++ g++-gcc-$VERSION mv gcc gcc-$VERSION mv ${TARGET}-gfortran gfortran-gcc-$VERSION ln -sf g++-gcc-$VERSION g++ ln -sf gcc-$VERSION gcc ln -sf g++ c++ ln -sf gcc cc ln -sf gcc-$VERSION ${TARGET}-gcc ln -sf gcc-$VERSION ${TARGET}-gcc-$VERSION ln -sf gcj ${TARGET}-gcj ln -sf gcjh ${TARGET}-gcjh ln -sf g++-gcc-$VERSION ${TARGET}-c++ ln -sf g++-gcc-$VERSION ${TARGET}-g++ ln -sf gfortran-gcc-$VERSION gfortran ln -sf gfortran-gcc-$VERSION ${TARGET}-gfortran ln -sf gfortran-gcc-$VERSION ${TARGET}-gfortran-$VERSION ln -sf gfortran-gcc-$VERSION ${TARGET}-g95 ln -sf gfortran g95 ln -sf gfortran f95 ln -sf gfortran-gcc-$VERSION ${TARGET}-g77 ln -sf gfortran g77 ln -sf gfortran f77 ) # This is something I added in myself - it's not in the real gcc.SlackBuild # # Break these hard links: # rm -f $ARCH-slackware-linux-gnueabi-gcc gcc # ln -fs $ARCH-slackware-linux-gnueabi-gcc-$VERSION $ARCH-slackware-linux-gnueabi-gcc # ln -fs $ARCH-slackware-linux-gnueabi-gcc-$VERSION gcc # # g++ # rm -f g++ c++ $ARCH-slackware-linux-gnueabi-c++ # ln -fs $ARCH-slackware-linux-gnueabi-g++ g++ # ln -fs $ARCH-slackware-linux-gnueabi-g++ c++ # ln -fs $ARCH-slackware-linux-gnueabi-g++ $ARCH-slackware-linux-gnueabi-c++ ) ( cd $PKG1/usr/man gzip -9 */* cd man1 ln -sf g++.1.gz c++.1.gz ln -sf gcc.1.gz cc.1.gz ) # OK, time to split the big package where needed: # gcc-g++: ( cd $PKG2 mkdir -p usr/bin mv $PKG1/usr/bin/*++* usr/bin mkdir -p usr/include mv $PKG1/usr/include/c++ usr/include mkdir -p usr/lib${LIBDIRSUFFIX} mv $PKG1/usr/lib${LIBDIRSUFFIX}/*++* usr/lib 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 ) # gcc-gfortran: ( cd $PKG3 mkdir -p usr/bin mv $PKG1/usr/bin/*gfortran* usr/bin mv $PKG1/usr/bin/*95* usr/bin mv $PKG1/usr/bin/*77* usr/bin # Doesn't this seem like a logical idea? ( cd usr/bin ; ln -sf gfortran-gcc-${VERSION} fortran ) mkdir -p usr/info mv $PKG1/usr/info/gfortran* usr/info mkdir -p usr/lib${LIBDIRSUFFIX} mv $PKG1/usr/lib${LIBDIRSUFFIX}/libgfortran* usr/lib${LIBDIRSUFFIX} mkdir -p usr/lib${LIBDIRSUFFIX}/gcc/$TARGET/$VERSION mv $PKG1/usr/lib${LIBDIRSUFFIX}/gcc/$TARGET/$VERSION/finclude usr/lib${LIBDIRSUFFIX}/gcc/$TARGET/$VERSION mkdir -p usr/libexec/gcc/$TARGET/$VERSION mv $PKG1/usr/libexec/gcc/$TARGET/$VERSION/f951 usr/libexec/gcc/$TARGET/$VERSION/f951 mv $PKG1/usr/libexec/gcc/$TARGET/$VERSION/libgfortran* usr/libexec/gcc/$TARGET/$VERSION mkdir -p usr/man/man1 mv $PKG1/usr/man/man1/gfortran* usr/man/man1 ) # gcc-gnat: ( cd $PKG4 mkdir -p usr/bin mv $PKG1/usr/bin/gnat* usr/bin mv $PKG1/usr/bin/gpr* usr/bin mkdir -p usr/info mv $PKG1/usr/info/gnat* usr/info mkdir -p usr/libexec/gcc/$TARGET/$VERSION mv $PKG1/usr/libexec/gcc/$TARGET/$VERSION/gnat1 usr/libexec/gcc/$TARGET/$VERSION mkdir -p usr/lib${LIBDIRSUFFIX}/gcc/$TARGET/$VERSION mv $PKG1/usr/lib${LIBDIRSUFFIX}/gcc/$TARGET/$VERSION/adainclude usr/lib${LIBDIRSUFFIX}/gcc/$TARGET/$VERSION mv $PKG1/usr/lib${LIBDIRSUFFIX}/gcc/$TARGET/$VERSION/adalib usr/lib${LIBDIRSUFFIX}/gcc/$TARGET/$VERSION ) # gcc-java: ( cd $PKG5 mkdir -p usr/bin mv $PKG1/usr/bin/aot-compile usr/bin mv $PKG1/usr/bin/addr2name.awk usr/bin # mv $PKG1/usr/bin/fastjar usr/bin mv $PKG1/usr/bin/gappletviewer usr/bin mv $PKG1/usr/bin/gc-analyze usr/bin mv $PKG1/usr/bin/*gcj* usr/bin mv $PKG1/usr/bin/gij usr/bin mv $PKG1/usr/bin/gjar usr/bin mv $PKG1/usr/bin/gjarsigner usr/bin mv $PKG1/usr/bin/gkeytool usr/bin mv $PKG1/usr/bin/grepjar usr/bin mv $PKG1/usr/bin/grmic usr/bin mv $PKG1/usr/bin/grmiregistry usr/bin mv $PKG1/usr/bin/gserialver usr/bin mv $PKG1/usr/bin/gtnameserv usr/bin mv $PKG1/usr/bin/gjavah usr/bin mv $PKG1/usr/bin/gorbd usr/bin mv $PKG1/usr/bin/jar usr/bin mv $PKG1/usr/bin/jcf-dump usr/bin mv $PKG1/usr/bin/jv-* usr/bin mv $PKG1/usr/bin/rmi* usr/bin mkdir -p usr/include/c++/$VERSION # Move some Java only C++ headers from the C++ package: mv $PKG2/usr/include/c++/$VERSION/{gcj,gnu,java,javax,org,sun} usr/include/c++/$VERSION mv $PKG1/usr/include/ffi.h usr/include mkdir -p usr/lib${LIBDIRSUFFIX}/gcc/$TARGET/$VERSION/include mv $PKG1/usr/lib${LIBDIRSUFFIX}/gcc/$TARGET/$VERSION/include/jawt.h usr/lib${LIBDIRSUFFIX}/gcc/$TARGET/$VERSION/include mv $PKG1/usr/lib${LIBDIRSUFFIX}/gcc/$TARGET/$VERSION/include/ffi.h usr/lib${LIBDIRSUFFIX}/gcc/$TARGET/$VERSION/include mv $PKG1/usr/lib${LIBDIRSUFFIX}/gcc/$TARGET/$VERSION/include/ffitarget.h usr/lib${LIBDIRSUFFIX}/gcc/$TARGET/$VERSION/include mv $PKG1/usr/lib${LIBDIRSUFFIX}/gcc/$TARGET/$VERSION/include/jawt_md.h usr/lib${LIBDIRSUFFIX}/gcc/$TARGET/$VERSION/include mv $PKG1/usr/lib${LIBDIRSUFFIX}/gcc/$TARGET/$VERSION/include/jni.h usr/lib${LIBDIRSUFFIX}/gcc/$TARGET/$VERSION/include mv $PKG1/usr/lib${LIBDIRSUFFIX}/gcc/$TARGET/$VERSION/include/jni_md.h usr/lib${LIBDIRSUFFIX}/gcc/$TARGET/$VERSION/include mv $PKG1/usr/lib${LIBDIRSUFFIX}/gcc/$TARGET/$VERSION/include/jvmpi.h usr/lib${LIBDIRSUFFIX}/gcc/$TARGET/$VERSION/include mv $PKG1/usr/lib${LIBDIRSUFFIX}/gcc/$TARGET/$VERSION/include/libffi usr/lib${LIBDIRSUFFIX}/gcc/$TARGET/$VERSION/include # aot-compile Python plugins: if [ ! -d $PKG1/usr/lib${LIBDIRSUFFIX}/python2.6 ]; then echo "NO $PKG1/usr/lib${LIBDIRSUFFIX}/python2.6 !" exit 1 fi mv $PKG1/usr/lib${LIBDIRSUFFIX}/python2.6 usr/lib${LIBDIRSUFFIX} mkdir -p usr/info mv $PKG1/usr/info/gcj.* usr/info # mv $PKG1/usr/info/fastjar.* usr/info mkdir -p usr/lib${LIBDIRSUFFIX} mv $PKG1/usr/lib${LIBDIRSUFFIX}/libffi* usr/lib${LIBDIRSUFFIX} mv $PKG1/usr/lib${LIBDIRSUFFIX}/gcj* usr/lib${LIBDIRSUFFIX} mv $PKG1/usr/lib${LIBDIRSUFFIX}/libgcj* usr/lib${LIBDIRSUFFIX} mv $PKG1/usr/lib${LIBDIRSUFFIX}/libgij* usr/lib${LIBDIRSUFFIX} mv $PKG1/usr/lib${LIBDIRSUFFIX}/lib-org* usr/lib${LIBDIRSUFFIX} mv $PKG1/usr/lib${LIBDIRSUFFIX}/security usr/lib${LIBDIRSUFFIX} mkdir -p usr/lib${LIBDIRSUFFIX}/pkgconfig mv $PKG1/usr/lib${LIBDIRSUFFIX}/pkgconfig/libgcj*.pc usr/lib${LIBDIRSUFFIX}/pkgconfig rmdir $PKG1/usr/lib${LIBDIRSUFFIX}/pkgconfig 2> /dev/null mkdir -p usr/libexec/gcc/$TARGET/$VERSION mv $PKG1/usr/libexec/gcc/$TARGET/$VERSION/jc1 usr/libexec/gcc/$TARGET/$VERSION mv $PKG1/usr/libexec/gcc/$TARGET/$VERSION/jvgenmain usr/libexec/gcc/$TARGET/$VERSION mkdir -p usr/lib${LIBDIRSUFFIX}/gcc/$TARGET/$VERSION/include mv $PKG1/usr/lib${LIBDIRSUFFIX}/gcc/$TARGET/$VERSION/include/gcj usr/lib${LIBDIRSUFFIX}/gcc/$TARGET/$VERSION/include mkdir -p usr/man/man1 mv $PKG1/usr/man/man1/aot-compile.1.gz usr/man/man1 mv $PKG1/usr/man/man1/gappletviewer.1.gz usr/man/man1 mv $PKG1/usr/man/man1/gc-analyze.1.gz usr/man/man1 mv $PKG1/usr/man/man1/gcj.1.gz usr/man/man1 mv $PKG1/usr/man/man1/gcjh.1.gz usr/man/man1 mv $PKG1/usr/man/man1/gcj-dbtool.1.gz usr/man/man1 mv $PKG1/usr/man/man1/gij.1.gz usr/man/man1 mv $PKG1/usr/man/man1/gjar.1.gz usr/man/man1 mv $PKG1/usr/man/man1/gjarsigner.1.gz usr/man/man1 mv $PKG1/usr/man/man1/gjavah.1.gz usr/man/man1 mv $PKG1/usr/man/man1/gjdoc.1.gz usr/man/man1 mv $PKG1/usr/man/man1/gjnih.1.gz usr/man/man1 mv $PKG1/usr/man/man1/gkeytool.1.gz usr/man/man1 mv $PKG1/usr/man/man1/gnative2ascii.1.gz usr/man/man1 mv $PKG1/usr/man/man1/gorbd.1.gz usr/man/man1 mv $PKG1/usr/man/man1/grmic.1.gz usr/man/man1 mv $PKG1/usr/man/man1/grmid.1.gz usr/man/man1 mv $PKG1/usr/man/man1/grmiregistry.1.gz usr/man/man1 mv $PKG1/usr/man/man1/gserialver.1.gz usr/man/man1 mv $PKG1/usr/man/man1/gtnameserv.1.gz usr/man/man1 mv $PKG1/usr/man/man1/jcf-dump.1.gz usr/man/man1 mv $PKG1/usr/man/man1/jv-convert.1.gz usr/man/man1 mv $PKG1/usr/man/man1/jv-scan.1.gz usr/man/man1 mv $PKG1/usr/man/man1/rebuild-gcj-db.1.gz usr/man/man1 mkdir -p usr/share mv $PKG1/usr/share/java usr/share ) # gcc-objc: ( cd $PKG6 mkdir -p usr/lib${LIBDIRSUFFIX} mv $PKG1/usr/lib${LIBDIRSUFFIX}/libobjc* usr/lib${LIBDIRSUFFIX} mkdir -p usr/libexec/gcc/$TARGET/$VERSION mv $PKG1/usr/libexec/gcc/$TARGET/$VERSION/cc1obj usr/libexec/gcc/$TARGET/$VERSION mkdir -p usr/lib${LIBDIRSUFFIX}/gcc/$TARGET/$VERSION/include mv $PKG1/usr/lib${LIBDIRSUFFIX}/gcc/$TARGET/$VERSION/include/objc usr/lib${LIBDIRSUFFIX}/gcc/$TARGET/$VERSION/include ) ## NOTE: Thought about this, because the precompiled headers are so large. ## Probably easier to keep everything together, though. ## gcc-g++-gch (precompiled c++ headers) #( cd $PKG7 # mkdir -p usr/include/c++/$VERSION/$TARGET/bits # mv $PKG2/usr/include/c++/$VERSION/$TARGET/bits/stdc++.h.gch usr/include/c++/$VERSION/$TARGET/bits #) # Filter all .la files: ( cd $TMP for file in $( find . -type f -name "*.la" ) ; do sed -i 's%-L/gcc-[[:graph:]]* % %g' "$file" done ) ## Strip bloated binaries and libraries: for dir in $PKG{1,2,3,4,5,6}; do ( cd $dir find . -name "lib*so*" -exec strip --strip-unneeded "{}" \; find . -name "lib*a" -exec strip -g "{}" \; strip --strip-unneeded usr/bin/* 2> /dev/null find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null ) done # Start the fakeroot server: start_fakeroot # Delete old packages - if you want the old ones, move them out # of the way first! rm -fv $PKGSTORE/$PKGSERIES/gcc-*.t* # Don't delete old packages otherwise 'slackmp' wipes # the base gcc package. export DELETEOLDPKGS=No # Build packages: ( echo "Building gcc package" cd $PKG1 slackchown slack644docs export SLACKPACKAGE=gcc-$VERSION-$PKGARCH-$BUILD.tgz slackmp ) ( echo "Building g++ package" cd $PKG2 slackchown slack644docs export SLACKPACKAGE=gcc-g++-$VERSION-$PKGARCH-$BUILD.tgz slackmp ) ( cd $PKG3 slackchown slack644docs export SLACKPACKAGE=gcc-gfortran-$VERSION-$PKGARCH-$BUILD.tgz slackmp ) # Not for ARM: #( cd $PKG4 # slackchown # slack644docs # export SLACKPACKAGE=gcc-gnat-$VERSION-$PKGARCH-$BUILD.tgz # slackmp ) ( cd $PKG5 slackchown slack644docs export SLACKPACKAGE=gcc-java-$VERSION-$PKGARCH-$BUILD.tgz slackmp ) ( cd $PKG6 slackchown slack644docs export SLACKPACKAGE=gcc-objc-$VERSION-$PKGARCH-$BUILD.tgz slackmp ) #( cd $PKG7 # slackchown # slack644docs # makepkg -l y -c n $PKGSTORE/$PKGSERIES/gcc-g++-gch-$VERSION-$PKGARCH-$BUILD.tgz )