LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 744|回复: 3

今天刚刚开始装0603CVS,贴个脚本。

[复制链接]
发表于 2003-6-25 02:54:28 | 显示全部楼层 |阅读模式
这个是我在装的过程中一步一步做的,我写到这里面去,再贴到命令行去的。有错的地方都改过了。
大家机子不一样,如果在make test或者make check或者在make -k check的地方出错,好像问题不是很大。似乎把这些test之类的都去掉,LFS也不会出什么问题。如果为了省事,就直接去掉吧,免得出错。
把源码包放在/mnt/lfs/usr/src下就好了。

#!/bin/bash

export INSDIR=/mnt/lfs/usr/src

cd $INSDIR

#
# Install binutils-2.13.2 Pass1
#

tar -xvjf binutils-2.13.2.tar.bz2 &&
cd binutils-2.13.2 &&
mkdir ../binutils-build &&
cd ../binutils-build &&
../binutils-2.13.2/configure \
    --prefix=/stage1 --disable-nls &&
make LDFLAGS="-all-static" &&
make install &&
make -C ld clean &&
make -C ld LIB_PATH=/stage1/lib &&
echo " Binutils OK " >> /mnt/lfs/usr/src/stage1log
cd $INSDIR

#
# Install GCC-3.2.3 Pass1
#

tar -xvjf gcc-3.2.3.tar.bz2 &&
cd gcc-3.2.3 &&
patch -Np1 -i ../gcc-3.2.3-mmap_test.patch &&
patch -Np1 -i ../gcc-3.2.3-no_fixincludes.patch &&
mkdir ../gcc-build &&
cd ../gcc-build &&
../gcc-3.2.3/configure --prefix=/stage1 \
    --with-local-prefix=/stage1 \
    --disable-nls --enable-shared \
    --enable-languages=c &&
make BOOT_LDFLAGS="-static" bootstrap &&
make install &&
ln -sf gcc /stage1/bin/cc &&
echo " GCC-3.2.3 OK " >> /mnt/lfs/usr/src/stage1log
cd $INSDIR
rm -rf gcc-build
rm -rf gcc-3.2.3

#
# Install Linux Headers
#

tar -xvjf linux-2.4.20.tar.bz2 &&
cd linux-2.4.20 &&
make mrproper &&
make include/linux/version.h &&
make symlinks &&
mkdir /stage1/include/asm &&
cp include/asm/* /stage1/include/asm &&
cp -R include/asm-generic /stage1/include &&
cp -R include/linux /stage1/include &&
touch /stage1/include/linux/autoconf.h &&
cd $INSDIR
rm -rf linux-2.4.20

#
# Install Glibc-2.3.2
#

tar -xvjf glibc-2.3.2.tar.bz2 &&
cd glibc-2.3.2 &&
cp ../glibc-linuxthreads-2.3.2.tar.bz2 ./ &&
tar -xvjf glibc-linuxthreads-2.3.2.tar.bz2 &&
mkdir /stage1/etc &&
touch /stage1/etc/ld.so.conf &&
mkdir ../glibc-build &&
cd ../glibc-build &&
../glibc-2.3.2/configure --prefix=/stage1 \
    --disable-profile --enable-add-ons \
    --with-headers=/stage1/include \
    --with-binutils=/stage1/bin \
    --without-gd &&
make &&
make check &&
make install &&
make localedata/install-locales &&
cd $INSDIR
rm -rf glibc-2.3.2
rm -rf glibc-build

#
# Locking in Glibc
#

cd $INSDIR/binutils-build &&
make -C ld install-data-local &&
cd $INSDIR &&
rm -rf binutils-build &&
rm -rf binutils-2.13.2 &&
cd $INSDIR

SPECFILE=/stage1/lib/gcc-lib/*/*/specs &&
sed -e 's@/lib/ld.so.1@/stage1/lib/ld.so.1@g' \
    -e 's@/lib/ld-linux.so.2@/stage1/lib/ld-linux.so.2@g' \
    $SPECFILE > XX &&
mv XX $SPECFILE &&
unset SPECFILE &&
cd $INSDIR

#
# Install TCL-8.4.2
#

tar -xvjf tcl8.4.2-src.tar.bz2 &&
cd tcl8.4.2 &&
cd unix &&
./configure --prefix=/stage1 &&
make &&
make test &&
make install &&
ln -s tclsh8.4 /stage1/bin/tclsh &&
cd $INSDIR

#
# Install Expect-5.38
#

tar -xvjf expect-5.38.tar.bz2 &&
cd expect-5.38 &&
patch -Np1 -i ../expect-5.38.patch &&
./configure --prefix=/stage1 --with-tcl=/stage1/lib --with-x=no &&
make &&
make test &&
make install &&
cd $INSDIR
rm -rf tcl8.4.2
rm -rf expect-5.38

#
# Install DejaGNU-1.4.3
#

tar -xvjf dejagnu-1.4.3.tar.bz2 &&
cd dejagnu-1.4.3 &&
./configure --prefix=/stage1 &&
make install &&
cd $INSDIR
rm -rf dejagnu-1.4.3

#
# Install GCC-3.2.3 Pass2
#
# While make -k check, error came but, it's said that it is safe to go on.
# So I removed the && after make -k check
#

tar -xvjf gcc-3.2.3.tar.bz2 &&
cd gcc-3.2.3 &&
patch -Np1 -i ../gcc-3.2.3-specs-4.patch &&
patch -Np1 -i ../gcc-3.2.3-mmap_test.patch &&
patch -Np1 -i ../gcc-3.2.3-no_fixincludes.patch &&
mkdir ../gcc-build &&
cd ../gcc-build &&
../gcc-3.2.3/configure --prefix=/stage1 \
    --with-local-prefix=/stage1 \
    --enable-clocale=gnu --enable-shared \
    --enable-threads=posix --enable-__cxa_atexit \
    --enable-languages=c,c++ &&
make &&
make -k check
make install &&
cd $INSDIR
rm -rf gcc-3.2.3
rm -rf gcc-build

#
# Install Binutils-2.13.2
#

tar -xvjf binutils-2.13.2.tar.bz2 &&
cd binutils-2.13.2 &&
patch -Np1 -i ../binutils-2.13.2-lib-path.patch &&
mkdir ../binutils-build &&
cd ../binutils-build &&
../binutils-2.13.2/configure --prefix=/stage1 \
    --enable-shared --with-lib-path=/stage1/lib &&
make &&
make check &&
make install &&
make -C ld clean &&
make -C ld LIB_PATH=/usr/lib:/lib &&
cd $INSDIR

#
# Install Gawk-3.1.2
#

tar -xvjf gawk-3.1.2.tar.bz2 &&
cd gawk-3.1.2 &&
./configure --prefix=/stage1 &&
make &&
make install &&
cd $INSDIR
rm -rf gawk-3.1.2

#
# Install Coreutils-5.0
#

tar -xvjf coreutils-5.0.tar.bz2 &&
cd coreutils-5.0 &&
./configure --prefix=/stage1 &&
make &&
make RUN_EXPENSIVE_TESTS=yes check &&
make install &&
cd $INSDIR
rm -rf coreutils-5.0

#
# Install Bzip2
#

tar -xvjf bzip2-1.0.2.tar.bz2 &&
cd bzip2-1.0.2 &&
make &&
make PREFIX=/stage1 install &&
cd $INSDIR
rm -rf bzip2-1.0.2

#
# Install Gzip-1.3.5
#

tar -xvjf gzip-1.3.5.tar.bz2 &&
cd gzip-1.3.5 &&
./configure --prefix=/stage1 &&
make &&
make install &&
cd $INSDIR
rm -rf gzip-1.3.5

#
# Install Diffutils-2.8.1
#

tar -xvjf diffutils-2.8.1.tar.bz2 &&
cd diffutils-2.8.1 &&
./configure --prefix=/stage1 &&
make &&
make install &&
cd $INSDIR
rm -rf diffutils-2.8.1

#
# Install Findutils-4.1.7
#

tar -xvjf findutils-4.1.7.tar.bz2 &&
cd findutils-4.1.7 &&
./configure --prefix=/stage1 &&
make &&
make check &&
make install &&
cd $INSDIR
rm -rf findutils-4.1.7

#
# Install Make-3.80
#

tar -xvjf make-3.80.tar.bz2 &&
cd make-3.80 &&
./configure --prefix=/stage1 &&
make &&
make check &&
make install &&
cd $INSDIR
rm -rf make-3.80

#
# Install Grep-2.5.1
#

tar -xvjf grep-2.5.1.tar.bz2 &&
cd grep-2.5.1 &&
./configure --prefix=/stage1 \
    --disable-perl-regexp --with-included-regex &&
make &&
make check &&
make install &&
cd $INSDIR
rm -rf grep-2.5.1

#
# Install Sed-4.0.7
#

tar -xvjf sed-4.0.7.tar.bz2 &&
cd sed-4.0.7 &&
./configure --prefix=/stage1 &&
make &&
make check &&
make install &&
cd $INSDIR
rm -rf sed-4.0.7

#
# Install gettext-0.11.5
#
# While make check, 1 of 197 tests failed. so I removed the && after make check.
#

tar -xvjf gettext-0.11.5.tar.bz2 &&
cd gettext-0.11.5 &&
./configure --prefix=/stage1 &&
make &&
make check
make install &&
cd $INSDIR
rm -rf gettext-0.11.5

#
# Install Ncurses-5.3
#

tar -xvjf ncurses-5.3.tar.bz2 &&
cd ncurses-5.3 &&
patch -Np1 -i ../ncurses-5.3-etip-2.patch &&
patch -Np1 -i ../ncurses-5.3-vsscanf.patch &&
./configure --prefix=/stage1 --with-shared --without-debug \
    --without-ada &&
make &&
make install &&
chmod 755 /stage1/lib/*.5.3 &&
cd $INSDIR
rm -rf ncurses-5.3

#
# Install Patch-2.5.4
#

tar -xvjf patch-2.5.4.tar.bz2 &&
cd patch-2.5.4 &&
CPPFLAGS=-D_GNU_SOURCE ./configure --prefix=/stage1 &&
make &&
make install &&
cd $INSDIR
rm -rf patch-2.5.4

#
# Install Tar-1.13.25
#

tar -xvjf tar-1.13.25.tar.bz2 &&
cd tar-1.13.25 &&
CPPFLAGS=-D_GNU_SOURCE ./configure --prefix=/stage1 &&
make &&
make install &&
cd $INSDIR
rm -rf tar-1.13.25

#
# Install Texinfo-4.5
#

tar -xvjf texinfo-4.5.tar.bz2 &&
cd texinfo-4.5 &&
./configure --prefix=/stage1 &&
make &&
make check &&
make install &&
cd $INSDIR
rm -rf texinfo-4.5

#
# Install bash-2.05b
#

tar -xvjf bash-2.05b.tar.bz2 &&
cd bash-2.05b &&
patch -Np1 -i ../bash-2.05b.patch &&
./configure --prefix=/stage1 \
    --with-curses &&
make &&
make tests &&
make install &&
ln -s bash /stage1/bin/sh &&
cd $INSDIR
rm -rf bash-2.05b

#
# Install Util-linux-2.11z
#

tar -xvjf util-linux-2.11z.tar.bz2 &&
cd util-linux-2.11z &&
./configure &&
make -C lib &&
make -C mount mount umount &&
make -C text-utils more &&
cp mount/{mount,umount} /stage1/bin &&
cp text-utils/more /stage1/bin &&
cd $INSDIR
rm -rf util-linux-2.11z

#
# Install Perl-5.8.0
#

tar -xvjf perl-5.8.0.tar.bz2 &&
cd perl-5.8.0 &&
patch -Np1 -i ../perl-5.8.0-libc.patch &&
chmod u+w hints/linux.sh &&
echo 'static_ext="IO re Fcntl"' >> hints/linux.sh &&
./configure.gnu --prefix=/stage1 &&
make perl &&
make utilities &&
cp perl /stage1/bin/perl &&
cp pod/pod2man /stage1/bin &&
mkdir -p /stage1/lib/perl5/5.8.0 &&
cp -R lib/* /stage1/lib/perl5/5.8.0 &&
cd $INSDIR
rm -rf perl-5.8.0
 楼主| 发表于 2003-6-25 02:55:47 | 显示全部楼层

这个是我第一次写

没学过,有错大家改。
发表于 2003-6-26 11:42:37 | 显示全部楼层
这个脚本不够聪明。
发表于 2003-10-7 03:11:58 | 显示全部楼层
是的,最好有case 1)  2)  3),这样可以分阶段
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表