win32/install.iss: Support spaces in git-cola path
[git-cola.git] / win32 / create-installer.sh
blobafadb01b76f23e0da11eedb8f6eeb6179d4d8c25
1 #!/bin/sh
2 if ! test -d win32; then
3 echo "Please run this script from the root of the cola source tree"
4 exit 1
5 fi
7 # Add Python and Gettext to our path
8 for python in "/c/Python27" "/c/Python26" "/c/Python25"
9 do
10 if test -d "$python"
11 then
12 break
14 done
15 PATH="$python":/bin:/usr/bin:/mingw/bin:"/c/Program Files/Gnu/bin":win32:"$PATH"
16 export PATH
18 VERSION=$(bin/git-cola version | awk '{print $3}')
20 while test $# -gt 0;
22 case "$1" in
23 -v|--version)
24 shift
25 VERSION="$1"
26 shift
29 echo "Usage: $0 [--version <version>]"
30 exit 1
32 esac
33 done
35 BASENAME=git-cola-$VERSION
36 ETC=$BASENAME/etc
37 ROOT=$BASENAME
38 TARGET="$ROOT".exe
40 echo "Building installer for git-cola $VERSION"
42 python setup.py --quiet install \
43 --prefix="$ROOT" \
44 --install-scripts="$ROOT"/bin
45 rm -rf "$ROOT"/lib "$ROOT"/Lib build
47 cp $BASENAME/bin/git-cola $BASENAME/bin/git-cola.pyw
48 cp $BASENAME/bin/git-dag $BASENAME/bin/git-dag.pyw
49 mkdir -p $ETC 2>/dev/null
50 cp win32/git.bmp win32/gpl-2.0.rtf win32/git.ico $ETC
52 NOTES=$ETC/ReleaseNotes.txt
54 printf "git-cola: v$VERSION\nBottled-on: $(date)\n\n\n" > $NOTES
55 printf "To run cola, just type 'cola' from a Git Bash session.\n\n\n" >> $NOTES
57 tag=$(git tag | tail -2 | head -1)
58 echo "--------------------------------------------------------" >> $NOTES
59 echo " Changes since $tag" >> $NOTES
60 echo "--------------------------------------------------------" >> $NOTES
61 echo >> $NOTES
62 git shortlog $tag.. >> $NOTES
64 # LF -> CRLF
65 vim -c "set ff=dos" -c "wq" $NOTES
67 OUTPUTDIR="$(pwd -W)" &&
68 sed -e "s/%APPVERSION%/$VERSION/" -e "s@%OUTPUTDIR%@$OUTPUTDIR@" \
69 < win32/install.iss > $BASENAME/install.iss &&
70 cd "$BASENAME" &&
71 echo "Lauching Inno Setup compiler ..." &&
72 /share/InnoSetup/ISCC.exe install.iss | grep -Ev "\s*Reading|\s*Compressing" &&
73 cd .. &&
74 rm -rf "$BASENAME"