Linux From Scratch 5.1.1 / 3.toolchainを作成 2



toolchainの作成2(lfs-5.1.1-toolchain-2.sh)

Tcl のインストール

cd $LFS/sources
tar jxvf tcl8.4.6-src.tar.bz2
cd tcl8.4.6/unix
./configure --prefix=/tools
make;make install
ln -s tclsh8.4 /tools/bin/tclsh

Expect のインストール

cd $LFS/sources
tar jxvf expect-5.41.0.tar.bz2
cd expect-5.41
patch -Np1 -i ../expect-5.41.0-spawn-1.patch
./configure --prefix=/tools --with-tcl=/tools/lib --with-x=no
make;make SCRIPTS="" install
cd $LFS/sources
rm -rf expect-5.41
rm -rf tcl8.4.6

DejaGnu のインストール

cd $LFS/sources
tar jxvf dejagnu-1.4.4.tar.bz2
cd dejagnu-1.4.4
./configure --prefix=/tools
make install
cd $LFS/sources
rm -rf dejagnu-1.4.4

GCC の再インストール

cd $LFS/sources
tar jxvf gcc-core-3.3.3.tar.bz2
tar jxvf gcc-g++-3.3.3.tar.bz2
tar jxvf gcc-testsuite-3.3.3.tar.bz2
cd gcc-3.3.3
patch -Np1 -i ../gcc-3.3.3-no_fixincludes-1.patch
patch -Np1 -i ../gcc-3.3.3-specs-1.patch
mkdir ../gcc-build
cd ../gcc-build
../gcc-3.3.3/configure --prefix=/tools \
--with-local-prefix=/tools \
--enable-clocale=gnu --enable-shared \
--enable-threads=posix --enable-__cxa_atexit \
--enable-languages=c,c++
make;make install
cd $LFS/sources
rm -rf gcc-3.3.3
rm -rf gcc-build

Binutils の再インストール

cd $LFS/sources
tar jxvf binutils-2.14.tar.bz2
mkdir binutils-build
cd binutils-build
../binutils-2.14/configure --prefix=/tools \
--enable-shared --with-lib-path=/tools/lib
make;make install
make -C ld clean
make -C ld LIB_PATH=/usr/lib:/lib

この段階ではまだ Binutils の構築とソースのディレクトリを削除しないで下さい。 [4-6 Toolchain を再調整する] で、再び現状のまま必要となります。

Gawk のインストール

cd $LFS/sources
tar jxvf gawk-3.1.3.tar.bz2
cd gawk-3.1.3
./configure --prefix=/tools
make;make install
cd $LFS/sources
rm -rf gawk-3.1.3

Coreutils のインストール

cd $LFS/sources
tar jxvf coreutils-5.2.1.tar.bz2
cd coreutils-5.2.1
DEFAULT_POSIX2_VERSION=199209 ./configure --prefix=/tools
make;make install
cd $LFS/sources
rm -rf coreutils-5.2.1

Bzip2 のインストール

cd $LFS/sources
tar jxvf bzip2-1.0.2.tar.bz2
cd bzip2-1.0.2
make PREFIX=/tools install
cd $LFS/sources
rm -rf bzip2-1.0.2

Gzip のインストール

tar jxvf gzip-1.3.5.tar.bz2
cd gzip-1.3.5
./configure --prefix=/tools
make;make install
cd $LFS/sources
rm -rf gzip-1.3.5

Diffutils のインストール

tar jxvf diffutils-2.8.1.tar.bz2
cd diffutils-2.8.1
./configure --prefix=/tools
make;make install
cd $LFS/sources
rm -rf diffutils-2.8.1

Findutils のインストール

tar jxvf findutils-4.1.20.tar.bz2
cd findutils-4.1.20
./configure --prefix=/tools
make;make install
cd $LFS/sources
rm -rf findutils-4.1.20

Make のインストール

tar jxvf make-3.80.tar.bz2
cd make-3.80
./configure --prefix=/tools
make;make install
cd $LFS/sources
rm -rf make-3.80

Grep のインストール

tar jxvf grep-2.5.1.tar.bz2
cd grep-2.5.1
./configure --prefix=/tools \
--disable-perl-regexp --with-included-regex
make;make install
cd $LFS/sources
rm -rf grep-2.5.1

Sed のインストール

tar jxvf sed-4.0.9.tar.bz2
cd sed-4.0.9
./configure --prefix=/tools
make;make install
cd $LFS/sources
rm -rf sed-4.0.9

Gettext のインストール

tar jxvf gettext-0.14.1.tar.bz2
cd gettext-0.14.1
./configure --prefix=/tools
make;make install
cd $LFS/sources
rm -rf gettext-0.14.1

Ncurses のインストール

tar jxvf ncurses-5.4.tar.bz2
cd ncurses-5.4
./configure --prefix=/tools --with-shared \
--without-debug --without-ada --enable-overwrite
make;make install
cd $LFS/sources
rm -rf ncurses-5.4

Patch のインストール

tar jxvf patch-2.5.4.tar.bz2
cd patch-2.5.4
CPPFLAGS=-D_GNU_SOURCE ./configure --prefix=/tools
make;make install
cd $LFS/sources
rm -rf patch-2.5.4

Tar のインストール

tar jxvf tar-1.13.94.tar.bz2
cd tar-1.13.94
./configure --prefix=/tools
make;make install
cd $LFS/sources
rm -rf tar-1.13.94

Texinfo のインストール

tar jxvf texinfo-4.7.tar.bz2
cd texinfo-4.7
./configure --prefix=/tools
make;make install
cd $LFS/sources
rm -rf texinfo-4.7

Bash のインストール

tar jxvf bash-2.05b.tar.bz2
cd bash-2.05b
patch -Np1 -i ../bash-2.05b-2.patch
./configure --prefix=/tools
make;make install
ln -s bash /tools/bin/sh
cd $LFS/sources
rm -rf bash-2.05b

Util-linux のインストール

tar jxvf util-linux-2.12a.tar.bz2
cd util-linux-2.12a
cp configure configure.backup
sed "s@/usr/include@/tools/include@g" configure.backup > configure
./configure
make -C lib
make -C mount  mount umount
make -C text-utils  more
cp mount/{,u}mount text-utils/more /tools/bin
cd $LFS/sources
rm -rf util-linux-2.12a

Perl のインストール

tar jxvf perl-5.8.4.tar.bz2
cd perl-5.8.4
patch -Np1 -i ../perl-5.8.4-libc-1.patch
echo "uname -m" > /tools/bin/arch
chmod 755 /tools/bin/arch
./configure.gnu --prefix=/tools -Dstatic_ext='IO Fcntl POSIX'
make perl utilities
cp perl pod/pod2man /tools/bin
mkdir -p /tools/lib/perl5/5.8.4
cp -R lib/* /tools/lib/perl5/5.8.4
cd $LFS/sources
rm -rf perl-5.8.4

不必要なものを取り除く(任意行程)

約 130 MB の不必要なデバッグシンボルを取り除く

strip --strip-debug /tools/lib/*
strip --strip-unneeded /tools/{,s}bin/*

ドキュメントも削除すれば約 30MB を節約できます。

rm -rf /tools/{doc,info,man}