Add breeze-icons binary ressource
authorAndre Heinecke <aheinecke@gnupg.org>
Mon, 4 Mar 2019 09:26:30 +0000 (10:26 +0100)
committerAndre Heinecke <aheinecke@gnupg.org>
Mon, 4 Mar 2019 09:27:22 +0000 (10:27 +0100)
* Makefile.am (EXTRA_DIST): Add patch.
* src/Makefile.am: Enable it.

Makefile.am
patches/breeze-icons/0001-Make-binary-icons-cross-compilable.patch [new file with mode: 0755]
src/Makefile.am

index 75e48b4..1d128de 100644 (file)
@@ -46,7 +46,8 @@ EXTRA_DIST = autogen.sh README.GIT ONEWS \
         patches/qtbase/relative-paths.patch \
         patches/qttools/disable-most-tools.patch \
         patches/qtwinextras/support-xp.patch \
-        patches/w32pth-2.0.5/workaround-broken-libtool.patch
+        patches/w32pth-2.0.5/workaround-broken-libtool.patch \
+        patches/breze-icons/0001-Make-binary-icons-cross-compilable.patch
 
 copy-news:
        cp NEWS doc/website/NEWS.last
diff --git a/patches/breeze-icons/0001-Make-binary-icons-cross-compilable.patch b/patches/breeze-icons/0001-Make-binary-icons-cross-compilable.patch
new file mode 100755 (executable)
index 0000000..4ac78dc
--- /dev/null
@@ -0,0 +1,86 @@
+#! /bin/sh
+patch -p1 -l -f $* < $0
+exit $?
+
+From 290479782278cdf07945be059eb47580fc8502ac Mon Sep 17 00:00:00 2001
+From: Andre Heinecke <aheinecke@gnupg.org>
+Date: Mon, 4 Mar 2019 10:22:23 +0100
+Subject: [PATCH] Make binary icons cross compilable
+
+This uses KF5_HOST_TOOLING as used by other frameworks
+to find host libraries and builds qrcAlias as external
+project against it.
+---
+ CMakeLists.txt                        | 28 +++++++++++++++++++++++----
+ qrcAlias/CMakeLists.txt               |  8 ++++++++
+ qrcAlias.cpp => qrcAlias/qrcAlias.cpp |  0
+ 3 files changed, 32 insertions(+), 4 deletions(-)
+ create mode 100644 qrcAlias/CMakeLists.txt
+ rename qrcAlias.cpp => qrcAlias/qrcAlias.cpp (100%)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 1045e6b3..920a535a 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -19,7 +19,6 @@ include(GtkUpdateIconCache)
+ # Dependencies
+ set(REQUIRED_QT_VERSION 5.10.0)
+
+-# When cross-compiling, we should compile qrcAlias natively (against a native Qt build)
+ if (CMAKE_CROSSCOMPILING)
+     set(BINARY_ICONS_RESOURCE_OPTION_DEFAULT OFF)
+ else()
+@@ -30,9 +29,30 @@ option(BINARY_ICONS_RESOURCE "Install Qt binary resource files containing breeze
+ option(SKIP_INSTALL_ICONS "Skip installing the icons files" OFF)
+
+ if(BINARY_ICONS_RESOURCE)
+-    find_package(Qt5 NO_MODULE REQUIRED Core)
+-    add_executable(qrcAlias qrcAlias.cpp)
+-    target_link_libraries(qrcAlias PUBLIC Qt5::Core)
++    if (CMAKE_CROSSCOMPILING)
++        if (NOT KF5_HOST_TOOLING)
++            message(FATAL_ERROR "Please provide a prefix with a native Qt build and pass -DKF5_HOST_TOOLING=path or disable BINARY_ICONS_RESOURCE")
++        endif()
++
++        # search native tooling prefix
++        string(FIND ${KF5_HOST_TOOLING} /lib idx)
++        string(SUBSTRING ${KF5_HOST_TOOLING} 0 ${idx} NATIVE_PREFIX)
++        message(STATUS "Building qrcAlias against ${NATIVE_PREFIX}")
++
++        include(ExternalProject)
++        ExternalProject_Add(native_qrcAlias
++                            SOURCE_DIR ${CMAKE_SOURCE_DIR}/qrcAlias
++                            CMAKE_ARGS -DCMAKE_PREFIX_PATH=${NATIVE_PREFIX}
++                                -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}
++                            INSTALL_COMMAND ""
++                           )
++        add_executable(qrcAlias IMPORTED GLOBAL)
++        add_dependencies(qrcAlias native_qrcAlias)
++        set_target_properties(qrcAlias PROPERTIES IMPORTED_LOCATION
++            ${CMAKE_BINARY_DIR}/native_qrcAlias-prefix/src/native_qrcAlias-build/qrcAlias)
++    else ()
++        add_subdirectory (qrcAlias)
++    endif()
+
+ function(generate_binary_resource target outfile)
+     set(RESOURCES_WORKING_DIR ${CMAKE_CURRENT_BINARY_DIR}/res)
+diff --git a/qrcAlias/CMakeLists.txt b/qrcAlias/CMakeLists.txt
+new file mode 100644
+index 00000000..4199f2fe
+--- /dev/null
++++ b/qrcAlias/CMakeLists.txt
+@@ -0,0 +1,8 @@
++cmake_minimum_required(VERSION 3.5)
++
++# This lives in a subdirectory to make it easy to switch
++# the toolchain for cross compile.
++
++find_package(Qt5 NO_MODULE REQUIRED Core)
++add_executable(qrcAlias qrcAlias.cpp)
++target_link_libraries(qrcAlias PUBLIC Qt5::Core)
+diff --git a/qrcAlias.cpp b/qrcAlias/qrcAlias.cpp
+similarity index 100%
+rename from qrcAlias.cpp
+rename to qrcAlias/qrcAlias.cpp
+--
+2.20.1
index 3eef90b..b1f417c 100644 (file)
@@ -392,7 +392,8 @@ gpg4win_pkg_kxmlgui_configure = \
     -DXMLGUI_DISTRIBUTION_TEXT="Gpg4win"
 
 gpg4win_pkg_breeze_icons_configure = \
-    -DBINARY_ICONS_RESOURCE=OFF
+    -DBINARY_ICONS_RESOURCE=ON \
+    -DKF5_HOST_TOOLING="/home/aheinecke/dev/main"
 
 # Supported make-only source packages.
 gpg4win_mpkgs = bzip2 zlib