debuild—是否可以通过debuild编译一个Makefile来构建多个debian包

debuild—是否可以通过debuild编译一个Makefile来构建多个debian包,debian,dpkg,dpkg-buildpackage,Debian,Dpkg,Dpkg Buildpackage,我使用Debild创建debian包 In file "debian/control" is described two packages: Package: app1 Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} Description: Tool1. Package: app2 Architecture: any Depends: ${shlibs:Depends}, ${misc:Depen

我使用Debild创建debian包

In file "debian/control" is described two packages:
Package: app1
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: Tool1.

Package: app2
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: Tool2.
它们都应该包含由一个makefile编译的相同二进制文件,但使用不同的环境变量

我的规则文件调用两个编译:

%:
    TARGET=S_SS dh $@ -papp1
    TARGET=S_TT dh $@ -papp2
下一步是去ILD阶段的结果流程:

dh clean -papp1
dh clean -papp2
dh build -papp1
dh build -papp2
dh binary -papp1
dh binary -papp2
看起来数据包是并行创建的。最后,二进制文件被第二次构建覆盖

是否可以先在app1中创建规则文件,然后再在app2中创建规则文件:

dh clean -papp1
dh build -papp1
dh binary -papp1
dh clean -papp2
dh build -papp2
dh binary -papp2
回答您的问题:不,不可能更改包构建的基本顺序

dh sequencer将分阶段运行构建过程,例如(非常简化)

  • 干净的
  • 建造
  • 包装
在您当前的设置中,“构建”阶段将运行两个构建(针对您的两种风格),一旦两个构建完成,它将进入下一个阶段,将所有工件打包到deb中

现在,不幸的是,您的第二个版本将覆盖您的第一个版本(或者,它将检测到它已经有了二进制文件(不考虑更改的环境变量),并且根本不会重新构建)。 这主要是上游源的构建系统(即:您的构建系统)的问题,而不是Debian软件包工具集的问题

为了正确构建软件包的多种风格,构建系统应该(真正)支持树外构建,在树外构建中,您可以在subdir1/中为一种风格构建所有二进制文件,在subdir2/中为另一种风格构建所有二进制文件,因此这两种构建不会相互干扰

然后,您需要(手动!)指示
dh
使用适当的标志调用您的构建系统,以使用这些子目录(显然是不同的配置)

可以找到Debian软件包(免责声明:由我自己维护)的一个真实示例,该软件包使用
dh
从相同来源构建多种口味

上游构建系统使用
自动工具
(本机支持树外构建),并且通过不同的配置标志区分不同的风格

要点如下:

#!/usr/bin/make -f
builddir=debian/build/flavor-
FLAVOURS = foo bar
CONFIG_foo = --some-flag
CONFIG_bar = --some-other-flag

%:
        dh $@

# this target depends on 'configure_foo' and 'configure_bar'
override_dh_auto_configure: $(patsubst %,configure_%,$(FLAVORS))
# 'configure_%' is expanded to 'configure_foo' and 'configure_bar'
# the '$*' is replaced with the '%' component of the target ('foo', 'bar')
# so there are different builddirs ('debian/build/flavor-foo', 'debian/build/flavor-bar')
# and we call `configure`-script (relative to the builddir) with the appropriate flag
configure_%:
        mkdir -p $(builddir)$*
        cd $(builddir)$* && ../../../configure $(CONFIG_$*)

# same for the build-stage; this is simpler as we only need to run 'make' in the
# various builddirs
override_dh_auto_build: $(patsubst %,build_%,$(FLAVORS))
build_%:
    dh_auto_build --sourcedirectory=$(builddir)$*

据我所知,$@是调度程序,这就是为什么以非预期的方式调用stages。如何调用编译而不进行调度?下一次调用失败,因为它预期阶段应该在参数中。目标=S_SS dh-papp1;目标=S_TT dh-papp2;