wok-undigest view gcc/receipt @ rev 1043

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