wok-current view gcc/receipt @ rev 9118
glibc-dev: ensure necessary packages are built
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sat Mar 05 13:14:44 2011 +0100 (2011-03-05) |
parents | 0b4cf0d9e1b5 |
children | d1768332cee0 |
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 DEPENDS="libgomp gcc-lib-base mpc-library elfutils"
9 BUILD_DEPENDS="elfutils mpc-library"
10 TARBALL="$PACKAGE-$VERSION.tar.bz2"
11 WEB_SITE="http://gcc.gnu.org/"
12 WGET_URL="ftp://gcc.gnu.org/pub/gcc/releases/gcc-$VERSION/$TARBALL"
14 # Rules to compile & install the temporary toolchain.
15 precook_tmp_toolchain()
16 {
17 report open-bloc
18 cd $src
20 # GCC requires the GMP, MPFR and MPC packages.
21 tazwok get-src mpfr --target=$PWD/mpfr || { report close-bloc; return 1; }
22 tazwok get-src gmp --target=$PWD/gmp || { report close-bloc; return 1; }
23 tazwok get-src mpc-library --target=$PWD/mpc || { report close-bloc; return 1; }
25 report step "Running compilation"
27 # Build it in a separate directory.
28 mkdir ../gcc-build
29 cd ../gcc-build
31 { $src/configure \
32 --target=$BUILD_HOST \
33 --disable-nls --disable-shared --disable-multilib \
34 --disable-decimal-float --disable-threads \
35 --disable-libmudflap --disable-libssp \
36 --disable-libgomp --enable-languages=c \
37 --with-gmp-include=$(pwd)/gmp --with-gmp-lib=$(pwd)/gmp/.libs \
38 --without-ppl --without-cloog &&
39 make &&
40 make install
41 } || { report close-bloc; return 1; }
43 # See LFS for more detais about this.
44 ln -s libgcc.a `$BUILD_HOST-gcc -print-libgcc-file-name | \
45 sed 's/libgcc/&_eh/'`
46 report close-bloc
47 }
49 cook_tmp_toolchain()
50 {
51 report open-bloc
52 cd $src
53 patch -Np1 -i ../stuff/gcc-$VERSION-startfiles_fix-1.patch || { report close-bloc; return 1; }
55 # Details about theses lines are in LFS book.
56 sed 's@\./fixinc\.sh@-c true@' -i gcc/Makefile.in
57 sed 's/^T_CFLAGS =$/& -fomit-frame-pointer/' -i gcc/Makefile.in
58 for file in \
59 $(find gcc/config -name linux64.h -o -name linux.h -o -name sysv4.h)
60 do
61 sed -e 's@/lib\(64\)\?\(32\)\?/ld@/tools&@g' \
62 -e 's@/usr@/tools@g' -i $file
63 echo '
64 #undef STANDARD_INCLUDE_DIR
65 #define STANDARD_INCLUDE_DIR 0
66 #define STANDARD_STARTFILE_PREFIX_1 ""
67 #define STANDARD_STARTFILE_PREFIX_2 ""' >> $file
68 done
70 if [ "$ARCH" = x86_64 ]; then
71 for file in $(find gcc/config -name t-linux64) ; do
72 sed '/MULTILIB_OSDIRNAMES/d' -i $file
73 done
74 fi
76 # GCC requires the GMP, MPFR and MPC packages.
77 tazwok get-src mpfr --target=$PWD/mpfr || { report close-bloc; return 1; }
78 tazwok get-src gmp --target=$PWD/gmp || { report close-bloc; return 1; }
79 tazwok get-src mpc-library --target=$PWD/mpc || { report close-bloc; return 1; }
81 report step "Running compilation"
83 # Build it in a separate directory.
84 mkdir ../gcc-build
85 cd ../gcc-build
87 { CC="$BUILD_HOST-gcc -B/tools/lib/" \
88 AR=$BUILD_HOST-ar RANLIB=$BUILD_HOST-ranlib \
89 $src/configure \
90 --with-local-prefix=/tools --enable-clocale=gnu \
91 --enable-shared --enable-threads=posix \
92 --enable-__cxa_atexit --enable-languages=c,c++ \
93 --disable-libstdcxx-pch --disable-multilib \
94 --disable-bootstrap --disable-libgomp \
95 --with-gmp-include=$(pwd)/gmp --with-gmp-lib=$(pwd)/gmp/.libs \
96 --without-ppl --without-cloog &&
97 make &&
98 make install
99 } || { report close-bloc; return 1; }
100 ln -s gcc /tools/bin/cc
101 report close-bloc
102 }
104 # Rules to configure and make the package.
105 compile_rules()
106 {
107 # Use libiberty.a from binutils.
108 sed -i 's/install_to_$(INSTALL_DEST) //' \
109 $PACKAGE-$VERSION/libiberty/Makefile.in || return 1
110 mkdir -p gcc-build && cd gcc-build
111 $src/configure --enable-nls \
112 --enable-languages=c,c++,objc,fortran --enable-shared --with-system-zlib \
113 --enable-clocale=gnu --enable-objc-gc --enable-__cxa_atexit \
114 --enable-lto --disable-bootstrap libexecdir=/usr/lib \
115 --enable-threads=posix --with-tune=$ARCH $BUILD_HOST &&
116 make &&
117 make install
118 }
120 # Rules to gen a SliTaz package suitable for Tazpkg.
121 genpkg_rules()
122 {
123 mkdir -p $fs/usr/share
124 cp -a $_pkg/usr/bin $fs/usr
125 # Copy all libs. Remove libgcc_s.so and libstdc++.so
126 # they goes in gcc-lib-base-$VERSION package.
127 cp -a $_pkg/usr/lib $fs/usr
128 rm $fs/usr/lib/libgcc_s.so*
129 rm $fs/usr/lib/libstdc++.so*
130 rm $fs/usr/lib/libgomp.so*
131 # Include files.
132 cp -a $_pkg/usr/include $fs/usr
133 # Gfortran goes in gfortran-$VERSION package.
134 rm -f $fs/usr/bin/*gfortran
135 rm -f $fs/usr/lib/libgfortran*
136 rm -f $fs/usr/lib/gcc/*/$VERSION/libgfortran*
137 rm -rf $fs/usr/lib/gcc/*/$VERSION/f*
139 # Remove build directory.
140 rm -r $WOK/$PACKAGE/$PACKAGE-build
141 }
143 # Post install commands for Tazpkg.
144 post_install()
145 {
146 local root
147 root=$1
148 echo "Processing post-install commands..."
149 if [ ! -f "$root/lib/cpp" ]; then
150 ln -s ../usr/bin/cpp $root/lib
151 fi
152 if [ ! -f "$root/usr/bin/cc" ]; then
153 ln -s gcc $root/usr/bin/cc
154 fi
155 }