forked from aburch/simutrans
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdistribute.sh
executable file
·133 lines (118 loc) · 3.63 KB
/
distribute.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
#!/bin/bash
#
# parameters (in this order):
# "-no-lang" prevents downloading the translations
# "-no-rev" do not include revision number in zip file name
# "-rev=###" overide SDL revision with ## (number)
# get pthreads DLL
getDLL()
{
# Use curl if available, else use wget
echo "Downloading pthreadGC2.dll"
curl -q -h > /dev/null
if [ $? -eq 0 ]; then
curl -q ftp://sourceware.org/pub/pthreads-win32/dll-latest/dll/x86/pthreadGC2.dll > pthreadGC2.dll || {
echo "Error: download of PthreadGC2.dll failed (curl returned $?)" >&2
exit 4
}
else
wget -q --help > /dev/null
if [ $? -eq 0 ]; then
wget -q -N ftp://sourceware.org/pub/pthreads-win32/dll-latest/dll/x86/pthreadGC2.dll || {
echo "Error: download of PthreadGC2.dll failed (wget returned $?)" >&2
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
}
# first assume unix name defaults ...
simexe=
updatepath="/"
updater="get_pak.sh"
OST=unknown
# now get the OSTYPE from config.default and remove all spaces around
OST=`grep "^OSTYPE" config.default | sed "s/OSTYPE[ ]*=[ ]*//" | sed "s/[ ]*\#.*//"`
# now make the correct archive name
simexe=
if [ "$OST" = "mac" ]; then
simarchivbase=simumac
elif [ "$OST" = "haiku" ]; then
simarchivbase=simuhaiku
elif [ "$OST" = "mingw" ]; then
simexe=.exe
SDLTEST=`grep "^BACKEND =" config.default | sed "s/BACKEND[ ]*=[ ]*//" | sed "s/[ ]*\#.*//"`
if [ "$SDLTEST" = "sdl" ] || [ "$SDLTEST" = "sdl2" ]; then
simarchivbase=simuwin-sdl
else
simarchivbase=simuwin
# Missing: Copy matching SDL dll!
fi
cd simutrans
getDLL
cd ..
updatepath="/nsis/"
updater="download-paksets.exe"
cd nsis
makensis onlineupgrade.nsi
cd ..
elif [ "$OST" = "linux" ]; then
simarchivbase=simulinux
elif [ "$OST" = "freebsd" ]; then
simarchivbase=simubsd
elif [ "$OST" = "amiga" ]; then
simarchivbase=simuamiga
fi
# now add revesion number without any modificators
# fetch language files
if [ `expr match "$*" ".*-rev="` != "0" ]; then
REV_NR=$(echo $* | sed "s/.*-rev=[ ]*//" | sed "s/[^0-9]*//")
simarchiv=$simarchivbase-$REV_NR
elif [ "$#" = "0" ] || [ `expr match "$*" ".*-no-rev"` = "0" ]; then
REV_NR=`svnversion | sed "s/[0-9]*://" | sed "s/M.*//"`
simarchiv=$simarchivbase-$REV_NR
else
echo "No revision given!"
simarchiv=$simarchivbase
fi
# (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" -o -name "*.dll" ")"`
zip -9 $simarchiv.zip $FILELISTE simutrans/simutrans$simexe simutrans/$updater
}
buildOSX()
{
# builds a bundle for MAC OS
mkdir -p "simutrans.app/Contents/MacOS"
mkdir -p "simutrans.app/Contents/Resources"
cp ../sim.exe "simutrans.app/Contents/MacOS/simutrans"
strip "simutrans.app/Contents/MacOS/simutrans"
cp "../OSX/simutrans.icns" "simutrans.app/Contents/Resources/simutrans.icns"
echo "APPL????" > "simutrans.app/Contents/PkgInfo"
sh ../OSX/plistgen.sh "simutrans.app" "simutrans"
}
# fetch language files
if [ "$#" = "0" ] || [ `expr match "$*" "-no-lang"` = "0" ]; then
sh ./get_lang_files.sh
fi
# now built the archive for distribution
cd simutrans
if [ $OSTYPE = darwin* ]; then
buildOSX
else
cp ../sim$simexe ./simutrans$simexe
strip simutrans$simexe
fi
cp ..$updatepath$updater $updater
cd ..
distribute
# .. finally delete executable and language files
rm simutrans/simutrans$simexe
# cleanup dll's
if [ "$OST" = "mingw" ]; then
rm simutrans/pthread*.dll
fi