Source: mir
Version: 2.14.1-5
Tags: patch
User: debian-cr...@lists.debian.org
Usertags: ftcbfs

mir fails to cross build from source as it fails running the built
mir_wayland_generator. This is a typical problem for cmake based
projects as cmake has very little idea of what a build architecture is
or what a native executable is. mir_wayland_generator happens to be
installed into libmirwayland-bin and that's what should be used during a
cross build. I'm attaching a patch implementing this and it is
conditional to the cross build profile in order to not affect native
builds. While at it, I noticed that the noinsttest build profile FTBFS
and I think mir-wlcs-integration should also be disabled by that
profile. I'm attaching a patch for your convenience.

Helmut
diff --minimal -Nru mir-2.14.1/debian/changelog mir-2.14.1/debian/changelog
--- mir-2.14.1/debian/changelog 2024-03-23 07:29:01.000000000 +0100
+++ mir-2.14.1/debian/changelog 2024-04-19 11:04:42.000000000 +0200
@@ -1,3 +1,12 @@
+mir (2.14.1-5.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Improve cross building: Use packages mir_wayland_generator during cross
+    builds. (Closes: #-1)
+  * Fix noinsttest build profile: skip package mir-wlcs-integration.
+
+ -- Helmut Grohne <hel...@subdivi.de>  Fri, 19 Apr 2024 11:04:42 +0200
+
 mir (2.14.1-5) unstable; urgency=medium
 
   [ Matthias Klose ]
diff --minimal -Nru mir-2.14.1/debian/control mir-2.14.1/debian/control
--- mir-2.14.1/debian/control   2024-02-28 21:03:56.000000000 +0100
+++ mir-2.14.1/debian/control   2024-04-19 11:04:42.000000000 +0200
@@ -27,6 +27,7 @@
                libglm-dev,
                libgoogle-glog-dev,
                liblttng-ust-dev,
+               libmirwayland-bin <cross>,
                libxkbcommon-dev (>= 0.5),
                libumockdev-dev (>= 0.6) <!noinsttest>,
                umockdev (>= 0.8.7) <!noinsttest>,
@@ -238,6 +239,7 @@
 
 Package: mir-wlcs-integration
 Architecture: linux-any
+Build-Profiles: <!noinsttest>
 Pre-Depends: ${misc:Pre-Depends}
 Breaks: mir-test-tools (<< 2.0.0.0+dev148~)
 Replaces: mir-test-tools (<< 2.0.0.0+dev148~)
diff --minimal -Nru mir-2.14.1/debian/patches/cross.patch 
mir-2.14.1/debian/patches/cross.patch
--- mir-2.14.1/debian/patches/cross.patch       1970-01-01 01:00:00.000000000 
+0100
+++ mir-2.14.1/debian/patches/cross.patch       2024-04-19 11:04:42.000000000 
+0200
@@ -0,0 +1,43 @@
+--- mir-2.14.1.orig/cmake/MirCommon.cmake
++++ mir-2.14.1/cmake/MirCommon.cmake
+@@ -310,6 +310,14 @@
+   add_dependencies(${DEPENDENT_TARGET} ${TARGET_NAME})
+ endfunction()
+ 
++set(
++  MIR_WAYLAND_GENERATOR_EXECUTABLE
++  "${CMAKE_BINARY_DIR}/bin/mir_wayland_generator"
++  CACHE
++  STRING
++  "Location of an externally supplied mir_wayland_generator executable"
++)
++
+ function (mir_generate_protocol_wrapper TARGET_NAME NAME_PREFIX PROTOCOL_FILE)
+   if (NAME_PREFIX STREQUAL "")
+     set(NAME_PREFIX "@") # won't match anything
+@@ -322,9 +330,9 @@
+     OUTPUT "${OUTPUT_PATH_HEADER}" "${OUTPUT_PATH_SRC}"
+     VERBATIM
+     COMMAND "sh" "-c"
+-    "${CMAKE_BINARY_DIR}/bin/mir_wayland_generator ${NAME_PREFIX} 
${PROTOCOL_PATH} header > ${OUTPUT_PATH_HEADER}"
++    "${MIR_WAYLAND_GENERATOR_EXECUTABLE} ${NAME_PREFIX} ${PROTOCOL_PATH} 
header > ${OUTPUT_PATH_HEADER}"
+     COMMAND "sh" "-c"
+-    "${CMAKE_BINARY_DIR}/bin/mir_wayland_generator ${NAME_PREFIX} 
${PROTOCOL_PATH} source > ${OUTPUT_PATH_SRC}"
++    "${MIR_WAYLAND_GENERATOR_EXECUTABLE} ${NAME_PREFIX} ${PROTOCOL_PATH} 
source > ${OUTPUT_PATH_SRC}"
+     DEPENDS mir_wayland_generator "${PROTOCOL_PATH}"
+   )
+   target_sources("${TARGET_NAME}" PRIVATE "${OUTPUT_PATH_HEADER}" 
"${OUTPUT_PATH_SRC}")
+--- mir-2.14.1.orig/tests/acceptance-tests/wayland-generator/CMakeLists.txt
++++ mir-2.14.1/tests/acceptance-tests/wayland-generator/CMakeLists.txt
+@@ -5,9 +5,9 @@
+   OUTPUT "${GENERATED_HEADER}" "${GENERATED_SRC}"
+   VERBATIM
+   COMMAND "sh" "-c"
+-  "${CMAKE_BINARY_DIR}/bin/mir_wayland_generator wl_ ${PROTOCOL_PATH} header 
> ${GENERATED_HEADER}"
++  "${MIR_WAYLAND_GENERATOR_EXECUTABLE} wl_ ${PROTOCOL_PATH} header > 
${GENERATED_HEADER}"
+   COMMAND "sh" "-c"
+-  "${CMAKE_BINARY_DIR}/bin/mir_wayland_generator wl_ ${PROTOCOL_PATH} source 
> ${GENERATED_SRC}"
++  "${MIR_WAYLAND_GENERATOR_EXECUTABLE} wl_ ${PROTOCOL_PATH} source > 
${GENERATED_SRC}"
+   DEPENDS mir_wayland_generator "${PROTOCOL_PATH}"
+ )
+ add_custom_target(wayland_generator_test_generated_files ALL DEPENDS 
"${GENERATED_SRC}" "${GENERATED_HEADER}")
diff --minimal -Nru mir-2.14.1/debian/patches/series 
mir-2.14.1/debian/patches/series
--- mir-2.14.1/debian/patches/series    2024-03-23 07:29:01.000000000 +0100
+++ mir-2.14.1/debian/patches/series    2024-04-19 10:57:39.000000000 +0200
@@ -1,3 +1,4 @@
 1002_arch-indep-only-install-target.patch
 2002_dont-dpkg-gensymbols-by-upstream.patch
 2001_time64.patch
+cross.patch
diff --minimal -Nru mir-2.14.1/debian/rules mir-2.14.1/debian/rules
--- mir-2.14.1/debian/rules     2024-02-28 21:03:54.000000000 +0100
+++ mir-2.14.1/debian/rules     2024-04-19 11:04:38.000000000 +0200
@@ -73,6 +73,10 @@
        COMMON_CONFIGURE_OPTIONS += -DMIR_ENABLE_TESTS=OFF
 endif
 
+ifneq (,$(filter cross,$(DEB_BUILD_PROFILES)))
+       COMMON_CONFIGURE_OPTIONS += 
-DMIR_WAYLAND_GENERATOR_EXECUTABLE=/usr/bin/mir_wayland_generator
+endif
+
 # We can't guarantee non-Ubuntu builds will build against WLCS packages we
 # control, so disable it on non-Ubuntu builds
 #ifeq ($(filter Ubuntu,$(DEB_VENDOR)),)

Reply via email to