wok-current view gcc/receipt @ rev 10411

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