wok-next annotate gcc/receipt @ rev 13019
Up perl-berkeleydb (0.51)
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sat Jun 09 10:39:06 2012 +0200 (2012-06-09) |
parents | 2345afe1479a |
children | 4c16797dce28 |
rev | line source |
---|---|
pankso@9 | 1 # SliTaz package receipt. |
pankso@9 | 2 |
pankso@9 | 3 PACKAGE="gcc" |
pankso@12541 | 4 VERSION="4.6.3" |
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. |
gokhlayeh@11383 | 15 DEPENDS="binutils libgomp libobjc gcc-lib-base mpc-library elfutils" |
slaxemulator@10577 | 16 BUILD_DEPENDS="elfutils mpc-library mpfr mpfr-dev gmp gmp-dev \ |
slaxemulator@10353 | 17 elfutils-dev" |
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 |
slaxemulator@10422 | 32 # Use libiberty.a from binutils. |
slaxemulator@10422 | 33 sed -i 's/install_to_$(INSTALL_DEST) //' \ |
slaxemulator@10422 | 34 libiberty/Makefile.in || return 1 |
slaxemulator@10422 | 35 |
gokhlayeh@8181 | 36 # Build it in a separate directory. |
gokhlayeh@8181 | 37 mkdir ../gcc-build |
slaxemulator@10422 | 38 cd ../gcc-build |
gokhlayeh@8181 | 39 |
gokhlayeh@8181 | 40 { $src/configure \ |
slaxemulator@10422 | 41 --target=$HOST_SYSTEM \ |
gokhlayeh@8181 | 42 --disable-nls --disable-shared --disable-multilib \ |
gokhlayeh@8181 | 43 --disable-decimal-float --disable-threads \ |
gokhlayeh@8181 | 44 --disable-libmudflap --disable-libssp \ |
gokhlayeh@8181 | 45 --disable-libgomp --enable-languages=c \ |
gokhlayeh@8181 | 46 --with-gmp-include=$(pwd)/gmp --with-gmp-lib=$(pwd)/gmp/.libs \ |
gokhlayeh@8181 | 47 --without-ppl --without-cloog && |
gokhlayeh@8181 | 48 make && |
gokhlayeh@8181 | 49 make install |
gokhlayeh@8631 | 50 } || { report close-bloc; return 1; } |
gokhlayeh@8181 | 51 |
gokhlayeh@8181 | 52 # See LFS for more detais about this. |
slaxemulator@10422 | 53 ln -s libgcc.a `$HOST_SYSTEM-gcc -print-libgcc-file-name | \ |
gokhlayeh@8181 | 54 sed 's/libgcc/&_eh/'` |
gokhlayeh@8181 | 55 report close-bloc |
gokhlayeh@8181 | 56 } |
gokhlayeh@8181 | 57 |
gokhlayeh@8181 | 58 cook_tmp_toolchain() |
gokhlayeh@8181 | 59 { |
gokhlayeh@8181 | 60 report open-bloc |
gokhlayeh@8181 | 61 cd $src |
pankso@9705 | 62 patch -Np1 -i $stuff/gcc-$VERSION-startfiles_fix-1.patch || { report close-bloc; return 1; } |
gokhlayeh@8181 | 63 |
gokhlayeh@8181 | 64 # Details about theses lines are in LFS book. |
gokhlayeh@8181 | 65 sed 's@\./fixinc\.sh@-c true@' -i gcc/Makefile.in |
gokhlayeh@8181 | 66 sed 's/^T_CFLAGS =$/& -fomit-frame-pointer/' -i gcc/Makefile.in |
gokhlayeh@8181 | 67 for file in \ |
gokhlayeh@8181 | 68 $(find gcc/config -name linux64.h -o -name linux.h -o -name sysv4.h) |
gokhlayeh@8181 | 69 do |
gokhlayeh@8181 | 70 sed -e 's@/lib\(64\)\?\(32\)\?/ld@/tools&@g' \ |
gokhlayeh@8181 | 71 -e 's@/usr@/tools@g' -i $file |
gokhlayeh@8181 | 72 echo ' |
gokhlayeh@8181 | 73 #undef STANDARD_INCLUDE_DIR |
gokhlayeh@8181 | 74 #define STANDARD_INCLUDE_DIR 0 |
gokhlayeh@8181 | 75 #define STANDARD_STARTFILE_PREFIX_1 "" |
gokhlayeh@8181 | 76 #define STANDARD_STARTFILE_PREFIX_2 ""' >> $file |
gokhlayeh@8181 | 77 done |
gokhlayeh@8181 | 78 |
gokhlayeh@8181 | 79 if [ "$ARCH" = x86_64 ]; then |
gokhlayeh@8181 | 80 for file in $(find gcc/config -name t-linux64) ; do |
gokhlayeh@8181 | 81 sed '/MULTILIB_OSDIRNAMES/d' -i $file |
gokhlayeh@8181 | 82 done |
gokhlayeh@8181 | 83 fi |
pankso@12541 | 84 |
gokhlayeh@8181 | 85 # GCC requires the GMP, MPFR and MPC packages. |
gokhlayeh@8631 | 86 tazwok get-src mpfr --target=$PWD/mpfr || { report close-bloc; return 1; } |
gokhlayeh@8631 | 87 tazwok get-src gmp --target=$PWD/gmp || { report close-bloc; return 1; } |
gokhlayeh@8631 | 88 tazwok get-src mpc-library --target=$PWD/mpc || { report close-bloc; return 1; } |
gokhlayeh@8181 | 89 |
gokhlayeh@8181 | 90 report step "Running compilation" |
gokhlayeh@8181 | 91 |
slaxemulator@10422 | 92 # Use libiberty.a from binutils. |
slaxemulator@10422 | 93 sed -i 's/install_to_$(INSTALL_DEST) //' \ |
slaxemulator@10422 | 94 libiberty/Makefile.in || return 1 |
slaxemulator@10422 | 95 |
gokhlayeh@8181 | 96 # Build it in a separate directory. |
gokhlayeh@8181 | 97 mkdir ../gcc-build |
gokhlayeh@8181 | 98 cd ../gcc-build |
gokhlayeh@8181 | 99 |
slaxemulator@10422 | 100 { CC="$HOST_SYSTEM-gcc -B/tools/lib/" \ |
slaxemulator@10422 | 101 AR=$HOST_SYSTEM-ar RANLIB=$HOST_SYSTEM-ranlib \ |
gokhlayeh@8181 | 102 $src/configure \ |
gokhlayeh@8181 | 103 --with-local-prefix=/tools --enable-clocale=gnu \ |
gokhlayeh@8181 | 104 --enable-shared --enable-threads=posix \ |
gokhlayeh@8181 | 105 --enable-__cxa_atexit --enable-languages=c,c++ \ |
gokhlayeh@8181 | 106 --disable-libstdcxx-pch --disable-multilib \ |
gokhlayeh@8181 | 107 --disable-bootstrap --disable-libgomp \ |
gokhlayeh@8181 | 108 --with-gmp-include=$(pwd)/gmp --with-gmp-lib=$(pwd)/gmp/.libs \ |
gokhlayeh@8181 | 109 --without-ppl --without-cloog && |
gokhlayeh@8181 | 110 make && |
gokhlayeh@8181 | 111 make install |
gokhlayeh@8631 | 112 } || { report close-bloc; return 1; } |
gokhlayeh@8181 | 113 ln -s gcc /tools/bin/cc |
gokhlayeh@8181 | 114 report close-bloc |
gokhlayeh@8181 | 115 } |
gokhlayeh@8181 | 116 |
pankso@9 | 117 # Rules to configure and make the package. |
pankso@9 | 118 compile_rules() |
pankso@9 | 119 { |
pankso@9704 | 120 cd $src |
pankso@10030 | 121 |
slaxemulator@10353 | 122 # SliTaz is a Busybox based OS, why we so small and fast. Using gawk by |
slaxemulator@10353 | 123 # default to build package will not ensure package work with Busybox awk |
slaxemulator@10353 | 124 # and so should NOT be use to cook. |
slaxemulator@10353 | 125 if [ -x /usr/bin/cook ]; then |
slaxemulator@10353 | 126 [ -d "/var/lib/tazpkg/installed/gawk" ] || tazpkg get-install gawk |
slaxemulator@10353 | 127 fi |
slaxemulator@10353 | 128 |
pankso@9704 | 129 # Package slitaz-toolchain use 'cook --options' when rebuilding |
pankso@9707 | 130 # the full SliTaz toolchain. |
pankso@9707 | 131 [ "$2" == "--first-pass" ] && opt=$2 |
pankso@9704 | 132 [ "$3" == "--first-pass" ] && opt=$3 |
pankso@12541 | 133 |
pankso@3185 | 134 # Use libiberty.a from binutils. |
pankso@12267 | 135 sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in || return 1 |
pankso@12541 | 136 |
pankso@12267 | 137 case $ARCH in |
pankso@12267 | 138 i?86) sed -i 's/^T_CFLAGS =$/& -fomit-frame-pointer/' \ |
pankso@12267 | 139 gcc/Makefile.in ;; |
pankso@12267 | 140 esac |
pankso@12541 | 141 |
pankso@12267 | 142 #sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in |
pankso@12541 | 143 |
pankso@9704 | 144 mkdir -p ../gcc-build && cd ../gcc-build |
pankso@10036 | 145 |
pankso@10036 | 146 # This is the default GCC and we want a native build to cross compile after. |
pankso@10036 | 147 # SliTaz target i486 host so we need a native i486 build for GCC. |
pankso@9704 | 148 case "$opt" in |
pankso@9704 | 149 --first-pass) |
pankso@9704 | 150 # Used by slitaz-toolchain when rebuilding the full toolchain. |
pankso@9704 | 151 echo "cook: configure GCC for: toolchain first pass" |
pankso@10012 | 152 $src/configure \ |
pankso@10012 | 153 --libexecdir=/usr/lib \ |
pankso@10012 | 154 --disable-nls \ |
pankso@10012 | 155 --enable-shared \ |
pankso@10030 | 156 --enable-languages=c,c++ \ |
pankso@10012 | 157 --disable-libstdcxx-pch \ |
pankso@10012 | 158 --enable-__cxa_atexit \ |
pankso@10012 | 159 --enable-clocale=gnu \ |
pankso@10012 | 160 --enable-threads=posix \ |
pankso@10036 | 161 --disable-bootstrap \ |
pankso@10036 | 162 --build=$HOST_SYSTEM \ |
pankso@10036 | 163 --host=$HOST_SYSTEM && |
pankso@10012 | 164 make && make install ;; |
pankso@9704 | 165 *) |
pankso@10036 | 166 # Used by default to produce a full featured X86 GCC compiler. |
pankso@9704 | 167 echo "cook: configure GCC for: final/full build" |
pankso@10012 | 168 $src/configure \ |
pankso@10012 | 169 --libexecdir=/usr/lib \ |
pankso@10012 | 170 --enable-nls \ |
pankso@9704 | 171 --enable-languages=c,c++,objc,fortran \ |
pankso@10012 | 172 --enable-shared \ |
pankso@10012 | 173 --with-system-zlib \ |
pankso@10012 | 174 --enable-clocale=gnu \ |
pankso@10012 | 175 --enable-objc-gc \ |
pankso@10012 | 176 --enable-__cxa_atexit \ |
pankso@10012 | 177 --enable-lto \ |
pankso@10012 | 178 --enable-threads=posix \ |
pankso@10036 | 179 --disable-bootstrap \ |
pankso@10036 | 180 --with-pkgversion="SliTaz" \ |
pankso@10012 | 181 --with-tune=$ARCH \ |
pankso@10036 | 182 --build=$HOST_SYSTEM \ |
pankso@10036 | 183 --host=$HOST_SYSTEM && |
pankso@10012 | 184 make && make install ;; |
pankso@9704 | 185 esac |
pankso@9 | 186 } |
pankso@9 | 187 |
pankso@9 | 188 # Rules to gen a SliTaz package suitable for Tazpkg. |
pankso@9 | 189 genpkg_rules() |
pankso@9 | 190 { |
pankso@9 | 191 mkdir -p $fs/usr/share |
pankso@12267 | 192 cp -a $install/usr/bin $fs/usr |
pankso@12541 | 193 |
pankso@9704 | 194 # Copy all libs. Remove libgcc_s.so and libstdc++.so they goes in |
pankso@10036 | 195 # the gcc-lib-base package. |
pankso@12267 | 196 cp -a $install/usr/lib $fs/usr |
pankso@10025 | 197 rm -f $fs/usr/lib/libgcc_s.so* |
pankso@10025 | 198 rm -f $fs/usr/lib/libstdc++.so* |
pankso@10025 | 199 rm -f $fs/usr/lib/libgomp.so* |
pankso@10025 | 200 rm -f $fs/usr/lib/libobjc.so* |
slaxemulator@9781 | 201 |
gokhlayeh@8181 | 202 # Include files. |
pankso@12267 | 203 cp -a $install/usr/include $fs/usr |
pankso@12541 | 204 |
pankso@10036 | 205 # Gfortran goes in gfortran package. |
gokhlayeh@8181 | 206 rm -f $fs/usr/bin/*gfortran |
gokhlayeh@8181 | 207 rm -f $fs/usr/lib/libgfortran* |
gokhlayeh@8181 | 208 rm -f $fs/usr/lib/gcc/*/$VERSION/libgfortran* |
gokhlayeh@8181 | 209 rm -rf $fs/usr/lib/gcc/*/$VERSION/f* |
pankso@12541 | 210 |
gokhlayeh@8181 | 211 # Remove build directory. |
pankso@9706 | 212 rm -rf $WOK/$PACKAGE/source/$PACKAGE-build |
pankso@9706 | 213 rm -rf $WOK/$PACKAGE/$PACKAGE-build |
pankso@9 | 214 } |
pankso@9 | 215 |
pankso@9 | 216 # Post install commands for Tazpkg. |
pankso@9 | 217 post_install() |
pankso@9 | 218 { |
pankso@9704 | 219 local root |
pankso@9704 | 220 root=$1 |
pankso@9704 | 221 echo "Processing post-install commands..." |
pankso@9704 | 222 if [ ! -f "$root/lib/cpp" ]; then |
pankso@9704 | 223 ln -s ../usr/bin/cpp $root/lib |
pankso@9704 | 224 fi |
pankso@9704 | 225 if [ ! -f "$root/usr/bin/cc" ]; then |
pankso@9704 | 226 ln -s gcc $root/usr/bin/cc |
pankso@9704 | 227 fi |
pankso@9 | 228 } |