Source: libcoverart
Version: 1.0.0+git20150706-9
Tags: patch
User: debian-cr...@lists.debian.org
Usertags: ftcbfs

libcoverart fails to cross build from source, because it does not pass
previously built IMPORT_EXECUTABLES to cmake. This is necessary when
performing cross compilation. It's a separate cmake invocation with a
native toolchain and produces the make-c-interface program. Just adding
that pass does not exactly work though. libcoverart uses neon and neon
is not coinstallable, so we cannot provide it to the native build pass.
Thus my patch adds an option BUILD_IMPORT_EXECUTABLES_ONLY that
basically disables everything but make-c-interface. Building that tool
requires libxml2-dev (for the build architecture!), which was previously
missing from Build-Depends. The attached patch makes libcoverart cross
buildable. Please consider applying it.

Helmut
diff --minimal -Nru libcoverart-1.0.0+git20150706/debian/changelog 
libcoverart-1.0.0+git20150706/debian/changelog
--- libcoverart-1.0.0+git20150706/debian/changelog      2020-09-27 
21:27:04.000000000 +0200
+++ libcoverart-1.0.0+git20150706/debian/changelog      2020-10-15 
17:49:18.000000000 +0200
@@ -1,3 +1,10 @@
+libcoverart (1.0.0+git20150706-9.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTCBFS: Build IMPORT_EXECUTABLES. (Closes: #-1)
+
+ -- Helmut Grohne <hel...@subdivi.de>  Thu, 15 Oct 2020 17:49:18 +0200
+
 libcoverart (1.0.0+git20150706-9) unstable; urgency=medium
 
   [ Debian Janitor ]
diff --minimal -Nru libcoverart-1.0.0+git20150706/debian/control 
libcoverart-1.0.0+git20150706/debian/control
--- libcoverart-1.0.0+git20150706/debian/control        2020-09-27 
21:25:21.000000000 +0200
+++ libcoverart-1.0.0+git20150706/debian/control        2020-10-15 
17:49:18.000000000 +0200
@@ -7,7 +7,8 @@
  debhelper-compat (= 13),
  cmake,
  libneon27-gnutls-dev | libneon-dev,
- libjansson-dev
+ libjansson-dev,
+ libxml2-dev:native,
 Build-Depends-Indep:
  doxygen,
  graphviz
diff --minimal -Nru libcoverart-1.0.0+git20150706/debian/patches/cross.patch 
libcoverart-1.0.0+git20150706/debian/patches/cross.patch
--- libcoverart-1.0.0+git20150706/debian/patches/cross.patch    1970-01-01 
01:00:00.000000000 +0100
+++ libcoverart-1.0.0+git20150706/debian/patches/cross.patch    2020-10-15 
17:49:18.000000000 +0200
@@ -0,0 +1,41 @@
+--- libcoverart-1.0.0+git20150706.orig/CMakeLists.txt
++++ libcoverart-1.0.0+git20150706/CMakeLists.txt
+@@ -30,8 +30,10 @@
+ SET(coverartc_SOVERSION ${coverartc_SOVERSION_MAJOR})
+ 
+ SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
+-FIND_PACKAGE(Neon REQUIRED)
+-FIND_PACKAGE(Jansson REQUIRED)
++IF(NOT BUILD_IMPORT_EXECUTABLES_ONLY)
++      FIND_PACKAGE(Neon REQUIRED)
++      FIND_PACKAGE(Jansson REQUIRED)
++ENDIF()
+ IF(NOT CMAKE_CROSSCOMPILING)
+       FIND_PACKAGE(LibXml2 REQUIRED)
+ ENDIF(NOT CMAKE_CROSSCOMPILING)
+@@ -52,8 +54,10 @@
+ INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/libcoverartcc.pc 
${CMAKE_CURRENT_BINARY_DIR}/libcoverart.pc DESTINATION 
${LIB_INSTALL_DIR}/pkgconfig)
+ 
+ ADD_SUBDIRECTORY(src)
+-ADD_SUBDIRECTORY(tests)
+-ADD_SUBDIRECTORY(examples)
++IF(NOT BUILD_IMPORT_EXECUTABLES_ONLY)
++      ADD_SUBDIRECTORY(tests)
++      ADD_SUBDIRECTORY(examples)
++ENDIF()
+ 
+ ADD_CUSTOM_TARGET(docs
+       doxygen
+--- libcoverart-1.0.0+git20150706.orig/src/CMakeLists.txt
++++ libcoverart-1.0.0+git20150706/src/CMakeLists.txt
+@@ -32,6 +32,10 @@
+   EXPORT(TARGETS make-c-interface FILE 
${CMAKE_BINARY_DIR}/ImportExecutables.cmake )
+ ENDIF(NOT CMAKE_CROSSCOMPILING)
+ 
++IF(BUILD_IMPORT_EXECUTABLES_ONLY)
++      RETURN()
++ENDIF()
++
+ FILE(GLOB INC_FILES *.inc)
+ ADD_CUSTOM_COMMAND(
+       OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/caa_c.cc 
${CMAKE_CURRENT_BINARY_DIR}/caa_c.h 
${CMAKE_CURRENT_BINARY_DIR}/../include/coverart/caa_c.h
diff --minimal -Nru libcoverart-1.0.0+git20150706/debian/patches/series 
libcoverart-1.0.0+git20150706/debian/patches/series
--- libcoverart-1.0.0+git20150706/debian/patches/series 2020-09-27 
21:23:09.000000000 +0200
+++ libcoverart-1.0.0+git20150706/debian/patches/series 2020-10-15 
17:49:18.000000000 +0200
@@ -3,3 +3,4 @@
 0003-gcc-5.patch
 0004-Use-const-when-catching-exceptions.patch
 0005-Fix-build-with-cmake-3.18.patch
+cross.patch
diff --minimal -Nru libcoverart-1.0.0+git20150706/debian/rules 
libcoverart-1.0.0+git20150706/debian/rules
--- libcoverart-1.0.0+git20150706/debian/rules  2020-09-27 21:26:42.000000000 
+0200
+++ libcoverart-1.0.0+git20150706/debian/rules  2020-10-15 17:49:18.000000000 
+0200
@@ -2,11 +2,22 @@
 
 include /usr/share/dpkg/architecture.mk
 
+FOR_BUILD = dpkg-architecture -a$(DEB_BUILD_ARCH) -f -c
+
 %:
        dh $@
 
+ifeq (,$(filter cross,$(DEB_BUILD_PROFILES)))
+execute_after_dh_auto_clean::
+       $(FOR_BUILD) dh_auto_clean
+endif
+
 override_dh_auto_configure:
-       dh_auto_configure -- -DLIB_SUFFIX=/$(DEB_HOST_MULTIARCH)
+ifneq (,$(filter cross,$(DEB_BUILD_PROFILES)))
+       $(FOR_BUILD) dh_auto_configure -- -DBUILD_IMPORT_EXECUTABLES_ONLY=TRUE
+       $(FOR_BUILD) dh_auto_build -- make-c-interface
+endif
+       dh_auto_configure -- -DLIB_SUFFIX=/$(DEB_HOST_MULTIARCH) $(if $(filter 
cross,$(DEB_BUILD_PROFILES)),-DIMPORT_EXECUTABLES=../obj-$(DEB_BUILD_GNU_TYPE)/ImportExecutables.cmake)
 
 override_dh_auto_build-indep:
        dh_auto_build -- docs

Reply via email to