wok annotate gcc/receipt @ rev 11875

poppler: remove poppler-data (not needed to view PDF document) and save 1,4 Mb on core
author Christophe Lincoln <pankso@slitaz.org>
date Tue Feb 28 00:29:35 2012 +0100 (2012-02-28)
parents 84e3f4466f26
children 2345afe1479a
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.
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
gokhlayeh@8181 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
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@9704 134
pankso@3185 135 # Use libiberty.a from binutils.
pankso@3185 136 sed -i 's/install_to_$(INSTALL_DEST) //' \
pankso@9704 137 libiberty/Makefile.in || return 1
pankso@9704 138 mkdir -p ../gcc-build && cd ../gcc-build
pankso@10036 139
pankso@10036 140 # This is the default GCC and we want a native build to cross compile after.
pankso@10036 141 # SliTaz target i486 host so we need a native i486 build for GCC.
pankso@9704 142 case "$opt" in
pankso@9704 143 --first-pass)
pankso@9704 144 # Used by slitaz-toolchain when rebuilding the full toolchain.
pankso@9704 145 echo "cook: configure GCC for: toolchain first pass"
pankso@10012 146 $src/configure \
pankso@10012 147 --libexecdir=/usr/lib \
pankso@10012 148 --disable-nls \
pankso@10012 149 --enable-shared \
pankso@10030 150 --enable-languages=c,c++ \
pankso@10012 151 --disable-libstdcxx-pch \
pankso@10012 152 --enable-__cxa_atexit \
pankso@10012 153 --enable-clocale=gnu \
pankso@10012 154 --enable-threads=posix \
pankso@10036 155 --disable-bootstrap \
pankso@10036 156 --build=$HOST_SYSTEM \
pankso@10036 157 --host=$HOST_SYSTEM &&
pankso@10012 158 make && make install ;;
pankso@9704 159 *)
pankso@10036 160 # Used by default to produce a full featured X86 GCC compiler.
pankso@9704 161 echo "cook: configure GCC for: final/full build"
pankso@10012 162 $src/configure \
pankso@10012 163 --libexecdir=/usr/lib \
pankso@10012 164 --enable-nls \
pankso@9704 165 --enable-languages=c,c++,objc,fortran \
pankso@10012 166 --enable-shared \
pankso@10012 167 --with-system-zlib \
pankso@10012 168 --enable-clocale=gnu \
pankso@10012 169 --enable-objc-gc \
pankso@10012 170 --enable-__cxa_atexit \
pankso@10012 171 --enable-lto \
pankso@10012 172 --enable-threads=posix \
pankso@10036 173 --disable-bootstrap \
pankso@10036 174 --with-pkgversion="SliTaz" \
pankso@10012 175 --with-tune=$ARCH \
pankso@10036 176 --build=$HOST_SYSTEM \
pankso@10036 177 --host=$HOST_SYSTEM &&
pankso@10012 178 make && make install ;;
pankso@9704 179 esac
pankso@9 180 }
pankso@9 181
pankso@9 182 # Rules to gen a SliTaz package suitable for Tazpkg.
pankso@9 183 genpkg_rules()
pankso@9 184 {
pankso@9 185 mkdir -p $fs/usr/share
gokhlayeh@8181 186 cp -a $_pkg/usr/bin $fs/usr
pankso@9704 187
pankso@9704 188 # Copy all libs. Remove libgcc_s.so and libstdc++.so they goes in
pankso@10036 189 # the gcc-lib-base package.
gokhlayeh@8181 190 cp -a $_pkg/usr/lib $fs/usr
pankso@10025 191 rm -f $fs/usr/lib/libgcc_s.so*
pankso@10025 192 rm -f $fs/usr/lib/libstdc++.so*
pankso@10025 193 rm -f $fs/usr/lib/libgomp.so*
pankso@10025 194 rm -f $fs/usr/lib/libobjc.so*
slaxemulator@9781 195
gokhlayeh@8181 196 # Include files.
gokhlayeh@8181 197 cp -a $_pkg/usr/include $fs/usr
pankso@9704 198
pankso@10036 199 # Gfortran goes in gfortran package.
gokhlayeh@8181 200 rm -f $fs/usr/bin/*gfortran
gokhlayeh@8181 201 rm -f $fs/usr/lib/libgfortran*
gokhlayeh@8181 202 rm -f $fs/usr/lib/gcc/*/$VERSION/libgfortran*
gokhlayeh@8181 203 rm -rf $fs/usr/lib/gcc/*/$VERSION/f*
gokhlayeh@8181 204
gokhlayeh@8181 205 # Remove build directory.
pankso@9706 206 rm -rf $WOK/$PACKAGE/source/$PACKAGE-build
pankso@9706 207 rm -rf $WOK/$PACKAGE/$PACKAGE-build
pankso@9 208 }
pankso@9 209
pankso@9 210 # Post install commands for Tazpkg.
pankso@9 211 post_install()
pankso@9 212 {
pankso@9704 213 local root
pankso@9704 214 root=$1
pankso@9704 215 echo "Processing post-install commands..."
pankso@9704 216 if [ ! -f "$root/lib/cpp" ]; then
pankso@9704 217 ln -s ../usr/bin/cpp $root/lib
pankso@9704 218 fi
pankso@9704 219 if [ ! -f "$root/usr/bin/cc" ]; then
pankso@9704 220 ln -s gcc $root/usr/bin/cc
pankso@9704 221 fi
pankso@9 222 }