From 7459eb89d67db4d1245603b3c7cde1140a999474 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Remko=20Tron=C3=A7on?= <git@el-tramo.be>
Date: Mon, 10 Aug 2009 22:30:13 +0200
Subject: Fix SCons build on windows.


diff --git a/3rdParty/LibIDN/SConscript b/3rdParty/LibIDN/SConscript
index 9e408ff..5853a85 100644
--- a/3rdParty/LibIDN/SConscript
+++ b/3rdParty/LibIDN/SConscript
@@ -1,4 +1,4 @@
-Import("env")
+Import(["env", "conf_env"])
 
 env["LIBIDN_FLAGS"] = {
 		"CPPDEFINES": ["IDNA_STATIC"],
@@ -13,7 +13,7 @@ myenv = env.Clone()
 myenv.Replace(CCFLAGS = [flag for flag in env["CCFLAGS"] if flag not in ["-W", "-Wall"]])
 
 # Check for strcasecmp() or replacement
-conf = Configure(myenv)
+conf = Configure(conf_env)
 if not conf.CheckFunc('strcasecmp') :
 	if conf.CheckFunc("stricmp") :
 		myenv.Append(CPPDEFINES = [("strcasecmp", "stricmp")])
diff --git a/BuildTools/SCons/Tools/qt4.py b/BuildTools/SCons/Tools/qt4.py
index 6df945b..1eb1273 100644
--- a/BuildTools/SCons/Tools/qt4.py
+++ b/BuildTools/SCons/Tools/qt4.py
@@ -463,6 +463,8 @@ def enable_modules(self, modules, debug=False, crosscompiling=False) :
 			self.AppendUnique(CPPPATH=[os.path.join("$QTDIR","include","QtAssistant")])
 			modules.remove("QtAssistant")
 			modules.append("QtAssistantClient")
+		# FIXME: Phonon Hack
+		self.AppendUnique(LIBS=['phonon4'+debugSuffix])
 		self.AppendUnique(LIBS=[lib+'4'+debugSuffix for lib in modules if lib not in staticModules])
 		self.PrependUnique(LIBS=[lib+debugSuffix for lib in modules if lib in staticModules])
 		if 'QtOpenGL' in modules:
@@ -482,6 +484,7 @@ def enable_modules(self, modules, debug=False, crosscompiling=False) :
 		self.AppendUnique(LINKFLAGS="-F$QTDIR/lib")
 		self.AppendUnique(CPPFLAGS="-F$QTDIR/lib")
 		self.AppendUnique(LINKFLAGS="-L$QTDIR/lib") #TODO clean!
+		# FIXME: Phonon Hack
 		self.Append(LINKFLAGS=['-framework', "phonon"])
 		if debug : debugSuffix = 'd'
 		for module in modules :
diff --git a/SConstruct b/SConstruct
index 1f41d19..541f2a8 100644
--- a/SConstruct
+++ b/SConstruct
@@ -1,38 +1,11 @@
 import sys, os
 
 ################################################################################
-# Set up default build environment
+# Set up default build & configure environment
 ################################################################################
 
 env = Environment(CPPPATH = "#", ENV = {'PATH' : os.environ['PATH']})
 
-# Pretty output
-if ARGUMENTS.get("V") != "1":
-  if sys.stdout.isatty() and env["PLATFORM"] != "win32":
-    env["CCCOMSTR"]             = "  \033[0;33;140mCC\033[0m     $TARGET"
-    env["CXXCOMSTR"]            = "  \033[0;32;140mCXX\033[0m    $TARGET"
-    env["LINKCOMSTR"]           = "  \033[0;31;140mLINK\033[0m   $TARGET"
-    env["ARCOMSTR"]             = "  \033[0;31;140mAR\033[0m     $TARGET"
-    env["RANLIBCOMSTR"]         = "  \033[0;31;140mRANLIB\033[0m $TARGET"
-    env["QT4_RCCCOMSTR"]        = "  \033[0;34;140mRCC\033[0m    $TARGET"
-    env["QT4_UICCOMSTR"]        = "  \033[0;34;140mUIC\033[0m    $TARGET"
-    env["QT4_MOCFROMHCOMSTR"]   = "  \033[0;34;140mMOC\033[0m    $TARGET"
-    env["QT4_MOCFROMCXXCOMSTR"] = "  \033[0;34;140mMOC\033[0m    $TARGET"
-    env["GENCOMSTR"]            = "  \033[0;34;140mGEN\033[0m    $TARGET"
-    #Progress(                     "  \033[0;35;140mDEP\033[0m    $TARGET\n")
-  else :
-    env["CCCOMSTR"]             = "  CC     $TARGET"
-    env["CXXCOMSTR"]            = "  CXX    $TARGET"
-    env["LINKCOMSTR"]           = "  LINK   $TARGET"
-    env["ARCOMSTR"]             = "  AR     $TARGET"
-    env["RANLIBCOMSTR"]         = "  RANLIB $TARGET"
-    env["QT4_RCCCOMSTR"]        = "  RCC    $TARGET"
-    env["QT4_UICCOMSTR"]        = "  UIC    $TARGET"
-    env["QT4_MOCFROMHCOMSTR"]   = "  MOC    $TARGET"
-    env["QT4_MOCFROMCXXCOMSTR"] = "  MOC    $TARGET"
-    env["GENCOMSTR"]            = "  GEN    $TGENGET"
-    #Progress('  DEP $TARGET\n')
-
 # Default compiler flags
 if int(ARGUMENTS.get("optimize", 0)) == 1 :
 	if env["PLATFORM"] == "win32" :
@@ -71,19 +44,64 @@ if int(ARGUMENTS.get("coverage", 0)) == 1 :
 	env.Append(LINKFLAGS = ["-fprofile-arcs", "-ftest-coverage"])
 
 if env["PLATFORM"] == "win32" :
+	env.Append(LIBS = ["dnsapi", "ws2_32", "wsock32"])
 	env.Append(CCFLAGS = "/EHsc")
 
 if env["PLATFORM"] == "darwin" :
 	env.Append(FRAMEWORKS = "AppKit")
 
+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)
+################################################################################
+
+# Pretty output
+if int(ARGUMENTS.get("V", 0)) == 0:
+  if sys.stdout.isatty() and env["PLATFORM"] != "win32":
+    env["CCCOMSTR"]             = "  \033[0;33;140mCC\033[0m     $TARGET"
+    env["CXXCOMSTR"]            = "  \033[0;32;140mCXX\033[0m    $TARGET"
+    env["LINKCOMSTR"]           = "  \033[0;31;140mLINK\033[0m   $TARGET"
+    env["ARCOMSTR"]             = "  \033[0;31;140mAR\033[0m     $TARGET"
+    env["RANLIBCOMSTR"]         = "  \033[0;31;140mRANLIB\033[0m $TARGET"
+    env["QT4_RCCCOMSTR"]        = "  \033[0;34;140mRCC\033[0m    $TARGET"
+    env["QT4_UICCOMSTR"]        = "  \033[0;34;140mUIC\033[0m    $TARGET"
+    env["QT4_MOCFROMHCOMSTR"]   = "  \033[0;34;140mMOC\033[0m    $TARGET"
+    env["QT4_MOCFROMCXXCOMSTR"] = "  \033[0;34;140mMOC\033[0m    $TARGET"
+    env["GENCOMSTR"]            = "  \033[0;34;140mGEN\033[0m    $TARGET"
+    env["RCCOMSTR"]             = "  \033[0;34;140mRC\033[0m     $TARGET"
+    #Progress(                     "  \033[0;35;140mDEP\033[0m    $TARGET\n")
+  else :
+    env["CCCOMSTR"]             = "  CC     $TARGET"
+    env["CXXCOMSTR"]            = "  CXX    $TARGET"
+    env["LINKCOMSTR"]           = "  LINK   $TARGET"
+    env["ARCOMSTR"]             = "  AR     $TARGET"
+    env["RANLIBCOMSTR"]         = "  RANLIB $TARGET"
+    env["QT4_RCCCOMSTR"]        = "  RCC    $TARGET"
+    env["QT4_UICCOMSTR"]        = "  UIC    $TARGET"
+    env["QT4_MOCFROMHCOMSTR"]   = "  MOC    $TARGET"
+    env["QT4_MOCFROMCXXCOMSTR"] = "  MOC    $TARGET"
+    env["GENCOMSTR"]            = "  GEN    $TARGET"
+    env["RCCOMSTR"]             = "  RC     $TARGET"
+    #Progress('  DEP $TARGET\n')
+
+if env["PLATFORM"] == "win32" :
+	env["MSVC_BATCH"] = 1
 
 
 ################################################################################
 # Platform configuration
 ################################################################################
 
-conf = Configure(env)
+conf = Configure(conf_env)
 
 if conf.CheckCHeader("pthread.h") :
 	env["HAVE_PTHREAD"] = 1
@@ -166,5 +184,5 @@ if env.get("HAVE_EXPAT", 0):
 		parsers.append("(Bundled)")
 print "		 XML Parsers: " + ' '.join(parsers)
 
-print "		 TLS Support: " + ("OpenSSL" if env["HAVE_OPENSSL"] else "Disabled")
+print "		 TLS Support: " + ("OpenSSL" if env.get("HAVE_OPENSSL",0) else "Disabled")
 print
diff --git a/Swift/QtUI/SConscript b/Swift/QtUI/SConscript
index 36cf850..2fd1bc1 100644
--- a/Swift/QtUI/SConscript
+++ b/Swift/QtUI/SConscript
@@ -75,7 +75,8 @@ sources = [
 	]
 
 if env["PLATFORM"] == "win32" :
-	sources += ["../resources/Windows/Swift.rc"]
+	myenv.RES("../resources/Windows/Swift.rc")
+	sources += ["../resources/Windows/Swift.res"]
 
 if env["PLATFORM"] == "darwin" or env["PLATFORM"] == "win32" :
 	myenv.Program("Swift", sources)
-- 
cgit v0.10.2-6-g49f6