fwupd/libfwupd/meson.build
Richard Hughes 7bcb8d4385 Export FwupdPlugin so we can convey enumerated system errors to the end user
For instance, we can tell the user that UEFI UpdateCapsule is disabled in the
system firmware, or that efivarfs is not mounted. This is much better than
creating "dummy" devices which are really just hacks around the problem because
no better API existed. THe dummy devices cause as many problems as they solve.

Plugins have to set FWUPD_PLUGIN_FLAG_USER_WARNING if a warning should be shown
to the user, and only one warning will be shown of each failure type.

It is expected that GUI clients like gnome-software and gnome-firmware would use
this API to notify the user the localized message for why firmware updates are
not being shown.

Fixes https://github.com/fwupd/fwupd/issues/2456
2020-10-13 15:56:49 +01:00

189 lines
4.3 KiB
Meson

cargs = [
'-DG_LOG_DOMAIN="Fwupd"',
]
fwupd_version_h = configure_file(
input : 'fwupd-version.h.in',
output : 'fwupd-version.h',
configuration : conf
)
install_headers(
'fwupd.h',
subdir : 'fwupd-1',
)
install_headers([
'fwupd-client.h',
'fwupd-client-sync.h',
'fwupd-common.h',
'fwupd-deprecated.h',
'fwupd-device.h',
'fwupd-enums.h',
'fwupd-error.h',
'fwupd-remote.h',
'fwupd-security-attr.h',
'fwupd-release.h',
'fwupd-plugin.h',
fwupd_version_h,
],
subdir : 'fwupd-1/libfwupd',
)
fwupd_mapfile = 'fwupd.map'
vflag = '-Wl,--version-script,@0@/@1@'.format(meson.current_source_dir(), fwupd_mapfile)
fwupd = shared_library(
'fwupd',
sources : [
'fwupd-client.c',
'fwupd-client-sync.c',
'fwupd-common.c',
'fwupd-device.c',
'fwupd-enums.c',
'fwupd-error.c',
'fwupd-security-attr.c',
'fwupd-release.c',
'fwupd-plugin.c',
'fwupd-remote.c',
],
soversion : libfwupd_lt_current,
version : libfwupd_lt_version,
dependencies : [
giounix,
soup,
libjcat,
libjsonglib,
],
c_args : [
cargs,
'-DLOCALSTATEDIR="' + localstatedir + '"',
],
include_directories : root_incdir,
link_args : vflag,
link_depends : fwupd_mapfile,
install : true
)
pkgg = import('pkgconfig')
pkgg.generate(
libraries : fwupd,
requires : [ 'gio-2.0' ],
subdirs : 'fwupd-1',
version : meson.project_version(),
name : 'fwupd',
filebase : 'fwupd',
description : 'fwupd is a system daemon for installing device firmware',
)
if get_option('introspection')
fwupd_gir = gnome.generate_gir(fwupd,
sources : [
'fwupd-client.c',
'fwupd-client.h',
'fwupd-client-sync.c',
'fwupd-client-sync.h',
'fwupd-common.c',
'fwupd-common.h',
'fwupd-common-private.h',
'fwupd-device.c',
'fwupd-device.h',
'fwupd-device-private.h',
'fwupd-enums.c',
'fwupd-enums.h',
'fwupd-enums-private.h',
'fwupd-error.c',
'fwupd-error.h',
'fwupd-security-attr.c',
'fwupd-security-attr.h',
'fwupd-security-attr-private.h',
'fwupd-release.c',
'fwupd-release.h',
'fwupd-release-private.h',
'fwupd-plugin.c',
'fwupd-plugin.h',
'fwupd-plugin-private.h',
'fwupd-remote.c',
'fwupd-remote.h',
'fwupd-remote-private.h',
],
nsversion : '2.0',
namespace : 'Fwupd',
symbol_prefix : 'fwupd',
identifier_prefix : 'Fwupd',
export_packages : 'fwupd',
header : 'fwupd.h',
dependencies : [
giounix,
soup,
],
includes : [
'Gio-2.0',
'GObject-2.0',
'Soup-2.4',
],
install : true
)
gnome.generate_vapi('fwupd',
sources : fwupd_gir[0],
packages : ['gio-2.0', 'libsoup-2.4'],
install : true,
)
# Verify the map file is correct -- note we can't actually use the generated
# file for two reasons:
#
# 1. We don't hard depend on GObject Introspection
# 2. The map file is required to build the lib that the GIR is built from
#
# To avoid the circular dep, and to ensure we don't change exported API
# accidentally actually check in a version of the version script to git.
mapfile_target = custom_target('fwupd_mapfile',
input: fwupd_gir[0],
output: 'fwupd.map',
command: [
join_paths(meson.source_root(), 'contrib', 'generate-version-script.py'),
'LIBFWUPD',
'@INPUT@',
'@OUTPUT@',
],
)
test('fwupd-exported-api', diffcmd,
args : [
'-urNp',
join_paths(meson.current_source_dir(), 'fwupd.map'),
mapfile_target,
],
)
endif
if get_option('tests')
testdatadir = join_paths(meson.source_root(), 'data')
localremotetestdir = join_paths(meson.source_root(), 'plugins', 'dell-esrt')
e = executable(
'fwupd-self-test',
sources : [
'fwupd-self-test.c'
],
include_directories : [
root_incdir,
],
dependencies : [
gio,
soup,
libjsonglib,
],
link_with : fwupd,
c_args : [
cargs,
'-DLOCALSTATEDIR="' + localstatedir + '"',
'-DTESTDATADIR="' + testdatadir + '"',
'-DFU_SELF_TEST_REMOTES_DIR="' + testdatadir + '"',
'-DFU_LOCAL_REMOTE_DIR="' + localremotetestdir + '"',
],
)
test('fwupd-self-test', e, timeout: 60)
endif
fwupd_incdir = include_directories('.')