From 7f1b4031463a9dff47dbc705ba1f2f5cdd3a26d2 Mon Sep 17 00:00:00 2001 From: "Jan Alexander Steffens (heftig)" Date: Fri, 19 Oct 2018 17:01:45 +0200 Subject: build: Gather common path variables in root meson.build This eliminates a lot of get_option and some join_paths. --- data/meson.build | 8 ++++---- demo/meson.build | 10 ++++------ libgeoclue/meson.build | 3 --- meson.build | 14 +++++++++++--- public-api/meson.build | 2 -- src/geocode-glib/meson.build | 3 --- src/meson.build | 6 ++---- 7 files changed, 21 insertions(+), 25 deletions(-) diff --git a/data/meson.build b/data/meson.build index f76df0a..f826864 100644 --- a/data/meson.build +++ b/data/meson.build @@ -7,17 +7,17 @@ if get_option('enable-backend') conf.set('demo_agent', '') endif - conf_dir = join_paths(get_option('sysconfdir'), 'geoclue') + conf_dir = join_paths(sysconfdir, 'geoclue') configure_file(output: 'geoclue.conf', input: 'geoclue.conf.in', configuration: conf, install_dir: conf_dir) conf = configuration_data() - conf.set('libexecdir', join_paths(get_option('prefix'), get_option('libexecdir'))) + conf.set('libexecdir', libexecdir) conf.set('dbus_srv_user', get_option('dbus-srv-user')) - service_dir = join_paths(get_option('datadir'), 'dbus-1', 'system-services') + service_dir = join_paths(datadir, 'dbus-1', 'system-services') configure_file(output: 'org.freedesktop.GeoClue2.service', input: 'org.freedesktop.GeoClue2.service.in', configuration: conf, @@ -26,7 +26,7 @@ if get_option('enable-backend') # DBus Service policy file dbus_service_dir = get_option('dbus-sys-dir') if dbus_service_dir == '' - dbus_service_dir = join_paths(get_option('sysconfdir'), 'dbus-1', 'system.d') + dbus_service_dir = join_paths(sysconfdir, 'dbus-1', 'system.d') endif configure_file(output: 'org.freedesktop.GeoClue2.conf', input: 'org.freedesktop.GeoClue2.conf.in', diff --git a/demo/meson.build b/demo/meson.build index a4837f0..99c094f 100644 --- a/demo/meson.build +++ b/demo/meson.build @@ -1,9 +1,9 @@ -desktop_dir = join_paths(get_option('datadir'), 'applications') -demo_dir = join_paths(get_option('libexecdir'), 'geoclue-2.0', 'demos') +desktop_dir = join_paths(datadir, 'applications') +demo_dir = join_paths(libexecdir, 'geoclue-2.0', 'demos') i18n = import('i18n') desktop_conf = configuration_data() -desktop_conf.set('libexecdir', join_paths(get_option('prefix'), get_option('libexecdir'))) +desktop_conf.set('libexecdir', libexecdir) if get_option('libgeoclue') include_dirs = [ configinc, @@ -56,9 +56,7 @@ if get_option('demo-agent') install_dir: desktop_dir) # Also install in the autostart directory. - autostart_dir = join_paths(get_option('prefix'), - get_option('sysconfdir'), - 'xdg', 'autostart') + autostart_dir = join_paths(sysconfdir, 'xdg', 'autostart') meson.add_install_script('install-file.py', desktop_file.full_path(), autostart_dir) diff --git a/libgeoclue/meson.build b/libgeoclue/meson.build index 2ae5af9..ef2761f 100644 --- a/libgeoclue/meson.build +++ b/libgeoclue/meson.build @@ -1,6 +1,3 @@ -header_dir = 'libgeoclue-' + gclue_api_version -include_subdir = join_paths(get_option('includedir'), header_dir) - # FIXME: meson 0.46 doesn't seem to be actually installing the headers # generated by gnome.gdbus_codegen: # diff --git a/meson.build b/meson.build index 393364e..01df757 100644 --- a/meson.build +++ b/meson.build @@ -9,6 +9,15 @@ gclue_micro_version = ver_arr[2] gclue_api_version='2.0' +datadir = join_paths(get_option('prefix'), get_option('datadir')) +includedir = join_paths(get_option('prefix'), get_option('includedir')) +libexecdir = join_paths(get_option('prefix'), get_option('libexecdir')) +sysconfdir = join_paths(get_option('prefix'), get_option('sysconfdir')) +localedir = join_paths(datadir, 'locale') + +header_dir = 'libgeoclue-' + gclue_api_version +include_subdir = join_paths(includedir, header_dir) + conf = configuration_data() conf.set_quoted('VERSION', gclue_version) conf.set_quoted('PACKAGE_VERSION', gclue_version) @@ -19,9 +28,8 @@ conf.set_quoted('PACKAGE_STRING', 'geoclue ' + gclue_version) conf.set_quoted('PACKAGE_URL', 'http://www.freedesktop.org/wiki/Software/GeoClue') conf.set_quoted('PACKAGE_BUGREPORT', 'http://bugs.freedesktop.org/enter_bug.cgi?product=GeoClue') conf.set_quoted('TEST_SRCDIR', meson.source_root() + '/data/') -datadir = join_paths(get_option('prefix'), get_option('datadir')) -conf.set_quoted('LOCALEDIR', join_paths(datadir, 'locale')) -conf.set_quoted('SYSCONFDIR', join_paths(get_option('prefix'), get_option('sysconfdir'))) +conf.set_quoted('LOCALEDIR', localedir) +conf.set_quoted('SYSCONFDIR', sysconfdir) configure_file(output: 'config.h', configuration : conf) configinc = include_directories('.') diff --git a/public-api/meson.build b/public-api/meson.build index 5772aaa..e5e23fe 100644 --- a/public-api/meson.build +++ b/public-api/meson.build @@ -1,8 +1,6 @@ headers = [ 'gclue-enums.h' ] -header_dir = 'libgeoclue-' + gclue_api_version install_headers(headers, subdir: header_dir) -include_subdir = join_paths(get_option('includedir'), header_dir) libgeoclue_public_api_gen_sources = gnome.mkenums_simple( 'gclue-enum-types', diff --git a/src/geocode-glib/meson.build b/src/geocode-glib/meson.build index a29b8a2..17fb435 100644 --- a/src/geocode-glib/meson.build +++ b/src/geocode-glib/meson.build @@ -16,9 +16,6 @@ sources = [ 'geocode-location.h', 'geocode-bounding-box.c', 'geocode-glib-private.h' ] -datadir = join_paths(get_option('prefix'), get_option('datadir')) -localedir = join_paths(datadir, 'locale') - c_args = [ '-DPACKAGE_VERSION="' + gclue_version + '"', '-DGEOCODE_LOCALEDIR="' + localedir + '"' ] libgeocode_glib_inc = include_directories('.', '..', '../..') diff --git a/src/meson.build b/src/meson.build index d33dcf4..4c1a4f9 100644 --- a/src/meson.build +++ b/src/meson.build @@ -1,5 +1,4 @@ -dbus_interface_dir = join_paths(get_option('prefix'), get_option('datadir'), - 'dbus-1', 'interfaces') +dbus_interface_dir = join_paths(datadir, 'dbus-1', 'interfaces') subdir('agent') @@ -119,7 +118,6 @@ endif c_args = [ '-DG_LOG_DOMAIN="Geoclue"' ] link_with = [ libgeoclue_public_api, libgeoclue_agent, libgeocode_glib ] -install_dir = get_option('libexecdir') executable('geoclue', sources, link_with: link_with, @@ -127,7 +125,7 @@ executable('geoclue', c_args: c_args, dependencies: geoclue_deps, install: true, - install_dir: install_dir) + install_dir: libexecdir) dbus_interface = join_paths(dbus_interface_dir, 'org.freedesktop.GeoClue2.xml') agent_dbus_interface = join_paths(dbus_interface_dir, 'org.freedesktop.GeoClue2.Agent.xml') -- cgit v1.2.1