diff --git a/Makefile.in b/Makefile.in index 06dad2990..3d8c83354 100644 --- a/Makefile.in +++ b/Makefile.in @@ -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 @@ -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 diff --git a/meson.build b/meson.build index ecfbd1892..bc28d3bbb 100644 --- a/meson.build +++ b/meson.build @@ -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 diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 000000000..0501737b5 --- /dev/null +++ b/meson_options.txt @@ -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') diff --git a/umu/meson.build b/umu/meson.build index 50529e5e2..6245101bd 100644 --- a/umu/meson.build +++ b/umu/meson.build @@ -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', @@ -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', ) @@ -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') diff --git a/umu/umu-launcher/meson.build b/umu/umu-launcher/meson.build index a4441f95b..585cb57d8 100644 --- a/umu/umu-launcher/meson.build +++ b/umu/umu-launcher/meson.build @@ -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', ) @@ -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()), ) diff --git a/umu/umu-run.in b/umu/umu-run.in index d7d2ef586..3428375eb 100755 --- a/umu/umu-run.in +++ b/umu/umu-run.in @@ -1,3 +1,3 @@ #!/usr/bin/env sh -@INSTALL_PATH@/umu_run.py "$@" +@INSTALL_PATH@ "$@"