wok-undigest view gcc/receipt @ rev 1038

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