# gcc346/cfg - "Build" settings for package #--------------------------------------------------------------------- [technotes] 1. "gcc346" provides an old release of "gcc" [3.4.6]. To use this release in a package, specify "compiler = gcc346" in the package's "cfg" file. To use this release to compile a 'C' program outside of the package context, try doing this to set up: PATH=$PRODTREE/gcc346/bin:$PATH #--------------------------------------------------------------------- 2. The copies of "gcc" and "g++" provided aren't intended to be used as the default 'C' or C++ compilers for a Linux distro. It may be possible to use the copy of "gcc" provided to compile 'C' code written for old releases of "gcc". However, attempts to use the copy of "g++" provided to compile C++ code against newer releases of "glibc" are likely to fail. #--------------------------------------------------------------------- 3. Presently, "gcc1420" ["gcc" 14.2.0] is needed, and used, to build this package. If you're porting this distro to a new architecture, you may or may not be able to use a different distro's "gcc" package[s] to bootstrap this package. The details of a "gcc" bootstrap are beyond the scope of this discussion. If you use this package to rebuild itself, it's recommended that you back-up this package first. #--------------------------------------------------------------------- 4. The executables stored in this package's main "bin" directory shouldn't be compressed (i.e., using "upx" or a similar program). If this is done, the distro's compiler wrapper won't be able to operate correctly. It's also a bad idea to compress executables stored in this package's other directories. In theory, this should work. In practice, it pro- duces a slow compiler. #--------------------------------------------------------------------- [buildtimes] 00.04 hours (or 002.62 minutes) - 2021 dedi box 00.07 hours (or 003.97 minutes) - 2023 dedi Xeon E3-1200 v3 4x2 32GB RAM 00.07 hours (or 004.43 minutes) - ThinkPad W530 i7 4x2 32GB RAM 00.12 hours (or 007.17 minutes) - ThinkPad W530 i7 4x2 32GB RAM using a 64-bit kernel and 32-bit distro 00.21 hours (or 012.78 minutes) - HP EliteBook 8560w 32GB RAM 00.28 hours (or 017.05 minutes) - ThinkPad E540 i7 4x2 16GB RAM #--------------------------------------------------------------------- [settings] altpkg = yes configure = none # Handled during "build" stage license = See "license*.txt" in installed tree licfile = COPYING nodebug = yes nosyslinks = yes # Disable normal integration nowerror = yes purge = yes tmpsize = 269M unpack = relaxed #--------------------------------------------------------------------- [depends] actools:forward gcc494:forward bison:forward chrpath:forward flex:forward gawk:forward grep:forward none #--------------------------------------------------------------------- [build] #--------------------------------------------------------------------- # Initial setup. GCCTRIPLE=3.4.6 PATH=$PRODTREE/gcc1420/bin:$PATH treetextsub --pattern='DEFAULT_USE_CXA_ATEXIT 1' \ --newtext='DEFAULT_USE_CXA_ATEXIT 0' \ --keeptimes #--------------------------------------------------------------------- if [ "x$LACARCH" == "x" ]; then echo Error: LACARCH not set exit 1 fi if [ "x$LACSYSTREE" == "x" ]; then echo Error: LACSYSTREE not set exit 1 fi #--------------------------------------------------------------------- sed -e 's@__META_SYSTREE__@$LACSYSTREE@' \ -i gcc/cppdefault.c gcc/collect2.c gcc/config/i386/linux64.h date && echo Start echo Compiling with: hash gcc g++ gcc --version rm -fr /usr/lib64/*.a mkdir -p /usr/lib64 for x in libc.so libpthread.so do FX=/usr/lib64/$x if [ -f $FX ]; then echo Error: $FX exists exit 1 fi done #--------------------------------------------------------------------- SUPLIB=$PKGDIR_SPECIAL/suplib tar Jxf $SUPLIB/gmp-6.1.2.tar.xz tar Jxf $SUPLIB/isl-0.18.tar.xz tar zxf $SUPLIB/mpc-1.1.0.tar.gz tar jxf $SUPLIB/mpfr-3.1.6.tar.bz2 mv gmp{-6.1.2,} mv isl{-0.18,} mv mpc{-1.1.0,} mv mpfr{-3.1.6,} #--------------------------------------------------------------------- # This step is from BFLS and/or Slackware. # sed -e '/m64=/s/lib64/lib/' \ -i gcc/config/i386/t-linux64 # From BLFS: # sed -e 's@\./fixinc\.sh@-c true@' \ -i gcc/Makefile.in #--------------------------------------------------------------------- treetextsub \ --pattern="/usr/lib64" \ --newtext="$LACSYSTREE/lib" --keeptimes treetextsub \ --pattern="/usr/lib" \ --newtext="$LACSYSTREE/lib" --keeptimes #--------------------------------------------------------------------- BINDIR=$PKGDIR_PROD/bin LIBDIR=$PKGDIR_PROD/lib mkdir -p $BINDIR $LIBDIR #--------------------------------------------------------------------- # The "chown/chmod" commands used here are based partly on Slackware # recommendations. chown -R 0.0 . find . -perm 777 -exec chmod 755 {} \; find . -perm 775 -exec chmod 755 {} \; find . -perm 754 -exec chmod 755 {} \; # Skip this one. It's too slow for some releases of gcc. # find . -perm 664 -print -exec chmod 644 {} \; #--------------------------------------------------------------------- SDIR=`pwd` cd .. mkdir obj cd obj XDIR=`pwd` #--------------------------------------------------------------------- export FORCEPATHMAX=yes PREFIX=$PKGDIR_PROD mkdir -p $PREFIX/lib export TEMPDIR=/ram export TMP=$TEMPDIR export TMPDIR=$TEMPDIR mkdir -p $TEMPDIR #--------------------------------------------------------------------- # "configure" step. export LACNOWERROR=no PATH=$PATH:`pwd` bash ../gcc*/configure \ --prefix=$PREFIX \ --build=$LACARCHBUILD \ --host=$LACARCHHOST \ \ --disable-bootstrap \ --disable-checking \ --disable-libgomp \ --disable-libstdcxx-pch \ --disable-lto \ --disable-multilib \ --disable-nls \ --disable-werror \ \ --enable-__cxa_atexit=no \ --enable-c99 \ --enable-clocale=gnu \ --enable-languages=c,c++,f77 \ --enable-shared \ --enable-static \ --enable-threads=posix \ --enable-__cxa_atexit \ \ --libexecdir=$PREFIX/lib #--------------------------------------------------------------------- # Not used under normal circumstances: # # --with-gmp=$PREFIX \ # --with-mpc=$PREFIX \ # --with-mpfr=$PREFIX \ # --with-local-prefix=$PREFIX \ # --with-build-sysroot=$PREFIX \ # --with-sysroot=$PREFIX \ #--------------------------------------------------------------------- LACLIBTOOL=`which libtool` for x in $SDIR $XDIR do cd $x for ltfile in `find . -type f -name libtool` do # These commands may be needed for cross-compilation: # rm $ltfile # cp -p $LACLIBTOOL $ltfile X=42 # Just a placeholder command done done #--------------------------------------------------------------------- GLIBCDIR=$LACSYSTREE/toolchain/lib ALIBCDIR=$PRODTREE/glibc/lib if [ -f "$ALIBCDIR/crti.o" ]; then GLIBCDIR=$ALIBCDIR fi if [ \! -f "$GLIBCDIR/crti.o" ]; then echo "Error: glibc crtX.o setup isn't as expected" exit 1 fi pushd $GLIBCDIR for x in /lib /usr/lib /usr/local/lib $LACSYSTREE/lib do mkdir -p $x for crto in *crt*.o do ln -nsf $GLIBCDIR/$crto $x/ done done popd #--------------------------------------------------------------------- cd / sync #--------------------------------------------------------------------- date && echo 1st make start cd $XDIR export LACSLOWDOWN=no smpmake || make date && echo 1st make done #--------------------------------------------------------------------- # "make install" step. date && echo make install start make install || make install || make install date && echo make install done for x in /lib /usr/lib /usr/local/lib $LACSYSTREE/lib do rm -f $x/crt*.o done #--------------------------------------------------------------------- date && echo Post-install cleanup install -v -dm755 $LACSYSTREE/lib/bfd-plugins ln -sfv \ ../../libexec/gcc/$(gcc -dumpmachine)/$GCCTRIPLE/liblto_plugin.so \ $LACSYSTREE/lib/bfd-plugins/ #--------------------------------------------------------------------- cd $BINDIR (strip -p * || true) 2> /dev/null rm -fr cc wrapcc sed -e "s@__META_SYSTREE__@$LACSYSTREE@g" \ -e "s@__META_PKGNAME__@$EXEWORD@g" \ < $PKGDIR_SPECIAL/altcc \ > cc chmod 755 cc str="This line is magic" sed -e "s@__META_LACARCH__@$LACARCH@g" \ -e 's/unshift (@ARGV, "-mno-avx")/$str = "bacon"/' \ -e 's/\(unshift *(@ARGV.*-Wno-error\)/# \1/' \ < /laclin/sysutil/toolchain/wrapcc.txt \ > wrapcc chmod 755 wrapcc #--------------------------------------------------------------------- # The "for"-loop below tries to do the following: # # (1) rename 'C' compiler ELF executables that are not already named # "*.bin" to corresponding "*.bin" names # # (2) hard-link the original 'C' compiler executable names to a wrap- # per script that was installed previously # "trueifexe" is a distro-specific utility script. echo trueifexe loop start for x in c++ g++ gcc *-c++ *-g++ *-gcc *-gcc-[0-9.]* do if [ -f "$x.bin" ]; then trueifexe "$x.bin" || (echo trueifexe error-1: $x ; exit 1) fi z=`echo $x | sed 's/\.bin//'` if [ "@$x" == "@$z" ]; then # Doesn't end with ".bin" trueifexe $x && rm -fr $x.bin && mv $x $x.bin ln -f wrapcc $x trueifexe "$x.bin" || (echo trueifexe error-2: $x ; exit 1) else trueifexe "$x" || (echo trueifexe error-3: $x ; exit 1) fi done echo trueifexe loop end #--------------------------------------------------------------------- rm -f $LIBDIR/libstdc++.so.*-gdb.py #--------------------------------------------------------------------- # This is needed by some programs. It may need some work. cd $PREFIX sed -e 's|#include_next|#include|' \ -i `find . -type f -name cstdlib` \ `find . -type f -name cmath` \ `find . -type f -name std_abs.h` rm -fr `find . -type d -name include-fixed` #--------------------------------------------------------------------- # Wrap it up. date && echo Done #--------------------------------------------------------------------- # Original URLs. These URLs were valid at one point, but may have died # since then. If you download newer versions of tarballs [etc.], don't # delete the original versions, as you may not be able to replace # them. [urls] url_debian = Not checked yet url_home = http://www.gnu.org/software/gcc/ url_tarball = ftp://ftp.gnu.org/gnu/gcc/gcc-3.4.6/gcc-3.4.6.tar.bz2 url_lfs = http://www.linuxfromscratch.org/lfs/view/\ stable/chapter06/gcc.html