e3f3769f9288459a43b68b2d8a4ae7d4b564787b
[msysgit.git] / share / WinGit / release.sh
blobe3f3769f9288459a43b68b2d8a4ae7d4b564787b
1 #!/bin/bash
3 force=
4 do_compile=t
5 while test $# -gt 0
6 do
7 case "$1" in
8 -f|--force)
9 force=t
10 shift
12 -n|--no-compile)
13 do_compile=
14 shift
17 break
18 esac
19 done
21 test -z "$1" && {
22 echo "Usage: $0 [-f] [-n] <version>" >&2
23 exit 1
26 version=$1
28 # change directory to msysGit root
29 SCRIPTDIR="$(cd "$(dirname "$0")" && pwd)"
30 MSYSGITROOT="$(cd $SCRIPTDIR/../../ && pwd | sed 's/\/$//')/."
31 cd $MSYSGITROOT || {
32 echo "Could not change directory to msysGit root" >&2
33 exit 1
36 test -z "$force" && {
37 die () {
38 echo "$*" >&2
39 echo "If that is okay, please call '$0 -f $version'" >&2
40 exit 1
43 (cd git &&
44 git update-index --refresh &&
45 git diff-files --quiet &&
46 git diff-index --cached HEAD --) ||
47 die "Git submodule has dirty files"
48 (git update-index --refresh &&
49 git diff-files --quiet &&
50 git diff-index --cached HEAD --) ||
51 die "msysGit super project not up-to-date"
54 create_msysgit_tag () {
55 if tag=$(git describe --exact-match --match "*.msysgit.*" HEAD 2> /dev/null)
56 then
57 echo "Using existing tag $tag"
58 else
59 i=0 &&
60 tag=$(git describe HEAD | cut -d- -f1) &&
61 tag=${tag%.msysgit.*} &&
62 while ! git tag -a -m "Git for Windows $1" $tag.msysgit.$i 2> /dev/null
64 i=$(($i+1))
65 done &&
66 echo "Created tag $tag.msysgit.$i"
70 # compile everything needed for standard setup
71 test "$do_compile" && {
72 wordpad share/WinGit/ReleaseNotes.rtf && {
73 ( # create a commit if ReleaseNotes changed
74 if test ! -z "$(git diff share/WinGit/ReleaseNotes.rtf)"
75 then
76 git add share/WinGit/ReleaseNotes.rtf &&
77 git commit -m "Git for Windows $version"
78 fi) &&
79 (cd git &&
80 create_msysgit_tag $version &&
81 make install) &&
82 (cd git/contrib/subtree &&
83 make install INSTALL=/bin/install prefix=) &&
84 (cd git/contrib/credential/wincred &&
85 make install INSTALL=/bin/install prefix=) &&
86 /src/mingw-w64/release-easy.sh &&
87 /src/mingw-w64/release-zlib.sh &&
88 (cd src/git-cheetah/explorer/ &&
89 make objects-clean && make &&
90 make objects-clean && make W64=1)
91 } || exit 1
94 test -z "$force" && {
95 die () {
96 echo "$*" >&2
97 echo "If that is okay, please call '$0 -f $version'" >&2
98 exit 1
101 (cd git &&
102 git update-index --refresh &&
103 git diff-files --quiet &&
104 git diff-index --cached HEAD --) ||
105 die "Git submodule has dirty files"
106 (cd git &&
107 test git.exe = $((printf 'git.exe\0'; git ls-files -z) | xargs --null ls -t 2>/dev/null| head -1)) ||
108 die "Git's git.exe is not up-to-date (run 'cd /git && make' to fix)"
109 for f in bin/git* libexec/git-core/git*
111 case "$f" in
112 *.manifest)
113 continue
115 */gitk)
116 basename=gitk-git/gitk
118 */git-citool|*/git-gui)
119 basename=git-gui/git-gui
121 */git-gui--askpass|*/git-gui--askyesno|*/git-gui.tcl)
122 basename=git-gui/$(basename "$f")
124 */git-subtree)
125 basename=contrib/subtree/$(basename "$f")
128 basename=$(basename "$f")
130 esac
131 cmp "$f" "git/$basename" ||
132 die "Installed Git disagrees with contents of /git/ ($f)"
133 done
134 (git update-index --refresh &&
135 git diff-files --quiet &&
136 git diff-index --cached HEAD --) ||
137 die "msysGit super project not up-to-date"
138 (cd git &&
139 test ! -z "$(git tag --contains HEAD)") ||
140 die "Git's HEAD is untagged"
143 TMPDIR=/tmp/WinGit
144 unset DONT_REMOVE_BUILTINS
146 $MSYSGITROOT/share/WinGit/copy-files.sh $TMPDIR &&
147 sed -e '/share\/msysGit/d' -e "s/msysGit/Git (version $version)/" \
148 < etc/motd > $TMPDIR/etc/motd &&
149 cp share/resources/gpl-2.0.rtf share/resources/git.bmp share/resources/gitsmall.bmp $TMPDIR &&
150 sed -e "s/%APPVERSION%/$version/" \
151 < share/WinGit/install.iss > $TMPDIR/install.iss &&
152 cp share/WinGit/*.inc.iss $TMPDIR &&
153 echo "Launching Inno Setup compiler ..." &&
154 (cd $TMPDIR &&
155 if test -x $MSYSGITROOT/share/InnoSetup/ISCC.exe
156 then
157 $MSYSGITROOT/share/InnoSetup/ISCC.exe install.iss
158 else
159 case $(wine --version) in
160 wine-0*|wine-1.[012]*|wine-1.3.[0-9]|wine-1.3.[0-9]-*|wine-1.3.1[0-4]|wine-1.3.1[0-4]-*)
161 echo "You need at least WINE version 1.3.15" >&2 &&
162 exit 1
163 esac &&
164 wine $MSYSGITROOT/share/InnoSetup/ISCC.exe install.iss
165 fi > /tmp/install.out &&
166 echo $? > /tmp/install.status) &&
167 (test 0 = "$(cat /tmp/install.status)") &&
168 git tag -a -m "Git for Windows $1" Git-$1 &&
169 echo "Installer is available as $(tail -n 1 /tmp/install.out)"