| 1 | #!/bin/sh |
|---|
| 2 | APPBUNDLE=Tremulous.app |
|---|
| 3 | BINARY=Tremulous.ub |
|---|
| 4 | PKGINFO=APPLTREM |
|---|
| 5 | ICNS=misc/Tremulous.icns |
|---|
| 6 | DESTDIR=build/release-darwin-ub |
|---|
| 7 | BASEDIR=base |
|---|
| 8 | Q3_VERSION=`grep "\#define Q3_VERSION" src/qcommon/q_shared.h | \ |
|---|
| 9 | sed -e 's/.*".* \([^ ]*\)"/\1/'`; |
|---|
| 10 | |
|---|
| 11 | BIN_OBJ=" |
|---|
| 12 | build/release-darwin-ppc/tremulous.ppc |
|---|
| 13 | build/release-darwin-x86/tremulous.x86 |
|---|
| 14 | " |
|---|
| 15 | BASE_OBJ=" |
|---|
| 16 | build/release-darwin-ppc/$BASEDIR/cgameppc.dylib |
|---|
| 17 | build/release-darwin-x86/$BASEDIR/cgamex86.dylib |
|---|
| 18 | build/release-darwin-ppc/$BASEDIR/uippc.dylib |
|---|
| 19 | build/release-darwin-x86/$BASEDIR/uix86.dylib |
|---|
| 20 | build/release-darwin-ppc/$BASEDIR/gameppc.dylib |
|---|
| 21 | build/release-darwin-x86/$BASEDIR/gamex86.dylib |
|---|
| 22 | " |
|---|
| 23 | if [ ! -f Makefile ]; then |
|---|
| 24 | echo "This script must be run from the Tremulous build directory"; |
|---|
| 25 | fi |
|---|
| 26 | |
|---|
| 27 | if [ ! -d /Developer/SDKs/MacOSX10.2.8.sdk ]; then |
|---|
| 28 | echo " |
|---|
| 29 | /Developer/SDKs/MacOSX10.2.8.sdk/ is missing, this doesn't install by default |
|---|
| 30 | with newer XCode releases, but the installers is included" |
|---|
| 31 | exit 1; |
|---|
| 32 | fi |
|---|
| 33 | |
|---|
| 34 | if [ ! -d /Developer/SDKs/MacOSX10.4u.sdk ]; then |
|---|
| 35 | echo " |
|---|
| 36 | /Developer/SDKs/MacOSX10.4u.sdk/ is missing. You must install XCode 2.2 or |
|---|
| 37 | newer in order to build Universal Binaries" |
|---|
| 38 | exit 1; |
|---|
| 39 | fi |
|---|
| 40 | |
|---|
| 41 | (BUILD_MACOSX_UB=ppc make && BUILD_MACOSX_UB=x86 make) || exit 1; |
|---|
| 42 | |
|---|
| 43 | echo "Creating .app bundle $DESTDIR/$APPBUNDLE" |
|---|
| 44 | if [ ! -d $DESTDIR/$APPBUNDLE/Contents/MacOS/$BASEDIR ]; then |
|---|
| 45 | mkdir -p $DESTDIR/$APPBUNDLE/Contents/MacOS/$BASEDIR || exit 1; |
|---|
| 46 | fi |
|---|
| 47 | if [ ! -d $DESTDIR/$APPBUNDLE/Contents/MacOS/$MPACKDIR ]; then |
|---|
| 48 | mkdir -p $DESTDIR/$APPBUNDLE/Contents/MacOS/$MPACKDIR || exit 1; |
|---|
| 49 | fi |
|---|
| 50 | if [ ! -d $DESTDIR/$APPBUNDLE/Contents/Resources ]; then |
|---|
| 51 | mkdir -p $DESTDIR/$APPBUNDLE/Contents/Resources |
|---|
| 52 | fi |
|---|
| 53 | cp $ICNS $DESTDIR/$APPBUNDLE/Contents/Resources/Tremulous.icns || exit 1; |
|---|
| 54 | echo $PKGINFO > $DESTDIR/$APPBUNDLE/Contents/PkgInfo |
|---|
| 55 | echo " |
|---|
| 56 | <?xml version=\"1.0\" encoding="UTF-8"?> |
|---|
| 57 | <!DOCTYPE plist |
|---|
| 58 | PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" |
|---|
| 59 | \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"> |
|---|
| 60 | <plist version=\"1.0\"> |
|---|
| 61 | <dict> |
|---|
| 62 | <key>CFBundleDevelopmentRegion</key> |
|---|
| 63 | <string>English</string> |
|---|
| 64 | <key>CFBundleExecutable</key> |
|---|
| 65 | <string>$BINARY</string> |
|---|
| 66 | <key>CFBundleGetInfoString</key> |
|---|
| 67 | <string>$Q3_VERSION</string> |
|---|
| 68 | <key>CFBundleIconFile</key> |
|---|
| 69 | <string>Tremulous.icns</string> |
|---|
| 70 | <key>CFBundleIdentifier</key> |
|---|
| 71 | <string>net.tremulous</string> |
|---|
| 72 | <key>CFBundleInfoDictionaryVersion</key> |
|---|
| 73 | <string>6.0</string> |
|---|
| 74 | <key>CFBundleName</key> |
|---|
| 75 | <string>Tremulous</string> |
|---|
| 76 | <key>CFBundlePackageType</key> |
|---|
| 77 | <string>APPL</string> |
|---|
| 78 | <key>CFBundleShortVersionString</key> |
|---|
| 79 | <string>$Q3_VERSION</string> |
|---|
| 80 | <key>CFBundleSignature</key> |
|---|
| 81 | <string>$PKGINFO</string> |
|---|
| 82 | <key>CFBundleVersion</key> |
|---|
| 83 | <string>$Q3_VERSION</string> |
|---|
| 84 | <key>NSExtensions</key> |
|---|
| 85 | <dict/> |
|---|
| 86 | <key>NSPrincipalClass</key> |
|---|
| 87 | <string>NSApplication</string> |
|---|
| 88 | </dict> |
|---|
| 89 | </plist> |
|---|
| 90 | " > $DESTDIR/$APPBUNDLE/Contents/Info.plist |
|---|
| 91 | |
|---|
| 92 | lipo -create -o $DESTDIR/$APPBUNDLE/Contents/MacOS/$BINARY $BIN_OBJ |
|---|
| 93 | cp $BASE_OBJ $DESTDIR/$APPBUNDLE/Contents/MacOS/$BASEDIR/ |
|---|
| 94 | cp src/libs/macosx/*.dylib $DESTDIR/$APPBUNDLE/Contents/MacOS/ |
|---|