Move GstAggregator from -bad to core
[platform/upstream/gstreamer.git] / gst / parse / meson.build
1 cc = meson.get_compiler('c')
2
3 # Find flex, configure lex generator
4 flex_cdata = configuration_data()
5
6 flex_min_version='2.5.31'
7 flex = find_program('flex', required : false)
8 if not flex.found()
9   flex = find_program('win_flex', required : false)
10   if not flex.found()
11     error('flex not found')
12   endif
13 endif
14
15 flexversion_res = run_command([flex, '--version'])
16 if flexversion_res.returncode() != 0
17   error('Could not get flex version (@0@)'.format(flexversion_res.stderr()))
18 endif
19
20 flexversion = flexversion_res.stdout().split('\n')[0].split(' ')[1].strip()
21 if flexversion.version_compare('<' + flex_min_version)
22   error('flex version @0@ >= @1@: NO'.format(flexversion, flex_min_version))
23 else
24   message('flex version @0@ >= @1@: YES'.format(flexversion, flex_min_version))
25 endif
26
27 flex_cdata.set('FLEX', flex.path())
28 if cc.get_id() == 'msvc'
29   flex_cdata.set('FLEX_ARGS', '--nounistd')
30 else
31   flex_cdata.set('FLEX_ARGS', '')
32 endif
33
34 gen_lex = configure_file(input : 'gen_lex.py.in',
35   output : 'gen_lex.py',
36   configuration : flex_cdata)
37
38 # Find bison, configure grammar generator
39 bison_cdata = configuration_data()
40
41 bison_min_version='2.4'
42 bison = find_program('bison', required : false)
43 if not bison.found()
44   bison = find_program('win_bison', required : false)
45   if not bison.found()
46     error('GNU bison not found')
47   endif
48 endif
49
50 bversion_res = run_command([bison, '--version'])
51 if bversion_res.returncode() != 0
52   error('Could not get bison version (@0@)'.format(bversion_res.stderr()))
53 endif
54
55 bversion = bversion_res.stdout().split('\n')[0].split(' ')[-1].strip()
56 if bversion.version_compare('<' + bison_min_version)
57   error('bison version @0@ >= @1@: NO'.format(bversion, bison_min_version))
58 else
59   message('bison version @0@ >= @1@: YES'.format(bversion, bison_min_version))
60 endif
61
62
63
64 bison_cdata.set('BISON', bison.path())
65 bison_cdata.set('BISON_ARGS', '')
66
67 gen_grammar = configure_file(input : 'gen_grammar.py.in',
68   output : 'gen_grammar.py',
69   configuration : bison_cdata)
70
71 # Custom targets
72 parser = custom_target('parselex',
73   input : 'parse.l',
74   output : ['lex.priv_gst_parse_yy.c', 'parse_lex.h'],
75   command : [python3, gen_lex, '@OUTPUT0@', '@OUTPUT1@', '@INPUT@', 'DUMMY']
76 )
77
78 grammar = custom_target('parsegrammar',
79   input : 'grammar.y',
80   output : ['grammar.tab.c', 'grammar.tab.h'],
81   command : [python3, gen_grammar, '@OUTPUT0@', '@OUTPUT1@', '@INPUT@'],
82   depends : [parser],
83 )