From 168687837b48dfb531cbdf0f4ca9a74befd37f26 Mon Sep 17 00:00:00 2001 From: nalla Date: Wed, 1 Apr 2015 12:10:41 +0100 Subject: [PATCH] installer: port to *MSYS2* This is a rough port of the inno setup files to the current *MSYS2* environment. The source files are generated by the `release.sh` into `file-list.iss`. That file is then included by adding the line `#include "file-list.iss"` into `install.iss.in`. The git-cheeta plugin is commented out temporary. Signed-off-by: nalla Signed-off-by: Johannes Schindelin --- .gitignore | 3 + installer/copy-files.sh | 111 ------------ installer/{install.iss => install.iss.in} | 34 ++-- installer/release.sh | 202 +++++++--------------- 4 files changed, 82 insertions(+), 268 deletions(-) delete mode 100755 installer/copy-files.sh rename installer/{install.iss => install.iss.in} (95%) diff --git a/.gitignore b/.gitignore index 161feb8..6556c1a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,10 @@ *.swp /git-extra/pkg/ /git-extra/src/ +/installer/install.iss +/installer/install.out /installer/is-unicode.exe +/installer/file-list.iss /portable/root/cmd/ /portable/root/git-bash.bat /portable/root/git-cmd.bat diff --git a/installer/copy-files.sh b/installer/copy-files.sh deleted file mode 100755 index 7bcf022..0000000 --- a/installer/copy-files.sh +++ /dev/null @@ -1,111 +0,0 @@ -#!/bin/bash - -test -z "$1" && { - echo "Usage: $0 " - exit 1 -} - -test -d doc/git/html/.git || -(git submodule update --init doc/git/html/) || { - echo "Error: html pages in /doc/git/html/ missing" - exit 1 -} - -if test "$( cd doc/git/html/ ; git config core.autocrlf )" != "true" -then - echo "Error: documentation must be checked out with core.autocrlf=true." - echo "If you have changes in the documentation, hit Ctrl-C NOW." - sleep 3 - (cd doc/git/html && - git config core.autocrlf true && - rm -rf *.html *.txt howto && - git checkout -f) || { - echo "Could not fix documentation" - exit 1 - } -fi - -SCRIPTDIR="$(cd "$(dirname "$0")" && pwd)" -MSYSGITROOT="$(cd $SCRIPTDIR/../../ && pwd | sed 's/\/$//')/." -TMPDIR=$1 - -(test ! -d "$TMPDIR" || echo "Removing $TMPDIR" && rm -rf "$TMPDIR") && -mkdir "$TMPDIR" && -cd "$TMPDIR" && -echo "Copying files" && -(git --git-dir=$MSYSGITROOT/doc/git/html/.git log --pretty=format:%s -1 HEAD && - mkdir -p doc/git/html && cd doc/git/html && - git --git-dir=$MSYSGITROOT/doc/git/html/.git archive HEAD | tar xf -) && -(cd $MSYSGITROOT && tar cf - \ -$(ls {bin,libexec/git-core}/git* | grep -v 'cvs\|shell\|archimport\|instaweb') \ -bin/{antiword.exe,docx2txt,astextplain,awk,basename.exe,bash.exe,bison.exe,yacc,\ -bunzip2,bzip2.exe,c_rehash,\ -cat.exe,chmod.exe,clear,cmp.exe,cp.exe,cut.exe,cvs.exe,date.exe,diff.exe,\ -dirname.exe,\ -du.exe,echo,egrep,env.exe,expr.exe,false.exe,find.exe,flex.exe,gawk.exe,grep.exe,\ -head.exe,id.exe,kill.exe,less.exe,libW11.dll,ln.exe,\ -ls.exe,m4.exe,md5sum.exe,mkdir.exe,msys-1.0.dll,msysltdl-3.dll,mv.exe,patch.exe,\ -patch.exe.manifest,perl.exe,printf,ps.exe,pwd,recodetree,rm.exe,rmdir.exe,rxvt.exe,\ -scp.exe,sed.exe,sh.exe,sh.VisualElementsManifest.xml,sleep.exe,sort.exe,split.exe,\ -ssh-agent.exe,ssh.exe,ssh-add.exe,ssh-keygen.exe,ssh-keyscan.exe,\ -tail.exe,tar.exe,tee.exe,touch.exe,tr.exe,true.exe,uname.exe,uniq.exe,\ -unzip.exe,vi,wish.VisualElementsManifest.xml,\ -msys-perl5_8.dll,lib{apr,aprutil,expat,neon,z,svn}*.dll,pthreadGC2.dll,\ -msys-crypto-1.0.0.dll,msys-regex-1.dll,msys-ssl-1.0.0.dll,msys-minires.dll,msys-z.dll,\ -vim,vimtutor,wc.exe,which,xargs.exe,start} lib/engines/ \ -ssl/ cmd/ lib/perl5/ libexec/git-core/mergetools share/antiword/ share/bison/ share/git* \ -share/vim/vimrc share/vim/vim74/{filetype.vim,ftoff.vim,menu.vim,optwin.vim,\ -scripts.vim,\ -autoload/netrw.vim,autoload/netrwFileHandlers.vim,autoload/netrwSettings.vim,\ -plugin/netrwPlugin.vim,\ -syntax/c.vim,syntax/conf.vim,syntax/cpp.vim,syntax/diff.vim,\ -syntax/gitcommit.vim,syntax/gitconfig.vim,syntax/gitrebase.vim,syntax/git.vim,\ -syntax/nosyntax.vim,syntax/syncolor.vim,syntax/synload.vim,syntax/syntax.vim,\ -tutor/,vim.exe}) | -tar xf - && -rm -rf bin/cvs.exe && -(test ! -f $MSYSGITROOT/lib/Git.pm || cp -u $MSYSGITROOT/lib/Git.pm lib/perl5/site_perl/Git.pm) && -(test ! -d $MSYSGITROOT/lib/Git || cp -uR $MSYSGITROOT/lib/Git lib/perl5/site_perl/Git) && -test -f lib/perl5/site_perl/Git.pm && -gitmd5=$(md5sum bin/git.exe | cut -c 1-32) && -mkdir etc && -md5sum {bin,libexec/git-core}/git-*.exe libexec/git-core/git.exe | -sed -n -r "s/^$gitmd5\s+\*?(.*)/\1/p" > etc/fileList-builtins.txt && -rm $(cat etc/fileList-builtins.txt) && # rm builtins - if needed we'll restore them after strip -(cd $MSYSGITROOT/mingw && tar cf - \ - bin/*{tcl,tk,wish,gpg,msmtp,curl.exe,*.crt}* bin/connect.exe bin/iconv.exe \ - bin/dos2unix.exe bin/unix2dos.exe bin/hd2u.exe bin/openssl.exe \ - bin/*{libcurl,libcrypto,libssl,libgsasl,libiconv,libintl}* \ - bin/getcp.exe bin/rebase.exe \ - bin/gzip.exe bin/gunzip.exe \ - bin/{libpoppler-7.dll,pdfinfo.exe,pdftotext.exe} \ - lib/{tcl,tk,dde,reg}* ) | -tar xf - && -strip bin/{[a-fh-z],g[a-oq-z]}*.exe libexec/git-core/*.exe && -if test -n "$DONT_REMOVE_BUILTINS" -then - # restore builtins after git.exe was stripped - # (for PE, strip embeds current time into file header, and if we just - # pass all git builtins to strip the result will be lots of - # not-bit-exact exe's) - for b in $(cat etc/fileList-builtins.txt); do - ln bin/git.exe $b - done -fi && -cp $MSYSGITROOT/git/contrib/completion/git-completion.bash etc/ && -cp $MSYSGITROOT/git/contrib/completion/git-prompt.sh etc/ && -cp $MSYSGITROOT/etc/termcap etc/ && -cp $MSYSGITROOT/etc/inputrc etc/ && -sed 's/ = \/mingw\// = \//' < $MSYSGITROOT/etc/gitconfig > etc/gitconfig && -cp $MSYSGITROOT/etc/gitattributes etc/ && -cp $MSYSGITROOT/share/WinGit/Git\ Bash.vbs . && -mkdir git-cheetah && -cp $MSYSGITROOT/src/git-cheetah/explorer/git_shell_ext.dll git-cheetah/ && -cp $MSYSGITROOT/src/git-cheetah/explorer/git_shell_ext64.dll git-cheetah/ && -cp $MSYSGITROOT/share/WinGit/ReleaseNotes.rtf . && -sed 's@/git/contrib/completion@/etc@g' \ - < $MSYSGITROOT/etc/profile > etc/profile && -cp $MSYSGITROOT/share/resources/git.ico etc/ && -cp $MSYSGITROOT/share/resources/git.ico share/git-gui/lib/git-gui.ico && -find bin libexec -iname \*.exe -o -iname \*.dll | sort > etc/fileList-bindimage.txt || -exit 1 diff --git a/installer/install.iss b/installer/install.iss.in similarity index 95% rename from installer/install.iss rename to installer/install.iss.in index 06b8707..aef458f 100644 --- a/installer/install.iss +++ b/installer/install.iss.in @@ -7,8 +7,9 @@ #else #define APP_VERSION '%APPVERSION%' #endif -#define APP_URL 'http://msysgit.github.io/' -#define APP_BUILTINS 'etc\fileList-builtins.txt' +#define MINGW_BITNESS '%MINGW_BITNESS%' +#define APP_URL 'http://git-for-windows.github.io/' +#define APP_BUILTINS 'share\git\builtins.txt' #define APP_BINDIMAGE 'etc\fileList-bindimage.txt' #define PLINK_PATH_ERROR_MSG 'Please enter a valid path to a Plink executable.' @@ -22,6 +23,7 @@ LZMAUseSeparateProcess=yes OutputBaseFilename={#APP_NAME+'-'+APP_VERSION} OutputDir={#GetEnv('USERPROFILE')} SolidCompression=yes +SourceDir={#GetEnv('ROOTDIR')} #ifdef COMPILE_FROM_IDE SourceDir={#GetEnv('TEMP')}\WinGit #endif @@ -39,7 +41,7 @@ DisableDirPage=auto DefaultGroupName={#APP_NAME} DisableProgramGroupPage=auto DisableReadyPage=yes -InfoBeforeFile=gpl-2.0.rtf +InfoBeforeFile={#GetEnv('SCRIPTDIR')}\gpl-2.0.rtf PrivilegesRequired=none UninstallDisplayIcon={app}\etc\git.ico #ifndef COMPILE_FROM_IDE @@ -51,11 +53,11 @@ VersionInfoVersion={#APP_VERSION} #endif ; Cosmetic -SetupIconFile=etc\git.ico +SetupIconFile={#GetEnv('SCRIPTDIR')}\git.ico WizardImageBackColor=clWhite WizardImageStretch=no -WizardImageFile=git.bmp -WizardSmallImageFile=gitsmall.bmp +WizardImageFile={#GetEnv('SCRIPTDIR')}\git.bmp +WizardSmallImageFile={#GetEnv('SCRIPTDIR')}\gitsmall.bmp [Types] ; Define a custom type to avoid getting the three default types. @@ -76,11 +78,13 @@ Name: consolefont; Description: Use a TrueType font in all console windows (not [Files] ; Install files that might be in use during setup under a different name. -Source: git-cheetah\git_shell_ext.dll; DestDir: {app}\git-cheetah; DestName: git_shell_ext.dll.new; Flags: replacesameversion; Components: ext\cheetah; AfterInstall: DeleteFromVirtualStore -Source: git-cheetah\git_shell_ext64.dll; DestDir: {app}\git-cheetah; DestName: git_shell_ext64.dll.new; Flags: replacesameversion; Components: ext\cheetah; AfterInstall: DeleteFromVirtualStore +;Source: git-cheetah\git_shell_ext.dll; DestDir: {app}\git-cheetah; DestName: git_shell_ext.dll.new; Flags: replacesameversion; Components: ext\cheetah; AfterInstall: DeleteFromVirtualStore +;Source: git-cheetah\git_shell_ext64.dll; DestDir: {app}\git-cheetah; DestName: git_shell_ext64.dll.new; Flags: replacesameversion; Components: ext\cheetah; AfterInstall: DeleteFromVirtualStore +#include "file-list.iss" +Source: {#GetEnv('SCRIPTDIR')}\ReleaseNotes.rtf; DestDir: {app}; Flags: isreadme replacesameversion; AfterInstall: DeleteFromVirtualStore -Source: *; DestDir: {app}; Excludes: \*.bmp, gpl-2.0.rtf, \*.iss, \tmp.*, \bin\*install*, \git-cheetah\git_shell_ext.dll, \git-cheetah\git_shell_ext64.dll; Flags: recursesubdirs replacesameversion sortfilesbyextension; AfterInstall: DeleteFromVirtualStore -Source: ReleaseNotes.rtf; DestDir: {app}; Flags: isreadme replacesameversion; AfterInstall: DeleteFromVirtualStore +[Dirs] +Name: "{app}\tmp" [Icons] Name: {group}\Git GUI; Filename: {app}\bin\wish.exe; Parameters: """{app}\libexec\git-core\git-gui"""; WorkingDir: %HOMEDRIVE%%HOMEPATH%; IconFilename: {app}\etc\git.ico @@ -156,7 +160,7 @@ Type: files; Name: {app}\libexec\git-core\git-*.exe Type: files; Name: {app}\libexec\git-core\git.exe ; Delete any (temporary) git-cheetah files. -Type: files; Name: {app}\git-cheetah\*.* +;Type: files; Name: {app}\git-cheetah\*.* ; Delete any manually created shortcuts. Type: files; Name: {userappdata}\Microsoft\Internet Explorer\Quick Launch\Git Bash.lnk @@ -949,7 +953,7 @@ begin } // Load the built-ins from a text file. - FileName:=AppDir+'\{#APP_BUILTINS}'; + FileName:=AppDir+'\{#MINGW_BITNESS}\{#APP_BUILTINS}'; if LoadStringsFromFile(FileName,BuiltIns) then begin Count:=GetArrayLength(BuiltIns)-1; @@ -1001,7 +1005,7 @@ begin FindClose(FindRec); end; end else begin - Msg:='Line {#__LINE__}: Unable to read file "{#APP_BUILTINS}".'; + Msg:='Line {#__LINE__}: Unable to read file "{#MINGW_BITNESS}\{#APP_BUILTINS}".'; // This is in fact a critical error, but "Abort" does not work during ssPostInstall anymore and // we have no other way of aborting the installation, so just notify the user and continue. @@ -1020,8 +1024,8 @@ begin end else begin Cmd:='core.autocrlf false'; end; - if not Exec(AppDir + '\bin\git.exe', 'config -f gitconfig ' + Cmd, - AppDir + '\etc', SW_HIDE, ewWaitUntilTerminated, i) then begin + if not Exec(AppDir + '\{#MINGW_BITNESS}\bin\git.exe', 'config -f gitconfig ' + Cmd, + AppDir + '\{#MINGW_BITNESS}\etc', SW_HIDE, ewWaitUntilTerminated, i) then begin Msg:='Unable to configure the line ending conversion: ' + Cmd; // This is not a critical error, so just notify the user and continue. diff --git a/installer/release.sh b/installer/release.sh index 4888fa5..ba68c80 100755 --- a/installer/release.sh +++ b/installer/release.sh @@ -1,7 +1,11 @@ #!/bin/bash +die () { + echo "$*" >&2 + exit 1 +} + force= -do_compile=t while test $# -gt 0 do case "$1" in @@ -9,164 +13,78 @@ do force=t shift ;; - -n|--no-compile) - do_compile= - shift - ;; *) break esac done -test -z "$1" && { - echo "Usage: $0 [-f] [-n] " >&2 - exit 1 -} +test $# -gt 0 || +die "Usage: $0 [-f] " version=$1 -# change directory to msysGit root -SCRIPTDIR="$(cd "$(dirname "$0")" && pwd)" -MSYSGITROOT="$(cd $SCRIPTDIR/../../ && pwd | sed 's/\/$//')/." -cd $MSYSGITROOT || { - echo "Could not change directory to msysGit root" >&2 - exit 1 -} +# change directory to the script's directory +cd "$(dirname "$0")" || +die "Could not switch directory" -test -z "$force" && { - die () { - echo "$*" >&2 - echo "If that is okay, please call '$0 -f $version'" >&2 - exit 1 - } +# Export paths to inno setup file +SCRIPTDIR="$(pwd -W)" +ROOTDIR="$(cd / && pwd -W)" +export SCRIPTDIR ROOTDIR - (cd git && - git update-index --refresh && - git diff-files --quiet && - git diff-index --cached HEAD --) || - die "Git submodule has dirty files" - (git update-index --refresh && - git diff-files --quiet && - git diff-index --cached HEAD --) || - die "msysGit super project not up-to-date" -} +# Evaluate architecture +ARCH="$(uname -m)" -create_msysgit_tag () { - if tag=$(git describe --exact-match --match "*.msysgit.*" HEAD 2> /dev/null) - then - echo "Using existing tag $tag" - else - i=0 && - tag=$(git describe HEAD | cut -d- -f1) && - tag=${tag%.msysgit.*} && - while ! git tag -a -m "Git for Windows $1" $tag.msysgit.$i 2> /dev/null +case "$ARCH" in +i686) + BITNESS=32 + ;; +x86_64) + BITNESS=64 + ;; +*) + die "Unhandled architecture: $ARCH" + ;; +esac + +# Generate list of files to include +pacman_list () { + pacman -Ql $(for arg do - i=$(($i+1)) - done && - echo "Created tag $tag.msysgit.$i" - fi + pactree -u "$arg" + done | + sort | + uniq) | + grep -v '/$' | + sed 's/^[^ ]* //' } -# compile everything needed for standard setup -test "$do_compile" && { - wordpad share/WinGit/ReleaseNotes.rtf && { - ( # create a commit if ReleaseNotes changed - if test ! -z "$(git diff share/WinGit/ReleaseNotes.rtf)" - then - git add share/WinGit/ReleaseNotes.rtf && - git commit -m "Git for Windows $version" - fi) && - (cd git && - create_msysgit_tag $version && - make install) && - (cd git/contrib/subtree && - make install INSTALL=/bin/install prefix=) && - (cd git/contrib/credential/wincred && - make install INSTALL=/bin/install prefix=) && - /src/mingw-w64/release-easy.sh && - /src/mingw-w64/release-zlib.sh && - (cd src/git-cheetah/explorer/ && - make objects-clean && make && - make objects-clean && make W64=1) - } || exit 1 -} +LIST="$(pacman_list mingw-w64-$ARCH-git git-extra ncurses mintty vim \ + sed awk less grep gnupg findutils coreutils \ + dos2unix which subversion | + grep -v -e '\.[acho]$' -e '/aclocal/' \ + -e '/man/' \ + -e '^/usr/include/' -e '^/mingw32/include/' \ + -e '^/usr/share/doc/' -e '^/mingw32/share/doc/' \ + -e '^/usr/share/info/' -e '^/mingw32/share/info/' | + sed 's/^\///')" -test -z "$force" && { - die () { - echo "$*" >&2 - echo "If that is okay, please call '$0 -f $version'" >&2 - exit 1 - } +LIST="$LIST etc/profile etc/bash.bash_logout etc/bash.bashrc etc/fstab" +LIST="$LIST mingw$BITNESS/etc/gitconfig" - (cd git && - git update-index --refresh && - git diff-files --quiet && - git diff-index --cached HEAD --) || - die "Git submodule has dirty files" - (cd git && - test git.exe = $((printf 'git.exe\0'; git ls-files -z) | xargs --null ls -t 2>/dev/null| head -1)) || - die "Git's git.exe is not up-to-date (run 'cd /git && make' to fix)" - for f in bin/git* libexec/git-core/git* - do - case "$f" in - *.manifest) - continue - ;; - */gitk) - basename=gitk-git/gitk - ;; - */git-citool|*/git-gui) - basename=git-gui/git-gui - ;; - */git-gui--askpass|*/git-gui--askyesno|*/git-gui.tcl) - basename=git-gui/$(basename "$f") - ;; - */git-subtree) - basename=contrib/subtree/$(basename "$f") - ;; - */git-credential-wincred.exe) - basename=contrib/credential/wincred/$(basename "$f") - ;; - *) - basename=$(basename "$f") - ;; - esac - cmp "$f" "git/$basename" || - die "Installed Git disagrees with contents of /git/ ($f)" - done - (git update-index --refresh && - git diff-files --quiet && - git diff-index --cached HEAD --) || - die "msysGit super project not up-to-date" - (cd git && - test ! -z "$(git tag --contains HEAD)") || - die "Git's HEAD is untagged" -} +rm -rf file-list.iss +for f in $LIST +do + printf 'Source: %s; DestDir: {app}\%s; Flags: %s; AfterInstall: %s\n' \ + $f $(dirname $f) replacesameversion DeleteFromVirtualStore \ + >> file-list.iss +done -TMPDIR=/tmp/WinGit -unset DONT_REMOVE_BUILTINS +sed -e "s|%APPVERSION%|$version|" -e "s|%MINGW_BITNESS%|mingw$BITNESS|" < install.iss.in > install.iss || +exit -$MSYSGITROOT/share/WinGit/copy-files.sh $TMPDIR && -sed -e '/share\/msysGit/d' -e "s/msysGit/Git (version $version)/" \ - < etc/motd > $TMPDIR/etc/motd && -cp share/resources/gpl-2.0.rtf share/resources/git.bmp share/resources/gitsmall.bmp $TMPDIR && -sed -e "s/%APPVERSION%/$version/" \ - < share/WinGit/install.iss > $TMPDIR/install.iss && -cp share/WinGit/*.inc.iss $TMPDIR && echo "Launching Inno Setup compiler ..." && -(cd $TMPDIR && - if test -x $MSYSGITROOT/share/InnoSetup/ISCC.exe - then - $MSYSGITROOT/share/InnoSetup/ISCC.exe install.iss - else - case $(wine --version) in - 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]-*) - echo "You need at least WINE version 1.3.15" >&2 && - exit 1 - esac && - wine $MSYSGITROOT/share/InnoSetup/ISCC.exe install.iss - fi > /tmp/install.out && - echo $? > /tmp/install.status) && -(test 0 = "$(cat /tmp/install.status)") && +./InnoSetup/ISCC.exe install.iss > install.out || +die "Could not make installer" git tag -a -m "Git for Windows $1" Git-$1 && -echo "Installer is available as $(tail -n 1 /tmp/install.out)" +echo "Installer is available as $(tail -n 1 install.out)"