Source: conky
Version: 1.12.2-2
Tags: patch
User: debian-cr...@lists.debian.org
Usertags: ftcbfs

conky fails to cross build from source, because it does not find
toluapp. What's happening here is actually a little more involved.
toluapp is actually vendored. It is packaged spearately as
libtolua++5.1-dev albeit for a different (deprecated) lua version. If
conky were using the packaged tolua++ instead of vendoring it, this bug
would fully go away (while leaving #1010294, but that's not your issue).
Unfortunately, tolua++ would have to be upgraded from 5.1 to 5.3 first.
I'm not sure whether that's going to happen. In any case, please do one
of the following:
 * Use a separately packaged tolua++
 * Register your vendored tolua++ with the security tracker at
   
https://salsa.debian.org/security-tracker-team/security-tracker/-/blob/master/data/embedded-code-copies

Now, I'm going to assume that you register your copy. If you want to
remove the copy, please close this bug with the removal and stop reading
here.

Now conky uses cmake as a build system and cmake is notoriously bad at
distinguishing "build architecture" from "host architecture". Basically,
if you want to build a build tool like tolua++, you need to run cmake
twice somehow (e.g. via an ExternalProject). That doesn't happen here
and it is non-trivial to do. As a consequence, cmake does not consider
the built toluapp relevant and searches for one in $PATH instead where
none is found. Therefore, I'm proposing to extend $PATH with a directory
that contains a separately built toluapp. In essence, that's what the
attached patch does. Please consider applying it. Note that once you do,
conky will continue to fail cross builds until we also fix #1006570, but
again, that's not your issue.

Helmut
diff --minimal -Nru conky-1.12.2/debian/changelog conky-1.12.2/debian/changelog
--- conky-1.12.2/debian/changelog       2022-04-15 11:06:37.000000000 +0200
+++ conky-1.12.2/debian/changelog       2022-04-28 07:19:04.000000000 +0200
@@ -1,3 +1,11 @@
+conky (1.12.2-2.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTCBFS: Separately build toluapp for the build architecture.
+    (Closes: #-1)
+
+ -- Helmut Grohne <hel...@subdivi.de>  Thu, 28 Apr 2022 07:19:04 +0200
+
 conky (1.12.2-2) unstable; urgency=medium
 
   [ Arnaud Rebillout ]
diff --minimal -Nru conky-1.12.2/debian/control conky-1.12.2/debian/control
--- conky-1.12.2/debian/control 2022-04-15 10:58:58.000000000 +0200
+++ conky-1.12.2/debian/control 2022-04-28 07:19:04.000000000 +0200
@@ -23,6 +23,7 @@
  libiw-dev [linux-any],
  libkvm-dev [kfreebsd-any],
  liblua5.3-dev,
+ liblua5.3-dev:native,
  libncurses5-dev,
  libpulse-dev,
  librsvg2-dev,
diff --minimal -Nru conky-1.12.2/debian/rules conky-1.12.2/debian/rules
--- conky-1.12.2/debian/rules   2022-04-15 10:58:58.000000000 +0200
+++ conky-1.12.2/debian/rules   2022-04-28 07:19:04.000000000 +0200
@@ -6,8 +6,8 @@
 DEB_CPPFLAGS        ?= $(shell dpkg-buildflags --get CPPFLAGS)
 DEB_CXXFLAGS        ?= $(shell dpkg-buildflags --get CXXFLAGS)
 
-DEB_HOST_ARCH_OS    ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
-DEB_HOST_ARCH       ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)
+include /usr/share/dpkg/architecture.mk
+include /usr/share/dpkg/buildtools.mk
 
 COMMON_CONF_ARGS=-DCMAKE_BUILD_TYPE=RelWithDebInfo \
                  -DCMAKE_INSTALL_PREFIX=/usr \
@@ -32,11 +32,15 @@
 endif
 endif
 
+ifneq ($(DEB_HOST_ARCH),$(DEB_BUILD_ARCH))
+export PATH:=$(CURDIR)/debian/bin:$(PATH)
+endif
+
 %:
        dh $@ --buildsystem=cmake
 
 override_dh_auto_clean:
-       rm -rf $(CURDIR)/README $(CURDIR)/doc/*.html $(CURDIR)/doc/*.1
+       rm -rf $(CURDIR)/README $(CURDIR)/doc/*.html $(CURDIR)/doc/*.1 
$(CURDIR)/debian/bin
        dh_auto_clean --builddirectory build-std
        dh_auto_clean --builddirectory build-cli
        dh_auto_clean --builddirectory build-all
@@ -71,7 +75,11 @@
        -DBUILD_WEATHER_XOAP=ON \
        -DBUILD_XDBE=ON
 
-override_dh_auto_build:
+debian/bin/toluapp: 3rdparty/toluapp/src/bin/toluabind.c 
3rdparty/toluapp/src/bin/tolua.c $(wildcard 3rdparty/toluapp/src/lib/*.c)
+       mkdir -p debian/bin
+       $(CC_FOR_BUILD) -I3rdparty/toluapp/include -o $@ $^ 
`$(PKG_CONFIG_FOR_BUILD) --cflags --libs lua-5.3`
+
+override_dh_auto_build: $(if $(filter 
$(DEB_BUILD_ARCH),$(DEB_HOST_ARCH)),,debian/bin/toluapp)
        dh_auto_build --builddirectory build-std
        dh_auto_build --builddirectory build-cli
        dh_auto_build --builddirectory build-all

Reply via email to