1fc_sources = [
2  'fcatomic.c',
3  'fccache.c',
4  'fccfg.c',
5  'fccharset.c',
6  'fccompat.c',
7  'fcdbg.c',
8  'fcdefault.c',
9  'fcdir.c',
10  'fcformat.c',
11  'fcfreetype.c',
12  'fcfs.c',
13  'fcptrlist.c',
14  'fchash.c',
15  'fcinit.c',
16  'fclang.c',
17  'fclist.c',
18  'fcmatch.c',
19  'fcmatrix.c',
20  'fcname.c',
21  'fcobjs.c',
22  'fcpat.c',
23  'fcrange.c',
24  'fcserialize.c',
25  'fcstat.c',
26  'fcstr.c',
27  'fcweight.c',
28  'fcxml.c',
29  'ftglue.c',
30]
31
32# FIXME: obviously fragile, cc.preprocess would be sweet
33cpp = cc.cmd_array()
34if cc.get_id() == 'gcc'
35  cpp += ['-E', '-P']
36elif cc.get_id() == 'msvc'
37  cpp += ['/EP']
38elif cc.get_id() == 'clang'
39  cpp += ['-E', '-P']
40else
41  error('FIXME: implement cc.preprocess')
42endif
43
44cpp += ['-I', join_paths(meson.current_source_dir(), '..')]
45
46fcobjshash_gperf = custom_target('fcobjshash.gperf',
47  input: 'fcobjshash.gperf.h',
48  output: 'fcobjshash.gperf',
49  command: [python3, files('cutout.py')[0], '@INPUT@', '@OUTPUT@', '@BUILD_ROOT@', cpp],
50  build_by_default: true,
51)
52
53fcobjshash_h = custom_target('fcobjshash.h',
54  input: fcobjshash_gperf,
55  output: 'fcobjshash.h',
56  command: [gperf, '--pic', '-m', '100', '@INPUT@', '--output-file', '@OUTPUT@']
57)
58
59# Define FcPublic appropriately for exports on windows
60fc_extra_c_args = []
61
62if cc.get_argument_syntax() == 'msvc'
63  fc_extra_c_args += '-DFcPublic=__declspec(dllexport)'
64endif
65
66libfontconfig = library('fontconfig',
67  fc_sources, alias_headers, ft_alias_headers, fclang_h, fccase_h, fcobjshash_h,
68  c_args: c_args + fc_extra_c_args,
69  include_directories: incbase,
70  dependencies: deps,
71  install: true,
72  soversion: soversion,
73  version: libversion,
74  darwin_versions: osxversion,
75)
76
77fontconfig_dep = declare_dependency(link_with: libfontconfig,
78  include_directories: incbase,
79  dependencies: deps,
80)
81
82pkgmod.generate(libfontconfig,
83  description: 'Font configuration and customization library',
84  filebase: 'fontconfig',
85  name: 'Fontconfig',
86  requires: ['freetype2 ' + freetype_req],
87  version: fc_version,
88  variables: [
89    'sysconfdir=@0@'.format(join_paths(prefix, get_option('sysconfdir'))),
90    'localstatedir=/var',
91    'confdir=${sysconfdir}/fonts',
92    'cachedir=/var/db/fontconfig',
93  ])
94