wok-current annotate gcc/receipt @ rev 16314

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