source: rtems-tools/rtemstoolkit/wscript @ 7d3350d

5
Last change on this file since 7d3350d was 635a28f, checked in by Chris Johns <chrisj@…>, on 04/03/16 at 05:41:08

rtemstoolkit: Add a buffer helper class to insert and extract data.

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