summaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2016-08-24 12:20:51 +0100
committerRichard Hughes <richard@hughsie.com>2017-05-10 12:44:02 +0100
commit8122b447e5c85a7addfc19827232d5cfe85b4eba (patch)
tree8c277f330485f7e4ad945c048a7e2687e03a3bbc /meson.build
parentfe18fd82266a0ff1f744d3ae287dc312e09549fa (diff)
downloadappstream-glib-8122b447e5c85a7addfc19827232d5cfe85b4eba.tar.gz
Switch to the meson build system.
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build140
1 files changed, 140 insertions, 0 deletions
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..7cbc5a1
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,140 @@
+project('appstream-glib', 'c',
+ version : '0.7.0',
+ license : 'LGPL-2.1+',
+ default_options : ['warning_level=1'],
+ meson_version : '>=0.37.0'
+)
+
+as_version = meson.project_version()
+varr = as_version.split('.')
+as_major_version = varr[0]
+as_minor_version = varr[1]
+as_micro_version = varr[2]
+
+conf = configuration_data()
+conf.set('AS_MAJOR_VERSION_CONF', as_major_version)
+conf.set('AS_MINOR_VERSION_CONF', as_minor_version)
+conf.set('AS_MICRO_VERSION_CONF', as_micro_version)
+conf.set_quoted('PACKAGE_VERSION', as_version)
+
+# this refers to the plugin API version
+# this is not in any way related to a package or soname version
+as_plugin_version = '5'
+
+# libtool versioning - this applies to libpackagekit
+#
+# See http://sources.redhat.com/autobook/autobook/autobook_91.html#SEC91 for details
+#
+# - If interfaces have been changed or added, but binary compatibility
+# has been preserved, change:
+# CURRENT += 1
+# REVISION = 0
+# AGE += 1
+# - If binary compatibility has been broken (eg removed or changed
+# interfaces), change:
+# CURRENT += 1
+# REVISION = 0
+# AGE = 0
+# - If the interface is the same as the previous version, but bugs are
+# fixed, change:
+# REVISION += 1
+lt_current = '8'
+lt_revision = '10'
+lt_age = '0'
+lt_version = '@0@.@1@.@2@'.format(lt_current, lt_age, lt_revision)
+
+# set plugindir for builder
+plugindir = join_paths(get_option('libdir'), 'asb-plugins-' + as_plugin_version)
+
+glib_ver = '>= 2.45.8'
+uuid = dependency('uuid')
+glib = dependency('glib-2.0', version : glib_ver)
+gmodule = dependency('gmodule-2.0', version : glib_ver)
+giounix = dependency('gio-unix-2.0', version : glib_ver)
+libarchive = dependency('libarchive')
+soup = dependency('libsoup-2.4', version : '>= 2.51.92')
+gdk = dependency('gdk-3.0')
+gdkpixbuf = dependency('gdk-pixbuf-2.0', version : '>= 2.31.5')
+libgcab = dependency('libgcab-1.0', required : false)
+
+# builder (default enabled)
+if get_option('enable-builder')
+ gtk = dependency('gtk+-3.0')
+ gmodule = dependency('gmodule-2.0')
+ gcab = find_program('gcab')
+ if get_option('enable-rpm')
+ rpm = dependency('rpm')
+ conf.set('HAVE_RPM', 1)
+ endif
+ if get_option('enable-alpm')
+ alpm = dependency('libalpm')
+ conf.set('HAVE_ALPM', 1)
+ endif
+ if get_option('enable-fonts')
+ conf.set('HAVE_FONTS', 1)
+ freetype = dependency('freetype2', version : '>= 9.10.0')
+ fontconfig = dependency('fontconfig')
+ endif
+endif
+
+# support loading yaml files
+if get_option('enable-dep11')
+ yaml = dependency('yaml-0.1')
+ conf.set('AS_BUILD_DEP11', 1)
+endif
+
+# support stemming of search tokens
+if get_option('enable-stemmer')
+ cc = meson.get_compiler('c')
+ stemmer = cc.find_library('stemmer')
+ conf.set('HAVE_LIBSTEMMER', 1)
+endif
+
+# use gperf for faster string -> enum matching
+gperf = find_program('gperf', required : false)
+if gperf.found()
+ conf.set('HAVE_GPERF', 1)
+endif
+
+gnome = import('gnome')
+i18n = import('i18n')
+
+conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
+conf.set_quoted('LOCALEDIR', get_option('localedir'))
+conf.set_quoted('LOCALSTATEDIR', get_option('localstatedir'))
+configure_file(
+ output : 'config.h',
+ configuration : conf
+)
+
+add_global_arguments('-DAS_COMPILATION', language : 'c')
+
+subdir('libappstream-glib')
+subdir('data')
+subdir('docs')
+subdir('po')
+
+if get_option('enable-builder')
+ # depends on data
+ subdir('libappstream-builder')
+endif
+
+# depends on libappstream-builder
+subdir('client')
+
+archiver = find_program('git', required : false)
+if archiver.found()
+ run_target('dist',
+ # git config tar.tar.xz.command "xz -c"
+ command: [
+ 'git', 'archive',
+ '--prefix=' + meson.project_name() + '-' + meson.project_version() + '/',
+ 'HEAD',
+ '--format=tar.xz',
+ '--output',
+ meson.project_name() + '-' + meson.project_version() + '.tar.xz'
+ ]
+ )
+else
+ message('git not found, you will not be able to run `ninja dist`')
+endif