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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
|
pango_sources = [
'break.c',
'ellipsize.c',
'fonts.c',
'glyphstring.c',
'modules.c',
'pango-attributes.c',
'pango-bidi-type.c',
'pango-color.c',
'pango-context.c',
'pango-coverage.c',
'pango-emoji.c',
'pango-engine.c',
'pango-fontmap.c',
'pango-fontset.c',
'pango-glyph-item.c',
'pango-gravity.c',
'pango-item.c',
'pango-language.c',
'pango-layout.c',
'pango-markup.c',
'pango-matrix.c',
'pango-renderer.c',
'pango-script.c',
'pango-tabs.c',
'pango-utils.c',
'reorder-items.c',
'shape.c',
'pangofc-shape.c',
]
pango_headers = [
'pango.h',
'pango-attributes.h',
'pango-bidi-type.h',
'pango-break.h',
'pango-context.h',
'pango-coverage.h',
'pango-direction.h',
'pango-engine.h',
'pango-font.h',
'pango-fontmap.h',
'pango-fontset.h',
'pango-glyph.h',
'pango-glyph-item.h',
'pango-gravity.h',
'pango-item.h',
'pango-language.h',
'pango-layout.h',
'pango-matrix.h',
'pango-modules.h',
'pango-renderer.h',
'pango-script.h',
'pango-tabs.h',
'pango-types.h',
'pango-utils.h',
'pango-version-macros.h',
]
install_headers(pango_headers, subdir: pango_api_path)
# Features header
pango_features_conf = configuration_data()
pango_features_conf.set('PANGO_VERSION_MAJOR', pango_major_version)
pango_features_conf.set('PANGO_VERSION_MINOR', pango_minor_version)
pango_features_conf.set('PANGO_VERSION_MICRO', pango_micro_version)
pango_features_conf.set('PANGO_API_VERSION', pango_api_version)
pango_features_conf.set('PANGO_CURRENT_MINUS_AGE', '0')
configure_file(
input: 'pango-features.h.meson',
output: 'pango-features.h',
configuration: pango_features_conf,
install: true,
install_dir: join_paths(pango_includedir, pango_api_path),
)
# Enumerations for GType
pango_enums = gnome.mkenums(
'pango-enum-types',
sources: pango_headers,
c_template: 'pango-enum-types.c.template',
h_template: 'pango-enum-types.h.template',
install_dir: join_paths(pango_includedir, pango_api_path),
install_header: true,
)
pango_enum_h = pango_enums[1]
if host_system == 'windows'
pango_rc = configure_file(
input: 'pango.rc.in',
output: 'pango.rc',
configuration: pango_features_conf,
)
pango_res = import('windows').compile_resources(pango_rc)
pango_sources += pango_res
endif
pango_cflags = [
'-DG_LOG_DOMAIN="Pango"',
'-DG_LOG_USE_STRUCTURED=1',
'-DPANGO_COMPILATION',
'-DSYSCONFDIR="@0@"'.format(pango_sysconfdir),
'-DLIBDIR="@0@"'.format(pango_libdir),
]
pango_inc = include_directories('.')
libpango = library(
pango_api_name,
sources: pango_sources + pango_enums,
version: pango_libversion,
soversion: pango_soversion,
darwin_versions : pango_osxversion,
install: true,
dependencies: pango_deps,
include_directories: [ root_inc, pango_inc ],
c_args: common_cflags + pango_debug_cflags + pango_cflags,
link_args: common_ldflags,
)
pango_dep_sources = [pango_enum_h]
build_gir = get_option('introspection')
if build_gir
gir_args = [
'--quiet',
]
pango_gir = gnome.generate_gir(
libpango,
sources: pango_sources + pango_headers + [ pango_enum_h ],
namespace: 'Pango',
nsversion: pango_api_version,
identifier_prefix: 'Pango',
symbol_prefix: 'pango',
export_packages: 'pango',
includes: [ 'HarfBuzz-0.0', 'GObject-2.0', 'cairo-1.0', ],
header: 'pango/pango.h',
install: true,
extra_args: gir_args,
)
pango_gir_dep = declare_dependency(sources: pango_gir)
pango_dep_sources += pango_gir
endif
libpango_dep = declare_dependency(
link_with: libpango,
include_directories: pango_inc,
dependencies: pango_deps,
sources: pango_dep_sources,
)
pkgconfig.generate(libpango,
name: 'Pango',
description: 'Internationalized text handling',
version: meson.project_version(),
requires: ['gobject-2.0', 'harfbuzz'],
filebase: 'pango',
subdirs: pango_api_name,
install_dir: join_paths(pango_libdir, 'pkgconfig'),
)
# FreeType
if build_pangoft2
pangofc_headers = [
'pangofc-font.h',
'pangofc-fontmap.h',
'pangofc-decoder.h',
]
pangofc_public_sources = [
'pangofc-font.c',
'pangofc-fontmap.c',
'pangofc-decoder.c',
]
pangoot_headers = [
'pango-ot.h',
]
pangoot_public_sources = [
'pango-ot-buffer.c',
'pango-ot-info.c',
'pango-ot-ruleset.c',
'pango-ot-tag.c',
]
pangoft2_headers = [
'pangoft2.h',
]
pangoft2_public_sources = [
'pangoft2-fontmap.c',
'pangoft2-render.c',
'pangoft2.c',
]
pangoft2_sources = pangofc_public_sources + pangoot_public_sources + pangoft2_public_sources
if host_system == 'windows'
pangoft2_rc = configure_file(
input: 'pangoft2.rc.in',
output: 'pangoft2.rc',
configuration: pango_features_conf,
)
pangoft2_res = import('windows').compile_resources(pangoft2_rc)
pangoft2_sources += pangoft2_res
endif
install_headers(pangoft2_headers + pangofc_headers + pangoot_headers, subdir: pango_api_path)
libpangoft2 = library(
'pangoft2-@0@'.format(pango_api_version),
sources: pangoft2_sources,
version: pango_libversion,
soversion: pango_soversion,
darwin_versions : pango_osxversion,
install: true,
dependencies: pango_deps + [ libpango_dep ],
include_directories: [ root_inc, pango_inc ],
c_args: common_cflags + pango_debug_cflags + pango_cflags + [
'-DPANGO_DISABLE_DEPRECATION_WARNINGS',
],
link_args: common_ldflags,
)
pangoft2_dep_sources = []
if build_gir
pangofc_gir = gnome.generate_gir(
libpangoft2,
sources: pangofc_headers + pangofc_public_sources,
dependencies: [ libpango_dep, pango_gir_dep ],
namespace: 'PangoFc',
nsversion: pango_api_version,
identifier_prefix: 'PangoFc',
symbol_prefix: 'pango_fc',
export_packages: 'pangoft2',
includes: [ pango_gir[0], 'fontconfig-2.0', ],
header: 'pango/pangoft2.h',
install: true,
extra_args: gir_args,
)
pangofc_gir_dep = declare_dependency(sources: pangofc_gir)
pangoft2_dep_sources += pangofc_gir
# Deprecated API, still needed for PangoXft
pangoot_gir = gnome.generate_gir(
libpangoft2,
sources: pangoot_headers + pangoot_public_sources,
dependencies: [ libpango_dep, pango_gir_dep, pangofc_gir_dep ],
namespace: 'PangoOT',
nsversion: pango_api_version,
identifier_prefix: 'PangoOT',
symbol_prefix: 'pango_ot',
export_packages: 'pangoft2',
includes: [ pangofc_gir[0], 'freetype2-2.0', ],
header: 'pango/pangoft2.h',
install: true,
extra_args: gir_args,
)
pangoot_gir_dep = declare_dependency(sources: pangoot_gir)
pangoft2_dep_sources += pangoot_gir
pangoft2_gir = gnome.generate_gir(
libpangoft2,
sources: pangoft2_headers + pangoft2_public_sources,
dependencies: [ libpango_dep, pango_gir_dep, pangofc_gir_dep, pangoot_gir_dep ],
namespace: 'PangoFT2',
nsversion: pango_api_version,
identifier_prefix: 'PangoFT2',
symbol_prefix: 'pango_ft2',
export_packages: 'pangoft2',
includes: [ pangofc_gir[0], 'freetype2-2.0', ],
header: 'pango/pangoft2.h',
install: true,
extra_args: gir_args,
)
pangoft2_gir_dep = declare_dependency(sources: pangoft2_gir)
pangoft2_dep_sources += pangoft2_gir
endif
libpangoft2_dep = declare_dependency(
link_with: libpangoft2,
include_directories: pango_inc,
dependencies: pango_deps + [ libpango_dep ],
sources: pangoft2_dep_sources,
)
pkgconfig.generate(libpangoft2,
name: 'Pango FT2 and Pango Fc',
description: 'Freetype 2.0 and fontconfig font support for Pango',
version: meson.project_version(),
filebase: 'pangoft2',
subdirs: pango_api_name,
requires: [ 'pango', freetype2_pc, fontconfig_pc ],
install_dir: join_paths(pango_libdir, 'pkgconfig'),
)
else
# For usage as a subproject
libpangoft2_dep = dependency('', required : false)
# Needed for making ft2 no-op while generating pangoxft_gir below
pangoft2_gir_dep = dependency('', required : false)
pangoft2_gir = [[]]
endif
# Xft
if xft_dep.found() and fontconfig_dep.found()
pangoxft_headers = [
'pangoxft.h',
'pangoxft-render.h',
]
pangoxft_sources = [
'pangoxft-font.c',
'pangoxft-fontmap.c',
'pangoxft-render.c',
]
install_headers(pangoxft_headers, subdir: pango_api_path)
libpangoxft = library(
'pangoxft-@0@'.format(pango_api_version),
sources: pangoxft_sources,
version: pango_libversion,
soversion: pango_soversion,
darwin_versions : pango_osxversion,
install: true,
dependencies: pango_deps + [ libpango_dep, libpangoft2_dep ],
include_directories: [ root_inc, pango_inc ],
c_args: common_cflags + pango_debug_cflags + pango_cflags + [
'-DPANGO_DISABLE_DEPRECATION_WARNINGS',
],
link_args: common_ldflags,
)
pangoxft_dep_sources = []
if build_gir
pangoxft_gir = gnome.generate_gir(
libpangoxft,
sources: pangoxft_headers + pangoxft_sources,
dependencies: [ libpango_dep, libpangoft2_dep, pango_gir_dep, pangoot_gir_dep, pangoft2_gir_dep ],
namespace: 'PangoXft',
nsversion: pango_api_version,
identifier_prefix: 'PangoXft',
symbol_prefix: 'pango_xft',
export_packages: 'pangoxft',
includes: [ pango_gir[0], pangoot_gir[0], pangoft2_gir[0], 'GObject-2.0', 'xft-2.0', 'xlib-2.0' ],
header: 'pango/pangoxft.h',
install: true,
extra_args: gir_args,
)
pangoxft_dep_sources += pangoxft_gir
endif
libpangoxft_dep = declare_dependency(
link_with: libpangoxft,
include_directories: root_inc,
dependencies: pango_deps + [ libpango_dep, libpangoft2_dep ],
sources: pangoxft_dep_sources,
)
pkgconfig.generate(libpangoxft,
name: 'Pango Xft',
description: 'Xft font support for Pango',
version: meson.project_version(),
filebase: 'pangoxft',
subdirs: pango_api_name,
requires: [ 'pangoft2', 'xft' ],
install_dir: join_paths(pango_libdir, 'pkgconfig'),
)
else
# For usage as a subproject
libpangoxft_dep = dependency('', required: false)
endif
# Win32
if host_system == 'windows'
pangowin32_headers = [
'pangowin32.h',
]
pangowin32_sources = [
'pangowin32.c',
'pangowin32-fontcache.c',
'pangowin32-fontmap.c',
]
pangowin32_deps = pango_deps + [
libpango_dep,
cc.find_library('gdi32'),
]
pangowin32_rc = configure_file(
input: 'pangowin32.rc.in',
output: 'pangowin32.rc',
configuration: pango_features_conf,
)
pangowin32_res = import('windows').compile_resources(pangowin32_rc)
pangowin32_sources += pangowin32_res
install_headers(pangowin32_headers, subdir: pango_api_path)
libpangowin32 = library(
'pangowin32-@0@'.format(pango_api_version),
sources: pangowin32_sources,
version: pango_libversion,
soversion: pango_soversion,
install: true,
dependencies: pangowin32_deps,
include_directories: [ root_inc, pango_inc ],
c_args: common_cflags + pango_debug_cflags + pango_cflags + [
'-DPANGO_DISABLE_DEPRECATION_WARNINGS',
],
link_args: common_ldflags,
)
libpangowin32_dep = declare_dependency(
link_with: libpangowin32,
include_directories: root_inc,
dependencies: pango_deps + [ libpango_dep ],
)
pkgconfig.generate(libpangowin32,
name: 'Pango Win32',
description: 'Win32 GDI font support for Pango',
version: meson.project_version(),
filebase: 'pangowin32',
subdirs: pango_api_name,
requires: 'pango',
install_dir: join_paths(pango_libdir, 'pkgconfig'),
)
else
# For usage as a subproject
libpangowin32_dep = dependency('', required: false)
endif
# Cairo
if cairo_dep.found()
pangocairo_headers = [
'pangocairo.h',
]
pangocairo_sources = [
'pangocairo-context.c',
'pangocairo-font.c',
'pangocairo-fontmap.c',
'pangocairo-render.c',
]
pangocairo_deps = pango_deps + [ libpango_dep ]
if pango_font_backends.contains('freetype')
pangocairo_sources += [
'pangocairo-fcfont.c',
'pangocairo-fcfontmap.c',
]
pangocairo_deps += libpangoft2_dep
endif
if host_system == 'windows' and pango_font_backends.contains('win32')
pangocairo_sources += [
'pangocairo-win32font.c',
'pangocairo-win32fontmap.c',
]
pangocairo_rc = configure_file(
input: 'pangocairo.rc.in',
output: 'pangocairo.rc',
configuration: pango_features_conf,
)
pangocairo_res = import('windows').compile_resources(pangocairo_rc)
pangocairo_sources += pangocairo_res
pangocairo_deps += cc.find_library('gdi32')
pangocairo_deps += libpangowin32_dep
endif
if host_system == 'darwin' and pango_font_backends.contains('quartz')
pangocairo_sources += [
'pangocoretext.c',
'pangocoretext-fontmap.c',
'pangocairo-coretextfont.c',
'pangocairo-coretextfontmap.c',
]
endif
install_headers(pangocairo_headers, subdir: pango_api_path)
libpangocairo = library(
'pangocairo-@0@'.format(pango_api_version),
sources: pangocairo_sources,
version: pango_libversion,
soversion: pango_soversion,
darwin_versions : pango_osxversion,
install: true,
dependencies: pango_deps + pangocairo_deps,
include_directories: [ root_inc, pango_inc ],
c_args: common_cflags + pango_debug_cflags + pango_cflags + [
'-DPANGO_DISABLE_DEPRECATION_WARNINGS',
],
link_args: common_ldflags
)
pangocairo_dep_sources = []
if build_gir
pangocairo_gir = gnome.generate_gir(
libpangocairo,
sources: pangocairo_headers + pangocairo_sources,
dependencies: [ pangocairo_deps, pango_gir_dep ],
namespace: 'PangoCairo',
nsversion: pango_api_version,
identifier_prefix: 'PangoCairo',
symbol_prefix: 'pango_cairo',
export_packages: 'pangocairo',
includes: [ pango_gir[0], 'GObject-2.0', 'cairo-1.0' ],
header: 'pango/pangocairo.h',
install: true,
extra_args: gir_args,
)
pangocairo_dep_sources += pangocairo_gir
endif
libpangocairo_dep = declare_dependency(
link_with: libpangocairo,
include_directories: root_inc,
dependencies: pango_deps + [ libpango_dep ],
sources: pangocairo_dep_sources,
)
# Create pangocairo.pc according to whether we found Cairo
# manually
if ['pkgconfig', 'internal'].contains(cairo_found_type)
pango_cairo_requires = [ 'pango', cairo_pc ]
else
pango_cairo_requires = [ 'pango' ]
endif
pkgconfig.generate(libpangocairo,
name: 'Pango Cairo',
description: 'Cairo rendering support for Pango',
version: meson.project_version(),
filebase: 'pangocairo',
subdirs: pango_api_name,
requires: pango_cairo_requires,
install_dir: join_paths(pango_libdir, 'pkgconfig'),
)
else
# For usage as a subproject
libpangocairo_dep = dependency('', required: false)
endif
|