Bug#1083175: freerdp3 FTCBFS: fails locating native tools
Source: freerdp3
Version: 3.6.3+dfsg1-2
Tags: patch
User: debian-cross@lists.debian.org
Usertags: ftcbfs
freerdp3 fails to cross build from source as a Debian package. The
upstream build system has some support for cross building built into it.
There are two tools that are to be run during build. They're
sdl-common-res2bin and generate_argument_docbook. The build system takes
care of importing these during cross building, but nothing supplies them
in the Debian build. Generating these tools using CMake is a non-trivial
affair as many of the dependencies cannot be disabled, so we'd massively
increase Build-Depends for little value. I therefore propose manually
building these two components. Doing so is a little fragile admittedly.
A minor complication is that the upstream build system references
generate_argument_docbook via its native path and that has to be
patched. I'm attaching the resulting patch for your convenience. Please
let me know if this is acceptable.
Helmut
diff --minimal -Nru freerdp3-3.6.3+dfsg1/debian/changelog freerdp3-3.6.3+dfsg1/debian/changelog
--- freerdp3-3.6.3+dfsg1/debian/changelog 2024-07-09 13:37:31.000000000 +0200
+++ freerdp3-3.6.3+dfsg1/debian/changelog 2024-10-02 15:00:29.000000000 +0200
@@ -1,3 +1,14 @@
+freerdp3 (3.6.3+dfsg1-2.1) UNRELEASED; urgency=medium
+
+ * Non-maintainer upload.
+ * Fix FTCBFS: (Closes: #-1)
+ + cross.patch: Reference generate_argument_docbook via its target path.
+ + Skip test build pass when DEB_BUILD_OPTIONS contains nocheck.
+ + Manually generate native components in obj-native/ as building them
+ with CMake is non-trivial.
+
+ -- Helmut Grohne <helmut@subdivi.de> Wed, 02 Oct 2024 15:00:29 +0200
+
freerdp3 (3.6.3+dfsg1-2) unstable; urgency=medium
* Revert "Add Build-Depends: libmp3lame-dev for MP3 audio codec support":
diff --minimal -Nru freerdp3-3.6.3+dfsg1/debian/clean freerdp3-3.6.3+dfsg1/debian/clean
--- freerdp3-3.6.3+dfsg1/debian/clean 1970-01-01 01:00:00.000000000 +0100
+++ freerdp3-3.6.3+dfsg1/debian/clean 2024-10-02 14:41:52.000000000 +0200
@@ -0,0 +1,2 @@
+obj-native
+debian/testtmp
diff --minimal -Nru freerdp3-3.6.3+dfsg1/debian/patches/cross.patch freerdp3-3.6.3+dfsg1/debian/patches/cross.patch
--- freerdp3-3.6.3+dfsg1/debian/patches/cross.patch 1970-01-01 01:00:00.000000000 +0100
+++ freerdp3-3.6.3+dfsg1/debian/patches/cross.patch 2024-10-02 15:00:29.000000000 +0200
@@ -0,0 +1,11 @@
+--- freerdp3-3.6.3+dfsg1.orig/cmake/InstallFreeRDPMan.cmake
++++ freerdp3-3.6.3+dfsg1/cmake/InstallFreeRDPMan.cmake
+@@ -54,7 +54,7 @@
+
+ add_custom_command(
+ OUTPUT "${manpage}"
+- COMMAND ${CMAKE_BINARY_DIR}/client/common/man/generate_argument_docbook
++ COMMAND $<TARGET_FILE:generate_argument_docbook>
+ COMMAND ${XSLTPROC_EXECUTABLE} --path "${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}" ${DOCBOOKXSL_DIR}/manpages/docbook.xsl ${manpage}.xml
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ DEPENDS
diff --minimal -Nru freerdp3-3.6.3+dfsg1/debian/patches/series freerdp3-3.6.3+dfsg1/debian/patches/series
--- freerdp3-3.6.3+dfsg1/debian/patches/series 2024-07-09 13:37:31.000000000 +0200
+++ freerdp3-3.6.3+dfsg1/debian/patches/series 2024-10-02 15:00:29.000000000 +0200
@@ -1 +1,2 @@
2000-skip-failing-test.patch
+cross.patch
diff --minimal -Nru freerdp3-3.6.3+dfsg1/debian/rules freerdp3-3.6.3+dfsg1/debian/rules
--- freerdp3-3.6.3+dfsg1/debian/rules 2024-07-09 13:37:31.000000000 +0200
+++ freerdp3-3.6.3+dfsg1/debian/rules 2024-10-02 15:00:29.000000000 +0200
@@ -118,8 +118,43 @@
# (however, they're using 0x17)
xSEDx :=$(shell printf '\026')
+ifneq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
+ DEB_CMAKE_EXTRA_FLAGS += -DCMAKE_PREFIX_PATH=$(CURDIR)/obj-native
+endif
+
override_dh_auto_configure:
+ifneq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
+ # Perform the native pass without CMake, because we only need a tiny
+ # fraction and disabling all that is unnecessary would be more work.
+ mkdir -p obj-native/freerdp obj-native/winpr
+ touch obj-native/freerdp/config.h
+ sed '/WINPR_HAVE_.*_H$$/s/^#cmakedefine/#define/' \
+ winpr/include/config/wtypes.h.in \
+ > obj-native/winpr/wtypes.h
+ $(or $(CXX_FOR_BUILD),g++) \
+ $(CXXFLAGS_FOR_BUILD) \
+ $(CPPFLAGS_FOR_BUILD) \
+ $(LDFLAGS_FOR_BUILD) \
+ client/SDL/common/res/convert_res_to_c.cpp \
+ -o obj-native/sdl-common-res2bin
+ printf 'add_executable(sdl-common-res2bin IMPORTED GLOBAL)\nset_property(TARGET sdl-common-res2bin PROPERTY IMPORTED_LOCATION "%s")\n' \
+ '$(CURDIR)/obj-native/sdl-common-res2bin' \
+ > obj-native/SdlCommonRes2binConfig.cmake
+ $(or $(CC_FOR_BUILD),cc) \
+ $(CCFLAGS_FOR_BUILD) \
+ $(CPPFLAGS_FOR_BUILD) \
+ $(LDFLAGS_FOR_BUILD) \
+ -Iobj-native \
+ -Iwinpr/include \
+ client/common/man/generate_argument_docbook.c \
+ -o obj-native/generate_argument_docbook
+ printf 'add_executable(generate_argument_docbook IMPORTED GLOBAL)\nset_property(TARGET generate_argument_docbook PROPERTY IMPORTED_LOCATION "%s")\n' \
+ '$(CURDIR)/obj-native/generate_argument_docbook' \
+ > obj-native/GenerateArgumentDocbookConfig.cmake
+endif
+ifeq ($(filter nocheck,$(DEB_BUILD_OPTIONS)),)
dh_auto_configure --builddirectory=debian/testtmp -- $(DEB_CMAKE_EXTRA_FLAGS) -DBUILD_TESTING=ON
+endif
dh_auto_configure -- $(DEB_CMAKE_EXTRA_FLAGS)
# mangle CFLAGS value stored in buildflags.h.
# fixes build path leakage.
@@ -133,11 +168,13 @@
-e "s$(xSEDx) $${o}=[^=]+=\.$(xSEDx)$(xSEDx)g;" \
obj-$(DEB_HOST_GNU_TYPE)/winpr/include/winpr/buildflags.h
+ifeq ($(filter nocheck,$(DEB_BUILD_OPTIONS)),)
execute_after_dh_auto_build:
dh_auto_build --builddirectory=debian/testtmp
execute_after_dh_auto_test:
dh_auto_test --builddirectory=debian/testtmp
+endif
# NB debhelper 13+: convert to execute_before_dh_install
override_dh_install: TMP_LIB = debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)
Reply to: