git: Properly use symlinks instead of hard links

Git's Makefile has a NO_INSTALL_HARDLINKS flag to produce symlinks
instead of hard links. However, it still produces hard links between
$out/bin and $out/libexec, hence the patch.

Also, update Git to 1.8.2.1.

+19 -24
+6 -24
pkgs/applications/version-management/git-and-tools/git/default.nix
··· 10 10 11 11 let 12 12 13 - version = "1.8.2"; 13 + version = "1.8.2.1"; 14 14 15 15 svn = subversionClient.override { perlBindings = true; }; 16 16 ··· 21 21 22 22 src = fetchurl { 23 23 url = "http://git-core.googlecode.com/files/git-${version}.tar.gz"; 24 - sha256 = "1rhkya4kfs7iayasgj3bk8zg1pfk3h7wqhfy9d6aaqjgzb75pwy2"; 24 + sha1 = "ad9f833e509ba31c83efe336fd3599e89a39394b"; 25 25 }; 26 26 27 - patches = [ ./docbook2texi.patch ]; 27 + patches = [ ./docbook2texi.patch ./symlinks-in-bin.patch ]; 28 28 29 29 buildInputs = [curl openssl zlib expat gettext cpio makeWrapper] 30 30 ++ stdenv.lib.optionals withManual [ asciidoc texinfo xmlto docbook2x ··· 40 40 # FIXME: "make check" requires Sparse; the Makefile must be tweaked 41 41 # so that `SPARSE_FLAGS' corresponds to the current architecture... 42 42 #doCheck = true; 43 + 44 + installFlags = "NO_INSTALL_HARDLINKS=1"; 43 45 44 46 postInstall = 45 47 '' ··· 116 118 notSupported "$out/$prog" \ 117 119 "reinstall with config git = { guiSupport = true; } set" 118 120 done 119 - '') 120 - 121 - # Don't know why hardlinks aren't created. git installs the same executable 122 - # multiple times into $out so replace duplicates by symlinks because I 123 - # haven't tested whether the nix distribution system can handle hardlinks. 124 - # This reduces the size of $out from 115MB down to 13MB on x86_64-linux! 125 - + '' 126 - declare -A seen 127 - shopt -s globstar 128 - for f in "$out/"**; do 129 - if [ -L "$f" ]; then continue; fi 130 - test -f "$f" || continue 131 - sum=$(md5sum "$f"); 132 - sum=''\${sum/ */} 133 - if [ -z "''\${seen["$sum"]}" ]; then 134 - seen["$sum"]="$f" 135 - else 136 - rm "$f"; ln -v -s "''\${seen["$sum"]}" "$f" 137 - fi 138 - done 139 - ''; 121 + ''); 140 122 141 123 enableParallelBuilding = true; 142 124