-
Notifications
You must be signed in to change notification settings - Fork 1
/
build-cmd.sh
158 lines (143 loc) · 5.28 KB
/
build-cmd.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
#!/usr/bin/env bash
cd "$(dirname "$0")"
# turn on verbose debugging output for logs.
exec 4>&1; export BASH_XTRACEFD=4; set -x
# make errors fatal
set -e
# bleat on references to undefined shell variables
set -u
FMOD_ROOT_NAME="fmodstudioapi"
FMOD_VERSION="20222"
FMOD_VERSION_PRETTY="2.02.22"
top="$(pwd)"
stage="$top"/stage
stage_release="$stage/lib/release"
stage_debug="$stage/lib/debug"
# load autobuild provided shell functions and variables
case "$AUTOBUILD_PLATFORM" in
windows*)
autobuild="$(cygpath -u "$AUTOBUILD")"
;;
*)
autobuild="$AUTOBUILD"
;;
esac
source_environment_tempfile="$stage/source_environment.sh"
"$autobuild" source_environment > "$source_environment_tempfile"
. "$source_environment_tempfile"
echo "${FMOD_VERSION_PRETTY}" > "${stage}/VERSION.txt"
# Create the staging license folder
mkdir -p "$stage/LICENSES"
# Create the staging include folders
mkdir -p "$stage/include/fmodstudio"
#Create the staging debug and release folders
mkdir -p "$stage_debug"
mkdir -p "$stage_release"
# Form the official fmod archive URL to fetch
# Note: fmod is provided in 3 flavors (one per platform) of precompiled binaries. We do not have access to source code.
case "$AUTOBUILD_PLATFORM" in
windows*)
FMOD_PLATFORM="win-installer"
FMOD_FILEEXTENSION=".exe"
;;
darwin*)
FMOD_PLATFORM="mac-installer"
FMOD_FILEEXTENSION=".dmg"
;;
linux*)
FMOD_PLATFORM="linux"
FMOD_FILEEXTENSION=".tar.gz"
;;
esac
FMOD_SOURCE_DIR="$FMOD_ROOT_NAME$FMOD_VERSION$FMOD_PLATFORM"
FMOD_ARCHIVE="$FMOD_SOURCE_DIR$FMOD_FILEEXTENSION"
case "$FMOD_ARCHIVE" in
*.exe)
cp -a fmodstudio/$FMOD_ARCHIVE .
# We can't run the NSIS installer as admin in TC
# so we do this part manually and put the whole lot
# into the repo instead.
#
bash_install_dir="$(pwd)/$FMOD_ROOT_NAME$FMOD_VERSION$FMOD_PLATFORM"
mkdir -p $bash_install_dir
win_install_dir=`cygpath -w "$bash_install_dir"`
#
# This will invoke the UAC dialog to confirm permission before
# proceeding. You can run the build on a 'modified' system with
# permissions granted to the build account or you might be able
# to get to the dialog using remote desktop. Either way, manual
# preparation for this is required.
#
chmod +x "$FMOD_ARCHIVE"
cmd.exe /c "$FMOD_ARCHIVE /S /D=$win_install_dir"
if [ ! -d "$win_install_dir" ]; then
echo "Please run $FMODEX_ARCHIVE as administrator and install to $win_install_dir"
fail
fi
;;
*.tar.gz)
cp -a fmodstudio/$FMOD_ARCHIVE .
tar xvf "$FMOD_ARCHIVE"
;;
*.dmg)
cp -a fmodstudio/$FMOD_ARCHIVE .
hdid "$FMOD_ARCHIVE"
mkdir -p "$(pwd)/$FMOD_SOURCE_DIR"
cp -r /Volumes/FMOD\ Programmers\ API\ Mac/FMOD\ Programmers\ API/* "$FMOD_SOURCE_DIR"
umount /Volumes/FMOD\ Programmers\ API\ Mac/
;;
esac
COPYFLAGS=""
pushd "$FMOD_SOURCE_DIR"
case "$AUTOBUILD_PLATFORM" in
"windows")
COPYFLAGS="-dR --preserve=mode,timestamps"
cp $COPYFLAGS "api/core/lib/x86/fmodL_vc.lib" "$stage_debug"
cp $COPYFLAGS "api/core/lib/x86/fmod_vc.lib" "$stage_release"
cp $COPYFLAGS "api/core/lib/x86/fmodL.dll" "$stage_debug"
cp $COPYFLAGS "api/core/lib/x86/fmod.dll" "$stage_release"
;;
"windows64")
COPYFLAGS="-dR --preserve=mode,timestamps"
cp $COPYFLAGS "api/core/lib/x64/fmodL_vc.lib" "$stage_debug"
cp $COPYFLAGS "api/core/lib/x64/fmod_vc.lib" "$stage_release"
cp $COPYFLAGS "api/core/lib/x64/fmodL.dll" "$stage_debug"
cp $COPYFLAGS "api/core/lib/x64/fmod.dll" "$stage_release"
;;
darwin*)
cp "api/core/lib/libfmodL.dylib" "$stage_debug"
cp "api/core/lib/libfmod.dylib" "$stage_release"
pushd "$stage_debug"
install_name_tool -id "@rpath/libfmodL.dylib" "libfmodL.dylib"
popd
pushd "$stage_release"
install_name_tool -id "@rpath/libfmod.dylib" "libfmod.dylib"
popd
if [ -n "${AUTOBUILD_KEYCHAIN_PATH:=""}" -a -n "${AUTOBUILD_KEYCHAIN_ID:=""}" ]; then
for dylib in $stage/lib/*/libfmod*.dylib;
do
if [ -f "$dylib" ]; then
codesign --keychain $AUTOBUILD_KEYCHAIN_PATH --force --timestamp --sign "$AUTOBUILD_KEYCHAIN_ID" "$dylib"
fi
done
else
echo "Code signing not configured; skipping codesign."
fi
;;
"linux")
# Copy the relevant stuff around
cp -a api/core/lib/x86/libfmodL.so* "$stage_debug"
cp -a api/core/lib/x86/libfmod.so* "$stage_release"
;;
"linux64")
# Copy the relevant stuff around
cp -a api/core/lib/x86_64/libfmodL.so* "$stage_debug"
cp -a api/core/lib/x86_64/libfmod.so* "$stage_release"
;;
esac
# Copy the headers
cp $COPYFLAGS api/core/inc/*.h "$stage/include/fmodstudio"
cp $COPYFLAGS api/core/inc/*.hpp "$stage/include/fmodstudio"
# Copy License (extracted from the readme)
cp "doc/LICENSE.TXT" "$stage/LICENSES/fmodstudio.txt"
popd