toolchain: changements aux scripts
[glg-lfs.git] / toolchain / scripts / GCC-4.7.3-Pass_2
blob55f55bdf2fe118061457d819ee644a1553d4d5db
1 #!/bin/bash
3 pkgname="gcc-4.7.3"
4 archive="$pkgname".tar.bz2
5 tar_flags="-xjf"
6 make_flags="--jobs=4 --quiet"
8 set -u
9 set -e
11 cd $LFS/sources
13 echo "======> extraction de l'archive $archive"
14 tar "$tar_flags" "$archive"
16 cd "$pkgname"
18 echo "======> creation d'une version complete de limit.h"
19 cat gcc/limitx.h gcc/glimits.h gcc/limity.h > \
20 `dirname $($LFS_TGT-gcc -print-libgcc-file-name)`/include-fixed/limits.h
22 echo "======> ajout de -fomit-frame-pointer pour la compilation"
23 cp gcc/Makefile.in{,.tmp}
24 sed 's/^T_CFLAGS =$/& -fomit-frame-pointer/' gcc/Makefile.in.tmp \
25 > gcc/Makefile.in
27 echo "======> extraction de l'archive mpfr-3.1.1.tar.xz"
28 tar -Jxf ../mpfr-3.1.1.tar.xz
29 mv mpfr-3.1.1 mpfr
30 echo "======> extraction de l'archive gmp-5.1.1.tar.xz"
31 tar -Jxf ../gmp-5.1.1.tar.xz
32 mv gmp-5.1.1 gmp
33 echo "======> extraction de l'archive mpc-1.0.1.tar.gz"
34 tar -zxf ../mpc-1.0.1.tar.gz
35 mv mpc-1.0.1 mpc
37 echo "======> changement du dynamic linker"
38 for file in \
39 $(find gcc/config -name linux64.h -o -name linux.h -o -name sysv4.h)
41 cp -u $file{,.orig}
42 sed -e 's@/lib\(64\)\?\(32\)\?/ld@/tools&@g' \
43 -e 's@/usr@/tools@g' $file.orig > $file
44 echo '
45 #undef STANDARD_STARTFILE_PREFIX_1
46 #undef STANDARD_STARTFILE_PREFIX_2
47 #define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/"
48 #define STANDARD_STARTFILE_PREFIX_2 ""' >> $file
49 touch $file.orig
50 done
52 echo "======> desactivation de la compilation des fichiers .info"
53 sed -i 's/BUILD_INFO=info/BUILD_INFO=/' gcc/configure
55 cd ../
57 mkdir -v "$pkgname"-build
58 cd "$pkgname"-build
60 echo "======> execution du script de configuration"
61 CC=$LFS_TGT-gcc \
62 AR=$LFS_TGT-ar \
63 RANLIB=$LFS_TGT-ranlib \
64 ../"$pkgname"/configure --quiet \
65 --prefix=/tools \
66 --with-local-prefix=/tools \
67 --with-native-system-header-dir=/tools/include \
68 --enable-clocale=gnu \
69 --enable-shared \
70 --enable-threads=posix \
71 --enable-__cxa_atexit \
72 --enable-languages=c,c++ \
73 --disable-libstdcxx-pch \
74 --disable-multilib \
75 --disable-bootstrap \
76 --disable-libgomp \
77 --with-mpfr-include=$(pwd)/../$pkgname/mpfr/src \
78 --with-mpfr-lib=$(pwd)/mpfr/src/.libs
80 echo "======> compilation de $pkgname"
81 make $make_flags
83 echo "======> installation de $pkgname"
84 make install
86 echo "======> creation d'un lien symbolique cc -> gcc"
87 ln -s gcc /tools/bin/cc
89 echo "======> verification de la toolchain"
90 echo 'main(){}' > dummy.c
91 cc dummy.c
92 readelf -l a.out | grep ': /tools'
94 echo "======> supression du repertoire" "$pkgname"-build
95 cd ../
96 rm -rf "$pkgname"-build
98 echo "======> supression du rÃpertoire $pkgname"
99 rm -rf "$pkgname"
101 echo "======> compilation et installation de $pkgname reussi"
102 exit 0