-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootstrap.sh
executable file
·964 lines (814 loc) · 25.6 KB
/
bootstrap.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
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
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
#!/bin/bash
TOPDIR=`pwd`
BUILDDIR=`pwd`/build
OUTPUTDIR=`pwd`/output
SOURCEDIR=`pwd`/sources
RESULTDIR=`pwd`/result
MAKEJOBS=-j2
mkdir -p $BUILDDIR
mkdir -p $OUTPUTDIR
mkdir -p $RESULTDIR
function cleanup_builddir()
{
echo -n Clean builddir...
rm -fr $BUILDDIR/*
echo OK
}
function cleanup_outputdir()
{
echo -n Clean output dir...
rm -fr $OUTPUTDIR/*
echo OK
}
function create_pkg()
{
echo -n "Creating archive for $1 ... "
cd $OUTPUTDIR
find . -type f -executable -exec strip {} \;
rm -f usr/share/info/dir
tar cfz $RESULTDIR/$1.tgz .
cd $TOPDIR
echo "OK"
}
function extract_archive()
{
echo -n "Exctracting $1 ... "
tar -xf $SOURCEDIR/$1 -C $BUILDDIR
echo "OK"
}
function build_emptydirs()
{
cd $OUTPUTDIR
mkdir -pv $OUTPUTDIR/{bin,boot,etc/{opt,sysconfig},home,lib/firmware,mnt,opt}
mkdir -pv $OUTPUTDIR/{media/{floppy,cdrom},sbin,srv,var}
install -dv -m 0750 root
install -dv -m 1777 tmp var/tmp
mkdir -pv $OUTPUTDIR/usr/{,local/}{bin,include,lib,sbin,src}
mkdir -pv $OUTPUTDIR/usr/{,local/}share/{color,dict,doc,info,locale,man}
mkdir -v $OUTPUTDIR/usr/{,local/}share/{misc,terminfo,zoneinfo}
mkdir -v $OUTPUTDIR/usr/libexec
mkdir -pv $OUTPUTDIR/usr/{,local/}share/man/man{1..8}
case $(uname -m) in
x86_64) mkdir -v $OUTPUTDIR/lib64 ;;
esac
mkdir -v $OUTPUTDIR/var/{log,mail,spool}
ln -sv run var/run
ln -sv run/lock var/lock
mkdir -pv $OUTPUTDIR/var/{opt,cache,lib/{color,misc,locate},local}
create_pkg emptydirs-0
cleanup_builddir
cleanup_outputdir
}
function build_bash()
{
BASHVERSION=4.3
extract_archive bash-$BASHVERSION.tar.gz
cd $BUILDDIR/bash-$BASHVERSION
CC=clang CXX=clang++ ./configure --prefix=/usr --without-bash-malloc --with-installed-readline
make $MAKEJOBS
make DESTDIR=$OUTPUTDIR install
cd $OUTPUTDIR
mkdir -p bin
mv usr/bin/bash bin/
if [[ ! -e $OUTPUTDIR/bin/sh ]] ; then
ln -sf bash "$OUTPUTDIR"/bin/sh
fi
create_pkg bash-$BASHVERSION
cleanup_builddir
cleanup_outputdir
}
function build_linuxheaders()
{
LINUXVERSION=4.9.49
extract_archive linux-$LINUXVERSION.tar.xz
cd $BUILDDIR/linux-$LINUXVERSION
make mrproper
make INSTALL_HDR_PATH=dest headers_install
find dest/include \( -name .install -o -name ..install.cmd \) -delete
mkdir -p $OUTPUTDIR/usr/include
cp -rv dest/include/* $OUTPUTDIR/usr/include
create_pkg linux-headers-$LINUXVERSION
cleanup_builddir
cleanup_outputdir
}
function build_manpages()
{
MANVERSION=4.09
extract_archive man-pages-$MANVERSION.tar.xz
cd $BUILDDIR/man-pages-$MANVERSION
make DESTDIR=$OUTPUTDIR/ install
create_pkg man-pages-$MANVERSION
cleanup_builddir
cleanup_outputdir
}
function build_glibc()
{
GLIBCVERSION=2.26
extract_archive glibc-$GLIBCVERSION.tar.xz
cd $BUILDDIR/glibc-$GLIBCVERSION
mkdir -v build
cd build
../configure --prefix=/usr --enable-kernel=2.6.32 --enable-obsolete-rpc --enable-stack-protector=strong libc_cv_slibdir=/lib
make $MAKEJOBS
make check
touch $OUTPUTDIR/etc/ld.so.conf
make DESTDIR=$OUTPUTDIR install
cp -v ../nscd/nscd.conf $OUTPUTDIR/etc/nscd.conf
mkdir -pv $OUTPUTDIR/var/cache/nscd
echo /usr/local/lib > $OUTPUTDIR/etc/ld.so.conf
echo /opt/lib >> $OUTPUTDIR/etc/ld.so.conf
create_pkg glibc-$GLIBCVERSION
cleanup_builddir
cleanup_outputdir
}
function build_zlib()
{
ZLIBVERSION=1.2.11
extract_archive zlib-$ZLIBVERSION.tar.gz
cd $BUILDDIR/zlib-$ZLIBVERSION
CC=clang CXX=clang++ ./configure --prefix=/usr
make $MAKEJOBS
make DESTDIR=$OUTPUTDIR install
cd $OUTPUTDIR
mkdir lib
mv -v usr/lib/libz.so.* lib
#TODO CHECK THIS LINKING
ln -sfv lib/libz.so usr/lib/libz.so
create_pkg zlib-$ZLIBVERSION
cleanup_builddir
cleanup_outputdir
}
function build_file()
{
FILEVERSION=5.29
extract_archive file-$FILEVERSION.tar.gz
cd $BUILDDIR/file-$FILEVERSION
CC=clang CXX=clang++ ./configure --prefix=/usr
make $MAKEJOBS
make DESTDIR=$OUTPUTDIR install
create_pkg file-$FILEVERSION
cleanup_builddir
cleanup_outputdir
}
function build_binutils()
{
BINUTILSVERSION=2.29
extract_archive binutils-$BINUTILSVERSION.tar.bz2
cd $BUILDDIR/binutils-$BINUTILSVERSION
mkdir -v build
cd build
CC=clang CXX=clang++ ../configure --prefix=/usr --enable-gold --enable-ld=default --enable-plugins --enable-shared --disable-werror --with-system-zlib
make $MAKEJOBS
make DESTDIR=$OUTPUTDIR install
create_pkg binutils-$BINUTILSVERSION
cleanup_builddir
cleanup_outputdir
}
function build_gmp()
{
GMPVERSION=6.1.0
extract_archive gmp-$GMPVERSION.tar.xz
cd $BUILDDIR/gmp-$GMPVERSION
CC=clang CXX=clang++ ./configure --prefix=/usr --enable-cxx --disable-static --docdir=/usr/share/doc/gmp
make $MAKEJOBS
make html
make DESTDIR=$OUTPUTDIR install
make DESTDIR=$OUTPUTDIR install-html
create_pkg gmp-$GMPVERSION
cleanup_builddir
cleanup_outputdir
}
function build_mpfr()
{
MPFRVERSION=3.1.3
extract_archive mpfr-$MPFRVERSION.tar.xz
cd $BUILDDIR/mpfr-$MPFRVERSION
CC=clang CXX=clang++ ./configure --prefix=/usr --disable-static --enable-thread-safe --docdir=/usr/share/doc/mpfr
make $MAKEJOBS
make html
make DESTDIR=$OUTPUTDIR install
make DESTDIR=$OUTPUTDIR install-html
create_pkg mpfr-$MPFRVERSION
cleanup_builddir
cleanup_outputdir
}
function build_mpc()
{
MPCRVERSION=1.0.2
extract_archive mpc-$MPCRVERSION.tar.gz
cd $BUILDDIR/mpc-$MPCRVERSION
CC=clang CXX=clang++ ./configure --prefix=/usr --disable-static --docdir=/usr/share/doc/mpc
make $MAKEJOBS
make html
make DESTDIR=$OUTPUTDIR install
make DESTDIR=$OUTPUTDIR install-html
create_pkg mpc-$MPCRVERSION
cleanup_builddir
cleanup_outputdir
}
function build_gcc()
{
GCCVERSION=5.4.0
extract_archive gcc-$GCCVERSION.tar.bz2
cd $BUILDDIR/gcc-$GCCVERSION
mkdir -v build
cd build
SED=sed
CC=clang CXX=clang++ ../configure --prefix=/usr --enable-languages=c,c++ --disable-multilib --disable-bootstrap --with-system-zlib
make $MAKEJOBS
make DESTDIR=$OUTPUTDIR install
cd $OUTPUTDIR
mkdir -v lib
#TODO this have to be without ..
ln -sv ../usr/bin/cpp lib/cpp
ln -sv gcc cc
#mkdir -pv usr/share/gdb/auto-load/usr/lib
#mv -v usr/lib/*gdb.py usr/share/gdb/auto-load/usr/lib
create_pkg gcc-$GCCVERSION
cleanup_builddir
cleanup_outputdir
}
function build_bzip2()
{
BZIPVERSION=1.0.6
extract_archive bzip2-$BZIPVERSION.tar.gz
cd $BUILDDIR/bzip2-$BZIPVERSION
sed -i 's@\(ln -s -f \)$(PREFIX)/bin/@\1@' Makefile
sed -i "s@(PREFIX)/man@(PREFIX)/share/man@g" Makefile
make -f Makefile-libbz2_so
cd $OUTPUTDIR
mkdir bin
mkdir lib
cp -v $BUILDDIR/bzip2-$BZIPVERSION/bzip2-shared bin/bzip2
cp -v $BUILDDIR/bzip2-$BZIPVERSION/libbz2.so.1.0.6 lib
cd bin
ln -s bzip2 bzcat
ln -s bzip2 bunzip2
cd ../lib/
ln -s libbz2.so.1.0.6 libbz2.so
cd $BUILDDIR/bzip2-$BZIPVERSION
make clean
make
make PREFIX=$OUTPUTDIR/usr install
rm -v $OUTPUTDIR/usr/bin/{bunzip2,bzcat,bzip2}
create_pkg bzip2-$BZIPVERSION
cleanup_builddir
cleanup_outputdir
}
function build_pkg_config()
{
PKGCONFIGVERSION=0.28
extract_archive pkg-config-$PKGCONFIGVERSION.tar.gz
cd $BUILDDIR/pkg-config-$PKGCONFIGVERSION
CC=clang CXX=clang++ ./configure --prefix=/usr --with-internal-glib --disable-compile-warnings --disable-host-tool --docdir=/usr/share/doc/pkg-config
make $MAKEJOBS
make DESTDIR=$OUTPUTDIR install
create_pkg pkg-config-$PKGCONFIGVERSION
cleanup_builddir
cleanup_outputdir
}
function build_ncurses()
{
NCURSESVERSION=6.0
extract_archive ncurses-$NCURSESVERSION.tar.gz
cd $BUILDDIR/ncurses-$NCURSESVERSION
sed -i '/LIBTOOL_INSTALL/d' c++/Makefile.in
CC=clang CXX=clang++ ./configure --prefix=/usr \
--mandir=/usr/share/man \
--with-shared \
--without-debug \
--without-normal \
--enable-pc-files \
--enable-widec \
--without-hashed-db \
--with-cxx-shared \
--enable-symlinks \
--with-rcs-ids \
--with-manpage-format=normal \
--enable-const \
--enable-colorfgbg \
--enable-hard-tabs \
--enable-echo
make $MAKEJOBS
make DESTDIR=$OUTPUTDIR install
mkdir $OUTPUTDIR/lib
mv -v $OUTPUTDIR/usr/lib/libncursesw.so* $OUTPUTDIR/lib
make distclean
CC=clang CXX=clang++ ./configure --prefix=/usr \
--with-shared \
--without-normal \
--without-debug \
--without-cxx-binding
make sourses libs $MAKEJOBS
make DESTDIR=$OUTPUTDIR install
mv -v $OUTPUTDIR/usr/lib/libncurses.so* $OUTPUTDIR/lib
mv -v $OUTPUTDIR/usr/lib/libcurses.so* $OUTPUTDIR/lib
create_pkg ncurses-$NCURSESVERSION
cleanup_builddir
cleanup_outputdir
}
function build_attr()
{
ATTRVERSION=2.4.47
extract_archive attr-$ATTRVERSION.src.tar.gz
cd $BUILDDIR/attr-$ATTRVERSION
# Modify the documentation directory so that it is a versioned directory
sed -i -e 's|/@pkg_name@|&-@pkg_version@|' include/builddefs.in
# Prevent installation of manual pages that were already installed by the man pages package
sed -i -e "/SUBDIRS/s|man[25]||g" man/Makefile
CC=clang CXX=clang++ ./configure --prefix=/usr --bindir=/bin --disable-static
make
make DESTDIR=$OUTPUTDIR install install-dev install-lib
chmod -v 755 $OUTPUTDIR/usr/lib/libattr.so
mkdir -p $OUTPUTDIR/lib
mv -v $OUTPUTDIR/usr/lib/libattr.so.* $OUTPUTDIR/lib
rm $OUTPUTDIR/usr/lib/libattr.so
cd $OUTPUTDIR/lib
ln -sfv libattr.so.1.1.0 libattr.so.1
ln -sfv libattr.so.1 libattr.so
create_pkg attr-$ATTRVERSION
cleanup_builddir
cleanup_outputdir
}
function build_acl()
{
ACLVERSION=2.2.52
extract_archive acl-$ACLVERSION.src.tar.gz
cd $BUILDDIR/acl-$ACLVERSION
# Modify the documentation directory so that it is a versioned directory
sed -i -e 's|/@pkg_name@|&-@pkg_version@|' include/builddefs.in
# Fix some broken tests
sed -i "s:| sed.*::g" test/{sbits-restore,cp,misc}.test
# Additionally, fix a bug that causes getfacl -e to segfault on overly long group name
sed -i -e "/TABS-1;/a if (x > (TABS-1)) x = (TABS-1);" libacl/__acl_to_any_text.c
CC=clang CXX=clang++ ./configure --prefix=/usr --bindir=/bin --disable-static --libexecdir=/usr/lib
make
make DESTDIR=$OUTPUTDIR install install-dev install-lib
chmod -v 755 $OUTPUTDIR/usr/lib/libacl.so
mkdir -p $OUTPUTDIR/lib
mv -v $OUTPUTDIR/usr/lib/libacl.so.* $OUTPUTDIR/lib
rm $OUTPUTDIR/usr/lib/libacl.so
cd $OUTPUTDIR/lib
ln -sfv libacl.so.1.1.0 libacl.so.1
ln -sfv libacl.so.1 libacl.so
create_pkg acl-$ACLVERSION
cleanup_builddir
cleanup_outputdir
}
function build_libcap()
{
LIBCAPVERSION=2.25
extract_archive libcap-$LIBCAPVERSION.tar.xz
cd $BUILDDIR/libcap-$LIBCAPVERSION
sed -i '/install.*STALIBNAME/d' libcap/Makefile
make
make RAISE_SETFCAP=no lib=lib prefix=/usr DESTDIR=$OUTPUTDIR install
chmod -v 755 $OUTPUTDIR/usr/lib/libcap.so
mkdir $OUTPUTDIR/lib
mv -v $OUTPUTDIR/usr/lib/libcap.so* $OUTPUTDIR/lib
create_pkg libcap-$LIBCAPVERSION
cleanup_builddir
cleanup_outputdir
}
function build_sed()
{
SEDVERSION=4.2.2
extract_archive sed-$SEDVERSION.tar.bz2
cd $BUILDDIR/sed-$SEDVERSION
# First fix an issue in the LFS environment and remove a failing test
sed -i 's/usr/tools/' build-aux/help2man
sed -i 's/panic-tests.sh//' Makefile.in
CC=clang CXX=clang++ ./configure --prefix=/usr --bindir=/bin
make
make html
make DESTDIR=$OUTPUTDIR install
install -d -m755 $OUTPUTDIR/usr/share/doc/sed-$SEDVERSION
install -m644 doc/sed.html $OUTPUTDIR/usr/share/doc/sed-$SEDVERSION
create_pkg sed-$SEDVERSION
cleanup_builddir
cleanup_outputdir
}
function build_shadow()
{
SHADOWVERSION=4.4
extract_archive shadow-$SHADOWVERSION.tar.gz
cd $BUILDDIR/shadow-$SHADOWVERSION
# Disable the installation of the groups program and its man pages,
# as Coreutils provides a better version. Also Prevent the installation
# of manual pages that were already installed by the man pages package
sed -i 's/groups$(EXEEXT) //' src/Makefile.in
find man -name Makefile.in -exec sed -i 's/groups\.1 / /' {} \;
find man -name Makefile.in -exec sed -i 's/getspnam\.3 / /' {} \;
find man -name Makefile.in -exec sed -i 's/passwd\.5 / /' {} \;
# CVE is a good reason not to be vanilla
for p in `find $SOURCEDIR/ -name shadow-$SHADOWVERSION\*.patch` ; do
patch -p 1 < $p
done
# Instead of using the default crypt method, use the more secure SHA-512
# method of password encryption, which also allows passwords longer than 8
# characters. It is also necessary to change the obsolete /var/spool/mail
# location for user mailboxes that Shadow uses by default to the /var/mail
# location used currently
sed -i -e 's@#ENCRYPT_METHOD DES@ENCRYPT_METHOD SHA512@' \
-e 's@/var/spool/mail@/var/mail@' etc/login.defs
# Make a minor change to make the default useradd consistent with the LFS groups file:
sed -i 's/1000/999/' etc/useradd
# Fix a security issue identified upstream
sed -i -e '47 d' -e '60,65 d' libmisc/myname.c
CC=clang CXX=clang++ ./configure --sysconfdir=/etc --without-group-name-max-length --without-tcb --enable-shared=no --enable-static=yes --enable-man
make
make DESTDIR=$OUTPUTDIR install
mv -v $OUTPUTDIR/usr/bin/passwd $OUTPUTDIR/bin
create_pkg shadow-$SHADOWVERSION
cleanup_builddir
cleanup_outputdir
}
function build_psmisc()
{
PSMISCVERSION=22.21
extract_archive psmisc-$PSMISCVERSION.tar.gz
cd $BUILDDIR/psmisc-$PSMISCVERSION
CC=clang CXX=clang++ ./configure --prefix=/usr
make
make DESTDIR=$OUTPUTDIR install
mkdir $OUTPUTDIR/bin
mv -v $OUTPUTDIR/usr/bin/fuser $OUTPUTDIR/bin
mv -v $OUTPUTDIR/usr/bin/killall $OUTPUTDIR/bin
create_pkg psmisc-$PSMISCVERSION
cleanup_builddir
cleanup_outputdir
}
function build_m4()
{
M4VERSION=1.4.17
extract_archive m4-$M4VERSION.tar.xz
cd $BUILDDIR/m4-$M4VERSION
CC=clang CXX=clang++ ./configure --prefix=/usr
make
make DESTDIR=$OUTPUTDIR install
create_pkg m4-$M4VERSION
cleanup_builddir
cleanup_outputdir
}
function build_bison()
{
BISONVERSION=3.0.4
extract_archive bison-$BISONVERSION.tar.xz
cd $BUILDDIR/bison-$BISONVERSION
CC=clang CXX=clang++ ./configure --prefix=/usr --docdir=/usr/share/doc/bison-3.0.4
make
make DESTDIR=$OUTPUTDIR install
create_pkg bison-$BISONVERSION
cleanup_builddir
cleanup_outputdir
}
function build_flex()
{
FLEXVERSION=2.6.1
extract_archive flex-$FLEXVERSION.tar.xz
cd $BUILDDIR/flex-$FLEXVERSION
CC=clang CXX=clang++ ./configure --prefix=/usr --docdir=/usr/share/doc/flex-$FLEXVERSION
make
make DESTDIR=$OUTPUTDIR install
cd $OUTPUTDIR/usr/bin
ln -sf flex lex
create_pkg flex-$FLEXVERSION
cleanup_builddir
cleanup_outputdir
}
function build_grep()
{
GREPVERSION=2.27
extract_archive grep-$GREPVERSION.tar.xz
cd $BUILDDIR/grep-$GREPVERSION
CC=clang CXX=clang++ ./configure --prefix=/usr --bindir=/bin
make
make DESTDIR=$OUTPUTDIR install
create_pkg grep-$GREPVERSION
cleanup_builddir
cleanup_outputdir
}
function build_readline()
{
READLINEVERION=6.3
extract_archive readline-$READLINEVERION.tar.gz
cd $BUILDDIR/readline-$READLINEVERION
# Reinstalling Readline will cause the old libraries to be
# moved to <libraryname>.old. While this is normally not a
# problem, in some cases it can trigger a linking bug in
# ldconfig. This can be avoided by issuing the following two seds
sed -i '/MV.*old/d' Makefile.in
sed -i '/{OLDSUFF}/c:' support/shlib-install
CC=clang CXX=clang++ ./configure --prefix=/usr --disable-static --docdir=/usr/share/doc/readline-$READLINEVERION
make SHLIB_LIBS=-lncurses
make SHLIB_LIBS=-lncurses DESTDIR=$OUTPUTDIR install
mkdir -vp $OUTPUTDIR/lib
mv -v $OUTPUTDIR/usr/lib/lib{readline,history}.so* $OUTPUTDIR/lib
rmdir -v $OUTPUTDIR/usr/lib
rmdir -v $OUTPUTDIR/usr/bin
create_pkg realine-$READLINEVERION
cleanup_builddir
cleanup_outputdir
}
function build_bc()
{
BCVERSION=1.06.95
extract_archive bc-$BCVERSION.tar.bz2
cd $BUILDDIR/bc-$BCVERSION
CC=clang CXX=clang++ ./configure --prefix=/usr --with-readline --mandir=/usr/share/man --infodir=/usr/share/info
make
make DESTDIR=$OUTPUTDIR install
create_pkg bc-$BCVERSION
cleanup_builddir
cleanup_outputdir
}
function build_libtool()
{
LIBTOOLVERSION=2.4.6
extract_archive libtool-$LIBTOOLVERSION.tar.xz
cd $BUILDDIR/libtool-$LIBTOOLVERSION
CC=clang CXX=clang++ ./configure --prefix=/usr
make
make DESTDIR=$OUTPUTDIR install
create_pkg libtool-$LIBTOOLVERSION
cleanup_builddir
cleanup_outputdir
}
function build_gdbm()
{
GDBMVERSION=1.11
extract_archive gdbm-$GDBMVERSION.tar.gz
cd $BUILDDIR/gdbm-$GDBMVERSION
CC=clang CXX=clang++ ./configure --prefix=/usr --disable-static --enable-libgdbm-compat
make
make DESTDIR=$OUTPUTDIR install
create_pkg gdbm-$GDBMVERSION
cleanup_builddir
cleanup_outputdir
}
function build_gperf()
{
GPERFVERSION=3.0.4
extract_archive gperf-$GPERFVERSION.tar.gz
cd $BUILDDIR/gperf-$GPERFVERSION
CC=clang CXX=clang++ ./configure --prefix=/usr --docdir=/usr/share/doc/gperf-$GPERFVERSION
make
make DESTDIR=$OUTPUTDIR install
create_pkg gperf-$GPERFVERSION
cleanup_builddir
cleanup_outputdir
}
function build_expat()
{
EXPATVERSION=2.2.0
extract_archive expat-$EXPATVERSION.tar.bz2
cd $BUILDDIR/expat-$EXPATVERSION
CC=clang CXX=clang++ ./configure --prefix=/usr --disable-static
make
make DESTDIR=$OUTPUTDIR install
#If desired, install the documentation:
#install -v -dm755 /usr/share/doc/expat-2.2.0
#install -v -m644 doc/*.{html,png,css} /usr/share/doc/expat-2.2.0
create_pkg expat-$EXPATVERSION
cleanup_builddir
cleanup_outputdir
}
function build_inetutils()
{
INETUTILSVERSION=1.9.4
extract_archive inetutils-$INETUTILSVERSION.tar.gz
cd $BUILDDIR/inetutils-$INETUTILSVERSION
CC=clang CXX=clang++ ./configure --prefix=/usr --localstatedir=/var --disable-logger --disable-whois --disable-rcp --disable-rexec --disable-rlogin --disable-rsh --disable-servers
make
make DESTDIR=$OUTPUTDIR install
mkdir -v $OUTPUTDIR/bin
mv -v $OUTPUTDIR/usr/bin/{hostname,ping,ping6,traceroute} $OUTPUTDIR/bin
mkdir -v $OUTPUTDIR/sbin
mv -v $OUTPUTDIR/usr/bin/ifconfig $OUTPUTDIR/sbin
rmdir $OUTPUTDIR/usr/libexec
# Strange. Its not executable after install
chmod +x $OUTPUTDIR/bin/*
create_pkg inetutils-$INETUTILSVERSION
cleanup_builddir
cleanup_outputdir
}
function build_perl()
{
PERLVERSION=5.24.1
extract_archive perl-$PERLVERSION.tar.xz
cd $BUILDDIR/perl-$PERLVERSION
export BUILD_ZLIB=False
export BUILD_BZIP2=0
export CC=clang
export CXX=clang++
sh Configure -des -Dprefix=/usr \
-Dvendorprefix=/usr \
-Dman1dir=/usr/share/man/man1 \
-Dman3dir=/usr/share/man/man3 \
-Dpager="/usr/bin/less -isR" \
-Duseshrplib
make $MAKEJOBS
make DESTDIR=$OUTPUTDIR install
unset BUILD_ZLIB BUILD_BZIP2
create_pkg perl-$PERLVERSION
cleanup_builddir
cleanup_outputdir
}
function build_perl_xmlparser()
{
XMLPARSERVERSION=2.44
extract_archive XML-Parser-$XMLPARSERVERSION.tar.gz
cd $BUILDDIR/XML-Parser-$XMLPARSERVERSION
perl Makefile.PL
make
make DESTDIR=$OUTPUTDIR install
# Strange files in usr/local/
create_pkg XML-Parser-$XMLPARSERVERSION
cleanup_builddir
cleanup_outputdir
}
function build_intltool()
{
INTLTOOLVERSION=0.51.0
extract_archive intltool-$INTLTOOLVERSION.tar.gz
cd $BUILDDIR/intltool-$INTLTOOLVERSION
sed -i 's:\\\${:\\\$\\{:' intltool-update.in
CC=clang CXX=clang++ ./configure --prefix=/usr
make
make DESTDIR=$OUTPUTDIR install
install -v -Dm644 $BUILDIR/doc/I18N-HOWTO $OUTPUTDIR/usr/share/doc/intltool-$INTLTOOLVERSION/I18N-HOWTO
create_pkg intltool-$INTLTOOLVERSION
cleanup_builddir
cleanup_outputdir
}
function build_autoconf()
{
AUTOCONFVERSION=2.69
extract_archive autoconf-$AUTOCONFVERSION.tar.xz
cd $BUILDDIR/autoconf-$AUTOCONFVERSION
CC=clang CXX=clang++ ./configure --prefix=/usr
make $MAKEJOBS
make DESTDIR=$OUTPUTDIR install
create_pkg autoconf-$AUTOCONFVERSION
cleanup_builddir
cleanup_outputdir
}
function build_automake()
{
AUTOMAKEVERSION=1.15
extract_archive automake-$AUTOMAKEVERSION.tar.xz
cd $BUILDDIR/automake-$AUTOMAKEVERSION
sed -i 's:/\\\${:/\\\$\\{:' bin/automake.in
CC=clang CXX=clang++ ./configure --prefix=/usr --docdir=/usr/share/doc/automake-$AUTOMAKEVERSION
make
make DESTDIR=$OUTPUTDIR install
create_pkg automake-$AUTOMAKEVERSION
cleanup_builddir
cleanup_outputdir
}
function build_xz()
{
XZVERSION=5.2.3
extract_archive xz-$XZVERSION.tar.gz
cd $BUILDDIR/xz-$XZVERSION
CC=clang CXX=clang++ ./configure --prefix=/usr --disable-static --docdir=/usr/share/doc/xz-$XZVERSION
make
make DESTDIR=$OUTPUTDIR install
mkdir -v $OUTPUTDIR/lib $OUTPUTDIR/bin
mv -v $OUTPUTDIR/usr/bin/{lzma,unlzma,lzcat,xz,unxz,xzcat} $OUTPUTDIR/bin
mv -v $OUTPUTDIR/usr/lib/liblzma.so* $OUTPUTDIR/lib
cd $OUTPUTDIR
# TODO
#ln -svf lib/liblzma.so usr/lib/liblzma.so
create_pkg xz-$XZVERSION
cleanup_builddir
cleanup_outputdir
}
function build_kmod()
{
KMODVERSION=23
extract_archive kmod-$KMODVERSION.tar.xz
cd $BUILDDIR/kmod-$KMODVERSION
CC=clang CXX=clang++ ./configure --prefix=/usr --bindir=/bin --sysconfdir=/etc --with-rootlibdir=/lib --with-xz --with-zlib
make
make DESTDIR=$OUTPUTDIR install
cd $OUTPUTDIR/bin
mkdir $OUTPUTDIR/sbin
for target in depmod insmod lsmod modinfo modprobe rmmod; do
ln -sfv ../bin/kmod ../sbin/$target
done
ln -sfv kmod lsmod
create_pkg kmod-$KMODVERSION
cleanup_builddir
cleanup_outputdir
}
function build_gettext()
{
GETTEXTVERSION=0.19.8.1
extract_archive gettext-$GETTEXTVERSION.tar.gz
cd $BUILDDIR/gettext-$GETTEXTVERSION
sed -i '/^TESTS =/d' gettext-runtime/tests/Makefile.in &&
sed -i 's/test-lock..EXEEXT.//' gettext-tools/gnulib-tests/Makefile.in
CC=clang CXX=clang++ ./configure --prefix=/usr --disable-static --docdir=/usr/share/doc/gettext-$GETTEXTVERSION
make
make DESTDIR=$OUTPUTDIR install
chmod -v 0755 $OUTPUTDIR/usr/lib/preloadable_libintl.so
create_pkg gettext-$GETTEXTVERSION
cleanup_builddir
cleanup_outputdir
}
function build_procpsng()
{
PROCPSNGVERSION=3.3.12
extract_archive procps-ng-$PROCPSNGVERSION.tar.xz
cd $BUILDDIR/procps-ng-$PROCPSNGVERSION
CC=clang CXX=clang++ ./configure --prefix=/usr --exec-prefix= --libdir=/usr/lib --docdir=/usr/share/doc/procps-ng-$PROCPSNGVERSION --disable-static --disable-kill
make
make DESTDIR=$OUTPUTDIR install
mv -v $OUTPUTDIR/usr/lib/libprocps.so* $OUTPUTDIR/lib
create_pkg procps-ng-$PROCPSNGVERSION
cleanup_builddir
cleanup_outputdir
}
function build_e2fsprogs()
{
E2FSPROGSVERSION=1.43.3
extract_archive e2fsprogs-$E2FSPROGSVERSION.tar.gz
cd $BUILDDIR/e2fsprogs-$E2FSPROGSVERSION
mkdir -v build
cd build
CC=clang CXX=clang++ ../configure --prefix=/usr --bindir=/bin --with-root-prefix="" --enable-elf-shlibs --disable-libblkid --disable-libuuid --disable-uuidd --disable-fsck
make
make DESTDIR=$OUTPUTDIR install
make DESTDIR=$OUTPUTDIR install-libs
chmod -v u+w $OUTPUTDIR/usr/lib/{libcom_err,libe2p,libext2fs,libss}.a
gunzip -v $OUTPUTDIR/usr/share/info/libext2fs.info.gz
install-info --dir-file=$OUTPUTDIR/usr/share/info/dir $OUTPUTDIR/usr/share/info/libext2fs.info
create_pkg e2fsprogs-$E2FSPROGSVERSION
cleanup_builddir
cleanup_outputdir
}
function build_coreutils()
{
COREUTILSVERSION=8.25
extract_archive coreutils-$COREUTILSVERSION.tar.xz
cd $BUILDDIR/coreutils-$COREUTILSVERSION
CC=clang CXX=clang++ ./configure --prefix=/usr --enable-no-install-program=kill,uptime
make
make DESTDIR=$OUTPUTDIR install
mkdir -v $OUTPUTDIR/usr/sbin
mkdir -v $OUTPUTDIR/bin
mv -v $OUTPUTDIR/usr/bin/{cat,chgrp,chmod,chown,cp,date,dd,df,echo} $OUTPUTDIR/bin
mv -v $OUTPUTDIR/usr/bin/{false,ln,ls,mkdir,mknod,mv,pwd,rm} $OUTPUTDIR/bin
mv -v $OUTPUTDIR/usr/bin/{rmdir,stty,sync,true,uname} $OUTPUTDIR/bin
mv -v $OUTPUTDIR/usr/bin/chroot $OUTPUTDIR/usr/sbin
mkdir -v $OUTPUTDIR/usr/share/man/man8
mv -v $OUTPUTDIR/usr/share/man/man1/chroot.1 $OUTPUTDIR/usr/share/man/man8/chroot.8
sed -i s/\"1\"/\"8\"/1 $OUTPUTDIR/usr/share/man/man8/chroot.8
create_pkg coreutils-$COREUTILSVERSION
cleanup_builddir
cleanup_outputdir
}
build_emptydirs
build_linuxheaders
build_manpages
build_glibc
build_zlib
build_file
build_binutils
build_gmp
build_mpfr
build_mpc
build_gcc
build_bzip2
build_pkg_config
build_ncurses
build_attr
build_acl
build_libcap
build_sed
build_shadow
build_psmisc
build_m4
build_bison
build_flex
build_grep
build_readline
build_bash
build_bc
build_libtool
build_gdbm
build_gperf
build_expat
build_inetutils
build_perl
build_perl_xmlparser
build_intltool
build_autoconf
build_automake
build_xz
build_kmod
build_gettext
build_procpsng
build_e2fsprogs
build_coreutils