summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabiano Fidêncio <fidencio@redhat.com>2019-08-21 09:14:33 +0200
committerFabiano Fidêncio <fidencio@redhat.com>2019-09-25 13:26:22 +0200
commit25c45ffd9a1b8f18f56974d5b9b6b2c1da8cbd0c (patch)
tree2ca628fd2df926c67a1f67cdbb982f590731a58f
parentdaf4faf54ff2014cd7c1f2bb24276190268f3ece (diff)
downloadlibosinfo-25c45ffd9a1b8f18f56974d5b9b6b2c1da8cbd0c.tar.gz
Add support to meson build system
Meson build system is a "simpler and easier" to understand build system that that can provide (with some work-arounds here and there) the same functionalities currently available with our current build system (autotools). Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
-rw-r--r--README1
-rwxr-xr-xbuild-aux/dist.sh13
-rwxr-xr-xbuild-aux/download_pci_ids4
-rwxr-xr-xbuild-aux/download_usb_ids4
-rw-r--r--docs/reference/meson.build25
-rw-r--r--meson.build362
-rw-r--r--meson_options.txt37
-rw-r--r--osinfo/meson.build214
-rw-r--r--po/meson.build2
-rwxr-xr-xtests/check-symfile3
-rwxr-xr-xtests/check-symsorting3
-rw-r--r--tests/meson.build61
-rw-r--r--tools/meson.build68
13 files changed, 797 insertions, 0 deletions
diff --git a/README b/README
index 4d7ec1c..e9bdf0e 100644
--- a/README
+++ b/README
@@ -19,6 +19,7 @@ Dependencies
============
- Required:
+ - meson >= 0.49.0
- gobject-2.0
- gio-2.0
- libxml-2.0
diff --git a/build-aux/dist.sh b/build-aux/dist.sh
new file mode 100755
index 0000000..e50bdb7
--- /dev/null
+++ b/build-aux/dist.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+SOURCE_ROOT=$1
+BUILD_ROOT=$2
+
+$SOURCE_ROOT/build-aux/gitlog-to-changelog > $MESON_DIST_ROOT/ChangeLog
+
+# Only osinfo-db-tools.spec is put into the tarball,
+# otherwise rpmbuild -ta $tarball.tar.gz would fail
+cp $BUILD_ROOT/libosinfo.spec $MESON_DIST_ROOT/
+
+out="`git log --pretty=format:'%aN <%aE>' | sort -u`"
+perl -p -e "s/#authorslist#// and print '$out'" < $SOURCE_ROOT/AUTHORS.in > $MESON_DIST_ROOT/AUTHORS
diff --git a/build-aux/download_pci_ids b/build-aux/download_pci_ids
new file mode 100755
index 0000000..4ed9c56
--- /dev/null
+++ b/build-aux/download_pci_ids
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+cd $MESON_BUILD_ROOT
+wget -q -O pci.ids http://pciids.sourceforge.net/v2.2/pci.ids
diff --git a/build-aux/download_usb_ids b/build-aux/download_usb_ids
new file mode 100755
index 0000000..82bb011
--- /dev/null
+++ b/build-aux/download_usb_ids
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+cd $MESON_BUILD_ROOT
+wget -q -O usb.ids http://www.linux-usb.org/usb.ids
diff --git a/docs/reference/meson.build b/docs/reference/meson.build
new file mode 100644
index 0000000..00bb13b
--- /dev/null
+++ b/docs/reference/meson.build
@@ -0,0 +1,25 @@
+gnome = import('gnome')
+
+mkdb_args = [
+ '--xml-mode',
+ '--output-format=xml',
+]
+
+scan_args = [
+ '--rebuild-sections',
+ '--rebuild-types',
+]
+
+gnome.gtkdoc('Libosinfo',
+ main_xml: 'Libosinfo-docs.xml',
+ include_directories: libosinfo_include,
+ src_dir: [
+ join_paths(meson.source_root(), 'osinfo'),
+ join_paths(meson.build_root(), 'osinfo'),
+ ],
+ namespace: 'Libosinfo',
+ mkdb_args: mkdb_args,
+ scan_args: scan_args,
+ dependencies: libosinfo_dep,
+ install: true,
+)
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..34d4b53
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,362 @@
+project(
+ 'libosinfo', 'c',
+ version: '1.7.0',
+ license: 'LGPLv2+',
+ meson_version: '>= 0.49.0',
+ default_options: [
+ 'buildtype=debugoptimized',
+ 'c_std=gnu99',
+ 'warning_level=1',
+ ],
+)
+
+libosinfo_prefix = get_option('prefix')
+
+# those directories have to be know by the project
+libosinfo_datadir = join_paths(libosinfo_prefix, get_option('datadir'))
+libosinfo_localedir = join_paths(libosinfo_prefix, get_option('localedir'))
+libosinfo_pkgdatadir = join_paths(libosinfo_datadir, meson.project_name())
+libosinfo_sysconfdir = join_paths(libosinfo_prefix, get_option('sysconfdir'))
+
+# those directories will have files installed in
+libsoinfo_bindir = join_paths(libosinfo_prefix, get_option('bindir'))
+libsoinfo_docdir = join_paths(libosinfo_datadir, 'doc', meson.project_name())
+libosinfo_includedir = join_paths(libosinfo_prefix, get_option('includedir'))
+libosinfo_libdir = join_paths(libosinfo_prefix, get_option('libdir'))
+libosinfo_licensedir = join_paths(libosinfo_datadir, 'license', meson.project_name())
+libosinfo_mandir = join_paths(libosinfo_prefix, get_option('mandir'))
+libosinfo_pkgconfdir = join_paths(libosinfo_libdir, 'pkgconfig')
+
+# gobject introspection
+gir = find_program('g-ir-scanner', required: get_option('enable-introspection'))
+enable_introspection = gir.found() and not meson.is_cross_build()
+
+# vala
+vapi_opt = get_option('enable-vala')
+enable_vapi = add_languages('vala', required: vapi_opt)
+if enable_vapi and not enable_introspection
+ enable_vapi = false
+ if vapi_opt.enabled()
+ error('vala support was requested, but introspection support is mandatory.')
+ endif
+endif
+
+libosinfo_girdir = join_paths(libosinfo_datadir, 'gir-1.0')
+libosinfo_typelibdir = join_paths(libosinfo_libdir, 'girepository-1.0')
+libosinfo_pkgconfdir = join_paths(libosinfo_libdir, 'pkgconfig')
+
+# spec files
+libosinfo_spec_data = configuration_data()
+libosinfo_spec_data.set('VERSION', meson.project_version())
+
+specs = ['libosinfo.spec', 'mingw-libosinfo.spec']
+foreach spec: specs
+ configure_file(
+ input: spec + '.in',
+ output: spec,
+ configuration: libosinfo_spec_data,
+ )
+endforeach
+
+# ninja dist helper
+meson.add_dist_script('build-aux/dist.sh', meson.source_root(), meson.build_root())
+
+# dependencies
+# glib stuff
+glib_version = '2.44'
+glib_version_required = 'GLIB_VERSION_2_44'
+glib_version_info = '>= @0@'.format(glib_version)
+glib_dep = dependency('glib-2.0', version: glib_version_info)
+gio_dep = dependency('gio-2.0', version: glib_version_info)
+gobject_dep = dependency('gobject-2.0', version: glib_version_info)
+
+# everything else
+libsoup_dep = dependency('libsoup-2.4')
+libxml_dep = dependency('libxml-2.0', version: '>= 2.6.0')
+libxslt_dep = dependency('libxslt', version: '>= 1.0.0')
+
+# common dependencies
+libosinfo_dependencies = [
+ gobject_dep,
+ gio_dep,
+ glib_dep,
+ libsoup_dep,
+ libxml_dep,
+ libxslt_dep,
+]
+
+libosinfo_include = [include_directories('.')]
+
+# arguments
+libosinfo_cflags = []
+
+# glib stuff
+libosinfo_cflags += [
+ '-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_44',
+ '-DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_44'
+]
+
+# directories used
+libosinfo_cflags += [
+ '-DPKG_DATA_DIR="@0@"'.format(libosinfo_pkgdatadir),
+ '-DDATA_DIR="@0@"'.format(libosinfo_datadir),
+ '-DSYS_CONF_DIR="@0@"'.format(libosinfo_sysconfdir),
+ '-DLOCALEDIR="@0@"'.format(libosinfo_localedir),
+]
+
+# gettext package name
+libosinfo_cflags += ['-DGETTEXT_PACKAGE="@0@"'.format(meson.project_name())]
+
+# cflags to check whether the compiler supports them or not
+libosinfo_check_cflags = [
+ '-W',
+ '-Waddress',
+ '-Waggressive-loop-optimizations',
+ '-Wall',
+ '-Warray-bounds',
+ '-Wattributes',
+ '-Wbuiltin-macro-redefined',
+ '-Wcast-align',
+ '-Wchar-subscripts',
+ '-Wclobbered',
+ '-Wcomment',
+ '-Wcomments',
+ '-Wcoverage-mismatch',
+ '-Wcpp',
+ '-Wdate-time',
+ '-Wdeprecated-declarations',
+ '-Wdisabled-optimization',
+ '-Wdiv-by-zero',
+ '-Wempty-body',
+ '-Wendif-labels',
+ '-Wenum-compare',
+ '-Wextra',
+ '-Wformat-contains-nul',
+ '-Wformat-extra-args',
+ '-Wformat-security',
+ '-Wformat-y2k',
+ '-Wformat-zero-length',
+ '-Wfree-nonheap-object',
+ '-Wignored-qualifiers',
+ '-Wimplicit',
+ '-Wimplicit-function-declaration',
+ '-Wimplicit-int',
+ '-Winit-self',
+ '-Winline',
+ '-Wint-to-pointer-cast',
+ '-Winvalid-memory-model',
+ '-Winvalid-pch',
+ '-Wjump-misses-init',
+ '-Wlogical-op',
+ '-Wmain',
+ '-Wmaybe-uninitialized',
+ '-Wmissing-braces',
+ '-Wmissing-declarations',
+ '-Wmissing-field-initializers',
+ '-Wmissing-include-dirs',
+ '-Wmissing-parameter-type',
+ '-Wmissing-prototypes',
+ '-Wmultichar',
+ '-Wnarrowing',
+ '-Wnested-externs',
+ '-Wnonnull',
+ '-Wold-style-declaration',
+ '-Wold-style-definition',
+ '-Wopenmp-simd',
+ '-Woverflow',
+ '-Woverlength-strings',
+ '-Woverride-init',
+ '-Wpacked',
+ '-Wpacked-bitfield-compat',
+ '-Wparentheses',
+ '-Wpointer-arith',
+ '-Wpointer-sign',
+ '-Wpointer-to-int-cast',
+ '-Wpragmas',
+ '-Wreturn-local-addr',
+ '-Wreturn-type',
+ '-Wsequence-point',
+ '-Wshadow',
+ '-Wsizeof-pointer-memaccess',
+ '-Wstack-protector',
+ '-Wstrict-aliasing',
+ '-Wstrict-overflow',
+ '-Wstrict-prototypes',
+ '-Wsuggest-attribute=const',
+ '-Wsuggest-attribute=format',
+ '-Wsuggest-attribute=noreturn',
+ '-Wsuggest-attribute=pure',
+ '-Wswitch',
+ '-Wswitch-default',
+ '-Wsync-nand',
+ '-Wtrampolines',
+ '-Wtrigraphs',
+ '-Wtype-limits',
+ '-Wuninitialized',
+ '-Wunknown-pragmas',
+ '-Wunsafe-loop-optimizations',
+ '-Wunused',
+ '-Wunused-but-set-parameter',
+ '-Wunused-but-set-variable',
+ '-Wunused-function',
+ '-Wunused-label',
+ '-Wunused-local-typedefs',
+ '-Wunused-parameter',
+ '-Wunused-result',
+ '-Wunused-value',
+ '-Wunused-variable',
+ '-Wvarargs',
+ '-Wvariadic-macros',
+ '-Wvector-operation-performance',
+ '-Wvla',
+ '-Wvolatile-register-var',
+ '-Wwrite-strings',
+ '-Wnormalized=nfc',
+ '-Wno-sign-compare',
+ '-Wno-sign-conversion',
+ '-Wno-conversion',
+ '-Wno-unused-parameter',
+ '-Wjump-misses-init',
+ '-Wframe-larger-than=4096',
+ '-Wno-overlength-strings',
+ '--param=ssp-buffer-size=4',
+ '-fexceptions',
+ '-fasynchronous-unwind-tables',
+ '-fdiagnostics-show-option',
+ '-funit-at-a-time',
+ '-fipa-pure-const',
+ '-Wno-suggest-attribute=pure',
+ '-Wno-suggest-attribute=const',
+]
+
+if host_machine.system() == 'linux'
+ libosinfo_check_cflags += ['-fstack-protector-all']
+endif
+
+
+# Builds on macOS would fail without those.
+if host_machine.system() == 'darwin'
+ libosinfo_check_cflags += [
+ '-Wno-typedef-redefinition',
+ '-Wno-missing-field-initializers',
+ ]
+endif
+
+if run_command('[', '-d', '.git', ']').returncode() == 0
+ libosinfo_check_cflags += ['-Werror']
+endif
+
+compiler = meson.get_compiler('c')
+foreach cflag: libosinfo_check_cflags
+ if compiler.has_argument(cflag)
+ libosinfo_cflags += [cflag]
+ endif
+endforeach
+
+pci_ids_path = get_option('with-pci-ids-path')
+if pci_ids_path == ''
+ pci_id_files = [
+ '/usr/share/pci.ids',
+ '/usr/share/misc/pci.ids',
+ '/usr/share/hwdata/pci.ids',
+ '/usr/local/share/pciids/pci.ids',
+ ]
+
+ foreach file: pci_id_files
+ if run_command('[', '-f', file, ']').returncode() == 0
+ pci_ids_path = file
+ break
+ endif
+ endforeach
+
+ if pci_ids_path == ''
+ download = find_program('build-aux/download_pci_ids')
+ if download.found()
+ r = run_command(download)
+ if r.returncode() == 0
+ pci_ids_path = join_paths(meson.build_root(), 'pci.ids')
+ endif
+ endif
+ endif
+endif
+libosinfo_cflags += ['-DPCI_IDS="@0@"'.format(pci_ids_path)]
+message('Location of pci.ids: "@0@"'.format(pci_ids_path))
+
+usb_ids_path = get_option('with-usb-ids-path')
+if usb_ids_path == ''
+ usb_id_files = [
+ '/usr/share/usb.ids',
+ '/usr/share/misc/usb.ids',
+ '/usr/share/hwdata/usb.ids',
+ '/usr/local/share/usbids/usb.ids',
+ ]
+
+ foreach file: usb_id_files
+ if run_command('[', '-f', file, ']').returncode() == 0
+ usb_ids_path = file
+ break
+ endif
+ endforeach
+
+ if usb_ids_path == ''
+ download = find_program('build-aux/download_usb_ids')
+ if download.found()
+ r = run_command(download)
+ if r.returncode() == 0
+ usb_ids_path = join_paths(meson.build_root(), 'usb.ids')
+ endif
+ endif
+ endif
+endif
+libosinfo_cflags += ['-DUSB_IDS="@0@"'.format(usb_ids_path)]
+message('Location of usb.ids: "@0@"'.format(usb_ids_path))
+
+add_project_arguments(libosinfo_cflags, language: 'c')
+
+libosinfo_version = meson.project_version()
+libosinfo_major_version = libosinfo_version.split('.')[0].to_int()
+libosinfo_minor_version = libosinfo_version.split('.')[1].to_int()
+libosinfo_micro_version = libosinfo_version.split('.')[2].to_int()
+
+libosinfo_interface_age = 0
+libosinfo_binary_age = 1000 * libosinfo_major_version + libosinfo_minor_version
+
+# Mantain versin scheme with libtool
+libosinfo_soversion = 0
+libosinfo_version = '@0@.@1@.@2@'.format(
+ libosinfo_soversion,
+ (libosinfo_binary_age - libosinfo_interface_age),
+ libosinfo_interface_age)
+osx_current = libosinfo_binary_age - libosinfo_interface_age + 1
+libosinfo_darwin_versions = [
+ osx_current,
+ '@0@.@1@.0'.format(osx_current, libosinfo_interface_age)
+]
+
+libosinfo_ldflags = []
+if meson.get_compiler('c').has_link_argument('-Wl,--no-undefined')
+ libosinfo_ldflags += ['-Wl,--no-undefined']
+endif
+
+if host_machine.system() == 'linux'
+ libosinfo_ldflags += [
+ '-Wl,--version-script.@0@/@1@'.format(
+ meson.current_source_dir(),
+ 'libosinfo.syms'
+ )
+ ]
+endif
+
+subdir('osinfo')
+subdir('tools')
+subdir('po')
+if get_option('enable-gtk-doc')
+ if find_program('gtkdoc-scan', required: true).found()
+ subdir('docs/reference')
+ else
+ message('Not building documentation as gtk-doc was not found')
+ endif
+endif
+if get_option('enable-tests')
+ subdir('tests')
+endif
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 0000000..cd7dc61
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,37 @@
+option('enable-gtk-doc',
+ type: 'boolean',
+ value: true,
+ description: 'Enable generating te API reference'
+)
+
+option('enable-introspection',
+ type: 'feature',
+ value: 'auto',
+ yield: true,
+ description: 'Enable GObject Introspection'
+)
+
+option('enable-tests',
+ type: 'boolean',
+ value: true,
+ description: 'Enable test suite'
+)
+
+option('enable-vala',
+ type: 'feature',
+ value: 'auto',
+ yield: true,
+ description: 'Enable Vala bindings'
+)
+
+option('with-pci-ids-path',
+ type: 'string',
+ value: '',
+ description: 'Location of pci.ids database'
+)
+
+option('with-usb-ids-path',
+ type: 'string',
+ value: '',
+ description: 'Location of usb.ids database'
+)
diff --git a/osinfo/meson.build b/osinfo/meson.build
new file mode 100644
index 0000000..a1a4040
--- /dev/null
+++ b/osinfo/meson.build
@@ -0,0 +1,214 @@
+libosinfo_include += [include_directories('.')]
+
+# generate osinfo_version.h
+version_info = meson.project_version().split('.')
+version_major = '@0@'.format(version_info[0])
+version_minor = '@0@'.format(version_info[1])
+version_micro = '@0@'.format(version_info[2])
+
+version_data = configuration_data()
+version_data.set('LIBOSINFO_MAJOR_VERSION', version_major)
+version_data.set('LIBOSINFO_MINOR_VERSION', version_minor)
+version_data.set('LIBOSINFO_MICRO_VERSION', version_micro)
+osinfo_version = configure_file(
+ input: 'osinfo_version.h.in',
+ output: 'osinfo_version.h',
+ configuration: version_data,
+ install_dir: join_paths(libosinfo_includedir, 'libosinfo-1.0', 'osinfo'),
+)
+
+libosinfo_headers = [
+ osinfo_version,
+ 'osinfo.h',
+ 'osinfo_avatar_format.h',
+ 'osinfo_db.h',
+ 'osinfo_loader.h',
+ 'osinfo_datamap.h',
+ 'osinfo_datamaplist.h',
+ 'osinfo_device.h',
+ 'osinfo_devicelink.h',
+ 'osinfo_devicelist.h',
+ 'osinfo_devicelinklist.h',
+ 'osinfo_devicelinkfilter.h',
+ 'osinfo_device_driver.h',
+ 'osinfo_device_driverlist.h',
+ 'osinfo_entity.h',
+ 'osinfo_filter.h',
+ 'osinfo_firmware.h',
+ 'osinfo_firmwarelist.h',
+ 'osinfo_install_config.h',
+ 'osinfo_install_config_param.h',
+ 'osinfo_install_config_paramlist.h',
+ 'osinfo_install_script.h',
+ 'osinfo_install_scriptlist.h',
+ 'osinfo_product.h',
+ 'osinfo_productfilter.h',
+ 'osinfo_productlist.h',
+ 'osinfo_platform.h',
+ 'osinfo_platformlist.h',
+ 'osinfo_list.h',
+ 'osinfo_os.h',
+ 'osinfo_oslist.h',
+ 'osinfo_os_variant.h',
+ 'osinfo_os_variantlist.h',
+ 'osinfo_deployment.h',
+ 'osinfo_deploymentlist.h',
+ 'osinfo_media.h',
+ 'osinfo_medialist.h',
+ 'osinfo_resources.h',
+ 'osinfo_resourceslist.h',
+ 'osinfo_tree.h',
+ 'osinfo_treelist.h',
+ 'osinfo_image.h',
+ 'osinfo_imagelist.h',
+]
+
+# generate osinfo-enum-types.[ch]
+gnome = import('gnome')
+libosinfo_enum_types = gnome.mkenums_simple(
+ 'osinfo_enum_types',
+ sources: libosinfo_headers,
+ install_header: true,
+ install_dir: join_paths(libosinfo_includedir, 'libosinfo-1.0', 'osinfo'))
+
+install_headers(libosinfo_headers, subdir: join_paths('libosinfo-1.0', 'osinfo'))
+
+libosinfo_sources = [
+ 'osinfo_avatar_format.c',
+ 'osinfo_datamap.c',
+ 'osinfo_datamaplist.c',
+ 'osinfo_device.c',
+ 'osinfo_devicelink.c',
+ 'osinfo_devicelist.c',
+ 'osinfo_devicelinklist.c',
+ 'osinfo_devicelinkfilter.c',
+ 'osinfo_device_driver.c',
+ 'osinfo_device_driverlist.c',
+ 'osinfo_entity.c',
+ 'osinfo_filter.c',
+ 'osinfo_firmware.c',
+ 'osinfo_firmwarelist.c',
+ 'osinfo_install_config.c',
+ 'osinfo_install_config_param.c',
+ 'osinfo_install_config_paramlist.c',
+ 'osinfo_install_script.c',
+ 'osinfo_install_scriptlist.c',
+ 'osinfo_product.c',
+ 'osinfo_productfilter.c',
+ 'osinfo_productlist.c',
+ 'osinfo_platform.c',
+ 'osinfo_platformlist.c',
+ 'osinfo_list.c',
+ 'osinfo_oslist.c',
+ 'osinfo_os.c',
+ 'osinfo_os_variant.c',
+ 'osinfo_os_variantlist.c',
+ 'osinfo_deployment.c',
+ 'osinfo_deploymentlist.c',
+ 'osinfo_media.c',
+ 'osinfo_medialist.c',
+ 'osinfo_resources.c',
+ 'osinfo_resourceslist.c',
+ 'osinfo_tree.c',
+ 'osinfo_treelist.c',
+ 'osinfo_image.c',
+ 'osinfo_imagelist.c',
+ 'osinfo_db.c',
+ 'osinfo_loader.c',
+ 'osinfo_util_private.c',
+]
+
+libosinfo_private_headers = [
+ 'osinfo_device_driver_private.h',
+ 'osinfo_install_script_private.h',
+ 'osinfo_product_private.h',
+ 'osinfo_media_private.h',
+ 'osinfo_resources_private.h',
+ 'osinfo_util_private.h',
+ 'ignore-value.h',
+]
+
+libosinfo = library(
+ 'osinfo-1.0',
+ sources: [
+ libosinfo_sources,
+ libosinfo_enum_types,
+ ],
+ dependencies: libosinfo_dependencies,
+ include_directories: libosinfo_include,
+ version: libosinfo_version,
+ darwin_versions: libosinfo_darwin_versions,
+ soversion: libosinfo_soversion,
+ install: true,
+)
+
+libosinfo_dep = declare_dependency(
+ sources: [
+ libosinfo_enum_types,
+ ],
+ link_with: libosinfo,
+ dependencies: libosinfo_dependencies,
+ include_directories: libosinfo_include,
+)
+
+pkgdata = configuration_data()
+pkgdata.set('datarootdir', join_paths(libosinfo_prefix, 'data'))
+pkgdata.set('sysconfdir', join_paths(libosinfo_prefix, 'etc'))
+pkgdata.set('exec_prefix', libosinfo_prefix)
+pkgdata.set('includedir', libosinfo_includedir)
+pkgdata.set('libdir', libosinfo_libdir)
+pkgdata.set('prefix', libosinfo_prefix)
+pkgdata.set('VERSION', meson.project_version())
+configure_file(
+ input: 'libosinfo-1.0.pc.in',
+ output: 'libosinfo-1.0.pc',
+ configuration: pkgdata,
+ install_dir: libosinfo_pkgconfdir,
+)
+
+libosinfo_gir_sources = [
+ libosinfo_headers,
+ libosinfo_sources,
+ libosinfo_enum_types,
+]
+
+if host_machine.system() != 'windows'
+ if enable_introspection
+ libosinfo_gir = gnome.generate_gir(
+ libosinfo,
+ sources: libosinfo_gir_sources,
+ nsversion: '1.0',
+ namespace: 'Libosinfo',
+ export_packages: 'libosinfo-1.0',
+ includes: [
+ 'GObject-2.0',
+ 'Gio-2.0',
+ 'libxml2-2.0',
+ ],
+ dependencies: libosinfo_dependencies,
+ header: 'osinfo/osinfo.h',
+ identifier_prefix: 'Osinfo',
+ symbol_prefix: 'osinfo',
+ install: true,
+ install_dir_gir: libosinfo_girdir,
+ install_dir_typelib: libosinfo_typelibdir,
+ )
+
+ libosinfo_gir_dep = declare_dependency(
+ sources: libosinfo_gir,
+ )
+
+ if enable_vapi
+ libosinfo_vapi = gnome.generate_vapi(
+ 'libosinfo-1.0',
+ install: true,
+ packages: [
+ 'gobject-2.0',
+ 'gio-2.0',
+ 'libxml-2.0',
+ ],
+ sources: libosinfo_gir[0],
+ )
+ endif
+ endif
+endif
diff --git a/po/meson.build b/po/meson.build
new file mode 100644
index 0000000..79c6233
--- /dev/null
+++ b/po/meson.build
@@ -0,0 +1,2 @@
+i18n = import('i18n')
+i18n.gettext(meson.project_name(), preset: 'glib')
diff --git a/tests/check-symfile b/tests/check-symfile
new file mode 100755
index 0000000..0888237
--- /dev/null
+++ b/tests/check-symfile
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+$MESON_SOURCE_ROOT/osinfo/check-symfile.pl $MESON_SOURCE_ROOT/osinfo/libosinfo.syms $MESON_BUILD_ROOT/osinfo/libosinfo-1.0.so
diff --git a/tests/check-symsorting b/tests/check-symsorting
new file mode 100755
index 0000000..577c19c
--- /dev/null
+++ b/tests/check-symsorting
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+$MESON_SOURCE_ROOT/osinfo/check-symsorting.pl $MESON_SOURCE_ROOT/osinfo $MESON_SOURCE_ROOT/osinfo/libosinfo.syms
diff --git a/tests/meson.build b/tests/meson.build
new file mode 100644
index 0000000..f425d0a
--- /dev/null
+++ b/tests/meson.build
@@ -0,0 +1,61 @@
+if host_machine.system() == 'linux'
+ check_sources = [
+ 'check-symfile',
+ 'check-symsorting',
+ ]
+
+ foreach check: check_sources
+ exe = find_program(check)
+ test(
+ check,
+ exe,
+ suite: 'symbols',
+ env: [
+ 'MESON_SOURCE_ROOT=@0@'.format(meson.source_root()),
+ 'MESON_BUILD_ROOT=@0@'.format(meson.build_root()),
+ ],
+ )
+ endforeach
+endif
+
+tests_sources = [
+ 'test-db.c',
+ 'test-device.c',
+ 'test-devicelinklist.c',
+ 'test-devicelist.c',
+ 'test-entity.c',
+ 'test-filter.c',
+ 'test-firmware.c',
+ 'test-firmwarelist.c',
+ 'test-image.c',
+ 'test-imagelist.c',
+ 'test-install-script.c',
+ 'test-list.c',
+ 'test-loader.c',
+ 'test-media.c',
+ 'test-os.c',
+ 'test-oslist.c',
+ 'test-platform.c',
+ 'test-platformlist.c',
+ 'test-product.c',
+ 'test-productfilter.c',
+ 'test-tree.c',
+]
+
+foreach src: tests_sources
+ name = src.split('.')[0]
+ exe = executable(name,
+ sources: src,
+ dependencies: libosinfo_dep,
+ c_args: [
+ '-DSRCDIR="@0@"'.format(meson.source_root()),
+ '-DBUILDDIR="@0@"'.format(meson.build_root()),
+ ],
+ )
+
+ test(
+ name,
+ exe,
+ suite: 'unit',
+ )
+endforeach
diff --git a/tools/meson.build b/tools/meson.build
new file mode 100644
index 0000000..d24b167
--- /dev/null
+++ b/tools/meson.build
@@ -0,0 +1,68 @@
+# osinfo-detect
+executable(
+ 'osinfo-detect',
+ sources: 'osinfo-detect.c',
+ dependencies: [
+ glib_dep,
+ gio_dep,
+ gobject_dep,
+ libxml_dep,
+ libosinfo_dep,
+ ],
+ install: true,
+)
+
+# osinfo-install-script
+executable(
+ 'osinfo-install-script',
+ sources: 'osinfo-install-script.c',
+ dependencies: [
+ glib_dep,
+ gio_dep,
+ gobject_dep,
+ libosinfo_dep,
+ ],
+ install: true,
+)
+
+# osinfo-query
+executable(
+ 'osinfo-query',
+ sources: 'osinfo-query.c',
+ dependencies: [
+ glib_dep,
+ gio_dep,
+ gobject_dep,
+ libxml_dep,
+ libosinfo_dep,
+ ],
+ install: true,
+)
+
+# man pages
+pod2man = find_program('pod2man')
+if pod2man.found()
+ files = [
+ 'osinfo-detect',
+ 'osinfo-install-script',
+ 'osinfo-query',
+ ]
+
+ foreach file: files
+ custom_target(
+ file + '.1',
+ output: file + '.1',
+ input: file + '.c',
+ install: true,
+ install_dir: join_paths(libosinfo_datadir, 'man', 'man1'),
+ build_by_default: true,
+ command: [
+ pod2man,
+ '-c', 'Libosinfo',
+ '-r', meson.project_name() + '-' + meson.project_version(),
+ '--name', file,
+ '@INPUT@', '@OUTPUT@',
+ ]
+ )
+ endforeach
+endif