如果源码包里包含多个deb包,如何只构建我想要的?

最大的社区版本,Ubuntu的发源地
回复
科学之子
帖子: 2284
注册时间: 2013-05-26 6:58
系统: Debian 9

如果源码包里包含多个deb包,如何只构建我想要的?

#1

帖子 科学之子 » 2016-08-19 8:58

如果源码包里包含多个deb包,如何只构建我想要的?
比如"apt-get source ntpdate",下载下来一堆的ntp相关程序的源码
但我只想构建一个ntpdate包,如何操作?
我进行了简单的搜索,找到的都是一样的方法
onlylove
论坛版主
帖子: 5229
注册时间: 2007-01-14 16:23

Re: 如果源码包里包含多个deb包,如何只构建我想要的?

#2

帖子 onlylove » 2016-08-19 10:05

你终于构建了你想要的包,然后你发现装上后并不能用,需要把其他你觉得不需要的包一起装上才能用
#include <stdio.h>
void main()
{
double world;
unsigned letter;
short stay;
long memories;
printf("I miss you.\n");
}
科学之子
帖子: 2284
注册时间: 2013-05-26 6:58
系统: Debian 9

Re: 如果源码包里包含多个deb包,如何只构建我想要的?

#3

帖子 科学之子 » 2016-08-19 11:36

onlylove 写了:你终于构建了你想要的包,然后你发现装上后并不能用,需要把其他你觉得不需要的包一起装上才能用
貌似能用
其实我构建的原因是为了调试一个看起来几乎不可能的Bug
代码逻辑上怎么看也看不出来,于是想加上调试代码编译运行一下看看到底发生了什么
到现在还没看出来...
(稍后会发帖提问,这个帖子只讨论如何构建包吧)
头像
vickycq
帖子: 4507
注册时间: 2011-03-20 13:12
系统: Debian
来自: 山东省寿光县
联系:

Re: 如果源码包里包含多个deb包,如何只构建我想要的?

#4

帖子 vickycq » 2016-08-19 13:03

对于 ntp (ntp, ntpdate, ntp-doc) 可修改 debian/rules 将不需要的过程去掉
例如只需要 ntpdate,可做类似如下修改
binary-indep 中最后一行改为 dh_builddeb --no-act (不要 ntp-doc)
binary-arch 中最后一行改为 dh_builddeb -pntpdate (只要 ntpdate)
其余按情况修改

实际意义不大,对于 ntp,所有内容都是一次编译构建的,只干预分包省不了多少时间。千山万水都过来了,还差最后一段羊肠小道么。
对于较复杂的包,倒是可以设法将不需要的编译过程去掉。

debhelper 参数 -i/-a, -p, -N, --no-act 参考
http://manpages.ubuntu.com/manpages/tru ... per.7.html
Debian 中文论坛 - forums.debiancn.org
欢迎所有 Debian GNU/Linux 用户
科学之子
帖子: 2284
注册时间: 2013-05-26 6:58
系统: Debian 9

Re: 如果源码包里包含多个deb包,如何只构建我想要的?

#5

帖子 科学之子 » 2016-08-19 13:15

vickycq 写了:对于 ntp (ntp, ntpdate, ntp-doc) 可修改 debian/rules 将不需要的过程去掉
例如只需要 ntpdate,可做类似如下修改
binary-indep 中最后一行改为 dh_builddeb --no-act (不要 ntp-doc)
binary-arch 中最后一行改为 dh_builddeb -pntpdate (只要 ntpdate)
其余按情况修改

实际意义不大,对于 ntp,所有内容都是一次编译构建的,只干预分包省不了多少时间。千山万水都过来了,还差最后一段羊肠小道么。
对于较复杂的包,倒是可以设法将不需要的编译过程去掉。

debhelper 参数 -i/-a, -p, -N, --no-act 参考
http://manpages.ubuntu.com/manpages/tru ... per.7.html
对于 ntp,所有内容都是一次编译构建的
如何确定的?
难道没办法干预编译吗?
头像
vickycq
帖子: 4507
注册时间: 2011-03-20 13:12
系统: Debian
来自: 山东省寿光县
联系:

Re: 如果源码包里包含多个deb包,如何只构建我想要的?

#6

帖子 vickycq » 2016-08-19 13:23

科学之子 写了:如何确定的?难道没办法干预编译吗?
看上去是这样的,见下文代码 debian/rules
第一步 config.status,即 ./configure
第二步 $(MAKE) 即 make
没找到分开编译的迹象。

debian 分包分得细,一个包拆成三个(ntp, ntpdate, ntp-doc)。像 archlinux 这样的完全不拆,就一个。
https://www.archlinux.org/packages/extra/x86_64/ntp/

代码: 全选

config.status:
	dh_testdir
ifeq (hurd, $(DEB_HOST_ARCH_OS))
	# hurd does not provided the system calls needed for ntpd to work.
	exit 1
endif
	dh_autoreconf
	./configure CFLAGS='$(CFLAGS)' CPPFLAGS='$(CPPFLAGS)' LDFLAGS='$(LDFLAGS)' \
		--build=$(DEB_BUILD_GNU_TYPE) \
		--host=$(DEB_HOST_GNU_TYPE) \
		--prefix=/usr \
		--enable-all-clocks --enable-parse-clocks --enable-SHM \
		--disable-debugging --sysconfdir=/var/lib/ntp \
		--with-sntp=no \
		--with-lineeditlibs=edit \
		--without-ntpsnmpd \
		--disable-local-libopts \
		--enable-ntp-signd \
		--disable-dependency-tracking \
		--with-openssl-libdir=/usr/lib/$(DEB_HOST_MULTIARCH)

build: build-arch build-indep
build-arch: build-stamp
build-indep: build-stamp
build-stamp: config.status
	dh_testdir
	$(MAKE)
	touch $@
Debian 中文论坛 - forums.debiancn.org
欢迎所有 Debian GNU/Linux 用户
回复