2
0
mirror of https://frontier.innolan.net/github/amigaos-cross-toolchain6.git synced 2024-10-19 10:29:55 +00:00

@N added xbuild - to build without updateing, also build checks now for changes and rebuilds submodules

This commit is contained in:
bebbo
2017-03-22 16:07:34 +01:00
parent d8ff900ff6
commit 8f19190db2
2 changed files with 66 additions and 27 deletions

View File

@ -345,37 +345,16 @@ def recipe(name, nargs=0):
def wrapper(*args, **kwargs):
target = [str(arg) for arg in args[:min(nargs, len(args))]]
if len(target) > 0:
mtarget = target[0]
target = [target[0], fill_in(name)] + target[1:]
target = '-'.join(target)
else:
target = fill_in(name)
mtarget = target
target = target.replace('_', '-')
target = target.replace('/', '-')
stamp = path.join('{stamps}', target)
if not path.exists('{stamps}'):
mkdir('{stamps}')
if name == 'make' and path.exists(stamp):
mfile = ''
mmax = 0
for root, dirs, files in os.walk('submodules/' + mtarget):
for filename in files:
mf = os.path.join(root, filename)
mt = os.stat(mf).st_mtime
if mt > mmax:
mfile = mf
mmax = mt
if mmax > os.stat(stamp).st_mtime:
mstamp = path.join('{stamps}', mtarget + '-make*')
info('removing stamp for "%s"\n\tcaused by "%s" %s'
'\n\tstamp is "%s" %s', mstamp, mfile, datetime.datetime.fromtimestamp(mmax),
stamp, datetime.datetime.fromtimestamp(os.stat(stamp).st_mtime))
for f in glob(mstamp):
remove(f)
if not path.exists(stamp):
fn(*args, **kwargs)
touch(stamp)
@ -443,6 +422,34 @@ def unpack(name, work_dir='{sources}', top_dir=None, dst_dir=None):
copytree(path.join(tmpdir, top_dir or name), dst)
rmtree(tmpdir)
def removemodule(name):
mbuild = path.join('{build}', name)
info('removing build for module %s : "%s"', name, mbuild)
mstamp = path.join('{stamps}', name + '-*')
for f in glob(mstamp):
remove(f)
rmtree(mbuild)
def checkstamps(name):
target = fill_in(name)
target = target.replace('_', '-')
target = target.replace('/', '-') + "-make"
stamp = path.join('{stamps}', target)
info('checking %s with %s', name, stamp)
mtime = 0
if path.exists(stamp):
mtime = os.stat(stamp).st_mtime
submodule = path.join('submodules/', name)
for root, dirs, files in os.walk(submodule):
for filename in files:
mf = os.path.join(root, filename)
mt = os.stat(mf).st_mtime
if mt > mtime:
return True
return False
@recipe('patch', 1)
def patch(name, work_dir='{sources}'):
@ -523,4 +530,5 @@ __all__ = ['setvar', 'panic', 'cmpver', 'find_executable', 'chmod', 'execute',
'rmtree', 'mkdir', 'copy', 'copytree', 'unarc', 'fetch', 'cwd',
'symlink', 'remove', 'move', 'find', 'textfile', 'env', 'path',
'add_site_dir', 'find_site_dir', 'python_setup', 'recipe',
'unpack', 'patch', 'configure', 'make', 'require_header', 'touch']
'unpack', 'patch', 'configure', 'make', 'require_header', 'touch',
'checkstamps', 'removemodule']

View File

@ -232,6 +232,12 @@ def update():
execute('git', 'submodule', 'update');
def build():
_build(True)
def xbuild():
_build(False)
def _build(pull):
for var in environ.keys():
if var not in ['_', 'LOGNAME', 'HOME', 'SHELL', 'TMPDIR', 'PWD']:
del environ[var]
@ -245,8 +251,9 @@ def build():
environ['LANG'] = 'C'
environ['TERM'] = 'xterm'
download()
update()
if pull:
download()
update()
add_site_dir('{host}')
@ -275,6 +282,29 @@ def build():
required programs, headers and libraries are present.
"""
if checkstamps('{binutils}'):
checkstamps('{binutils}')
if checkstamps('{gcc}'):
removemodule('{libnix}')
removemodule('{clib2}')
removemodule('{libdebug}')
removemodule('{libm}')
if checkstamps('{libnix}'):
checkstamps('{libnix}')
if checkstamps('{clib2}'):
checkstamps('{clib2}')
if checkstamps('{libdebug}'):
checkstamps('{libdebug}')
if checkstamps('{libm}'):
checkstamps('{libm}')
find_executable('perl')
find_executable('pod2text')
find_executable('pod2man')
@ -381,7 +411,7 @@ def build():
config.guess script knows nothing about x86-64 or darwin.
"""
with env(CC=CC, CXX=CXX, CFLAGS='-g -Wall', CXXFLAGS='-g -Wall'):
with env(CC=CC, CXX=CXX, CFLAGS='-g -Os -Wall', CXXFLAGS='-g -Os -Wall'):
configure('{binutils}',
'--prefix={target}',
'--host=i686-linux-gnu',
@ -664,7 +694,8 @@ def test():
def help():
print ('\n'
'build: build the tool chain (use --threads n to speed up the build)\n'
'build: download, update and build the tool chain (use --threads n to speed up the build)\n'
'xbuild: build the tool chain (use --threads n to speed up the build)\n'
'clean: remove the build artifacts\n'
'update: updates the submodules using git\n'
'download: download the archives\n'
@ -688,7 +719,7 @@ if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Build cross toolchain.')
parser.add_argument('action',
choices=['help', 'build', 'list-sdk', 'install-sdk', 'clean',
choices=['help', 'build', 'xbuild', 'list-sdk', 'install-sdk', 'clean',
'test', 'update', 'download'],
default='build', help='perform an action')
parser.add_argument('args', metavar='ARGS', type=str, nargs='*',