meson: Don't enable any vulkan drivers on arm, aarch64
[mesa.git] / bin / install_megadrivers.py
1 # encoding=utf-8
2 # Copyright © 2017-2018 Intel Corporation
3
4 # Permission is hereby granted, free of charge, to any person obtaining a copy
5 # of this software and associated documentation files (the "Software"), to deal
6 # in the Software without restriction, including without limitation the rights
7 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 # copies of the Software, and to permit persons to whom the Software is
9 # furnished to do so, subject to the following conditions:
10
11 # The above copyright notice and this permission notice shall be included in
12 # all copies or substantial portions of the Software.
13
14 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 # SOFTWARE.
21
22 """Script to install megadriver symlinks for meson."""
23
24 from __future__ import print_function
25 import argparse
26 import os
27 import shutil
28
29
30 def main():
31 parser = argparse.ArgumentParser()
32 parser.add_argument('megadriver')
33 parser.add_argument('libdir')
34 parser.add_argument('drivers', nargs='+')
35 args = parser.parse_args()
36
37 if os.path.isabs(args.libdir):
38 to = os.path.join(os.environ.get('DESTDIR', '/'), args.libdir[1:])
39 else:
40 to = os.path.join(os.environ['MESON_INSTALL_DESTDIR_PREFIX'], args.libdir)
41
42 master = os.path.join(to, os.path.basename(args.megadriver))
43
44 if not os.path.exists(to):
45 if os.path.lexists(to):
46 os.unlink(to)
47 os.makedirs(to)
48 shutil.copy(args.megadriver, master)
49
50 for driver in args.drivers:
51 abs_driver = os.path.join(to, driver)
52
53 if os.path.lexists(abs_driver):
54 os.unlink(abs_driver)
55 print('installing {} to {}'.format(args.megadriver, abs_driver))
56 os.link(master, abs_driver)
57
58 try:
59 ret = os.getcwd()
60 os.chdir(to)
61
62 name, ext = os.path.splitext(driver)
63 while ext != '.so':
64 if os.path.lexists(name):
65 os.unlink(name)
66 os.symlink(driver, name)
67 name, ext = os.path.splitext(name)
68 finally:
69 os.chdir(ret)
70 os.unlink(master)
71
72
73 if __name__ == '__main__':
74 main()