Imported Upstream version 1.0.10
[platform/upstream/fribidi.git] / gen.tab / meson.build
1 # gen.tab
2
3 native_cc = meson.get_compiler('c')
4
5 # Don't pick up top-level config.h, as that has defines for the cross-compiler
6 # (if we're cross-compiling), but here we need values for the host compiler/env
7 # in that case. We shall pass those on the command line since it's just a few.
8 native_args = ['-UHAVE_CONFIG_H']
9
10 # This is available pretty much everywhere
11 native_args += ['-DHAVE_STRINGIZE']
12
13 native_args += ['-DDONT_HAVE_FRIBIDI_CONFIG_H']
14
15 if native_cc.has_header('stdlib.h')
16   native_args += ['-DHAVE_STDLIB_H']
17 endif
18
19 if native_cc.has_header('string.h')
20   native_args += ['-DHAVE_STRING_H']
21 endif
22
23 if native_cc.has_header('strings.h')
24   native_args += ['-DHAVE_STRINGS_H']
25
26   # Not entirely correct, but sufficient for us. Should move away from this
27   # ancient define and just include individual headers based on individual defs.
28   # stdlib.h and string.h are standard nowadays, but strings.h not (msvc)
29   native_args += ['-DSTDC_HEADERS=1']
30 endif
31
32 gen_unicode_version = executable('gen-unicode-version',
33   'gen-unicode-version.c',
34   include_directories: incs,
35   c_args: native_args,
36   install: false,
37   native: true)
38
39 fribidi_unicode_version_h = custom_target('fribidi-unicode-version.h',
40   input: files('unidata/ReadMe.txt', 'unidata/BidiMirroring.txt'),
41   output: 'fribidi-unicode-version.h',
42   command: [gen_unicode_version, '@INPUT0@', '@INPUT1@', 'gen-unicode-version'],
43   capture: true,
44   install_dir: join_paths(get_option('includedir'), 'fribidi'),
45   install: true)
46
47 COMPRESSION='2'
48
49 tabs = [
50   ['bidi-type', files('unidata/UnicodeData.txt')],
51   ['joining-type', files('unidata/UnicodeData.txt', 'unidata/ArabicShaping.txt')],
52   ['arabic-shaping', files('unidata/UnicodeData.txt')],
53   ['mirroring', files('unidata/BidiMirroring.txt')],
54   ['brackets', files('unidata/BidiBrackets.txt', 'unidata/UnicodeData.txt')],
55   ['brackets-type', files('unidata/BidiBrackets.txt')],
56 ]
57
58 generated_tab_include_files = []
59
60 foreach tab : tabs
61   gen_prog_name = 'gen-@0@-tab'.format(tab[0])
62   gen_prog_src = 'gen-@0@-tab.c'.format(tab[0])
63   gen_prog_out = '@0@.tab.i'.format(tab[0])
64   gen_prog_inputs = tab[1]
65
66   gen_exe = executable(gen_prog_name,
67     fribidi_unicode_version_h,
68     gen_prog_src, 'packtab.c',
69     include_directories: incs,
70     c_args: native_args,
71     install: false,
72     native: true)
73
74   tab_inc_file = custom_target(gen_prog_name,
75     input: gen_prog_inputs,
76     output: gen_prog_out,
77     command: [gen_exe, COMPRESSION, '@INPUT@', gen_prog_name],
78     capture: true)
79
80   generated_tab_include_files += [tab_inc_file]
81 endforeach