wok-next annotate gcc/receipt @ rev 13639

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