-
Notifications
You must be signed in to change notification settings - Fork 51
/
gen_rts_sources.py
executable file
·111 lines (96 loc) · 3.33 KB
/
gen_rts_sources.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#! /usr/bin/env python3
#
# Copyright (C) 2016-2020, AdaCore
#
# Python script to gather files for the bareboard runtime.
# Don't use any fancy features. Ideally, this script should work with any
# Python version starting from 2.6 (yes, it's very old but that's the system
# python on oldest host).
import argparse
import os
from support.files_holder import FilesHolder
from support.rts_sources import SourceTree
from support.rts_sources.sources import all_scenarios, sources
def main():
# global link, gccdir, gnatdir, verbose, create_common
parser = argparse.ArgumentParser()
parser.add_argument("-v", "--verbose", action="store_true", help="verbose output")
parser.add_argument(
"-l", "--link", action="store_true", help="use symlinks when installing files"
)
parser.add_argument("--gcc-dir", help="gcc sources dir")
parser.add_argument("--gnat-dir", help="gnat sources dir")
parser.add_argument(
"--output",
help=(
"installation location. By default the runtime descriptor is "
"installed in <output>/lib/gnat while the sources are installed "
"in <output>/include/rts-sources"
),
)
parser.add_argument(
"--output-descriptor",
help="installation location for the runtime sources descriptor",
)
parser.add_argument(
"--output-sources", help="installation location for the runtime sources tree"
)
parser.add_argument(
"--rts-profile",
choices=["light", "light-tasking", "embedded", "cert"],
required=True,
help="supported profiles",
)
parser.add_argument(
"--source-profile",
choices=[
"bb",
"deos",
"freertos",
"linux",
"lynx",
"pikeos",
"vx7r2cert",
"qnx",
],
default="bb",
help="platform specific source selections",
)
args = parser.parse_args()
if args.verbose:
FilesHolder.verbose = True
if args.link:
FilesHolder.link = True
if args.gcc_dir is not None:
FilesHolder.gccdir = os.path.abspath(args.gcc_dir)
if args.gnat_dir is not None:
FilesHolder.gnatdir = os.path.abspath(args.gnat_dir)
if args.output is not None:
dest = os.path.abspath(args.output)
else:
dest = os.path.abspath("install")
if args.output_descriptor is not None:
dest_json = os.path.abspath(args.output_descriptor)
else:
dest_json = os.path.join(dest, "lib", "gnat", "rts-sources.json")
if args.output_sources is not None:
dest_srcs = os.path.abspath(args.output_sources)
else:
dest_srcs = os.path.join(dest, "include", "rts-sources")
if not os.path.exists(os.path.dirname(dest_json)):
os.makedirs(os.path.dirname(dest_json))
if not os.path.exists(dest_srcs):
os.makedirs(dest_srcs)
# Install the shared runtime sources
SourceTree.dest_sources = dest_srcs
# create the rts sources object. This uses a slightly different set
# on pikeos.
rts_srcs = SourceTree(
sources=args.source_profile + "_srcs",
profile=args.rts_profile,
rts_sources=sources,
rts_scenarios=all_scenarios,
)
rts_srcs.install_tree(dest_json=dest_json, dest_sources=dest_srcs)
if __name__ == "__main__":
main()