source: rtems-tools/rtemstoolkit/wscript @ efc4f09

4.105
Last change on this file since efc4f09 was efc4f09, checked in by Chris Johns <chrisj@…>, on 12/09/15 at 09:08:19

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