-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild_temp_tools.sh
More file actions
executable file
·326 lines (295 loc) · 8.09 KB
/
build_temp_tools.sh
File metadata and controls
executable file
·326 lines (295 loc) · 8.09 KB
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
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
#!/bin/bash
set -euo pipefail
#TODO ADINA rends ce code propre et stérile comme une seringue avant injection d'anesthésiant
LFS=/mnt/lfs
get_version() {
curr="$(pwd)"
cd $LFS/sources
folder=$(ls -d $1*.tar.*)
folder_with_ver="$(echo ${folder%*.tar.*})"
echo ${folder_with_ver/"$1-"/""}
cd "$curr"
}
config_sources() {
cd $LFS/sources
echo extracting $1.tar.*
tar -xf ${1}*.tar.*
cd "$(ls -d */ | grep ^${1})"
}
clean_sources() {
cd $LFS/sources
rm -rf $(ls -d */ | grep ^${1}*)
}
log_compil_end() {
echo -ne "\n\nCompiling ${1}...done\n"
sleep 1
}
compile_m4() {
config_sources m4 xz
./configure --prefix=/usr \
--host=$LFS_TGT \
--build=$(build-aux/config.guess)
make
make DESTDIR=$LFS install
clean_sources m4
log_compil_end m4
}
compile_ncurses() {
config_sources ncurses gz
sed -i s/mawk// configure
mkdir -pv build
cd build
../configure
make -C include
make -C progs tic
cd ..
./configure --prefix=/usr \
--host=$LFS_TGT \
--build=$(./config.guess) \
--mandir=/usr/share/man \
--with-manpage-format=normal \
--with-shared \
--without-normal \
--with-cxx-shared \
--without-debug \
--without-ada \
--disable-stripping \
--enable-widec
make
make DESTDIR=$LFS TIC_PATH=$(pwd)/build/progs/tic install
echo "INPUT(-lncursesw)" > $LFS/usr/lib/libncurses.so
clean_sources ncurses
log_compil_end ncurses
}
compile_bash() {
config_sources bash gz
./configure --prefix=/usr \
--build=$(sh support/config.guess) \
--host=$LFS_TGT \
--without-bash-malloc
make
make DESTDIR=$LFS install
ln -sfv bash $LFS/bin/sh
clean_sources bash
log_compil_end bash
}
compile_coreutils() {
config_sources coreutils xz
./configure --prefix=/usr \
--host=$LFS_TGT \
--build=$(build-aux/config.guess) \
--enable-install-program=hostname \
--enable-no-install-program=kill,uptime \
gl_cv_macro_MB_CUR_MAX_good=y
make
make DESTDIR=$LFS install
mv -v $LFS/usr/bin/chroot $LFS/usr/sbin
mkdir -pv $LFS/usr/share/man/man8
mv -v $LFS/usr/share/man/man1/chroot.1 $LFS/usr/share/man/man8/chroot.8
sed -i 's/"1"/"8"/' $LFS/usr/share/man/man8/chroot.8
clean_sources coreutils
log_compil_end coreutils
}
compile_diffutils() {
config_sources diffutils xz
./configure --prefix=/usr \
--host=$LFS_TGT \
--build=$(./build-aux/config.guess)
make
make DESTDIR=$LFS install
clean_sources diffutils
log_compil_end diffutils
}
compile_file() {
config_sources file gz
mkdir build
cd build
../configure --disable-bzlib \
--disable-libseccomp \
--disable-xzlib \
--disable-zlib
make
cd ..
./configure --prefix=/usr --host=$LFS_TGT --build=$(./config.guess)
make FILE_COMPILE=$(pwd)/build/src/file
make DESTDIR=$LFS install
rm -v $LFS/usr/lib/libmagic.la
clean_sources file
log_compil_end file
}
compile_findutils() {
config_sources findutils xz
./configure --prefix=/usr \
--localstatedir=/var/lib/locate \
--host=$LFS_TGT \
--build=$(build-aux/config.guess)
make
make DESTDIR=$LFS install
clean_sources findutils
log_compil_end findutils
}
compile_gawk() {
config_sources gawk xz
sed -i 's/extras//' Makefile.in
./configure --prefix=/usr \
--host=$LFS_TGT \
--build=$(build-aux/config.guess)
make
make DESTDIR=$LFS install
clean_sources gawk
log_compil_end gawk
}
compile_grep() {
config_sources grep xz
./configure --prefix=/usr \
--host=$LFS_TGT \
--build=$(./build-aux/config.guess)
make
make DESTDIR=$LFS install
clean_sources grep
log_compil_end grep
}
compile_gzip() {
config_sources gzip xz
./configure --prefix=/usr \
--host=$LFS_TGT
make
make DESTDIR=$LFS install
clean_sources gzip
log_compil_end gzip
}
compile_make() {
config_sources make gz
./configure --prefix=/usr \
--without-guile \
--host=$LFS_TGT \
--build=$(build-aux/config.guess)
make
make DESTDIR=$LFS install
clean_sources make
log_compil_end make
}
compile_patch() {
config_sources patch xz
./configure --prefix=/usr \
--host=$LFS_TGT \
--build=$(build-aux/config.guess)
make
make DESTDIR=$LFS install
clean_sources patch
log_compil_end patch
}
compile_sed() {
config_sources sed xz
./configure --prefix=/usr \
--host=$LFS_TGT \
--build=$(build-aux/config.guess)
make
make DESTDIR=$LFS install
clean_sources sed
log_compil_end sed
}
compile_tar() {
config_sources tar xz
./configure --prefix=/usr \
--host=$LFS_TGT \
--build=$(build-aux/config.guess)
make
make DESTDIR=$LFS install
clean_sources tar
log_compil_end tar
}
compile_xz() {
config_sources xz xz
version="$(get_version xz)"
./configure --prefix=/usr \
--host=$LFS_TGT \
--build=$(build-aux/config.guess) \
--disable-static \
--docdir=/usr/share/doc/xz-$version
make
make DESTDIR=$LFS install
rm -v $LFS/usr/lib/liblzma.la
clean_sources xz
log_compil_end xz
}
compile_binutils_pass2() {
config_sources binutils xz
sed '6009s/$add_dir//' -i ltmain.sh
mkdir -pv build
cd build
../configure \
--prefix=/usr \
--build=$(../config.guess) \
--host=$LFS_TGT \
--disable-nls \
--enable-shared \
--enable-gprofng=no \
--disable-werror \
--enable-64-bit-bfd
make
make DESTDIR=$LFS install
rm -v $LFS/usr/lib/lib{bfd,ctf,ctf-nobfd,opcodes,sframe}.{a,la}
clean_sources binutils
log_compil_end "binutils (second pass)"
}
compile_gcc_pass2() {
config_sources gcc xz
tar -xf ../mpfr-*.tar.xz
mv -v "$(ls -d mpfr*)" mpfr
tar -xf ../gmp-*.tar.xz
mv -v "$(ls -d gmp*)" gmp
tar -xf ../mpc-*.tar.gz
mv -v "$(ls -d mpc*)" mpc
case $(uname -m) in
x86_64)
sed -e '/m64=/s/lib64/lib/' -i.orig gcc/config/i386/t-linux64
;;
esac
sed '/thread_header =/s/@.*@/gthr-posix.h/' \
-i libgcc/Makefile.in libstdc++-v3/include/Makefile.in
mkdir -v build
cd build
../configure \
--build=$(../config.guess) \
--host=$LFS_TGT \
--target=$LFS_TGT \
LDFLAGS_FOR_TARGET=-L$PWD/$LFS_TGT/libgcc \
--prefix=/usr \
--with-build-sysroot=$LFS \
--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++
make
make DESTDIR=$LFS install
ln -sv gcc $LFS/usr/bin/cc
clean_sources gcc
log_compil_end "gcc (second pass)"
}
compile_m4
compile_ncurses
compile_bash
compile_coreutils
compile_diffutils
compile_file
compile_findutils
compile_gawk
compile_grep
compile_gzip
compile_make
compile_patch
compile_sed
compile_tar
compile_xz
compile_binutils_pass2
compile_gcc_pass2
echo -ne "\n\n\nNow run the following commands as root:\n"
echo "$LFS/prepare_chroot.sh"