LFS 学习日记(第六章安装基本系统软件之 Zlib 至 Gmp 安装 )

注:这篇日记及后面日记的内容均在 Eee PC 900HA 的 Ubuntu 10.04 宿主机上的 Vmware Ubuntu 10.04 客户机上运行, SBU 数据为在此平台下的数据。而不是前面的 E7400 的 Windows XP 宿主机上的 Vmware Ubuntu 10.04 客户机。

2010年07月14日 星期三
http://www.linuxfromscratch.org/lfs/view/6.6/chapter06/zlib.html
6.11. Zlib-1.2.3

todo:
CFLAGS 值 -fPIC 的用处

question:
./configure --prefix=/usr --shared --libdir=/lib 为什么告诉了安装在 /usr 下,而库文件却安装在 /lib 下?

{ ./configure && make && make install; } 和 { ./configure; make; make install; } 的区别是前者如果一个命令执行出现错误就会中止不再执行后面的命令,后者每个命令都要顺序执行一遍。

 question: 为什么上面 install; 后面必须加分号? 是不是没有分号就表示命令没有结束?

参考资料: abs-guide/special-chars.html
{}

    Block of code [curly brackets]. Also referred to as an inline group, this construct, in effect, creates an anonymous function (a function without a name). However, unlike in a "standard" function, the variables inside a code block remain visible to the remainder of the script.

但是这里 If SBU measure include test time? http://linuxfromscratch.org/pipermail/lfs-support/2010-June/039088.html Bruce 给出的脚本{}里面的代码命令间只用换行符分隔,而且末尾并没有分号,但是执行却没出错,是怎么一回事呢?脚本片断如下:
{ time \
   {
     echo Making $TITLE
     date

     ./configure --prefix=/usr &&
     make &&
     make DESTDIR=$DEST install

   }
} 2>&1 | tee -a $LOG

2010年08月18日 星期三
(2010年08月18日)这后面的 SBU 数据均是在 eeepc 900ha 上的 ubuntu 10.04 vmware虚拟机里执行。
time { ./configure --prefix=/usr --shared --libdir=/lib && make; } 2>&1 | tee /backup/installlogs/6zlib.dyn.make.log
real    0m14.044s
user    0m16.645s
sys    0m7.348s

time { make check; } 2>&1 | tee /backup/installlogs/6zlib.dyn.check.log
real    0m0.157s
user    0m0.044s
sys    0m0.164s

time { make install; } 2>&1 | tee /backup/installlogs/6zlib.dyn.install.log
real    0m0.703s
user    0m0.072s
sys    0m0.460s

rm -v /lib/libz.so && ln -sfv ../../lib/libz.so.1.2.3 /usr/lib/libz.so

time { make clean && ./configure --prefix=/usr && make; } 2>&1 | tee /backup/installlogs/6zlib.static.make.log
real    0m12.733s
user    0m17.297s
sys    0m5.384s

time { make check; } 2>&1 | tee /backup/installlogs/6zlib.static.check.log
real    0m0.157s
user    0m0.024s
sys    0m0.168s

time { make install; } 2>&1 | tee /backup/installlogs/6zlib.static.install.log
real    0m0.336s
user    0m0.048s
sys    0m0.316s

chmod -v 644 /usr/lib/libz.a

2010年07月15日 星期四
http://www.linuxfromscratch.org/lfs/view/6.6/chapter06/binutils.html
6.12. Binutils-2.20

todo:
expect -c "spawn ls" 的理解

sed -i.bak '/^INFO/s/standards.info //' etc/Makefile.in
       -i[SUFFIX], --in-place[=SUFFIX]
              edit files in place (makes backup if extension supplied)

question:
$(exec_prefix)/$(target_alias)  would be used if the system was used to cross-compile
为什么?是怎样用于交叉编译的?

在 Makefile 中的 tooldir  值是定了的,是 tooldir = ${exec_prefix}/i686-pc-linux-gnu 。但是,在 "make" 和 "make install" 命令中均指定了 “tooldir=/usr” ,此值传入 Makefile 脚本中覆盖了原来的值,所以实际的 tooldir=/usr 。

2010年08月18日 星期三
time { ../binutils-2.20/configure --prefix=/usr \
    --enable-shared && make tooldir=/usr; } 2>&1 | tee /backup/installlogs/6binutils.make.log
real    11m38.635s
user    11m7.238s
sys    10m12.486s

time { make check; } 2>&1 | tee /backup/installlogs/6binutils.check.log
real    17m24.892s
user    4m22.568s
sys    18m30.157s

time { make tooldir=/usr install; } 2>&1 | tee /backup/installlogs/6binutils.install.log
real    0m40.097s
user    0m11.549s
sys    0m44.659s

http://www.linuxfromscratch.org/lfs/view/6.6/chapter06/gmp.html
6.13. GMP-5.0.0

awk '/tests passed/{total+=$2} ; END{print total}' gmp-check-log #查找符合 tests passed 的行,找到后把此行的第2个字段(FS  The input field separator, a space by default. )累加,在最后( Similarly, all the  END blocks are merged, and executed when all the input is exhausted (or when  an exit statement is executed))打印出累加的总和。

todo: 需要时学习 awk 的基本使用。

2010年08月18日 星期三
time { ./configure --prefix=/usr --enable-cxx --enable-mpbsd && make; } 2>&1 | tee /backup/installlogs/6gmp.make.log
real    25m22.948s
user    10m13.170s
sys    28m21.522s

time { make check; } 2>&1 | tee /backup/installlogs/6gmp.check.log
real    16m13.802s
user    10m5.466s
sys    13m2.237s

time { make install; } 2>&1 | tee /backup/installlogs/6gmp.install.log
real    0m15.515s
user    0m3.568s
sys    0m13.569s