文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>14.构建LFS系统──安装系统基础软件(六)

14.构建LFS系统──安装系统基础软件(六)

时间:2006-11-17  来源:anima

十四、构建LFS系统──安装系统基础软件(六)


20.Sed-4.1.5

Sed 是一个流编辑器。

预计编译时间: 0.1 SBU

所需磁盘空间: 6.4 MB


安装Sed

root:/sources/procps-3.2.6# mv $LFS/sources/sed-4.1.5 $LFS/sources/old2

root:/sources/procps-3.2.6# tar -zxvf $LFS/sources/sed-4.1.5.tar.gz -C $LFS/sources

root:/sources/procps-3.2.6# cd $LFS/sources/sed-4.1.5


为编译Sed做准备:


root:/sources/sed-4.1.5# ./configure --prefix=/usr --bindir=/bin –enable-html


新配置选项的含义:

--enable-html This builds the HTML documentation.


编译软件包:


root:/sources/sed-4.1.5# make


要测试结果,请运行:make check 。


安装软件包:


root:/sources/sed-4.1.5# make install




Sed 的内容

安装的程序: sed

简要描述

sed

流式(单向)过滤和改变文本文件








21.Libtool-1.5.22

GNU libtool 是一个通用库支持脚本,将使用动态库的复杂性隐藏在统一的、可移植的接口中。

预计编译时间: 0.1 SBU

所需磁盘空间: 16.6 MB


安装Libtool

root:/sources/sed-4.1.5# tar -zxvf $LFS/sources/libtool-1.5.22.tar.gz -C $LFS/sources

root:/sources/sed-4.1.5# cd $LFS/sources/libtool-1.5.22


为编译Libtool做准备:


root:/sources/libtool-1.5.22# ./configure --prefix=/usr



编译软件包:


root:/sources/libtool-1.5.22# make


要测试结果,请运行:make check 。


安装软件包:


root:/sources/libtool-1.5.22# make install




Libtool 的内容

安装的程序: libtool, libtoolize

安装的库: libltdl.{a,so}

简要描述

libtool

提供通用的库编译支持。

libtoolize

提供了一种标准方式来将 libtool 支持加入到一个软件包中

libltdl

隐藏 dlopening 库的复杂细节









22.Perl-5.8.8

Perl 将 C, sed, awk 和 sh 的最佳特性集于一身,是一种强大的编程语言。

预计编译时间: 1.5 SBU

所需磁盘空间: 143 MB


安装Perl

root:/sources/libtool-1.5.22# mv $LFS/sources/perl-5.8.8 $LFS/sources/old2

root:/sources/libtool-1.5.22# tar -jxvf $LFS/sources/perl-5.8.8.tar.bz2 -C $LFS/sources

root:/sources/libtool-1.5.22# cd $LFS/sources/perl-5.8.8


为了运行测试套件,要先创建一个基本的 /etc/hosts 文件,好几个测试都需要它来解析 localhost 的名称:


root:/sources/perl-5.8.8# echo "127.0.0.1 localhost $(hostname)" > /etc/hosts

root:/sources/perl-5.8.8# cat /etc/hosts

127.0.0.1 localhost fish

root:/sources/perl-5.8.8#



对 Perl 的设置进行更多的控制,你可以运行交互的 Configure 脚本,精心选择编译配置。如果你能接受 Perl 的自动配置(这是很明智的),就用下面的命令:


root:/sources/perl-5.8.8# ./configure.gnu --prefix=/usr \

> -Dman1dir=/usr/share/man/man1 \

> -Dman3dir=/usr/share/man/man3 \

> -Dpager="/usr/bin/less -isR"




配置选项的含义:

-Dpager="/usr/bin/less -isR" 纠正 perldoc 代码调用 less 程序时的一个错误。 -Dman1dir=/usr/share/man/man1 -Dman3dir=/usr/share/man/man3 因为 Groff 还没有安装,Configure 会认为我们不想安装 Perl 的 man 手册。应用这个参数来改变这种情况:



编译软件包:


root:/sources/perl-5.8.8# make && date +%c (开始于2006-11-14 17:50:35)

……

……

……

chmod 755 ../../../lib/auto/threads/shared/shared.so

cp shared.bs ../../../lib/auto/threads/shared/shared.bs

chmod 644 ../../../lib/auto/threads/shared/shared.bs

make[1]: Leaving directory `/sources/perl-5.8.8/ext/threads/shared'


Making Errno (nonxs)

Writing Makefile for Errno

make[1]: Entering directory `/sources/perl-5.8.8/ext/Errno'

make[1]: Leaving directory `/sources/perl-5.8.8/ext/Errno'

make[1]: Entering directory `/sources/perl-5.8.8/ext/Errno'

../../miniperl "-I../../lib" "-I../../lib" Errno_pm.PL Errno.pm

cp Errno.pm ../../lib/Errno.pm

make[1]: Leaving directory `/sources/perl-5.8.8/ext/Errno'

make: [extras.make] Error 1 (ignored)


Everything is up to date. Type 'make test' to run test suite.

Tue Nov 14 17:57:41 2006 (结束于2006-11-14 17:57:41)

root:/sources/perl-5.8.8#



要测试结果,请运行:make test 。


安装软件包:


root:/sources/perl-5.8.8# make install




Perl 的内容

安装的程序: a2p, c2ph, dprofpp, enc2xs, find2perl, h2ph, h2xs, instmodsh, libnetcfg, perl, perl5.8.8(→perl), perlbug, perlcc, perldoc, perlivp, piconv, pl2pm, pod2html, pod2latex, pod2man, pod2text, pod2usage, podchecker, podselect, psed(→s2p), pstruct(→c2ph), s2p, splain, xsubpp

安装的库:太多了,有好几百个,无法在这里全部列出!

简要描述

a2p

把 awk 翻译成 Perl

c2ph

显示 cc -g -S 产生的 C 语言结构。

dprofpp

显示 Perl 的 profile 数据。

enc2xs

为 Encode 模块编译 Perl 扩展,用于 Unicode 字符映射或 Tcl 编码文件。

find2perl

将 find 命令翻译成 Perl 代码。

h2ph

将 .h 的C头文件转成 .ph 的perl头文件

h2xs

将 .h 的 C 头文件转成 perl 程序扩展

instmodsh

一个监测安装 Perl 模块的 Shell 脚本,甚至可以从已安装模块中创建压缩包。

libnetcfg

可以用来配置 libnet

perl

综合了 C, sed, awk, sh 特性和能力于一体的强大的编程语言

perl5.8.8

perl 的硬连接

perlbug

生成关于 perl 和相关模块的 bug 报告,并且 mail 给他们。

perlcc

从 perl 程序生成可执行文件

perldoc

显示嵌于 perl 安装目录或者一个 perl 脚本的 .pod 格式的小文档。

perlivp

Perl 安装验证过程,可以用它来验证 Perl 及其库是否安装正常。

piconv

A 是 Perl 版本的字符编码转换程序,类似于 iconv

pl2pm

将 Perl4 样式的 .pl 库文件转化为 Perl5 样式的 .pm 库模块的工具

pod2html

将 pod 格式的文件转为 html 格式

pod2latex

将 pod 格式的文件转为 LaTeX 格式

pod2man

将 pod 数据转为格式化的 *roff 输入

pod2text

将 pod 数据转为格式化的 ASCII 文本

pod2usage

打印文件内嵌的 pod 文档的使用信息

podchecker

检查 pod 格式的文档的语法

podselect

有选择的打印 pod 文档内容到标准输出

psed

是 Perl 版本的流式编辑器,类似于 sed

pstruct

显示 cc -g -S 产生的 C 语言结构

s2p

把 sed 脚本翻译成 Perl 脚本

splain

强制 Perl 输出冗余警告信息

xsubpp

把 Perl XS 代码转换成 C 代码







23.Readline-5.1

Readline 软件包是一个提供命令行编辑和历史纪录功能的库集合。

预计编译时间: 0.1 SBU

所需磁盘空间: 10.2 MB


安装Readline

root:/sources/perl-5.8.8# tar -zxvf $LFS/sources/readline-5.1.tar.gz -C $LFS/sources

root:/sources/perl-5.8.8# cd $LFS/sources/readline-5.1



上游开发者已经修正了自从 Readline-5.1 之后版本的一些问题。应用这些修正:


root:/sources/readline-5.1# patch -Np1 -i ../readline-5.1-fixes-3.patch

patching file display.c

patching file readline.c

patching file terminal.c

patching file text.c

root:/sources/readline-5.1#



重新安装 Readline 会将老的库libraryname重命名为<libraryname>.old。然而这并不是一个问题。在某些情况下它会引发ldconfig 的一个链接bug。应用下面的两个sed命令可以避免这种情况:


root:/sources/readline-5.1# sed -i '/MV.*old/d' Makefile.in

root:/sources/readline-5.1# sed -i '/{OLDSUFF}/c:' support/shlib-install



为编译Readline做准备:


root:/sources/readline-5.1# ./configure --prefix=/usr –libdir=/lib



编译软件包:


root:/sources/readline-5.1# make SHLIB_LIBS=-lncurses



make 选项的含义:

SHLIB_LIBS=-lncurses 这个选项强制 Readline 链接到 libncurses 库。

这个软件包没有附带测试程序。


安装软件包:


root:/sources/readline-5.1# make install

……

……

……

make[1]: Leaving directory `/sources/readline-5.1/doc'

/usr/bin/install -c -m 644 libreadline.a /lib/libreadline.a

test -n "ranlib" && ranlib /lib/libreadline.a

/usr/bin/install -c -m 644 libhistory.a /lib/libhistory.a

test -n "ranlib" && ranlib /lib/libhistory.a

test -d shlib || mkdir shlib

( cd shlib ; make all )

make[1]: Entering directory `/sources/readline-5.1/shlib'

make[1]: Nothing to be done for `all'.

make[1]: Leaving directory `/sources/readline-5.1/shlib'

( cd shlib ; make DESTDIR= install )

make[1]: Entering directory `/sources/readline-5.1/shlib'

/bin/sh ../support/mkdirs /lib

/bin/sh ../support/shlib-install -O linux-gnu -d /lib -b /usr/bin -i "/usr/bin/install -c -m 644" libhistory.so.5.1

/bin/sh ../support/shlib-install -O linux-gnu -d /lib -b /usr/bin -i "/usr/bin/install -c -m 644" libreadline.so.5.1

install: you may need to run ldconfig

make[1]: Leaving directory `/sources/readline-5.1/shlib'

root:/sources/readline-5.1#


给 Readline 动态库更多恰当的权限:


root:/sources/readline-5.1# chmod -v 755 /lib/lib{readline,history}.so*

mode of `/lib/libreadline.so' changed to 0755 (rwxr-xr-x)

mode of `/lib/libreadline.so.5' changed to 0755 (rwxr-xr-x)

mode of `/lib/libreadline.so.5.1' changed to 0755 (rwxr-xr-x)

mode of `/lib/libhistory.so' changed to 0755 (rwxr-xr-x)

mode of `/lib/libhistory.so.5' changed to 0755 (rwxr-xr-x)

mode of `/lib/libhistory.so.5.1' changed to 0755 (rwxr-xr-x)

root:/sources/readline-5.1#



将静态库移动到一个更合理的位置:


root:/sources/readline-5.1# mv -v /lib/lib{readline,history}.a /usr/lib

`/lib/libreadline.a' -> `/usr/lib/libreadline.a'

`/lib/libhistory.a' -> `/usr/lib/libhistory.a'

root:/sources/readline-5.1#



删除 /lib 中的 .so 文件,并将它们重新连接到 /usr/lib 中:


root:/sources/readline-5.1# rm -v /lib/lib{readline,history}.so

removed `/lib/libreadline.so'

removed `/lib/libhistory.so'

root:/sources/readline-5.1# ln -sfv ../../lib/libreadline.so.5 /usr/lib/libreadline.so

create symbolic link `/usr/lib/libreadline.so' to `../../lib/libreadline.so.5'

root:/sources/readline-5.1# ln -sfv ../../lib/libhistory.so.5 /usr/lib/libhistory.so

create symbolic link `/usr/lib/libhistory.so' to `../../lib/libhistory.so.5'

root:/sources/readline-5.1#




Readline 的内容

安装的库: libhistory.{a,so}, libreadline.{a,so}

简要描述

libhistory

提供一个统一的调用历史行的用户接口

libreadline

应用于各种需要命令行接口的应用程序的统一的用户接口的辅助程序








24.Zlib-1.2.3

Zlib 软件包包含 zlib 库,很多程序中的压缩或者解压缩程序都会用到这个库。

预计编译时间: 少于 0.1 SBU

所需磁盘空间: 3.1 MB


安装Zlib

注意

如果在环境变量中指定了 CFLAGS 的话,Zlib 就不能正常编译共享库。如果你想使用自定义的 CFLAGS 环境变量,请在下述整个 configure 命令的过程中始终把 -fPIC 指令加在 CFLAGS 的最前面,结束后还必须再撤销它。


root:/sources/readline-5.1# tar -zxvf $LFS/sources/zlib-1.2.3.tar.gz -C $LFS/sources

root:/sources/readline-5.1# cd $LFS/sources/zlib-1.2.3



为编译Zlib做准备:


root:/sources/zlib-1.2.3# ./configure --prefix=/usr --shared --libdir=/lib

Checking for gcc...

Checking for shared library support...

Building shared library libz.so.1.2.3 with gcc.

Checking for unistd.h... Yes.

Checking whether to use vs[n]printf() or s[n]printf()... using vs[n]printf()

Checking for vsnprintf() in stdio.h... Yes.

Checking for return value of vsnprintf()... Yes.

Checking for errno.h... Yes.

Checking for mmap support... Yes.

root:/sources/zlib-1.2.3#



编译软件包:


root:/sources/zlib-1.2.3# make

gcc -fPIC -O3 -DUSE_MMAP -c -o example.o example.c

gcc -fPIC -O3 -DUSE_MMAP -c -o adler32.o adler32.c

gcc -fPIC -O3 -DUSE_MMAP -c -o compress.o compress.c

gcc -fPIC -O3 -DUSE_MMAP -c -o crc32.o crc32.c

gcc -fPIC -O3 -DUSE_MMAP -c -o gzio.o gzio.c

gcc -fPIC -O3 -DUSE_MMAP -c -o uncompr.o uncompr.c

gcc -fPIC -O3 -DUSE_MMAP -c -o deflate.o deflate.c

gcc -fPIC -O3 -DUSE_MMAP -c -o trees.o trees.c

gcc -fPIC -O3 -DUSE_MMAP -c -o zutil.o zutil.c

gcc -fPIC -O3 -DUSE_MMAP -c -o inflate.o inflate.c

gcc -fPIC -O3 -DUSE_MMAP -c -o infback.o infback.c

gcc -fPIC -O3 -DUSE_MMAP -c -o inftrees.o inftrees.c

gcc -fPIC -O3 -DUSE_MMAP -c -o inffast.o inffast.c

gcc -shared -Wl,-soname,libz.so.1 -o libz.so.1.2.3 adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o zutil.o inflate.o infback.o inftrees.o inffast.o

rm -f libz.so libz.so.1

ln -s libz.so.1.2.3 libz.so

ln -s libz.so.1.2.3 libz.so.1

gcc -fPIC -O3 -DUSE_MMAP -o example example.o -L. libz.so.1.2.3

gcc -fPIC -O3 -DUSE_MMAP -c -o minigzip.o minigzip.c

gcc -fPIC -O3 -DUSE_MMAP -o minigzip minigzip.o -L. libz.so.1.2.3

root:/sources/zlib-1.2.3#


要测试结果,请运行:make check 。


安装共享库:


root:/sources/zlib-1.2.3# make install

cp zlib.h zconf.h /usr/include

chmod 644 /usr/include/zlib.h /usr/include/zconf.h

cp libz.so.1.2.3 /lib

cd /lib; chmod 755 libz.so.1.2.3

cd /lib; if test -f libz.so.1.2.3; then \

rm -f libz.so libz.so.1; \

ln -s libz.so.1.2.3 libz.so; \

ln -s libz.so.1.2.3 libz.so.1; \

(ldconfig || true) >/dev/null 2>&1; \

fi

cp zlib.3 /usr/share/man/man3

chmod 644 /usr/share/man/man3/zlib.3

root:/sources/zlib-1.2.3#



上面的命令将会在 /lib 目录下安装一个 .so 文件。我们将要移除它并重新连接到 /usr/lib 目录下:


root:/sources/zlib-1.2.3# rm -v /lib/libz.so

removed `/lib/libz.so'

root:/sources/zlib-1.2.3# ln -sfv ../../lib/libz.so.1.2.3 /usr/lib/libz.so

create symbolic link `/usr/lib/libz.so' to `../../lib/libz.so.1.2.3'

root:/sources/zlib-1.2.3#



编译静态库(非共享库):


root:/sources/zlib-1.2.3# make clean

rm -f *.o *~ example minigzip \

libz.* foo.gz so_locations \

_match.s maketree contrib/infback9/*.o

root:/sources/zlib-1.2.3# ./configure --prefix=/usr

Checking for gcc...

Building static library libz.a version 1.2.3 with gcc.

Checking for unistd.h... Yes.

Checking whether to use vs[n]printf() or s[n]printf()... using vs[n]printf()

Checking for vsnprintf() in stdio.h... Yes.

Checking for return value of vsnprintf()... Yes.

Checking for errno.h... Yes.

Checking for mmap support... Yes.

root:/sources/zlib-1.2.3# make

gcc -O3 -DUSE_MMAP -c -o example.o example.c

gcc -O3 -DUSE_MMAP -c -o adler32.o adler32.c

gcc -O3 -DUSE_MMAP -c -o compress.o compress.c

gcc -O3 -DUSE_MMAP -c -o crc32.o crc32.c

gcc -O3 -DUSE_MMAP -c -o gzio.o gzio.c

gcc -O3 -DUSE_MMAP -c -o uncompr.o uncompr.c

gcc -O3 -DUSE_MMAP -c -o deflate.o deflate.c

gcc -O3 -DUSE_MMAP -c -o trees.o trees.c

gcc -O3 -DUSE_MMAP -c -o zutil.o zutil.c

gcc -O3 -DUSE_MMAP -c -o inflate.o inflate.c

gcc -O3 -DUSE_MMAP -c -o infback.o infback.c

gcc -O3 -DUSE_MMAP -c -o inftrees.o inftrees.c

gcc -O3 -DUSE_MMAP -c -o inffast.o inffast.c

ar rc libz.a adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o zutil.o inflate.o infback.o inftrees.o inffast.o

gcc -O3 -DUSE_MMAP -o example example.o -L. libz.a

gcc -O3 -DUSE_MMAP -c -o minigzip.o minigzip.c

gcc -O3 -DUSE_MMAP -o minigzip minigzip.o -L. libz.a

root:/sources/zlib-1.2.3#



要测试静态库可以用这个命令:make check 。


安装静态库:


root:/sources/zlib-1.2.3# make install

cp zlib.h zconf.h /usr/include

chmod 644 /usr/include/zlib.h /usr/include/zconf.h

cp libz.a /usr/lib

cd /usr/lib; chmod 755 libz.a

cd /usr/lib; if test -f libz.so.1.2.3; then \

rm -f libz.so libz.so.1; \

ln -s libz.so.1.2.3 libz.so; \

ln -s libz.so.1.2.3 libz.so.1; \

(ldconfig || true) >/dev/null 2>&1; \

fi

cp zlib.3 /usr/share/man/man3

chmod 644 /usr/share/man/man3/zlib.3

root:/sources/zlib-1.2.3#



修正静态库的权限:


root:/sources/zlib-1.2.3# chmod -v 644 /usr/lib/libz.a

mode of `/usr/lib/libz.a' changed to 0644 (rw-r--r--)

root:/sources/zlib-1.2.3#



Zlib 的内容

安装的库: libz.{a,so}

简要描述

libz

包含很多程序都用到的压缩和解压函数










25.Autoconf-2.59

Autoconf 能生成用于自动配置源代码的 shell 脚本

预计编译时间: 少于 0.1 SBU

所需磁盘空间: 7.2 MB


安装Autoconf

root:/sources/zlib-1.2.3# tar -jxvf $LFS/sources/autoconf-2.59.tar.bz2 -C $LFS/sources

root:/sources/zlib-1.2.3# cd $LFS/sources/autoconf-2.59


为编译Autoconf做准备:


root:/sources/autoconf-2.59# ./configure –prefix=/usr



编译软件包:


root:/sources/autoconf-2.59# make



要测试结果,请运行:make check 。这可能要花费比较长的时间,大约 3 SUB。另外,因为要用到 Automake 的原因,跳过测试二。为了全面测试,可以在 Auotomake 安装完后重新测试。


安装软件包:


root:/sources/autoconf-2.59# make install




Autoconf 的内容

安装的程序: autoconf, autoheader, autom4te, autoreconf, autoscan, autoupdate, ifnames

简要描述

autoconf

一个产生可以自动配置源代码包,生成shell脚本的工具,以适应各种类 UNIX 系统的需要。autoconf 产生的配置脚本在运行时独立于 autoconf ,因此使用这些脚本的用户不需要安装 autoconf 。

autoheader

能够创建供 configure 脚本使用的 C #define 语句模板文件。

autom4te

一个 M4 宏处理器的包装

autoreconf

当 autoconf 和 automake 的模版文件被改变的时候,以正确的顺序自动运行 autoconf, autoheader, aclocal, span>automake, gettextize, libtoolize 以节约时间。

autoscan

为软件包创建 configure.in 文件。它以命令行参数中指定的目录为根(如果未给定参数则以当前目录为根)的目录树中检查源文件,搜索其中的可移植性问题,为那个软件包创建一个 configure.scan 文件以充当一个预备性的 configure.in 文件。

autoupdate

将 configure.in 文件中 autoconf 宏的旧名称更新为当前名称

ifnames

为一个软件包写 configure.in 文件提供帮助,它打印软件包中那些在 C 预处理器中已经使用了的标识符。如果一个包已经设置成具有某些可移植属性,这个程序能够帮助指出它的 configure 脚本应该如何检查。它可以用来填补由 configure.in 产生的 autoscan 中的隔阂。








26.Automake-1.9.6

Automake 与 Autoconf 配合使用,产生 Makefile 文件。

预计编译时间: 少于 0.1 SBU

所需磁盘空间: 7.9 MB


安装Automake

root:/sources/autoconf-2.59# tar -jxvf $LFS/sources/automake-1.9.6.tar.bz2 -C $LFS/sources

root:/sources/autoconf-2.59# cd $LFS/sources/automake-1.9.6


为编译Automake做准备:


root:/sources/automake-1.9.6# ./configure –prefix=/usr



编译软件包:


root:/sources/automake-1.9.6# make


要测试结果,请运行:make check 。 This takes a long time, about 10 SUB.


安装软件包:


root:/sources/automake-1.9.6# make install



Automake 的内容

安装的程序: acinstall, aclocal, aclocal-1.9.6, automake, automake-1.9.6, compile, config.guess, config.sub, depcomp, elisp-comp, install-sh, mdate-sh, missing, mkinstalldirs, py-compile, symlink-tree, ylwrap

简要描述

acinstall

用来安装 aclocal 风格的 M4文件的脚本

aclocal

根据 configure.in 文件的内容,自动生成 aclocal.m4 文件

aclocal-1.9.6

aclocal的硬链接

automake

根据 Makefile.am 文件的内容,自动生成 Makefile.in 文件。在目录的顶层运行该命令,可以为一个包建立所有的 Makefile.in 文件。通过扫描 configure.in 文件,它可以自动找到每一个合适的 Makefile.am 文件并且产生相应的 Makefile.in 文件。

automake-1.9.6

automake的一个硬链接

compile

包装了编译器的脚本

config.guess

用来为特定的 build, host, target 尝试猜测标准的系统名称的脚本

config.sub

配置验证子脚本

depcomp

在编译程序的同时产生其依赖信息的脚本

elisp-comp

按字节编译 Emacs Lisp 代码

install-sh

能安装程序、脚本、数据文件的脚本

mdate-sh

打印程序和目录更改时间的脚本

missing

一个用来填充在安装过程检查出的缺失的 GNU 程序空位的脚本

mkinstalldirs

产生目录树结构的脚本

py-compile

编译 Python 程序

symlink-tree

为整个目录创建符号链接的脚本

ylwrap

包装了 lex 和 yacc 的脚本








27.Bash-3.1

Bash 是 Bourne-Again Shell 的缩写,它在 UNIX 系统中作为 shell 被广泛使用。

预计编译时间: 0.4 SBU

所需磁盘空间: 25.8 MB


安装Bash

root:/sources/automake-1.9.6# mv $LFS/sources/bash-3.1 $LFS/sources/old2

root:/sources/automake-1.9.6# tar -zxvf $LFS/sources/bash-3.1.tar.gz -C $LFS/sources

root:/sources/automake-1.9.6# cd $LFS/sources/bash-3.1



如果你下载了Bash的文档包,可以通过下面的命令安装:


root:/sources/bash-3.1# tar -xvf ../bash-doc-3.1.tar.gz &&

> sed -i "s|htmldir = @htmldir@|htmldir = /usr/share/doc/bash-3.1|" \

> Makefile.in



上游开发者解决了从Bash-3.1后的一些问题:


root:/sources/bash-3.1# patch -Np1 -i ../bash-3.1-fixes-8.patch

patching file arrayfunc.c

patching file doc/bash.1

patching file doc/bashref.texi

patching file doc/version.texi

patching file jobs.c

patching file lib/glob/glob.c

patching file lib/glob/sm_loop.c

patching file lib/readline/display.c

patching file lib/readline/readline.c

patching file lib/readline/terminal.c

patching file parse.y

patching file patchlevel.h

patching file subst.c

patching file subst.h

patching file variables.c

root:/sources/bash-3.1#



为编译Bash做准备:


root:/sources/bash-3.1# ./configure --prefix=/usr --bindir=/bin \

> --without-bash-malloc –with-installed-readline



配置选项的含义:

--with-installed-readline 这个选项是告诉 Bash 使用已经安装的系统的 readline 库,而不是它自己的 readline 版本。


编译软件包:


root:/sources/bash-3.1# make

……

……

……

make[1]: Leaving directory `/sources/bash-3.1/lib/tilde'

rm -f bash

gcc -L./builtins -L/usr/lib -L/usr/lib -L./lib/glob -L./lib/tilde -L./lib/sh -rdynamic -g -O2 -o bash shell.o eval.o y.tab.o general.o make_cmd.o print_cmd.o dispose_cmd.o execute_cmd.o variables.o copy_cmd.o error.o expr.o flags.o jobs.o subst.o hashcmd.o hashlib.o mailcheck.o trap.o input.o unwind_prot.o pathexp.o sig.o test.o version.o alias.o array.o arrayfunc.o braces.o bracecomp.o bashhist.o bashline.o list.o stringlib.o locale.o findcmd.o redir.o pcomplete.o pcomplib.o syntax.o xmalloc.o -lbuiltins -lsh -lreadline -lhistory -lcurses -lglob -ltilde -ldl

ls -l bash

-rwxr-xr-x 1 root root 1440852 Nov 14 19:15 bash

size bash

text data bss dec hex filename

503123 10384 25392 538899 83913 bash

root:/sources/bash-3.1#



要测试结果,请运行:make tests 。


安装软件包:


root:/sources/bash-3.1# make install



运行新编译的 bash 程序来替换正在执行的这一个:


root:/sources/bash-3.1# exec /bin/bash --login +h

root:/sources/bash-3.1#


注意

上面命令里使用的参数指示 bash 产生一个交互式的登陆 shell 并且继续禁用哈希功能,以便新的程序一旦被安装就立即投入使用。




Bash 的内容

安装的程序: bash, bashbug, sh(→bash)

简要描述

bash

作为命令行解释器被广泛使用。它能在执行命令前解释非常复杂的命令行参数,这使它成为一个强大的工具。

bashbug

帮助用户用标准格式编写和提交有关 bash 的bug报告的脚本。

sh

指向 bash 的符号连接。当运行 sh 的时候,bash 会尽量模仿老的 sh 历史环境来运行,同时遵循 POSIX 标准。







28.Bzip2-1.0.3

Bzip2 包含了对文件进行压缩和解压缩的工具,对于文本文件,bzip2 比传统的 gzip 拥有更高压缩比。

预计编译时间: 少于 0.1 SBU

所需磁盘空间: 5.3 MB


安装Bzip2

root:/sources/bash-3.1# mv $LFS/sources/bzip2-1.0.3 $LFS/sources/old2

root:/sources/bash-3.1# tar -zxvf $LFS/sources/bzip2-1.0.3.tar.gz -C $LFS/sources

root:/sources/bash-3.1# cd $LFS/sources/bzip2-1.0.3


下面的补丁可以为这个软件包安装相应的文档:


root:/sources/bzip2-1.0.3# patch -Np1 -i ../bzip2-1.0.3-install_docs-1.patch

patching file Makefile

root:/sources/bzip2-1.0.3#


bzgrep 命令并不将传递给它的文件名中的 '|' 和 '&' 进行转义,这就会允许别有用心的用户执行任意命令。下面的补丁可以解决这个问题:


root:/sources/bzip2-1.0.3# patch -Np1 -i ../bzip2-1.0.3-bzgrep_security-1.patch

patching file bzgrep

root:/sources/bzip2-1.0.3#


bzdiff 脚本仍然会使用原来的 tempfile 程序。可以使用 mktemp 来替换:


root:/sources/bzip2-1.0.3# sed -i 's@tempfile -d /tmp -p bz@mktemp -p /tmp@' bzdiff


为编译Bzip2做准备:


root:/sources/bzip2-1.0.3# make -f Makefile-libbz2_so

gcc -fpic -fPIC -Wall -Winline -O -g -c blocksort.c

gcc -fpic -fPIC -Wall -Winline -O -g -c huffman.c

gcc -fpic -fPIC -Wall -Winline -O -g -c crctable.c

gcc -fpic -fPIC -Wall -Winline -O -g -c randtable.c

gcc -fpic -fPIC -Wall -Winline -O -g -c compress.c

gcc -fpic -fPIC -Wall -Winline -O -g -c decompress.c

gcc -fpic -fPIC -Wall -Winline -O -g -c bzlib.c

gcc -shared -Wl,-soname -Wl,libbz2.so.1.0 -o libbz2.so.1.0.3 blocksort.o huffman.o crctable.o randtable.o compress.o decompress.o bzlib.o

gcc -fpic -fPIC -Wall -Winline -O -g -o bzip2-shared bzip2.c libbz2.so.1.0.3

rm -f libbz2.so.1.0

ln -s libbz2.so.1.0.3 libbz2.so.1.0

root:/sources/bzip2-1.0.3# make clean

rm -f *.o libbz2.a bzip2 bzip2recover \

sample1.rb2 sample2.rb2 sample3.rb2 \

sample1.tst sample2.tst sample3.tst

root:/sources/bzip2-1.0.3#



make 参数的含义:

-f Makefile-libbz2_so 这会采用一个另外一个 Makefile 来编译 Bzip2,也就是这里的 Makefile-libbz2_so 文件,它创建一个动态链接库 libbz2.so ,然后把Bzip2的工具都链接到这个库上。



编译并测试软件包:


root:/sources/bzip2-1.0.3# make


If compilation produces errors, or a large number of warnings,

please read README.COMPILATION.PROBLEMS -- you might be able to

adjust the flags in this Makefile to improve matters.


gcc -Wall -Winline -O -g -D_FILE_OFFSET_BITS=64 -c blocksort.c

gcc -Wall -Winline -O -g -D_FILE_OFFSET_BITS=64 -c huffman.c

gcc -Wall -Winline -O -g -D_FILE_OFFSET_BITS=64 -c crctable.c

gcc -Wall -Winline -O -g -D_FILE_OFFSET_BITS=64 -c randtable.c

gcc -Wall -Winline -O -g -D_FILE_OFFSET_BITS=64 -c compress.c

gcc -Wall -Winline -O -g -D_FILE_OFFSET_BITS=64 -c decompress.c

gcc -Wall -Winline -O -g -D_FILE_OFFSET_BITS=64 -c bzlib.c

rm -f libbz2.a

ar cq libbz2.a blocksort.o huffman.o crctable.o randtable.o compress.o decompress.o bzlib.o

ranlib libbz2.a

gcc -Wall -Winline -O -g -D_FILE_OFFSET_BITS=64 -c bzip2.c

gcc -Wall -Winline -O -g -D_FILE_OFFSET_BITS=64 -o bzip2 bzip2.o -L. -lbz2

gcc -Wall -Winline -O -g -D_FILE_OFFSET_BITS=64 -c bzip2recover.c

gcc -Wall -Winline -O -g -D_FILE_OFFSET_BITS=64 -o bzip2recover bzip2recover.o


Doing 6 tests (3 compress, 3 uncompress) ...

If there's a problem, things might stop at this point.


./bzip2 -1 < sample1.ref > sample1.rb2

./bzip2 -2 < sample2.ref > sample2.rb2

./bzip2 -3 < sample3.ref > sample3.rb2

./bzip2 -d < sample1.bz2 > sample1.tst

./bzip2 -d < sample2.bz2 > sample2.tst

./bzip2 -ds < sample3.bz2 > sample3.tst

cmp sample1.bz2 sample1.rb2

cmp sample2.bz2 sample2.rb2

cmp sample3.bz2 sample3.rb2

cmp sample1.tst sample1.ref

cmp sample2.tst sample2.ref

cmp sample3.tst sample3.ref


If you got this far and the "cmp"s didn't complain, it looks

like you're in business.


To install in /usr/bin, /usr/lib, /usr/man and /usr/include, type

make install

To install somewhere else, eg, /xxx/yyy/{bin,lib,man,include}, type

make install PREFIX=/xxx/yyy

If you are (justifiably) paranoid and want to see what 'make install'

is going to do, you can first do

make -n install or

make -n install PREFIX=/xxx/yyy respectively.

The -n instructs make to show the commands it would execute, but

not actually execute them.


Instructions for use are in the preformatted manual page, in the file

bzip2.txt. For more detailed documentation, read the full manual.

It is available in Postscript form (manual.ps), PDF form (manual.pdf),

and HTML form (manual_toc.html).


You can also do "bzip2 --help" to see some helpful information.

"bzip2 -L" displays the software license.


root:/sources/bzip2-1.0.3#




如果重新安装Bzip2,必须首先执行 rm -vf /usr/bin/bz* ,否则下面的 make install 会出错。



安装Bzip2:


root:/sources/bzip2-1.0.3# make install

if ( test ! -d /usr/bin ) ; then mkdir -p /usr/bin ; fi

if ( test ! -d /usr/lib ) ; then mkdir -p /usr/lib ; fi

if ( test ! -d /usr/man ) ; then mkdir -p /usr/man ; fi

if ( test ! -d /usr/man/man1 ) ; then mkdir -p /usr/man/man1 ; fi

if ( test ! -d /usr/share/doc/bzip2-1.0.3 ) ; then mkdir -p /usr/share/doc/bzip2-1.0.3; fi

if ( test ! -d /usr/include ) ; then mkdir -p /usr/include ; fi

cp -f bzip2 /usr/bin/bzip2

cp -f bzip2 /usr/bin/bunzip2

cp -f bzip2 /usr/bin/bzcat

cp -f bzip2recover /usr/bin/bzip2recover

chmod a+x /usr/bin/bzip2

chmod a+x /usr/bin/bunzip2

chmod a+x /usr/bin/bzcat

chmod a+x /usr/bin/bzip2recover

cp -f bzip2.1 /usr/man/man1

chmod a+r /usr/man/man1/bzip2.1

cp -f bzlib.h /usr/include

chmod a+r /usr/include/bzlib.h

cp -f libbz2.a /usr/lib

chmod a+r /usr/lib/libbz2.a

cp -f bzgrep /usr/bin/bzgrep

ln /usr/bin/bzgrep /usr/bin/bzegrep

ln /usr/bin/bzgrep /usr/bin/bzfgrep

chmod a+x /usr/bin/bzgrep

cp -f bzmore /usr/bin/bzmore

ln /usr/bin/bzmore /usr/bin/bzless

chmod a+x /usr/bin/bzmore

cp -f bzdiff /usr/bin/bzdiff

ln /usr/bin/bzdiff /usr/bin/bzcmp

chmod a+x /usr/bin/bzdiff

cp -f bzgrep.1 bzmore.1 bzdiff.1 /usr/man/man1

chmod a+r /usr/man/man1/bzgrep.1

chmod a+r /usr/man/man1/bzmore.1

chmod a+r /usr/man/man1/bzdiff.1

echo ".so man1/bzgrep.1" > /usr/man/man1/bzegrep.1

echo ".so man1/bzgrep.1" > /usr/man/man1/bzfgrep.1

echo ".so man1/bzmore.1" > /usr/man/man1/bzless.1

echo ".so man1/bzdiff.1" > /usr/man/man1/bzcmp.1

cp -f manual.html /usr/share/doc/bzip2-1.0.3

cp -f manual.pdf /usr/share/doc/bzip2-1.0.3

cp -f manual.ps /usr/share/doc/bzip2-1.0.3

cp -f bzip2.txt /usr/share/doc/bzip2-1.0.3

chmod a+r /usr/share/doc/bzip2-1.0.3/manual.html

chmod a+r /usr/share/doc/bzip2-1.0.3/manual.pdf

chmod a+r /usr/share/doc/bzip2-1.0.3/manual.ps

chmod a+r /usr/share/doc/bzip2-1.0.3/bzip2.txt

root:/sources/bzip2-1.0.3#



把 bzip2 二进制共享库拷贝到 /bin 目录,创建必要的符号链接,再做一些清理工作:


root:/sources/bzip2-1.0.3# cp -v bzip2-shared /bin/bzip2

`bzip2-shared' -> `/bin/bzip2'

root:/sources/bzip2-1.0.3# cp -av libbz2.so* /lib

`libbz2.so.1.0' -> `/lib/libbz2.so.1.0'

`libbz2.so.1.0.3' -> `/lib/libbz2.so.1.0.3'

root:/sources/bzip2-1.0.3# ln -sv ../../lib/libbz2.so.1.0 /usr/lib/libbz2.so

create symbolic link `/usr/lib/libbz2.so' to `../../lib/libbz2.so.1.0'

root:/sources/bzip2-1.0.3# rm -v /usr/bin/{bunzip2,bzcat,bzip2}

removed `/usr/bin/bunzip2'

removed `/usr/bin/bzcat'

removed `/usr/bin/bzip2'

root:/sources/bzip2-1.0.3# ln -sv bzip2 /bin/bunzip2

create symbolic link `/bin/bunzip2' to `bzip2'

root:/sources/bzip2-1.0.3# ln -sv /bzip2 /bin/bzcat

create symbolic link `/bin/bzcat' to `/bzip2'

root:/sources/bzip2-1.0.3#




Bzip2 的内容

安装的程序: bunzip2(→bzip2), bzcat(→bzip2), bzcmp, bzdiff, bzegrep, bzfgrep, bzgrep, bzip2, bzip2recover, bzless, bzmore

安装的库: libbz2.{a,so}

简要描述

bunzip2

解压使用 bzip2 压缩的文件

bzcat

解压缩指定的文件到标准输出

bzcmp

对 bzip2 压缩的文件运行 cmp 命令

bzdiff

对 bzip2 压缩的文件运行 diff 命令

bzgrep

对 bzip2 压缩的文件运行 grep 命令

bzegrep

对 bzip2 压缩的文件运行 egrep 命令

bzfgrep

对 bzip2 压缩的文件运行 fgrep 命令

bzip2

使用 Burrows-Wheeler 块排列文本压缩算法和霍夫曼编码来压缩文件。压缩比要大于 gzip 工具使用的基于"Lempel-Ziv"的压缩算法(如 gzip 格式),接近 PPM 统计压缩算法族的压缩比。

bzip2recover

试图从被破坏的 bzip2 文件中恢复数据

bzless

对 bzip2 压缩的文件运行 less 命令

bzmore

对 bzip2 压缩的文件运行 more 命令

libbz2*

利用 Burrows-Wheeler 算法,实现无损块顺序数据压缩的库文件。







29.Diffutils-2.8.1

Diffutils 软件包里的程序向你显示两个文件或目录的差异,常用来生成软件的补丁。

预计编译时间: 0.1 SBU

所需磁盘空间: 6.3 MB


安装Diffutils

root:/sources/bzip2-1.0.3# mv $LFS/sources/diffutils-2.8.1 $LFS/sources/old2

root:/sources/bzip2-1.0.3# tar -zxvf $LFS/sources/diffutils-2.8.1.tar.gz -C $LFS/sources

root:/sources/bzip2-1.0.3# cd $LFS/sources/diffutils-2.8.1



POSIX 要求 diff 命令能够根据当前的locale处理 whitespace(空白符)。 下面的patch可以解决这个问题:


root:/sources/diffutils-2.8.1# patch -Np1 -i ../diffutils-2.8.1-i18n-1.patch

patching file src/diff.c

Hunk #1 succeeded at 273 (offset -2 lines).

patching file src/diff.h

Hunk #1 succeeded at 25 with fuzz 2 (offset 2 lines).

Hunk #2 succeeded at 360 (offset -3 lines).

patching file src/io.c

Hunk #1 succeeded at 25 (offset -1 lines).

Hunk #3 succeeded at 261 (offset -1 lines).

patching file src/side.c

Hunk #1 succeeded at 74 with fuzz 1 (offset 1 line).

patching file src/util.c

Hunk #1 succeeded at 312 (offset -9 lines).

root:/sources/diffutils-2.8.1#



上面的这个patch将会导致用一个无效的程序help2man来重新编译 diff.1 man 帮助。结果导致 diff 的 man 不可读。我们可以通过改变 man/diff.1 的时间戳来避免这个问题:


root:/sources/diffutils-2.8.1# touch man/diff.1


为编译Diffutils做准备:


root:/sources/diffutils-2.8.1# ./configure --prefix=/usr



编译软件包:


root:/sources/diffutils-2.8.1# make


这个软件包没有附带测试程序。


安装软件包:


root:/sources/diffutils-2.8.1# make install



Diffutils 的内容

安装的程序: cmp, diff, diff3, sdiff

简要描述

cmp

比较两个文件,并指出它们是否不同及不同的字节。

diff

比较两个文件或目录,并指出哪些文件的哪些行不同。

diff3

逐行比较三个文件

sdiff

合并两个文件,并以交互方式输出结果










相关阅读 更多 +
排行榜 更多 +
激萌手账

激萌手账

游戏工具 下载
躺平不要慌

躺平不要慌

音乐节奏 下载
嗨自拍修图

嗨自拍修图

图像拍照 下载