summaryrefslogtreecommitdiff
path: root/meson.build
blob: 4a1c66059a2394ff3274277c889575550d4a65cb (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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
#
# 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.8',
        default_options: [
            'buildtype=debugoptimized',
            'c_std=gnu99',
            'warning_level=1'
        ],
        license: 'LGPL 2.1',
        meson_version: '>= 0.37.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.44'
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('grl_net')
if enable_grlnet
    libsoup_dep = dependency('libsoup-2.4', version: '>= 2.41.3', required: true)
endif

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

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

enable_vala = get_option('vapi')
if enable_vala
    find_program('vapigen', required: true)
endif

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

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)
localedir = join_paths(prefix, get_option('localedir'))
datadir = join_paths(prefix, get_option('datadir'))

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

vapigen = dependency('vapigen', required: false)
if vapigen.found()
    vapidir = vapigen.get_pkgconfig_variable('vapidir', define_variable: ['datadir', datadir])
else
    vapidir = join_paths(datadir, 'vala', 'vapi')
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

pkgconfig_files = [
    'grilo-@0@'.format(grl_majorminor),
    'grilo-net-@0@'.format(grl_majorminor),
    'grilo-pls-@0@'.format(grl_majorminor),
]

pkgconf = configuration_data()
pkgconf.set('prefix', prefix)
pkgconf.set('exec_prefix', '${prefix}')
pkgconf.set('libdir', libdir)
pkgconf.set('includedir', join_paths('${prefix}', includedir))
pkgconf.set('GRL_NAME', grl_name)
pkgconf.set('GRL_PLUGINS_DIR', plugins_dir)
pkgconf.set('INTROSPECTION_GIRDIR', join_paths('${prefix}', girdir))
pkgconf.set('INTROSPECTION_TYPELIBDIR', join_paths('${prefix}', typelibdir))
pkgconf.set('VERSION', grilo_version)
pkgconf.set('GRLNET_VERSION', grlnet_version)
pkgconf.set('GRLPLS_VERSION', grlpls_version)

foreach p: pkgconfig_files
    infile = p + '.pc.in'
    outfile = p + '.pc'
    configure_file(input: infile,
        output: outfile,
        configuration: pkgconf,
        install_dir: join_paths(libdir, 'pkgconfig'))
endforeach

gnome = import('gnome')

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