summaryrefslogtreecommitdiff
path: root/meson.build
blob: 0c2005c0b00e6ac7aebdf75cbc7758e5cf471a83 (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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#
# meson.build
#
# Author: Juan A. Suarez Romero <jasuarez@igalia.com>
#
# Copyright (C) 2016 Igalia S.L. All rights reserved.

project('grilo', 'c',
        version: '0.3.13',
        default_options: [
            'buildtype=debugoptimized',
            'c_std=gnu99',
            'warning_level=1'
        ],
        license: 'LGPL 2.1',
        meson_version: '>= 0.46.0')

grilo_version = meson.project_version()
grlnet_version = meson.project_version()
grlpls_version = meson.project_version()

# maintaining compatibility with the previous libtool versioning
# current = minor * 100 + micro
version_array = grilo_version.split('.')
soversion = version_array[0]
current = version_array[1].to_int() * 100 + version_array[2].to_int()

# Increase the age everytime new API is added
grilo_interface_age = 1
grlnet_interface_age = 0
grlpls_interface_age = 0

grilo_lt_version = '@0@.@1@.@2@'.format(soversion, current, grilo_interface_age)
grlnet_lt_version = '@0@.@1@.@2@'.format(soversion, current, grlnet_interface_age)
grlpls_lt_version = '@0@.@1@.@2@'.format(soversion, current, grlpls_interface_age)

grl_majorminor = '@0@.@1@'.format(version_array[0], version_array[1])
grl_name = '@0@-@1@'.format(meson.project_name(), grl_majorminor)

glib2_required = '2.58'
glib2_required_info = '>= @0@'.format(glib2_required)

gio_dep = dependency('gio-2.0', version: glib2_required_info, required: true)
glib_dep = dependency('glib-2.0', version: glib2_required_info, required: true)
gmodule_dep = dependency('gmodule-2.0', version: glib2_required_info, required: true)
gobject_dep = dependency('gobject-2.0', version: glib2_required_info, required: true)
libxml_dep = dependency('libxml-2.0', required: true)

enable_grlnet = get_option('enable-grl-net')
if enable_grlnet
    libsoup_dep = dependency('libsoup-2.4', version: '>= 2.41.3', required: true)
endif

enable_grlpls = get_option('enable-grl-pls')
if enable_grlpls
    totem_plparser_dep = dependency('totem-plparser', version: '>= 3.4.1', required: true)
endif

enable_gir = get_option('enable-introspection') or get_option('enable-vala')
if enable_gir
   find_program('g-ir-scanner', required: true)
endif

enable_vala = get_option('enable-vala')
if enable_vala
    find_program('vapigen', required: true)
endif

enable_testui = get_option('enable-test-ui')
if enable_testui
    gtk_dep = dependency('gtk+-3.0', version: '>= 3.14', required: true)
    oauth_dep = dependency('oauth', required: false)
endif

source_root = meson.current_source_dir()

prefix = get_option('prefix')
includedir = join_paths(prefix, get_option('includedir'))
libdir = join_paths(prefix, get_option('libdir'))
plugins_dir = join_paths(libdir, grl_name)
plugins_dir_for_pc_file = join_paths('${libdir}', grl_name)
localedir = join_paths(prefix, get_option('localedir'))
datadir_unprefixed = get_option('datadir')
datadir = join_paths(prefix, datadir_unprefixed)
datadir_for_pc_file = join_paths('${prefix}', datadir_unprefixed)

girdir = join_paths(datadir, 'gir-1.0')
girdir_for_pc_file = join_paths('${datadir}', 'gir-1.0')
typelibdir = join_paths(libdir, 'girepository-1.0')
typelibdir_for_pc_file = join_paths('${libdir}', 'girepository-1.0')
gobject_introspection = dependency('gobject-introspection-1.0', required: false)
if gobject_introspection.found()
    girdir = gobject_introspection.get_pkgconfig_variable('girdir', define_variable: ['datadir', datadir])
    girdir_for_pc_file = gobject_introspection.get_pkgconfig_variable('girdir', define_variable: ['datadir', '${datadir}'])
    typelibdir = gobject_introspection.get_pkgconfig_variable('typelibdir', define_variable: ['libdir', libdir])
    typelibdir_for_pc_file = gobject_introspection.get_pkgconfig_variable('typelibdir', define_variable: ['libdir', '${libdir}'])
endif

vapidir = join_paths(datadir, 'vala', 'vapi')
vapigen = dependency('vapigen', required: false)
if vapigen.found()
    vapidir = vapigen.get_pkgconfig_variable('vapidir', define_variable: ['datadir', datadir])
endif

cdata = configuration_data()
cdata.set_quoted('VERSION', grilo_version)
cdata.set('GRLNET_VERSION', grlnet_version)
cdata.set('GRLPLS_VERSION', grlpls_version)
cdata.set_quoted('GRL_MAJORMINOR', grl_majorminor)
cdata.set_quoted('GETTEXT_PACKAGE', meson.project_name())
cdata.set_quoted('GRL_PLUGINS_DIR', plugins_dir)
cdata.set_quoted('LOCALEDIR', localedir)
if enable_testui
   cdata.set('HAVE_OAUTH', oauth_dep.found())
endif

gnome = import('gnome')
pkgconfig = import('pkgconfig')

subdir('src')
subdir('libs')
subdir('bindings')
subdir('po')
subdir('tools')
subdir('tests')
subdir('examples')
subdir('doc')