summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2009-11-28 09:23:02 (GMT)
committerRemko Tronçon <git@el-tramo.be>2009-11-28 09:23:02 (GMT)
commitbafe5e6d6386f40f254b5da752545b5f9f41d316 (patch)
tree50b83577bb920dbde22529515954c8f1ad29cdd3
parenta1c0b927525a7f70a8c60363100a9968d0f3ae04 (diff)
downloadswift-bafe5e6d6386f40f254b5da752545b5f9f41d316.zip
swift-bafe5e6d6386f40f254b5da752545b5f9f41d316.tar.bz2
Prettify install commands.
-rw-r--r--3rdParty/SCons/scons-local/SCons/Tool/install.py2
-rw-r--r--SConstruct1
2 files changed, 2 insertions, 1 deletions
diff --git a/3rdParty/SCons/scons-local/SCons/Tool/install.py b/3rdParty/SCons/scons-local/SCons/Tool/install.py
index 3680b53..9596db1 100644
--- a/3rdParty/SCons/scons-local/SCons/Tool/install.py
+++ b/3rdParty/SCons/scons-local/SCons/Tool/install.py
@@ -41,97 +41,97 @@ from SCons.Util import make_path_relative
#
# We keep track of *all* installed files.
_INSTALLED_FILES = []
_UNIQUE_INSTALLED_FILES = None
#
# Functions doing the actual work of the Install Builder.
#
def copyFunc(dest, source, env):
"""Install a source file or directory into a destination by copying,
(including copying permission/mode bits)."""
if os.path.isdir(source):
if os.path.exists(dest):
if not os.path.isdir(dest):
raise SCons.Errors.UserError, "cannot overwrite non-directory `%s' with a directory `%s'" % (str(dest), str(source))
else:
parent = os.path.split(dest)[0]
if not os.path.exists(parent):
os.makedirs(parent)
shutil.copytree(source, dest)
else:
shutil.copy2(source, dest)
st = os.stat(source)
os.chmod(dest, stat.S_IMODE(st[stat.ST_MODE]) | stat.S_IWRITE)
return 0
def installFunc(target, source, env):
"""Install a source file into a target using the function specified
as the INSTALL construction variable."""
try:
install = env['INSTALL']
except KeyError:
raise SCons.Errors.UserError('Missing INSTALL construction variable.')
assert len(target)==len(source), \
"Installing source %s into target %s: target and source lists must have same length."%(map(str, source), map(str, target))
for t,s in zip(target,source):
if install(t.get_path(),s.get_path(),env):
return 1
return 0
def stringFunc(target, source, env):
installstr = env.get('INSTALLSTR')
if installstr:
- return env.subst_target_source(installstr, 0, target, source)
+ return env.subst_target_source(installstr, 1, target, source)
target = str(target[0])
source = str(source[0])
if os.path.isdir(source):
type = 'directory'
else:
type = 'file'
return 'Install %s: "%s" as "%s"' % (type, source, target)
#
# Emitter functions
#
def add_targets_to_INSTALLED_FILES(target, source, env):
""" an emitter that adds all target files to the list stored in the
_INSTALLED_FILES global variable. This way all installed files of one
scons call will be collected.
"""
global _INSTALLED_FILES, _UNIQUE_INSTALLED_FILES
_INSTALLED_FILES.extend(target)
_UNIQUE_INSTALLED_FILES = None
return (target, source)
class DESTDIR_factory:
""" a node factory, where all files will be relative to the dir supplied
in the constructor.
"""
def __init__(self, env, dir):
self.env = env
self.dir = env.arg2nodes( dir, env.fs.Dir )[0]
def Entry(self, name):
name = make_path_relative(name)
return self.dir.Entry(name)
def Dir(self, name):
name = make_path_relative(name)
return self.dir.Dir(name)
#
# The Builder Definition
#
install_action = SCons.Action.Action(installFunc, stringFunc)
installas_action = SCons.Action.Action(installFunc, stringFunc)
BaseInstallBuilder = None
def InstallBuilderWrapper(env, target=None, source=None, dir=None, **kw):
if target and dir:
import SCons.Errors
diff --git a/SConstruct b/SConstruct
index 121df77..799929d 100644
--- a/SConstruct
+++ b/SConstruct
@@ -108,96 +108,97 @@ if env.get("valgrind", 0) :
env["TEST_RUNNER"] = "valgrind --suppressions=QA/valgrind.supp -q --leak-check=full --track-origins=yes "
# Packaging
if ARGUMENTS.get("SWIFT_INSTALLDIR", "") :
env["SWIFT_INSTALLDIR"] = Dir(ARGUMENTS["SWIFT_INSTALLDIR"]).abspath
conf_env = env.Clone()
Export("env")
Export("conf_env")
################################################################################
# Extend the default build environment (not affecting the configure env)
#
# Keeping both environments separated mostly because of SCons Issue 2391,
# although it doesn't hurt to separate them (e.g. not have pretty printed
# strings in config.log)
################################################################################
#if env["PLATFORM"] == "win32" :
# env["MSVC_BATCH"] = 1
# Pretty output
def colorize(command, target, color) :
colors = { "red": "31", "green": "32", "yellow": "33", "blue": "34" }
prefix = ""
suffix = ""
if sys.stdout.isatty() and env["PLATFORM"] != "win32":
prefix = "\033[0;" + colors[color] + ";140m"
suffix = "\033[0m"
return " " + prefix + command + suffix + " " + target
if int(ARGUMENTS.get("V", 0)) == 0:
env["CCCOMSTR"] = colorize("CC", "$TARGET", "green")
env["CXXCOMSTR"] = colorize("CXX", "$TARGET", "green")
env["LINKCOMSTR"] = colorize("LINK", "$TARGET", "red")
env["ARCOMSTR"] = colorize("AR", "$TARGET", "red")
env["RANLIBCOMSTR"] = colorize("RANLIB", "$TARGET", "red")
env["QT4_RCCCOMSTR"] = colorize("RCC", "$TARGET", "blue")
env["QT4_UICCOMSTR"] = colorize("UIC", "$TARGET", "blue")
env["QT4_MOCFROMHCOMSTR"] = colorize("MOC", "$TARGET", "blue")
env["QT4_MOCFROMCXXCOMSTR"] = colorize("MOC", "$TARGET", "blue")
env["GENCOMSTR"] = colorize("GEN", "$TARGET", "blue")
env["RCCOMSTR"] = colorize("RC", "$TARGET", "blue")
env["BUNDLECOMSTR"] = colorize("BUNDLE", "$TARGET", "blue")
env["NIBCOMSTR"] = colorize("NIB", "$TARGET", "blue")
env["NSISCOMSTR"] = colorize("NSIS", "$TARGET", "blue")
+ env["INSTALLSTR"] = colorize("INSTALL", "$TARGET", "blue")
env["TESTCOMSTR"] = colorize("TEST", "$SOURCE", "yellow")
#Progress(colorize("DEP", "$TARGET", "red")
def checkObjCHeader(context, header) :
context.Message("Checking for Objective-C header " + header + " ... ")
ret = context.TryCompile("#include <Cocoa/Cocoa.h>\n#include <" + header + ">", ".m")
context.Result(ret)
return ret
################################################################################
# Platform configuration
################################################################################
if ARGUMENTS.get("force-configure", 0) :
SCons.SConf.SetCacheMode("force")
conf = Configure(conf_env)
conf.CheckCXX()
conf.CheckCC()
if conf.CheckLib("z") :
env.Append(LIBS = "z")
env["ZLIB_FLAGS"] = ""
else :
SConscript("3rdParty/ZLib/SConscript")
if conf.CheckLib("dl") :
env.Append(LIBS = ["dl"])
if conf.CheckLib("c") :
env.Append(LIBS = ["c"])
if conf.CheckLib("resolv") :
env.Append(LIBS = ["resolv"])
# Expat
if conf.CheckCHeader("expat.h") and conf.CheckLib("expat") :
env["HAVE_EXPAT"] = 1
env["EXPAT_FLAGS"] = { "LIBS": ["expat"] }
conf.Finish()
# Xss
env["HAVE_XSS"] = 0
if env["PLATFORM"] != "win32" and env["PLATFORM"] != "darwin" :
xss_flags = {
"LIBPATH": ["/usr/X11R6/lib"],