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

5
Last change on this file since 7c032b0 was 5df7c3c, checked in by Sebastian Huber <sebastian.huber@…>, on 10/10/17 at 18:07:15

Install missing files

  • Property mode set to 100644
File size: 10.8 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                  'configuration.py',
134                  'darwin.py',
135                  'error.py',
136                  'execute.py',
137                  'freebsd.py',
138                  'git.py',
139                  'host.py',
140                  'linux.py',
141                  'log.py',
142                  'macros.py',
143                  'mailer.py',
144                  'options.py',
145                  'path.py',
146                  'reraise.py',
147                  'stacktraces.py',
148                  'textbox.py',
149                  'version.py',
150                  'windows.py'],
151        install_from = '.',
152        install_path = '${PREFIX}/share/rtems/rtemstoolkit')
153
154def rebuild(ctx):
155    import waflib.Options
156    waflib.Options.commands.extend(['clean', 'build'])
157
158def tags(ctx):
159    ctx.exec_command('etags $(find . -name \*.[sSch])', shell = True)
160
161#
162# Libelf module.
163#
164def conf_libelf(conf):
165    pass
166
167def bld_libelf(bld, conf):
168    libelf = 'elftoolchain/libelf/'
169    m4_rule = '${M4} -D SRCDIR=../rtemstoolkit/' + libelf[:-1] + ' ${SRC} > ${TGT}'
170    if bld.env.DEST_OS == 'win32':
171        includes = ['win32']
172    else:
173        includes = []
174
175    bld(target = 'libelf_convert.c', source = libelf + 'libelf_convert.m4', rule = m4_rule)
176    bld(target = 'libelf_fsize.c',   source = libelf + 'libelf_fsize.m4',   rule = m4_rule)
177    bld(target = 'libelf_msize.c',   source = libelf + 'libelf_msize.m4',   rule = m4_rule)
178
179    host_source = []
180
181    if bld.env.DEST_OS == 'linux':
182        common = 'elftoolchain/common/'
183        bld(target = common + 'native-elf-format.h',
184            source = common + 'native-elf-format',
185            name = 'native-elf-format',
186            rule   = './${SRC} > ${TGT}')
187        bld.add_group ()
188    elif bld.env.DEST_OS == 'win32':
189        host_source += [libelf + 'mmap_win32.c']
190
191    bld.stlib(target = 'elf',
192              features = 'c',
193              install_path = None,
194              uses = ['native-elf-format'],
195              includes = [bld.bldnode.abspath(),
196                          'elftoolchain/libelf', 'elftoolchain/common'] + includes,
197              cflags = conf['cflags'],
198              source =[libelf + 'elf.c',
199                       libelf + 'elf_begin.c',
200                       libelf + 'elf_cntl.c',
201                       libelf + 'elf_end.c',
202                       libelf + 'elf_errmsg.c',
203                       libelf + 'elf_errno.c',
204                       libelf + 'elf_data.c',
205                       libelf + 'elf_fill.c',
206                       libelf + 'elf_flag.c',
207                       libelf + 'elf_getarhdr.c',
208                       libelf + 'elf_getarsym.c',
209                       libelf + 'elf_getbase.c',
210                       libelf + 'elf_getident.c',
211                       libelf + 'elf_hash.c',
212                       libelf + 'elf_kind.c',
213                       libelf + 'elf_memory.c',
214                       libelf + 'elf_next.c',
215                       libelf + 'elf_rand.c',
216                       libelf + 'elf_rawfile.c',
217                       libelf + 'elf_phnum.c',
218                       libelf + 'elf_shnum.c',
219                       libelf + 'elf_shstrndx.c',
220                       libelf + 'elf_scn.c',
221                       libelf + 'elf_strptr.c',
222                       libelf + 'elf_update.c',
223                       libelf + 'elf_version.c',
224                       libelf + 'gelf_cap.c',
225                       libelf + 'gelf_checksum.c',
226                       libelf + 'gelf_dyn.c',
227                       libelf + 'gelf_ehdr.c',
228                       libelf + 'gelf_getclass.c',
229                       libelf + 'gelf_fsize.c',
230                       libelf + 'gelf_move.c',
231                       libelf + 'gelf_phdr.c',
232                       libelf + 'gelf_rel.c',
233                       libelf + 'gelf_rela.c',
234                       libelf + 'gelf_shdr.c',
235                       libelf + 'gelf_sym.c',
236                       libelf + 'gelf_syminfo.c',
237                       libelf + 'gelf_symshndx.c',
238                       libelf + 'gelf_xlate.c',
239                       libelf + 'libelf_align.c',
240                       libelf + 'libelf_allocate.c',
241                       libelf + 'libelf_ar.c',
242                       libelf + 'libelf_ar_util.c',
243                       libelf + 'libelf_checksum.c',
244                       libelf + 'libelf_data.c',
245                       libelf + 'libelf_ehdr.c',
246                       libelf + 'libelf_extended.c',
247                       libelf + 'libelf_phdr.c',
248                       libelf + 'libelf_shdr.c',
249                       libelf + 'libelf_xlate.c',
250                       'libelf_convert.c',
251                       'libelf_fsize.c',
252                       'libelf_msize.c'] + host_source)
253
254#
255# Libiberty module.
256#
257def conf_libiberty(conf):
258    conf.check(header_name='alloca.h',    features = 'c', mandatory = False)
259    conf.check(header_name='fcntl.h',     features = 'c', mandatory = False)
260    conf.check(header_name='process.h',   features = 'c', mandatory = False)
261    conf.check(header_name='stdlib.h',    features = 'c')
262    conf.check(header_name='string.h',    features = 'c')
263    conf.check(header_name='strings.h',   features = 'c', mandatory = False)
264    conf.check(header_name='sys/file.h',  features = 'c', mandatory = False)
265    conf.check(header_name='sys/stat.h',  features = 'c', mandatory = False)
266    conf.check(header_name='sys/time.h',  features = 'c', mandatory = False)
267    conf.check(header_name='sys/types.h', features = 'c', mandatory = False)
268    conf.check(header_name='sys/wait.h',  features = 'c', mandatory = False)
269    conf.check(header_name='unistd.h',    features = 'c', mandatory = False)
270    conf.check(header_name='vfork.h',     features = 'c', mandatory = False)
271
272    conf.check_cc(function_name='getrusage',
273                  header_name="sys/time.h sys/resource.h",
274                  features = 'c', mandatory = False)
275
276    conf.write_config_header('libiberty/config.h')
277
278def bld_libiberty(bld, conf):
279    if bld.env.DEST_OS == 'win32':
280        pex_host = 'libiberty/pex-win32.c'
281    else:
282        pex_host = 'libiberty/pex-unix.c'
283    bld.stlib(target = 'iberty',
284              features = 'c',
285              install_path = None,
286              includes = ['libiberty'],
287              cflags = conf['cflags'],
288              defines = ['HAVE_CONFIG_H=1'],
289              source =['libiberty/concat.c',
290                       'libiberty/cplus-dem.c',
291                       'libiberty/cp-demangle.c',
292                       'libiberty/d-demangle.c',
293                       'libiberty/rust-demangle.c',
294                       'libiberty/make-temp-file.c',
295                       'libiberty/mkstemps.c',
296                       'libiberty/safe-ctype.c',
297                       'libiberty/stpcpy.c',
298                       'libiberty/pex-common.c',
299                       'libiberty/pex-one.c',
300                       'libiberty/xmalloc.c',
301                       'libiberty/xmemdup.c',
302                       'libiberty/xstrdup.c',
303                       'libiberty/xstrerror.c',
304                       pex_host])
305
306#
307# The doxy command.
308#
309from waflib import Build
310class doxy(Build.BuildContext):
311    fun = 'build'
312    cmd = 'doxy'
Note: See TracBrowser for help on using the repository browser.