aboutsummaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
authorMarvin W <git@larma.de>2026-08-22 16:21:13 +0200
committerMarvin W <git@larma.de>2026-10-23 16:58:29 +0200
commitc71601077699df8464fce4cf9dc11bea598c071e (patch)
tree7d2e785dc45c0707638c0752b67f07646b356fa6 /meson.build
parentd34b9fcb37fa79738582392e194e76651cd4adc2 (diff)
Use meson native project version
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build45
1 files changed, 31 insertions, 14 deletions
diff --git a/meson.build b/meson.build
index eb372b6a..0fbe797d 100644
--- a/meson.build
+++ b/meson.build
@@ -1,9 +1,37 @@
-project('Dino', 'c', 'cpp', 'vala', license: 'GPL-3.0', meson_version: '>=1.3.0')
+project(
+ 'Dino',
+ 'c', 'cpp', 'vala',
+ license: 'GPL-3.0',
+ meson_version: '>=1.3.0',
+ version: run_command(
+ find_program('python3', required: true), # Can't use import('python').find_installation() here
+ meson.current_source_dir() / 'build-aux' / 'version.py',
+ meson.current_source_dir() / 'VERSION',
+ '--git-repo', meson.current_source_dir(),
+ '--git', find_program('git', required: false),
+ check: true
+ ).stdout().strip()
+)
-fs = import('fs')
gnome = import('gnome')
i18n = import('i18n')
-python = import('python')
+
+# Trigger recomnfiguration on version change
+version_stamp = configure_file(
+ command: [
+ # Keep in sync with above
+ find_program('python3', required: true),
+ meson.current_source_dir() / 'build-aux' / 'version.py',
+ meson.current_source_dir() / 'VERSION',
+ '--git-repo', meson.current_source_dir(),
+ '--git', find_program('git', required: false),
+ # Trigger depfile generation
+ '--depfile', '@DEPFILE@'
+ ],
+ input: 'build-aux' / 'version.py',
+ output: 'version.stamp',
+ depfile: 'version.d'
+)
# plugin_crypto is enabled if any of the crypto plugins is enabled, auto if
# none of them are explicitly enabled but at least one is set to auto, or
@@ -53,17 +81,6 @@ if not dep_webrtc_audio_processing.found()
dep_webrtc_audio_processing = disabler()
endif
-prog_git = find_program('git', required: false)
-prog_python = python.find_installation()
-
-if import('fs').is_file('VERSION') and meson.version().version_compare('>=1.4.0')
- version_file = files('VERSION')[0]
- version_file_path = version_file.full_path()
-else
- version_file = 'invalid'
- version_file_path = meson.current_source_dir() / 'VERSION'
-endif
-
default_install_rpath = ''
if get_option('set-install-rpath')
default_install_rpath = get_option('prefix') / get_option('libdir')