source: mainline/meson/part/tools/meson.build@ 017ffce

topic/simplify-dev-export
Last change on this file since 017ffce was cebd956, checked in by Jiří Zárevúcky <zarevucky.jiri@…>, 22 months ago

Prefer mkisofs if genisoimage is a symlink

  • Property mode set to 100644
File size: 4.2 KB
Line 
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
37basename = find_program('basename')
38cc = meson.get_compiler('c')
39config_py = find_program(_tools_dir / 'config.py')
40cp = find_program('cp')
41dirname = find_program('dirname')
42doxygen = find_program('doxygen', required: false)
43find = find_program('find')
44grep = find_program('grep')
45mkarray = find_program(_tools_dir / 'mkarray_for_meson.sh')
46mkext4 = find_program(_tools_dir / 'mkext4.py')
47mkfat = find_program(_tools_dir / 'mkfat.py')
48mkuimage = find_program(_tools_dir / 'mkuimage.py')
49objcopy = find_program('objcopy')
50objdump = find_program('objdump')
51patch = find_program('patch')
52sed = find_program('sed')
53unzip = find_program('unzip')
54which = find_program('which')
55cpc = find_program(_tools_dir / 'cc.sh')
56cppcheck = find_program('cppcheck', required: false)
57
58sh = [ find_program('sh'), '-u', '-e' ]
59if debug_shell_scripts
60 sh += '-x'
61endif
62
63# On some distributions (e.g. Arch Linux), genisoimage is actually a symbolic
64# link to mkisofs. However, they do not accept exactly the same options.
65# Thus we check if genisoimage is a symbolic link to mkisofs and if it is so,
66# we switch to mkisofs as that is the native application available.
67fs = import('fs')
68genisoimage = find_program('genisoimage', required: false)
69_mkisofs = find_program('mkisofs', required: false)
70if genisoimage.found() and not (fs.is_symlink(genisoimage.full_path()) and _mkisofs.found() and fs.is_samepath(genisoimage.full_path(), _mkisofs.full_path()))
71 genisoimage_type = 'genisoimage'
72else
73 genisoimage = _mkisofs
74 if genisoimage.found()
75 genisoimage_type = 'mkisofs'
76 else
77 xorriso = find_program('xorriso', required: false)
78 if xorriso.found()
79 genisoimage = [ xorriso, '-as', 'genisoimage' ]
80 genisoimage_type = 'genisoimage'
81 else
82 error('Need genisoimage, mkisofs or xorriso.')
83 endif
84 endif
85endif
86
87
88autocheck = generator(find_program(_tools_dir / 'autocheck.awk'),
89 arguments: [ '@INPUT@' ],
90 output: '@PLAINNAME@.check.c',
91 capture: true,
92)
93
94# TODO: bug in Meson
95#gzip = generator(find_program('gzip'),
96# arguments: [ '--no-name', '-9', '--stdout', '@INPUT@' ],
97# output: '@PLAINNAME@.gz',
98# capture: true,
99#)
100
101gzip = [ find_program('gzip'), '--no-name', '-9', '--stdout', '@INPUT@' ]
102
103# Tar's arguments make sure that the archive is reproducible.
104tar = [
105 find_program('tar'),
106 '-c',
107 '-f', '@OUTPUT@',
108 '--mtime=1970-01-01 00:00:00Z',
109 '--group=0',
110 '--owner=0',
111 '--numeric-owner',
112 '--mode=go=rX,u+rw,a-s',
113 '--no-acls',
114 '--no-selinux',
115 '--no-xattrs',
116 '--format=ustar',
117 '--transform', 's:@OUTDIR@/::',
118 '@INPUT@',
119]
Note: See TracBrowser for help on using the repository browser.