Allow disabling all plugins

This allows us to easily build just libfwupd in a flatpak manifest without
installing dozens of deps to build things we're just going to delete anyway.
This commit is contained in:
Richard Hughes 2019-09-13 08:32:05 +01:00
parent 6f82b989e8
commit fbff921b35
6 changed files with 77 additions and 57 deletions

View File

@ -21,13 +21,13 @@ configure_file(
install: true,
install_dir: tgt)
if get_option('daemon')
if build_daemon
configure_file(
input : 'fwupdmgr.in',
output : 'fwupdmgr',
configuration : con2,
install: true,
install_dir: tgt)
endif # get_option('daemon')
endif # build_daemon
endif # bashcomp.found()

View File

@ -2,19 +2,21 @@ subdir('builder')
subdir('pki')
subdir('remotes.d')
subdir('bash-completion')
if build_daemon
subdir('motd')
endif
if get_option('tests')
subdir('tests')
endif
if get_option('daemon')
if build_daemon
subdir('installed-tests')
install_data(['daemon.conf'],
install_dir : join_paths(sysconfdir, 'fwupd')
)
endif
install_data(['daemon.conf'],
install_dir : join_paths(sysconfdir, 'fwupd')
)
install_data(['org.freedesktop.fwupd.metainfo.xml'],
install_dir: join_paths(datadir, 'metainfo')
)
@ -23,17 +25,16 @@ install_data(['org.freedesktop.fwupd.svg'],
install_dir : join_paths(datadir, 'icons', 'hicolor', 'scalable', 'apps')
)
install_data(['org.freedesktop.fwupd.conf'],
install_dir : join_paths(sysconfdir, 'dbus-1', 'system.d')
)
if get_option('daemon')
if build_daemon
install_data(['org.freedesktop.fwupd.conf'],
install_dir : join_paths(sysconfdir, 'dbus-1', 'system.d')
)
install_data(['90-fwupd-devices.rules'],
install_dir : join_paths(udevdir, 'rules.d')
)
endif
if get_option('systemd')
if get_option('systemd') and build_daemon
con2 = configuration_data()
con2.set('libexecdir', libexecdir)
con2.set('bindir', bindir)
@ -87,7 +88,7 @@ if get_option('systemd')
)
endif
if get_option('systemd') or get_option('elogind')
if (get_option('systemd') or get_option('elogind')) and build_daemon
con2 = configuration_data()
con2.set('libexecdir', libexecdir)

View File

@ -1,4 +1,4 @@
if get_option('daemon') and get_option('lvfs')
if build_daemon and get_option('lvfs')
install_data([
'lvfs.conf',
'lvfs-testing.conf',

View File

@ -135,6 +135,18 @@ add_project_arguments('-DFWUPD_DISABLE_DEPRECATED', language : 'c')
add_project_arguments('-D_BSD_SOURCE', language : 'c')
add_project_arguments('-D_XOPEN_SOURCE=700', language : 'c')
# sanity check
if get_option('build') == 'all'
build_standalone = true
build_daemon = true
elif get_option('build') == 'standalone'
build_standalone = true
build_daemon = false
elif get_option('build') == 'library'
build_standalone = false
build_daemon = false
endif
prefix = get_option('prefix')
bindir = join_paths(prefix, get_option('bindir'))
@ -147,11 +159,12 @@ mandir = join_paths(prefix, get_option('mandir'))
localedir = join_paths(prefix, get_option('localedir'))
gio = dependency('gio-2.0', version : '>= 2.45.8')
giounix = dependency('gio-unix-2.0', version : '>= 2.45.8')
if gio.version().version_compare ('>= 2.55.0')
conf.set('HAVE_GIO_2_55_0', '1')
endif
if build_standalone
gmodule = dependency('gmodule-2.0')
giounix = dependency('gio-unix-2.0', version : '>= 2.45.8')
gudev = dependency('gudev-1.0')
if gudev.version().version_compare('>= 232')
conf.set('HAVE_GUDEV_232', '1')
@ -160,10 +173,11 @@ libxmlb = dependency('xmlb', version : '>= 0.1.7', fallback : ['libxmlb', 'libxm
gusb = dependency('gusb', version : '>= 0.2.9')
sqlite = dependency('sqlite3')
libarchive = dependency('libarchive')
endif
libjsonglib = dependency('json-glib-1.0', version : '>= 1.1.1')
valgrind = dependency('valgrind', required: false)
soup = dependency('libsoup-2.4', version : '>= 2.51.92')
if get_option('daemon')
if build_daemon
polkit = dependency('polkit-gobject-1', version : '>= 0.103')
if polkit.version().version_compare('>= 0.114')
conf.set('HAVE_POLKIT_0_114', '1')
@ -203,15 +217,15 @@ if valgrind.found()
conf.set('HAVE_VALGRIND', '1')
endif
if get_option('plugin_redfish')
if build_standalone and get_option('plugin_redfish')
efivar = dependency('efivar')
endif
if get_option('plugin_altos')
if build_standalone and get_option('plugin_altos')
libelf = dependency('libelf')
endif
if get_option('plugin_uefi')
if build_standalone and get_option('plugin_uefi')
cairo = dependency('cairo')
fontconfig = cc.find_library('fontconfig')
freetype = cc.find_library('freetype')
@ -249,7 +263,7 @@ if get_option('plugin_uefi')
endif
endif
if get_option('plugin_dell')
if build_standalone and get_option('plugin_dell')
libsmbios_c = dependency('libsmbios_c', version : '>= 2.4.0')
efivar = dependency('efivar')
conf.set('HAVE_DELL', '1')
@ -258,63 +272,64 @@ if get_option('plugin_dell')
endif
endif
if get_option('plugin_modem_manager')
if build_standalone and get_option('plugin_modem_manager')
libmm_glib = dependency('mm-glib', version : '>= 1.10.0')
add_project_arguments('-DMM_REQUIRED_VERSION="1.10.0"', language : 'c')
libqmi_glib = dependency('qmi-glib', version : '>= 1.22.0')
add_project_arguments('-DQMI_REQUIRED_VERSION="1.23.1"', language : 'c')
endif
if get_option('plugin_nvme')
if build_standalone and get_option('plugin_nvme')
if not cc.has_header('linux/nvme_ioctl.h')
error('NVMe support requires kernel >= 4.4')
endif
endif
if get_option('plugin_synaptics')
if build_standalone and get_option('plugin_synaptics')
conf.set('HAVE_SYNAPTICS', '1')
endif
if get_option('plugin_thunderbolt')
if build_standalone and get_option('plugin_thunderbolt')
umockdev = dependency('umockdev-1.0', required: false)
conf.set('HAVE_THUNDERBOLT', '1')
endif
if get_option('plugin_flashrom')
if build_standalone and get_option('plugin_flashrom')
libflashrom = dependency('flashrom', fallback : ['flashrom', 'flashrom_dep'])
endif
if get_option('systemd')
if build_standalone and get_option('systemd')
systemd = dependency('systemd', version : '>= 211')
conf.set('HAVE_SYSTEMD' , '1')
conf.set('HAVE_LOGIND' , '1')
systemdunitdir = get_option('systemdunitdir')
if systemdunitdir == '' and get_option('systemd')
systemdunitdir = systemd.get_pkgconfig_variable('systemdsystemunitdir')
endif
endif
if get_option('elogind')
if build_standalone and get_option('elogind')
elogind = dependency('libelogind', version : '>= 211')
conf.set('HAVE_LOGIND' , '1')
endif
if get_option('consolekit')
if build_standalone and get_option('consolekit')
conf.set('HAVE_CONSOLEKIT' , '1')
endif
systemdunitdir = get_option('systemdunitdir')
if systemdunitdir == '' and get_option('systemd')
systemdunitdir = systemd.get_pkgconfig_variable('systemdsystemunitdir')
endif
gnome = import('gnome')
i18n = import('i18n')
plugin_dir = join_paths(libdir, 'fwupd-plugins-3')
conf.set_quoted('BINDIR', bindir)
conf.set_quoted('LIBEXECDIR', libexecdir)
conf.set_quoted('DATADIR', datadir)
conf.set_quoted('LOCALSTATEDIR', localstatedir)
conf.set_quoted('SYSCONFDIR', sysconfdir)
if build_standalone
plugin_dir = join_paths(libdir, 'fwupd-plugins-3')
conf.set_quoted('PLUGINDIR', plugin_dir)
endif
conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
conf.set_quoted('PACKAGE_NAME', meson.project_name())
@ -325,30 +340,34 @@ configure_file(
configuration : conf
)
plugin_deps = []
plugin_deps += libxmlb
plugin_deps += gio
plugin_deps += giounix
plugin_deps += gmodule
plugin_deps += gusb
plugin_deps += soup
plugin_deps += libarchive
plugin_deps += gudev
if build_standalone
plugin_deps = []
plugin_deps += libxmlb
plugin_deps += gio
plugin_deps += giounix
plugin_deps += gmodule
plugin_deps += gusb
plugin_deps += soup
plugin_deps += libarchive
plugin_deps += gudev
endif
subdir('data')
if get_option('gtkdoc')
gtkdocscan = find_program('gtkdoc-scan', required : true)
subdir('docs')
endif
subdir('libfwupd')
subdir('po')
if get_option('daemon')
if build_daemon
subdir('policy')
endif
subdir('src')
subdir('plugins')
subdir('contrib')
if build_standalone
subdir('data')
subdir('po')
subdir('src')
subdir('plugins')
subdir('contrib')
endif
if get_option('systemd') and get_option('daemon')
if get_option('systemd') and build_daemon
meson.add_install_script('meson_post_install.sh', systemdunitdir, localstatedir)
endif

View File

@ -1,4 +1,4 @@
option('daemon', type : 'boolean', value : true, description : 'enable the fwupd daemon')
option('build', type : 'combo', choices : ['all', 'standalone', 'library'], value : 'all', description : 'build type')
option('agent', type : 'boolean', value : true, description : 'enable the fwupd agent')
option('consolekit', type : 'boolean', value : true, description : 'enable ConsoleKit support')
option('firmware-packager', type : 'boolean', value : true, description : 'enable firmware-packager installation')

View File

@ -1,4 +1,4 @@
if get_option('daemon')
if build_daemon
install_data(['org.freedesktop.fwupd.xml'],
install_dir : join_paths(datadir, 'dbus-1', 'interfaces')
)
@ -80,7 +80,7 @@ libfwupdprivate = static_library(
],
)
if get_option('daemon')
if build_daemon
fwupdmgr = executable(
'fwupdmgr',
sources : [
@ -236,7 +236,7 @@ fwupdtool = executable(
install_dir : join_paths(libexecdir, 'fwupd')
)
if get_option('daemon') and get_option('man')
if build_daemon and get_option('man')
help2man = find_program('help2man')
custom_target('fwupdmgr-man',
input : fwupdmgr,
@ -254,7 +254,7 @@ if get_option('daemon') and get_option('man')
)
endif
if get_option('daemon')
if build_daemon
executable(
'fwupd',
resources_src,