forked from Unvanquished/Unvanquished
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-macosx-app-single.sh
executable file
·61 lines (51 loc) · 1.87 KB
/
build-macosx-app-single.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash
# Exit on error
# Error on undefined variable
set -e
set -u
# Dynamic libraries for inclusion in app bundle
DEPS_VERSION=2
SDL2_VERSION=2.0.3
GLEW_VERSION=1.10.0
OPENAL_VERSION=1.15.1
# Usage
if [ "${#}" -ne "2" ]; then
echo "usage: ${0} <arch> <build>"
echo "Script to build a x86 .app for Mac OS X"
exit 1
fi
# Determine arch
if [ "${1}" -eq "32" ]; then
PKG_ARCH="x86"
else
PKG_ARCH="x86_64"
fi
# Get paths
SOURCE_PATH="`dirname "${BASH_SOURCE[0]}"`"
DEPS_PATH="${SOURCE_PATH}/external_deps/macosx${1}-${DEPS_VERSION}"
BUILD_PATH="${2}"
DEST_PATH="${PWD}/Unvanquished.app"
# Copy base files
install -d "${DEST_PATH}/Contents"
install -m 644 "${SOURCE_PATH}/macosx/Info.plist" "${DEST_PATH}/Contents"
install -d "${DEST_PATH}/Contents/Resources"
install -m 644 "${SOURCE_PATH}/macosx/Unvanquished.icns" "${DEST_PATH}/Contents/Resources"
install -d "${DEST_PATH}/Contents/MacOS"
install -m 755 "${SOURCE_PATH}/macosx/unvanquished.sh" "${DEST_PATH}/Contents/MacOS"
# Make universal binaries
make_universal() {
install -m "${2}" "${BUILD_PATH}/${1}" "${DEST_PATH}/Contents/MacOS/${1}"
}
make_universal daemon 755
make_universal daemonded 755
make_universal daemon-tty 755
make_universal sel_ldr 755
make_universal game-nacl-native-exe 755
make_universal cgame-qvm-native.so 644
make_universal ui-qvm-native.so 644
install -m 644 "${BUILD_PATH}/irt_core-${PKG_ARCH}.nexe" "${DEST_PATH}/Contents/MacOS/irt_core-${PKG_ARCH}.nexe"
# Create a universal version of GLEW and OpenAL and add it to the bundle
install -m 644 "${DEPS_PATH}/lib/libGLEW.${GLEW_VERSION}.dylib" "${DEST_PATH}/Contents/MacOS/libGLEW.${GLEW_VERSION}.dylib"
install -m 644 "${DEPS_PATH}/lib/libopenal.${OPENAL_VERSION}.dylib" "${DEST_PATH}/Contents/MacOS/libopenal.${OPENAL_VERSION}.dylib"
# SDL is already compiled as a universal binary, copy as is
cp -a "${DEPS_PATH}/SDL2.framework" "${DEST_PATH}/Contents/MacOS/"