wok annotate gcc/receipt @ rev 9705

gcc: dont erase Godane change ($stuff)
author Christophe Lincoln <pankso@slitaz.org>
date Sun May 08 20:09:05 2011 +0200 (2011-05-08)
parents 6cbf526b5cc3
children ab679abe4dd6
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"
pankso@9 8 TARBALL="$PACKAGE-$VERSION.tar.bz2"
pankso@9 9 WEB_SITE="http://gcc.gnu.org/"
pankso@5269 10 WGET_URL="ftp://gcc.gnu.org/pub/gcc/releases/gcc-$VERSION/$TARBALL"
pankso@9 11
pankso@9704 12 # We need gawk since busybox awk is not sufficient. We have BUILD_DEPENDS
pankso@9704 13 # for cookutils that are not used by tazwok/cook-toolchain since it install
pankso@9704 14 # and use it's own copy.
pankso@9704 15 DEPENDS="libgomp gcc-lib-base mpc-library elfutils"
pankso@9704 16 BUILD_DEPENDS="elfutils mpc-library mpfr mpfr-dev gmp gmp-dev elfutils \
pankso@9704 17 elfutils-dev gawk"
pankso@9704 18
gokhlayeh@8181 19 # Rules to compile & install the temporary toolchain.
gokhlayeh@8181 20 precook_tmp_toolchain()
gokhlayeh@8181 21 {
gokhlayeh@8181 22 report open-bloc
gokhlayeh@8181 23 cd $src
gokhlayeh@8181 24
gokhlayeh@8181 25 # GCC requires the GMP, MPFR and MPC packages.
gokhlayeh@8631 26 tazwok get-src mpfr --target=$PWD/mpfr || { report close-bloc; return 1; }
gokhlayeh@8631 27 tazwok get-src gmp --target=$PWD/gmp || { report close-bloc; return 1; }
gokhlayeh@8631 28 tazwok get-src mpc-library --target=$PWD/mpc || { report close-bloc; return 1; }
gokhlayeh@8181 29
gokhlayeh@8181 30 report step "Running compilation"
gokhlayeh@8181 31
gokhlayeh@8181 32 # Build it in a separate directory.
gokhlayeh@8181 33 mkdir ../gcc-build
gokhlayeh@8181 34 cd ../gcc-build
gokhlayeh@8181 35
gokhlayeh@8181 36 { $src/configure \
gokhlayeh@8181 37 --target=$BUILD_HOST \
gokhlayeh@8181 38 --disable-nls --disable-shared --disable-multilib \
gokhlayeh@8181 39 --disable-decimal-float --disable-threads \
gokhlayeh@8181 40 --disable-libmudflap --disable-libssp \
gokhlayeh@8181 41 --disable-libgomp --enable-languages=c \
gokhlayeh@8181 42 --with-gmp-include=$(pwd)/gmp --with-gmp-lib=$(pwd)/gmp/.libs \
gokhlayeh@8181 43 --without-ppl --without-cloog &&
gokhlayeh@8181 44 make &&
gokhlayeh@8181 45 make install
gokhlayeh@8631 46 } || { report close-bloc; return 1; }
gokhlayeh@8181 47
gokhlayeh@8181 48 # See LFS for more detais about this.
gokhlayeh@8181 49 ln -s libgcc.a `$BUILD_HOST-gcc -print-libgcc-file-name | \
gokhlayeh@8181 50 sed 's/libgcc/&_eh/'`
gokhlayeh@8181 51 report close-bloc
gokhlayeh@8181 52 }
gokhlayeh@8181 53
gokhlayeh@8181 54 cook_tmp_toolchain()
gokhlayeh@8181 55 {
gokhlayeh@8181 56 report open-bloc
gokhlayeh@8181 57 cd $src
pankso@9705 58 patch -Np1 -i $stuff/gcc-$VERSION-startfiles_fix-1.patch || { report close-bloc; return 1; }
gokhlayeh@8181 59
gokhlayeh@8181 60 # Details about theses lines are in LFS book.
gokhlayeh@8181 61 sed 's@\./fixinc\.sh@-c true@' -i gcc/Makefile.in
gokhlayeh@8181 62 sed 's/^T_CFLAGS =$/& -fomit-frame-pointer/' -i gcc/Makefile.in
gokhlayeh@8181 63 for file in \
gokhlayeh@8181 64 $(find gcc/config -name linux64.h -o -name linux.h -o -name sysv4.h)
gokhlayeh@8181 65 do
gokhlayeh@8181 66 sed -e 's@/lib\(64\)\?\(32\)\?/ld@/tools&@g' \
gokhlayeh@8181 67 -e 's@/usr@/tools@g' -i $file
gokhlayeh@8181 68 echo '
gokhlayeh@8181 69 #undef STANDARD_INCLUDE_DIR
gokhlayeh@8181 70 #define STANDARD_INCLUDE_DIR 0
gokhlayeh@8181 71 #define STANDARD_STARTFILE_PREFIX_1 ""
gokhlayeh@8181 72 #define STANDARD_STARTFILE_PREFIX_2 ""' >> $file
gokhlayeh@8181 73 done
gokhlayeh@8181 74
gokhlayeh@8181 75 if [ "$ARCH" = x86_64 ]; then
gokhlayeh@8181 76 for file in $(find gcc/config -name t-linux64) ; do
gokhlayeh@8181 77 sed '/MULTILIB_OSDIRNAMES/d' -i $file
gokhlayeh@8181 78 done
gokhlayeh@8181 79 fi
gokhlayeh@8181 80
gokhlayeh@8181 81 # GCC requires the GMP, MPFR and MPC packages.
gokhlayeh@8631 82 tazwok get-src mpfr --target=$PWD/mpfr || { report close-bloc; return 1; }
gokhlayeh@8631 83 tazwok get-src gmp --target=$PWD/gmp || { report close-bloc; return 1; }
gokhlayeh@8631 84 tazwok get-src mpc-library --target=$PWD/mpc || { report close-bloc; return 1; }
gokhlayeh@8181 85
gokhlayeh@8181 86 report step "Running compilation"
gokhlayeh@8181 87
gokhlayeh@8181 88 # Build it in a separate directory.
gokhlayeh@8181 89 mkdir ../gcc-build
gokhlayeh@8181 90 cd ../gcc-build
gokhlayeh@8181 91
gokhlayeh@8181 92 { CC="$BUILD_HOST-gcc -B/tools/lib/" \
gokhlayeh@8181 93 AR=$BUILD_HOST-ar RANLIB=$BUILD_HOST-ranlib \
pankso@9704 94 # --disable-bootstrap dont exist ???
pankso@9704 95 # See: ./configure --help | grep bootstrap
gokhlayeh@8181 96 $src/configure \
gokhlayeh@8181 97 --with-local-prefix=/tools --enable-clocale=gnu \
gokhlayeh@8181 98 --enable-shared --enable-threads=posix \
gokhlayeh@8181 99 --enable-__cxa_atexit --enable-languages=c,c++ \
gokhlayeh@8181 100 --disable-libstdcxx-pch --disable-multilib \
gokhlayeh@8181 101 --disable-bootstrap --disable-libgomp \
gokhlayeh@8181 102 --with-gmp-include=$(pwd)/gmp --with-gmp-lib=$(pwd)/gmp/.libs \
gokhlayeh@8181 103 --without-ppl --without-cloog &&
gokhlayeh@8181 104 make &&
gokhlayeh@8181 105 make install
gokhlayeh@8631 106 } || { report close-bloc; return 1; }
gokhlayeh@8181 107 ln -s gcc /tools/bin/cc
gokhlayeh@8181 108 report close-bloc
gokhlayeh@8181 109 }
gokhlayeh@8181 110
pankso@9 111 # Rules to configure and make the package.
pankso@9 112 compile_rules()
pankso@9 113 {
pankso@9704 114 cd $src
pankso@9704 115
pankso@9704 116 # Package slitaz-toolchain use 'cook --options' when rebuilding
pankso@9704 117 # the full SliTaz toolchain.
pankso@9704 118 [ "$3" == "--first-pass" ] && opt=$3
pankso@9704 119
pankso@3185 120 # Use libiberty.a from binutils.
pankso@3185 121 sed -i 's/install_to_$(INSTALL_DEST) //' \
pankso@9704 122 libiberty/Makefile.in || return 1
pankso@9704 123 mkdir -p ../gcc-build && cd ../gcc-build
pankso@9704 124
pankso@9704 125 case "$opt" in
pankso@9704 126 --first-pass)
pankso@9704 127 # Used by slitaz-toolchain when rebuilding the full toolchain.
pankso@9704 128 echo "cook: configure GCC for: toolchain first pass"
pankso@9704 129 $src/configure --libexecdir=/usr/lib \
pankso@9704 130 --disable-nls --enable-shared \
pankso@9704 131 --enable-languages=c --disable-multilib \
pankso@9704 132 --disable-libstdcxx-pch --enable-threads=posix &&
pankso@9704 133 make && make install ;;
pankso@9704 134 *)
pankso@9704 135 # Used by default to produce a full featured GCC compiler.
pankso@9704 136 echo "cook: configure GCC for: final/full build"
pankso@9704 137 $src/configure --libexecdir=/usr/lib --enable-nls \
pankso@9704 138 --enable-languages=c,c++,objc,fortran \
pankso@9704 139 --enable-shared --with-system-zlib \
pankso@9704 140 --enable-clocale=gnu --enable-objc-gc \
pankso@9704 141 --enable-__cxa_atexit --enable-lto \
pankso@9704 142 --enable-threads=posix \
pankso@9704 143 --with-tune=$ARCH $BUILD_HOST &&
pankso@9704 144 make && make install ;;
pankso@9704 145 esac
pankso@9 146 }
pankso@9 147
pankso@9 148 # Rules to gen a SliTaz package suitable for Tazpkg.
pankso@9 149 genpkg_rules()
pankso@9 150 {
pankso@9 151 mkdir -p $fs/usr/share
gokhlayeh@8181 152 cp -a $_pkg/usr/bin $fs/usr
pankso@9704 153
pankso@9704 154 # Copy all libs. Remove libgcc_s.so and libstdc++.so they goes in
pankso@9704 155 # the gcc-lib-base-$VERSION package.
gokhlayeh@8181 156 cp -a $_pkg/usr/lib $fs/usr
gokhlayeh@8181 157 rm $fs/usr/lib/libgcc_s.so*
gokhlayeh@8181 158 rm $fs/usr/lib/libstdc++.so*
gokhlayeh@8181 159 rm $fs/usr/lib/libgomp.so*
pankso@9704 160
gokhlayeh@8181 161 # Include files.
gokhlayeh@8181 162 cp -a $_pkg/usr/include $fs/usr
pankso@9704 163
gokhlayeh@8181 164 # Gfortran goes in gfortran-$VERSION package.
gokhlayeh@8181 165 rm -f $fs/usr/bin/*gfortran
gokhlayeh@8181 166 rm -f $fs/usr/lib/libgfortran*
gokhlayeh@8181 167 rm -f $fs/usr/lib/gcc/*/$VERSION/libgfortran*
gokhlayeh@8181 168 rm -rf $fs/usr/lib/gcc/*/$VERSION/f*
gokhlayeh@8181 169
gokhlayeh@8181 170 # Remove build directory.
gokhlayeh@8181 171 rm -r $WOK/$PACKAGE/$PACKAGE-build
pankso@9 172 }
pankso@9 173
pankso@9 174 # Post install commands for Tazpkg.
pankso@9 175 post_install()
pankso@9 176 {
pankso@9704 177 local root
pankso@9704 178 root=$1
pankso@9704 179 echo "Processing post-install commands..."
pankso@9704 180 if [ ! -f "$root/lib/cpp" ]; then
pankso@9704 181 ln -s ../usr/bin/cpp $root/lib
pankso@9704 182 fi
pankso@9704 183 if [ ! -f "$root/usr/bin/cc" ]; then
pankso@9704 184 ln -s gcc $root/usr/bin/cc
pankso@9704 185 fi
pankso@9 186 }