Commit 41267fdb authored by Salamandar's avatar Salamandar Committed by Bastien Nocera

build: Add meson build system

parent bf8b2e77
install_man('update-mime-database.1')
freedesktop_org_xml = custom_target('freedesktop.org.xml',
input : files(
'freedesktop.org.xml.in',
'its/shared-mime-info.its',
'its/shared-mime-info.loc',
),
output: 'freedesktop.org.xml',
command: [
find_program('freedesktop_generate.sh'),
'--meson',
meson.source_root(),
meson.build_root()
],
install: true,
install_dir: get_option('datadir') / 'mime' / 'packages',
)
custom_target('shared-mime-info-spec-html',
input : 'shared-mime-info-spec.xml',
output: 'shared-mime-info-spec-html',
command: [
xmlto,
'-o', '@OUTPUT@',
'html-nochunks',
'@INPUT@',
],
build_by_default: true,
)
pkgconfig.generate(
name: 'shared-mime-info',
description: 'Freedesktop common MIME database',
version: meson.project_version(),
)
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',
],
)
option('update-mimedb', type: 'boolean', value: false,
description: 'Call update-mime-database after install. It should not be enabled if DESTDIR is used.',
)
option('xdgmime-path', type: 'string', value: './xdgmime',
description: 'Path to the xdgmime executable',
)
i18n.gettext(meson.project_name(),
preset: 'glib',
)
test('translations', find_program('check_translations.sh'))
configure_file(
output: 'config.h',
configuration: config,
)
update_mime_database = executable('update-mime-database',
'update-mime-database.c',
dependencies: [
glib2,
libxml,
],
install: true,
)
test_subclassing = executable('test-subclassing',
'test-subclassing.c',
dependencies: [
glib2,
libxml,
],
install: false,
)
if gio.found()
test_tree_magic = executable('tree-magic',
'test-tree-magic.c',
dependencies:[
glib2,
gio,
],
install: false,
)
endif
if meson.is_cross_build()
subdir_done()
endif
if xdgmime_found
run_target('test-staging',
command: [
find_program('test_staging.sh'),
meson.source_root(),
meson.build_root(),
freedesktop_org_xml,
update_mime_database,
xdgmime_print_mime_data.path(),
]
)
test('test-mime',
find_program('test_mime.sh'),
args: [
meson.source_root(),
meson.build_root(),
freedesktop_org_xml,
update_mime_database,
xdgmime_test_mime_data.path(),
xdgmime_test_mime.path(),
test_tree_magic.full_path(),
],
)
endif
run_target('check-generic-icons',
command: [ find_program('test_generic_icons.sh'), freedesktop_org_xml ],
)
test('No duplicate mime-types',
find_program('test_duplicate_mime_types.sh'),
args: freedesktop_org_xml,
)
test('xmllint freedesktop.org.xml',
xmllint,
args: [ '--noout', '--valid', freedesktop_org_xml, ],
)
test('Case sensitivity',
find_program('test-case-sensitivity.sh'),
)
test('update-mime-database',
update_mime_database,
args: meson.current_source_dir() / 'mime-db-tests',
)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment