summaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
authorFélix Piédallu <felix@piedallu.me>2020-02-20 16:12:53 +0100
committerBastien Nocera <hadess@hadess.net>2020-02-20 18:05:39 +0100
commit41267fdbe47c93d377f314780be7b9fb5715686a (patch)
treead7097f5a6384363ac8be8232fa0cdff881c8157 /meson.build
parentbf8b2e770e2523827a1f13dcb8146e7b407cdb67 (diff)
downloadshared-mime-info-41267fdbe47c93d377f314780be7b9fb5715686a.tar.gz
build: Add meson build system
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build87
1 files changed, 87 insertions, 0 deletions
diff --git a/meson.build b/meson.build
new file mode 100644
index 00000000..f1da3539
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,87 @@
+
+project('shared-mime-info',
+ 'c',
+ version: '1.15',
+ meson_version: '>=0.49.0'
+)
+
+config = configuration_data()
+
+i18n = import('i18n')
+pkgconfig = import('pkgconfig')
+
+cc = meson.get_compiler('c')
+
+###############################################################################
+# Project configuration
+
+config.set_quoted('PACKAGE', meson.project_name())
+config.set_quoted('VERSION', meson.project_version())
+
+###############################################################################
+# Find tools
+
+itstool = find_program('itstool')
+xmllint = find_program('xmllint')
+xmlto = find_program('xmlto')
+
+###############################################################################
+# Find xdgmime
+
+xdgmime = get_option('xdgmime-path') / 'src'
+
+xdgmime_print_mime_data = find_program(xdgmime/'print-mime-data', required: false)
+xdgmime_test_mime_data = find_program(xdgmime/'test-mime-data', required: false)
+xdgmime_test_mime = find_program(xdgmime/'test-mime', required: false)
+xdgmime_found = (
+ xdgmime_print_mime_data.found() and
+ xdgmime_test_mime_data.found() and
+ xdgmime_test_mime.found()
+)
+
+if not xdgmime_found
+ warning('''
+***************************************************************************
+*** xdgmime not compiled, test suite cannot run. Check HACKING for info ***
+***************************************************************************
+ ''')
+endif
+
+###############################################################################
+# Dependencies
+
+check_functions = [
+ 'fdatasync',
+]
+foreach function : check_functions
+ config.set('HAVE_'+function.to_upper(), cc.has_function(function))
+endforeach
+
+
+libxml = dependency('libxml-2.0', version: '>=2.4')
+glib2 = dependency('glib-2.0', version: '>=2.6.0')
+
+gio = dependency('gio-2.0', required: false)
+
+subdir('po')
+subdir('data')
+subdir('src')
+subdir('tests')
+
+if get_option('update-mimedb')
+ upd_tool = (meson.is_cross_build()
+ ? find_program('update-mime-database').path()
+ : update_mime_database.full_path()
+ )
+ meson.add_install_script('sh', '-c', ' '.join([
+ upd_tool, '-V', '${MESON_INSTALL_DESTDIR_PREFIX}' / get_option('datadir') / 'mime',
+ ]))
+endif
+
+run_target('Changelog',
+ command: [ 'env',
+ 'git', 'log', '--stat',
+ '--after="Tue Oct 6 14:46:33 2009 +0000"',
+ '>', meson.source_root() / 'Changelog',
+ ],
+)