source: rtems-tools/wscript @ de1beea

4.105
Last change on this file since de1beea was de1beea, checked in by Chris Johns <chrisj@…>, on 02/19/16 at 00:26:51

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: 4.4 KB
RevLine 
[749ddf1]1#
2# RTEMS Tools Project (http://www.rtems.org/)
[efc4f09]3# Copyright 2014-2015 Chris Johns (chrisj@rtems.org)
[749ddf1]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
[efc4f09]31import os.path
32
[87e0e76]33subdirs = ['rtemstoolkit',
34           'linkers',
[749ddf1]35           'tester',
36           'tools/gdb/python']
37
[efc4f09]38def get_version(ctx):
[8b49f73]39    version = '4.12'
40    revision = 'not_released'
41    release = '%s.%s' % (version, revision)
[efc4f09]42    if os.path.exists('VERSION'):
43        try:
[3828e50]44            import configparser
45        except ImportError:
46            import ConfigParser as configparser
47        v = configparser.SafeConfigParser()
48        v.read('VERSION')
49        release = v.get('version', 'release')
[8b49f73]50    else:
51        from rtemstoolkit import git
52        repo = git.repo('.')
53        if repo.valid():
54            head = repo.head()
55            if repo.dirty():
56                modified = '_modified'
57            else:
58                modified = ''
[3828e50]59            release = '%s.%s%s' % (version, head[0:12], modified)
[efc4f09]60    last_dot = release.rfind('.')
61    if last_dot == -1:
62        ctx.fatal('invalid VERSION file')
63    revision = release[0:last_dot]
64    return revision, release
65
[749ddf1]66def recurse(ctx):
67    for sd in subdirs:
68        ctx.recurse(sd)
69
70def options(ctx):
[87e0e76]71    ctx.add_option('--c-opts',
72                   default = '-O2',
73                   dest='c_opts',
74                   help = 'Set build options, default: -O2.')
[3badbb0]75    ctx.add_option('--host',
76                   default = 'native',
77                   dest='host',
78                   help = 'Set host to build for, default: none.')
[749ddf1]79    recurse(ctx)
80
[3badbb0]81def init(ctx):
82    try:
83        import waflib.Options
84        import waflib.ConfigSet
85        env = waflib.ConfigSet.ConfigSet()
86        env.load(waflib.Options.lockfile)
87        check_options(ctx, env.options['host'])
88        for sd in subdirs:
89            ctx.recurse(sd)
90    except:
91        pass
92
[749ddf1]93def configure(ctx):
[87e0e76]94    try:
95        ctx.load("doxygen", tooldir = 'waf-tools')
96    except:
97        pass
[efc4f09]98    ctx.env.RTEMS_VERSION, ctx.env.RTEMS_RELEASE = get_version(ctx)
[8b49f73]99    ctx.start_msg('Version')
100    ctx.end_msg('%s (%s)' % (ctx.env.RTEMS_RELEASE, ctx.env.RTEMS_VERSION))
[87e0e76]101    ctx.env.C_OPTS = ctx.options.c_opts.split(',')
[3badbb0]102    check_options(ctx, ctx.options.host)
[de1beea]103    #
104    # Common Python check.
105    #
106    ctx.load('python')
107    ctx.check_python_version((2,6,6))
108    #
109    # Installing the PYO,PYC seems broken on 1.8.19. The path is wrong.
110    #
111    ctx.env.PYO = 0
112    ctx.env.PYC = 0
[749ddf1]113    recurse(ctx)
114
115def build(ctx):
[efc4f09]116    if os.path.exists('VERSION'):
117        ctx.install_files('${PREFIX}/share/rtems/rtemstoolkit', ['VERSION'])
[749ddf1]118    recurse(ctx)
119
120def install(ctx):
121    recurse(ctx)
122
123def clean(ctx):
124    recurse(ctx)
[87e0e76]125
126def rebuild(ctx):
127    import waflib.Options
128    waflib.Options.commands.extend(['clean', 'build'])
129
[3badbb0]130def check_options(ctx, host):
131    if host in ['mingw32']:
132        ctx.env.HOST = host
133        ctx.env.CC = '%s-gcc' % (host)
134        ctx.env.CXX = '%s-g++' % (host)
135        ctx.env.AR = '%s-ar' % (host)
136        ctx.env.PYTHON = 'python'
137    elif host is not 'native':
138        ctx.fatal('unknown host: %s' % (host));
139
[87e0e76]140#
141# The doxy command.
142#
143from waflib import Build
144class doxy(Build.BuildContext):
145    fun = 'build'
146    cmd = 'doxy'
Note: See TracBrowser for help on using the repository browser.