Changeset 7385feb in rtems-source-builder


Ignore:
Timestamp:
07/20/15 03:49:42 (9 years ago)
Author:
Chris Johns <chrisj@…>
Branches:
4.11
Children:
4c49119
Parents:
fba2549
git-author:
Chris Johns <chrisj@…> (07/20/15 03:49:42)
git-committer:
Chris Johns <chrisj@…> (07/21/15 06:56:53)
Message:

Canandian Cross Compiling and RTEMS 3rd party package building Fixes.

The change fixes installing for RTEMS 3rd Party packages where the
RSB considered them Canadian Cross Compiling (Cxc). Fixing the
Cxc issue broke real Cxc builds. The change corrects the issue of
macros being changed in the Cxc and the prep data not being udpated.
The configuration is loaded again after the updated macros. The
macros are also copied and restored to ensure a clean stable base.

The change also introduces --rtems-tools and --rtems-bsp to align
the command line with the waf configure process or RTEMS application.

Files:
10 edited

Legend:

Unmodified
Added
Removed
  • rtems/config/rtems-bsp.cfg

    rfba2549 r7385feb  
    44
    55#
    6 # The RTEMS BSP support requires the host turple, the RTEMS BSP
    7 # and the path to the tools. The prefix is set to an installed
    8 # RTEMS. The built package is installed into the prefix.
     6# The RTEMS BSP support requires the host turple, the RTEMS BSP and the path to
     7# the tools. The prefix is set to an installed RTEMS. The built package is
     8# installed into the prefix.
    99#
    10 # Keeping the package's installed path in the RTEMS install path
    11 # and separate to the tools lets the tools version vary
    12 # independently. If --with-tools is not provided use the prefix.
     10# Keeping the package's installed path in the RTEMS install path and separate
     11# to the tools lets the tools version vary independently. If --rtems-tools
     12# (--with-tools) is not provided use the prefix.
    1313#
    1414
    15 %if %{_host} == %{nil}
    16  %error No RTEMS target specified: --host=host
     15%if %{_target} == %{nil}
     16 %error No RTEMS target specified: --rtems-bsp=arch/bsp (or --target=target)
     17%endif
     18
     19%if %{_host} != %{_build}
     20 %error Canadian cross building for BSP is not supported.
    1721%endif
    1822
    1923%ifn %{defined with_rtems_bsp}
    20  %error No RTEMS BSP specified: --with-rtems-bsp=bsp
     24 %error No RTEMS BSP specified: --rtems-bsp=arch/bsp (or --with-rtems-bsp=bsp)
    2125%endif
    2226
     
    2428 %define with_tools %{_prefix}
    2529%endif
     30
     31#
     32# Set the host to the target.
     33#
     34%define _host %{_target}
    2635
    2736#
     
    4756%define rtems_bsp_ldflags   %{pkgconfig ldflags %{_host}-%{rtems_bsp}}
    4857%define rtems_bsp_libs      %{pkgconfig libs    %{_host}-%{rtems_bsp}}
     58
     59%if %{rtems_bsp_cflags} == %{nil}
     60 %error No RTEMS target CFLAGS found; Please check the --rtems-bsp option.
     61%endif
    4962
    5063%if %{rtems_bsp_ccflags} == %{nil}
  • rtems/config/tools/rtems-autoconf-2.69-1.cfg

    rfba2549 r7385feb  
    22# Autoconf 2.69.
    33#
     4
     5%if %{rtems_arch} == none
     6 %define _target %{_host}
     7%endif
    48
    59%include %{_configdir}/checks.cfg
  • rtems/config/tools/rtems-automake-1.12.6-1.cfg

    rfba2549 r7385feb  
    22# Automake 1.12.6
    33#
     4
     5%if %{rtems_arch} == none
     6 %define _target %{_host}
     7%endif
    48
    59%include %{_configdir}/checks.cfg
  • source-builder/defaults.mc

    rfba2549 r7385feb  
    8080_builddir:           dir,     optional, '%{_topdir}/build/%{buildname}'
    8181_buildcxcdir:        dir,     optional, '%{_topdir}/build/%{buildname}-cxc'
     82_buildxcdir:         dir,     optional, '%{_topdir}/build/%{buildname}-xc'
    8283_docdir:             dir,     none,     '%{_defaultdocdir}'
    8384_tmppath:            dir,     none,     '%{_topdir}/build/tmp'
     
    8687buildroot:           dir,     none,     '%{_tmppath}/%{buildname}-%{_uid}'
    8788buildcxcroot:        dir,     none,     '%{_tmppath}/%{buildname}-%{_uid}-cxc'
     89buildxcroot:         dir,     none,     '%{_tmppath}/%{buildname}-%{_uid}-xx'
    8890_datadir:            dir,     none,     '%{_prefix}/share'
    8991_defaultdocdir:      dir,     none,     '%{_prefix}/share/doc'
     
    302304host_build_flags:    none,    none,     '''
    303305# Host and build flags, Cross build if host and build are different and
    304 # Cxc build idf target is deifned and also different.
     306# Cxc build if target is deifned and also different.
    305307# Note, gcc is not ready to be compiled with -std=gnu99 (this needs to be checked).
    306308if test "%{_build}" != "%{_host}" ; then
  • source-builder/sb/build.py

    rfba2549 r7385feb  
    2323#
    2424
     25import copy
    2526import getopt
    2627import glob
     
    117118        try:
    118119            self.opts = opts
    119             if macros is None:
    120                 self.macros = opts.defaults
    121             else:
    122                 self.macros = macros
     120            self.init_name = name
     121            self.init_macros = macros
     122            self.config = None
    123123            self.create_tar_files = create_tar_files
    124124            log.notice('config: ' + name)
     125            self.set_macros(macros)
    125126            self.config = config.file(name, opts, self.macros)
    126127            self.script = script()
     
    137138            raise
    138139
     140    def copy_init_macros(self):
     141        return copy.copy(self.init_macros)
     142
     143    def copy_macros(self):
     144        return copy.copy(self.macros)
     145
     146    def set_macros(self, macros):
     147        if macros is None:
     148            self.macros = copy.copy(opts.defaults)
     149        else:
     150            self.macros = copy.copy(macros)
     151        if self.config:
     152            self.config.set_macros(self.macros)
     153
    139154    def rmdir(self, rmpath):
    140155        log.output('removing: %s' % (path.host(rmpath)))
     
    152167        _build = self.config.expand('%{_build}')
    153168        _target = self.config.expand('%{_target}')
    154         return self.config.defined('%{allow_cxc}') and \
    155             len(_host) and len(_build) and (_target) and \
    156             _host != _build and _host != _target
     169        _allowed = self.config.defined('%{allow_cxc}')
     170        if len(_host) and len(_build) and (_target) and \
     171           _allowed and _host != _build and _host != _target:
     172            return True
     173        return False
     174
     175    def installable(self):
     176        _host = self.config.expand('%{_host}')
     177        _build = self.config.expand('%{_build}')
     178        _canadian_cross = self.canadian_cross()
     179        if self.macros.get('_disable_installing') and \
     180           self.config.expand('%{_disable_installing}') == 'yes':
     181            _disable_installing = True
     182        else:
     183            _disable_installing = False
     184        _no_install = self.opts.no_install()
     185        log.trace('_build: installable: host=%s build=%s ' \
     186                  'no-install=%r Cxc=%r disable_installing=%r disabled=%r' % \
     187                  (_host, _build, _no_install, _canadian_cross, _disable_installing, \
     188                   self.disabled()))
     189        return len(_host) and len(_build) and \
     190            not self.disabled() and \
     191            not _disable_installing and \
     192            not _canadian_cross
    157193
    158194    def source(self, name):
     
    314350                    if args[0] == '%setup':
    315351                        if len(args) == 1:
    316                             raise error.general('invalid %%setup directive: %s' % (' '.join(args)))
     352                            raise error.general('invalid %%setup directive: %s' % \
     353                                                (' '.join(args)))
    317354                        if args[1] == 'source':
    318355                            self.source_setup(package, args[1:])
     
    372409    def build_package(self, package):
    373410        if self.canadian_cross():
     411            if not self.config.defined('%{allow_cxc}'):
     412                raise error.general('Canadian Cross is not allowed')
    374413            self.script.append('echo "==> Candian-cross build/target:"')
    375414            self.script.append('SB_CXC="yes"')
     
    403442        return packages['main']
    404443
     444    def reload(self):
     445        self.config.load(self.init_name)
     446
    405447    def make(self):
    406448        package = self.main_package()
     
    411453                name = package.name()
    412454                if self.canadian_cross():
    413                     log.notice('package: (Cxc) %s' % (name))
     455                    cxc_label = '(Cxc) '
    414456                else:
    415                     log.notice('package: %s' % (name))
    416                     log.trace('---- macro maps %s' % ('-' * 55))
    417                     log.trace('%s' % (str(self.config.macros)))
    418                     log.trace('-' * 70)
     457                    cxc_label = ''
     458                log.notice('package: %s%s' % (cxc_label, name))
     459                log.trace('---- macro maps %s' % ('-' * 55))
     460                log.trace('%s' % (str(self.config.macros)))
     461                log.trace('-' * 70)
    419462                self.script.reset()
    420463                self.script.append(self.config.expand('%{___build_template}'))
     
    427470                    log.output('write script: ' + sn)
    428471                    self.script.write(sn)
    429                     if self.canadian_cross():
    430                         log.notice('building: (Cxc) %s' % (name))
    431                     else:
    432                         log.notice('building: %s' % (name))
     472                    log.notice('building: %s%s' % (cxc_label, name))
    433473                    self.run(sn)
    434474            except error.general, gerr:
  • source-builder/sb/config.py

    rfba2549 r7385feb  
    237237
    238238    def __init__(self, name, opts, macros = None):
     239        log.trace('config: %s: initialising' % (name))
    239240        self.opts = opts
    240         if macros is None:
    241             self.macros = opts.defaults
    242         else:
    243             self.macros = macros
    244241        self.init_name = name
    245         log.trace('config: %s' % (name))
    246         self.disable_macro_reassign = False
    247         self.configpath = []
    248242        self.wss = re.compile(r'\s+')
    249243        self.tags = re.compile(r':+')
    250244        self.sf = re.compile(r'%\([^\)]+\)')
    251         for arg in self.opts.args:
    252             if arg.startswith('--with-') or arg.startswith('--without-'):
    253                 if '=' in arg:
    254                     label, value = arg.split('=', 1)
    255                 else:
    256                     label = arg
    257                     value = None
    258                 label = label[2:].lower().replace('-', '_')
    259                 if value:
    260                     self.macros.define(label, value)
    261                 else:
    262                     self.macros.define(label)
    263         self._includes = []
    264         self.load_depth = 0
    265         self.pkgconfig_prefix = None
    266         self.pkgconfig_crosscompile = False
    267         self.pkgconfig_filter_flags = False
     245        self.set_macros(macros)
     246        self._reset(name)
    268247        self.load(name)
    269248
     
    286265            s += str(self._packages[_package])
    287266        return s
     267
     268    def _reset(self, name):
     269        self.name = name
     270        self.load_depth = 0
     271        self.configpath = []
     272        self._includes = []
     273        self._packages = {}
     274        self.in_error = False
     275        self.lc = 0
     276        self.conditionals = {}
     277        self._packages = {}
     278        self.package = 'main'
     279        self.disable_macro_reassign = False
     280        self.pkgconfig_prefix = None
     281        self.pkgconfig_crosscompile = False
     282        self.pkgconfig_filter_flags = False
     283        for arg in self.opts.args:
     284            if arg.startswith('--with-') or arg.startswith('--without-'):
     285                if '=' in arg:
     286                    label, value = arg.split('=', 1)
     287                else:
     288                    label = arg
     289                    value = None
     290                label = label[2:].lower().replace('-', '_')
     291                if value:
     292                    self.macros.define(label, value)
     293                else:
     294                    self.macros.define(label)
    288295
    289296    def _relative_path(self, p):
     
    10541061        self._packages[self.package].info_append(info, data)
    10551062
     1063    def set_macros(self, macros):
     1064        if macros is None:
     1065            self.macros = opts.defaults
     1066        else:
     1067            self.macros = macros
     1068
    10561069    def load(self, name):
    10571070
     
    10671080
    10681081        if self.load_depth == 0:
    1069             self.in_error = False
    1070             self.lc = 0
    1071             self.name = name
    1072             self.conditionals = {}
    1073             self._packages = {}
    1074             self.package = 'main'
     1082            self._reset(name)
    10751083            self._packages[self.package] = package(self.package,
    10761084                                                   self.define('%{_arch}'),
  • source-builder/sb/options.py

    rfba2549 r7385feb  
    222222        print '--with-<label>         : Add the --with-<label> to the build'
    223223        print '--without-<label>      : Add the --without-<label> to the build'
     224        print '--rtems-tools path     : Path to an install RTEMS tool set'
     225        print '--rtems-bsp arc/bsp    : Standard RTEMS architecure and BSP specifier'
     226        print '--rtems-version ver    : The RTEMS major/minor version string'
    224227        if self.optargs:
    225228            for a in self.optargs:
     
    298301            if path.exists(rsb_macros):
    299302                self.defaults.load(rsb_macros)
    300         # If a Cxc build disable installing.
    301         if self.canadian_cross():
    302             self.opts['no-install'] = '1'
    303             self.defaults['_no_install'] = '1'
    304303
    305304    def sb_git(self):
     
    451450    def get_arg(self, arg):
    452451        if self.optargs is None or arg not in self.optargs:
    453             raise error.internal('bad arg: %s' % (arg))
     452            return None
    454453        return self.parse_args(arg)
    455454
     
    517516        return self.opts['no-download'] != '0'
    518517
     518    def disable_install(self):
     519        self.opts['no-install'] = '1'
     520
    519521    def info(self):
    520522        s = ' Command Line: %s%s' % (' '.join(self.argv), os.linesep)
     
    524526    def log_info(self):
    525527        log.output(self.info())
     528
     529    def rtems_options(self):
     530        # Check for RTEMS specific helper options.
     531        rtems_tools = self.parse_args('--rtems-tools')
     532        if rtems_tools is not None:
     533            if self.get_arg('--with-tools') is not None:
     534                raise error.general('--rtems-tools and --with-tools cannot be used together')
     535            self.args.append('--with-tools=%s' % (rtems_tools[1]))
     536        rtems_arch_bsp = self.parse_args('--rtems-bsp')
     537        if rtems_arch_bsp is not None:
     538            if self.get_arg('--target') is not None:
     539                raise error.general('--rtems-bsp and --target cannot be used together')
     540            ab = rtems_arch_bsp[1].split('/')
     541            if len(ab) != 2:
     542                raise error.general('invalid --rtems-bsp option')
     543            rtems_version = self.parse_args('--rtems-version')
     544            if rtems_version is None:
     545                rtems_version = '%d.%d' % (version.major, version.minor)
     546            else:
     547                rtems_version = rtems_version[1]
     548            self.args.append('--target=%s-rtems%s' % (ab[0], rtems_version))
     549            self.args.append('--with-rtems-bsp=%s' % (ab[1]))
    526550
    527551def load(args, optargs = None, defaults = '%{_sbdir}/defaults.mc'):
     
    591615
    592616    o.sb_git()
     617    o.rtems_options()
    593618    o.process()
    594619    o.post_process()
  • source-builder/sb/path.py

    rfba2549 r7385feb  
    202202        if trace:
    203203            print ' mkdir: %s' % (hdst)
    204         os.makedirs(hdst)
     204        try:
     205            os.makedirs(hdst)
     206        except OSError, why:
     207            raise error.general('copying tree: cannot create target directory %s: %s' % \
     208                                (hdst, str(why)))
    205209
    206210    for name in names:
  • source-builder/sb/setbuilder.py

    rfba2549 r7385feb  
    100100                if format is not None:
    101101                    if len(format) != 2:
    102                         raise error.general('invalid report format option: %s' % ('='.join(format)))
     102                        raise error.general('invalid report format option: %s' % \
     103                                            ('='.join(format)))
    103104                    format = format[1]
    104105            if format is None:
     
    157158
    158159    def canadian_cross(self, _build):
    159         # @fixme Switch to using a private macros map.
    160         macros_to_save = ['%{_prefix}',
    161                           '%{_tmproot}',
    162                           '%{buildroot}',
    163                           '%{_builddir}',
    164                           '%{_host}']
    165         macros_to_copy = [('%{_host}',     '%{_build}'),
    166                           ('%{_tmproot}',  '%{_tmpcxcroot}'),
    167                           ('%{buildroot}', '%{buildcxcroot}'),
    168                           ('%{_builddir}', '%{_buildcxcdir}')]
    169         orig_macros = {}
    170         for m in macros_to_save:
    171             orig_macros[m] = _build.config.macro(m)
     160        log.trace('_bset: Cxc for build machine: _build => _host')
     161        macros_to_copy = [('%{_host}',        '%{_build}'),
     162                          ('%{_host_alias}',  '%{_build_alias}'),
     163                          ('%{_host_arch}',   '%{_build_arch}'),
     164                          ('%{_host_cpu}',    '%{_build_cpu}'),
     165                          ('%{_host_os}',     '%{_build_os}'),
     166                          ('%{_host_vendor}', '%{_build_vendor}'),
     167                          ('%{_tmproot}',     '%{_tmpcxcroot}'),
     168                          ('%{buildroot}',    '%{buildcxcroot}'),
     169                          ('%{_builddir}',    '%{_buildcxcdir}')]
     170        cxc_macros = _build.copy_init_macros()
    172171        for m in macros_to_copy:
    173             _build.config.set_define(m[0], _build.config.macro(m[1]))
     172            log.trace('_bset: Cxc: %s <= %s' % (m[0], cxc_macros[m[1]]))
     173            cxc_macros[m[0]] = cxc_macros[m[1]]
     174        _build.set_macros(cxc_macros)
     175        _build.reload()
    174176        _build.make()
    175         for m in macros_to_save:
    176             _build.config.set_define(m, orig_macros[m])
    177177        if not _build.macros.get('%{_disable_collecting}'):
    178             self.root_copy(_build.config.expand('%{buildcxcroot}'),
    179                            _build.config.expand('%{_tmpcxcroot}'))
     178            self.root_copy(_build.config.expand('%{buildroot}'),
     179                           _build.config.expand('%{_tmproot}'))
     180        _build.set_macros(_build.copy_init_macros())
     181        _build.reload()
    180182
    181183    def build_package(self, _config, _build):
     
    190192    def bset_tar(self, _build):
    191193        tardir = _build.config.expand('%{_tardir}')
    192         if self.opts.get_arg('--bset-tar-file') \
     194        if (self.opts.get_arg('--bset-tar-file') or self.opts.canadian_cross()) \
    193195           and not _build.macros.get('%{_disable_packaging}'):
    194196            path.mkdir(tardir)
     
    381383                    else:
    382384                        raise
     385            #
     386            # Installing ...
     387            #
     388            log.trace('_bset: installing: deps:%r no-install:%r' % \
     389                      (deps is None, self.opts.no_install()))
    383390            if deps is None \
    384391               and not self.opts.no_install() \
    385392               and not have_errors:
    386393                for b in builds:
    387                     if not b.canadian_cross() \
    388                        and not b.disabled() \
    389                        and not b.macros.get('%{_disable_installing}'):
     394                    log.trace('_bset: installing: %r' % b.installable())
     395                    if b.installable():
    390396                        self.install(b.name(),
    391397                                     b.config.expand('%{buildroot}'),
    392398                                     b.config.expand('%{_prefix}'))
     399
    393400            if deps is None and \
    394401                    (not self.opts.no_clean() or self.opts.always_clean()):
     
    473480        if not list_bset_cfg_files(opts, configs):
    474481            prefix = opts.defaults.expand('%{_prefix}')
     482            if opts.canadian_cross():
     483                opts.disable_install()
     484
    475485            if not opts.dry_run() and \
    476486               not opts.canadian_cross() and \
  • source-builder/sb/version.py

    rfba2549 r7385feb  
    2424#
    2525
    26 major = 0
    27 minor = 5
     26major = 4
     27minor = 11
    2828revision = 0
    2929
Note: See TracChangeset for help on using the changeset viewer.