Source: bear
Version: 3.0.4-1
Tags: patch
User: debian-cr...@lists.debian.org
Usertags: ftcbfs

bear fails to cross build from source for three quite distinct issues:

1. bear is built as an ExternalProject from cmake. Unfortunately, the
   ExternalProject does not pass down all relevant build tools. In
   particular, the C compiler and pkg-config go missing. As a result,
   cmake detects the wrong tools and fails.

2. bear uses grpc, which is not Multi-Arch tagged and thus installed for
   the host architetcure. The relevant plugin cannot be run then. Fixing
   this is likely out of scope for bear.

3. bear runs its test suite during dh_auto_build. Therefore the
   automatic support for DEB_BUILD_OPTIONS=nocheck in debhelper does not
   work. During cross builds, test suites must be disabled as they
   cannot be run.

The attached patch fixes the first and last issue. The grpc issue needs
a separate bug report. Please consider applying it and close this bug
when doing so.

Helmut
diff --minimal -Nru bear-3.0.4/debian/changelog bear-3.0.4/debian/changelog
--- bear-3.0.4/debian/changelog 2020-12-14 21:52:31.000000000 +0100
+++ bear-3.0.4/debian/changelog 2020-12-22 23:30:57.000000000 +0100
@@ -1,3 +1,13 @@
+bear (3.0.4-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Improve cross building: (Closes: #-1)
+    + cross.patch: Pass C compiler and pkg-config down via the
+      ExternalProject.
+    + Honour DEB_BUILD_OPTIONS=nocheck.
+
+ -- Helmut Grohne <hel...@subdivi.de>  Tue, 22 Dec 2020 23:30:57 +0100
+
 bear (3.0.4-1) unstable; urgency=medium
 
   * New upstream release
diff --minimal -Nru bear-3.0.4/debian/patches/cross.patch 
bear-3.0.4/debian/patches/cross.patch
--- bear-3.0.4/debian/patches/cross.patch       1970-01-01 01:00:00.000000000 
+0100
+++ bear-3.0.4/debian/patches/cross.patch       2020-12-22 23:30:57.000000000 
+0100
@@ -0,0 +1,16 @@
+--- bear-3.0.4.orig/CMakeLists.txt
++++ bear-3.0.4/CMakeLists.txt
+@@ -46,11 +46,13 @@
+         CMAKE_ARGS
+             -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
+             -DCMAKE_PROJECT_VERSION=${CMAKE_PROJECT_VERSION}
++            -DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
+             -DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}
+             -DCMAKE_CXX_STANDARD_REQUIRED=${CMAKE_CXX_STANDARD_REQUIRED}
+             -DCMAKE_CXX_EXTENSIONS=${CMAKE_CXX_EXTENSIONS}
+             -DCMAKE_CXX_FLAGS:STRING=${CMAKE_CXX_FLAGS}
+             -DCMAKE_CXX_COMPILER:STRING=${CMAKE_CXX_COMPILER}
++            -DPKG_CONFIG_EXECUTABLE:PATH=${PKG_CONFIG_EXECUTABLE}
+         CMAKE_CACHE_ARGS
+             -DCMAKE_PREFIX_PATH:PATH=${CMAKE_PREFIX_PATH}
+             -DCMAKE_INSTALL_PREFIX:PATH=${STAGED_INSTALL_PREFIX}
diff --minimal -Nru bear-3.0.4/debian/patches/series 
bear-3.0.4/debian/patches/series
--- bear-3.0.4/debian/patches/series    1970-01-01 01:00:00.000000000 +0100
+++ bear-3.0.4/debian/patches/series    2020-12-22 23:30:28.000000000 +0100
@@ -0,0 +1 @@
+cross.patch
diff --minimal -Nru bear-3.0.4/debian/rules bear-3.0.4/debian/rules
--- bear-3.0.4/debian/rules     2020-11-22 23:03:20.000000000 +0100
+++ bear-3.0.4/debian/rules     2020-12-22 23:30:57.000000000 +0100
@@ -7,7 +7,8 @@
 
 override_dh_auto_configure:
        dh_auto_configure -- \
-               -DCMAKE_INSTALL_LIBEXECDIR=lib/${DEB_HOST_MULTIARCH}/bear
+               -DCMAKE_INSTALL_LIBEXECDIR=lib/${DEB_HOST_MULTIARCH}/bear \
+               $(if $(filter 
nocheck,$(DEB_BUILD_OPTIONS)),-DENABLE_UNIT_TESTS=OFF -DENABLE_FUNC_TESTS=OFF)
 
 override_dh_auto_test:
        # The tests fail if /usr/lib/ccache is in PATH so we remove it here. 
The tests

Reply via email to