3
0
Fork 0
forked from mirrors/nixpkgs

git: fix build on FreeBSD

Our hard-linking code depended on md5sum, which FreeBSD doesn't have in its
system environment. To avoid that impure dependency, the hard-linking is now
done with the 'hardlink' utility from Nixpkgs.
This commit is contained in:
Peter Simons 2013-03-25 12:21:45 +01:00
parent 16863d8ffe
commit ab98d72fad
2 changed files with 10 additions and 30 deletions
pkgs/applications/version-management/git-and-tools

View file

@ -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;
cpio tcl tk makeWrapper subversionClient hardlink;
svnSupport = false; # for git-svn support
guiSupport = false; # requires tcl/tk
sendEmailSupport = false; # requires plenty of perl libraries

View file

@ -1,6 +1,6 @@
{ fetchurl, stdenv, curl, openssl, zlib, expat, perl, python, gettext, cpio, gnugrep
, asciidoc, texinfo, xmlto, docbook2x, docbook_xsl, docbook_xml_dtd_45
, libxslt, tcl, tk, makeWrapper
, libxslt, tcl, tk, makeWrapper, hardlink
, svnSupport, subversionClient, perlLibs, smtpPerlLibs
, guiSupport
, withManual ? true
@ -111,46 +111,26 @@ stdenv.mkDerivation {
notSupported "$out/$prog" \
"reinstall with config git = { guiSupport = true; } set"
done
'')
'');
# 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
'';
# 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";
enableParallelBuilding = true;
meta = {
license = "GPLv2";
homepage = http://git-scm.com/;
homepage = "http://git-scm.com/";
description = "Git, a popular distributed version control system";
license = stdenv.lib.licenses.gpl2Plus;
longDescription = ''
Git, a popular distributed version control system designed to
handle very large projects with speed and efficiency.
'';
maintainers =
[ # Add your name here!
stdenv.lib.maintainers.ludo
stdenv.lib.maintainers.simons
];
platforms = stdenv.lib.platforms.all;
maintainers = [ stdenv.lib.maintainers.ludo stdenv.lib.maintainers.simons ];
};
}