source: rtems-tools/wscript @ e4c886f

4.11
Last change on this file since e4c886f was e4c886f, checked in by Chris Johns <chrisj@…>, on 02/19/16 at 00:39:42

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.

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