[ghex] build: Split resources between app and library



commit 486de66712f60c54544cf737c31200ff4db93448
Author: Logan Rathbone <poprocks gmail com>
Date:   Mon May 30 02:50:17 2022 -0400

    build: Split resources between app and library
    
    This gets the widget to work properly with language bindings.

 src/ghex.gresource.xml.in      |  4 ---
 src/libgtkhex.gresource.xml.in | 33 +++++++++++++++++++++++
 src/meson.build                | 60 +++++++++++++++++++++++++-----------------
 3 files changed, 69 insertions(+), 28 deletions(-)
---
diff --git a/src/ghex.gresource.xml.in b/src/ghex.gresource.xml.in
index 7c58568..020f256 100644
--- a/src/ghex.gresource.xml.in
+++ b/src/ghex.gresource.xml.in
@@ -26,7 +26,6 @@
 <gresources>
        <gresource prefix="@resource_base_path@">
                <file preprocess="xml-stripblanks" compressed="true">ghex-application-window.ui</file>
-               <file preprocess="xml-stripblanks" compressed="true">context-menu.ui</file>
                <file preprocess="xml-stripblanks" compressed="true">preferences.ui</file>
                <file preprocess="xml-stripblanks" compressed="true">paste-special.ui</file>
                <file preprocess="xml-stripblanks" compressed="true">find-dialog.ui</file>
@@ -34,9 +33,6 @@
                <file preprocess="xml-stripblanks" compressed="true">jump-dialog.ui</file>
                <file preprocess="xml-stripblanks" compressed="true">find-options.ui</file>
        </gresource>
-       <gresource prefix="@resource_base_path@/css">
-               <file>ghex.css</file>
-       </gresource>
        <gresource prefix="@resource_base_path@/gtk">
                <file preprocess="xml-stripblanks">help-overlay.ui</file>
        </gresource>
diff --git a/src/libgtkhex.gresource.xml.in b/src/libgtkhex.gresource.xml.in
new file mode 100644
index 0000000..72e2622
--- /dev/null
+++ b/src/libgtkhex.gresource.xml.in
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- vim:ts=4 sw=4
+-->
+<!--
+   Copyright © 2021 Logan Rathbone <poprocks gmail com>
+
+   GHex is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   GHex is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with GHex; see the file COPYING.
+   If not, write to the Free Software Foundation, Inc.,
+   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+   Original GHex Author: Jaka Mocnik <jaka gnu org>
+-->
+
+<gresources>
+       <gresource prefix="@resource_base_path@">
+               <file preprocess="xml-stripblanks" compressed="true">context-menu.ui</file>
+       </gresource>
+       <gresource prefix="@resource_base_path@/css">
+               <file>ghex.css</file>
+       </gresource>
+</gresources>
diff --git a/src/meson.build b/src/meson.build
index c5f57e8..4091859 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -37,9 +37,44 @@ install_headers(
 osx_current = libgtkhex_version_major + 1
 lib_osx_version = [osx_current, '@0@.@1@'.format(osx_current, libgtkhex_version_minor)]
 
+src_conf = configuration_data()
+src_conf.set('app_id', app_id)
+src_conf.set('resource_base_path', resource_base_path)
+
+app_ui = configure_file(
+  input: 'ghex-application-window.ui.in',
+  output: 'ghex-application-window.ui',
+  configuration: src_conf
+)
+
+lib_res_in = configure_file(
+  input: 'libgtkhex.gresource.xml.in',
+  output: 'libgtkhex.gresource.xml',
+  configuration: src_conf
+)
+
+lib_res = gnome.compile_resources(
+  'libgtkhex-resources',
+  lib_res_in,
+  c_name: 'libgtkhex'
+)
+
+res_in = configure_file(
+  input: 'ghex.gresource.xml.in',
+  output: 'ghex.gresource.xml',
+  configuration: src_conf
+)
+
+res = gnome.compile_resources(
+  'ghex-resources',
+  res_in,
+  c_name: 'ghex',
+  dependencies: app_ui
+)
+
 libgtkhex = library(
   'gtkhex-@0@'.format(libgtkhex_api_version),
-  libgtkhex_sources,
+  libgtkhex_sources + lib_res,
   version: '@0@.@1@.@2@'.format(
     libgtkhex_version_major, libgtkhex_version_minor, libgtkhex_version_micro),
   darwin_versions: lib_osx_version,
@@ -84,29 +119,6 @@ ghex_sources = [
   'print.c',
 ]
 
-src_conf = configuration_data()
-src_conf.set('app_id', app_id)
-src_conf.set('resource_base_path', resource_base_path)
-
-app_ui = configure_file(
-  input: 'ghex-application-window.ui.in',
-  output: 'ghex-application-window.ui',
-  configuration: src_conf
-)
-
-res_in = configure_file(
-  input: 'ghex.gresource.xml.in',
-  output: 'ghex.gresource.xml',
-  configuration: src_conf
-)
-
-res = gnome.compile_resources(
-  'ghex-resources',
-  res_in,
-  c_name: 'ghex',
-  dependencies: app_ui
-)
-
 ghex_c_args = [
   '-DG_LOG_DOMAIN="GHex"'
 ]


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]