From 65264ae8017d5a3cf1432078cd4eaa4257645662 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Remko=20Tron=C3=A7on?= <git@el-tramo.be>
Date: Thu, 22 Apr 2010 22:31:22 +0200
Subject: Don't build Slimber if no zeroconf is available.


diff --git a/BuildTools/SCons/SConstruct b/BuildTools/SCons/SConstruct
index 0cfa211..1735073 100644
--- a/BuildTools/SCons/SConstruct
+++ b/BuildTools/SCons/SConstruct
@@ -374,10 +374,6 @@ if env.Dir("#/.git").exists() :
 
 ################################################################################
 # Project files
-# FIXME: We need to explicitly list the order of libraries here, because of
-# the exported FLAGS. We should put FLAGS in separate SConscript files, and
-# read these in before anything else, such that we don't need to manually
-# list modules in order.
 ################################################################################
 
 # Modules
@@ -398,6 +394,7 @@ for dir in os.listdir(Dir("#/3rdParty").abspath) :
 		modules.append("3rdParty/" + dir)
 
 # Flags
+env["PROJECTS"] = [m for m in modules if m not in ["Documentation", "QA", "SwifTools"] and not m.startswith("3rdParty")]
 for stage in ["flags", "build", "test"] :
 	env["SCONS_STAGE"] = stage
 	SConscript(dirs = map(lambda x : "#/" + x, modules))
@@ -417,6 +414,8 @@ if env.get("HAVE_EXPAT", 0):
 	parsers.append("Expat")
 	if env.get("EXPAT_BUNDLED", False) :
 		parsers.append("(Bundled)")
+print "  Projects: " + ' '.join(env["PROJECTS"])
+print ""
 print "  XML Parsers: " + ' '.join(parsers)
 
 print "  TLS Support: " + ("OpenSSL" if env.get("HAVE_OPENSSL",0) else "Disabled")
diff --git a/Slimber/SConscript b/Slimber/SConscript
index b3ceba6..2d1d33b 100644
--- a/Slimber/SConscript
+++ b/Slimber/SConscript
@@ -1,40 +1,53 @@
 Import("env")
 
+env["BUILD_SLIMBER"] = True
+if env["PLATFORM"] == "win32" :
+	if not env.get("HAVE_BONJOUR") and "Slimber" in env["PROJECTS"] :
+		env["PROJECTS"].remove("Slimber")
+elif env["PLATFORM"] != "darwin" :
+	if not env.get("HAVE_AVAHI", False) and "Slimber" in env["PROJECTS"] :
+		env["PROJECTS"].remove("Slimber")
+
+if not "Slimber" in env["PROJECTS"] and env["SCONS_STAGE"] == "flags" :
+		print "Bonjour missing. Not building Slimber."
+
+if "Slimber" in env["PROJECTS"] :
+
 ################################################################################
 # Flags
 ################################################################################
 
-if env["SCONS_STAGE"] == "flags" :
-	env["SLIMBER_FLAGS"] = {
-			"LIBPATH": [Dir(".")],
-			"LIBS": ["Slimber"]
-		}
+	if env["SCONS_STAGE"] == "flags" :
+		env["SLIMBER_FLAGS"] = {
+				"LIBPATH": [Dir(".")],
+				"LIBS": ["Slimber"]
+			}
 
 ################################################################################
 # Build
 ################################################################################
 
-if env["SCONS_STAGE"] == "build" :
-	myenv = env.Clone()
-	myenv.MergeFlags(env["BOOST_FLAGS"])
-	myenv.MergeFlags(env["SWIFTEN_FLAGS"])
-	myenv.StaticLibrary("Slimber", [
-			"LinkLocalPresenceManager.cpp",
-			"FileVCardCollection.cpp",
-			"VCardCollection.cpp",
-			"Server.cpp",
-			"MainController.cpp",
-			"MenuletController.cpp",
-			"Menulet.cpp"
-		])
-
-	env.Append(UNITTEST_SOURCES = [
-			File("UnitTest/LinkLocalPresenceManagerTest.cpp"),
-			File("UnitTest/MenuletControllerTest.cpp")
-		])
-
-	SConscript("CLI/SConscript")
-	if env["PLATFORM"] == "darwin" :
-		SConscript("Cocoa/SConscript")
-	else :
-		SConscript("Qt/SConscript")
+	if env["SCONS_STAGE"] == "build" :
+		myenv = env.Clone()
+		myenv.MergeFlags(env["BOOST_FLAGS"])
+		myenv.MergeFlags(env["SWIFTEN_FLAGS"])
+		myenv.StaticLibrary("Slimber", [
+				"LinkLocalPresenceManager.cpp",
+				"FileVCardCollection.cpp",
+				"VCardCollection.cpp",
+				"Server.cpp",
+				"MainController.cpp",
+				"MenuletController.cpp",
+				"Menulet.cpp"
+			])
+
+		env.Append(UNITTEST_SOURCES = [
+				File("UnitTest/LinkLocalPresenceManagerTest.cpp"),
+				File("UnitTest/MenuletControllerTest.cpp")
+			])
+
+		SConscript("CLI/SConscript")
+		if env["PLATFORM"] == "darwin" :
+			SConscript("Cocoa/SConscript")
+		else :
+			SConscript("Qt/SConscript")
-- 
cgit v0.10.2-6-g49f6