build: Refactor directory selection

Previously, the various install paths were obtained using get_option
as needed.

This patch unifies the directory selection inside the top-level meson
file as requested in https://github.com/hughsie/colord/pull/62.
This commit is contained in:
Jan Tojnar 2017-11-17 17:28:11 +01:00 committed by Richard Hughes
parent 5b02c70d93
commit cc9f934787
10 changed files with 50 additions and 56 deletions

View File

@ -1,3 +1,3 @@
install_data('README.md',
install_dir : join_paths(get_option('localstatedir'), 'lib', 'fwupd', 'builder')
install_dir : join_paths(localstatedir, 'lib', 'fwupd', 'builder')
)

View File

@ -1,11 +1,7 @@
con2 = configuration_data()
con2.set('installedtestsdir',
join_paths(get_option('prefix'),
get_option('datadir'),
'installed-tests', 'fwupd'))
con2.set('bindir',
join_paths(get_option('prefix'),
get_option('bindir')))
join_paths(datadir, 'installed-tests', 'fwupd'))
con2.set('bindir', bindir)
configure_file(
input : 'fwupdmgr.test.in',

View File

@ -8,19 +8,19 @@ if get_option('enable-tests')
endif
install_data(['daemon.conf'],
install_dir : join_paths(get_option('sysconfdir'), 'fwupd')
install_dir : join_paths(sysconfdir, 'fwupd')
)
install_data(['org.freedesktop.fwupd.metainfo.xml'],
install_dir: join_paths(get_option('datadir'), 'metainfo')
install_dir: join_paths(datadir, 'metainfo')
)
install_data(['org.freedesktop.fwupd.conf'],
install_dir : join_paths(get_option('sysconfdir'), 'dbus-1', 'system.d')
install_dir : join_paths(sysconfdir, 'dbus-1', 'system.d')
)
install_data(['metadata.xml'],
install_dir : join_paths(get_option('datadir'), 'fwupd', 'remotes.d', 'fwupd')
install_dir : join_paths(datadir, 'fwupd', 'remotes.d', 'fwupd')
)
install_data(['90-fwupd-devices.rules'],
@ -28,14 +28,10 @@ install_data(['90-fwupd-devices.rules'],
)
con2 = configuration_data()
con2.set('libexecdir',
join_paths(get_option('prefix'),
get_option('libexecdir')))
con2.set('bindir',
join_paths(get_option('prefix'),
get_option('bindir')))
con2.set('localstatedir', join_paths(get_option('localstatedir')))
con2.set('datadir', join_paths(get_option('datadir')))
con2.set('libexecdir', libexecdir)
con2.set('bindir', bindir)
con2.set('localstatedir', localstatedir)
con2.set('datadir', datadir)
con2.set('bootdir', get_option('with-bootdir'))
con2.set('sysconfdir', default_sysconfdir)
@ -45,7 +41,7 @@ configure_file(
output : 'org.freedesktop.fwupd.service',
configuration : con2,
install: true,
install_dir: join_paths(get_option('datadir'),
install_dir: join_paths(datadir,
'dbus-1',
'system-services'),
)

View File

@ -3,13 +3,13 @@ if get_option('enable-gpg')
'GPG-KEY-Hughski-Limited',
'GPG-KEY-Linux-Vendor-Firmware-Service',
],
install_dir : join_paths(get_option('sysconfdir'), 'pki', 'fwupd')
install_dir : join_paths(sysconfdir, 'pki', 'fwupd')
)
install_data([
'GPG-KEY-Linux-Vendor-Firmware-Service',
],
install_dir : join_paths(get_option('sysconfdir'), 'pki', 'fwupd-metadata')
install_dir : join_paths(sysconfdir, 'pki', 'fwupd-metadata')
)
endif
@ -17,12 +17,12 @@ if get_option('enable-pkcs7')
install_data([
'LVFS-CA.pem',
],
install_dir : join_paths(get_option('sysconfdir'), 'pki', 'fwupd')
install_dir : join_paths(sysconfdir, 'pki', 'fwupd')
)
install_data([
'LVFS-CA.pem',
],
install_dir : join_paths(get_option('sysconfdir'), 'pki', 'fwupd-metadata')
install_dir : join_paths(sysconfdir, 'pki', 'fwupd-metadata')
)
endif

View File

@ -3,28 +3,28 @@ if get_option('enable-lvfs')
'lvfs.conf',
'lvfs-testing.conf',
],
install_dir : join_paths(get_option('sysconfdir'), 'fwupd', 'remotes.d')
install_dir : join_paths(sysconfdir, 'fwupd', 'remotes.d')
)
endif
install_data('README.md',
install_dir : join_paths(get_option('datadir'), 'fwupd', 'remotes.d', 'vendor', 'firmware')
install_dir : join_paths(datadir, 'fwupd', 'remotes.d', 'vendor', 'firmware')
)
# replace @datadir@
con2 = configuration_data()
con2.set('datadir', join_paths(get_option('prefix'), get_option('datadir')))
con2.set('datadir', datadir)
configure_file(
input : 'fwupd.conf',
output : 'fwupd.conf',
configuration : con2,
install: true,
install_dir: join_paths(get_option('sysconfdir'), 'fwupd', 'remotes.d'),
install_dir: join_paths(sysconfdir, 'fwupd', 'remotes.d'),
)
configure_file(
input : 'vendor.conf',
output : 'vendor.conf',
configuration : con2,
install: true,
install_dir: join_paths(get_option('sysconfdir'), 'fwupd', 'remotes.d'),
install_dir: join_paths(sysconfdir, 'fwupd', 'remotes.d'),
)

View File

@ -223,6 +223,17 @@ if get_option('enable-consolekit')
conf.set('HAVE_CONSOLEKIT' , '1')
endif
prefix = get_option('prefix')
bindir = join_paths(prefix, get_option('bindir'))
libdir = join_paths(prefix, get_option('libdir'))
datadir = join_paths(prefix, get_option('datadir'))
libexecdir = join_paths(prefix, get_option('libexecdir'))
sysconfdir = join_paths(prefix, get_option('sysconfdir'))
localstatedir = join_paths(prefix, get_option('localstatedir'))
mandir = join_paths(prefix, get_option('mandir'))
localedir = join_paths(prefix, get_option('localedir'))
systemdunitdir = get_option('with-systemdunitdir')
if systemdunitdir == '' and get_option('enable-systemd')
systemdunitdir = systemd.get_pkgconfig_variable('systemdsystemunitdir')
@ -236,21 +247,15 @@ endif
gnome = import('gnome')
i18n = import('i18n')
plugin_dir = join_paths(get_option('prefix'),
get_option('libdir'),
'fwupd-plugins-3')
plugin_dir = join_paths(libdir, 'fwupd-plugins-3')
conf.set_quoted('BINDIR',
join_paths(get_option('prefix'),
get_option('bindir')))
conf.set_quoted('LIBEXECDIR',
join_paths(get_option('prefix'),
get_option('libexecdir')))
conf.set_quoted('BINDIR', bindir)
conf.set_quoted('LIBEXECDIR', libexecdir)
conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
conf.set_quoted('PACKAGE_NAME', meson.project_name())
conf.set_quoted('VERSION', meson.project_version())
conf.set_quoted('LOCALEDIR', get_option('localedir'))
conf.set_quoted('LOCALEDIR', localedir)
configure_file(
output : 'config.h',
configuration : conf
@ -262,9 +267,6 @@ if default_sysconfdir == 'etc'
default_sysconfdir = '/etc'
endif
localstatedir = join_paths(get_option('prefix'),
get_option('localstatedir'))
plugin_deps = []
plugin_deps += appstream_glib
plugin_deps += gio

View File

@ -1,7 +1,7 @@
cargs = ['-DG_LOG_DOMAIN="FuPluginDell"']
install_data(['dell.quirk'],
install_dir: join_paths(get_option('datadir'), 'fwupd', 'quirks.d')
install_dir: join_paths(datadir, 'fwupd', 'quirks.d')
)
shared_module('fu_plugin_dell',

View File

@ -1,7 +1,7 @@
cargs = ['-DG_LOG_DOMAIN="FuPluginDfu"']
install_data(['dfu.quirk'],
install_dir: join_paths(get_option('datadir'), 'fwupd', 'quirks.d')
install_dir: join_paths(datadir, 'fwupd', 'quirks.d')
)
dfu = static_library(
@ -84,7 +84,7 @@ executable(
],
c_args : cargs,
install : true,
install_dir : get_option('bindir')
install_dir : bindir
)
if get_option('enable-man')
@ -97,7 +97,7 @@ if get_option('enable-man')
'--output', meson.current_build_dir(),
],
install : true,
install_dir : join_paths(get_option('mandir'), 'man1'),
install_dir : join_paths(mandir, 'man1'),
)
endif

View File

@ -1,5 +1,5 @@
install_data('org.freedesktop.fwupd.rules',
install_dir : join_paths(get_option('datadir'), 'polkit-1', 'rules.d'))
install_dir : join_paths(datadir, 'polkit-1', 'rules.d'))
#meson 0.41.0 added support for data_dirs argument
if meson.version().version_compare('>=0.41.0')
@ -9,7 +9,7 @@ if meson.version().version_compare('>=0.41.0')
input: 'org.freedesktop.fwupd.policy.in',
output: 'org.freedesktop.fwupd.policy',
install: true,
install_dir: join_paths(get_option('datadir'), 'polkit-1', 'actions') ,
install_dir: join_paths(datadir, 'polkit-1', 'actions') ,
type: 'xml',
po_dir: join_paths(meson.source_root(), 'po')
)
@ -19,7 +19,7 @@ if meson.version().version_compare('>=0.41.0')
input: 'org.freedesktop.fwupd.policy.in',
output: 'org.freedesktop.fwupd.policy',
install: true,
install_dir: join_paths(get_option('datadir'), 'polkit-1', 'actions') ,
install_dir: join_paths(datadir, 'polkit-1', 'actions') ,
type: 'xml',
data_dirs: join_paths(meson.source_root(), 'policy'),
po_dir: join_paths(meson.source_root(), 'po')
@ -38,6 +38,6 @@ else
'-d', join_paths(meson.source_root(), 'po'),
'-o', '@OUTPUT@'],
install: true,
install_dir: join_paths(get_option('datadir'), 'polkit-1', 'actions')
install_dir: join_paths(datadir, 'polkit-1', 'actions')
)
endif

View File

@ -1,7 +1,7 @@
cargs = ['-DG_LOG_DOMAIN="Fu"']
install_data(['org.freedesktop.fwupd.xml'],
install_dir : join_paths(get_option('datadir'), 'dbus-1', 'interfaces')
install_dir : join_paths(datadir, 'dbus-1', 'interfaces')
)
keyring_deps = []
@ -51,7 +51,7 @@ libfwupdprivate = static_library(
cargs,
'-DLOCALSTATEDIR="' + localstatedir + '"',
'-DSYSFSFIRMWAREDIR="/sys/firmware"',
'-DFWUPDDATADIR="' + join_paths(get_option('prefix'), get_option('datadir'), 'fwupd') + '"',
'-DFWUPDDATADIR="' + join_paths(datadir, 'fwupd') + '"',
'-DFU_OFFLINE_DESTDIR=""',
],
)
@ -85,7 +85,7 @@ fwupdmgr = executable(
'-DFU_OFFLINE_DESTDIR=""',
],
install : true,
install_dir : get_option('bindir')
install_dir : bindir
)
if get_option('enable-man')
@ -102,7 +102,7 @@ if get_option('enable-man')
'--version-string', fwupd_version,
],
install : true,
install_dir : join_paths(get_option('mandir'), 'man1'),
install_dir : join_paths(mandir, 'man1'),
)
endif
@ -158,12 +158,12 @@ executable(
'-DPLUGINDIR="' + plugin_dir + '"',
'-DSYSFSFIRMWAREDIR="/sys/firmware"',
'-DSYSCONFDIR="' + default_sysconfdir + '"',
'-DFWUPDDATADIR="' + join_paths(get_option('prefix'), get_option('datadir'), 'fwupd') + '"',
'-DFWUPDDATADIR="' + join_paths(datadir, 'fwupd') + '"',
'-DFWUPDCONFIGDIR="' + join_paths(default_sysconfdir, 'fwupd') + '"',
'-DFU_OFFLINE_DESTDIR=""',
],
install : true,
install_dir : join_paths(get_option('libexecdir'), 'fwupd')
install_dir : join_paths(libexecdir, 'fwupd')
)
if get_option('enable-tests')