Jordan Savant # Software Engineer

Linux Kernel Dev Blog 9 - Linux From Scratch (LFS) Compiling pt 2

4/8/2020

Tcl-8.6.10

TCL is a test suite runner so we can test our installed packages like GCC etc

cd unix
./configure --prefix=/tools
make
# run tests
TZ=UTC make test
# 0 Failures!
# install (NOT DONE)
make install
chmod -v u+w /tools/lib/libtcl8.6.so
make install-private-headers
ln -sv tclsh8.6 /tools/bin/tclsh

Expect-5.45.4

cp -v configure{,.orig}
sed 's:/usr/local/bin:/bin:' configure.orig > configure
./configure --prefix=/tools       \
            --with-tcl=/tools/lib \
            --with-tclinclude=/tools/include
make -j2
make test
make SCRIPTS="" install

DejaGNU-1.6.2

./configure --prefix=/tools
make install
make check

M4-1.4.18

sed -i 's/IO_ftrylockfile/IO_EOF_SEEN/' lib/*.c
echo "#define _IO_IN_BACKUP 0x100" >> lib/stdio-impl.h
./configure --prefix=/tools
make -j2
make check
make install

Ncurses-6.2

sed -i s/mawk// configure
./configure --prefix=/tools \
            --with-shared   \
            --without-debug \
            --without-ada   \
            --enable-widec  \
            --enable-overwrite
make -j2
make install
ln -s libncursesw.so /tools/lib/libncurses.so

Bash-5.0

./configure --prefix=/tools --without-bash-malloc
make -j2
make tests
make install
ln -sv bash /tools/bin/sh

Bison-3.5.2

./configure --prefix=/tools
make -j2
make check
make install

Bzip2-1.0.8

# shared lib first
make -f Makefile-libbz2_so
make clean
# test and compile
make -j2
# instlal
make PREFIX=/tools install
  cp -v bzip2-shared /tools/bin/bzip2
  cp -av libbz2.so* /tools/lib
  ln -sv libbz2.so.1.0 /tools/lib/libbz2.so

Coreutils-8.31

./configure --prefix=/tools --enable-install-program=hostname
make -j2
make install

Diffutils-3.7

./configure --prefix=/tools
make -j2
make check
make install

File-5.38

./configure --prefix=/tools
make -j2
make check
make install

Findutils-4.7.0

./configure --prefix=/tools; make -j2; make check; make install;

Gawk-5.0.1

./configure --prefix=/tools; make -j2; make check; make install;

Gettext-0.20.1

./configure --disable-shared; make -j2;
cp -v gettext-tools/src/{msgfmt,msgmerge,xgettext} /tools/bin

Grep-3.4

./configure --prefix=/tools; make -j2; make check; make install;

Gzip-1.10

./configure --prefix=/tools; make -j2; make check; make install;

Make-4.3

./configure --prefix=/tools --without-guile; make -j2; make check; make install;

Patch-2.7.6

./configure --prefix=/tools; make -j2; make check; make install;

Perl-5.30.1

sh Configure -des -Dprefix=/tools -Dlibs=-lm -Uloclibpth -Ulocincpth
make -j2
cp -v perl cpan/podlators/scripts/pod2man /tools/bin
mkdir -pv /tools/lib/perl5/5.30.1
cp -Rv lib/* /tools/lib/perl5/5.30.1

Python-3.8.1

sed -i '/def add_multiarch_paths/a \        return' setup.py
./configure --prefix=/tools --without-ensurepip
make -j2
make install

Sed-4.8

./configure --prefix=/tools; make -j2; make check; make install;

Tar-1.32

./configure --prefix=/tools; make -j2; make check; make install;

Texinfo-6.7

./configure --prefix=/tools; make -j2; make check; make install;

Xz-5.2.4

./configure --prefix=/tools; make -j2; make check; make install;

STRIPPING!

I made it through the tool builds, now to clean up the garbage we dont need

remove scripts and docs to save space

strip --strip-debug /tools/lib/*
/usr/bin/strip --strip-unneeded /tools/{,s}bin/*
rm -rf /tools/{,share}/{info,man,doc}
find /tools/{lib,libexec} -name \*.la -delete