]> Dogcows Code - chaz/yoink/blob - arch/win32/makepackage.sh
more normal configure options for gtk and qt4
[chaz/yoink] / arch / win32 / makepackage.sh
1 #!/bin/sh
2
3 #
4 # Yoink
5 # Run this script to create a win32 package.
6 #
7 # You should typically only run this through the "portable" and "installer"
8 # makes targets in the package root directory. The build system will take
9 # care to pass the correct arguments.
10 #
11
12 showhelp()
13 {
14 echo "Usage: $0 [-h] [-i makensis] [-s strip] -d assets -V version -p prefix"
15 echo " Creates a portable win32 package or installer."
16 echo ""
17 echo " -V Specify the version of the program to be packaged"
18 echo " -d Specify the game assets to be included."
19 echo " -h Show this help an exit."
20 echo " -i To make an installer, specify the makensis program."
21 echo " -p Specify the path to your toolchain installation."
22 echo " -s To strip the binaries, specify the strip program."
23 }
24
25 while getopts ":V:hd:i:p:s:" opt
26 do
27 case $opt in
28 V)
29 VERSION="$OPTARG"
30 ;;
31 d)
32 ASSETS="$OPTARG"
33 ;;
34 h)
35 showhelp
36 exit 0
37 ;;
38 i)
39 MAKENSIS="$OPTARG"
40 ;;
41 p)
42 PREFIX="$OPTARG"
43 ;;
44 s)
45 STRIP="$OPTARG"
46 ;;
47 \?)
48 echo "Invalid option: -$OPTARG" >&2
49 showhelp
50 exit 1
51 ;;
52 esac
53 done
54
55 if test "x$ASSETS" = x || test "x$VERSION" = x || test "x$PREFIX" = x
56 then
57 showhelp
58 exit 1
59 fi
60
61 die()
62 {
63 rm -rf "$BUILD"
64 echo "die:" $@
65 exit 1
66 }
67
68 ROOT="$PWD"
69 BUILD=`mktemp -d "$ROOT/tmp-XXXXXXXX"`
70 DIRECTORY="yoink-$VERSION"
71 ARCHIVE="$BUILD/$DIRECTORY"
72
73 MAN2HTML="lua $ROOT/doc/man2html.lua"
74 UNIX2DOS="$ROOT/arch/win32/unix2dos.sh"
75
76 DLLS="libogg-0 libpng14 libvorbis-0 libvorbisfile-3 lua51 OpenAL32 SDL zlib1"
77
78
79 if test ! -f "src/version.c"
80 then
81 echo "Run the script from the repository root directory."
82 exit 1
83 fi
84
85 if ! mkdir "$BUILD"
86 then
87 "The temp directory $BUILD could not be created."
88 exit 1
89 fi
90 mkdir -p "$ARCHIVE"
91
92
93 cp -f "$ROOT/src/yoink.exe" "$ARCHIVE" || die "copying yoink.exe"
94 test "x$STRIP" != x && "$STRIP" "$ARCHIVE/yoink.exe"
95
96 for dll in $DLLS
97 do
98 cp -f "$PREFIX/bin/$dll.dll" "$ARCHIVE" || die "copying $dll"
99 test "x$STRIP" != x && "$STRIP" "$ARCHIVE/$dll.dll"
100 done
101
102 for asset in $ASSETS
103 do
104 cp -f --parents "data/$asset" "$ARCHIVE"
105 done
106
107 for doc in AUTHORS ChangeLog COPYING README TODO
108 do
109 "$UNIX2DOS" "$doc" "$ARCHIVE/$doc.txt" || die "unix2dos $doc"
110 done
111
112 $MAN2HTML -o "$ARCHIVE/Manual.html"
113 $UNIX2DOS "$ARCHIVE/Manual.html"
114
115 cp -rf "$ROOT/doc/licenses" "$ARCHIVE" || die "copying doc/licenses"
116 cd "$ARCHIVE/licenses"
117 for license in $(ls)
118 do
119 (mv "$license" "$license.txt" && "$UNIX2DOS" "$license.txt") \
120 || die "moving and unix2dos $license"
121 done
122 cd "$ROOT"
123
124
125 if test "x$MAKENSIS" = x
126 then
127 # build portable archive
128 echo "No valid makensis executable passed;"
129 echo "making portable package instead..."
130 NAME="$DIRECTORY.zip"
131 cd "$BUILD"
132 zip -r "$NAME" "$DIRECTORY" || die "zipping portable archive"
133 cd "$ROOT"
134 mv "$BUILD/$NAME" .
135 echo "Done! Package saved to $NAME."
136 else
137 # build an installer
138 NAME="yoinksetup-$VERSION.exe"
139 cd "$BUILD"
140 cp "$ROOT/arch/win32/yoink.nsi" .
141 "$MAKENSIS" -DROOTPATH="$ROOT" -DINSTALLFILES="$ARCHIVE" \
142 -DVERSION="$VERSION" -DOUTFILE="$NAME" yoink.nsi \
143 || die "running '$MAKENSIS'"
144 cd "$ROOT"
145 mv "$BUILD/$NAME" .
146 echo "Done! Installer saved to $NAME."
147 fi
148
149
150 rm -rf "$BUILD"
151
This page took 0.038016 seconds and 4 git commands to generate.