wok annotate gcc/receipt @ rev 8695

improve receipt
author Eric Joseph-Alexandre <erjo@slitaz.org>
date Thu Feb 17 23:04:20 2011 +0100 (2011-02-17)
parents 0b4cf0d9e1b5
children d1768332cee0
rev   line source
pankso@9 1 # SliTaz package receipt.
pankso@9 2
pankso@9 3 PACKAGE="gcc"
gokhlayeh@8181 4 VERSION="4.5.2"
pankso@204 5 CATEGORY="development"
pankso@9 6 SHORT_DESC="The the GNU Compiler Collection."
pankso@9 7 MAINTAINER="pankso@slitaz.org"
gokhlayeh@8181 8 DEPENDS="libgomp gcc-lib-base mpc-library elfutils"
gokhlayeh@8181 9 BUILD_DEPENDS="elfutils mpc-library"
pankso@9 10 TARBALL="$PACKAGE-$VERSION.tar.bz2"
pankso@9 11 WEB_SITE="http://gcc.gnu.org/"
pankso@5269 12 WGET_URL="ftp://gcc.gnu.org/pub/gcc/releases/gcc-$VERSION/$TARBALL"
pankso@9 13
gokhlayeh@8181 14 # Rules to compile & install the temporary toolchain.
gokhlayeh@8181 15 precook_tmp_toolchain()
gokhlayeh@8181 16 {
gokhlayeh@8181 17 report open-bloc
gokhlayeh@8181 18 cd $src
gokhlayeh@8181 19
gokhlayeh@8181 20 # GCC requires the GMP, MPFR and MPC packages.
gokhlayeh@8631 21 tazwok get-src mpfr --target=$PWD/mpfr || { report close-bloc; return 1; }
gokhlayeh@8631 22 tazwok get-src gmp --target=$PWD/gmp || { report close-bloc; return 1; }
gokhlayeh@8631 23 tazwok get-src mpc-library --target=$PWD/mpc || { report close-bloc; return 1; }
gokhlayeh@8181 24
gokhlayeh@8181 25 report step "Running compilation"
gokhlayeh@8181 26
gokhlayeh@8181 27 # Build it in a separate directory.
gokhlayeh@8181 28 mkdir ../gcc-build
gokhlayeh@8181 29 cd ../gcc-build
gokhlayeh@8181 30
gokhlayeh@8181 31 { $src/configure \
gokhlayeh@8181 32 --target=$BUILD_HOST \
gokhlayeh@8181 33 --disable-nls --disable-shared --disable-multilib \
gokhlayeh@8181 34 --disable-decimal-float --disable-threads \
gokhlayeh@8181 35 --disable-libmudflap --disable-libssp \
gokhlayeh@8181 36 --disable-libgomp --enable-languages=c \
gokhlayeh@8181 37 --with-gmp-include=$(pwd)/gmp --with-gmp-lib=$(pwd)/gmp/.libs \
gokhlayeh@8181 38 --without-ppl --without-cloog &&
gokhlayeh@8181 39 make &&
gokhlayeh@8181 40 make install
gokhlayeh@8631 41 } || { report close-bloc; return 1; }
gokhlayeh@8181 42
gokhlayeh@8181 43 # See LFS for more detais about this.
gokhlayeh@8181 44 ln -s libgcc.a `$BUILD_HOST-gcc -print-libgcc-file-name | \
gokhlayeh@8181 45 sed 's/libgcc/&_eh/'`
gokhlayeh@8181 46 report close-bloc
gokhlayeh@8181 47 }
gokhlayeh@8181 48
gokhlayeh@8181 49 cook_tmp_toolchain()
gokhlayeh@8181 50 {
gokhlayeh@8181 51 report open-bloc
gokhlayeh@8181 52 cd $src
gokhlayeh@8631 53 patch -Np1 -i ../stuff/gcc-$VERSION-startfiles_fix-1.patch || { report close-bloc; return 1; }
gokhlayeh@8181 54
gokhlayeh@8181 55 # Details about theses lines are in LFS book.
gokhlayeh@8181 56 sed 's@\./fixinc\.sh@-c true@' -i gcc/Makefile.in
gokhlayeh@8181 57 sed 's/^T_CFLAGS =$/& -fomit-frame-pointer/' -i gcc/Makefile.in
gokhlayeh@8181 58 for file in \
gokhlayeh@8181 59 $(find gcc/config -name linux64.h -o -name linux.h -o -name sysv4.h)
gokhlayeh@8181 60 do
gokhlayeh@8181 61 sed -e 's@/lib\(64\)\?\(32\)\?/ld@/tools&@g' \
gokhlayeh@8181 62 -e 's@/usr@/tools@g' -i $file
gokhlayeh@8181 63 echo '
gokhlayeh@8181 64 #undef STANDARD_INCLUDE_DIR
gokhlayeh@8181 65 #define STANDARD_INCLUDE_DIR 0
gokhlayeh@8181 66 #define STANDARD_STARTFILE_PREFIX_1 ""
gokhlayeh@8181 67 #define STANDARD_STARTFILE_PREFIX_2 ""' >> $file
gokhlayeh@8181 68 done
gokhlayeh@8181 69
gokhlayeh@8181 70 if [ "$ARCH" = x86_64 ]; then
gokhlayeh@8181 71 for file in $(find gcc/config -name t-linux64) ; do
gokhlayeh@8181 72 sed '/MULTILIB_OSDIRNAMES/d' -i $file
gokhlayeh@8181 73 done
gokhlayeh@8181 74 fi
gokhlayeh@8181 75
gokhlayeh@8181 76 # GCC requires the GMP, MPFR and MPC packages.
gokhlayeh@8631 77 tazwok get-src mpfr --target=$PWD/mpfr || { report close-bloc; return 1; }
gokhlayeh@8631 78 tazwok get-src gmp --target=$PWD/gmp || { report close-bloc; return 1; }
gokhlayeh@8631 79 tazwok get-src mpc-library --target=$PWD/mpc || { report close-bloc; return 1; }
gokhlayeh@8181 80
gokhlayeh@8181 81 report step "Running compilation"
gokhlayeh@8181 82
gokhlayeh@8181 83 # Build it in a separate directory.
gokhlayeh@8181 84 mkdir ../gcc-build
gokhlayeh@8181 85 cd ../gcc-build
gokhlayeh@8181 86
gokhlayeh@8181 87 { CC="$BUILD_HOST-gcc -B/tools/lib/" \
gokhlayeh@8181 88 AR=$BUILD_HOST-ar RANLIB=$BUILD_HOST-ranlib \
gokhlayeh@8181 89 $src/configure \
gokhlayeh@8181 90 --with-local-prefix=/tools --enable-clocale=gnu \
gokhlayeh@8181 91 --enable-shared --enable-threads=posix \
gokhlayeh@8181 92 --enable-__cxa_atexit --enable-languages=c,c++ \
gokhlayeh@8181 93 --disable-libstdcxx-pch --disable-multilib \
gokhlayeh@8181 94 --disable-bootstrap --disable-libgomp \
gokhlayeh@8181 95 --with-gmp-include=$(pwd)/gmp --with-gmp-lib=$(pwd)/gmp/.libs \
gokhlayeh@8181 96 --without-ppl --without-cloog &&
gokhlayeh@8181 97 make &&
gokhlayeh@8181 98 make install
gokhlayeh@8631 99 } || { report close-bloc; return 1; }
gokhlayeh@8181 100 ln -s gcc /tools/bin/cc
gokhlayeh@8181 101 report close-bloc
gokhlayeh@8181 102 }
gokhlayeh@8181 103
pankso@9 104 # Rules to configure and make the package.
pankso@9 105 compile_rules()
pankso@9 106 {
pankso@3185 107 # Use libiberty.a from binutils.
pankso@3185 108 sed -i 's/install_to_$(INSTALL_DEST) //' \
gokhlayeh@8615 109 $PACKAGE-$VERSION/libiberty/Makefile.in || return 1
gokhlayeh@8181 110 mkdir -p gcc-build && cd gcc-build
gokhlayeh@8181 111 $src/configure --enable-nls \
gokhlayeh@8181 112 --enable-languages=c,c++,objc,fortran --enable-shared --with-system-zlib \
gokhlayeh@8181 113 --enable-clocale=gnu --enable-objc-gc --enable-__cxa_atexit \
gokhlayeh@8181 114 --enable-lto --disable-bootstrap libexecdir=/usr/lib \
gokhlayeh@8181 115 --enable-threads=posix --with-tune=$ARCH $BUILD_HOST &&
gokhlayeh@8181 116 make &&
gokhlayeh@8181 117 make install
pankso@9 118 }
pankso@9 119
pankso@9 120 # Rules to gen a SliTaz package suitable for Tazpkg.
pankso@9 121 genpkg_rules()
pankso@9 122 {
pankso@9 123 mkdir -p $fs/usr/share
gokhlayeh@8181 124 cp -a $_pkg/usr/bin $fs/usr
gokhlayeh@8181 125 # Copy all libs. Remove libgcc_s.so and libstdc++.so
gokhlayeh@8181 126 # they goes in gcc-lib-base-$VERSION package.
gokhlayeh@8181 127 cp -a $_pkg/usr/lib $fs/usr
gokhlayeh@8181 128 rm $fs/usr/lib/libgcc_s.so*
gokhlayeh@8181 129 rm $fs/usr/lib/libstdc++.so*
gokhlayeh@8181 130 rm $fs/usr/lib/libgomp.so*
gokhlayeh@8181 131 # Include files.
gokhlayeh@8181 132 cp -a $_pkg/usr/include $fs/usr
gokhlayeh@8181 133 # Gfortran goes in gfortran-$VERSION package.
gokhlayeh@8181 134 rm -f $fs/usr/bin/*gfortran
gokhlayeh@8181 135 rm -f $fs/usr/lib/libgfortran*
gokhlayeh@8181 136 rm -f $fs/usr/lib/gcc/*/$VERSION/libgfortran*
gokhlayeh@8181 137 rm -rf $fs/usr/lib/gcc/*/$VERSION/f*
gokhlayeh@8181 138
gokhlayeh@8181 139 # Remove build directory.
gokhlayeh@8181 140 rm -r $WOK/$PACKAGE/$PACKAGE-build
pankso@9 141 }
pankso@9 142
pankso@9 143 # Post install commands for Tazpkg.
pankso@9 144 post_install()
pankso@9 145 {
pankso@9 146 local root
pankso@9 147 root=$1
pankso@9 148 echo "Processing post-install commands..."
pankso@9 149 if [ ! -f "$root/lib/cpp" ]; then
pankso@9 150 ln -s ../usr/bin/cpp $root/lib
pankso@9 151 fi
pankso@9 152 if [ ! -f "$root/usr/bin/cc" ]; then
pankso@9 153 ln -s gcc $root/usr/bin/cc
pankso@9 154 fi
pankso@9 155 }