#!/bin/sh CWD=`pwd` VERSION=4.5.0 ARCH=alpha TARGET=$ARCH-alphaslack-linux BUILD=1 TMP=/tmp PKG=$TMP/package-gcc ( cd $TMP rm -rf $PKG mkdir -p $PKG rm -rf gcc-$VERSION tar xjf $CWD/gcc-$VERSION.tar.bz2 # 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.5.jar gcc-$VERSION/ecj.jar # install docs cd gcc-$VERSION # Fix perms/owners chown -R root:root . find . -perm 777 -exec chmod 755 {} \; find . -perm 775 -exec chmod 755 {} \; find . -perm 754 -exec chmod 755 {} \; find . -perm 664 -exec chmod 644 {} \; mkdir -p $PKG/usr/doc/gcc-$VERSION cp -a BUGS COPYING COPYING.LIB ChangeLog FAQ INSTALL MAINTAINERS README* $PKG/usr/doc/gcc-$VERSION # build gcc ./configure \ --prefix=/usr \ --mandir=/usr/man \ --infodir=/usr/info \ --enable-shared \ --with-system-zlib \ --with-python-dir=/lib/python2.6/site-packages \ --enable-threads=posix \ --enable-__cxa_atexit \ --enable-checking=release \ --enable-languages=c,c++,fortran,java,objc,obj-c++ \ --enable-libssp \ --enable-libada \ --enable-decimal-float \ --disable-fixed-point \ --enable-gnu-unique-object \ --enable-long-double-128 \ --enable-tls \ --enable-lto \ --enable-gold \ --with-gnu-ld \ --verbose \ --target=$TARGET \ --host=$TARGET \ --build=$TARGET || exit 1 # Start the build: make -sj2; # ( cd gcc # make -sj2 gnatlib || exit 1 # This wants a shared -ladd2line? #make gnatlib-shared # make -sj2 gnattools || exit 1 # ) # Set GCCCHECK=something to run the tests if [ ! -z $GCCCHECK ]; then make check || exit 1 fi make install DESTDIR=$PKG || exit #be sure the "specs" file is installed. if [ ! -r $PKG/usr/lib/gcc/${TARGET}/${VERSION}/specs ]; then cat $TMP/gcc-${VERSION}/host-${TARGET}/gcc/specs > $PKG/usr/lib/gcc/${TARGET}/${VERSION}/specs fi chmod 755 $PKG/usr/lib/libgcc_s.so.1 # This is provided by binutils, so delete it here: rm -f $PKG/usr/lib/libiberty.a # Strip out unneeded stuff from the libraries and binaries: ( cd $PKG 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 ) # Most people debug their own code (not the libraries), so we'll strip these. # It cuts the size down quite a bit. find $PKG -name "*.a" | xargs file | grep "archive" | cut -f 1 -d : | xargs strip -g # Fix stuff up: ( cd $PKG/usr/info ; rm dir ; gzip -9 * ) ( cd $PKG/usr/man ; rm man1/g++.1 ; gzip -9 man{1,7}/* ) ( cd $PKG mkdir -p lib cd lib ln -sf /usr/bin/cpp . ) ( cd $PKG/usr/bin mv g++ g++-$VERSION mv gcc gcc-$VERSION mv gfortran gfortran-gcc-$VERSION mv gcj gcj-$VERSION ln -sf g++-$VERSION g++ ln -sf gcc-$VERSION gcc ln -sf gfortran-gcc-$VERSION gfortran ln -sf gcj-$VERSION gcj ln -sf g++ c++ ln -sf gcc cc ln -sf gcj-$VERSION ${TARGET}-gcj ln -sf gcjh ${TARGET}-gcjh ln -sf gfortran f77 ln -sf gfortran f95 ln -sf gfortran g77 ln -sf gfortran g95 ln -sf gcc-$VERSION ${TARGET}-gcc ln -sf gcc-$VERSION ${TARGET}-gcc-$VERSION ln -sf g++-$VERSION ${TARGET}-c++ ln -sf g++-$VERSION ${TARGET}-g++ ln -sf g++-$VERSION ${TARGET}-g++-$VERSION ln -sf gfortran-gcc-$VERSION ${TARGET}-gfortran ln -sf gfortran-gcc-$VERSION ${TARGET}-gfortran-gcc-$VERSION ln -sf gfortran-gcc-$VERSION ${TARGET}-g77 ln -sf gfortran-gcc-$VERSION ${TARGET}-g95 chown root:bin * . ) mkdir -p $PKG/install # Install the descriptions: ( cd $CWD cat slack-desc.gcc > $PKG/install/slack-desc ) # Filter all .la files (thanks much to Mark Post for the sed script): ( cd $TMP for file in `find . -type f -name "*.la"` ; do cat $file | sed -e 's%-L/gcc-[[:graph:]]* % %g' > $TMP/tmp-la-file cat $TMP/tmp-la-file > $file done rm $TMP/tmp-la-file ) ( cd $PKG makepkg -l y -c n $TMP/gcc-$VERSION-$ARCH-$BUILD.tgz ) ) 2>&1 | tee $TMP/gcc45.build.log