Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Meson build system #53

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,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 @@ -47,9 +47,11 @@ version-install: version
install -Dm 644 umu/umu_version.json -t $(DESTDIR)$(DATADIR)/$(INSTALLDIR)


UMU_RUN_COMMAND = $(DATADIR)/$(INSTALLDIR)/umu_run.py

$(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@|$(UMU_RUN_COMMAND)|g' umu/umu-run.in > $(OBJDIR)/umu-run
touch $(@)

.PHONY: umu
Expand Down Expand Up @@ -93,16 +95,17 @@ else
umu-install: version-install umu-dist-install umu-docs-install umu-bin-install
endif


ifeq ($(FLATPAK), xtrue)
UMU_LAUNCHER_COMMAND = org.openwinecomponents.umu.launcher
else
UMU_LAUNCHER_COMMAND = $(DATADIR)/$(INSTALLDIR)/umu_run.py
UMU_LAUNCHER_COMMAND = $(UMU_RUN_COMMAND)
endif

# 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##|$(UMU_LAUNCHER_COMMAND)|g' umu/umu-launcher/umu-run.in > $(OBJDIR)/umu-launcher-run
sed 's|@INSTALL_PATH@|$(UMU_LAUNCHER_COMMAND)|g' umu/umu-launcher/umu-run.in > $(OBJDIR)/umu-launcher-run
touch $(@)

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

man_1 = custom_target('man1',
input : 'umu.1.scd',
output : 'umu.1',
command : [ scdoc ],
feed : true,
capture : true,
)

man_5 = custom_target('man5',
input : 'umu.5.scd',
output : 'umu.5',
command : [ scdoc ],
feed : true,
capture : true,
)

install_man(man_1.full_path())
install_man(man_5.full_path())
20 changes: 20 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
project('umu',
['cpp'],
license : 'GPL-3.0-only',
license_files : ['LICENSE'],
)

# 'libdir' is likely a more conformant target directory than 'datadir'
umu_install_path = get_option('datadir') / meson.project_name()

subproject('reaper',
default_options : [
'prefix=' + get_option('prefix'),
'bindir=' + get_option('prefix') / umu_install_path,
],
)

subdir('umu')
if not get_option('flatpak')
subdir('docs')
endif
2 changes: 2 additions & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
option('flatpak', type : 'boolean', value : false, description: 'Build for Flatpak distribution')
#option('user_install', type : 'boolean', value : false, description: 'Install under current user\'s home directory')
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_cfg = configuration_data()
umu_run_cfg.set('INSTALL_PATH', get_option('prefix') / umu_install_path / 'umu_run.py')
configure_file(
input : 'umu-run.in',
output : 'umu-run',
configuration : umu_run_cfg,
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: umu_install_path,
)
install_data(
[
'umu_run.py',
],
install_dir: umu_install_path,
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: umu_install_path,
)

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

umu_run_launcher_cfg = configuration_data()
if get_option('flatpak')
umu_run_launcher_cfg.set('INSTALL_PATH', 'org.openwinecomponents.umu.launcher')
else
umu_run_launcher_cfg.set('INSTALL_PATH', umu_run_cfg.get('INSTALL_PATH'))
endif

configure_file(
input : 'umu-run.in',
output : 'umu-run',
configuration : umu_run_launcher_cfg,
install : true,
install_dir : umu_install_path / fs.name(meson.current_source_dir()),
install_mode: 'rwxr-xr-x',
)

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

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

@INSTALL_PATH@ "$@"
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