forked from aburch/simutrans
-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildOSXbundle.sh
executable file
·150 lines (135 loc) · 4.73 KB
/
buildOSXbundle.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
#!/bin/bash
#
# first assume unix ...
simexe=
updatepath="/"
updater="get_pak.sh"
simarchiv=simumac
getNightlies()
{
# Use curl if available, else use wget
curl -h > /dev/null
if [ $? -eq 0 ]; then
curl http://simutrans-germany.com/stn/Download.php?d=9 > sim-macintel.zip || {
echo "Error: download of file sim-macintel.zip failed (curl returned $?)" >&2
rm -f "sim-macintel.zip"
exit 4
}
curl http://simutrans-germany.com/stn/Download.php?d=11 > sim-macpowerpc.zip || {
echo "Error: download of file sim-macpowerpc.zip failed (curl returned $?)" >&2
rm -f "sim-macpowerpc.zip"
exit 4
}
else
wget --help > /dev/null
if [ $? -eq 0 ]; then
wget -N http://simutrans-germany.com/stn/Download.php?d=9 || {
echo "Error: download of file sim-macintel.zip failed (wget returned $?)" >&2
rm -f "sim-macintel.zip"
exit 4
}
wget -N http://simutrans-germany.com/stn/Download.php?d=11 || {
echo "Error: download of file sim-macpowerpc.zip failed (wget returned $?)" >&2
rm -f "sim-macpowerpc.zip"
exit 4
}
else
echo "Error: Neither curl or wget are available on your system, please install either and try again!" >&2
exit 6
fi
fi
unzip -tv "sim-macintel.zip" || {
echo "Error: file sim-macintel.zip seems to be defective" >&2
rm -f "sim-macintel.zip"
exit 5
}
unzip -tv "sim-macpowerpc.zip" || {
echo "Error: file sim-macpowerpc.zip seems to be defective" >&2
rm -f "sim-macpowerpc.zip"
exit 5
}
}
getSDL()
{
# Use curl if available, else use wget
curl -h > /dev/null
if [ $? -eq 0 ]; then
curl http://www.libsdl.org/release/SDL-1.2.15.dmg > SDL-1.2.15.dmg || {
echo "Error: download of file SDL-1.2.15.dmg failed (curl returned $?)" >&2
rm -f "SDL-1.2.15.dmg"
exit 4
}
curl http://www.libsdl.org/release/SDL-1.2.15-OSX10.4.dmg > SDL-1.2.15-OSX10.4.dmg || {
echo "Error: download of file SDL-1.2.15-OSX10.4.dmg failed (curl returned $?)" >&2
rm -f "SDL-1.2.15-OSX10.4.dmg"
exit 4
}
else
wget --help > /dev/null
if [ $? -eq 0 ]; then
wget -N http://www.libsdl.org/release/SDL-1.2.15.dmg || {
echo "Error: download of file SDL-1.2.15.dmg failed (wget returned $?)" >&2
rm -f "SDL-1.2.15.dmg"
exit 4
}
wget -N http://www.libsdl.org/release/SDL-1.2.15-OSX10.4.dmg || {
echo "Error: download of file SDL-1.2.15-OSX10.4.dmg failed (wget returned $?)" >&2
rm -f "SDL-1.2.15-OSX10.4.dmg"
exit 4
}
else
echo "Error: Neither curl or wget are available on your system, please install either and try again!" >&2
exit 6
fi
fi
7z t "SDL-1.2.15-OSX10.4.dmg" || {
echo "Error: file SDL-1.2.15-OSX10.4.dmg seems to be defective" >&2
rm -f "sim-macintel.zip"
exit 5
}
7z t "SDL-1.2.15.dmg" || {
echo "Error: file SDL-1.2.15.dmg seems to be defective" >&2
rm -f "SDL-1.2.15.dmg"
exit 5
}
}
# (otherwise there will be many .svn included under windows)
distribute()
{
# pack all files of the current release
FILELISTE=`find simutrans -type f "(" -name "*.tab" -o -name "*.mid" -o -name "*.bdf" -o -name "*.fnt" -o -name "*.txt" -o -name "*.dll" -o -name "*.pak" -o -name "*.nut" ")"`
zip -9 $simarchiv.zip $FILELISTE simutrans/$updater
FILELISTE=`find simutrans/simutrans.app`
zip -9r $simarchiv.zip $FILELISTE
}
# fetch language files
sh ./get_lang_files.sh
# now download the nightlies
cd simutrans
cp ..updatepath$updater .
getNightlies
unzip "sim-macpowerpc.zip"
unzip "sim-macintel.zip"
rm "sim-macpowerpc.zip"
rm "sim-macintel.zip"
# Now get the SDL frameworks
getSDL
7z x "SDL-1.2.15-OSX10.4.dmg"
7z x 2.hfs
rm -f 0.ddm 1.Apple_partition_map 2. hfs 3.free
# save the version number
simversion=`grep -a "Version " sim-macintel | awk 'BEGIN { RS = "\000" } {print $0 "\n"}' | grep "Version " `
# builds a bundle for MAC OS
mkdir -p "simutrans.app/Contents/MacOS"
mkdir -p "simutrans.app/Contents/Resources"
mv sim-macpowerpc "simutrans.app/Contents/MacOS/simutrans.ppc"
mv sim-macintel "simutrans.app/Contents/MacOS/simutrans.i386"
cp "../OSX/simutrans.icns" "simutrans.app/Contents/Resources/simutrans.icns"
cp "../OSX/simutrans.sh" "simutrans.app/Contents/MacOS/simutrans.sh"
echo "APPL????" > "simutrans.app/Contents/PkgInfo"
sh ../OSX/plistgen.sh "simutrans.app" "simutrans.sh" "$simversion"
echo "#!/bin/sh\n"${0}.`uname -p`"\nif [ "$?" != "0" ] ; then\n /usr/bin/osascript <<-EOF\n tell application "Console" to activate\n EOF\fi" > "simutrans.app/Contents/MacOS/simutrans.sh"
cd ..
distribute
# .. finally delete executable and language files
rm -rf simutrans/simutrans.app