summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--BuildTools/SCons/Tools/AppBundle.py56
-rw-r--r--SConstruct1
-rw-r--r--Slimber/Cocoa/Makefile.inc47
-rw-r--r--Slimber/Cocoa/SConscript13
-rw-r--r--Swift/QtUI/SConscript13
-rw-r--r--Swiften/SConscript8
6 files changed, 78 insertions, 60 deletions
diff --git a/BuildTools/SCons/Tools/AppBundle.py b/BuildTools/SCons/Tools/AppBundle.py
new file mode 100644
index 0000000..17a7e4f
--- /dev/null
+++ b/BuildTools/SCons/Tools/AppBundle.py
@@ -0,0 +1,56 @@
+import SCons.Util
+
+def generate(env) :
+ # WriteVal helper builder
+ def writeVal(env, target, source) :
+ f = open(str(target[0]), 'wb')
+ f.write(source[0].get_contents())
+ f.close()
+
+ env["BUILDERS"]["WriteVal"] = SCons.Builder.Builder(
+ action = SCons.Action.Action(writeVal, cmdstr = "$GENCOMSTR"),
+ single_source = True)
+
+ # createAppBundle
+ def createAppBundle(env, bundle, resources = [], info = {}) :
+ bundleContentsDir = bundle + ".app" + "/Contents"
+ resourcesDir = bundleContentsDir + "/Resources"
+ env.Install(bundleContentsDir + "/MacOS", bundle)
+ env.WriteVal(bundleContentsDir + "/PkgInfo", env.Value("APPL\77\77\77\77"))
+
+ infoDict = {
+ "CFBundleDevelopmentRegion" : "English",
+ "CFBundleExecutable" : bundle,
+ "CFBundleIdentifier" : "im.swift." + bundle,
+ "CFBundleInfoDictionaryVersion" : "6.0",
+ "CFBundleName" : bundle,
+ "CFBundlePackageType" : "APPL",
+ "CFBundleSignature": "\77\77\77\77",
+ "CFBundleVersion" : "1.0",
+ "CFBundleIconFile" : bundle,
+ "NSPrincipalClass" : "NSApplication",
+ "NSHumanReadableCopyright" : unichr(0xA9) + " 2009 Swift Development Team.\nAll Rights Reserved."
+ }
+ infoDict.update(info)
+
+ plist = """<?xml version="1.0" encoding="UTF-8"?>
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+ <plist version="1.0">
+ <dict>
+ """
+ for key, value in infoDict.items() :
+ plist += "<key>" + key + "</key>\n"
+ plist += "<string>" + value.encode("utf-8") + "</string>\n"
+ plist += """</dict>
+ </plist>
+ """
+ env.WriteVal(bundleContentsDir + "/Info.plist", env.Value(plist))
+
+ for resource in resources :
+ env.Install(resourcesDir, resource)
+
+ env.AddMethod(createAppBundle, "AppBundle")
+
+
+def exists(env) :
+ return env["PLATFORM"] == "darwin"
diff --git a/SConstruct b/SConstruct
index ab9cf5e..014d8ef 100644
--- a/SConstruct
+++ b/SConstruct
@@ -33,6 +33,7 @@ env.Alias("dist", ["."])
# Default custom tools
if env["PLATFORM"] == "darwin" :
env.Tool("Nib", toolpath = ["#/BuildTools/SCons/Tools"])
+ env.Tool("AppBundle", toolpath = ["#/BuildTools/SCons/Tools"])
# Default compiler flags
if env["optimize"] :
diff --git a/Slimber/Cocoa/Makefile.inc b/Slimber/Cocoa/Makefile.inc
deleted file mode 100644
index cdb19b7..0000000
--- a/Slimber/Cocoa/Makefile.inc
+++ /dev/null
@@ -1,47 +0,0 @@
-SLIMBER_COCOA_TARGET = Slimber/Cocoa/Slimber.app
-SLIMBER_COCOA_BINARY = \
- Slimber/Cocoa/Slimber
-SLIMBER_COCOA_SOURCES = \
- Slimber/Cocoa/main.mm \
- Slimber/Cocoa/CocoaController.mm \
- Slimber/Cocoa/CocoaMenulet.mm \
- Slimber/Cocoa/CocoaAction.mm
-SLIMBER_COCOA_XIBS = \
- Slimber/Cocoa/MainMenu.xib
-SLIMBER_COCOA_RESOURCES = \
- Slimber/Resources/Slimber.icns \
- Slimber/Resources/Credits.html \
- Slimber/Resources/Online.png \
- Slimber/Resources/Offline.png \
- Slimber/Resources/UsersOnline.png \
- Slimber/Resources/UsersOffline.png
-
-TARGETS += $(SLIMBER_COCOA_TARGET)
-SLIMBER_TARGETS += $(SLIMBER_COCOA_TARGET)
-SLIMBER_COCOA_NIBS = \
- $(SLIMBER_COCOA_XIBS:.xib=.nib)
-SLIMBER_COCOA_OBJECTS = \
- $(patsubst %.m,%.o,$(patsubst %.mm,%.o,$(patsubst %.cpp,%.o, $(SLIMBER_COCOA_SOURCES))))
-CLEANFILES += \
- Slimber/Cocoa/PkgInfo \
- $(SLIMBER_COCOA_NIBS) \
- $(SLIMBER_COCOA_TARGET) \
- $(SLIMBER_COCOA_BINARY)
-DEPS += \
- $(patsubst %.m, %.dep, $(patsubst %.mm, %.dep, $(SLIMBER_COCOA_SOURCES)))
-
-.PHONY: slimber-cocoa
-slimber-cocoa: $(SLIMBER_COCOA_TARGET)
-
-$(SLIMBER_COCOA_TARGET): $(SLIMBER_COCOA_BINARY) $(SLIMBER_COCOA_NIBS) Slimber/Cocoa/Info.plist Slimber/Cocoa/PkgInfo
- -rm -rf $(SLIMBER_COCOA_TARGET)
- mkdir -p $(SLIMBER_COCOA_TARGET)/Contents/Resources
- mkdir -p $(SLIMBER_COCOA_TARGET)/Contents/MacOS
- cp -r Slimber/Cocoa/Info.plist $(SLIMBER_COCOA_TARGET)/Contents
- cp -r Slimber/Cocoa/PkgInfo $(SLIMBER_COCOA_TARGET)/Contents
- cp $(SLIMBER_COCOA_BINARY) $(SLIMBER_COCOA_TARGET)/Contents/MacOS
- cp $(SLIMBER_COCOA_NIBS) $(SLIMBER_COCOA_TARGET)/Contents/Resources
- cp $(SLIMBER_COCOA_RESOURCES) $(SLIMBER_COCOA_TARGET)/Contents/Resources
-
-$(SLIMBER_COCOA_BINARY): $(SLIMBER_COCOA_OBJECTS) $(SWIFTEN_TARGET) $(SLIMBER_TARGET)
- $(QUIET_LINK)$(CXX) -o $@ $(SLIMBER_COCOA_OBJECTS) $(LDFLAGS) $(SLIMBER_TARGET) $(SWIFTEN_TARGET) $(LIBS) -framework Cocoa
diff --git a/Slimber/Cocoa/SConscript b/Slimber/Cocoa/SConscript
index 3e04273..25d7579 100644
--- a/Slimber/Cocoa/SConscript
+++ b/Slimber/Cocoa/SConscript
@@ -15,3 +15,16 @@ myenv.Program("Slimber", [
])
myenv.Nib("MainMenu")
+
+myenv.AppBundle("Slimber", resources = [
+ "MainMenu.nib",
+ "../Resources/Slimber.icns",
+ "../Resources/Credits.html",
+ "../Resources/Online.png",
+ "../Resources/Offline.png",
+ "../Resources/UsersOnline.png",
+ "../Resources/UsersOffline.png"
+ ], info = {
+ "NSMainNibFile" : "MainMenu",
+ "LSUIElement" : "1",
+ })
diff --git a/Swift/QtUI/SConscript b/Swift/QtUI/SConscript
index 5615819..700eb81 100644
--- a/Swift/QtUI/SConscript
+++ b/Swift/QtUI/SConscript
@@ -15,15 +15,6 @@ def generateDefaultTheme(env, target, source) :
output.write("</qresource>")
output.write("</RCC>")
-def createAppBundle(env, target, source) :
- target = target[0].abspath
- source = source[0].abspath
- os.makedirs(target + "/Contents/MacOS")
- Execute(Copy(target + "/Contents/MacOS", source))
- pkgInfo = open(target + "/Contents/PkgInfo", "w")
- pkgInfo.write("APPL\77\77\77\77")
- pkgInfo.close()
-
def buildWindowsBundle(env, target, source) :
sources = source
if not os.path.exists(target[0].abspath) :
@@ -102,7 +93,9 @@ myenv.Qrc("DefaultTheme.qrc")
myenv.Qrc("Swift.qrc")
if env["PLATFORM"] == "darwin" :
- myenv.Command("Swift.app", "Swift", createAppBundle)
+ myenv.AppBundle("Swift", resources = [
+ "../resources/MacOSX/Swift.icns"
+ ])
if env["PLATFORM"] == "win32" :
if "dist" in COMMAND_LINE_TARGETS or env.GetOption("clean") :
diff --git a/Swiften/SConscript b/Swiften/SConscript
index 1c2c8cc..eb60c7e 100644
--- a/Swiften/SConscript
+++ b/Swiften/SConscript
@@ -158,13 +158,15 @@ sources = [
# "Notifier/GrowlNotifier.cpp",
-if myenv.get("HAVE_AVAHI", 0) :
- sources += ["LinkLocal/DNSSD/Avahi/AvahiQuerier.cpp"]
-if myenv.get("HAVE_BONJOUR", 0) :
+if env["PLATFORM"] == "darwin" :
+ myenv.Append(CPPDEFINES = "HAVE_BONJOUR")
sources += [
"LinkLocal/DNSSD/Bonjour/BonjourQuerier.cpp",
"LinkLocal/DNSSD/Bonjour/BonjourQuery.cpp",
]
+elif myenv.get("HAVE_AVAHI", 0) :
+ sources += ["LinkLocal/DNSSD/Avahi/AvahiQuerier.cpp"]
+
if myenv.get("HAVE_OPENSSL", 0) :
myenv.Append(CPPDEFINES = "HAVE_OPENSSL")