-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path1-gcc.sh
executable file
·95 lines (83 loc) · 2.16 KB
/
1-gcc.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/bin/bash
export STAGE=1
. ./environment.sh
. ./package-versions.sh
export FORCE_UNSAFE_CONFIGURE=1
if [ -f $PROGRESS_DIR/1-gcc-$PASS ] ; then
exit 0
fi
echo "building gcc pass $PASS..."
set -e
cd $MINL/sources
rm -rf gcc-${gcc_v}
tar xf gcc-${gcc_v}.tar.xz
cd gcc-${gcc_v}
tar xf ../mpfr-${mpfr_v}.tar.xz
mv mpfr-${mpfr_v} mpfr
tar xf ../gmp-${gmp_v}.tar.xz
mv gmp-${gmp_v} gmp
tar xf ../mpc-${mpc_v}.tar.gz
mv mpc-${mpc_v} mpc
case $(uname -m) in
x86_64)
sed -e '/m64=/s/lib64/lib/' -i.orig gcc/config/i386/t-linux64
;;
esac
if [ "$PASS" == "2" ] ; then
sed '/thread_header =/s/@.*@/gthr-posix.h/' -i libgcc/Makefile.in libstdc++-v3/include/Makefile.in
fi
mkdir build
cd build
if [ "$PASS" == "1" ] ; then
../configure \
--target=$MINL_TGT \
--prefix=$MINL/tools \
--with-glibc-version=${glibc_v} \
--with-sysroot=$MINL \
--with-newlib \
--without-headers \
--enable-default-pie \
--enable-default-ssp \
--disable-nls \
--disable-shared \
--disable-multilib \
--disable-threads \
--disable-libatomic \
--disable-libgomp \
--disable-libquadmath \
--disable-libssp \
--disable-libvtv \
--disable-libstdcxx \
--enable-languages=c,c++
else
../configure \
--build=$(../config.guess) \
--host=$MINL_TGT \
--target=$MINL_TGT \
LDFLAGS_FOR_TARGET=-L$PWD/$MINL_TGT/libgcc \
--prefix=/usr \
--with-build-sysroot=$MINL \
--enable-default-pie \
--enable-default-ssp \
--disable-nls \
--disable-multilib \
--disable-libatomic \
--disable-libgomp \
--disable-libquadmath \
--disable-libsanitizer \
--disable-libssp \
--disable-libvtv \
--enable-languages=c,c++
fi
make
if [ "$PASS" == "1" ] ; then
make install
cd ..
cat gcc/limitx.h gcc/glimits.h gcc/limity.h > `dirname $($MINL_TGT-gcc -print-libgcc-file-name)`/include/limits.h
else
make DESTDIR=$MINL install
ln -s gcc $MINL/usr/bin/cc
fi
cd $MINL/sources
rm -rf gcc-${gcc_v}
touch $PROGRESS_DIR/1-gcc-$PASS