Source: libvdpau-va-gl
Version: 0.4.2-1
Tags: patch
User: debian-cr...@lists.debian.org
Usertags: ftcbfs

libvdpau-va-gl fails to cross build from source, because it fails
running shader-bundle-tool. Other distributions have already recognized
that this build-time tool is not architecture-dependent and should be
built for the build architecture (e.g. voidlinux and oe). Doing so is
close to impossible with CMake (because it doesn't have a notion of
build architecture), so this patch allows providing the tool externally
and makes the Debian package construct it beforehand. The upstream
changes should be upstreamable (and improving the situation at voidlinux
and oe).  Please consider applying the whole patch.

Helmut
diff --minimal -Nru libvdpau-va-gl-0.4.2/debian/changelog 
libvdpau-va-gl-0.4.2/debian/changelog
--- libvdpau-va-gl-0.4.2/debian/changelog       2016-10-07 10:56:46.000000000 
+0200
+++ libvdpau-va-gl-0.4.2/debian/changelog       2022-08-22 20:37:27.000000000 
+0200
@@ -1,3 +1,11 @@
+libvdpau-va-gl (0.4.2-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Fix FTCBFS: Build shader-bundle-tool with the build architecture
+    compiler. (Closes: #-1)
+
+ -- Helmut Grohne <hel...@subdivi.de>  Mon, 22 Aug 2022 20:37:27 +0200
+
 libvdpau-va-gl (0.4.2-1) unstable; urgency=medium
 
   * New upstream release.
diff --minimal -Nru libvdpau-va-gl-0.4.2/debian/clean 
libvdpau-va-gl-0.4.2/debian/clean
--- libvdpau-va-gl-0.4.2/debian/clean   1970-01-01 01:00:00.000000000 +0100
+++ libvdpau-va-gl-0.4.2/debian/clean   2022-08-22 20:37:25.000000000 +0200
@@ -0,0 +1 @@
+debian/shader-bundle-tool
diff --minimal -Nru libvdpau-va-gl-0.4.2/debian/patches/cross.patch 
libvdpau-va-gl-0.4.2/debian/patches/cross.patch
--- libvdpau-va-gl-0.4.2/debian/patches/cross.patch     1970-01-01 
01:00:00.000000000 +0100
+++ libvdpau-va-gl-0.4.2/debian/patches/cross.patch     2022-08-22 
20:37:27.000000000 +0200
@@ -0,0 +1,24 @@
+--- libvdpau-va-gl-0.4.2.orig/glsl/CMakeLists.txt
++++ libvdpau-va-gl-0.4.2/glsl/CMakeLists.txt
+@@ -10,13 +10,19 @@
+       list(APPEND shader_list ${CMAKE_CURRENT_SOURCE_DIR}/${item})
+ endforeach(item)
+ 
++if(SHADER_BUNDLE_TOOL_EXECUTABLE)
++      add_executable(shader-bundle-tool IMPORTED)
++      set_target_properties(shader-bundle-tool PROPERTIES IMPORTED_LOCATION 
"${SHADER_BUNDLE_TOOL_EXECUTABLE}")
++else()
++      add_executable(shader-bundle-tool shader-bundle-tool.cc)
++endif()
++
+ add_custom_command(
+       OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/shaders.c 
${CMAKE_CURRENT_BINARY_DIR}/shaders.h
+-      COMMAND ${CMAKE_CURRENT_BINARY_DIR}/shader-bundle-tool 
${CMAKE_CURRENT_BINARY_DIR}/shaders.h ${CMAKE_CURRENT_BINARY_DIR}/shaders.c 
${shader_list}
++      COMMAND shader-bundle-tool ${CMAKE_CURRENT_BINARY_DIR}/shaders.h 
${CMAKE_CURRENT_BINARY_DIR}/shaders.c ${shader_list}
+       DEPENDS ${shader_list} shader-bundle-tool
+ )
+ add_custom_target(shader-bundle-src DEPENDS 
${CMAKE_CURRENT_BINARY_DIR}/shaders.c ${CMAKE_CURRENT_BINARY_DIR}/shaders.h)
+ 
+-add_executable(shader-bundle-tool shader-bundle-tool.cc)
+ add_library(shader-bundle STATIC ${CMAKE_CURRENT_BINARY_DIR}/shaders.c)
+ add_dependencies(shader-bundle shader-bundle-src)
diff --minimal -Nru libvdpau-va-gl-0.4.2/debian/patches/series 
libvdpau-va-gl-0.4.2/debian/patches/series
--- libvdpau-va-gl-0.4.2/debian/patches/series  1970-01-01 01:00:00.000000000 
+0100
+++ libvdpau-va-gl-0.4.2/debian/patches/series  2022-08-22 20:30:59.000000000 
+0200
@@ -0,0 +1 @@
+cross.patch
diff --minimal -Nru libvdpau-va-gl-0.4.2/debian/rules 
libvdpau-va-gl-0.4.2/debian/rules
--- libvdpau-va-gl-0.4.2/debian/rules   2016-10-07 10:56:46.000000000 +0200
+++ libvdpau-va-gl-0.4.2/debian/rules   2022-08-22 20:37:27.000000000 +0200
@@ -1,12 +1,19 @@
 #!/usr/bin/make -f
 # -*- makefile -*-
 
-DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
+include /usr/share/dpkg/architecture.mk
+include /usr/share/dpkg/buildtools.mk
 export DEB_CPPFLAGS_MAINT_APPEND = -DNDEBUG
 
 %:
        dh $@
 
+ifneq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
+override_dh_auto_configure:
+       $(CXX_FOR_BUILD) glsl/shader-bundle-tool.cc -o debian/shader-bundle-tool
+       dh_auto_configure -- 
-DSHADER_BUNDLE_TOOL_EXECUTABLE=$(CURDIR)/debian/shader-bundle-tool
+endif
+
 override_dh_auto_test:
        # Cannot run tests without a X11 server (with VAAPI support)
 

Reply via email to