wok view gcc/receipt @ rev 10874

slitaz-tools-boxes: This can't be a wanted package. Compile_rules are made for non-wanted packages. Also tazwok doesn't execute compile_rules if its a wanted package.
author Christopher Rogers <slaxemulator@gmail.com>
date Sun Jun 19 12:25:19 2011 +0000 (2011-06-19)
parents 4b65e4765281
children 18c26403f57c
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 \
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 # Use libiberty.a from binutils.
33 sed -i 's/install_to_$(INSTALL_DEST) //' \
34 libiberty/Makefile.in || return 1
36 # Build it in a separate directory.
37 mkdir ../gcc-build
38 cd ../gcc-build
40 { $src/configure \
41 --target=$HOST_SYSTEM \
42 --disable-nls --disable-shared --disable-multilib \
43 --disable-decimal-float --disable-threads \
44 --disable-libmudflap --disable-libssp \
45 --disable-libgomp --enable-languages=c \
46 --with-gmp-include=$(pwd)/gmp --with-gmp-lib=$(pwd)/gmp/.libs \
47 --without-ppl --without-cloog &&
48 make &&
49 make install
50 } || { report close-bloc; return 1; }
52 # See LFS for more detais about this.
53 ln -s libgcc.a `$HOST_SYSTEM-gcc -print-libgcc-file-name | \
54 sed 's/libgcc/&_eh/'`
55 report close-bloc
56 }
58 cook_tmp_toolchain()
59 {
60 report open-bloc
61 cd $src
62 patch -Np1 -i $stuff/gcc-$VERSION-startfiles_fix-1.patch || { report close-bloc; return 1; }
64 # Details about theses lines are in LFS book.
65 sed 's@\./fixinc\.sh@-c true@' -i gcc/Makefile.in
66 sed 's/^T_CFLAGS =$/& -fomit-frame-pointer/' -i gcc/Makefile.in
67 for file in \
68 $(find gcc/config -name linux64.h -o -name linux.h -o -name sysv4.h)
69 do
70 sed -e 's@/lib\(64\)\?\(32\)\?/ld@/tools&@g' \
71 -e 's@/usr@/tools@g' -i $file
72 echo '
73 #undef STANDARD_INCLUDE_DIR
74 #define STANDARD_INCLUDE_DIR 0
75 #define STANDARD_STARTFILE_PREFIX_1 ""
76 #define STANDARD_STARTFILE_PREFIX_2 ""' >> $file
77 done
79 if [ "$ARCH" = x86_64 ]; then
80 for file in $(find gcc/config -name t-linux64) ; do
81 sed '/MULTILIB_OSDIRNAMES/d' -i $file
82 done
83 fi
85 # GCC requires the GMP, MPFR and MPC packages.
86 tazwok get-src mpfr --target=$PWD/mpfr || { report close-bloc; return 1; }
87 tazwok get-src gmp --target=$PWD/gmp || { report close-bloc; return 1; }
88 tazwok get-src mpc-library --target=$PWD/mpc || { report close-bloc; return 1; }
90 report step "Running compilation"
92 # Use libiberty.a from binutils.
93 sed -i 's/install_to_$(INSTALL_DEST) //' \
94 libiberty/Makefile.in || return 1
96 # Build it in a separate directory.
97 mkdir ../gcc-build
98 cd ../gcc-build
100 { CC="$HOST_SYSTEM-gcc -B/tools/lib/" \
101 AR=$HOST_SYSTEM-ar RANLIB=$HOST_SYSTEM-ranlib \
102 $src/configure \
103 --with-local-prefix=/tools --enable-clocale=gnu \
104 --enable-shared --enable-threads=posix \
105 --enable-__cxa_atexit --enable-languages=c,c++ \
106 --disable-libstdcxx-pch --disable-multilib \
107 --disable-bootstrap --disable-libgomp \
108 --with-gmp-include=$(pwd)/gmp --with-gmp-lib=$(pwd)/gmp/.libs \
109 --without-ppl --without-cloog &&
110 make &&
111 make install
112 } || { report close-bloc; return 1; }
113 ln -s gcc /tools/bin/cc
114 report close-bloc
115 }
117 # Rules to configure and make the package.
118 compile_rules()
119 {
120 cd $src
123 # SliTaz is a Busybox based OS, why we so small and fast. Using gawk by
124 # default to build package will not ensure package work with Busybox awk
125 # and so should NOT be use to cook.
126 if [ -x /usr/bin/cook ]; then
127 [ -d "/var/lib/tazpkg/installed/gawk" ] || tazpkg get-install gawk
128 fi
130 # Package slitaz-toolchain use 'cook --options' when rebuilding
131 # the full SliTaz toolchain.
132 [ "$2" == "--first-pass" ] && opt=$2
133 [ "$3" == "--first-pass" ] && opt=$3
135 # Use libiberty.a from binutils.
136 sed -i 's/install_to_$(INSTALL_DEST) //' \
137 libiberty/Makefile.in || return 1
138 mkdir -p ../gcc-build && cd ../gcc-build
140 # This is the default GCC and we want a native build to cross compile after.
141 # SliTaz target i486 host so we need a native i486 build for GCC.
142 case "$opt" in
143 --first-pass)
144 # Used by slitaz-toolchain when rebuilding the full toolchain.
145 echo "cook: configure GCC for: toolchain first pass"
146 $src/configure \
147 --libexecdir=/usr/lib \
148 --disable-nls \
149 --enable-shared \
150 --enable-languages=c,c++ \
151 --disable-libstdcxx-pch \
152 --enable-__cxa_atexit \
153 --enable-clocale=gnu \
154 --enable-threads=posix \
155 --disable-bootstrap \
156 --build=$HOST_SYSTEM \
157 --host=$HOST_SYSTEM &&
158 make && make install ;;
159 *)
160 # Used by default to produce a full featured X86 GCC compiler.
161 echo "cook: configure GCC for: final/full build"
162 $src/configure \
163 --libexecdir=/usr/lib \
164 --enable-nls \
165 --enable-languages=c,c++,objc,fortran \
166 --enable-shared \
167 --with-system-zlib \
168 --enable-clocale=gnu \
169 --enable-objc-gc \
170 --enable-__cxa_atexit \
171 --enable-lto \
172 --enable-threads=posix \
173 --disable-bootstrap \
174 --with-pkgversion="SliTaz" \
175 --with-tune=$ARCH \
176 --build=$HOST_SYSTEM \
177 --host=$HOST_SYSTEM &&
178 make && make install ;;
179 esac
180 }
182 # Rules to gen a SliTaz package suitable for Tazpkg.
183 genpkg_rules()
184 {
185 mkdir -p $fs/usr/share
186 cp -a $_pkg/usr/bin $fs/usr
188 # Copy all libs. Remove libgcc_s.so and libstdc++.so they goes in
189 # the gcc-lib-base package.
190 cp -a $_pkg/usr/lib $fs/usr
191 rm -f $fs/usr/lib/libgcc_s.so*
192 rm -f $fs/usr/lib/libstdc++.so*
193 rm -f $fs/usr/lib/libgomp.so*
194 rm -f $fs/usr/lib/libobjc.so*
196 # Include files.
197 cp -a $_pkg/usr/include $fs/usr
199 # Gfortran goes in gfortran package.
200 rm -f $fs/usr/bin/*gfortran
201 rm -f $fs/usr/lib/libgfortran*
202 rm -f $fs/usr/lib/gcc/*/$VERSION/libgfortran*
203 rm -rf $fs/usr/lib/gcc/*/$VERSION/f*
205 # Remove build directory.
206 rm -rf $WOK/$PACKAGE/source/$PACKAGE-build
207 rm -rf $WOK/$PACKAGE/$PACKAGE-build
208 }
210 # Post install commands for Tazpkg.
211 post_install()
212 {
213 local root
214 root=$1
215 echo "Processing post-install commands..."
216 if [ ! -f "$root/lib/cpp" ]; then
217 ln -s ../usr/bin/cpp $root/lib
218 fi
219 if [ ! -f "$root/usr/bin/cc" ]; then
220 ln -s gcc $root/usr/bin/cc
221 fi
222 }