From 7fb4bbf13d7bf8ad850cce0e05731dba90175bbf Mon Sep 17 00:00:00 2001 From: Stelios Tsampas Date: Sun, 3 Mar 2024 19:09:44 +0200 Subject: [PATCH] Generate version information for `ULWGL_VERSIONS.json` --- ULWGL/meson.build | 40 +++++++++++++++++++++++++++++++++------- meson.build | 12 ++++++------ subprojects/reaper.wrap | 3 +++ 3 files changed, 42 insertions(+), 13 deletions(-) diff --git a/ULWGL/meson.build b/ULWGL/meson.build index f8a0aa515..9336d4518 100644 --- a/ULWGL/meson.build +++ b/ULWGL/meson.build @@ -1,3 +1,19 @@ +sed = find_program('sed') +git = find_program('git') + +ulwgl_run = custom_target('ulwgl_run', + input : 'ulwgl-run.in', + output : 'ulwgl-run', + command : [ + sed, + '-e', 's|##INSTALL_PATH##|' + get_option('prefix') / get_option('datadir') / meson.project_name() + '|g', + '@INPUT@' + ], + capture : true, + install : true, + install_dir : get_option('bindir'), +) + install_data( [ 'ulwgl_consts.py', @@ -5,7 +21,6 @@ install_data( 'ulwgl_log.py', 'ulwgl_plugins.py', 'ulwgl_util.py', - 'ULWGL_VERSION.json', ], install_dir: get_option('datadir') / meson.project_name(), ) @@ -16,14 +31,25 @@ install_data( install_dir: get_option('datadir') / meson.project_name(), install_mode: 'rwxr-xr-x', ) -sed = find_program('sed') -ulwgl_run = custom_target('ulwgl_run', - input : 'ulwgl-run.in', - output : 'ulwgl-run', - command : [sed, 's|##INSTALL_PATH##|' + get_option('prefix') / get_option('datadir') / meson.project_name() + '|g', '@INPUT@'], + +ulwgl_desc = run_command( + git, '-C', meson.source_root(), 'describe', '--always', '--long', '--tags', check: true +).stdout().strip() +reaper_desc = run_command( + git, '-C', meson.source_root() / 'subprojects/reaper', 'describe', '--always', '--long', '--tags', check: true +).stdout().strip() +ulwgl_version = custom_target( + input : 'ULWGL_VERSION.json.in', + output : 'ULWGL_VERSION.json', + command : [ + sed, + '-e', 's|##ULWGL_VERSION##|' + ulwgl_desc + '|g', + '-e', 's|##REAPER_VERSION##|' + reaper_desc + '|g', + '@INPUT@' + ], capture : true, install : true, - install_dir : get_option('bindir'), + install_dir: get_option('datadir') / meson.project_name(), ) subdir('ULWGL-Launcher') diff --git a/meson.build b/meson.build index 3f757b34b..4d5c1d851 100644 --- a/meson.build +++ b/meson.build @@ -1,14 +1,14 @@ project('ulwgl', ['cpp'], - license : 'GPL-3.0-only' + license : 'GPL-3.0-only', + license_files : ['LICENSE'], ) -reaper_options = [ - 'prefix=' + get_option('prefix'), - 'bindir=' + get_option('prefix') / get_option('datadir') / meson.project_name(), -] reaper = subproject('reaper', - default_options : reaper_options + default_options : [ + 'prefix=' + get_option('prefix'), + 'bindir=' + get_option('prefix') / get_option('datadir') / meson.project_name(), + ], ) subdir('ULWGL') diff --git a/subprojects/reaper.wrap b/subprojects/reaper.wrap index e17b5ffd1..1b456d6cc 100644 --- a/subprojects/reaper.wrap +++ b/subprojects/reaper.wrap @@ -3,3 +3,6 @@ directory = reaper url = https://github.com/Plagman/reaper.git revision = head depth = 1 + +[provide] +program_names = reaper