-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmake-x64-toolchan.sh
executable file
·233 lines (214 loc) · 5.99 KB
/
make-x64-toolchan.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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
#!/bin/sh
#sudo apt-get g++ libncurses5-dev libtinfo-dev g++-4.9 autopoint libapr1 libaprutil1 libserf-1-1 libsvn1 subversion gcc gcc-4.9 libtool gperf libgcrypt-dev intltool gettext automake autogen autoconf autogen autogen-doc automake autotools-dev guile-2.0-libs libgc1c2 libopts25 libopts25-dev m4
# fonts-lmodern fonts-texgyre libfile-homedir-perl libfile-which-perl
# libjs-jquery libpotrace0 libptexenc1 libruby2.1 libsynctex1 libyaml-0-2
# libzzip-0-13 lmodern prosper ps2eps ruby ruby2.1 rubygems-integration
# tex-common tex-gyre texlive texlive-base texlive-binaries
# texlive-extra-utils texlive-font-utils texlive-fonts-recommended
# texlive-fonts-recommended-doc texlive-generic-recommended texlive-latex-base
# texlive-latex-base-doc texlive-latex-recommended
# texlive-latex-recommended-doc texlive-pictures texliv e-pictures-doc
# texlive-pstricks texlive-pstricks-doc tipa bison libprotobuf-c-dev libprotobuf-c1 libprotoc9 protobuf-c-compiler flex libfl-dev gnutls-bin
TARGET="x86_64-media-linux-gnu"
CLFS="$1"
isget="$2"
SYSROOT="$CLFS/root"
export PATH=$CLFS/bin/:$PATH
HOST="x86_64-pc-linux-gnu"
LINUX_VERSION=4.2
BINUTILS_VERSION=2.25
GCC_VERSION=5.2.0
unset CFLAGS
unset CXXFLAGS
check_success() {
if [ $? -ne 0 ]
then
echo Failed
exit 1
fi
echo Done
}
if [ "$2" = "clear" ]
then
rm -rfv $CLFS
mkdir -p $SYSROOT
check_success
exit 1
fi
mkdir -p $SYSROOT
InstallKernelHeader()
{
if [ "$isget" = "get" ]
then
wget -c "https://www.kernel.org/pub/linux/kernel/v4.x/linux-$LINUX_VERSION.tar.gz"
tar -xf linux-$LINUX_VERSION.tar.gz
rm linux-$LINUX_VERSION.tar.gz
fi
echo -n "Install kernel headers..."
cd linux-$LINUX_VERSION/
if [ "$isget" != "install" ]
then
make mrproper
make ARCH=x86 headers_check
fi
make ARCH=x86 INSTALL_HDR_PATH=$SYSROOT headers_install
cd -
check_success
}
InstallBinutils()
{
if [ "$isget" = "get" ]
then
wget -c "http://ftp.gnu.org/gnu/binutils/binutils-$BINUTILS_VERSION.tar.gz"
tar -xf binutils-$BINUTILS_VERSION.tar.gz
rm binutils-$BINUTILS_VERSION.tar.gz
fi
echo -n "Install binutils..."
mkdir $TARGET-binutils
cd $TARGET-binutils
if [ "$isget" != "install" ]
then
rm -rf ./*
../binutils-$BINUTILS_VERSION/configure --prefix=$CLFS --target=$TARGET --with-sysroot=$SYSROOT --disable-nls --enable-plugins
make V=0 -j 9
check_success
fi
make install
check_success
cd ..
}
InstallStaticGCC()
{
if [ "$isget" = "get" ]
then
wget -c "http://ftp.gnu.org/gnu/gcc/gcc-$GCC_VERSION/gcc-$GCC_VERSION.tar.bz2"
tar -xf gcc-$GCC_VERSION.tar.bz2
rm /gcc-$GCC_VERSION.tar.bz2
cd ./gcc-$GCC_VERSION/
./contrib/download_prerequisites
cd ..
check_success
fi
echo -n "Install static gcc..."
mkdir $TARGET-static-gcc
cd $TARGET-static-gcc
if [ "$isget" != "install" ]
then
rm -rf ./*
../gcc-$GCC_VERSION/configure --disable-multilib --target=$TARGET --prefix=$CLFS --with-sysroot=$SYSROOT --disable-nls --disable-shared --without-headers --with-newlib --disable-decimal-float --disable-libgomp --disable-libmudflap --disable-libssp --disable-threads --disable-libatomic --disable-libitm --disable-libsanitizer --disable-libquadmath --disable-target-libiberty --enable-languages=c --enable-checking=release
make V=0 all-gcc -j 9
check_success
make V=0 all-target-libgcc -j 9
check_success
fi
make install-gcc install-target-libgcc
check_success
cd ..
}
InstallEGLIB()
{
if [ "$isget" = "get" ]
then
svn co http://www.eglibc.org/svn/trunk eglibc
fi
echo -n "Install eglibs header files..."
mkdir $TARGET-eglibs
cd $TARGET-eglibs
if [ "$isget" != "install" ]
then
rm -rf ./*
echo "libc_cv_ssp=no" > config.cache
BUILD_CC="gcc" \
CC="$CLFS/bin/$TARGET-gcc" \
AR="$CLFS/bin/$TARGET-ar" \
RANLIB="$CLFS/bin/$TARGET-ranlib" \
../eglibc/libc/configure \
--prefix=/ \
--with-headers=$SYSROOT/include \
--build=$HOST \
--host=$TARGET \
--disable-profile --without-gd --without-cvs --enable-add-ons --cache-file=config.cache
check_success
make V=0 -j 9
check_success
fi
make install install_root=$SYSROOT
check_success
cd ..
}
InstallGLIB()
{
if [ "$isget" = "get" ]
then
git clone git://sourceware.org/git/glibc.git
fi
echo -n "Install eglibs header files..."
mkdir $TARGET-glibc
cd $TARGET-glibc
if [ "$isget" != "install" ]
then
rm -rf ./*
echo "libc_cv_ssp=no" > config.cache
BUILD_CC="gcc" \
CC="$CLFS/bin/$TARGET-gcc" \
AR="$CLFS/bin/$TARGET-ar" \
RANLIB="$CLFS/bin/$TARGET-ranlib" \
../glibc/configure \
--prefix=/ \
--with-headers=$SYSROOT/include \
--build=$HOST \
--host=$TARGET \
--enable-obsolete-rpc \
--disable-profile --without-gd --without-cvs --enable-add-ons --cache-file=config.cache
check_success
make V=0 -j 9
check_success
fi
make install install_root=$SYSROOT
check_success
cd ..
}
InstallFinallGCC()
{
if [ "$isget" = "get" ]
then
wget -c "http://ftp.gnu.org/gnu/gcc/gcc-$GCC_VERSION/gcc-$GCC_VERSION.tar.bz2"
tar -xf gcc-$GCC_VERSION.tar.bz2
rm /gcc-$GCC_VERSION.tar.bz2
cd ./gcc-$GCC_VERSION/
./contrib/download_prerequisites
cd ..
check_success
fi
echo -n "Install final gcc..."
mkdir $TARGET-final-gcc
cd $TARGET-final-gcc
if [ "$isget" != "install" ]
then
rm -rf ./*
../gcc-$GCC_VERSION/configure \
--build=$HOST --target=$TARGET --host=$HOST --prefix=$CLFS \
--with-sysroot=$SYSROOT --enable-shared --enable-languages=c,c++ \
--with-native-system-header-dir=/include \
--enable-__cxa_atexit --enable-c99 --enable-long-long --enable-threads=posix \
--enable-checking=release \
--disable-multilib \
--disable-nls \
--disable-libstdcxx-pch \
--disable-multilib \
--disable-bootstrap \
--disable-libgomp
make V=0 AS_FOR_TARGET="$TARGET-as" LD_FOR_TARGET="$TARGET-ld" -j 9
check_success
fi
make install
mkdir -p $SYSROOT/lib
cp -fv $CLFS/x86_64-media-linux-gnu/lib64/libgcc* $SYSROOT/lib
check_success
cd ..
}
#InstallKernelHeader
#InstallBinutils
#InstallStaticGCC
InstallGLIB
InstallFinallGCC