From 18a31edc9028192ac18b5dbba5108d48e48ff98a Mon Sep 17 00:00:00 2001
From: Bruce Cowan <bruce@bcowan.me.uk>
Date: Tue, 28 Jul 2020 14:17:03 +0100
Subject: [PATCH] Build system improvements

Add compiled schemas to the binary
Use standard VCS tagging system
---
 data/meson.build |  2 +-
 meson.build      | 20 +++++++++++---------
 src/meson.build  |  7 +++----
 3 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/data/meson.build b/data/meson.build
index 8724dc3..32f4a52 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -6,7 +6,7 @@ resources = gnome.compile_resources('gen-resources',
                                     'rugby.gresource.xml',
                                     source_dir: 'data')
 
-gnome.compile_schemas(
+compiled_schemas = gnome.compile_schemas(
   build_by_default: true,
   depend_files: 'uk.me.bcowan.Rugby.gschema.xml',
 )
diff --git a/meson.build b/meson.build
index 842783a..08fd6fd 100644
--- a/meson.build
+++ b/meson.build
@@ -15,15 +15,17 @@ gio_dep = dependency('gio-2.0', version: '>= 2.44')
 gtk_dep = dependency('gtk+-3.0', version: '>= 3.16')
 
 conf = configuration_data()
-
-git = find_program('git', required: false)
-if git.found()
-    VERSION = run_command('git', 'describe', '--always').stdout().strip()
-else
-    VERSION = meson.version()
-endif
-
-conf.set_quoted('VERSION', VERSION)
+conf.set_quoted('VERSION','@VCS_TAG@')
+
+config_h = declare_dependency(
+  sources: vcs_tag(
+    input: configure_file(
+      output: 'config.h.in',
+      configuration: conf
+    ),
+    output: 'config.h',
+  )
+)
 
 cflags = []
 cflags += ['-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_44',
diff --git a/src/meson.build b/src/meson.build
index ca4bb92..bace1d8 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -1,4 +1,5 @@
 # SPDX-FileCopyrightText: 2016-2020 Bruce Cowan <bruce@bcowan.me.uk>
+#
 # SPDX-License-Identifier: CC0-1.0
 sources = [
     'main.c',
@@ -9,10 +10,8 @@ sources = [
     'rugby-pref-window.c',
 ]
 
-config_h = configure_file(configuration: conf, output: 'config.h')
-
 executable('rugby',
-           sources, resources, config_h,
-           dependencies: [gio_dep, gtk_dep],
+           sources, resources, compiled_schemas,
+           dependencies: [config_h, gio_dep, gtk_dep],
            install_dir: get_option('bindir'),
            install: true)
-- 
GitLab