1 | #
|
---|
2 | # Copyright (c) 2019 Jiří Zárevúcky
|
---|
3 | # All rights reserved.
|
---|
4 | #
|
---|
5 | # Redistribution and use in source and binary forms, with or without
|
---|
6 | # modification, are permitted provided that the following conditions
|
---|
7 | # are met:
|
---|
8 | #
|
---|
9 | # - Redistributions of source code must retain the above copyright
|
---|
10 | # notice, this list of conditions and the following disclaimer.
|
---|
11 | # - Redistributions in binary form must reproduce the above copyright
|
---|
12 | # notice, this list of conditions and the following disclaimer in the
|
---|
13 | # documentation and/or other materials provided with the distribution.
|
---|
14 | # - The name of the author may not be used to endorse or promote products
|
---|
15 | # derived from this software without specific prior written permission.
|
---|
16 | #
|
---|
17 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
---|
18 | # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
19 | # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
---|
20 | # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
---|
21 | # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
---|
22 | # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
---|
23 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
---|
24 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
---|
25 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
---|
26 | # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
27 | #
|
---|
28 |
|
---|
29 | # Find all the programs and tools used by meson.
|
---|
30 | # Whenever you use an external command anywhere,
|
---|
31 | # first find and assign it to a variable here. Don't use its name directly.
|
---|
32 | # This way it's obvious what programs are used, and for some we can use
|
---|
33 | # the same argument list everywhere.
|
---|
34 |
|
---|
35 | _tools_dir = meson.source_root() / 'tools'
|
---|
36 |
|
---|
37 | basename = find_program('basename')
|
---|
38 | cc = meson.get_compiler('c')
|
---|
39 | config_py = find_program(_tools_dir / 'config.py')
|
---|
40 | cp = find_program('cp')
|
---|
41 | dirname = find_program('dirname')
|
---|
42 | doxygen = find_program('doxygen', required: false)
|
---|
43 | find = find_program('find')
|
---|
44 | grep = find_program('grep')
|
---|
45 | mkarray = find_program(_tools_dir / 'mkarray_for_meson.sh')
|
---|
46 | mkext4 = find_program(_tools_dir / 'mkext4.py')
|
---|
47 | mkfat = find_program(_tools_dir / 'mkfat.py')
|
---|
48 | mkuimage = find_program(_tools_dir / 'mkuimage.py')
|
---|
49 | objcopy = find_program('objcopy')
|
---|
50 | objdump = find_program('objdump')
|
---|
51 | patch = find_program('patch')
|
---|
52 | sed = find_program('sed')
|
---|
53 | unzip = find_program('unzip')
|
---|
54 | which = find_program('which')
|
---|
55 | cpc = find_program(_tools_dir / 'cc.sh')
|
---|
56 | cppcheck = find_program('cppcheck', required: false)
|
---|
57 |
|
---|
58 | sh = [ find_program('sh'), '-u', '-e' ]
|
---|
59 | if debug_shell_scripts
|
---|
60 | sh += '-x'
|
---|
61 | endif
|
---|
62 |
|
---|
63 | genisoimage = find_program('genisoimage', required: false)
|
---|
64 | if genisoimage.found()
|
---|
65 | genisoimage_type = 'genisoimage'
|
---|
66 | else
|
---|
67 | genisoimage = find_program('mkisofs', required: false)
|
---|
68 | if genisoimage.found()
|
---|
69 | genisoimage_type = 'mkisofs'
|
---|
70 | else
|
---|
71 | xorriso = find_program('xorriso', required: false)
|
---|
72 | if xorriso.found()
|
---|
73 | genisoimage = [ xorriso, '-as', 'genisoimage' ]
|
---|
74 | genisoimage_type = 'genisoimage'
|
---|
75 | else
|
---|
76 | error('Need genisoimage, mkisofs or xorriso.')
|
---|
77 | endif
|
---|
78 | endif
|
---|
79 | endif
|
---|
80 |
|
---|
81 |
|
---|
82 | autocheck = generator(find_program(_tools_dir / 'autocheck.awk'),
|
---|
83 | arguments: [ '@INPUT@' ],
|
---|
84 | output: '@PLAINNAME@.check.c',
|
---|
85 | capture: true,
|
---|
86 | )
|
---|
87 |
|
---|
88 | # TODO: bug in Meson
|
---|
89 | #gzip = generator(find_program('gzip'),
|
---|
90 | # arguments: [ '--no-name', '-9', '--stdout', '@INPUT@' ],
|
---|
91 | # output: '@PLAINNAME@.gz',
|
---|
92 | # capture: true,
|
---|
93 | #)
|
---|
94 |
|
---|
95 | gzip = [ find_program('gzip'), '--no-name', '-9', '--stdout', '@INPUT@' ]
|
---|
96 |
|
---|
97 | # Tar's arguments make sure that the archive is reproducible.
|
---|
98 | tar = [
|
---|
99 | find_program('tar'),
|
---|
100 | '-c',
|
---|
101 | '-f', '@OUTPUT@',
|
---|
102 | '--mtime=1970-01-01 00:00:00Z',
|
---|
103 | '--group=0',
|
---|
104 | '--owner=0',
|
---|
105 | '--numeric-owner',
|
---|
106 | '--mode=go=rX,u+rw,a-s',
|
---|
107 | '--no-acls',
|
---|
108 | '--no-selinux',
|
---|
109 | '--no-xattrs',
|
---|
110 | '--format=ustar',
|
---|
111 | '--transform', 's:@OUTDIR@/::',
|
---|
112 | '@INPUT@',
|
---|
113 | ]
|
---|