Monday, August 5, 2019

7 - Build the System (First Half)



Toucan Linux Project

A Roll Your Own Distribution

Goal 1 – Base System

Stage 2 – Building the Base System

With our helper script built we are now ready to build the actual target system using the intermediate tools. This will replace all the tools we built earlier with the final builds in order to create the target system. For most of these tools this is the second pass, but they will all be built the the compiler, assembler, linker, make, libraries, and all other tools in the tool chain that reside in /tools. Recall that the PATH still contains /tools but it is now at the end of the search path instead of the beginning. Since we launch bash with the +h to disable command hashing which remembers where it found commands, we will automatically use the new tools we compile because PATH will be searched every time. For this reason is it very important to compile the programs in the order listed here. It follows LFS exactly, except we use the cci.pl program to perform the build to make it faster but also to generate the configuration scripts will need later to maintain the system.

Do not do parallel builds in different terminals or launch any build in the background. The test scripts are ran as part of the build and you can examine the logs in /sources for each of the packages. With every thing in place we are ready to begin. Our guide is LFS chapter 6.

This process is long. It’s not hard, but there is a lot of steps. This will be broken up over two posts so if you are following along weekly, it is probably better to wait for the next two posts so you’ll have the complete process.

Step 1 – Verify the System

If you have stopped at any point be sure the target system filesystem is mounted under $LFS using the mount.sh script, ran the mount_vfs from step 3 last time, and that you have chrooted into the target system with the chg2tgt script from step 4 last time. You have login as the root user since you used chroot meaning that it is step to double check all commands. Once again, we will follow some LFS steps exactly, but most are modified here, so be sure to use copy and paste. Since you are working in the host still, you can keep this article open in a browser and work in the terminal window.

Be sure the build area is a ram disk. Use df to verify it is mounted. If not, remount with

mount -o size=250M -t tmpfs tmpfs /sources/build

The logs are written to the build area which is the RAM disk and will take up space over time and will be gone forever as soon as you unmount the filesystem. If you want them, move them elsewhere.

Remember for this whole section you are working as root and even though your are restricted to the target’s filesystem (due to chroot) it is still very easy to undo a lot of your hard work. Work slowly and carefully as you should anytime you are using the root account and always double-check the command line before you press ENTER. Again you can copy and paste as much as possible.

Step 2 - Linux API Headers

Just like last time, we’ll need the Linux API headers installed because the configuration scripts will use them. They are also essential to compiling many of the early tools. This step is only required in the initial build, after this we will simply install a new kernel so there is no reason to automate this. Extract linux-5.2.2.tar.xz (or the kernel you used) and follow the LFS steps exactly:

http://www.linuxfromscratch.org/lfs/view/development/chapter06/linux-headers.html

There is no reason to delete the directory when you are complete unless you need the disk space. We will need it to build the kernel later.

Step 3 – Man-pages 5.01

The man pages don’t require a configuration, compile, or test step, only an install. But this is the perfect time to introduce the usage of the cci.pl script. Change back to the cci directory with

cd ~/cci

then perform the following

./cci.pl -p man-pages-5.01.tar.xz -n man-pages -c null -m null -t null

The cci.pl script will perform the work, but let’s examine what is going on here. First check LFS to see what it says about man-pages.

http://www.linuxfromscratch.org/lfs/view/development/chapter06/man-pages.html

As you can see it simple says to extract the tarball (implied as a step) and then run

make install

Recall we created five scripts in /sources called config, compile, test, install, and null. Invoking the script with the above options does the following:

-p select the file to use as the tar archive

-n name the package as man-pages

-c use the null script for the configuration

-m use the null script for compilation

-t use the null script for testing

Since we didn’t select an install script for the package it will automatically use /sources/install, the default script. When cci.pl is ran it outputs the following

# ./cci.pl -p man-pages-5.01.tar.xz -n man-pages -c null -m null -t null
Using the following to build man-pages-5.01.tar.xz: 
config = null 
compile = null 
test = null 
install = install

Changing to /sources/build 
Executing /bin/tar -xf /sources/man-pages-5.01.tar.xz... 

Build script is: 
# NOP 
# NOP 
# NOP 
make install 

for i in man?; do \ 
install -d -m 755 /usr/share/man/"$i" || exit $?; \ 
install -m 644 "$i"/* /usr/share/man/"$i" || exit $?; \
done 

Changing to /sources 

This shows that the build script contains three lines with # NOP and the fourth containing the make install as specified in the LFS page. Run the following

# ls /sources/man-pages compile 
config test 
# cat /sources/man-pages/compile 
# NOP

This shows there is now a directory called man-pages which is the name we gave the package with the -n option. It contains three files that all contain “# NOP.” The first three lines are the config, compile, and test scripts which are all “no operation” because we don’t need to do anything for those steps with man-pages but we will need those files for the package manager.

Step 4 – Glib 2.29

The LFS page will be the guide for this step since it is designed to work with the partial build. We will rebuild it later using different options. Follows the steps exactly from LFS.

http://www.linuxfromscratch.org/lfs/view/development/chapter06/glibc.html

We could do this work with cci.pl but because the test suite needs a few temporary changes it is better to redo this later with the package manager.

Step 5 – Adjusting the Tool Chain

Here a few changes are made regarding the tool chain such as backing up the linker in tools, moving it to the proper location, and changing the compiler specifications to find it in the proper location. After that there are a number of tests to verify everything is working properly. This is essential to verify and fix any problems.

There will be few adjustments necessary now as we begin building the new system.

http://www.linuxfromscratch.org/lfs/view/development/chapter06/adjusting.html

Step 6 – zlib 1.2.11

Since we are doing so much work in the sources/config, let’s make it easy to type by creating a variable. Do the following:

export confs=/sources/configs

Here the default scripts work for all but the install step. Make the proper install file first with

cat > $confs/config.zlib << "EOF"
make install
mv -v /usr/lib/libz.so.* /lib
ln -sfv ../../lib/$(readlink
/usr/lib/libz.so) /usr/lib/libz.so
EOF

Now run the script as follows

./cci.pl -n zlib -p zlib-1.2.11.tar.xz -i config.zlib

It will build and leave the log in /sources/build for your inspection. You can check http://www.linuxfromscratch.org/lfs/view/development/chapter06/zlib.html to see exactly what would be done with strict LFS. In almost all cases, we will embedded the LFS commands in our config scripts because we want a base LFS system when we are done.

Step 7 – File 5.37

Everything is the default. No adjustments are required. Simply run:

./cci.pl -n file -p file-5.37.tar.gz


Step 8 – Readline 8.0

We need to change everything since nothing is standard. Create the script components using the following.

First the config

cat > $confs/config.readline << EOF
sed -i '/MV.*old/d' Makefile.in 
sed -i '/{OLDSUFF}/c:' support/shlib-install ./configure --prefix=/usr \
            --disable-static \ 
            --docdir=/usr/share/doc/readline-8.0
EOF

Then the compile 

echo 'make SHLIB_LIBS="-L/tools/lib -lncursesw"' > $confs/compile.readline

Then the install

echo > $confs/install.readline << "EOF" 
make SHLIB_LIBS="-L/tools/lib -lncursesw" install 
# Fix links and perms 
mv -v /usr/lib/lib{readline,history}.so.* /lib chmod -v u+w /lib/lib{readline,history}.so.* 
ln -sfv ../../lib/$(readlink /usr/lib/libreadline.so) /usr/lib/libreadline.so 
ln -sfv ../../lib/$(readlink /usr/lib/libhistory.so ) /usr/lib/libhistory.so # Install documentation 
install -v -m644 doc/*.{ps,pdf,html,dvi} /usr/share/doc/readline-8.0
EOF

There is no test suite so we will use the null script for that. The command to build is

./cci.pl -n readline -p readline-8.0.tar.gz -c config.readline -m compile.readline -t null -i install.readline

If you prefer you can choose not to install the extra documentation by leaving out the last two lines of the install component (starting with # Install documentation)

Step 9 – M4 1.4.18

We need to adjust the config script

cat > $confs/config.m4 << EOF 
sed -i 's/IO_ftrylockfile/IO_EOF_SEEN/' lib/*.c
echo "#define _IO_IN_BACKUP 0x100" >> lib/stdio-impl.h 
./configure –-prefix=/usr 
EOF

Then invoke cci.pl as follows

./cci.pl -n m4 -c config.m4


Step 10 - Bc-2.1.1

The bc program uses a custom configuration script and invokes the test with “make test.”

Make the appropriate config scripts

echo ‘PREFIX=/usr CC=gcc CFLAGS="-std=c99" ./configure.sh -G -O3’ > $confs/config.bc

echo “make test” > $confs/test.bc

Then run cci.pl

./cci.pl -n bc -p bc-1.07.1.tar.gz -c config.bc -t test.bc


Step 11 – Binutils 2.32

Everything is different in this package. We will override all the defaults.

First, check http://www.linuxfromscratch.org/lfs/view/development/chapter06/binutils.html

This is also a large compile that requires far more space than we have allocated to the RAM disk of the build area. First we need to unmount it:

umount /sources/build

Our package manager will gracefully handle large builds, but cci.pl does not.

It will perform a test of expect. If it fails most likely, your devpts (and devfs) has not been mounted. Once this is verified we make the config scripts

cat > $confs/config.binutils << "EOF" 
sed -i '/@\tincremental_copy/d' gold/testsuite/Makefile.in 
mkdir -v build 
cd build 
../configure --prefix=/usr \ 
             --enable-gold \ 
             --enable-ld=default \ 
             --enable-plugins \ 
             --enable-shared \ 
             --disable-werror \ 
             --enable-64-bit-bfd \ 
             --with-system-zlib 
EOF 

echo "make tooldir=/usr" > $confs/compile.binutils

echo "make -k check" > $confs/test.binutils

echo "make tooldir=/usr install" > $confs/install.binutils

then issue the command

./cci.pl -n binutils -p binutils-2.32.tar.xz -c config.binutils -m compile.binutils -t test.binutils -i install.binutils

Please note testing this package is very important. Verify it went well using the log.

Now remount the fast build area:

mount -o size=250M -t tmpfs tmpfs /sources/build


Step 12 – GMP 6.1.2

GMP has additional HTML documentation that can be installed if you want. If so, the default scripts won’t work. We’ll need to modify three of them. If you don’t care for the documentation then only a new config script is needed.

Create the config script

cat > $confs/config.gmp << EOF
./configure --prefix=/usr \
            --enable-cxx \
            --disable-static \
            --docdir=/usr/share/doc/gmp-6.1.2
EOF


If the additional documentation isn’t required, we’re ready to go. Run

./cci.pl -n gmp -p gmp-6.1.2.tar.xz -c config.gmp

If you want the documentation then do the following

echo "make ; make html" > $confs/compile.gmp

echo "make install ; make install-html" > $confs/install.gmp


then run

./cci.pl -n gmp -p gmp-6.1.2.tar.xz -c config.gmp -m compile.gmp -i install.gmp

Either way, LFS suggests checking the log file for the number of tests that pass since GMP has a known history of compiling incorrectly due to configuration, system, or compiler errors.

See http://www.linuxfromscratch.org/lfs/view/development/chapter06/gmp.html

Step 13 – MPFR 4.0.2

Like GMP there is additional HTML documentation that you can compile or not. It is exactly the same as GMP for the compile and install components of the scripts.

Make the config script

cat > $confs/config.mpfr << EOF
./configure --prefix=/usr \
            --disable-static \
            --enable-thread-safe \
            --docdir=/usr/share/doc/mpfr-4.0.2
EOF

Next run

./cci.pl-n mpfr -p mpfr-4.0.2.tar.xz -c config.mpfr

If the documentation is desired, instead do the following

echo "make ; make html" > $confs/compile.mpfr

echo "make install ; make install-html" > $confs/install.mpfr

then run
./cci.pl -n mpfr -p mpfr-4.0.2.tar.xz -c config.mpfr -m compile.mpfr -i install.mpfr

Again, running the test suite is considered mandatory since the configure script will very aggressively try to use the fastest options for the system.

Step 14 – MPC 1.1.0

Again, HTML documentation is provided. This process is exactly like the previous two packages. Create the config script

cat > $confs/config.mpc << EOF
./configure --prefix=/usr \
            --disable-static \
            --docdir=/usr/share/doc/mpc-1.1.0
EOF

If you don’t want the HTML documentation run

./cci.pl -n mpc -p mpc-1.1.0.tar.gz -c config.mpc

If you want the documentation, do the following

echo "make ; make htm" > $confs/compile.mpc

echo "make install ; make install-html" > $confs/install.mpc

the run

./cci.pl -n mpc -p mpc-1.1.0.tar.gz -c config.mpc -m compile.mpc -i install.mpc


Step 15 – Shadow 4.7

Create the configuration script

cat > $confs/config.shadow << "EOF"
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 / /' {} \;
sed -i -e 's@#ENCRYPT_METHOD DES@ENCRYPT_METHOD SHA512@' \
-e 's@/var/spool/mail@/var/mail@' etc/login.defs
sed -i 's/1000/999/' etc/useradd
./configure --sysconfdir=/etc –with-group-name-max-length=32
EOF

There is a useradd program as included in this package and it will create a configuration file called /etc/default/useradd. If unmodified, it will create a mailbox in the spool area for each user. Since the Unix mail system is rarely used the following will disable this action. If instead you want the user mail directory created, remove the sed command line from the block below.

And the install script

cat > $confs/install.shadow << EOF
make install
mv -v /usr/bin/passwd /bin
sed -i 's/yes/no/' /etc/default/useradd
EOF

And build it with

./cci.pl -n shadow -p shadow-4.6.tar.xz -c config.shadow -t null -i install.shadow

For a first time install of shadow you need to do the following

pwconv
grpconv
passwd root

The last command will reset the root user’s password, of course, but this is necessary or you won’t be able to log in. See more at:

http://www.linuxfromscratch.org/lfs/view/development/chapter06/shadow.html

Step 16 – GCC 9.1.0

This is first install of the compiler on the new system. Several steps must be taken to ensure there are no links of any kind to the intermediate system. There are many tests that verify the install is correct. For this reason, we will manually follow the LFS guide for now, and configure GCC in the package manager later.

Be sure to perform all the tests. Follow directions at:

http://www.linuxfromscratch.org/lfs/view/development/chapter06/gcc.html

Step 17 – bzip2 1.0.8

This package is the first that requires a patch. Any patch we want to apply can simply go in the config section. The biggest problem is the location of the patches in our temporary situation. For now we will leave them in sources and reference them with absolute paths. Create the config script

cat > $confs/config.bzip2 << "EOF"
patch -Np1 -i /sources/bzip2-1.0.6-install_docs-1.patch
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
make clean
EOF

Create the install script

cat > $confs/install.bzip2 << EOF
make PREFIX=/usr install
cp -v bzip2-shared /bin/bzip2
cp -av libbz2.so* /lib
ln -sv ../../lib/libbz2.so.1.0 /usr/lib/libbz2.so
rm -v /usr/bin/{bunzip2,bzcat,bzip2}
ln -sv bzip2 /bin/bunzip2
ln -sv bzip2 /bin/bzcat
EOF

Now build it

./cci.pl -n bzip2 -p bzip2-1.0.8.tar.gz -c config.bzip2 -t null -i install.bzip2

Since there is no test suite we use null for that component.

Step 18 – pkg-config 0.29.2

This program uses glib which isn’t available yet in our system. Fortunately it comes with an internal version we can use for now, though we will have to adjust this later. Create the config

cat > $confs/config.pkg-config << EOF
./configure --prefix=/usr \
--with-internal-glib \
--disable-host-tool \
--docdir=/usr/share/doc/pkg-config-0.29.2
EOF

Then execute

./cci.pl -n pkg-config -p pkg-config-0.29.2.tar.gz -c config.pkg-config


Step 19 – ncurses 6.1

One of the prime requirements for our second goal, angband, we are well on our way.

Create the config

cat > $confs/config.ncurses << "EOF"
sed -i '/LIBTOOL_INSTALL/d' c++/Makefile.in
/configure --prefix=/usr \
           --mandir=/usr/share/man \
           --with-shared \
           --without-debug \
           --without-normal \
           --enable-pc-files \
           --enable-widec
EOF

Then the install

cat > $confs/install.ncurses << "EOF"
make install
mv -v /usr/lib/libncursesw.so.6* /lib
ln -sfv ../../lib/$(readlink /usr/lib/libncursesw.so) /usr/lib/libncursesw.so
for lib in ncurses form panel menu ; do
  rm -vf /usr/lib/lib${lib}.so
  echo "INPUT(-l${lib}w)" > /usr/lib/lib${lib}.so
  ln -sfv ${lib}w.pc /usr/lib/pkgconfig/${lib}.pc
done
rm -vf /usr/lib/libcursesw.so
echo "INPUT(-lncursesw)" > /usr/lib/libcursesw.so
ln -sfv libncurses.so /usr/lib/libcurses.so
mkdir -v /usr/share/doc/ncurses-6.1
cp -v -R doc/* /usr/share/doc/ncurses-6.1
EOF

The last two lines above the EOF install additional documentation, remove them if you don’t need these.

We don’t have a test suite so run

./cci.pl -n ncurses -p ncurses-6.1.tar.gz -c config.ncurses -t null -i install.ncurses

Also, as discussed on the LFS page this will not install the non-wide (ASCII instead of Unicode) libraries since the wide libraries do everything the non-wide do. Since TTLP is a source based system where all code is compiled this isn’t a problem, but if some binary package is linked against the non-wide libraries you will have to install differently. In that case follow the directions from LFS, but this is not supported by TTLP. This is more a note for future reference.

http://www.linuxfromscratch.org/lfs/view/development/chapter06/ncurses.html

Step 20 – attr 2.4.48

Create the config

cat > $confs/config.attr << EOF
./configure --prefix=/usr \
            --bindir=/bin \
            --disable-static \
            --sysconfdir=/etc \
            --docdir=/usr/share/doc/attr-2.4.48
EOF

and the install

cat > $confs/install.attr << "EOF"
make install
mv -v /usr/lib/libattr.so.* /lib
ln -sfv ../../lib/$(readlink /usr/lib/libattr.so) /usr/lib/libattr.so
EOF

Then build with:

./cci.pl -n attr -p attr-2.4.48.tar.gz -c config.attr -i install.attr


Step 21 – acl 2.2.53

Create the config

cat > $confs/config.acl << EOF
./configure --prefix=/usr \
            --bindir=/bin \
            --disable-static \
            --libexecdir=/usr/lib \
            --docdir=/usr/share/doc/acl-2.2.53
EOF

and the install

cat > $confs/install.acl << "EOF"
make install
mv -v /usr/lib/libacl.so.* /lib
ln -sfv ../../lib/$(readlink /usr/lib/libacl.so) /usr/lib/libacl.so
EOF

There is a test suite but it requires coreutils which is not complete. You can test it later if you choose, instead will we use null.

./cci.pl -n acl -p acl-2.2.53.tar.gz -c config.acl -t null -i install.acl

http://www.linuxfromscratch.org/lfs/view/development/chapter06/acl.html

Step 22 – libcap 2.27

Make the config

echo 'sed -i '/install.*STALIBNAME/d' libcap/Makefile' > $confs/config.libcap

And the install

cat > $confs/install.libcap << "EOF"
make RAISE_SETFCAP=no lib=lib prefix=/usr install
chmod -v 755 /usr/lib/libcap.so.2.27
mv -v /usr/lib/libcap.so.* /lib
ln -sfv ../../lib/$(readlink /usr/lib/libcap.so) /usr/lib/libcap.so
EOF

Then build with

./cci.pl -n libcap -p libcap-2.27.tar.xz -c config.libcap -t null -i install.libcap


Step 23 – sed 4.7

Like other packages, sed has some additional HTML documentation that can be installed. You can modify the steps below and make the compile and install files exactly the same as step 10 but this configuration will not install the documentation.

Make the config

cat > $confs/config.sed << EOF
sed -i 's/usr/tools/' build-aux/help2man
sed -i 's/testsuite.panic-tests.sh//' Makefile.in
./configure --prefix=/usr –bindir=/bin
EOF

Make the install

cat > $confs/install.sed << EOF
make install
install -d -m755 /usr/share/doc/sed-4.7
install -m644 doc/sed.html /usr/share/doc/sed-4.7
EOF

Then build with

./cci.pl -n sed -p sed-4.7.tar.xz -c config.sed -i install.sed -

Because we are using the intermediate tools, sed needs a change for the final system. The config we used allowed it to work with the intermediate system but that will fail later. Remake the config in the final location

cat > /sources/sed/config << EOF
sed -i 's/testsuite.panic-tests.sh//' Makefile.in
./configure --prefix=/usr –bindir=/bin
EOF

Step 24 – psmisc 23.2

We just need an install, the the others are default

cat > $confs/install.psmisc << EOF
make install
mv -v /usr/bin/fuser /bin
mv -v /usr/bin/killall /bin
EOF

Then build

./cci.pl -n psmisc -p psmisc-23.2.tar.xz -i install.psmisc


Step 25 – iana-etc 2.30

There is no config or test so we simply run cci.pl with null for these two, all others are defaults.

./cci.pl -n iana-etc -p iana-etc-2.30.tar.bz2 -c null -t null


Step 26 – Bison 3.4.1

Build the config with a fix

cat > $confs/config.bison << EOF
sed -i '6855 s/mv/cp/' Makefile.in
./configure --prefix=/usr --docdir=/usr/share/doc/bison-3.4.1
EOF

Since bison has some reported issues with compiling in parallel we need to force it to use a single thread:

echo 'make -j1' > $confs/compile.bison

We can’t run the tests until after we install flex, so skip them. Build with:

./cci.pl -n bison -p bison-3.4.1.tar.xz -c config.bison -m compile.bison -t null


Step 27 – flex 2.6.4

Flex requires a tool that is not available in the intermediate tools so for the first build we’ll follow LFS and solve this problem. Later if we choose to install help2man we can fix this.

Create the config with the fix to make a fake help2man

cat > $confs/config.flex << "EOF"
sed -i "/math.h/a #include <malloc.h>" src/flexdef.h
HELP2MAN=/tools/bin/true \
./configure --prefix=/usr –docdir=/usr/share/doc/flex-2.6.4
EOF

And we need a link from flex to lex because some experiments we might perform with older code might expect to use lex. This will require a custom install

cat > $confs/install.flex << EOF
make install
ln -sv flex /usr/bin/lex
EOF

Then build with

./cci.pl -n flex -p flex-2.6.4.tar.gz -c config.flex -i install.flex

For now, we’ll leave the fix to help2man in place. It is a rarely used program. The true program does nothing but return true to the shell which triggers the make to accept that it did what it was supposed to do. This is way to get it to run without an error that would stop the process.

Step 28 – grep 3.3

Make the config

echo './configure --prefix=/usr --bindir=/bin' > $confs/config.grep

Make the test:

echo 'make -k check' > $confs/test.grep

Then build with:

./cci.pl -n grep -p grep-3.3.tar.xz -c config.grep -t test.grep


Step 29 – bash 5.0

Bash must be tested with the nobody user which makes the testing a bit more complicated.

Make the config:

cat > $confs/config.bash << EOF
./configure --prefix=/usr \
            --docdir=/usr/share/doc/bash-5.0 \
            --without-bash-malloc \
            --with-installed-readline
EOF

Create the test script:

cat > $confs/test.bash << "EOF"
chown -Rv nobody .
su nobody -s /bin/bash -c "PATH=$PATH HOME=/home make tests"
EOF

Finally the install script:

cat > $confs/install.bash << EOF
make install
mv -vf /usr/bin/bash /bin
EOF

Build with:

./cci.pl -n bash -p bash-5.0.tar.gz -c config.bash -t test.bash -i install.bash

Once complete, switch to the new shell (the current one is in /tools/bin) using:

exec /bin/bash --login +h

This step is only required for in the first build.

Step 30 – libtool 2.4.6

No changes are required. Build with

./cci.pl -n libtool -p libtool-2.4.6.tar.xz

The test suite is fairly long for this one.

Step 31 – GDBM 1.81.1

Again, we only need a config

cat > $confs/config.gdbm << EOF
./configure --prefix=/usr \
--disable-static \
--enable-libgdbm-compat
EOF

Then build with

./cci.pl -n gdbm -p gdbm-1.18.1.tar.gz -c config.gdbm


Step 32 – gperf 3.1

Make the config component

echo "./configure --prefix=/usr --docdir=/usr/share/doc/gperf-3.1" > $confs/config.gperf

Testing in parallel creates errors so restrict it to a single job

echo "make -j1 check" > $confs/test.gperf

Build it with

./cci.pl -n gperf -p gperf-3.1.tar.gz -c config.gperf -t test.gperf


Step 33 – expat 2.2.7

The expat test suite needs adjustment for config

cat > $confs/config.expat << EOF
sed -i 's|usr/bin/env |bin/|' run.sh.in
./configure --prefix=/usr \
            --disable-static \
            --docdir=/usr/share/doc/expat-2.2.7
EOF

If you want to install the documentation you’ll need to make a install like this

cat > $confs/install.expat << EOF
make install
install -v -m644 doc/*.{html,png,css} /usr/share/doc/expat-2.2.7
EOF

If you don’t care about the documentation, the default install will work.

For no documentation run

../cci.pl -n expat -p expat-2.2.6.tar.bz2 -c config.expat

to install the additional documentation run

./cci.pl -n expat -p expat-2.2.6.tar.bz2 -c config.expat -i install.expat


Step 34 – inetutils

There is only one change to this from the LFS guide. We are also disabling the talk command. First make the config

cat > $confs/config.inetutils << EOF
./configure --prefix=/usr \
            --localstatedir=/var \
            --disable-logger \
            --disable-whois \
            --disable-rcp \
            --disable-rexec \
            --disable-rlogin \
            --disable-rsh \
            --disable-servers \
            --disable-talk
EOF

And the install which needs to move a few things to /sbin to ensure they are available if only the root partition is mounted

cat > $confs/install.inetutils << EOF
make install
mv -v /usr/bin/{hostname,ping,ping6,traceroute} /bin
mv -v /usr/bin/ifconfig /sbin
EOF

Build with

./cci.pl -n inetutils -p inetutils-1.9.4.tar.xz -c config.inetutils -i install.inetutils


Step 35 – perl 5.30.0

First run a command to make a /etc/hosts which is need for configuration and testing

echo "127.0.0.1 localhost $(hostname)" > /etc/hosts

Create the config

cat > $confs/config.perl << "EOF"
export BUILD_ZLIB=False
export BUILD_BZIP2=0
sh Configure -des -Dprefix=/usr \
   -Dvendorprefix=/usr \
   -Dman1dir=/usr/share/man/man1 \
   -Dman3dir=/usr/share/man/man3 \
   -Dpager="/usr/bin/less -isR" \
   -Duseshrplib \
   -Dusethreads
EOF

Not two environment variables are created to force the build to use libraries on the system as opposed to internal libraries. Our script launches a new shell to run the build script making it unnecessary to unset these as in the LFS guide. The test is different from the default so run

echo "make -k test" > $confs/test.perl

Build with

./cci.pl -n perl -p perl-5.30.0.tar.xz -c config.perl -t test.perl

Now we have a Perl interpreter in the base system. We can now switch the cci.pl script to use the new interpreter. Run

sed -i 's/tools/usr/' ./cci.pl

to change both references to /tools/bin in the code.

Step 36 – XML::parser 2.44

Standard except it uses a perl Makefile

echo "perl Makefile.PL" > $confs/config.xml-parser

Adjust the test procedure

echo "make test" > $confs/test.xml-parser

Then build with

./cci.pl -n xml-parser -p XML-Parser-2.44.tar.gz -c config.xml-parser


Step 37 - Intltool 0.51.0

Create the config

cat > $confs/config.intltool << "EOF"
sed -i 's:\\\${:\\\$\\{:' intltool-update.in
./configure --prefix=/usr
EOF

If you want to install the documentation then make an install

cat > $confs/install.intltool << EOF
make install
install -v -Dm644 doc/I18N-HOWTO /usr/share/doc/intltool-0.51.0/I18N-HOWTO
EOF

and add “-t install.intltool” to the cci.pl command below

Build with

./cci.pl -n intltool -p intltool-0.51.0.tar.gz -c config.intltool


Step 38 – autoconf 2.69

Create the config which will fix a bug

cat > $confs/config.autoconf << "EOF"
sed '361 s/{/\\{/' -i bin/autoscan.in
./configure --prefix=/usr
EOF

The remaining components are the default. Build with

./cci.pl -n autoconf -p autoconf-2.69.tar.xz -c config.autoconf


Step 39 – automake 1.16.1

Create the config:

echo "./configure --prefix=/usr --docdir=/usr/share/doc/automake-1.16.1" > $confs/config.automake

Due to delays you can only run four test processes at a time. Adjust the test file to

echo "make -j4 check" > $confs/test.automake

The build with

./cci.pl -n automake -p automake-1.16.1.tar.xz -c config.automake -t test.automake

We are now at about the halfway point of the software to install. We’ll do the second half in the next installment. As you can see some of the test suites take a long time to complete but they are essential if you are building an experimental system. The package manager will allow the tests to be skipped, but for our first build it is important.

Copyright (C) 2019 by Michael R Stute

No comments:

Post a Comment