summaryrefslogtreecommitdiff
path: root/build/win32_install/build-win32-installer.sh
blob: 467d0d7858a0bb2cc639c75f8b9c87050ae2dbc5 (plain)
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
#!/usr/bin/sh

for i in uqm-installer.nsi packages.nsh orzshofixti.bmp ultron.bmp \
	 uqm-3do.cfg uqm-pc.cfg; do
	if ! [ -f $i ]; then
		echo "$i not found. Make sure you are running from sc2/build/win32_install."
		exit 1
	fi
done
if ! [ -f packages.nsh ]; then
	echo "packages.nsh not found. Follow the instructions in INSTALL.pkgs"
	echo "to regenerate it."
	exit 1
fi
if ! [ -f ../../uqm.exe ]; then
	echo "uqm.exe not found. Go build it first."
	exit 1
fi

build_keyjam()
{
	make clean && \
	make && \
	strip keyjam.exe && \
	cp keyjam.exe ../../sc2/build/win32_install
	return $?
}

echo "Building the key-jammer application..."
cd ../../../tools/keys || exit 1
build_keyjam
result=$?
cd ../../sc2/build/win32_install
if [ $result -ne 0 ] ; then
	echo "Could not build keyjam.exe. Aborting installer creation."
	exit 1
fi
cp ../../uqm.exe . || exit
strip ./uqm.exe || exit
echo "Identifying DLL dependencies..."
DLLS=$(ntldd -R uqm.exe | awk '/\\bin\\/{print $3;}')
DLLS2=$(ntldd -R keyjam.exe | awk '/\\bin\\/{print $3;}')
DLLS="$DLLS $DLLS2"
DLLS=$(for dll in $DLLS; do echo $dll; done | sort -u)

(echo "# Autogenerated by build-win32-installer.sh";
 echo "#"
 echo "    File \"uqm.exe\""
 echo "    File \"keyjam.exe\""
 for dll in $DLLS; do
	echo "    File \"$dll\""
 done) >> dlls.nsi

(echo "# Autogenerated by build-win32-installer.sh";
 echo "#"
 echo "    Delete \"\$INSTDIR\\uqm.exe\""
 echo "    Delete \"\$INSTDIR\\keyjam.exe\""
 for dll in $DLLS; do
	 echo "    Delete \"\$INSTDIR\\$(basename $dll)\""
 done) >> undlls.nsi

echo "Preparing documentation..."
for i in AUTHORS COPYING README README-SDL WhatsNew; do
	cp "../../$i" "$i.txt" && unix2dos "$i.txt"
done
cp ../../doc/users/manual.txt Manual.txt && unix2dos "Manual.txt"

echo "Creating installer..."
makensis "-XSetCompressor /SOLID lzma" uqm-installer.nsi || exit 1
echo "Installer has been created successfully."