wok-stable annotate gcc/receipt @ rev 9708

gcc: add few more options and enable c++ in --first-pass and remove --tune since we got configure WARNNIG, not use by LFS and not usefull we already have the tripplet --build, --host, --target
author Christophe Lincoln <pankso@slitaz.org>
date Sun May 08 20:39:17 2011 +0200 (2011-05-08)
parents 534b79da8611
children e393bc63082b
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@9707 117 # the full SliTaz toolchain.
pankso@9707 118 [ "$2" == "--first-pass" ] && opt=$2
pankso@9704 119 [ "$3" == "--first-pass" ] && opt=$3
pankso@9704 120
pankso@3185 121 # Use libiberty.a from binutils.
pankso@3185 122 sed -i 's/install_to_$(INSTALL_DEST) //' \
pankso@9704 123 libiberty/Makefile.in || return 1
pankso@9704 124 mkdir -p ../gcc-build && cd ../gcc-build
pankso@9704 125
pankso@9704 126 case "$opt" in
pankso@9704 127 --first-pass)
pankso@9704 128 # Used by slitaz-toolchain when rebuilding the full toolchain.
pankso@9704 129 echo "cook: configure GCC for: toolchain first pass"
pankso@9704 130 $src/configure --libexecdir=/usr/lib \
pankso@9704 131 --disable-nls --enable-shared \
pankso@9708 132 --enable-languages=c,c++ --disable-multilib \
pankso@9708 133 --disable-libstdcxx-pch --enable-__cxa_atexit \
pankso@9708 134 --enable-clocale=gnu --enable-threads=posix &&
pankso@9704 135 make && make install ;;
pankso@9704 136 *)
pankso@9704 137 # Used by default to produce a full featured GCC compiler.
pankso@9704 138 echo "cook: configure GCC for: final/full build"
pankso@9704 139 $src/configure --libexecdir=/usr/lib --enable-nls \
pankso@9704 140 --enable-languages=c,c++,objc,fortran \
pankso@9704 141 --enable-shared --with-system-zlib \
pankso@9704 142 --enable-clocale=gnu --enable-objc-gc \
pankso@9704 143 --enable-__cxa_atexit --enable-lto \
pankso@9708 144 --enable-threads=posix &&
pankso@9704 145 make && make install ;;
pankso@9704 146 esac
pankso@9 147 }
pankso@9 148
pankso@9 149 # Rules to gen a SliTaz package suitable for Tazpkg.
pankso@9 150 genpkg_rules()
pankso@9 151 {
pankso@9 152 mkdir -p $fs/usr/share
gokhlayeh@8181 153 cp -a $_pkg/usr/bin $fs/usr
pankso@9704 154
pankso@9704 155 # Copy all libs. Remove libgcc_s.so and libstdc++.so they goes in
pankso@9704 156 # the gcc-lib-base-$VERSION package.
gokhlayeh@8181 157 cp -a $_pkg/usr/lib $fs/usr
gokhlayeh@8181 158 rm $fs/usr/lib/libgcc_s.so*
gokhlayeh@8181 159 rm $fs/usr/lib/libstdc++.so*
gokhlayeh@8181 160 rm $fs/usr/lib/libgomp.so*
pankso@9704 161
gokhlayeh@8181 162 # Include files.
gokhlayeh@8181 163 cp -a $_pkg/usr/include $fs/usr
pankso@9704 164
gokhlayeh@8181 165 # Gfortran goes in gfortran-$VERSION package.
gokhlayeh@8181 166 rm -f $fs/usr/bin/*gfortran
gokhlayeh@8181 167 rm -f $fs/usr/lib/libgfortran*
gokhlayeh@8181 168 rm -f $fs/usr/lib/gcc/*/$VERSION/libgfortran*
gokhlayeh@8181 169 rm -rf $fs/usr/lib/gcc/*/$VERSION/f*
gokhlayeh@8181 170
gokhlayeh@8181 171 # Remove build directory.
pankso@9706 172 rm -rf $WOK/$PACKAGE/source/$PACKAGE-build
pankso@9706 173 rm -rf $WOK/$PACKAGE/$PACKAGE-build
pankso@9 174 }
pankso@9 175
pankso@9 176 # Post install commands for Tazpkg.
pankso@9 177 post_install()
pankso@9 178 {
pankso@9704 179 local root
pankso@9704 180 root=$1
pankso@9704 181 echo "Processing post-install commands..."
pankso@9704 182 if [ ! -f "$root/lib/cpp" ]; then
pankso@9704 183 ln -s ../usr/bin/cpp $root/lib
pankso@9704 184 fi
pankso@9704 185 if [ ! -f "$root/usr/bin/cc" ]; then
pankso@9704 186 ln -s gcc $root/usr/bin/cc
pankso@9704 187 fi
pankso@9 188 }