Skip to content

Commit

Permalink
build: Add meson build system.
Browse files Browse the repository at this point in the history
Squashed commits due to rename:
* meson: Update reaper default_options (doesn't work)
* meson: Generate version information for `ULWGL_VERSIONS.json`
* meson: Use meson string interpolation
* meson: Add man pages to meson
* meson: Use configure_file instead of sed
* meson: Use ulwgl version for reaper too
* meson: Rename ulwgl to umu
  • Loading branch information
loathingKernel committed Mar 21, 2024
1 parent 4b19aef commit 3059fa7
Show file tree
Hide file tree
Showing 9 changed files with 120 additions and 9 deletions.
8 changes: 4 additions & 4 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ endif
umu/umu_version.json: umu/umu_version.json.in
$(info :: Updating $(@) )
cp $(<) $(<).tmp
sed 's|##UMU_VERSION##|$(shell git describe --always --long --tags)|g' -i $(<).tmp
sed 's|##REAPER_VERSION##|$(shell git describe --always --long --tags)|g' -i $(<).tmp
sed 's|@UMU_VERSION@|$(shell git describe --always --long --tags)|g' -i $(<).tmp
sed 's|@REAPER_VERSION@|$(shell git describe --always --long --tags)|g' -i $(<).tmp
mv $(<).tmp $(@)

.PHONY: version
Expand All @@ -44,7 +44,7 @@ version-install: version

$(OBJDIR)/.build-umu: | $(OBJDIR)
$(info :: Building umu )
sed 's|##INSTALL_PATH##|$(DATADIR)/$(INSTALLDIR)|g' umu/umu-run.in > $(OBJDIR)/umu-run
sed 's|@INSTALL_PATH@|$(DATADIR)/$(INSTALLDIR)|g' umu/umu-run.in > $(OBJDIR)/umu-run
touch $(@)

.PHONY: umu
Expand Down Expand Up @@ -88,7 +88,7 @@ umu-install: version-install umu-dist-install umu-docs-install umu-bin-install
# umu-launcher is separate to allow control over installing the bin target
$(OBJDIR)/.build-umu-launcher: | $(OBJDIR)
$(info :: Building umu-launcher )
sed 's|##INSTALL_PATH##|$(DATADIR)/$(INSTALLDIR)|g' umu/umu-launcher/umu-run.in > $(OBJDIR)/umu-launcher-run
sed 's|@INSTALL_PATH@|$(DATADIR)/$(INSTALLDIR)|g' umu/umu-launcher/umu-run.in > $(OBJDIR)/umu-launcher-run
touch $(@)

.PHONY: umu-launcher
Expand Down
21 changes: 21 additions & 0 deletions docs/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
scdoc = find_program('scdoc')

custom_target('man1',
input : 'umu.1.scd',
output : 'umu.1',
command : [ scdoc ],
feed : true,
capture : true,
install : true,
install_dir : get_option('mandir'),
)

custom_target('man5',
input : 'umu.5.scd',
output : 'umu.5',
command : [ scdoc ],
feed : true,
capture : true,
install : true,
install_dir : get_option('mandir'),
)
15 changes: 15 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
project('umu',
['cpp'],
license : 'GPL-3.0-only',
license_files : ['LICENSE'],
)

subproject('reaper',
default_options : [
'prefix=' + get_option('prefix'),
'bindir=' + get_option('prefix') / get_option('datadir') / meson.project_name(),
],
)

subdir('umu')
subdir('docs')
8 changes: 8 additions & 0 deletions subprojects/reaper.wrap
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[wrap-git]
directory = reaper
url = https://github.com/Plagman/reaper.git
revision = head
depth = 1

[provide]
program_names = reaper
49 changes: 49 additions & 0 deletions umu/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
git = find_program('git')

umu_run_data = configuration_data()
umu_run_data.set('INSTALL_PATH', get_option('prefix') / get_option('datadir') / meson.project_name())
configure_file(
input : 'umu-run.in',
output : 'umu-run',
configuration : umu_run_data,
install : true,
install_dir : get_option('bindir'),
install_mode: 'rwxr-xr-x',
)

install_data(
[
'umu_consts.py',
'umu_dl_util.py',
'umu_log.py',
'umu_plugins.py',
'umu_util.py',
],
install_dir: get_option('datadir') / meson.project_name(),
)
install_data(
[
'umu_run.py',
],
install_dir: get_option('datadir') / meson.project_name(),
install_mode: 'rwxr-xr-x',
)

umu_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()
umu_version_data = configuration_data()
umu_version_data.set('UMU_VERSION', umu_desc)
umu_version_data.set('REAPER_VERSION', umu_desc)
configure_file(
input : 'umu_version.json.in',
output : 'umu_version.json',
configuration : umu_version_data,
install : true,
install_dir: get_option('datadir') / meson.project_name(),
)

subdir('umu-launcher')
18 changes: 18 additions & 0 deletions umu/umu-launcher/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
fs = import('fs')

configure_file(
input : 'umu-run.in',
output : 'umu-run',
configuration : umu_run_data,
install : false,
install_dir : get_option('datadir') / meson.project_name() / fs.name(meson.current_source_dir()),
install_mode: 'rwxr-xr-x',
)

install_data(
[
'compatibilitytool.vdf',
'toolmanifest.vdf'
],
install_dir: get_option('datadir') / meson.project_name() / fs.name(meson.current_source_dir()),
)
2 changes: 1 addition & 1 deletion umu/umu-launcher/umu-run.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env sh
##INSTALL_PATH##/umu_run.py "$@"
@INSTALL_PATH@/umu_run.py "$@"

2 changes: 1 addition & 1 deletion umu/umu-run.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env sh
##INSTALL_PATH##/umu_run.py "$@"
@INSTALL_PATH@/umu_run.py "$@"

6 changes: 3 additions & 3 deletions umu/umu_version.json.in
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"umu": {
"versions": {
"launcher": "##UMU_VERSION##",
"runner": "##UMU_VERSION##",
"launcher": "@UMU_VERSION@",
"runner": "@UMU_VERSION@",
"runtime_platform": "sniper_platform_0.20240125.75305",
"reaper": "##REAPER_VERSION##",
"reaper": "@REAPER_VERSION@",
"pressure_vessel": "v0.20240212.0"
}
}
Expand Down

0 comments on commit 3059fa7

Please sign in to comment.