分页: 1 / 1

apt-get -b source XXX 从源码编译疑问?

发表于 : 2012-05-18 13:20
pmshou
http://www.debian.org/doc/manuals/apt-h ... zh-cn.html

可以用这个命令安装信赖,例如:

代码: 全选

sudo apt-get build-dep vsftpd
疑问1:如何在编译后,在没记住这些信赖包名称的情况下卸载这些信赖?

可以用这个命令编译生成DEB,例如:

代码: 全选

apt-get -b source vsftpd
疑问2:我想修改这个包的编译选项,如何做到?

Re: apt-get -b source XXX 从源码编译疑问?

发表于 : 2012-05-18 19:54
pmshou
pmshou 写了: 疑问1:如何在编译后,在没记住这些信赖包名称的情况下卸载这些信赖?
这个问题可以查看相应软件下面的*.dsc文件,里面记录了信赖情况。
Standards-Version: 3.9.2
Build-Depends: debhelper (>= 8), libcap2-dev [linux-any], libpam0g-dev, libssl-dev, libwrap0-dev, dh-apport
这样就知道应该删除哪些包了。

但我没有找到如何使用build-dep来卸载信赖。

Re: apt-get -b source XXX 从源码编译疑问?

发表于 : 2012-05-18 19:56
枫叶饭团
从来没用过apt-get的源码安装

Re: apt-get -b source XXX 从源码编译疑问?

发表于 : 2012-05-18 22:25
pmshou
About issue 1:
You can use:

代码: 全选

apt-cache showsrc XXX
to get the depends.

And find two solution for undo build-dep, like below:

代码: 全选

sudo aptitude markauto $(apt-cache showsrc vsftpd | grep Build-Depends | perl -p -e 's/(?:[\[(].+?[\])]|Build-Depends:|,|\|)//g')
or:

代码: 全选

sudo aptitude markauto $(apt-cache showsrc vsftpd | sed -e '/Build-Depends/!d;s/Build-Depends: \|,\|([^)]*),\|\[[^]]*\]//g')
Sorry for now, the Chinese Method not works for me. :em09

Re: apt-get -b source XXX 从源码编译疑问?

发表于 : 2012-05-18 22:44
pmshou
Issue 1:
Put this function into .bashrc

代码: 全选

function aptitude-remove-dep() {
    sudo aptitude markauto $(apt-cache showsrc "$1" | sed -e '/Build-Depends/!d;s/Build-Depends: \|,\|([^)]*),\|\[[^]]*\]//g');
}
Then as you wish.
loaden@qpsoft:~$ aptitude-remove-dep vsftpd
[sudo] password for loaden:
下列软件包将被“删除”:
dh-apport{u} libpam0g-dev{u} libssl-dev{u} libwrap0-dev{u}
0 个软件包被升级,新安装 0 个, 4 个将被删除, 同时 0 个将不升级。
需要获取 0 B 的存档。 解包后将释放 6,845 kB。
您要继续吗?[Y/n/?]
(正在读取数据库 ... 系统当前共安装有 240275 个文件和目录。)
正在卸载 dh-apport ...
正在卸载 libpam0g-dev ...
正在卸载 libssl-dev ...
正在卸载 libwrap0-dev ...
正在处理用于 man-db 的触发器...

Re: apt-get -b source XXX 从源码编译疑问?

发表于 : 2012-07-08 22:41
pmshou
http://www.cyberciti.biz/faq/rebuilding ... y-package/
Q. I'd like to rebuild a Debian / Ubuntu package called foo with additional option. How do I recompile .deb packages?

A. To build a Debian package, you need the following packages / software installed on system
[a] fakeroot : fakeroot package - runs a command in an environment wherein it appears to have root privileges for file manipulation. This is useful for allowing users to create archives (tar, ar, .deb etc.) with files in them with root permissions/ownership.

dpkg-dev : package building tools for Debian

[c] Development environment - You need gcc, make and all other compiler collection installed on system. Under Debian / Ubuntu package build-essential takes care of everything.
Step #1: Install required packages

Type the following command
$ sudo apt-get install build-essential fakeroot dpkg-dev
Step #2: Install source code package

First, create a directory to store source package, enter:
$ mkdir build
$ cd build
Use apt-get command to install source code for a package called foo
$ sudo apt-get source foo
Install all build-dependencies, enter:
$ sudo apt-get build-dep foo
Unpacks Debian / Ubuntu source archives with Debian source package (.dsc) manipulation tool, enter:
$ dpkg-source -x foo_version-revision.dsc
To just compile the package, you need cd into foo-version directory and issue the command
$ dpkg-buildpackage -rfakeroot -b
If you want to pass custom additonal options to configure, you can set up the DEB_BUILD_OPTIONS environment variable. For instance, if you want pass option called --enable-radio --enable-gui, enter:
$ DEB_BUILD_OPTIONS="--enable-gui --enable-radio" fakeroot debian/rules binary
You can also pass some variables to the Makefile. For example, if you want to compile with gcc v3.4, enter:
$ CC=gcc-3.4 DEB_BUILD_OPTIONS="--enable-gui --enable-radio" fakeroot debian/rules binary
A complete example - mplayer

Let us see how to rebuild mplayer media player package with --enable-radio --disable-ivt options:
# sudo apt-get source mplayer
# sudo apt-get build-dep mplayer
# dpkg-source -x mplayer_version-revision.dsc
# DEB_BUILD_OPTIONS="--enable-gui --enable-radio --disable-ivt" fakeroot debian/rules binary
Now wait for some time as compile procedure going to take its own time. To install the newly-built package, enter:
# dpkg -i ../mplayer_version-revision_arch.deb
Further readings:

Debian Binary Package Building HOWTO
Debian New Maintainers' Guide
Man pages - dpkg-source, apt-get, dpkg, dpkg-buildpackage, fakeroot

Re: apt-get -b source XXX 从源码编译疑问?

发表于 : 2012-07-09 8:49
YeLee
貌似很深奥的样子。 :em11