summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/mac
diff options
context:
space:
mode:
authorDarshan Shaligram <dshaligram@users.sourceforge.net>2011-01-04 18:05:25 +0530
committerDarshan Shaligram <dshaligram@users.sourceforge.net>2011-01-05 16:12:24 +0530
commit82297df3abd17eee9a1cb68240e8c180346e2744 (patch)
tree79fabf0d216c22754442b177527df41d936eb864 /crawl-ref/source/mac
parent679089538a8d88ecca3792dad2bfb69168fe08e1 (diff)
downloadcrawl-ref-82297df3abd17eee9a1cb68240e8c180346e2744.tar.gz
crawl-ref-82297df3abd17eee9a1cb68240e8c180346e2744.zip
Mac makefiles to create universal binary app bundles.
Since the current makefile allows all dependencies to be statically linked, creating an app bundle is as simple as setting up the directory tree. The baroque Xcode project shenanigans that dynamically link SDL and other libs and then use relative framework references in the .app bundle should no longer be necessary. Running ./mac/mac-release-build will create universal (i386, ppc) app bundles for tiles and console and drop the zips in mac-app-zips. I've deliberately skipped x86-64 for now (compile-time and SDL build issues with the 10.4u SDK).
Diffstat (limited to 'crawl-ref/source/mac')
-rw-r--r--crawl-ref/source/mac/Crawl-Info.plist34
-rw-r--r--crawl-ref/source/mac/Makefile.app-bundle87
-rwxr-xr-xcrawl-ref/source/mac/mac-app-universal-build6
-rwxr-xr-xcrawl-ref/source/mac/mac-release-build13
-rwxr-xr-xcrawl-ref/source/mac/mac-release-console-build3
-rwxr-xr-xcrawl-ref/source/mac/mac-release-tiles-build4
6 files changed, 128 insertions, 19 deletions
diff --git a/crawl-ref/source/mac/Crawl-Info.plist b/crawl-ref/source/mac/Crawl-Info.plist
index 4ffd139625..ca4c6aa677 100644
--- a/crawl-ref/source/mac/Crawl-Info.plist
+++ b/crawl-ref/source/mac/Crawl-Info.plist
@@ -1,11 +1,10 @@
-<?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">
+<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
- <key>CFBundleExecutable</key>
- <string>${EXECUTABLE_NAME}</string>
+ <key>CFBundleDisplayName</key>
+ <string>%NAME%</string>
<key>CFBundleIdentifier</key>
<string>net.sourceforge.crawl-ref</string>
<key>CFBundleInfoDictionaryVersion</key>
@@ -16,20 +15,17 @@
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
- <key>CFBundleVersion</key>
- <string>1.0</string>
- <key>NSMainNibFile</key>
- <string>MainMenu</string>
- <key>NSPrincipalClass</key>
- <string>NSApplication</string>
- <key>LSMinimumSystemVersionByArchitecture</key>
- <dict>
- <key>x86_64</key>
- <string>10.6.0</string>
- <key>i386</key>
- <string>10.4.0</string>
- <key>ppc</key>
- <string>10.4.0</string>
- </dict>
+ <key>CFBundleVersion</key>
+ <string>%VERSION%</string>
+ <key>LSMinimumSystemVersion</key>
+ <string>10.4.2</string>
+ <key>LSMultipleInstancesProhibited</key>
+ <true/>
+ <key>LSRequiresNativeExecution</key>
+ <true/>
+ <key>NSAppleScriptEnabled</key>
+ <false/>
+ <key>NSHumanReadableCopyright</key>
+ <string>Copyright %YEAR%, Crawl DevTeam</string>
</dict>
</plist>
diff --git a/crawl-ref/source/mac/Makefile.app-bundle b/crawl-ref/source/mac/Makefile.app-bundle
new file mode 100644
index 0000000000..bbe33381bd
--- /dev/null
+++ b/crawl-ref/source/mac/Makefile.app-bundle
@@ -0,0 +1,87 @@
+# [ds] We all knew make's handling of embedded spaces is demented, but
+# I had no idea just how demented it is.
+
+CRAWL_BASE=$(CURDIR)/../..
+CRAWL_SRC=$(CRAWL_BASE)/source
+
+ZIP_QUALIFIER :=
+ZIP_ARCH :=
+
+ifdef BUILD_UNIVERSAL
+ZIP_ARCH := -universal
+endif
+
+APP_NAME := Dungeon Crawl Stone Soup
+ifneq (,$(findstring tiles,$(MAKECMDGOALS)))
+BUNDLE_NAME := Dungeon\ Crawl\ Stone\ Soup
+TILE_APP := y
+ZIP_QUALIFIER := -tiles
+EXECUTABLE_PATH := $(CRAWL_SRC)/crawl
+else
+BUNDLE_NAME := Dungeon\ Crawl\ Stone\ Soup\ -\ Terminal
+EXECUTABLE_PATH := crawl
+endif
+
+ZIP_NAME = stone_soup-$(SRC_VERSION_SHORT)$(ZIP_QUALIFIER)-macosx$(ZIP_ARCH).zip
+
+STAGING_DIR := $(CRAWL_SRC)/build/app-bundle-stage
+ZIPPED_APP_DIR := $(CRAWL_SRC)/mac-app-zips
+BUNDLE_DIRNAME := $(STAGING_DIR)/$(BUNDLE_NAME).app
+RESOURCES := $(BUNDLE_DIRNAME)/Contents/Resources
+
+.PHONY: all clean clean-stage stage-dir copy-executable copy-resources \
+ copy-tiledata assemble-app-bundle create-bundle-directory
+
+all: $(STAGING_DIR) $(ZIPPED_APP_DIR) \
+ clean-stage assemble-app-bundle zip-app-bundle
+
+clean:
+ rm -rf $(CRAWL_SRC)/build
+
+tiles: all
+
+$(STAGING_DIR):
+ mkdir -p $@
+
+$(ZIPPED_APP_DIR):
+ mkdir -p $@
+
+clean-stage:
+ rm -rf $(STAGING_DIR)/*
+
+assemble-app-bundle: create-bundle-directory copy-executable copy-resources \
+ copy-info-plist
+
+zip-app-bundle:
+ rm -f $(ZIPPED_APP_DIR)/$(ZIP_NAME)
+ cd $(STAGING_DIR) && \
+ zip -r $(ZIPPED_APP_DIR)/$(ZIP_NAME) $(BUNDLE_NAME).app
+
+create-bundle-directory: $(BUNDLE_DIRNAME)
+
+$(BUNDLE_DIRNAME):
+ mkdir -p "$@"/Contents/{MacOS,Resources}
+
+# The console Crawl bundle has a shell script launcher that uses the
+# real executable from Contents/Resources, so an extra copy for the wrapper+
+# real thing.
+copy-executable:
+ cp $(EXECUTABLE_PATH) $(BUNDLE_DIRNAME)/Contents/MacOS/$(BUNDLE_NAME)
+ifndef TILE_APP
+ cp $(CRAWL_SRC)/crawl $(RESOURCES)
+endif
+
+copy-resources:
+ cp $(CRAWL_SRC)/mac/Crawl.icns $(RESOURCES)
+ cp -r $(CRAWL_BASE)/settings $(RESOURCES)
+ cp -r $(CRAWL_SRC)/dat $(RESOURCES)
+ cp -r $(CRAWL_BASE)/docs $(RESOURCES)
+ifdef TILE_APP
+ cp $(CRAWL_SRC)/rltiles/*.png $(RESOURCES)
+endif
+
+copy-info-plist:
+ perl -lpe "s/%VERSION%/$(SRC_VERSION_SHORT)/g;" \
+ -e "s/%NAME%/$(APP_NAME)/g;" \
+ -e "s/%YEAR%/(localtime)[5] + 1900/ge" \
+ Crawl-Info.plist >$(BUNDLE_DIRNAME)/Contents/Info.plist \ No newline at end of file
diff --git a/crawl-ref/source/mac/mac-app-universal-build b/crawl-ref/source/mac/mac-app-universal-build
new file mode 100755
index 0000000000..6091683e66
--- /dev/null
+++ b/crawl-ref/source/mac/mac-app-universal-build
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+# [ds] NO_INLINE_DEPGEN because inline depgen behaves badly when specifying
+# multiple -arch flags to the Mac gcc.
+exec make BUILD_UNIVERSAL=y NO_INLINE_DEPGEN=y APPLE_GCC=y \
+ EXTRA_FLAGS='-DWIZARD' "$@" \ No newline at end of file
diff --git a/crawl-ref/source/mac/mac-release-build b/crawl-ref/source/mac/mac-release-build
new file mode 100755
index 0000000000..495c347d3a
--- /dev/null
+++ b/crawl-ref/source/mac/mac-release-build
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+set -e
+
+echo "*******************************************"
+echo "Building Mac console release build"
+echo "*******************************************"
+./mac/mac-release-console-build "$@"
+
+echo "*******************************************"
+echo "Building Mac tiles release build"
+echo "*******************************************"
+./mac/mac-release-tiles-build "$@"
diff --git a/crawl-ref/source/mac/mac-release-console-build b/crawl-ref/source/mac/mac-release-console-build
new file mode 100755
index 0000000000..82f1a734e5
--- /dev/null
+++ b/crawl-ref/source/mac/mac-release-console-build
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+exec ./mac/mac-app-universal-build "$@" mac-app-console \ No newline at end of file
diff --git a/crawl-ref/source/mac/mac-release-tiles-build b/crawl-ref/source/mac/mac-release-tiles-build
new file mode 100755
index 0000000000..a228fb5897
--- /dev/null
+++ b/crawl-ref/source/mac/mac-release-tiles-build
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+exec ./mac/mac-app-universal-build TILES=y NO_PKGCONFIG=y CONTRIB_SDL=y \
+ "$@" mac-app-tiles