meson: fixed some install_relative issues

This commit is contained in:
Andrei Alexeyev 2017-11-28 15:46:28 +02:00 committed by Martin Herkt
parent 0dcbc6bcf4
commit 22505e5ff7
3 changed files with 25 additions and 11 deletions

View file

@ -122,9 +122,16 @@ else
endif
endif
if get_option('install_freedesktop') == 'auto'
install_xdg = not config.get('TAISEI_BUILDCONF_RELATIVE_DATA_PATH')
else
install_xdg = get_option('install_freedesktop') == 'true'
endif
if config.get('TAISEI_BUILDCONF_RELATIVE_DATA_PATH')
data_path = 'data'
doc_path = '.'
doc_path = ''
xdg_path = 'freedesktop.org'
if macos_app_bundle
# This is relative to SDL_GetBasePath(), which will return '/path/to/Taisei.app/Contents/Resources' for a macOS bundle.
@ -132,6 +139,9 @@ if config.get('TAISEI_BUILDCONF_RELATIVE_DATA_PATH')
# Actual installation path
data_path = join_paths(datadir, data_path)
# I don't know why would you do that, but more power to you
xdg_path = join_paths(datadir, xdg_path)
else
# HACK
rel_dpath = []
@ -142,12 +152,13 @@ if config.get('TAISEI_BUILDCONF_RELATIVE_DATA_PATH')
endforeach
rel_dpath += data_path
config.set_quoted('TAISEI_BUILDCONF_DATA_PATH', format(join_paths(rel_dpath)))
config.set_quoted('TAISEI_BUILDCONF_DATA_PATH', join_paths(rel_dpath))
endif
else
data_path = join_paths(datadir, 'taisei')
config.set_quoted('TAISEI_BUILDCONF_DATA_PATH', join_paths(get_option('prefix'), data_path))
doc_path = join_paths(datadir, 'doc', 'taisei')
xdg_path = data_path
endif
if get_option('buildtype').startswith('debug')
@ -195,9 +206,12 @@ Summary:
taisei_deps.contains(dep_zip),
config.get('TAISEI_BUILDCONF_RELATIVE_DATA_PATH'),
get_option('prefix'),
bindir,
data_path,
doc_path,
# the $ is intentional
join_paths('$prefix', bindir),
join_paths('$prefix', data_path),
join_paths('$prefix', doc_path),
get_option('buildtype'),
taisei_version_string
)

View file

@ -2,10 +2,10 @@ option('version_fallback', type : 'string', description : 'Overrides the version
option('enable_audio', type : 'combo', choices : ['auto', 'true', 'false'], description : 'Enable audio support (needs SDL2_mixer)')
option('package_data', type : 'combo', choices : ['auto', 'true', 'false'], description : 'Package the games assets into a compressed archive instead of bundling plain files (needs libzip)')
option('install_relative', type : 'combo', choices : ['auto', 'true', 'false'], description : 'Use only relative paths to the executable and install everything in the same directory. Always enabled for macOS bundles')
option('install_freedesktop', type : 'combo', choices : ['auto', 'true', 'false'], description : 'Install freedesktop.org integration files (launchers, icons, replay file associations, etc.). Mostly relevant for Linux/BSD/etc. desktop systems')
option('win_console', type : 'boolean', value : false, description : 'Use the console subsystem on Windows')
option('static', type : 'boolean', value : false, description : 'Build statically linked executable')
option('intel_intrin', type : 'boolean', value : true, description : 'Use some x86-specific intrinsics for optimizations where appropriate (if possible). Note that this is not equivalent to e.g. supplying -march in CFLAGS')
option('macos_bundle', type : 'boolean', value : true, description : 'Make a macOS application bundle on install (ignored on other platforms)')
option('macos_lib_path', type : 'string', description : 'List of paths (separated like the PATH environment variable) from where required runtime libraries will be copied into the bundle (useful for cross-compiling)')
option('macos_tool_path', type : 'string', description : 'List of paths (separated like the PATH environment variable) from where macOS-specific utilities (such as otool and install_name_tool) can be found. This is prepended to PATH (useful for cross-compiling)')

View file

@ -1,10 +1,10 @@
if host_machine.system() != 'windows' and host_machine.system() != 'darwin'
if install_xdg
install_data('taisei-replay-viewer.desktop', 'taisei.desktop',
install_dir : join_paths(get_option('datadir'), 'applications'))
install_dir : join_paths(xdg_path, 'applications'))
install_data('taisei.png',
install_dir : join_paths(get_option('datadir'), 'icons/hicolor/128x128/apps'))
install_dir : join_paths(xdg_path, 'icons/hicolor/128x128/apps'))
install_data('taisei-replay.png',
install_dir : join_paths(get_option('datadir'), 'icons/hicolor/256x256/mimetypes'))
install_dir : join_paths(xdg_path, 'icons/hicolor/256x256/mimetypes'))
install_data('taisei.xml',
install_dir : join_paths(get_option('datadir'), 'mime/packages'))
install_dir : join_paths(xdg_path, 'mime/packages'))
endif