-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.sh
executable file
·167 lines (119 loc) · 3.26 KB
/
build.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
#!/bin/bash
set -e
[[ -f "$HOME/Haxe/environment" ]] && source $HOME/Haxe/environment
set -x
LIME="haxelib run lime"
VERSION=$(./build/get_version.py Project.xml)
[[ -z "$VERSION" ]] && exit 1
echo "*** Version: $VERSION ***"
function android_publish_testing ()
{
CERT_PATH="$HOME/.keys/irrational_testing.keystore"
CERT_ALIAS="testing"
stamp=$( date "+%Y-%m-%d" )
rm -f export/android/bin/bin/*.apk
${LIME} -Dtesting build android --certificate-path=${CERT_PATH} --certificate-alias=${CERT_ALIAS}
cp export/android/bin/bin/quik-release.apk "publish/android/quik-testing-${stamp}.apk"
}
function android_publish()
{
local type="$1"
CERT_PATH="$HOME/.keys/irrational_release.keystore"
CERT_ALIAS="release"
stamp=$( date "+%Y-%m-%d" )
rm -Rf export/android/
${LIME} -D${type} build android --certificate-path=${CERT_PATH} --certificate-alias=${CERT_ALIAS}
cp export/android/bin/bin/quik-release.apk "publish/android/quik-${type}-${stamp}.apk"
}
function android_publish_release ()
{
android_publish release
}
function android_publish_demo ()
{
android_publish demo
}
function linux_publish()
{
local type="$1"
stamp=$( date "+%Y-%m-%d" )
local buildarchs="x86 x64"
local origin=$(pwd)
for arch in $buildarchs ; do
local bits=""
local buildbits="-32"
[[ "$arch" == "x64" ]] && bits="64"
[[ "$arch" == "x64" ]] && buildbits="-64"
local buildlog="linux-${arch}.log"
cd $origin
rm -Rf "export/linux${bits}/"
${LIME} -D${type} build linux ${buildbits} > $buildlog
local appdir="quik-${arch}"
local apparchive="quik-${VERSION}-${arch}-${stamp}.tar.bz2"
if [[ "$type" == "demo" ]] ; then
apparchive="quik-${VERSION}-demo-${arch}-${stamp}.tar.bz2"
fi
cd export/linux${bits}/cpp/
mv bin "${appdir}"
# strip syms
strip -s ${appdir}/quik
# move original binary
mv ${appdir}/quik ${appdir}/quik.bin
# launch script
cp ${origin}/platform/linux/quik ${appdir}/quik
chmod 755 ${appdir}/quik
# package
tar -cjvf "${apparchive}" "${appdir}" --owner=65534 --group=100
# publish
echo "*** archive: ${apparchive}"
cp "${apparchive}" "${origin}/publish/linux/"
done
}
function linux_publish_release ()
{
linux_publish release
}
function linux_publish_demo()
{
linux_publish demo
}
function mac_publish()
{
local type="$1"
stamp=$( date "+%Y-%m-%d" )
local origin=$(pwd)
rm -Rf export/mac64
lime -D${type} build mac -64
cd export/macos/bin
local bundlename="Quik.app"
[[ "$type" == "demo" ]] && bundlename="Quik (Demo).app"
local appname=$( echo "$bundlename" | sed -e 's/.app//' )
local dmgvolname="Quik"
[[ "$type" == "demo" ]] && dmgvolname="Quik (Demo)"
local dmgsize=30
local dmgtmp=/tmp/quik.tmp.dmg
local dmgmnt=/tmp/quik
local dmg=/tmp/quik-${type}-${stamp}.dmg
rm -f ${dmgtmp} ${dmg}
hdiutil create -ov -megabytes ${dmgsize} -fs HFS+ -nospotlight -volname "${dmgvolname}" ${dmgtmp}
mkdir -p ${dmgmnt}
hdiutil attach -mountpoint ${dmgmnt} ${dmgtmp}
cp -pR "quik.app" "${dmgmnt}/${bundlename}"
pushd "${dmgmnt}"
ln -s /Applications .
popd
hdiutil detach "${dmgmnt}"
hdiutil convert "${dmgtmp}" -format UDBZ -o "${dmg}"
rm "${dmgtmp}"
mv "${dmg}" "${origin}/publish/mac/"
cd "$origin"
}
function mac_publish_demo()
{
mac_publish demo
}
function mac_publish_release()
{
mac_publish release
}
"$@"