wok view gcc/receipt @ rev 13838

Up freerdp (1.0.2)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Jan 07 23:12:50 2013 +0100 (2013-01-07)
parents 0893b8771990
children 380ffe05937a
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 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"
11 TAGS="compiler C"
13 # We need gawk since busybox awk is not sufficient. We have BUILD_DEPENDS
14 # for cookutils that are not used by tazwok/cook-toolchain since it install
15 # and use it's own copy.
16 DEPENDS="binutils libgomp libobjc gcc-lib-base mpc-library elfutils"
17 BUILD_DEPENDS="elfutils mpc-library mpfr mpfr-dev gmp gmp-dev \
18 elfutils-dev"
20 # Rules to compile & install the temporary toolchain.
21 precook_tmp_toolchain()
22 {
23 report open-bloc
24 cd $src
26 # GCC requires the GMP, MPFR and MPC packages.
27 tazwok get-src mpfr --target=$PWD/mpfr || { report close-bloc; return 1; }
28 tazwok get-src gmp --target=$PWD/gmp || { report close-bloc; return 1; }
29 tazwok get-src mpc-library --target=$PWD/mpc || { report close-bloc; return 1; }
31 report step "Running compilation"
33 # Use libiberty.a from binutils.
34 sed -i 's/install_to_$(INSTALL_DEST) //' \
35 libiberty/Makefile.in || return 1
37 # Build it in a separate directory.
38 mkdir ../gcc-build
39 cd ../gcc-build
41 { $src/configure \
42 --target=$HOST_SYSTEM \
43 --disable-nls --disable-shared --disable-multilib \
44 --disable-decimal-float --disable-threads \
45 --disable-libmudflap --disable-libssp \
46 --disable-libgomp --enable-languages=c \
47 --with-gmp-include=$(pwd)/gmp --with-gmp-lib=$(pwd)/gmp/.libs \
48 --without-ppl --without-cloog &&
49 make &&
50 make install
51 } || { report close-bloc; return 1; }
53 # See LFS for more detais about this.
54 ln -s libgcc.a `$HOST_SYSTEM-gcc -print-libgcc-file-name | \
55 sed 's/libgcc/&_eh/'`
56 report close-bloc
57 }
59 cook_tmp_toolchain()
60 {
61 report open-bloc
62 cd $src
63 patch -Np1 -i $stuff/gcc-$VERSION-startfiles_fix-1.patch || { report close-bloc; return 1; }
65 # Details about theses lines are in LFS book.
66 sed 's@\./fixinc\.sh@-c true@' -i gcc/Makefile.in
67 sed 's/^T_CFLAGS =$/& -fomit-frame-pointer/' -i gcc/Makefile.in
68 for file in \
69 $(find gcc/config -name linux64.h -o -name linux.h -o -name sysv4.h)
70 do
71 sed -e 's@/lib\(64\)\?\(32\)\?/ld@/tools&@g' \
72 -e 's@/usr@/tools@g' -i $file
73 echo '
74 #undef STANDARD_INCLUDE_DIR
75 #define STANDARD_INCLUDE_DIR 0
76 #define STANDARD_STARTFILE_PREFIX_1 ""
77 #define STANDARD_STARTFILE_PREFIX_2 ""' >> $file
78 done
80 if [ "$ARCH" = x86_64 ]; then
81 for file in $(find gcc/config -name t-linux64) ; do
82 sed '/MULTILIB_OSDIRNAMES/d' -i $file
83 done
84 fi
86 # GCC requires the GMP, MPFR and MPC packages.
87 tazwok get-src mpfr --target=$PWD/mpfr || { report close-bloc; return 1; }
88 tazwok get-src gmp --target=$PWD/gmp || { report close-bloc; return 1; }
89 tazwok get-src mpc-library --target=$PWD/mpc || { report close-bloc; return 1; }
91 report step "Running compilation"
93 # Use libiberty.a from binutils.
94 sed -i 's/install_to_$(INSTALL_DEST) //' \
95 libiberty/Makefile.in || return 1
97 # Build it in a separate directory.
98 mkdir ../gcc-build
99 cd ../gcc-build
101 { CC="$HOST_SYSTEM-gcc -B/tools/lib/" \
102 AR=$HOST_SYSTEM-ar RANLIB=$HOST_SYSTEM-ranlib \
103 $src/configure \
104 --with-local-prefix=/tools --enable-clocale=gnu \
105 --enable-shared --enable-threads=posix \
106 --enable-__cxa_atexit --enable-languages=c,c++ \
107 --disable-libstdcxx-pch --disable-multilib \
108 --disable-bootstrap --disable-libgomp \
109 --with-gmp-include=$(pwd)/gmp --with-gmp-lib=$(pwd)/gmp/.libs \
110 --without-ppl --without-cloog &&
111 make &&
112 make install
113 } || { report close-bloc; return 1; }
114 ln -s gcc /tools/bin/cc
115 report close-bloc
116 }
118 # Rules to configure and make the package.
119 compile_rules()
120 {
121 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) //' libiberty/Makefile.in || return 1
138 case $ARCH in
139 i?86) sed -i 's/^T_CFLAGS =$/& -fomit-frame-pointer/' \
140 gcc/Makefile.in ;;
141 esac
143 #sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in
145 mkdir -p ../gcc-build && cd ../gcc-build
147 # This is the default GCC and we want a native build to cross compile after.
148 # SliTaz target i486 host so we need a native i486 build for GCC.
149 case "$opt" in
150 --first-pass)
151 # Used by slitaz-toolchain when rebuilding the full toolchain.
152 echo "cook: configure GCC for: toolchain first pass"
153 $src/configure \
154 --libexecdir=/usr/lib \
155 --disable-nls \
156 --enable-shared \
157 --enable-languages=c,c++ \
158 --disable-libstdcxx-pch \
159 --enable-__cxa_atexit \
160 --enable-clocale=gnu \
161 --enable-threads=posix \
162 --disable-bootstrap \
163 --build=$HOST_SYSTEM \
164 --host=$HOST_SYSTEM &&
165 make && make install ;;
166 *)
167 # Used by default to produce a full featured X86 GCC compiler.
168 echo "cook: configure GCC for: final/full build"
169 $src/configure \
170 --libexecdir=/usr/lib \
171 --enable-nls \
172 --enable-languages=c,c++,objc,fortran \
173 --enable-shared \
174 --with-system-zlib \
175 --enable-clocale=gnu \
176 --enable-objc-gc \
177 --enable-__cxa_atexit \
178 --enable-lto \
179 --enable-threads=posix \
180 --disable-bootstrap \
181 --with-pkgversion="SliTaz" \
182 --with-tune=$ARCH \
183 --build=$HOST_SYSTEM \
184 --host=$HOST_SYSTEM &&
185 make && make install ;;
186 esac
187 }
189 # Rules to gen a SliTaz package suitable for Tazpkg.
190 genpkg_rules()
191 {
192 mkdir -p $fs/usr/share
193 cp -a $install/usr/bin $fs/usr
195 # Copy all libs. Remove libgcc_s.so and libstdc++.so they goes in
196 # the gcc-lib-base package.
197 cp -a $install/usr/lib $fs/usr
198 rm -f $fs/usr/lib/libgcc_s.so*
199 rm -f $fs/usr/lib/libstdc++.so*
200 rm -f $fs/usr/lib/libgomp.so*
201 rm -f $fs/usr/lib/libobjc.so*
203 # Include files.
204 cp -a $install/usr/include $fs/usr
206 # Gfortran goes in gfortran package.
207 rm -f $fs/usr/bin/*gfortran
208 rm -f $fs/usr/lib/libgfortran*
209 rm -f $fs/usr/lib/gcc/*/$VERSION/libgfortran*
210 rm -rf $fs/usr/lib/gcc/*/$VERSION/f*
212 # Remove build directory.
213 rm -rf $WOK/$PACKAGE/source/$PACKAGE-build
214 rm -rf $WOK/$PACKAGE/$PACKAGE-build
215 }
217 # Post install commands for Tazpkg.
218 post_install()
219 {
220 local root
221 root=$1
222 echo "Processing post-install commands..."
223 if [ ! -f "$root/lib/cpp" ]; then
224 ln -s ../usr/bin/cpp $root/lib
225 fi
226 if [ ! -f "$root/usr/bin/cc" ]; then
227 ln -s gcc $root/usr/bin/cc
228 fi
229 }