meson.build 7.39 KB
Newer Older
1
2
project(
  'totem', 'c',
Bastien Nocera's avatar
Bastien Nocera committed
3
  version: '41.alpha.0',
Bastien Nocera's avatar
Bastien Nocera committed
4
  license: 'GPL2+ with exception',
5
  default_options: 'buildtype=debugoptimized',
Bastien Nocera's avatar
Bastien Nocera committed
6
  meson_version: '>= 0.50.0'
7
8
9
10
11
)

totem_version = meson.project_version()
version_array = totem_version.split('.')
totem_major_version = version_array[0].to_int()
Bastien Nocera's avatar
Bastien Nocera committed
12
totem_minor_version = version_array[1]
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
totem_micro_version = version_array[2].to_int()

totem_api_version = '1.0'

totem_api_path = join_paths(meson.project_name(), totem_api_version)

totem_gir_ns = 'Totem'

totem_prefix = get_option('prefix')
totem_bindir = join_paths(totem_prefix, get_option('bindir'))
totem_datadir = join_paths(totem_prefix, get_option('datadir'))
totem_libdir = join_paths(totem_prefix, get_option('libdir'))
totem_libexecdir = join_paths(totem_prefix, get_option('libexecdir'))
totem_localedir = join_paths(totem_prefix, get_option('localedir'))
totem_mandir = join_paths(totem_prefix, get_option('mandir'))

totem_pkglibdir = join_paths(totem_libdir, meson.project_name())
totem_pkgdatadir = join_paths(totem_datadir, meson.project_name())

totem_pluginsdir = join_paths(totem_pkglibdir, 'plugins')
totem_schemadir = join_paths(totem_datadir, 'glib-2.0', 'schemas')

soversion = 0
current = 0
revision = 0
libversion = '@0@.@1@.@2@'.format(soversion, current, revision)

40
totem_debug = get_option('buildtype').contains('debug')
41
42
43

cc = meson.get_compiler('c')

44
45
46
47
48
49
50
51
52
53
if get_option('profile') == 'development'
  profile = '.Devel'
  name_suffix = ' ☢️'
else
  profile = ''
  name_suffix = ''
endif

application_id = 'org.gnome.Totem@0@'.format(profile)

54
55
56
config_h = configuration_data()

# debug options
57
config_h.set('GNOME_ENABLE_DEBUG', totem_debug)
58
59
60
61
62
63

# defines
set_defines = [
  # package
  ['PACKAGE', meson.project_name()],
  ['TOTEM_API_VERSION', totem_api_version],
64
  ['APPLICATION_ID', application_id],
65
66
67
68
69
70
71
72
  ['VERSION', totem_version],
  # i18n
  ['GETTEXT_PACKAGE', meson.project_name()]
]

foreach define: set_defines
  config_h.set_quoted(define[0], define[1])
endforeach
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95

# Compiler flags
common_flags = [
  '-DHAVE_CONFIG_H',
  '-D_REENTRANT',
  '-DGCONF_DISABLE_DEPRECATED',
  '-DGCONF_DISABLE_SINGLE_INCLUDES',
  '-DBONOBO_DISABLE_DEPRECATED',
  '-DBONOBO_DISABLE_SINGLE_INCLUDES',
  '-DBONOBO_UI_DISABLE_DEPRECATED',
  '-DBONOBO_UI_DISABLE_SINGLE_INCLUDES',
  '-DGNOME_DISABLE_DEPRECATED',
  '-DGNOME_DISABLE_SINGLE_INCLUDES',
  '-DLIBGLADE_DISABLE_DEPRECATED',
  '-DLIBGLADE_DISABLE_SINGLE_INCLUDES',
  '-DGNOME_VFS_DISABLE_DEPRECATED',
  '-DGNOME_VFS_DISABLE_SINGLE_INCLUDES',
  '-DWNCK_DISABLE_DEPRECATED',
  '-DWNCK_DISABLE_SINGLE_INCLUDES',
  '-DLIBSOUP_DISABLE_DEPRECATED',
  '-DLIBSOUP_DISABLE_SINGLE_INCLUDES'
]

96
97
warn_flags = []

98
if totem_debug
99
100
101
102
103
104
105
106
107
  test_cflags = [
    '-fno-strict-aliasing',
    '-Wcast-align',
    '-Wmissing-declarations',
    '-Wmissing-prototypes',
    '-Wnested-externs',
    '-Wpointer-arith'
  ]

108
  common_flags += cc.get_supported_arguments(test_cflags)
109
110
111
112
113
114
115
116
117
118
119
120

  test_cflags = [
    '-Werror=format=2',
    '-Werror=implicit-function-declaration',
    '-Werror=init-self',
    '-Werror=missing-include-dirs',
    '-Werror=missing-prototypes',
    '-Werror=pointer-arith',
    '-Werror=return-type',
    '-Wstrict-prototypes'
  ]

121
  warn_flags += cc.get_supported_arguments(test_cflags)
122
123
endif

124
125
add_project_arguments(common_flags, language: 'c')

126
glib_req_version = '>= 2.56.0'
Gabor Karsay's avatar
Gabor Karsay committed
127
gtk_req_version = '>= 3.22.0'
128
129
130
gst_req_version = '>= 1.6.0'
grilo_req_version = '>= 0.3.0'
peas_req_version = '>= 1.1.0'
131
totem_plparser_req_version = '>= 3.26.5'
132
133
134
135
136
137
138
139

glib_dep =  dependency('glib-2.0', version: glib_req_version)
gobject_dep =  dependency('gobject-2.0', version: glib_req_version)
gio_dep = dependency('gio-2.0', version: '>= 2.43.4')
gtk_dep = dependency('gtk+-3.0', version: gtk_req_version)
gst_dep = dependency('gstreamer-1.0', version: gst_req_version)
gst_tag_dep = dependency('gstreamer-tag-1.0', version: '>= 0.11.93')
gst_video_dep = dependency('gstreamer-video-1.0')
140
gst_pbutils_dep = dependency('gstreamer-pbutils-1.0')
141
142
143
144
145
146
147
148
149
150
151
152
peas_dep = dependency('libpeas-1.0', version: peas_req_version)
peas_gtk_dep = dependency('libpeas-gtk-1.0', version: peas_req_version)
totem_plparser_dep = dependency('totem-plparser', version: totem_plparser_req_version)
clutter_gtk_dep = dependency('clutter-gtk-1.0', version: '>= 1.8.1')
m_dep = cc.find_library('m', required: true)

libgd = subproject(
  'libgd',
  default_options: [
    'static=true',
    'with-gtk-hacks=true',
    'with-main-view=true',
153
    'with-main-icon-view=true',
154
155
156
157
158
    'with-tagged-entry=true',
  ]
)
libgd_dep = libgd.get_variable('libgd_dep')

159
gir_dep = dependency('gobject-introspection-1.0', version: '>= 0.6.7')
160
161
162

# missing plugins support
easy_codec_option = get_option('enable-easy-codec-installation')
163
have_easy_codec = false
164
if easy_codec_option != 'no'
165
  have_easy_codec = true
166
endif
167
168
config_h.set('ENABLE_MISSING_PLUGIN_INSTALLATION', have_easy_codec,
             description: 'Whether we can and want to do installation of missing plugins')
169
170
171
172
173
174
175

# python support
have_python = false
python_deps = []

python_option = get_option('enable-python')
if python_option != 'no'
176
  python = import('python').find_installation('python3')
177
  if python.found()
178
    python_req_version = '>= 3.0'
179

180
    r = run_command([python, '--version'], check: true)
181
    python_version = r.stdout().split(' ')[1]
182
183

    pygobject_dep = dependency('pygobject-3.0', version: '>= 2.90.3', required: false)
184
    pylint = find_program('pylint-3', 'pylint3', 'pylint', required: false)
185

Bastien Nocera's avatar
Bastien Nocera committed
186
    if python_version.version_compare(python_req_version) and pygobject_dep.found()
187
188
189
190
191
192
193
      have_python = true
      python_deps += pygobject_dep
      meson.add_install_script('meson_compile_python.py')
    endif
  endif

  if not have_python
Bastien Nocera's avatar
Bastien Nocera committed
194
    str = 'python ' + python_req_version + ', pygobject not found'
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
    if python_option == 'yes'
      error(str)
    endif
    message(str + ', disabling Python support')
  endif
endif

configure_file(
  output: 'config.h',
  configuration: config_h
)

gnome = import('gnome')
i18n = import('i18n')
pkg = import('pkgconfig')

po_dir = join_paths(meson.source_root(), 'po')

top_inc = include_directories('.')

subdir('po')
subdir('data')
217
218
219
if get_option('help')
  subdir('help')
endif
220
221
222
subdir('src')

if get_option('enable-gtk-doc')
223
  subdir('docs/reference')
224
225
226
227
endif

meson.add_install_script('meson_post_install.py')

Bastien Nocera's avatar
Bastien Nocera committed
228
229
230
is_stable = (totem_minor_version != 'alpha' and
  totem_minor_version != 'beta' and
  totem_minor_version != 'rc')
231
232
233
234
235
236
237
238
239
240
241
242
243
244
if is_stable
  meson.add_dist_script(
    find_program('check-news.sh').path(),
    '@0@'.format(meson.project_version()),
    'NEWS',
    'data/appdata/org.gnome.Totem.appdata.xml.in'
  )
else
  meson.add_dist_script(
    find_program('check-news.sh').path(),
    '@0@'.format(meson.project_version()),
    'NEWS',
  )
endif
245

246
247
248
249
meson.add_dist_script(
  find_program('remove-flatpak-dist.sh').path()
)

250
251
252
message('Totem was configured with the following options:')
message('** Using the GStreamer-1.0 backend')

253
254
255
256
257
258
259
str = 'Development build'
if get_option('profile') == 'development'
  message('** ' + str + ' enabled')
else
  message('   ' + str + ' disabled')
endif

260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
str = 'Easy codec installation support'
if have_easy_codec
  message('** ' + str + ' enabled')
else
  message('   ' + str + ' disabled')
endif

str = 'Python plugin support'
if have_python
  message('** ' + str + ' enabled')
else
  message('   ' + str + ' disabled')
endif

foreach plugin: allowed_plugins
  if plugins.contains(plugin)
    message('** ' + plugin + ' plugin enabled')
  else
    message('   ' + plugin + ' plugin disabled')
  endif
endforeach

message('End options')