3
3
# Build cross toolchain for AmigaOS <= 3.9 / M68k target.
4
4
5
5
from fnmatch import fnmatch
6
+ from glob import glob
6
7
from logging import info
7
8
from os import environ
8
9
import argparse
@@ -207,6 +208,20 @@ def update_autotools(dst):
207
208
copy ('{archives}/automake/lib/config.sub' , path .join (dst , 'config.sub' ))
208
209
209
210
211
+ def touch_genfiles (dst ):
212
+ """
213
+ For binutils and gcc we want to make sure C source & headers file doesn't get
214
+ regenerated. Otherwise it can cause weird errors later in the build process
215
+ (e.g. in ldexp.c:560)
216
+ """
217
+ for name in find (dst , include = ['*.l' , '*.y' ]):
218
+ basename = path .splitext (name )[0 ]
219
+ for c_file in glob (basename + '.c' ):
220
+ touch (c_file )
221
+ for h_file in glob (basename + '.h' ):
222
+ touch (h_file )
223
+
224
+
210
225
def build ():
211
226
for var in environ .keys ():
212
227
if var not in ['_' , 'LOGNAME' , 'HOME' , 'SHELL' , 'TMPDIR' , 'PWD' ]:
@@ -365,6 +380,7 @@ def build():
365
380
366
381
unpack ('{binutils}' )
367
382
update_autotools ('{sources}/{binutils}' )
383
+ touch_genfiles ('{sources}/{binutils}' )
368
384
with env (CC = environ ['CC' ] + ' -std=gnu11' ,
369
385
CXX = environ ['CXX' ] + ' -std=gnu++11' ,
370
386
CFLAGS = '-g -O2 -Wall' ,
@@ -383,6 +399,7 @@ def build():
383
399
update_autotools ('{sources}/{gcc}' )
384
400
update_autotools ('{sources}/{gcc}/gcc' )
385
401
update_autotools ('{sources}/{gcc}/texinfo' )
402
+ touch_genfiles ('{sources}/{gcc}' )
386
403
with env (CC = environ ['CC' ] + ' -std=gnu11' ,
387
404
CXX = environ ['CXX' ] + ' -std=gnu++11' ,
388
405
CFLAGS = '-g -O2 -Wall' ,
@@ -498,7 +515,7 @@ def read_sdk(filename):
498
515
def list_sdk ():
499
516
print 'Available SDKs:'
500
517
501
- for filename in find ('{top}/sdk' , include = '*.sdk' ):
518
+ for filename in find ('{top}/sdk' , include = [ '*.sdk' ] ):
502
519
info , _ = read_sdk (filename )
503
520
name = path .splitext (path .basename (filename ))[0 ]
504
521
print ' - %s %s : %s' % (name , info ['version' ], info ['short' ])
@@ -646,8 +663,8 @@ if __name__ == "__main__":
646
663
if not sys .version_info [:2 ] == (2 , 7 ):
647
664
panic ('I need Python 2.7 to run!' )
648
665
649
- if not ( platform .system () in [ 'Darwin' , 'Linux' ] or
650
- fnmatch ( platform . system () , 'MSYS_NT*' ) ):
666
+ if not any ( fnmatch ( platform .system (), pat )
667
+ for pat in [ 'Darwin' , 'Linux' , 'CYGWIN_NT*' , ' MSYS_NT*'] ):
651
668
panic ('Build on %s not supported!' , platform .system ())
652
669
653
670
if platform .machine () not in ['i686' , 'x86_64' ]:
0 commit comments