source: rtems-tools/rtemstoolkit/wscript @ 7279748

4.11
Last change on this file since 7279748 was 7279748, checked in by Chris Johns <chrisj@…>, on 12/09/15 at 08:36:26

Add release versioning support.

Support a top level VERSION file that defines an RTEMS release.

Fix the install of the python modules including thertems-test.

Update the git python module to the RSB version. Fix the options to
not call clean and to call dirty.

Update the version python module.

Fix the rtld C++ support to the VERSION file and the top level waf
script.

  • Property mode set to 100644
File size: 9.7 KB
Line 
1#
2# RTEMS Toolkit build script.
3#
4import sys
5
6#
7# Waf system setup. Allow more than one build in the same tree.
8#
9top = '.'
10out = 'build-' + sys.platform
11
12def options(opt):
13    opt.load('compiler_c')
14    opt.load('compiler_cxx')
15
16def configure(conf):
17    conf.load('compiler_c')
18    conf.load('compiler_cxx')
19    conf_libiberty(conf)
20    conf_libelf(conf)
21
22    conf.check(header_name='sys/wait.h',  features = 'c', mandatory = False)
23    conf.check_cc(function_name='kill', header_name="signal.h",
24                  features = 'c', mandatory = False)
25    conf.write_config_header('config.h')
26
27    conf.load('python')
28    conf.check_python_version((2,6,6))
29    conf.env['PYO'] = 0
30    conf.env['PYC'] = 0
31
32def build(bld):
33    #
34    # The local configuration.
35    #
36    conf = {}
37
38    #
39    # The include paths.
40    #
41    conf['includes'] = ['elftoolchain/libelf', 'elftoolchain/common', 'libiberty']
42    if bld.env.DEST_OS == 'win32':
43        conf['includes'] += ['win32']
44
45    #
46    # Build flags.
47    #
48    conf['warningflags'] = ['-Wall', '-Wextra', '-pedantic']
49    conf['optflags'] = bld.env.C_OPTS
50    conf['cflags'] = ['-pipe', '-g'] + conf['optflags']
51    conf['cxxflags'] = ['-pipe', '-g'] + conf['optflags']
52    conf['linkflags'] = ['-g']
53
54    #
55    # Create each of the modules as object files each with their own
56    # configurations.
57    #
58    bld_libelf(bld, conf)
59    bld_libiberty(bld, conf)
60
61    #
62    # RLD source.
63    #
64    rld_source = ['ConvertUTF.c',
65                  'pkgconfig.cpp',
66                  'rld-config.cpp',
67                  'rld-elf.cpp',
68                  'rld-files.cpp',
69                  'rld-cc.cpp',
70                  'rld-compression.cpp',
71                  'rld-outputter.cpp',
72                  'rld-path.cpp',
73                  'rld-process.cpp',
74                  'rld-resolver.cpp',
75                  'rld-rtems.cpp',
76                  'rld-symbols.cpp',
77                  'rld-rap.cpp',
78                  'rld.cpp']
79
80    #
81    # RTEMS Utilities.
82    #
83    rtems_utils = ['rtems-utils.cpp']
84
85    #
86    # Compression.
87    #
88    compression = ['fastlz.c']
89
90    #
91    # RTL static library
92    #
93    bld.stlib(target = 'rld',
94              install_path = None,
95              source = rld_source + rtems_utils + compression,
96              defines = ['HAVE_CONFIG_H=1',
97                         'RTEMS_VERSION=\"%s\"' % (bld.env.RTEMS_VERSION),
98                         'RTEMS_RELEASE=\"%s\"' % (bld.env.RTEMS_RELEASE),
99                         'FASTLZ_LEVEL=1'],
100              includes = ['.'] + conf['includes'],
101              cflags = conf['cflags'] + conf['warningflags'],
102              cxxflags = conf['cxxflags'] + conf['warningflags'],
103              linkflags = conf['linkflags'])
104
105    #
106    # The Python toolkit.
107    #
108    bld(features = 'py',
109        source = ['__init__.py',
110                  'check.py',
111                  'config.py',
112                  'darwin.py',
113                  'error.py',
114                  'execute.py',
115                  'freebsd.py',
116                  'git.py',
117                  'linux.py',
118                  'log.py',
119                  'macros.py',
120                  'mailer.py',
121                  'options.py',
122                  'path.py',
123                  'stacktraces.py',
124                  'version.py',
125                  'windows.py'],
126        install_path = '${PREFIX}/share/rtems')
127
128def rebuild(ctx):
129    import waflib.Options
130    waflib.Options.commands.extend(['clean', 'build'])
131
132def tags(ctx):
133    ctx.exec_command('etags $(find . -name \*.[sSch])', shell = True)
134
135#
136# Libelf module.
137#
138def conf_libelf(conf):
139    pass
140
141def bld_libelf(bld, conf):
142    libelf = 'elftoolchain/libelf/'
143
144    #
145    # Work around the ${SRC} having Windows slashes which the MSYS m4 does not
146    # understand.
147    #
148    if sys.platform == 'win32':
149        m4_rule = 'type ${SRC} | m4 -D SRCDIR=../rtemstoolkit/' + libelf[:-1] + '> ${TGT}"'
150    else:
151        m4_rule = 'm4 -D SRCDIR=../rtemstoolkit/' + libelf[:-1] + ' ${SRC} > ${TGT}'
152    if bld.env.DEST_OS == 'win32':
153        includes = ['win32']
154    else:
155        includes = []
156
157    bld(target = 'libelf_convert.c', source = libelf + 'libelf_convert.m4', rule = m4_rule)
158    bld(target = 'libelf_fsize.c',   source = libelf + 'libelf_fsize.m4',   rule = m4_rule)
159    bld(target = 'libelf_msize.c',   source = libelf + 'libelf_msize.m4',   rule = m4_rule)
160
161    host_source = []
162
163    if bld.env.DEST_OS == 'linux':
164        common = 'elftoolchain/common/'
165        bld(target = common + 'native-elf-format.h',
166            source = common + 'native-elf-format',
167            name = 'native-elf-format',
168            rule   = './${SRC} > ${TGT}')
169        bld.add_group ()
170    elif bld.env.DEST_OS == 'win32':
171        host_source += [libelf + 'mmap_win32.c']
172
173    bld.stlib(target = 'elf',
174              features = 'c',
175              install_path = None,
176              uses = ['native-elf-format'],
177              includes = [bld.bldnode.abspath(),
178                          'elftoolchain/libelf', 'elftoolchain/common'] + includes,
179              cflags = conf['cflags'],
180              source =[libelf + 'elf.c',
181                       libelf + 'elf_begin.c',
182                       libelf + 'elf_cntl.c',
183                       libelf + 'elf_end.c',
184                       libelf + 'elf_errmsg.c',
185                       libelf + 'elf_errno.c',
186                       libelf + 'elf_data.c',
187                       libelf + 'elf_fill.c',
188                       libelf + 'elf_flag.c',
189                       libelf + 'elf_getarhdr.c',
190                       libelf + 'elf_getarsym.c',
191                       libelf + 'elf_getbase.c',
192                       libelf + 'elf_getident.c',
193                       libelf + 'elf_hash.c',
194                       libelf + 'elf_kind.c',
195                       libelf + 'elf_memory.c',
196                       libelf + 'elf_next.c',
197                       libelf + 'elf_rand.c',
198                       libelf + 'elf_rawfile.c',
199                       libelf + 'elf_phnum.c',
200                       libelf + 'elf_shnum.c',
201                       libelf + 'elf_shstrndx.c',
202                       libelf + 'elf_scn.c',
203                       libelf + 'elf_strptr.c',
204                       libelf + 'elf_update.c',
205                       libelf + 'elf_version.c',
206                       libelf + 'gelf_cap.c',
207                       libelf + 'gelf_checksum.c',
208                       libelf + 'gelf_dyn.c',
209                       libelf + 'gelf_ehdr.c',
210                       libelf + 'gelf_getclass.c',
211                       libelf + 'gelf_fsize.c',
212                       libelf + 'gelf_move.c',
213                       libelf + 'gelf_phdr.c',
214                       libelf + 'gelf_rel.c',
215                       libelf + 'gelf_rela.c',
216                       libelf + 'gelf_shdr.c',
217                       libelf + 'gelf_sym.c',
218                       libelf + 'gelf_syminfo.c',
219                       libelf + 'gelf_symshndx.c',
220                       libelf + 'gelf_xlate.c',
221                       libelf + 'libelf_align.c',
222                       libelf + 'libelf_allocate.c',
223                       libelf + 'libelf_ar.c',
224                       libelf + 'libelf_ar_util.c',
225                       libelf + 'libelf_checksum.c',
226                       libelf + 'libelf_data.c',
227                       libelf + 'libelf_ehdr.c',
228                       libelf + 'libelf_extended.c',
229                       libelf + 'libelf_phdr.c',
230                       libelf + 'libelf_shdr.c',
231                       libelf + 'libelf_xlate.c',
232                       'libelf_convert.c',
233                       'libelf_fsize.c',
234                       'libelf_msize.c'] + host_source)
235
236#
237# Libiberty module.
238#
239def conf_libiberty(conf):
240    conf.check(header_name='alloca.h',    features = 'c', mandatory = False)
241    conf.check(header_name='fcntl.h',     features = 'c', mandatory = False)
242    conf.check(header_name='process.h',   features = 'c', mandatory = False)
243    conf.check(header_name='stdlib.h',    features = 'c')
244    conf.check(header_name='string.h',    features = 'c')
245    conf.check(header_name='strings.h',   features = 'c', mandatory = False)
246    conf.check(header_name='sys/file.h',  features = 'c', mandatory = False)
247    conf.check(header_name='sys/stat.h',  features = 'c', mandatory = False)
248    conf.check(header_name='sys/time.h',  features = 'c', mandatory = False)
249    conf.check(header_name='sys/types.h', features = 'c', mandatory = False)
250    conf.check(header_name='sys/wait.h',  features = 'c', mandatory = False)
251    conf.check(header_name='unistd.h',    features = 'c', mandatory = False)
252    conf.check(header_name='vfork.h',     features = 'c', mandatory = False)
253
254    conf.check_cc(function_name='getrusage',
255                  header_name="sys/time.h sys/resource.h",
256                  features = 'c', mandatory = False)
257
258    conf.write_config_header('libiberty/config.h')
259
260def bld_libiberty(bld, conf):
261    if bld.env.DEST_OS == 'win32':
262        pex_host = 'libiberty/pex-win32.c'
263    else:
264        pex_host = 'libiberty/pex-unix.c'
265    bld.stlib(target = 'iberty',
266              features = 'c',
267              install_path = None,
268              includes = ['libiberty'],
269              cflags = conf['cflags'],
270              defines = ['HAVE_CONFIG_H=1'],
271              source =['libiberty/concat.c',
272                       'libiberty/cplus-dem.c',
273                       'libiberty/cp-demangle.c',
274                       'libiberty/make-temp-file.c',
275                       'libiberty/mkstemps.c',
276                       'libiberty/safe-ctype.c',
277                       'libiberty/stpcpy.c',
278                       'libiberty/pex-common.c',
279                       'libiberty/pex-one.c',
280                       pex_host])
281
282#
283# The doxy command.
284#
285from waflib import Build
286class doxy(Build.BuildContext):
287    fun = 'build'
288    cmd = 'doxy'
Note: See TracBrowser for help on using the repository browser.