Skip to content

Commit

Permalink
meson: add flatpak build option
Browse files Browse the repository at this point in the history
* the `flatpak` option disables docs and uses the flatpak as the
command to run in the steam tool

* update both meson and make to inherit the command used in `umu-launcher`
steam tool from the system-wide entry point for system packages
  • Loading branch information
loathingKernel committed Apr 9, 2024
1 parent 55fbcc2 commit 4567383
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 17 deletions.
7 changes: 5 additions & 2 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -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,10 +95,11 @@ 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
Expand Down
9 changes: 7 additions & 2 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,17 @@ project('umu',
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') / get_option('datadir') / meson.project_name(),
'bindir=' + get_option('prefix') / umu_install_path,
],
)

subdir('umu')
subdir('docs')
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')
12 changes: 6 additions & 6 deletions umu/meson.build
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
git = find_program('git')

umu_run_data = configuration_data()
umu_run_data.set('INSTALL_PATH', get_option('prefix') / get_option('datadir') / meson.project_name())
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_data,
configuration : umu_run_cfg,
install : true,
install_dir : get_option('bindir'),
install_mode: 'rwxr-xr-x',
Expand All @@ -19,13 +19,13 @@ install_data(
'umu_plugins.py',
'umu_util.py',
],
install_dir: get_option('datadir') / meson.project_name(),
install_dir: umu_install_path,
)
install_data(
[
'umu_run.py',
],
install_dir: get_option('datadir') / meson.project_name(),
install_dir: umu_install_path,
install_mode: 'rwxr-xr-x',
)

Expand All @@ -43,7 +43,7 @@ configure_file(
output : 'umu_version.json',
configuration : umu_version_data,
install : true,
install_dir: get_option('datadir') / meson.project_name(),
install_dir: umu_install_path,
)

subdir('umu-launcher')
15 changes: 11 additions & 4 deletions umu/umu-launcher/meson.build
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
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_data,
install : false,
install_dir : get_option('datadir') / meson.project_name() / fs.name(meson.current_source_dir()),
configuration : umu_run_launcher_cfg,
install : true,
install_dir : umu_install_path / fs.name(meson.current_source_dir()),
install_mode: 'rwxr-xr-x',
)

Expand All @@ -14,5 +21,5 @@ install_data(
'compatibilitytool.vdf',
'toolmanifest.vdf'
],
install_dir: get_option('datadir') / meson.project_name() / fs.name(meson.current_source_dir()),
install_dir: umu_install_path / fs.name(meson.current_source_dir()),
)
1 change: 0 additions & 1 deletion 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@ "$@"

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

0 comments on commit 4567383

Please sign in to comment.