Source: clamav
Version: 1.4.1+dfsg-1
Tags: patch
User: debian-cr...@lists.debian.org
Usertags: bdsat
X-Debbugs-Cc: kanash...@debian.org

Hi,

I noticed that clamav fails to cross build from source since about two
years due to more Build-Depends. Unfortunately, building
clamav-testfiles depends on enabling unit tests. Thus I propose to
disable testing in arch-only builds with DEB_BUILD_OPTIONS=nocheck but
leave testing enabled in all other build configurations (in particular
in all buildd builds). The changed configuration is precisely the one
relevant to cross building. I verified that this change does not incur
changes to output artifacts by comparing modified builds with original
builds using diffoscope. I'm attaching the resulting patch for your
convenience. Note that it does not yet make clamav cross buildable. All
it does is get us significantly closer to actually satisfying
Build-Depends. What needs to happen next likely is annotating a couple
of Build-Depends with :native and then figure out how to avoid running
cmake/CheckSignedRightShift.cmake. That said, please close this bug when
addressing the test dependencies.

Helmut
diff --minimal -Nru clamav-1.4.1+dfsg/debian/changelog 
clamav-1.4.1+dfsg/debian/changelog
--- clamav-1.4.1+dfsg/debian/changelog  2024-10-03 10:51:50.000000000 +0200
+++ clamav-1.4.1+dfsg/debian/changelog  2024-12-04 08:26:22.000000000 +0100
@@ -1,3 +1,13 @@
+clamav (1.4.1+dfsg-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Improve cross building: (Closes: #-1)
+    + Skip tests in arch-only build with DEB_BUILD_OPTIONS=nocheck.
+    + Skip doxygen in arch-only build.
+    + Demote/annotate conditional dependencies.
+
+ -- Helmut Grohne <hel...@subdivi.de>  Wed, 04 Dec 2024 08:26:22 +0100
+
 clamav (1.4.1+dfsg-1) unstable; urgency=medium
 
   * Import 1.4.1 (Closes: #1080962)
diff --minimal -Nru clamav-1.4.1+dfsg/debian/control 
clamav-1.4.1+dfsg/debian/control
--- clamav-1.4.1+dfsg/debian/control    2024-10-03 10:41:37.000000000 +0200
+++ clamav-1.4.1+dfsg/debian/control    2024-12-04 08:26:22.000000000 +0100
@@ -10,12 +10,11 @@
 Build-Depends: dpkg-dev (>= 1.22.5), automake,
                bindgen,
                cargo,
-               check,
+               check <!nocheck>,
                cmake,
                debhelper-compat (= 12),
                dh-apparmor,
                dh-strip-nondeterminism,
-               doxygen,
                libbz2-dev,
                libcurl4-openssl-dev,
                libjson-c-dev,
@@ -30,11 +29,15 @@
                perl:native,
                pkg-config,
                po-debconf,
-               python3-pytest,
-               rust-gdb,
+               python3-pytest <!nocheck>,
+               rust-gdb <!nocheck>,
                rustfmt,
                systemd,
                zlib1g-dev
+Build-Depends-Indep: check,
+                     doxygen,
+                     python3-pytest,
+                     rust-gdb,
 Standards-Version: 4.7.0
 Rules-Requires-Root: no
 Vcs-Git: https://salsa.debian.org/clamav-team/clamav.git
diff --minimal -Nru clamav-1.4.1+dfsg/debian/rules 
clamav-1.4.1+dfsg/debian/rules
--- clamav-1.4.1+dfsg/debian/rules      2024-10-03 10:41:55.000000000 +0200
+++ clamav-1.4.1+dfsg/debian/rules      2024-12-04 08:26:22.000000000 +0100
@@ -33,7 +33,24 @@
 #else
    SYSTEM_LLVM := -DBYTECODE_RUNTIME=interpreter
 #endif
-#
+
+DO_PACKAGES := $(shell dh_listpackages)
+ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
+       ENABLE_TESTS = ON
+else
+ifeq (,$(filter clamav-testfiles,$(DO_PACKAGES)))
+       ENABLE_TESTS = OFF
+else
+       ENABLE_TESTS = ON
+endif
+endif
+
+ifeq (,$(filter clamav-docs,$(DO_PACKAGES)))
+       ENABLE_DOXYGEN = OFF
+else
+       ENABLE_DOXYGEN = ON
+endif
+
 # Enable debug code, if nostrip was given.
 ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
        INSTALL_PROGRAM += -s
@@ -47,7 +64,8 @@
 #      * set various paths
 CONFIG := -DENABLE_EXTERNAL_MSPACK=ON -DENABLE_UNRAR=OFF 
-DENABLE_EXTERNAL_TOMFASTMATH=ON \
        -DAPP_CONFIG_DIRECTORY=/etc/clamav -DDATABASE_DIRECTORY=/var/lib/clamav 
\
-       -DENABLE_DOXYGEN=ON -DSYSTEMD_UNIT_DIR=/lib/systemd/system 
-DDO_NOT_SET_RPATH=ON \
+       -DENABLE_DOXYGEN=$(ENABLE_DOXYGEN) 
-DSYSTEMD_UNIT_DIR=/lib/systemd/system -DDO_NOT_SET_RPATH=ON \
+       -DENABLE_TESTS=$(ENABLE_TESTS) \
        $(SYSTEM_LLVM) \
        $(DEBUG_OPTS)
 

Reply via email to