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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
|
#!/bin/bash
# These control which ones get built.
do_linux64=1
do_linux32=1
do_local=0
do_mac=0
do_windowsXP=1
# Where to find suitable disk images for the various OS's.
img_linux64=~/bin/ubuntu64_diff.qcow2
img_linux32=~/bin/ubuntu32_diff.qcow2
img_windowsXP=/media/sdb2/IMAGES/xp_diff.qcow2
# Extra PATH for cygwin, coz it don't pick up the Windows PATH in the serial console.
cw_path='/cygdrive/c/WINDOWS/system32:/cygdrive/c/WINDOWS:/cygdrive/c/WINDOWS/System32/Wbem:/cygdrive/c/Program Files/CMake 2.8/bin:/cygdrive/c/Python27:/cygdrive/c/Program Files/Git/cmd'
unique_port()
{
# Try to find an unused port number for each running instance of the program.
START=8192
RANGE=$[$(awk '{print $1}' /proc/sys/net/ipv4/ip_local_port_range)-$START]
if [ $RANGE -lt 8 ]
then
START=$[$(awk '{print $2}' /proc/sys/net/ipv4/ip_local_port_range)]
RANGE=$[65535-$START]
if [ $RANGE -lt 8 ]
then
START=16384
RANGE=32768
fi
fi
echo $[($$%$RANGE)+$START]
}
rm -rf TARBALLS
mkdir TARBALLS
date=$(date '+%H_%d-%m-%Y')
if [ -d SOURCE ]; then
echo "Updating source."
cd SOURCE &&
git pull &&
cd .. || exit 0
else
echo "Downloading source."
mkdir SOURCE &&
git clone git://github.com/imprudence/imprudence.git SOURCE || exit 0
fi
echo "Creating source tarball."
tar czf TARBALLS/impy-release-source_${date}.tar.gz SOURCE &&
FTP_PORT=$(unique_port)
echo "=== launching FTP daemon on port $FTP_PORT"
# Fire off an ftp daemon, making sure it's killed when this script exits.
# (We use the busybox version because no two ftp daemons have quite the same
# command line arguments, and this one's a known quantity.)
# Busybox needs -s 127.0.0.1 support here
./busybox nc -p $FTP_PORT -lle ./busybox ftpd -w TARBALLS &
trap "kill $(jobs -p)" EXIT
disown $(jobs -p)
# QEMU's alias for host loopback
FTP_SERVER=10.0.2.2
# Do Windows first, coz it still needs a manually typed password, dammit.
if [ $do_windowsXP -eq 1 ]
then
echo "Building in qemu, Windows XP."
qemu-system-i386 -M pc -cpu athlon -m 2G -hda ${img_windowsXP} -net nic -net user,vlan=0,hostfwd=tcp::2222-:22 -rtc base=localtime &
sleep 30
#expect -c 'spawn ssh -p 2222 me@localhost ; expect assword ; send " \n" ; interact' <<- zzzzEOFzzzz
ssh -p 2222 me@localhost <<- zzzzEOFzzzz
# TODO - there has to be a way of avoiding all this hard coded stuff, coz this is way too fragile.
PATH='/bin:/usr/local/bin:/usr/bin:'\$PATH':/cygdrive/c/Program Files/Microsoft SDKs/v6.1/Bin:/cygdrive/c/Program Files/Microsoft Visual Studio 8/SDK/v2.0/Bin:/cygdrive/c/Program Files/Microsoft Visual Studio 8/Common7/IDE:/cygdrive/c/Program Files/Microsoft Visual Studio 8/VC/bin:/cygdrive/c/Program Files/Microsoft Visual Studio 8/Common7/Tools/:/cygdrive/c/Program Files/Inno Setup 5'
#./.profile
#./.bash_profile
export DXSDK_DIR='C:\Program Files\Microsoft DirectX SDK (November 2008)\'
#vcvarsall.bat x86
export INCLUDE="C:\Program Files\Microsoft Visual Studio 8\VC\include;C:\Program Files\Microsoft SDKs\Windows\v6.1\Include"
export LIB="C:\Program Files\Microsoft Visual Studio 8\VC\lib;C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Lib;C:\Program Files\Microsoft SDKs\Windows\v6.1\Lib"
export LIBPATH="C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727"
#echo \$PATH
#set
cd /home/me
rm -fr BUILD
mkdir -p BUILD
rm -fr TARBALLS
mkdir -p TARBALLS
lftp -c 'open -p ${FTP_PORT} ${FTP_SERVER} && lcd TARBALLS && get1 impy-release-source_${date}.tar.gz'
tar xzf TARBALLS/impy-release-source_${date}.tar.gz -C BUILD
cd /home/me/BUILD/SOURCE
cd linden/scripts/linux
# Apparently my "works everywhere" Linux specific scripts work on Cygwin to. Mostly.
./0-patch-SL-source
./1-get-libraries-from-SL
./2-trim-libraries-from-SL
./3-compile-SL-source
cd /home/me/BUILD/SOURCE
rm linden/indra/CMakeCache.txt
cd linden/indra
# This would be preferable, but NMake is not an option.
#./develop.py -G "nmake" --type=Release build
# Also, apparently there's Cygwin support, but might have to install the cygwin python for that.
cmake -DCMAKE_BUILD_TYPE:STRING="Release" -DSTANDALONE:BOOL=OFF -DUNATTENDED:BOOL=OFF -DROOT_PROJECT_NAME:STRING="Imprudence" -DPACKAGE:BOOL=ON -G "NMake Makefiles" build .
# Hack around a bug in cmake that I'm surprised did not hit GUI controlled builds.
sed -i "s|\(^RC_FLAGS .* \) /GS .*$|\1|" win_crash_logger/CMakeFiles/windows-crash-logger.dir/flags.make
sed -i "s|\(^RC_FLAGS .* \) /GS .*$|\1|" newview/CMakeFiles/imprudence-bin.dir/flags.make
#cd build-nmake
nmake
# Build the inno installer.
iscc newview/package/Imprudence-1.4.0.3-beta-2.iss
cp newview/package/Imprudence-*.exe /home/me/TARBALLS
cd /home/me/TARBALLS
lftp -c 'open -p ${FTP_PORT} ${FTP_SERVER} && lcd /home/me/TARBALLS && mput Imprudence-*'
shutdown -s now
zzzzEOFzzzz
# A here document would be preferable, but "interact" won't work then.
# Serial port would be preferable, but python does nothing then. WTF?
# expect -c "
# set timeout -1
# set send_slow {1 .1}
# spawn qemu-system-i386 -M pc -cpu athlon -m 2G -hda ${img_windowsXP} -serial stdio -rtc base=localtime
# match_max 100000
# strace 1
# expect -exact \"\$ \"; sleep .1; send -s -- \"PATH=\\\$PATH':${cw_path}'\r\"
# expect -exact \"\$ \"; sleep .1; send -s -- \"echo \\\$PATH\r\"
# expect -exact \"\$ \"; sleep .1; send -s -- \"cd /home/me\r\"
# expect -exact \"\$ \"; sleep .1; send -s -- \"rm -fr BUILD\r\"
# expect -exact \"\$ \"; sleep .1; send -s -- \"rm -fr TARBALLS\r\"
# expect -exact \"\$ \"; sleep .1; send -s -- \"mkdir -p BUILD\r\"
# expect -exact \"\$ \"; sleep .1; send -s -- \"mkdir -p TARBALLS\r\"
# expect -exact \"\$ \"; sleep 2; send -s -- \"lftp -c 'open -p ${FTP_PORT} ${FTP_SERVER} && lcd TARBALLS && get1 impy-release-source_${date}.tar.gz'\r\"
# expect -exact \"\$ \"; sleep .1; send -s -- \"tar xzf TARBALLS/impy-release-source_${date}.tar.gz -C BUILD\r\"
# expect -exact \"\$ \"; sleep .1; send -s -- \"cd /home/me/BUILD/SOURCE\r\"
# expect -exact \"\$ \"; sleep .1; send -s -- \"cd linden/scripts/linux\r\"
# expect -exact \"\$ \"; sleep .1; send -s -- \"./0-patch-SL-source\r\"
# expect -exact \"\$ \"; sleep .1; send -s -- \"./1-get-libraries-from-SL\r\"
# expect -exact \"\$ \"; sleep .1; send -s -- \"./2-trim-libraries-from-SL\r\"
# expect -exact \"\$ \"; sleep .1; send -s -- \"./3-compile-SL-source\r\"
# expect -exact \"\$ \"; sleep .1; send -s -- \"cd ../../indra/viewer-windows-*\r\"
# expect -exact \"\$ \"; sleep .1; send -s -- \"make package\r\"
# expect -exact \"\$ \"; sleep .1; send -s -- \"cp Imprudence-* ../../../../../TARBALLS\r\"
# expect -exact \"\$ \"; sleep .1; send -s -- \"cd /home/me/BUILD/TARBALLS\r\"
# expect -exact \"\$ \"; sleep .1; send -s -- \"ls -la\r\"
# expect -exact \"\$ \"; sleep 2; send -s -- \"lftp -c 'open -p ${FTP_PORT} ${FTP_SERVER} && lcd TARBALLS && mput Imprudence-*'\r\"
# interact quit return; sleep .1; send -s -- \"\r\"
# expect -exact \"\$ \"; sleep .1; send -s -- \"shutdown -s now\r\"
# expect eof"
echo ''
sleep 10
fi
if [ $do_local -eq 1 ]
then
echo "Building local." &&
rm -fr BUILD &&
mkdir BUILD &&
tar xzf TARBALLS/impy-release-source_${date}.tar.gz -C BUILD &&
cd BUILD/SOURCE &&
cd linden/scripts/linux &&
./0-patch-SL-source &&
./1-get-libraries-from-SL &&
./2-trim-libraries-from-SL &&
./3-compile-SL-source &&
./4-package-viewer &&
cd ../../indra/viewer-linux-* &&
cp Imprudence-* ../../../../../TARBALLS
cd ../../../../..
fi
if [ $do_linux64 -eq 1 ]
then
echo "Building in qemu, 64 bit linux." &&
qemu-system-x86_64 -M pc -cpu phenom -m 1G -hda $img_linux64 -serial stdio <<- zzzzEOFzzzz
#
mkdir -p /home/builder &&
cd /home/builder &&
rm -fr BUILD &&
rm -fr TARBALLS &&
mkdir -p BUILD &&
mkdir -p TARBALLS &&
sleep 2 &&
busybox ftpget ${FTP_SERVER} -vP ${FTP_PORT} TARBALLS/impy-release-source_${date}.tar.gz impy-release-source_${date}.tar.gz &&
tar xzf TARBALLS/impy-release-source_${date}.tar.gz -C BUILD &&
cd BUILD/SOURCE &&
cd linden/scripts/linux &&
./0-patch-SL-source &&
./1-get-libraries-from-SL &&
./2-trim-libraries-from-SL &&
cp -ar ../../libraries/x86_64-linux/include/ares ../../libraries/include # Hack around an odd problem.
./3-compile-SL-source &&
./4-package-viewer &&
cd ../../indra/viewer-linux-* &&
cp Imprudence-* ../../../../../TARBALLS &&
cd /home/builder/TARBALLS &&
find . -name Imprudence-* -type f -exec busybox ftpput ${FTP_SERVER} -vP ${FTP_PORT} '{}' '{}' \;
shutdown -h now
zzzzEOFzzzz
sleep 10
fi
if [ $do_linux32 -eq 1 ]
then
echo "Building in qemu, 32 bit linux." &&
qemu-system-i386 -M pc -cpu athlon -m 1G -hda $img_linux32 -serial stdio <<- zzzzEOFzzzz
#
mkdir -p /home/builder &&
cd /home/builder &&
rm -fr BUILD &&
rm -fr TARBALLS &&
mkdir -p BUILD &&
mkdir -p TARBALLS &&
sleep 2 &&
busybox ftpget ${FTP_SERVER} -vP ${FTP_PORT} TARBALLS/impy-release-source_${date}.tar.gz impy-release-source_${date}.tar.gz &&
tar xzf TARBALLS/impy-release-source_${date}.tar.gz -C BUILD &&
cd BUILD/SOURCE &&
cd linden/scripts/linux &&
./0-patch-SL-source &&
./1-get-libraries-from-SL &&
./2-trim-libraries-from-SL &&
./3-compile-SL-source &&
./4-package-viewer &&
cd ../../indra/viewer-linux-* &&
cp Imprudence-* ../../../../../TARBALLS &&
cd /home/builder/TARBALLS &&
find . -name Imprudence-* -type f -exec busybox ftpput ${FTP_SERVER} -vP ${FTP_PORT} '{}' '{}' \;
shutdown -h now
zzzzEOFzzzz
sleep 10
fi
if [ $do_mac -eq 1 ]
then
echo "No Mac support yet, coz I need a real Mac for that."
fi
|