wok-4.x view gcc/receipt @ rev 12466
New toolchain GCC 4.9.2, Glibc 2.19, Binutils 2.23.1
author | Stanislas Leduc <shann@slitaz.org> |
---|---|
date | Wed Nov 09 15:12:00 2022 +0000 (2022-11-09) |
parents | 18c26403f57c |
children |
line source
1 # SliTaz package receipt.
3 PACKAGE="gcc"
4 VERSION="4.9.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 # Patch for compile with kernel 2.6 branch (thanks TimeSys)
123 # see http://repository.timesys.com/buildsources/
124 patch -Np1 < $stuff/gcc-$VERSION-EVIOCGPROP_fix-1.patch
125 patch -Np1 < $stuff/gcc-$VERSION-libsanitizer_fix-1.patch
127 # SliTaz is a Busybox based OS, why we so small and fast. Using gawk by
128 # default to build package will not ensure package work with Busybox awk
129 # and so should NOT be use to cook.
130 if [ -x /usr/bin/cook ]; then
131 [ -d "/var/lib/tazpkg/installed/gawk" ] || tazpkg get-install gawk
132 fi
134 # Package slitaz-toolchain use 'cook --options' when rebuilding
135 # the full SliTaz toolchain.
136 [ "$2" == "--first-pass" ] && opt=$2
137 [ "$3" == "--first-pass" ] && opt=$3
139 # Use libiberty.a from binutils.
140 sed -i 's/install_to_$(INSTALL_DEST) //' \
141 libiberty/Makefile.in || return 1
142 mkdir -p ../gcc-build && cd ../gcc-build
144 # This is the default GCC and we want a native build to cross compile after.
145 # SliTaz target i486 host so we need a native i486 build for GCC.
146 case "$opt" in
147 --first-pass)
148 # Used by slitaz-toolchain when rebuilding the full toolchain.
149 echo "cook: configure GCC for: toolchain first pass"
150 $src/configure \
151 --libexecdir=/usr/lib \
152 --disable-nls \
153 --enable-shared \
154 --enable-languages=c,c++ \
155 --disable-libstdcxx-pch \
156 --enable-__cxa_atexit \
157 --enable-clocale=gnu \
158 --enable-threads=posix \
159 --disable-bootstrap \
160 --build=$HOST_SYSTEM \
161 --host=$HOST_SYSTEM &&
162 make && make install ;;
163 *)
164 # Used by default to produce a full featured X86 GCC compiler.
165 echo "cook: configure GCC for: final/full build"
166 $src/configure \
167 --libexecdir=/usr/lib \
168 --enable-nls \
169 --enable-languages=c,c++,objc,fortran \
170 --enable-shared \
171 --with-system-zlib \
172 --enable-clocale=gnu \
173 --enable-objc-gc \
174 --enable-__cxa_atexit \
175 --enable-lto \
176 --enable-threads=posix \
177 --disable-bootstrap \
178 --with-pkgversion="SliTaz" \
179 --with-tune=$ARCH \
180 --build=$HOST_SYSTEM \
181 --host=$HOST_SYSTEM &&
182 make && make install ;;
183 esac
184 }
186 # Rules to gen a SliTaz package suitable for Tazpkg.
187 genpkg_rules()
188 {
189 mkdir -p $fs/usr/share
190 cp -a $_pkg/usr/bin $fs/usr
192 # Copy all libs. Remove libgcc_s.so and libstdc++.so they goes in
193 # the gcc-lib-base package.
194 cp -a $_pkg/usr/lib $fs/usr
195 rm -f $fs/usr/lib/libgcc_s.so*
196 rm -f $fs/usr/lib/libstdc++.so*
197 rm -f $fs/usr/lib/libgomp.so*
198 rm -f $fs/usr/lib/libobjc.so*
200 # Include files.
201 cp -a $_pkg/usr/include $fs/usr
203 # Gfortran goes in gfortran package.
204 rm -f $fs/usr/bin/*gfortran
205 rm -f $fs/usr/lib/libgfortran*
206 rm -f $fs/usr/lib/gcc/*/$VERSION/libgfortran*
207 rm -rf $fs/usr/lib/gcc/*/$VERSION/f*
209 # Remove build directory.
210 rm -rf $WOK/$PACKAGE/source/$PACKAGE-build
211 rm -rf $WOK/$PACKAGE/$PACKAGE-build
212 }
214 # Post install commands for Tazpkg.
215 post_install()
216 {
217 local root
218 root=$1
219 echo "Processing post-install commands..."
220 if [ ! -f "$root/lib/cpp" ]; then
221 ln -s ../usr/bin/cpp $root/lib
222 fi
223 if [ ! -f "$root/usr/bin/cc" ]; then
224 ln -s gcc $root/usr/bin/cc
225 fi
226 }