From 3911f30a92ae971aebdbf1d733b4261aafde4950 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Remko=20Tron=C3=A7on?= <git@el-tramo.be>
Date: Sun, 10 Jul 2011 09:58:49 +0200
Subject: Fixed compilation problem on some compilers.


diff --git a/3rdParty/OpenSSL/.gitignore b/3rdParty/OpenSSL/.gitignore
new file mode 100644
index 0000000..fa963ae
--- /dev/null
+++ b/3rdParty/OpenSSL/.gitignore
@@ -0,0 +1 @@
+openssl
diff --git a/3rdParty/OpenSSL/SConscript b/3rdParty/OpenSSL/SConscript
index c19632c..dfe78b7 100644
--- a/3rdParty/OpenSSL/SConscript
+++ b/3rdParty/OpenSSL/SConscript
@@ -1,6 +1,6 @@
 Import("env")
 
-openssl_bundle_dir = "#/../openssl"
+openssl_bundle_dir = "openssl"
 
 if env.get("OPENSSL_BUNDLED", False) :
 	if env["SCONS_STAGE"] == "flags" :
diff --git a/BuildTools/SCons/SConscript.boot b/BuildTools/SCons/SConscript.boot
index c57ba3c..e969def 100644
--- a/BuildTools/SCons/SConscript.boot
+++ b/BuildTools/SCons/SConscript.boot
@@ -50,6 +50,7 @@ vars.Add(PathVariable("avahi_libdir", "Avahi library location", None, PathVariab
 vars.Add(PathVariable("qt", "Qt location", "", PathVariable.PathAccept))
 vars.Add(PathVariable("docbook_xml", "DocBook XML", None, PathVariable.PathAccept))
 vars.Add(PathVariable("docbook_xsl", "DocBook XSL", None, PathVariable.PathAccept))
+vars.Add(BoolVariable("build_examples", "Build example programs", "yes"))
 vars.Add(BoolVariable("enable_variants", "Build in a separate dir under build/, depending on compile flags", "no"))
 
 ################################################################################
@@ -81,12 +82,6 @@ if env["PLATFORM"] == "win32" :
 		env['ENV']['TMP'] = os.environ['TMP'] 
 env.Tool("SLOCCount", toolpath = ["#/BuildTools/SCons/Tools"])
 
-# Override SConscript to handle tests
-oldSConscript = SConscript
-def SConscript(*arguments, **keywords) :
-  if not keywords.get("test_only", False) or env["TEST"] :
-    return apply(oldSConscript, arguments, keywords)
-  
 # Max out the number of jobs
 if env["max_jobs"] :
 	try :
@@ -289,8 +284,12 @@ Export("conf_env")
 
 variant = ""
 if env["enable_variants"] :
-	fingerprint = "".join([flag for flag in env["CXXFLAGS"] + env["CCFLAGS"] if not flag.startswith("-W")])
+	fingerprint = ",".join([flag for flag in env["CXXFLAGS"] + env["CCFLAGS"] if not flag.startswith("-W") and not flag.startswith("-fvisibility")])
 	variant = "build/" + fingerprint
-
+	if not os.path.exists(Dir("#/build").abspath) :
+		os.mkdir(Dir("#/build").abspath)
+	if os.path.exists(Dir("#/build/current").abspath) :
+		os.unlink(Dir("#/build/current").abspath)
+	os.symlink(os.path.basename(variant), Dir("#/build/current").abspath)
 
 Return("variant")
diff --git a/BuildTools/SCons/SConstruct b/BuildTools/SCons/SConstruct
index 90ea403..cc052ca 100644
--- a/BuildTools/SCons/SConstruct
+++ b/BuildTools/SCons/SConstruct
@@ -5,6 +5,13 @@ Import("env", "conf_env")
 
 root = Dir("../..").abspath
 
+# Override SConscript to handle tests
+oldSConscript = SConscript
+def SConscript(*arguments, **keywords) :
+	if not keywords.get("test_only", False) or env["TEST"] :
+		return apply(oldSConscript, arguments, keywords)
+env.SConscript = SConscript
+  
 ################################################################################
 # Extend the default build environment (not affecting the configure env)
 #
@@ -375,7 +382,7 @@ if use_openssl and openssl_conf.CheckCHeader("openssl/ssl.h") :
 		if env["PLATFORM"] == "darwin" :
 			if platform.mac_ver()[0].startswith("10.5") :
 				env["OPENSSL_FLAGS"]["FRAMEWORKS"] = ["Security"]
-elif target in ("iphone-device", "iphone-simulator", "xcode") :
+elif env["target"] in ("iphone-device", "iphone-simulator", "xcode") :
 	env["OPENSSL_BUNDLED"] = True
 	env["HAVE_OPENSSL"] = True
 else :
diff --git a/SConstruct b/SConstruct
index 2203743..15f6dd0 100644
--- a/SConstruct
+++ b/SConstruct
@@ -1,6 +1,5 @@
 variant_dir = SConscript("BuildTools/SCons/SConscript.boot")
-print "Variant dir: " + str(variant_dir)
 if variant_dir :
-	variant_dir = SConscript("BuildTools/SCons/SConstruct", variant_dir = variant_dir, src_dir = ".")
+	SConscript("BuildTools/SCons/SConstruct", variant_dir = variant_dir, src_dir = ".")
 else :
-	variant_dir = SConscript("BuildTools/SCons/SConstruct")
+	SConscript("BuildTools/SCons/SConstruct")
diff --git a/Swiften/JID/JID.h b/Swiften/JID/JID.h
index 876daa0..756db98 100644
--- a/Swiften/JID/JID.h
+++ b/Swiften/JID/JID.h
@@ -7,7 +7,8 @@
 #pragma once
 
 #include <string>
-#include <iosfwd>
+//#include <iosfwd>
+#include <iostream>
 
 namespace Swift {
 	/**
diff --git a/Swiften/SConscript b/Swiften/SConscript
index d98c9b7..6d38717 100644
--- a/Swiften/SConscript
+++ b/Swiften/SConscript
@@ -201,15 +201,16 @@ if env["SCONS_STAGE"] == "build" :
 			"LinkLocal",
 			"StreamManagement",
 			"Component",
-			"Config",
 			"AdHoc"
 		])
-	SConscript(test_only = True, dirs = [
+	if env["build_examples"] :
+		SConscript(dirs = [
+				"Config",
+				"Examples"
+			])
+	env.SConscript(test_only = True, dirs = [
 			"QA",
 		])
-	SConscript(dirs = [
-			"Examples"
-		])
 
 	myenv = swiften_env.Clone()
 	if myenv["PLATFORM"] != "darwin" and myenv["PLATFORM"] != "win32" and myenv.get("HAVE_GCONF", 0) :
-- 
cgit v0.10.2-6-g49f6