diff options
author | Iñigo Martínez <inigomartinez@gmail.com> | 2017-10-31 12:35:34 +0100 |
---|---|---|
committer | Ondrej Holy <oholy@redhat.com> | 2017-10-31 17:08:43 +0100 |
commit | ca7941971f00c4f35223bc903dafba585ada69b5 (patch) | |
tree | f5f469242f4347790c7a75ba03a413de266b5b3e | |
parent | 84da65da37d886add11fd0f07dd386609f2570c7 (diff) | |
download | gvfs-ca7941971f00c4f35223bc903dafba585ada69b5.tar.gz |
build: Improve installation on system pathswip/inigomartinez/meson
Instead of being hardcoded, D-Bus, systemd and GIO modules paths
can be checked by using the information in their correspondant
pkg-config files.
This patch uses the information on pkg-config files by default,
and also allows the user to provide this information to avoid
overwriting system files.
https://bugzilla.gnome.org/show_bug.cgi?id=786149
-rw-r--r-- | client/meson.build | 5 | ||||
-rw-r--r-- | daemon/meson.build | 6 | ||||
-rw-r--r-- | meson.build | 45 | ||||
-rw-r--r-- | meson_options.txt | 6 | ||||
-rw-r--r-- | metadata/meson.build | 6 | ||||
-rw-r--r-- | monitor/afc/meson.build | 6 | ||||
-rw-r--r-- | monitor/gdu/meson.build | 6 | ||||
-rw-r--r-- | monitor/goa/meson.build | 6 | ||||
-rw-r--r-- | monitor/gphoto2/meson.build | 6 | ||||
-rw-r--r-- | monitor/mtp/meson.build | 6 | ||||
-rw-r--r-- | monitor/udisks2/meson.build | 6 |
11 files changed, 60 insertions, 44 deletions
diff --git a/client/meson.build b/client/meson.build index 74ad446e..fd69f94e 100644 --- a/client/meson.build +++ b/client/meson.build @@ -74,11 +74,10 @@ endif # FUSE daemon if enable_fuse - # FIXME: reusing USE_LIBSYSTEMD_LOGIN as systemd has no universal header or pkg-config file - if enable_libsystemd_login + if install_tmp_files_dir install_data( 'gvfsd-fuse-tmpfiles.conf', - install_dir: join_paths(gvfs_libdir, 'tmpfiles.d') + install_dir: tmp_files_dir ) endif diff --git a/daemon/meson.build b/daemon/meson.build index d483a0af..606d83f4 100644 --- a/daemon/meson.build +++ b/daemon/meson.build @@ -7,18 +7,18 @@ daemon_service = configure_file( input: service + '.in', output: service, install: true, - install_dir: gvfs_dbus_service_dir, + install_dir: dbus_service_dir, configuration: service_conf ) -if have_systemd_user_unit +if install_systemd_user_unit_dir service = 'gvfs-daemon.service' configure_file( input: service + '.in', output: service, install: true, - install_dir: systemd_user_dir, + install_dir: systemd_user_unit_dir, configuration: service_conf ) endif diff --git a/meson.build b/meson.build index 1576407b..89d77313 100644 --- a/meson.build +++ b/meson.build @@ -27,10 +27,8 @@ gvfs_pkglibdir = join_paths(gvfs_libdir, gvfs_name) gvfs_rpath = gvfs_pkglibdir -gvfs_dbus_service_dir = join_paths(gvfs_datadir, 'dbus-1', 'services') gvfs_remote_volume_monitors_dir = join_paths(gvfs_pkgdatadir, 'remote-volume-monitors') -gio_module_dir = join_paths(gvfs_libdir, 'gio', 'modules') gvfs_mountdir = join_paths(gvfs_pkgdatadir, 'mounts') gvfs_schema_dir = join_paths(gvfs_datadir, 'glib-2.0', 'schemas') @@ -236,8 +234,10 @@ add_project_arguments(common_flags, language: 'c') ldflag = '-Wl,--version-script' have_version_script = host_machine.system().contains('linux') and cc.has_argument(ldflag) +gio_dep = dependency('gio-2.0') + glib_deps = [ - dependency('gio-2.0'), + gio_dep, dependency('gio-unix-2.0'), dependency('glib-2.0', version: '>= 2.51.0'), dependency('gmodule-no-export-2.0'), @@ -267,18 +267,36 @@ config_h.set('HAVE_GCRYPT', have_gcrypt) # *** Check for dbus service dir *** dbus_service_dir = get_option('with-dbus-service-dir') if dbus_service_dir == '' - dbus_service_dir = join_paths(gvfs_datadir, 'dbus-1', 'services') + dbus_dep = dependency('dbus-1', required: false) + assert(dbus_dep.found(), 'dbus-1 required but not found, please provide a valid D-Bus service dir') + dbus_service_dir = dbus_dep.get_pkgconfig_variable('session_bus_services_dir') +endif + +gio_module_dir = get_option('with-gio-module-dir') +if gio_module_dir == '' + gio_module_dir = gio_dep.get_pkgconfig_variable('giomoduledir') endif -# *** Check for systemd user units *** -systemd_user_dir = get_option('with-systemduserunitdir') -have_systemd_user_unit = (systemd_user_dir != 'no') +# *** Check for systemd options *** +systemd_user_unit_dir = get_option('with-systemduserunitdir') +install_systemd_user_unit_dir = (systemd_user_unit_dir != 'no') -if have_systemd_user_unit - systemd_dep = dependency('systemd', version: '>= 206') +tmp_files_dir = get_option('with-tmpfilesdir') +install_tmp_files_dir = (tmp_files_dir != 'no') - if systemd_user_dir == '' - systemd_user_dir = join_paths(gvfs_libdir, 'systemd', 'user') +if install_systemd_user_unit_dir or install_tmp_files_dir + if systemd_user_unit_dir == '' or tmp_files_dir == '' + systemd_dep = dependency('systemd', version: '>= 206', required: false) + + if install_systemd_user_unit_dir and systemd_user_unit_dir == '' + assert(systemd_dep.found(), 'systemd required but not found, please provide a valid systemd user unit dir or disable it') + systemd_user_unit_dir = systemd_dep.get_pkgconfig_variable('systemduserunitdir') + endif + + if install_tmp_files_dir and tmp_files_dir == '' + assert(systemd_dep.found(), 'systemd not found, if you use opentmpfiles please provide a valid systemd user unit dir or disable it') + tmp_files_dir = systemd_dep.get_pkgconfig_variable('tmpfilesdir') + endif endif endif @@ -339,10 +357,7 @@ endif # *** Check for libsystemd-login *** enable_libsystemd_login = get_option('enable-libsystemd-login') if enable_libsystemd_login - libsystemd_login_dep = dependency('libsystemd', required: false) - if not libsystemd_login_dep.found() - libsystemd_login_dep = dependency('libsystemd-login', version: '>= 44') - endif + libsystemd_login_dep = dependency('libsystemd') endif config_h.set('HAVE_LIBSYSTEMD_LOGIN', enable_libsystemd_login) diff --git a/meson_options.txt b/meson_options.txt index 540535a4..38b62dfb 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,5 +1,7 @@ -option('with-dbus-service-dir', type: 'string', value: '', description: 'choose directory for dbus service files [default=PREFIX/share/dbus-1/services]') -option('with-systemduserunitdir', type: 'string', value: '', description: 'choose directory for systemd user units, or \'no\' to disable [default=PREFIX/lib/systemd/user]') +option('with-dbus-service-dir', type: 'string', value: '', description: 'custom directory for dbus service files') +option('with-gio-module-dir', type: 'string', value: '', description: 'custom directory for gio modules') +option('with-systemduserunitdir', type: 'string', value: '', description: 'custom directory for systemd user units, or \'no\' to disable') +option('with-tmpfilesdir', type: 'string', value: '', description: 'custom directory for tmpfiles.d config files, or \'no\' to disable') option('enable-admin', type: 'boolean', value: true, description: 'build with admin backend') option('enable-afc', type: 'boolean', value: true, description: 'build with afc backend and volume monitor') diff --git a/metadata/meson.build b/metadata/meson.build index 474dd04f..a4f939a5 100644 --- a/metadata/meson.build +++ b/metadata/meson.build @@ -4,18 +4,18 @@ metadata_service = configure_file( input: service + '.in', output: service, install: true, - install_dir: gvfs_dbus_service_dir, + install_dir: dbus_service_dir, configuration: service_conf ) -if have_systemd_user_unit +if install_systemd_user_unit_dir service = 'gvfs-metadata.service' configure_file( input: service + '.in', output: service, install: true, - install_dir: systemd_user_dir, + install_dir: systemd_user_unit_dir, configuration: service_conf ) endif diff --git a/monitor/afc/meson.build b/monitor/afc/meson.build index 776341f0..830f8ccd 100644 --- a/monitor/afc/meson.build +++ b/monitor/afc/meson.build @@ -11,18 +11,18 @@ afc_service = configure_file( input: service + '.in', output: service, install: true, - install_dir: gvfs_dbus_service_dir, + install_dir: dbus_service_dir, configuration: service_conf ) -if have_systemd_user_unit +if install_systemd_user_unit_dir service = 'gvfs-afc-volume-monitor.service' configure_file( input: service + '.in', output: service, install: true, - install_dir: systemd_user_dir, + install_dir: systemd_user_unit_dir, configuration: service_conf ) endif diff --git a/monitor/gdu/meson.build b/monitor/gdu/meson.build index 653faebc..ba865631 100644 --- a/monitor/gdu/meson.build +++ b/monitor/gdu/meson.build @@ -11,18 +11,18 @@ gdu_service = configure_file( input: service + '.in', output: service, install: true, - install_dir: gvfs_dbus_service_dir, + install_dir: dbus_service_dir, configuration: service_conf ) -if have_systemd_user_unit +if install_systemd_user_unit_dir service = 'gvfs-gdu-volume-monitor.service' configure_file( input: service + '.in', output: service, install: true, - install_dir: systemd_user_dir, + install_dir: systemd_user_unit_dir, configuration: service_conf ) endif diff --git a/monitor/goa/meson.build b/monitor/goa/meson.build index 111d8d45..b45007ce 100644 --- a/monitor/goa/meson.build +++ b/monitor/goa/meson.build @@ -9,18 +9,18 @@ configure_file( input: service + '.in', output: service, install: true, - install_dir: gvfs_dbus_service_dir, + install_dir: dbus_service_dir, configuration: service_conf ) -if have_systemd_user_unit +if install_systemd_user_unit_dir service = 'gvfs-goa-volume-monitor.service' configure_file( input: service + '.in', output: service, install: true, - install_dir: systemd_user_dir, + install_dir: systemd_user_unit_dir, configuration: service_conf ) endif diff --git a/monitor/gphoto2/meson.build b/monitor/gphoto2/meson.build index 2cb3128d..7400071b 100644 --- a/monitor/gphoto2/meson.build +++ b/monitor/gphoto2/meson.build @@ -11,18 +11,18 @@ gphoto2_service = configure_file( input: service + '.in', output: service, install: true, - install_dir: gvfs_dbus_service_dir, + install_dir: dbus_service_dir, configuration: service_conf ) -if have_systemd_user_unit +if install_systemd_user_unit_dir service = 'gvfs-gphoto2-volume-monitor.service' configure_file( input: service + '.in', output: service, install: true, - install_dir: systemd_user_dir, + install_dir: systemd_user_unit_dir, configuration: service_conf ) endif diff --git a/monitor/mtp/meson.build b/monitor/mtp/meson.build index 21eb427d..a3468765 100644 --- a/monitor/mtp/meson.build +++ b/monitor/mtp/meson.build @@ -9,18 +9,18 @@ configure_file( input: service + '.in', output: service, install: true, - install_dir: gvfs_dbus_service_dir, + install_dir: dbus_service_dir, configuration: service_conf ) -if have_systemd_user_unit +if install_systemd_user_unit_dir service = 'gvfs-mtp-volume-monitor.service' configure_file( input: service + '.in', output: service, install: true, - install_dir: systemd_user_dir, + install_dir: systemd_user_unit_dir, configuration: service_conf ) endif diff --git a/monitor/udisks2/meson.build b/monitor/udisks2/meson.build index 44e49232..995b3008 100644 --- a/monitor/udisks2/meson.build +++ b/monitor/udisks2/meson.build @@ -11,18 +11,18 @@ udisks2_service = configure_file( input: service + '.in', output: service, install: true, - install_dir: gvfs_dbus_service_dir, + install_dir: dbus_service_dir, configuration: service_conf ) -if have_systemd_user_unit +if install_systemd_user_unit_dir service = 'gvfs-udisks2-volume-monitor.service' configure_file( input: service + '.in', output: service, install: true, - install_dir: systemd_user_dir, + install_dir: systemd_user_unit_dir, configuration: service_conf ) endif |