Changeset a6a6d54 in rtems-libbsd for waf_libbsd.py


Ignore:
Timestamp:
Mar 27, 2018, 7:31:49 AM (19 months ago)
Author:
Christian Mauderer <christian.mauderer@…>
Branches:
c1e05b9ea378b2971e3d7704779112b4bc4296da, 4a77611a223ea883fb548679b516d326a020d447
Children:
494b156
Parents:
d797c5d
git-author:
Christian Mauderer <christian.mauderer@…> (03/27/18 07:31:49)
git-committer:
Christian Mauderer <christian.mauderer@…> (04/10/18 06:55:28)
Message:

waf: Fix freebsd-to-rtems.py.

Update #3351

File:
1 edited

Legend:

Unmodified
Added
Removed
  • waf_libbsd.py

    rd797c5d ra6a6d54  
    4949else:
    5050    host_shell = ''
    51 
    52 def _cflagsIncludes(cflags, includes):
    53     if type(cflags) is not list:
    54         if cflags is not None:
    55             _cflags = cflags.split(' ')
    56         else:
    57             _cflags = [None]
    58     else:
    59         _cflags = cflags
    60     if type(includes) is not list:
    61         _includes = [includes]
    62     else:
    63         _includes = includes
    64     return _cflags, _includes
    65 
    66 class SourceFileFragmentComposer(builder.BuildSystemFragmentComposer):
    67 
    68     def __init__(self, cflags = "default", includes = None):
    69         self.cflags, self.includes = _cflagsIncludes(cflags, includes)
    70 
    71     def compose(self, path):
    72         if None in self.includes:
    73             flags = self.cflags
    74         else:
    75             flags = self.cflags + self.includes
    76         return ['sources', flags, ('default', None)], [path], self.cflags, self.includes
    77 
    78 class SourceFileIfHeaderComposer(SourceFileFragmentComposer):
    79 
    80     def __init__(self, headers, cflags = "default", includes = None):
    81         if headers is not list:
    82             headers = [headers]
    83         self.headers = headers
    84         super(SourceFileIfHeaderComposer, self).__init__(cflags = cflags, includes = includes)
    85 
    86     def compose(self, path):
    87         r = SourceFileFragmentComposer.compose(self, path)
    88         define_keys = ''
    89         for h in self.headers:
    90             h = h.upper()
    91             for c in '\/-.':
    92                 h = h.replace(c, '_')
    93             define_keys += ' ' + h
    94         r[0][2] = (define_keys.strip(), self.headers)
    95         return r
    96 
    97 class TestFragementComposer(builder.BuildSystemFragmentComposer):
    98 
    99     def __init__(self, testName, fileFragments, runTest = True, netTest = False):
    100         self.testName = testName
    101         self.fileFragments = fileFragments
    102         self.runTest = runTest
    103         self.netTest = netTest
    104 
    105     def compose(self, path):
    106         return ['tests', self.testName, ('default', None)], { 'files': self.fileFragments,
    107                                                               'run': self.runTest,
    108                                                               'net': self.netTest }
    109 
    110 class TestIfHeaderComposer(TestFragementComposer):
    111 
    112     def __init__(self, testName, headers, fileFragments, runTest = True, netTest = False):
    113         if headers is not list:
    114             headers = [headers]
    115         self.headers = headers
    116         super(TestIfHeaderComposer, self).__init__(testName, fileFragments,
    117                                                    runTest = runTest, netTest = netTest)
    118 
    119     def compose(self, path):
    120         r = TestFragementComposer.compose(self, path)
    121         define_keys = ''
    122         for h in self.headers:
    123             h = h.upper()
    124             for c in '\/-.':
    125                 h = h.replace(c, '_')
    126             define_keys += ' ' + h
    127         r[0][2] = (define_keys.strip(), self.headers)
    128         return r
    129 
    130 class KVMSymbolsFragmentComposer(builder.BuildSystemFragmentComposer):
    131 
    132     def compose(self, path):
    133         return ['KVMSymbols', 'files', ('default', None)], [path], self.includes
    134 
    135 class RPCGENFragmentComposer(builder.BuildSystemFragmentComposer):
    136 
    137     def compose(self, path):
    138         return ['RPCGen', 'files', ('default', None)], [path]
    139 
    140 class RouteKeywordsFragmentComposer(builder.BuildSystemFragmentComposer):
    141 
    142     def compose(self, path):
    143         return ['RouteKeywords', 'files', ('default', None)], [path]
    144 
    145 class LexFragmentComposer(builder.BuildSystemFragmentComposer):
    146 
    147     def __init__(self, sym, dep, cflags = None, includes = None):
    148         self.sym = sym
    149         self.dep = dep
    150         self.cflags, self.includes = _cflagsIncludes(cflags, includes)
    151 
    152     def compose(self, path):
    153         d = { 'file': path,
    154               'sym': self.sym,
    155               'dep': self.dep }
    156         if None not in self.cflags:
    157             d['cflags'] = self.cflags
    158         if None not in self.includes:
    159             d['includes'] = self.includes
    160         return ['lex', path, ('default', None)], d
    161 
    162 class YaccFragmentComposer(builder.BuildSystemFragmentComposer):
    163 
    164     def __init__(self, sym, header, cflags = None, includes = None):
    165         self.sym = sym
    166         self.header = header
    167         self.cflags, self.includes = _cflagsIncludes(cflags, includes)
    168 
    169     def compose(self, path):
    170         d = { 'file': path,
    171               'sym': self.sym,
    172               'header': self.header }
    173         if None not in self.cflags:
    174             d['cflags'] = self.cflags
    175         if None not in self.includes:
    176             d['includes'] = self.includes
    177         return ['yacc', path, ('default', None)], d
    17851
    17952#
     
    20275            sources = sorted(files)
    20376        return sources
    204 
    205     def setGenerators(self):
    206         #
    207         # Called when the builder.ModuleManager.__init__ is run
    208         #
    209         self.generator['convert'] = builder.Converter
    210         self.generator['no-convert'] = builder.NoConverter
    211         self.generator['from-FreeBSD-to-RTEMS-UserSpaceSourceConverter'] = builder.FromFreeBSDToRTEMSUserSpaceSourceConverter
    212         self.generator['from-RTEMS-To-FreeBSD-SourceConverter'] = builder.FromRTEMSToFreeBSDSourceConverter
    213         self.generator['buildSystemFragmentComposer'] = builder.BuildSystemFragmentComposer
    214 
    215         self.generator['file'] = builder.File
    216 
    217         self.generator['path'] = builder.PathComposer
    218         self.generator['freebsd-path'] = builder.FreeBSDPathComposer
    219         self.generator['rtems-path'] = builder.RTEMSPathComposer
    220         self.generator['cpu-path'] = builder.CPUDependentFreeBSDPathComposer
    221         self.generator['target-src-cpu--path'] = builder.TargetSourceCPUDependentPathComposer
    222 
    223         self.generator['source'] = SourceFileFragmentComposer
    224         self.generator['test'] = TestFragementComposer
    225         self.generator['kvm-symbols'] = KVMSymbolsFragmentComposer
    226         self.generator['rpc-gen'] = RPCGENFragmentComposer
    227         self.generator['route-keywords'] = RouteKeywordsFragmentComposer
    228         self.generator['lex'] = LexFragmentComposer
    229         self.generator['yacc'] = YaccFragmentComposer
    230 
    231         self.generator['source-if-header'] = SourceFileIfHeaderComposer
    232         self.generator['test-if-header'] = TestIfHeaderComposer
    23377
    23478    def generate(self, rtems_version):
Note: See TracChangeset for help on using the changeset viewer.