From 6f6df1064446bc3a0a71925c68488b03b6888176 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Remko=20Tron=C3=A7on?= Date: Mon, 2 Sep 2013 20:46:42 +0200 Subject: scons2ninja: Added support for dist=1. Change-Id: I2c07f916b4a4a14707a182c027d5eda3a736649b diff --git a/.scons2ninja.conf b/.scons2ninja.conf index 9ea1c57..0ad2ef4 100644 --- a/.scons2ninja.conf +++ b/.scons2ninja.conf @@ -1,4 +1,4 @@ -import glob +import glob, re, os.path scons_cmd = "python 3rdParty/SCons/scons.py" scons_dependencies += glob.glob("BuildTools/SCons/**/*.py") + glob.glob("BuildTools/SCons/SCons*") + ["config.py"] @@ -20,3 +20,26 @@ def ninja_post(ninja) : ninja.build(['Sluift', 'sluift'], 'phony', ['Sluift\\exe\\sluift.exe', 'Sluift\\dll\\sluift.dll']) elif sys.platform in ['posix', 'darwin'] : ninja.build(['Sluift', 'sluift'], 'phony', ['Sluift/exe/sluift', 'Sluift/dll/sluift.so']) + + # Extra rules + if sys.platform == "darwin" : + ninja.rule('zip', + command = 'cd $dir && zip -r $relative_out $relative_in', + description = 'ZIP $out') + + ninja.rule('package', + command = 'Swift/Packaging/MacOSX/package.sh $in $template $out $qtdir', + description = 'PACKAGE $out') + + +def ninja_custom_command(ninja, command) : + if sys.platform == "darwin" : + m = re.match("cd (.*) && zip -r (.*) (.*)", line) + if m : + ninja.build(os.path.relpath(m.group(2)), 'zip', os.path.join(m.group(1), m.group(3)), dir = m.group(1), relative_in = m.group(3), relative_out = os.path.relpath(m.group(2), m.group(1))) + return True + m = re.match(".*/MacOSX/package.sh (.*) (.*) (.*) (.*)", line) + if m : + ninja.build(m.group(3), 'package', m.group(1), deps = [m.group(2)], qtdir = m.group(4), template = m.group(2)) + return True + return False diff --git a/BuildTools/scons2ninja.py b/BuildTools/scons2ninja.py index 98b3518..4a7631a 100755 --- a/BuildTools/scons2ninja.py +++ b/BuildTools/scons2ninja.py @@ -221,6 +221,9 @@ ninja_post = [] scons_cmd = "scons" scons_dependencies = ['SConstruct'] + rglob('SConscript') +def ninja_custom_command(ninja, line) : + return False + CONFIGURATION_FILE = '.scons2ninja.conf' execfile(CONFIGURATION_FILE) @@ -320,6 +323,10 @@ ninja.rule('ibtool', command = '$ibtool $ibtoolflags --compile $out $in', description = 'IBTOOL $out') +ninja.rule('dsymutil', + command = '$dsymutil $dsymutilflags -o $out $in', + description = 'DSYMUTIL $out') + ninja.rule('generator', command = "python " + SCRIPT + " ${scons_args}", depfile = ".scons2ninja.deps", @@ -559,7 +566,12 @@ for line in build_lines : files, flags = extract_non_flags(flags) ninja.build(out, 'ibtool', files, ibtoolflags = flags) - else : + elif tool == 'dsymutil': + out, flags = extract_binary_flag("-o", flags) + files, flags = extract_non_flags(flags) + ninja.build(out, 'dsymutil', files, dsymutilflags = flags) + + elif not ninja_custom_command(ninja, line) : raise Exception("Unknown tool: '" + line + "'") -- cgit v0.10.2-6-g49f6