summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2013-04-22 15:26:26 +0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2013-04-22 15:26:26 +0200
commit6ee8bca8ee983416738720880a566c1203b7d25f (patch)
tree4594b8dff40aa5ae9952c2ef6acbf4d911a5e130
parent56b504a1cdbe85db70d30e07ddead608a887ec3d (diff)
downloadnixlib-6ee8bca8ee983416738720880a566c1203b7d25f.tar
nixlib-6ee8bca8ee983416738720880a566c1203b7d25f.tar.gz
nixlib-6ee8bca8ee983416738720880a566c1203b7d25f.tar.bz2
nixlib-6ee8bca8ee983416738720880a566c1203b7d25f.tar.lz
nixlib-6ee8bca8ee983416738720880a566c1203b7d25f.tar.xz
nixlib-6ee8bca8ee983416738720880a566c1203b7d25f.tar.zst
nixlib-6ee8bca8ee983416738720880a566c1203b7d25f.zip
Revert "git: fix build on FreeBSD"
This reverts commit ab98d72fad2c657836d36fe0ac2f7dac54f1b778, which
caused the size of the Git package in the store to increase from 18
MiB to 190 MiB.
-rw-r--r--pkgs/applications/version-management/git-and-tools/default.nix2
-rw-r--r--pkgs/applications/version-management/git-and-tools/git/default.nix31
2 files changed, 24 insertions, 9 deletions
diff --git a/pkgs/applications/version-management/git-and-tools/default.nix b/pkgs/applications/version-management/git-and-tools/default.nix
index 81362ec4d04d..a5aeb1bf6a41 100644
--- a/pkgs/applications/version-management/git-and-tools/default.nix
+++ b/pkgs/applications/version-management/git-and-tools/default.nix
@@ -10,7 +10,7 @@ rec {
   git = lib.makeOverridable (import ./git) {
     inherit fetchurl stdenv curl openssl zlib expat perl python gettext gnugrep
       asciidoc texinfo xmlto docbook2x docbook_xsl docbook_xml_dtd_45 libxslt
-      cpio tcl tk makeWrapper subversionClient hardlink gzip;
+      cpio tcl tk makeWrapper subversionClient gzip;
     svnSupport = false;		# for git-svn support
     guiSupport = false;		# requires tcl/tk
     sendEmailSupport = false;	# requires plenty of perl libraries
diff --git a/pkgs/applications/version-management/git-and-tools/git/default.nix b/pkgs/applications/version-management/git-and-tools/git/default.nix
index 30611f40f07b..47f38335c303 100644
--- a/pkgs/applications/version-management/git-and-tools/git/default.nix
+++ b/pkgs/applications/version-management/git-and-tools/git/default.nix
@@ -1,6 +1,6 @@
 { fetchurl, stdenv, curl, openssl, zlib, expat, perl, python, gettext, cpio, gnugrep, gzip
 , asciidoc, texinfo, xmlto, docbook2x, docbook_xsl, docbook_xml_dtd_45
-, libxslt, tcl, tk, makeWrapper, hardlink
+, libxslt, tcl, tk, makeWrapper
 , svnSupport, subversionClient, perlLibs, smtpPerlLibs
 , guiSupport
 , withManual ? true
@@ -116,17 +116,32 @@ stdenv.mkDerivation {
          notSupported "$out/$prog" \
                       "reinstall with config git = { guiSupport = true; } set"
        done
-     '');
-
-  # Git installs many copies of the same binary using hardlinks, but unfortunately
-  # our patchELF phase re-writes those files and destroys the hardlinks in the
-  # process. This utility re-generates them afterwards.
-  postFixup = "${hardlink}/bin/hardlink $out";
+     '')
+
+   # Don't know why hardlinks aren't created. git installs the same executable
+   # multiple times into $out so replace duplicates by symlinks because I
+   # haven't tested whether the nix distribution system can handle hardlinks.
+   # This reduces the size of $out from 115MB down to 13MB on x86_64-linux!
+   + ''
+      declare -A seen
+      shopt -s globstar
+      for f in "$out/"**; do
+        if [ -L "$f" ]; then continue; fi
+        test -f "$f" || continue
+        sum=$(md5sum "$f");
+        sum=''\${sum/ */}
+        if [ -z "''\${seen["$sum"]}" ]; then
+          seen["$sum"]="$f"
+        else
+          rm "$f"; ln -v -s "''\${seen["$sum"]}" "$f"
+        fi
+      done
+     '';
 
   enableParallelBuilding = true;
 
   meta = {
-    homepage = "http://git-scm.com/";
+    homepage = http://git-scm.com/;
     description = "Git, a popular distributed version control system";
     license = stdenv.lib.licenses.gpl2Plus;