wok-next view gcc/receipt @ rev 12435
jabberd2: update bdeps
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sat Apr 21 17:46:17 2012 +0200 (2012-04-21) |
parents | 18c26403f57c |
children | 0893b8771990 |
line source
1 # SliTaz package receipt.
3 PACKAGE="gcc"
4 VERSION="4.6.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="binutils 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
122 # SliTaz is a Busybox based OS, why we so small and fast. Using gawk by
123 # default to build package will not ensure package work with Busybox awk
124 # and so should NOT be use to cook.
125 if [ -x /usr/bin/cook ]; then
126 [ -d "/var/lib/tazpkg/installed/gawk" ] || tazpkg get-install gawk
127 fi
129 # Package slitaz-toolchain use 'cook --options' when rebuilding
130 # the full SliTaz toolchain.
131 [ "$2" == "--first-pass" ] && opt=$2
132 [ "$3" == "--first-pass" ] && opt=$3
134 # Use libiberty.a from binutils.
135 sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in || return 1
137 case $ARCH in
138 i?86) sed -i 's/^T_CFLAGS =$/& -fomit-frame-pointer/' \
139 gcc/Makefile.in ;;
140 esac
142 #sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in
144 mkdir -p ../gcc-build && cd ../gcc-build
146 # This is the default GCC and we want a native build to cross compile after.
147 # SliTaz target i486 host so we need a native i486 build for GCC.
148 case "$opt" in
149 --first-pass)
150 # Used by slitaz-toolchain when rebuilding the full toolchain.
151 echo "cook: configure GCC for: toolchain first pass"
152 $src/configure \
153 --libexecdir=/usr/lib \
154 --disable-nls \
155 --enable-shared \
156 --enable-languages=c,c++ \
157 --disable-libstdcxx-pch \
158 --enable-__cxa_atexit \
159 --enable-clocale=gnu \
160 --enable-threads=posix \
161 --disable-bootstrap \
162 --build=$HOST_SYSTEM \
163 --host=$HOST_SYSTEM &&
164 make && make install ;;
165 *)
166 # Used by default to produce a full featured X86 GCC compiler.
167 echo "cook: configure GCC for: final/full build"
168 $src/configure \
169 --libexecdir=/usr/lib \
170 --enable-nls \
171 --enable-languages=c,c++,objc,fortran \
172 --enable-shared \
173 --with-system-zlib \
174 --enable-clocale=gnu \
175 --enable-objc-gc \
176 --enable-__cxa_atexit \
177 --enable-lto \
178 --enable-threads=posix \
179 --disable-bootstrap \
180 --with-pkgversion="SliTaz" \
181 --with-tune=$ARCH \
182 --build=$HOST_SYSTEM \
183 --host=$HOST_SYSTEM &&
184 make && make install ;;
185 esac
186 }
188 # Rules to gen a SliTaz package suitable for Tazpkg.
189 genpkg_rules()
190 {
191 mkdir -p $fs/usr/share
192 cp -a $install/usr/bin $fs/usr
194 # Copy all libs. Remove libgcc_s.so and libstdc++.so they goes in
195 # the gcc-lib-base package.
196 cp -a $install/usr/lib $fs/usr
197 rm -f $fs/usr/lib/libgcc_s.so*
198 rm -f $fs/usr/lib/libstdc++.so*
199 rm -f $fs/usr/lib/libgomp.so*
200 rm -f $fs/usr/lib/libobjc.so*
202 # Include files.
203 cp -a $install/usr/include $fs/usr
205 # Gfortran goes in gfortran package.
206 rm -f $fs/usr/bin/*gfortran
207 rm -f $fs/usr/lib/libgfortran*
208 rm -f $fs/usr/lib/gcc/*/$VERSION/libgfortran*
209 rm -rf $fs/usr/lib/gcc/*/$VERSION/f*
211 # Remove build directory.
212 rm -rf $WOK/$PACKAGE/source/$PACKAGE-build
213 rm -rf $WOK/$PACKAGE/$PACKAGE-build
214 }
216 # Post install commands for Tazpkg.
217 post_install()
218 {
219 local root
220 root=$1
221 echo "Processing post-install commands..."
222 if [ ! -f "$root/lib/cpp" ]; then
223 ln -s ../usr/bin/cpp $root/lib
224 fi
225 if [ ! -f "$root/usr/bin/cc" ]; then
226 ln -s gcc $root/usr/bin/cc
227 fi
228 }