source: rtems-tools/rtemstoolkit/wscript @ de1beea

4.10
Last change on this file since de1beea was de1beea, checked in by Chris Johns <chrisj@…>, on Feb 19, 2016 at 12:26:51 AM

Disable installing PYO and PYC. Fix install paths.

Installing PYO and PYC does not work so disable this. Move the
Python check to the top level and have a single place.

Fix the install paths a revert the 'from . import' changes. This
is resolved by installing into the correct paths.

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