如何让dpkg-buildpackage在运行configure后停止?

介绍

我有一个源代码包(使用apt source ...下载的),我想在代码编辑器中使用rtags来探索它。 通常的做法是通过运行构建系统生成的makefile,将其传递给rtags进行试运行,以便它可以使用这些命令来(重新)构建上下文源代码导航和自动完成数据库。

问题

通常情况下,我只需使用autogen/autoconf/configure来获取一个makefile,然后使用make -nk进行构建的试运行。

然而,由于我正在使用Debian软件包,我需要使用Debian特定的配置命令dpkg-buildpackagedpkg-source,以便源代码导航反映出与官方构建中使用的相同的构建选项。

我查看了buildpackage的man页面,但找不到任何选项可以在执行./configure步骤之后,在执行任何实际构建命令之前停止构建。虽然它确实有--build=source(-S)选项,但它并不是我想要的:它应用了Ubuntu特定的补丁,然后在运行automake/configure之前停止。这是不可接受的,因为我也希望执行automake/configure步骤。
问题:
如何使dpkg-buildpackage在运行autogen/automake/configure之后但在运行make之前停止?
建议的方法对于dnsutils源代码包应该有效。
1个回答

如果你查看dpkg-buildpackage的手册,你会发现它没有区分configure步骤和make步骤 - 在它看来,只有build步骤和binary步骤。虽然./configure; make; make install是非常常见的,但它并不被dpkg-buildpackage视为唯一真正的构建方法;它留给debian/rules根据需要调用适当的操作。

对于dnsutils,或者更确切地说,binddebian/rules似乎非常手动化(尽管它调用了许多debhelper实用程序,但它并不依赖于debhelper的自动化)。因此,在这里,最简单的方法是利用debian/rules中的目标:

$ debian/rules stamps/configure
dh_testdir
if [ ! -d autoreconf-bck ]; then \
    mkdir autoreconf-bck; \
    cp -pr config.h.in configure libtool.m4 ltmain.sh autoreconf-bck; \
fi
cp -r bin/named bin/named-pkcs11
cp -r bin/dnssec bin/dnssec-pkcs11
cp -r lib/isc lib/isc-pkcs11
cp -r lib/dns lib/dns-pkcs11
patch -p1 < debian/patches/extra-add_native_pkcs11.diff
patching file bin/dnssec-pkcs11/Makefile.in
patching file bin/named-pkcs11/Makefile.in
...
========================================================================
Configuration summary:
------------------------------------------------------------------------
Optional features enabled:
    Multiprocessing support (--enable-threads)
    GeoIP access control (--with-geoip)
    GSS-API (--with-gssapi)
    Native PKCS#11/Cryptoki support (--enable-native-pkcs11)
        Provider library: ${prefix}/lib/x86_64-linux-gnu/softhsm/libsofthsm2.so
    GOST algorithm support (encoding: raw) (--with-gost)
    ECDSA algorithm support (--with-ecdsa)
    AAAA filtering (--enable-filter-aaaa)
    Print backtrace on crash (--enable-backtrace)
    Use symbol table for backtrace, named only (--enable-symtable)
    Use GNU libtool (--with-libtool)
    Dynamically loadable zone (DLZ) drivers:
        None

Features disabled or unavailable on this platform:
    Large-system tuning (--with-tuning)
    Recursive fetch limits for DoS attack mitigation (--enable-fetchlimit)
    Source Identity Token support (--enable-sit)
    Allow 'fixed' rrset-order (--enable-fixed-rrset)
    OpenSSL cryptography/DNSSEC (--with-openssl)
    Use libseccomp system call filtering (--enable-seccomp)
    Very verbose query trace logging (--enable-querytrace)
    Automated Testing Framework (--with-atf)
    JSON statistics (--with-libjson)

Unrecognized options:
    --enable-rrl
========================================================================
touch stamps/configure

如果使用debhelper的dh_auto_configure,另一种方法是在debian/rules中重写dh_auto_configure,在构建过程之后使其失败。
一般来说,dpkg-buildpackage 对于configure一无所知,因此无法在那里停止。