source: rtems-tools/rtemstoolkit/wscript @ 37a0843

5
Last change on this file since 37a0843 was ed80d2c, checked in by Chris Johns <chrisj@…>, on 05/16/17 at 06:43:19

rtemstoolkit: Add the configuration.py module to the install.

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