wok view gcc/receipt @ rev 15368

Up ipxe (1.0.0-20130925)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Oct 14 13:38:36 2013 +0000 (2013-10-14)
parents 4c16797dce28
children 3a1e8d25c320
line source
1 # SliTaz package receipt.
3 PACKAGE="gcc"
4 VERSION="4.6.3"
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 } || { report close-bloc; return 1; }
54 # See LFS for more detais about this.
55 ln -s libgcc.a `$HOST_SYSTEM-gcc -print-libgcc-file-name | \
56 sed 's/libgcc/&_eh/'`
57 report close-bloc
58 }
60 cook_tmp_toolchain()
61 {
62 report open-bloc
63 cd $src
64 patch -Np1 -i $stuff/gcc-$VERSION-startfiles_fix-1.patch || { report close-bloc; return 1; }
66 # Details about theses lines are in LFS book.
67 sed 's@\./fixinc\.sh@-c true@' -i gcc/Makefile.in
68 sed 's/^T_CFLAGS =$/& -fomit-frame-pointer/' -i gcc/Makefile.in
69 for file in \
70 $(find gcc/config -name linux64.h -o -name linux.h -o -name sysv4.h)
71 do
72 sed -e 's@/lib\(64\)\?\(32\)\?/ld@/tools&@g' \
73 -e 's@/usr@/tools@g' -i $file
74 echo '
75 #undef STANDARD_INCLUDE_DIR
76 #define STANDARD_INCLUDE_DIR 0
77 #define STANDARD_STARTFILE_PREFIX_1 ""
78 #define STANDARD_STARTFILE_PREFIX_2 ""' >> $file
79 done
81 if [ "$ARCH" = x86_64 ]; then
82 for file in $(find gcc/config -name t-linux64) ; do
83 sed '/MULTILIB_OSDIRNAMES/d' -i $file
84 done
85 fi
87 # GCC requires the GMP, MPFR and MPC packages.
88 tazwok get-src mpfr --target=$PWD/mpfr || { report close-bloc; return 1; }
89 tazwok get-src gmp --target=$PWD/gmp || { report close-bloc; return 1; }
90 tazwok get-src mpc-library --target=$PWD/mpc || { report close-bloc; return 1; }
92 report step "Running compilation"
94 # Use libiberty.a from binutils.
95 sed -i 's/install_to_$(INSTALL_DEST) //' \
96 libiberty/Makefile.in || return 1
98 # Build it in a separate directory.
99 mkdir ../gcc-build
100 cd ../gcc-build
102 { CC="$HOST_SYSTEM-gcc -B/tools/lib/" \
103 AR=$HOST_SYSTEM-ar RANLIB=$HOST_SYSTEM-ranlib \
104 $src/configure \
105 --with-local-prefix=/tools --enable-clocale=gnu \
106 --enable-shared --enable-threads=posix \
107 --enable-__cxa_atexit --enable-languages=c,c++ \
108 --disable-libstdcxx-pch --disable-multilib \
109 --disable-bootstrap --disable-libgomp \
110 --with-gmp-include=$(pwd)/gmp --with-gmp-lib=$(pwd)/gmp/.libs \
111 --without-ppl --without-cloog &&
112 make &&
113 make install
114 } || { report close-bloc; return 1; }
115 ln -s gcc /tools/bin/cc
116 report close-bloc
117 }
119 # Rules to configure and make the package.
120 compile_rules()
121 {
122 cd $src
124 # SliTaz is a Busybox based OS, why we so small and fast. Using gawk by
125 # default to build package will not ensure package work with Busybox awk
126 # and so should NOT be use to cook.
127 if [ -x /usr/bin/cook ]; then
128 [ -d "/var/lib/tazpkg/installed/gawk" ] || tazpkg get-install gawk
129 fi
131 # Package slitaz-toolchain use 'cook --options' when rebuilding
132 # the full SliTaz toolchain.
133 [ "$2" == "--first-pass" ] && opt=$2
134 [ "$3" == "--first-pass" ] && opt=$3
136 # Use libiberty.a from binutils.
137 sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in || return 1
139 case $ARCH in
140 i?86) sed -i 's/^T_CFLAGS =$/& -fomit-frame-pointer/' \
141 gcc/Makefile.in ;;
142 esac
144 #sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in
146 mkdir -p ../gcc-build && cd ../gcc-build
148 # This is the default GCC and we want a native build to cross compile after.
149 # SliTaz target i486 host so we need a native i486 build for GCC.
150 case "$opt" in
151 --first-pass)
152 # Used by slitaz-toolchain when rebuilding the full toolchain.
153 echo "cook: configure GCC for: toolchain first pass"
154 $src/configure \
155 --libexecdir=/usr/lib \
156 --disable-nls \
157 --enable-shared \
158 --enable-languages=c,c++ \
159 --disable-libstdcxx-pch \
160 --enable-__cxa_atexit \
161 --enable-clocale=gnu \
162 --enable-threads=posix \
163 --disable-bootstrap \
164 --build=$HOST_SYSTEM \
165 --host=$HOST_SYSTEM &&
166 make && make install ;;
167 *)
168 # Used by default to produce a full featured X86 GCC compiler.
169 echo "cook: configure GCC for: final/full build"
170 $src/configure \
171 --libexecdir=/usr/lib \
172 --enable-nls \
173 --enable-languages=c,c++,objc,fortran \
174 --enable-shared \
175 --with-system-zlib \
176 --enable-clocale=gnu \
177 --enable-objc-gc \
178 --enable-__cxa_atexit \
179 --enable-lto \
180 --enable-threads=posix \
181 --disable-bootstrap \
182 --with-pkgversion="SliTaz" \
183 --with-tune=$ARCH \
184 --build=$HOST_SYSTEM \
185 --host=$HOST_SYSTEM &&
186 make && make install ;;
187 esac
188 }
190 # Rules to gen a SliTaz package suitable for Tazpkg.
191 genpkg_rules()
192 {
193 mkdir -p $fs/usr/share
194 cp -a $install/usr/bin $fs/usr
196 # Copy all libs. Remove libgcc_s.so and libstdc++.so they goes in
197 # the gcc-lib-base package.
198 cp -a $install/usr/lib $fs/usr
199 rm -f $fs/usr/lib/libgcc_s.so*
200 rm -f $fs/usr/lib/libstdc++.so*
201 rm -f $fs/usr/lib/libgomp.so*
202 rm -f $fs/usr/lib/libobjc.so*
204 # Include files.
205 cp -a $install/usr/include $fs/usr
207 # Gfortran goes in gfortran package.
208 rm -f $fs/usr/bin/*gfortran
209 rm -f $fs/usr/lib/libgfortran*
210 rm -f $fs/usr/lib/gcc/*/$VERSION/libgfortran*
211 rm -rf $fs/usr/lib/gcc/*/$VERSION/f*
213 # Remove build directory.
214 rm -rf $WOK/$PACKAGE/source/$PACKAGE-build
215 rm -rf $WOK/$PACKAGE/$PACKAGE-build
216 }
218 # Post install commands for Tazpkg.
219 post_install()
220 {
221 local root
222 root=$1
223 echo "Processing post-install commands..."
224 if [ ! -f "$root/lib/cpp" ]; then
225 ln -s ../usr/bin/cpp $root/lib
226 fi
227 if [ ! -f "$root/usr/bin/cc" ]; then
228 ln -s gcc $root/usr/bin/cc
229 fi
230 }