关于 apt-build 的一点讨论
时间:2006-07-25
来源:互联网
首先由于 apt 包管理机制过于复杂的依赖关系,所以 apt-build 并不是很完善,特别对于 apt-build world 这样高难度动作,很难实现。以下是我的一点实践:
1. /etc/apt/apt-build.conf
build-dir = /var/cache/apt-build/build repository-dir = /var/cache/apt-build/repository Olevel = -O2 mtune = -mtune=pentium-m options = " " make_options = " "
以下引用作者之一 Julien Reveret 的解释:
http://julien.danjou.info/article-apt-build.html
Now, Gentoo fans will ask me "what about flags ?" ; sorry for us, but there are not. By flags, Gentoo users mean libraries with which software are linked to. Here, it is out of the question for a simple user to change package dependancies. Indeed, if you do this, you could make mistakes that don't exist with the original package. No need to fill a bug report in this case, you are not using the official Debian package anymore, but yours. |
有人会写一大堆 flags 放在 options 里,然后在加上 march 之类的,统统不管用,因为源代码里就定义了上面列出来的参数,而且每个参数一个值。这个不知是否算是 bug, 还是作者有意这么做。
2.屏幕输出和配置文件不符
我想这里是很多人最最疑惑的地方,难道 apt-build 根本就没有实现它的承诺么?
其实不然。屏幕输出的是 make 调用的命令,而背后包装过的 gcc (/var/lib/apt-build)使用的是你的配置:
作者的解答:
http://bugs.donarmstrong.com/cgi-bin...cgi?bug=332959
From README.Debian: Q: gcc and g++ do not seem to be called with good options! A: *** They are called with them! *** What you see on your screen is the command called by make, but the wrapper wraps (yeah, it does) calls to gcc/g++ and adds options you specified in the apt-build configuration file. You won't see this on your screen. Try `ps ax | grep gcc' instead as a proof, while building. |
$ ps ax | grep gcc
真相大白。
3. 使用中的一些好玩的地方:
有关 -march 和 -mtune, 照 gcc docs 中的说法:
http://gcc.gnu.org/onlinedocs/gcc-4....002d64-Options
-mtune=cpu-type Tune to cpu-type everything applicable about the generated code, except for the ABI and the set of available instructions. ...... While picking a specific cpu-type will schedule things appropriately for that particular chip, the compiler will not generate any code that does not run on the i386 without the -march=cpu-type option being used. -march=cpu-type Generate instructions for the machine type cpu-type. The choices for cpu-type are the same as for -mtune. Moreover, specifying -march=cpu-type implies -mtune=cpu-type. -mcpu=cpu-type A deprecated synonym for -mtune. |
故我修改 apt-build.conf,如下:
build-dir = /var/cache/apt-build/build repository-dir = /var/cache/apt-build/repository Olevel = -O2 mtune = -march=pentium-m options = " " make_options = " "
有关 -march , -mtune 其它讨论:
http://linuxfromscratch.org/pipermai...ay/003435.html
http://gentoo-wiki.com/Safe_Cflags
还有更好玩的,其实作者只是简单定义了几个变量,你可以随意修改,比如:
build-dir = /var/cache/apt-build/build repository-dir = /var/cache/apt-build/repository Olevel = -msse2 mtune = -mtune=pentium-m options = "-mfpmath=sse" make_options = " "
说实话,apt-build 并不复杂,用 C 和 perl 写成,主要借助 apt 来解决依赖关系和自身的主要功能,如果要添加大量的所谓优化参数,可以手工修改一下它的分析参数代码,并不难。
$ apt-get source apt-build
我并不是非常赞成过度优化,对于桌面应用如 firefox 之类的,很多都是 I/O bound 的东西,而非 cpu bound, 性能上是否有提高,能提高多少,估计没几个人能说的清,很多都是一些感觉或某些网站的测评。
有兴趣的又有时间可以玩玩如何 port 或 emerge debian
作者: quanliking 发布时间: 2006-07-25
# sudo apt-build world
这两句说是可以优化编译系统所有安装了的包,自己从来也没尝试过
作者: realtang 发布时间: 2006-07-26
作者: quanliking 发布时间: 2006-07-26
./configure --prefix=/usr --libexecdir=/usr/lib --enable-shared --.... 之类?
作者: d00m3d 发布时间: 2006-07-26
作者: 超级用户 发布时间: 2006-07-26
作者: d00m3d 发布时间: 2006-07-26
作者: quanliking 发布时间: 2006-07-26
fedora.cn 现在用的编译工具是ybuild,是一个配合rpm/yum的类ports工具,看来现在谁都对借鉴gentoo的ports设计感兴趣阿。
作者: hellwolf 发布时间: 2006-07-26
作者: quanliking
configure apt-build 干不了,主要用途就是给你加上几个优化参数,如 -O3 之类的,最后是调用 dpkg-buildpackage -us -uc,而且你改 configure,相当于给维护者的包动了手术,不能保证依赖关系,可能会出问题,我想这个你只能手工来做了!
|
唉~~偶的如意算盘还是打不响了~~
Debian 始终是 Debian,LFS 还是 LFS,未能齐於一起!
作者: d00m3d 发布时间: 2006-07-27
作者: d00m3d 发布时间: 2006-07-27
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28