Home Subscribe Contact   
   
   
   
Tue, 27 Feb 2007

/compute/git with MinGW
Tue, 27 Feb 2007, 18:47

I compiled git with MinGW today. I got a little bit (read "a whole lot") of help from Johannes Schindelin. Thanks Johannes!

If git were ever to be a viable alternative for Inkscape we'd need a clear path to supporting our win32 bound developers. So I started looking into the issue. The git wiki lists four possible alternatives.

  1. via cygwin
  2. port with mingw
  3. an eclipse plugin in pure java
  4. shell integration ala TortoiseSVN with a libgit.dll
So far I've only found evidence that the first two exist.

I had my doubts at first, but cygwin might indeed be a workable option. It could be especially nice if someone would build a unified git-cygwin installer package in the same convenient way that has been done for OpenSSH for Windows. I've even found one claim by Martin Langhoff that git via cygwin is faster than svn or cvs native:

Note: At the time of writing, GIT does not run natively on MSWindows platforms. Several projects are underway to port GIT to Windows but they are not complete yet. It is possible to use git on Win32 via Cygwin, but with slightly worse performance (note: v1.4.5 has several performance enhancements on Cygwin) though even on Cygwin GIT is much faster than CVS or SVN. If you are bound to the W32 platform and cygwin doesn't work for you, Mercurial may be an alternative.
I haven't taken the time to try git via cygwin yet.

The mingw port of git lives on repo.or.cz. I downloaded a tarball from one of the "snapshot" links with firefox and stood aghast when 7zip wouldn't open it. It was named mingw*.tar.gz but really didn't look like a gzipped file in a hex editor. It was also 5 times larger than the tarball I pulled down with wget. Turns out firefox ungzipped it for me. IE7 ungzipped it for me too but named it mingw*.tar.tar. Renamed to *.tar, 7zip still didn't like it. There is some sort of posix header on the front of it. Command line tar unarchived it but not without complaining.

The README lists all the necessary deps. I had a pain in the neck finding regex-0.12.tar.gz until somebody offered me a version they had locally. The README could better cater to newbies, like myself, if it explicitly listed the commands necessary for compiling libregex. I commented out the subdirs line from the Makefile to skip building docs and tests, and stumbled upon `ar rcs libregex.a regex.o`. I think that works. I've uploaded a 7z of all of the deps. If you want to skip the dep chasing step unpack it to c:\mingw4git.

The compile and install went smoothly after I was instructed to add two dots to the Makefile, one on line 636 and one on line 882.

$ diff Makefile Makefile.dots 
636c636
<       $(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) git$X)), rm -f '$p';)
---
>       $(foreach p,$(patsubst %$X,%.,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) git$X)), rm -f '$p';)
882c882
<       $(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) git$X)), rm -f '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p';)
---
>       $(foreach p,$(patsubst %$X,%.,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) git$X)), rm -f '$(DESTDIR_SQ)$(gitexecdir_SQ)/$p';)

Next step? I guess I'll have to try using it to see if any of this actually worked. :-)

     
   
   
Home Subscribe Contact