summaryrefslogtreecommitdiff
path: root/meson.build
blob: b224c4b10c92edbb8881c45343a9d68d1c8a3780 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88

project('shared-mime-info',
    'c',
    version: '2.0',
    meson_version: '>=0.49.0'
)

config = configuration_data()

i18n = import('i18n')

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')

configure_file(
    input: 'shared-mime-info.pc.in',
    output: '@BASENAME@',
    configuration: {
        'prefix': get_option('prefix'),
        'VERSION': meson.project_version()
    },
    install_dir: get_option('datadir') / 'pkgconfig'
)

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