-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathmacbuild.sh
185 lines (159 loc) · 6.64 KB
/
macbuild.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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
#!/bin/bash
START_DIR=$(cd $(dirname "$0"); pwd)
INDRA_DIR=$START_DIR/indra
OUTPUT_DIR=$START_DIR/builds
DEPENDENCY_DIR=$START_DIR/dependencies
configure()
{
echo "Configuring (for real)..."
./develop.py configure -G Xcode -DCMAKE_OSX_ARCHITECTURES="$1" -DOPENAL:BOOL=FALSE -DFMOD:BOOL=TRUE -DCMAKE_BUILD_TYPE=Release -DGCC_DISABLE_FATAL_WARNINGS:BOOL=TRUE \
-DCMAKE_C_FLAGS:STRING="$2" -DCMAKE_CXX_FLAGS:STRING="$2" > /dev/null
}
set_channel()
{
if [ -z "$BUILD_RELEASE" ]; then
sed -e s/Internal/Beta/ -i '' llcommon/llversionviewer.h
echo "Setting beta channel..."
else
sed -e s/Internal/Release/ -i '' llcommon/llversionviewer.h
echo "Setting release channel..."
fi
sed -e "s/LL_VERSION_BUILD = 0/LL_VERSION_BUILD = $REVISION/" -i '' llcommon/llversionviewer.h
}
build()
{
echo "Building version ${VERSION_VIEWER}.${REVISION}..."
xcodebuild -target ALL_BUILD -configuration Release GCC_VERSION=4.0 > /dev/null
}
copy_resources()
{
echo "Copying resources..."
# cp -R $DEPENDENCY_DIR/cursors_mac Phoenix\ Viewer.app/Contents/Resources/
if [ -n "$BUILD_RELEASE" ]; then
SETTINGS_FILE='settings_phoenix.xml'
else
SETTINGS_FILE='settings_phoenixviewerbeta.xml'
fi
echo "--settings $SETTINGS_FILE" > Phoenix\ Viewer.app/Contents/Resources/arguments.txt
}
# Sends output file to stdout
make_disk_image()
{
if [ -n "$BUILD_RELEASE" ]; then
IMAGE="release-template.dmg"
VOLUME_NAME="Phoenix Viewer ${VERSION_VIEWER}.${REVISION}"
OUTPUT_FILE="Phoenix_Viewer_${VERSION_VIEWER}.${REVISION}_${1}.dmg"
else
IMAGE="beta-template.dmg"
VOLUME_NAME="Phoenix Viewer ${VERSION_VIEWER}.${REVISION} Beta"
OUTPUT_FILE="Phoenix_Viewer_${VERSION_VIEWER}.${REVISION}_${1}_Beta.dmg"
fi
# hdiutil convert won't overwrite an existing output file
rm -f "$OUTPUT_DIR/$OUTPUT_FILE"
# We store the templates as compressed images, so decompress it now.
hdiutil convert "$DEPENDENCY_DIR/$IMAGE" -format UDRW -o temp-image.dmg > /dev/null
hdiutil attach -mountpoint "$DEPENDENCY_DIR/build-image" -nobrowse temp-image.dmg > /dev/null
# diskutil requires the full mount path.
diskutil renameVolume "$DEPENDENCY_DIR/build-image" "$VOLUME_NAME" > /dev/null
# Copy the viewer in
cp -R Phoenix\ Viewer*.app "$DEPENDENCY_DIR/build-image/" > /dev/null
# Compress/store the image and dispose of the temporary one.
hdiutil detach "$DEPENDENCY_DIR/build-image" > /dev/null
hdiutil convert temp-image.dmg -format UDBZ -o "$OUTPUT_DIR/$OUTPUT_FILE" > /dev/null
rm temp-image.dmg
echo "$OUTPUT_DIR/$OUTPUT_FILE";
}
# Sends output file to stdout
make_package()
{
if [ -z "$BUILD_RELEASE" ]; then
mv Phoenix\ Viewer.app Phoenix\ Viewer\ Beta.app
fi
echo $(make_disk_image $1)
}
upload()
{
# echo "Uploading..."
# #Be sure to take the upload function out before pushing any changes as it contains server credentials and hidden URLs.
echo "The final package can be found at $1."
}
# Get viewer version from source code: sets variable VERSION_VIEWER
. ${INDRA_DIR}/Version
case "$1" in
release)
echo "Building for release."
BUILD_RELEASE="yes"
;;
beta)
echo "Building beta."
BUILD_RELEASE=""
;;
*)
echo "Usage: $0 {beta|release} [revision]"
exit 1
;;
esac
if [ -z "$2" ]; then
REVISION=0
hg update
else
REVISION=$2
hg update -r $REVISION
fi
if [ $? -ne 0 ]; then
echo "Couldn't update from Mercurial."
exit 2
fi
if [ $REVISION -eq 0 ]; then
while read line; do
if [[ ${line:0:8} == "parent: " ]]; then
REVISION=$(echo ${line:8}|sed -e s'/:.*//')
fi
done < <(hg summary)
if [ $REVISION -eq 0 ]; then
echo "Could not determine Mercurial revision."
exit 3
fi
fi
echo "Retrieved Mercurial revision $REVISION."
echo "Preparing..."
rm installed.xml 2>/dev/null
if [ -z $SKIP_INTEL ]; then
echo "------------------------------------------"
echo " x86 Build "
echo "------------------------------------------"
echo "Cleaning..."
cd $INDRA_DIR
./develop.py clean > /dev/null
configure i386 "-O2 -fomit-frame-pointer -frename-registers -ftree-vectorize -fweb -fexpensive-optimizations -march=i686 \
-msse -mfpmath=sse -msse2 -pipe -DLL_VECTORIZE=1 -DLL_SSE=1 -DLL_SSE2=1"
cd build-darwin-i386
set_channel
build
if [ $? -eq 0 ]; then
cd newview/Release
copy_resources
echo "Liposuction..."
lipo -thin i386 Phoenix\ Viewer.app/Contents/MacOS/libhunspell-1.2.dylib -output Phoenix\ Viewer.app/Contents/MacOS/libhunspell-1.2.dylib
lipo -thin i386 Phoenix\ Viewer.app/Contents/MacOS/libndofdev.dylib -output Phoenix\ Viewer.app/Contents/MacOS/libndofdev.dylib
lipo -thin i386 Phoenix\ Viewer.app/Contents/MacOS/libotr.dylib -output Phoenix\ Viewer.app/Contents/MacOS/libotr.dylib
lipo -thin i386 Phoenix\ Viewer.app/Contents/MacOS/7za -output Phoenix\ Viewer.app/Contents/MacOS/7za
lipo -thin i386 Phoenix\ Viewer.app/Contents/Resources/SLVoice -output Phoenix\ Viewer.app/Contents/Resources/SLVoice
lipo -thin i386 Phoenix\ Viewer.app/Contents/Resources/libalut.dylib -output Phoenix\ Viewer.app/Contents/Resources/libalut.dylib
lipo -thin i386 Phoenix\ Viewer.app/Contents/Resources/libopenal.dylib -output Phoenix\ Viewer.app/Contents/Resources/libopenal.dylib
lipo -thin i386 Phoenix\ Viewer.app/Contents/Resources/libortp.dylib -output Phoenix\ Viewer.app/Contents/Resources/libortp.dylib
lipo -thin i386 Phoenix\ Viewer.app/Contents/Resources/libvivoxsdk.dylib -output Phoenix\ Viewer.app/Contents/Resources/libvivoxsdk.dylib
lipo -thin i386 Phoenix\ Viewer.app/Contents/Resources/llplugin/libllqtwebkit.dylib -output Phoenix\ Viewer.app/Contents/Resources/llplugin/libllqtwebkit.dylib
echo "Packaging..."
RESULT="$(make_package Intel)"
upload "$RESULT"
echo "Intel build succeeded."
else
echo "Intel build failed."
fi
else
echo "Intel build skipped."
fi
# Some cleanup.
rm installed.xml 2>/dev/null
echo "Finished."