Hi,

below is a very simple script, the intention of which is to do all of chapter 5 
in one sweep and avoid having to type all the commands in (error prone and 
nauseating after the umpteenth time round).


The script assumes that everything is setup right up to chapter 5. No error 
checking is performed to ensure this so don't use this script if you haven't 
set everything up right up to the beginning of chapter 5. The script also 
assumes that all the tarballs are present in the directory it is run from (no 
checking is made). It assumes that they are all in their original state except 
for those that have .bz2 suffix in which case the assumption is that they have 
been unzipped leaving the tar archive as named in the script.


On my box the script seems to compile everything fine except for Texinfo which 
gives some warnings which I have been unable to diagnose or get rid of. It 
would be great if somebody out there could test this script on their setup and 
see if it works for them or if they get the same Texinfo errors.


If I get any positive feedback about the script it might then turn out 
worthwhile developing it further and add error checking and or any other 
desired functionality (like being able to do a selected range of steps).


#!/bin/bash
#
# Binutils Pass 1
#
echo '***!!!*** Start of Binutils-2.25.1 pass 1' &&
tar xf binutils-2.25.1.tar &&
cd binutils-2.25.1 &&
mkdir -v ../binutils-build &&
cd ../binutils-build &&
../binutils-2.25.1/configure --prefix=/tools --with-sysroot=$LFS 
--with-lib-path=/tools/lib --target=$LFS_TGT --disable-nls --disable-werror &&
echo '***!!!*** End of configure' &&
make &&
echo '***!!!*** End of make' &&
case $(uname -m) in
  x86_64) mkdir -v /tools/lib && ln -sv lib /tools/lib64 ;;
esac
make install &&
echo '***!!!*** End of make install' &&
cd .. &&
rm -rf binutils-build &&
rm -rf binutils-2.25.1/ &&
echo '***!!!*** Binutils Pass 1 finished'
#
# GCC Pass 1
#
echo '***!!!*** Start of Gcc-5.2.0 pass 1' &&
tar xf gcc-5.2.0.tar &&
cd gcc-5.2.0 &&
tar -xf ../mpfr-3.1.3.tar.xz &&
mv -v mpfr-3.1.3 mpfr &&
tar -xf ../gmp-6.0.0a.tar.xz &&
mv -v gmp-6.0.0 gmp &&
tar -xf ../mpc-1.0.3.tar.gz &&
mv -v mpc-1.0.3 mpc &&
echo '***!!!*** End of unpacking' &&
for file in \
 $(find gcc/config -name linux64.h -o -name linux.h -o -name sysv4.h)
do
  cp -uv $file{,.orig}
  sed -e 's@/lib\(64\)\?\(32\)\?/ld@/tools&@g' \
      -e 's@/usr@/tools@g' $file.orig > $file
  echo '
#undef STANDARD_STARTFILE_PREFIX_1
#undef STANDARD_STARTFILE_PREFIX_2
#define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/"
#define STANDARD_STARTFILE_PREFIX_2 ""' >> $file
  touch $file.orig
done
mkdir -v ../gcc-build &&
cd ../gcc-build &&
echo '***!!!*** End of manual linking configuration' &&
../gcc-5.2.0/configure --target=$LFS_TGT --prefix=/tools 
--with-glibc-version=2.11 --with-sysroot=$LFS --with-newlib --without-headers 
--with-local-prefix=/tools --with-native-system-header-dir=/tools/include 
--disable-nls --disable-shared --disable-multilib --disable-decimal-float 
--disable-threads --disable-libatomic --disable-libgomp --disable-libquadmath 
--disable-libssp --disable-libvtv --disable-libstdcxx --enable-languages=c,c++ 
&&
echo '***!!!*** End of configure' &&
make &&
echo '***!!!*** End of make' &&
make install &&
echo '***!!!*** End of make install' &&
cd .. &&
rm -rf gcc-build &&
rm -rf gcc-5.2.0/ &&
echo '***!!!*** GCC Pass 1 finished'
#
# Pass 1 Linux API Headers
#
echo '***!!!*** Start of Linux-4.2 API Headers Pass 1' &&
tar xf linux-4.2.tar.xz &&
cd linux-4.2 &&
make mrproper &&
echo '***!!!*** End of make mrproper' &&
make INSTALL_HDR_PATH=dest headers_install &&
echo '***!!!*** End of make headers_install' &&
cp -rv dest/include/* /tools/include &&
echo '***!!!*** End of manual install' &&
cd .. &&
rm -rf linux-4.2/ &&
echo '***!!!*** Pass 1 Linux API Headers finished'
#
# Pass 1 Glibc
#
echo '***!!!*** Start of Glibc-2.22' &&
tar xf glibc-2.22.tar.xz &&
cd glibc-2.22 &&
patch -Np1 -i ../glibc-2.22-upstream_i386_fix-1.patch &&
mkdir -v ../glibc-build &&
cd ../glibc-build &&
../glibc-2.22/configure --prefix=/tools --host=$LFS_TGT 
--build=$(../glibc-2.22/scripts/config.guess) --disable-profile 
--enable-kernel=2.6.32 --enable-obsolete-rpc --with-headers=/tools/include 
libc_cv_forced_unwind=yes libc_cv_ctors_header=yes libc_cv_c_cleanup=yes &&
echo '***!!!*** End of configure' &&
make &&
echo '***!!!*** End of make' &&
make install &&
echo '***!!!*** End of make install' &&
cd .. &&
rm -rf glibc-build/ &&
rm -rf glibc-2.22/ &&
echo '***!!!*** Glibc Pass 1 finished'
#
# Pass 1 Libstdc++
#
echo '***!!!*** Start of Libstdc++ Pass 1' &&
tar xf gcc-5.2.0.tar &&
cd gcc-5.2.0 &&
mkdir -v ../gcc-build &&
cd ../gcc-build &&
../gcc-5.2.0/libstdc++-v3/configure --host=$LFS_TGT --prefix=/tools 
--disable-multilib --disable-nls --disable-libstdcxx-threads 
--disable-libstdcxx-pch 
--with-gxx-include-dir=/tools/$LFS_TGT/include/c++/5.2.0 &&
echo '***!!!*** End of configure' &&
make &&
echo '***!!!*** End of make' &&
make install &&
echo '***!!!*** End of make install' &&
cd .. &&
rm -rf gcc-build &&
rm -rf gcc-5.2.0/ &&
echo '***!!!*** Pass 1 Libstdc++ finished'
#
# Binutils Pass 2
#
echo '***!!!*** Start of Binutils-2.25.1 Pass 2' &&
tar xf binutils-2.25.1.tar &&
cd binutils-2.25.1 &&
mkdir -v ../binutils-build &&
cd ../binutils-build &&
CC=$LFS_TGT-gcc AR=$LFS_TGT-ar RANLIB=$LFS_TGT-ranlib 
../binutils-2.25.1/configure --prefix=/tools --disable-nls --disable-werror 
--with-lib-path=/tools/lib --with-sysroot &&
echo '***!!!*** End of configure' &&
make &&
echo '***!!!*** End of make' &&
make install &&
echo '***!!!*** End of make install' &&
make -C ld clean &&
echo '***!!!*** End of ' &&
make -C ld LIB_PATH=/usr/lib:/lib &&
echo '***!!!*** End of ' &&
cp -v ld/ld-new /tools/bin &&
echo '***!!!*** End of manual copy' &&
cd .. &&
rm -rf binutils-build &&
rm -rf binutils-2.25.1/ &&
echo '***!!!*** Binutils Pass 2 finished'
#
# GCC Pass 2
#
echo '***!!!*** Start of Gcc-5.2.0' &&
tar xf gcc-5.2.0.tar &&
cd gcc-5.2.0 &&
cat gcc/limitx.h gcc/glimits.h gcc/limity.h >   `dirname $($LFS_TGT-gcc 
-print-libgcc-file-name)`/include-fixed/limits.h &&
for file in  $(find gcc/config -name linux64.h -o -name linux.h -o -name 
sysv4.h); do   cp -uv $file{,.orig};   sed -e 
's@/lib\(64\)\?\(32\)\?/ld@/tools&@g'       -e 's@/usr@/tools@g' $file.orig > 
$file;   echo '
#undef STANDARD_STARTFILE_PREFIX_1
#undef STANDARD_STARTFILE_PREFIX_2
#define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/"
#define STANDARD_STARTFILE_PREFIX_2 ""' >> $file;   touch $file.orig; done &&
tar -xf ../mpfr-3.1.3.tar.xz &&
mv -v mpfr-3.1.3 mpfr &&
tar -xf ../gmp-6.0.0a.tar.xz &&
mv -v gmp-6.0.0 gmp &&
tar -xf ../mpc-1.0.3.tar.gz &&
mv -v mpc-1.0.3 mpc &&
mkdir -v ../gcc-build &&
cd ../gcc-build &&
echo '***!!!*** End of linker configuration' &&
CC=$LFS_TGT-gcc CXX=$LFS_TGT-g++ AR=$LFS_TGT-ar RANLIB=$LFS_TGT-ranlib 
../gcc-5.2.0/configure --prefix=/tools --with-local-prefix=/tools 
--with-native-system-header-dir=/tools/include --enable-languages=c,c++ 
--disable-libstdcxx-pch --disable-multilib --disable-bootstrap 
--disable-libgomp &&
echo '***!!!*** End of configure' &&
make &&
echo '***!!!*** End of make' &&
make install &&
echo '***!!!*** End of make install' &&
ln -sv gcc /tools/bin/cc
cd .. &&
rm -rf gcc-build &&
rm -rf gcc-5.2.0/ &&
echo '***!!!*** GCC Pass 2 finished'
echo 'Done'
#
# Tcl-core-8.6.4
#
echo '***!!!*** Start of Tcl-core-8.6.4' &&
tar xzf tcl-core8.6.4-src.tar.gz &&
cd tcl8.6.4/ &&
cd unix &&
./configure --prefix=/tools &&
echo '***!!!*** End of configure' &&
make install &&
echo '***!!!*** End of make install' &&
chmod -v u+w /tools/lib/libtcl8.6.so &&
make install-private-headers &&
echo '***!!!*** End of make install private headers' &&
ln -sv tclsh8.6 /tools/bin/tclsh &&
cd ../.. &&
rm -rf tcl8.6.4/ &&
echo '***!!!*** Finished Tcl-core'
#
# Expect-5.45
#
echo '***!!!*** Start 0f Expect-5.45' &&
tar xzf expect5.45.tar.gz &&
cd expect5.45 &&
cp -v configure{,.orig} &&
sed 's:/usr/local/bin:/bin:' configure.orig > configure &&
./configure --prefix=/tools --with-tcl=/tools/lib 
--with-tclinclude=/tools/include &&
echo '***!!!*** End of configure'
make &&
echo '***!!!*** End of make'
make SCRIPTS="" install &&
echo 'End of make SCRIPTS="" install'
cd .. &&
rm -rf expect5.45/ &&
echo '***!!!*** Finished'
#
# DejaGNU-1.5.3
#
echo '***!!!*** Start of DejaGNU-1.5.3' &&
tar xzf dejagnu-1.5.3.tar.gz &&
cd dejagnu-1.5.3 &&
./configure --prefix=/tools
echo '***!!!*** End of configure' &&
make install &&
echo '***!!!*** End of make install' &&
cd .. &&
rm -rf dejagnu-1.5.3/ &&
echo '***!!!*** Finished'
#
# Check-0.10.0
#
echo '***!!!*** Start of Check-0.10.0' &&
tar xzf check-0.10.0.tar.gz &&
cd check-0.10.0/ &&
PKG_CONFIG= ./configure --prefix=/tools &&
echo '***!!!*** End of configure'
make &&
echo '***!!!*** End of make'
make install &&
echo '***!!!*** End of make install'
cd .. &&
rm -rf check-0.10.0/ &&
echo '***!!!*** Finished Check-0.10.0'
#
# Ncurses-6.0
#
echo '***!!!*** Start of Ncurses-6.0' &&
tar xzf ncurses-6.0.tar.gz &&
cd ncurses-6.0/ &&
sed -i s/mawk// configure &&
./configure --prefix=/tools --with-shared --without-debug --without-ada 
--enable-widec --enable-overwrite &&
echo '***!!!*** End of configure' &&
make &&
echo '***!!!*** End of make' &&
make install &&
echo '***!!!*** End of make install' &&
cd .. &&
rm -rf ncurses-6.0/ &&
echo '***!!!*** Finished'
#
# Bash-4.3.30
#
echo '***!!!*** Start of Bash-4.3.30' &&
tar xzf bash-4.3.30.tar.gz &&
cd bash-4.3.30/ &&
./configure --prefix=/tools --without-bash-malloc &&
echo '***!!!*** End of configure' &&
make &&
echo '***!!!*** End of make' &&
make install &&
echo '***!!!*** End of make install' &&
ln -sv bash /tools/bin/sh &&
cd .. &&
rm -rf bash-4.3.30/ &&
echo '***!!!*** Finished'
#
# Bzip2-1.0.6
#
echo '***!!!*** Start of Bzip2-1.0.6' &&
tar xzf bzip2-1.0.6.tar.gz &&
cd bzip2-1.0.6/ &&
make &&
echo '***!!!*** End of make'
make PREFIX=/tools install &&
echo '***!!!*** End of make install'
cd .. &&
rm -rf bzip2-1.0.6/ &&
echo '***!!!*** Finished Bzip2-1.0.6'
#!/bin/bash
tar xf coreutils-8.24.tar.xz &&
cd coreutils-8.24/ &&
./configure --prefix=/tools --enable-install-program=hostname &&
echo '***!!!*** End of configure'
make &&
echo '***!!!*** End of make'
make install &&
echo '***!!!*** End of make install'
cd .. &&
rm -rf coreutils-8.24/ &&
echo '***!!!*** Finished'
#
# Diffutils-3.3
#
echo '***!!!*** Start of Diffutils-3.3' &&
tar xf diffutils-3.3.tar.xz &&
cd diffutils-3.3/ &&
./configure --prefix=/tools &&
echo '***!!!*** End of configure' &&
make &&
echo '***!!!*** End of make' &&
make install &&
echo '***!!!*** End of make install' &&
cd .. &&
rm -rf diffutils-3.3/ &&
echo '***!!!*** Finished Diffutils-3.3'
#
# File-5.24
#
echo '***!!!*** Start of File-5.24' &&
tar xzf file-5.24.tar.gz &&
cd file-5.24/ &&
./configure --prefix=/tools &&
echo '***!!!*** End of configure' &&
make &&
echo '***!!!*** End of make' &&
make install &&
echo '***!!!*** End of make install' &&
cd .. &&
rm -rf file-5.24/ &&
echo '***!!!*** Finished'
#
# Findutils-4.4.2
#
echo '***!!!*** Start of Findutils-4.4.2' &&
tar xzf findutils-4.4.2.tar.gz &&
cd findutils-4.4.2/ &&
./configure --prefix=/tools &&
echo '***!!!*** End of configure' &&
make &&
echo '***!!!*** End of make' &&
make install &&
echo '***!!!*** End of make install' &&
cd .. &&
rm -rf findutils-4.4.2/ &&
echo '***!!!*** Finished'
#
# Gawk-4.1.3
#
echo '***!!!*** Start of Gawk-4.1.3' &&
tar xf gawk-4.1.3.tar.xz &&
cd gawk-4.1.3/ &&
./configure --prefix=/tools &&
echo '***!!!*** End of configure' &&
make &&
echo '***!!!*** End of make' &&
make install &&
echo '***!!!*** End of make install' &&
cd .. &&
rm -rf gawk-4.1.3/ &&
echo '***!!!*** Finished'
#
# Gettext-0.19.5.1
#
echo '***!!!*** Start of Gettext-0.19.5.1' &&
tar xf gettext-0.19.5.1.tar.xz &&
cd gettext-0.19.5.1/ &&
cd gettext-tools &&
EMACS="no" ./configure --prefix=/tools --disable-shared &&
echo '***!!!*** End of configure'
make -C gnulib-lib &&
echo '***!!!*** End of make' &&
make -C intl pluralx.c &&
echo '***!!!*** End of make' &&
make -C src msgfmt &&
echo '***!!!*** End of make' &&
make -C src msgmerge &&
echo '***!!!*** End of make' &&
make -C src xgettext &&
echo '***!!!*** End of make' &&
cp -v src/{msgfmt,msgmerge,xgettext} /tools/bin
echo '***!!!*** End of manual install'
cd ../.. &&
rm -rf gettext-0.19.5.1/ &&
echo '***!!!*** Finished'
#
# Grep-2.21
#
echo '***!!!*** Start of Grep-2.21' &&
tar xf grep-2.21.tar.xz &&
cd grep-2.21/ &&
./configure --prefix=/tools &&
echo '***!!!*** End of configure' &&
make &&
echo '***!!!*** End of make' &&
make install &&
echo '***!!!*** End of make install' &&
cd .. &&
rm -rf grep-2.21/ &&
echo '***!!!*** Finished Grep-2.21'
#
# Gzip-1.6
#
echo '***!!!*** Start of Gzip-1.6' &&
tar xf gzip-1.6.tar.xz &&
cd gzip-1.6/ &&
./configure --prefix=/tools &&
echo '***!!!*** End of configure' &&
make &&
echo '***!!!*** End of make' &&
make install &&
echo '***!!!*** End of make install' &&
cd .. &&
rm -rf gzip-1.6/ &&
echo '***!!!*** Finished Gzip-1.6'
#
# M4-1.4.17
#
echo '***!!!*** Start of M4-1.4.17' &&
tar xf m4-1.4.17.tar.xz &&
cd m4-1.4.17/ &&
./configure --prefix=/tools &&
echo '***!!!*** End of configure' &&
make &&
echo '***!!!*** End of make' &&
make install &&
echo '***!!!*** End of make install' &&
cd .. &&
rm -rf m4-1.4.17/
echo '***!!!*** Finished M4-1.4.17'
#
# Make-4.1
#
echo '***!!!*** Start of Make-4.1' &&
tar xf make-4.1.tar &&
cd make-4.1/ &&
./configure --prefix=/tools --without-guile &&
echo '***!!!*** End of configure' &&
make &&
echo '***!!!*** End of make' &&
make install &&
echo '***!!!*** End of make install' &&
cd .. &&
rm -rf make-4.1/ &&
echo '***!!!*** Finished Make-4.1'
#
# Patch-2.7.5
#
echo '***!!!*** Start of Patch-2.7.5' &&
tar xf patch-2.7.5.tar.xz &&
cd patch-2.7.5/ &&
./configure --prefix=/tools &&
echo '***!!!*** End of configure' &&
make &&
echo '***!!!*** End of make' &&
make install &&
echo '***!!!*** End of make install' &&
cd .. &&
rm -rf patch-2.7.5/ &&
echo '***!!!*** Finished Patch-2.7.5'
#
# Perl-5.22.0
#
echo '***!!!*** Start of Perl-5.22.0' &&
tar xf perl-5.22.0.tar &&
cd perl-5.22.0/ &&
sh Configure -des -Dprefix=/tools -Dlibs=-lm &&
echo '***!!!*** End of configuration' &&
make &&
echo '***!!!*** End of make' &&
cp -v perl cpan/podlators/pod2man /tools/bin &&
mkdir -pv /tools/lib/perl5/5.22.0 &&
cp -Rv lib/* /tools/lib/perl5/5.22.0 &&
echo '***!!!*** End of manual install' &&
cd .. &&
rm -rf perl-5.22.0/ &&
echo '***!!!*** Finshed Perl-5.22.0'
#
# Sed-4.2.2
#
echo '***!!!*** Start of Sed-4.2.2' &&
tar xf sed-4.2.2.tar &&
cd sed-4.2.2/ &&
./configure --prefix=/tools &&
echo '***!!!*** End of configure' &&
make &&
echo '***!!!*** End of make' &&
make install &&
echo '***!!!*** End of make install' &&
cd .. &&
rm -rf sed-4.2.2/ &&
echo '***!!!*** Finished Sed-4.2.2'
#
# Tar-1.28
#
echo '***!!!*** Start of Tar-1.2' &&
tar xf tar-1.28.tar.xz &&
cd tar-1.28/ &&
./configure --prefix=/tools &&
echo '***!!!*** End of configure' &&
make &&
echo '***!!!*** End of make' &&
make install &&
echo '***!!!*** End of make install' &&
cd .. &&
rm -rf tar-1.28/ &&
echo '***!!!*** Finished Tar-1.28'
#
# Texinfo-6.0
#
echo '***!!!*** Start of Texinfo-6.0' &&
tar xf texinfo-6.0.tar.xz &&
cd texinfo-6.0/ &&
./configure --prefix=/tools &&
echo '***!!!*** End of configure' &&
make &&
echo '***!!!*** End of make' &&
make install &&
echo '***!!!*** End of make install' &&
cd .. &&
rm -rf texinfo-6.0/ &&
echo '***!!!*** Finished Texinfo-6.0'
#
# Util-linux-2.27
#
echo '***!!!*** Start of Util-linux-2.27' &&
tar xf util-linux-2.27.tar.xz &&
cd util-linux-2.27/ &&
./configure --prefix=/tools --without-python --disable-makeinstall-chown 
--without-systemdsystemunitdir PKG_CONFIG="" &&
echo '***!!!*** End of configure' &&
make &&
echo '***!!!*** End of make'
make install &&
echo '***!!!*** End of make install'
cd .. &&
rm -rf util-linux-2.27/ &&
echo '***!!!*** Finished Util-linux-2.27'
#
# Xz-5.2.1
#
echo '***!!!*** Start of Xz-5.2.1' &&
tar xf xz-5.2.1.tar.xz &&
cd xz-5.2.1/ &&
./configure --prefix=/tools &&
echo '***!!!*** End of configure' &&
make &&
echo '***!!!*** End of make' &&
make install &&
echo '***!!!*** End of make install' &&
cd .. &&
rm -rf xz-5.2.1/ &&
echo '***!!!*** Finished Xz-5.2.1'
-- 
http://lists.linuxfromscratch.org/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Do not top post on this list.

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

http://en.wikipedia.org/wiki/Posting_style

Reply via email to