wok-6.x annotate gcc/receipt @ rev 10012
gcc: use the tripplet
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Thu May 19 03:54:02 2011 +0200 (2011-05-19) |
parents | 3653f7168b43 |
children | 614a9e8d90a4 |
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. |
slaxemulator@9781 | 15 DEPENDS="libgomp libobjc 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@10012 | 130 $src/configure \ |
pankso@10012 | 131 --libexecdir=/usr/lib \ |
pankso@10012 | 132 --disable-nls \ |
pankso@10012 | 133 --enable-shared \ |
pankso@10012 | 134 --enable-languages=c,c++ \ |
pankso@10012 | 135 --disable-multilib \ |
pankso@10012 | 136 --disable-libstdcxx-pch \ |
pankso@10012 | 137 --enable-__cxa_atexit \ |
pankso@10012 | 138 --enable-clocale=gnu \ |
pankso@10012 | 139 --enable-threads=posix \ |
pankso@10012 | 140 --build=$BUILD_HOST \ |
pankso@10012 | 141 --host=$BUILD_HOST \ |
pankso@10012 | 142 --target=$BUILD_HOST && |
pankso@10012 | 143 make && make install ;; |
pankso@9704 | 144 *) |
pankso@9704 | 145 # Used by default to produce a full featured GCC compiler. |
pankso@9704 | 146 echo "cook: configure GCC for: final/full build" |
pankso@10012 | 147 $src/configure \ |
pankso@10012 | 148 --libexecdir=/usr/lib \ |
pankso@10012 | 149 --enable-nls \ |
pankso@9704 | 150 --enable-languages=c,c++,objc,fortran \ |
pankso@10012 | 151 --enable-shared \ |
pankso@10012 | 152 --with-system-zlib \ |
pankso@10012 | 153 --enable-clocale=gnu \ |
pankso@10012 | 154 --enable-objc-gc \ |
pankso@10012 | 155 --enable-__cxa_atexit \ |
pankso@10012 | 156 --enable-lto \ |
pankso@10012 | 157 --enable-threads=posix \ |
pankso@10012 | 158 --with-tune=$ARCH \ |
pankso@10012 | 159 --build=$BUILD_HOST \ |
pankso@10012 | 160 --host=$BUILD_HOST \ |
pankso@10012 | 161 --target=$BUILD_HOST && |
pankso@10012 | 162 make && make install ;; |
pankso@9704 | 163 esac |
pankso@9 | 164 } |
pankso@9 | 165 |
pankso@9 | 166 # Rules to gen a SliTaz package suitable for Tazpkg. |
pankso@9 | 167 genpkg_rules() |
pankso@9 | 168 { |
pankso@9 | 169 mkdir -p $fs/usr/share |
gokhlayeh@8181 | 170 cp -a $_pkg/usr/bin $fs/usr |
pankso@9704 | 171 |
pankso@9704 | 172 # Copy all libs. Remove libgcc_s.so and libstdc++.so they goes in |
pankso@9704 | 173 # the gcc-lib-base-$VERSION package. |
gokhlayeh@8181 | 174 cp -a $_pkg/usr/lib $fs/usr |
gokhlayeh@8181 | 175 rm $fs/usr/lib/libgcc_s.so* |
gokhlayeh@8181 | 176 rm $fs/usr/lib/libstdc++.so* |
gokhlayeh@8181 | 177 rm $fs/usr/lib/libgomp.so* |
slaxemulator@9781 | 178 rm $fs/usr/lib/libobjc.so* |
slaxemulator@9781 | 179 |
gokhlayeh@8181 | 180 # Include files. |
gokhlayeh@8181 | 181 cp -a $_pkg/usr/include $fs/usr |
pankso@9704 | 182 |
gokhlayeh@8181 | 183 # Gfortran goes in gfortran-$VERSION package. |
gokhlayeh@8181 | 184 rm -f $fs/usr/bin/*gfortran |
gokhlayeh@8181 | 185 rm -f $fs/usr/lib/libgfortran* |
gokhlayeh@8181 | 186 rm -f $fs/usr/lib/gcc/*/$VERSION/libgfortran* |
gokhlayeh@8181 | 187 rm -rf $fs/usr/lib/gcc/*/$VERSION/f* |
gokhlayeh@8181 | 188 |
gokhlayeh@8181 | 189 # Remove build directory. |
pankso@9706 | 190 rm -rf $WOK/$PACKAGE/source/$PACKAGE-build |
pankso@9706 | 191 rm -rf $WOK/$PACKAGE/$PACKAGE-build |
pankso@9 | 192 } |
pankso@9 | 193 |
pankso@9 | 194 # Post install commands for Tazpkg. |
pankso@9 | 195 post_install() |
pankso@9 | 196 { |
pankso@9704 | 197 local root |
pankso@9704 | 198 root=$1 |
pankso@9704 | 199 echo "Processing post-install commands..." |
pankso@9704 | 200 if [ ! -f "$root/lib/cpp" ]; then |
pankso@9704 | 201 ln -s ../usr/bin/cpp $root/lib |
pankso@9704 | 202 fi |
pankso@9704 | 203 if [ ! -f "$root/usr/bin/cc" ]; then |
pankso@9704 | 204 ln -s gcc $root/usr/bin/cc |
pankso@9704 | 205 fi |
pankso@9 | 206 } |