wok annotate gcc/receipt @ rev 10353

gcc: Removed gawk in build depends. Added check like the one glibc has to install if cook script is found. Fixed tazwok cookorder i hope.
author Christopher Rogers <slaxemulator@gmail.com>
date Sun May 22 16:40:19 2011 +0000 (2011-05-22)
parents 560bead4e358
children 4b65e4765281
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 \
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
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 \
gokhlayeh@8181 94 $src/configure \
gokhlayeh@8181 95 --with-local-prefix=/tools --enable-clocale=gnu \
gokhlayeh@8181 96 --enable-shared --enable-threads=posix \
gokhlayeh@8181 97 --enable-__cxa_atexit --enable-languages=c,c++ \
gokhlayeh@8181 98 --disable-libstdcxx-pch --disable-multilib \
gokhlayeh@8181 99 --disable-bootstrap --disable-libgomp \
gokhlayeh@8181 100 --with-gmp-include=$(pwd)/gmp --with-gmp-lib=$(pwd)/gmp/.libs \
gokhlayeh@8181 101 --without-ppl --without-cloog &&
gokhlayeh@8181 102 make &&
gokhlayeh@8181 103 make install
gokhlayeh@8631 104 } || { report close-bloc; return 1; }
gokhlayeh@8181 105 ln -s gcc /tools/bin/cc
gokhlayeh@8181 106 report close-bloc
gokhlayeh@8181 107 }
gokhlayeh@8181 108
pankso@9 109 # Rules to configure and make the package.
pankso@9 110 compile_rules()
pankso@9 111 {
pankso@9704 112 cd $src
pankso@10030 113
slaxemulator@10353 114
slaxemulator@10353 115 # SliTaz is a Busybox based OS, why we so small and fast. Using gawk by
slaxemulator@10353 116 # default to build package will not ensure package work with Busybox awk
slaxemulator@10353 117 # and so should NOT be use to cook.
slaxemulator@10353 118 if [ -x /usr/bin/cook ]; then
slaxemulator@10353 119 [ -d "/var/lib/tazpkg/installed/gawk" ] || tazpkg get-install gawk
slaxemulator@10353 120 fi
slaxemulator@10353 121
pankso@9704 122 # Package slitaz-toolchain use 'cook --options' when rebuilding
pankso@9707 123 # the full SliTaz toolchain.
pankso@9707 124 [ "$2" == "--first-pass" ] && opt=$2
pankso@9704 125 [ "$3" == "--first-pass" ] && opt=$3
pankso@9704 126
pankso@3185 127 # Use libiberty.a from binutils.
pankso@3185 128 sed -i 's/install_to_$(INSTALL_DEST) //' \
pankso@9704 129 libiberty/Makefile.in || return 1
pankso@9704 130 mkdir -p ../gcc-build && cd ../gcc-build
pankso@10036 131
pankso@10036 132 # This is the default GCC and we want a native build to cross compile after.
pankso@10036 133 # SliTaz target i486 host so we need a native i486 build for GCC.
pankso@9704 134 case "$opt" in
pankso@9704 135 --first-pass)
pankso@9704 136 # Used by slitaz-toolchain when rebuilding the full toolchain.
pankso@9704 137 echo "cook: configure GCC for: toolchain first pass"
pankso@10012 138 $src/configure \
pankso@10012 139 --libexecdir=/usr/lib \
pankso@10012 140 --disable-nls \
pankso@10012 141 --enable-shared \
pankso@10030 142 --enable-languages=c,c++ \
pankso@10012 143 --disable-libstdcxx-pch \
pankso@10012 144 --enable-__cxa_atexit \
pankso@10012 145 --enable-clocale=gnu \
pankso@10012 146 --enable-threads=posix \
pankso@10036 147 --disable-bootstrap \
pankso@10036 148 --build=$HOST_SYSTEM \
pankso@10036 149 --host=$HOST_SYSTEM &&
pankso@10012 150 make && make install ;;
pankso@9704 151 *)
pankso@10036 152 # Used by default to produce a full featured X86 GCC compiler.
pankso@9704 153 echo "cook: configure GCC for: final/full build"
pankso@10012 154 $src/configure \
pankso@10012 155 --libexecdir=/usr/lib \
pankso@10012 156 --enable-nls \
pankso@9704 157 --enable-languages=c,c++,objc,fortran \
pankso@10012 158 --enable-shared \
pankso@10012 159 --with-system-zlib \
pankso@10012 160 --enable-clocale=gnu \
pankso@10012 161 --enable-objc-gc \
pankso@10012 162 --enable-__cxa_atexit \
pankso@10012 163 --enable-lto \
pankso@10012 164 --enable-threads=posix \
pankso@10036 165 --disable-bootstrap \
pankso@10036 166 --with-pkgversion="SliTaz" \
pankso@10012 167 --with-tune=$ARCH \
pankso@10036 168 --build=$HOST_SYSTEM \
pankso@10036 169 --host=$HOST_SYSTEM &&
pankso@10012 170 make && make install ;;
pankso@9704 171 esac
pankso@9 172 }
pankso@9 173
pankso@9 174 # Rules to gen a SliTaz package suitable for Tazpkg.
pankso@9 175 genpkg_rules()
pankso@9 176 {
pankso@9 177 mkdir -p $fs/usr/share
gokhlayeh@8181 178 cp -a $_pkg/usr/bin $fs/usr
pankso@9704 179
pankso@9704 180 # Copy all libs. Remove libgcc_s.so and libstdc++.so they goes in
pankso@10036 181 # the gcc-lib-base package.
gokhlayeh@8181 182 cp -a $_pkg/usr/lib $fs/usr
pankso@10025 183 rm -f $fs/usr/lib/libgcc_s.so*
pankso@10025 184 rm -f $fs/usr/lib/libstdc++.so*
pankso@10025 185 rm -f $fs/usr/lib/libgomp.so*
pankso@10025 186 rm -f $fs/usr/lib/libobjc.so*
slaxemulator@9781 187
gokhlayeh@8181 188 # Include files.
gokhlayeh@8181 189 cp -a $_pkg/usr/include $fs/usr
pankso@9704 190
pankso@10036 191 # Gfortran goes in gfortran package.
gokhlayeh@8181 192 rm -f $fs/usr/bin/*gfortran
gokhlayeh@8181 193 rm -f $fs/usr/lib/libgfortran*
gokhlayeh@8181 194 rm -f $fs/usr/lib/gcc/*/$VERSION/libgfortran*
gokhlayeh@8181 195 rm -rf $fs/usr/lib/gcc/*/$VERSION/f*
gokhlayeh@8181 196
gokhlayeh@8181 197 # Remove build directory.
pankso@9706 198 rm -rf $WOK/$PACKAGE/source/$PACKAGE-build
pankso@9706 199 rm -rf $WOK/$PACKAGE/$PACKAGE-build
pankso@9 200 }
pankso@9 201
pankso@9 202 # Post install commands for Tazpkg.
pankso@9 203 post_install()
pankso@9 204 {
pankso@9704 205 local root
pankso@9704 206 root=$1
pankso@9704 207 echo "Processing post-install commands..."
pankso@9704 208 if [ ! -f "$root/lib/cpp" ]; then
pankso@9704 209 ln -s ../usr/bin/cpp $root/lib
pankso@9704 210 fi
pankso@9704 211 if [ ! -f "$root/usr/bin/cc" ]; then
pankso@9704 212 ln -s gcc $root/usr/bin/cc
pankso@9704 213 fi
pankso@9 214 }