mirror of
https://github.com/SebastianWendel/nixpkgs.git
synced 2024-09-21 21:09:00 +02:00
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.
This commit is contained in:
parent
6ee8bca8ee
commit
f2aaed44aa
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
version = "1.8.2";
|
version = "1.8.2.1";
|
||||||
|
|
||||||
svn = subversionClient.override { perlBindings = true; };
|
svn = subversionClient.override { perlBindings = true; };
|
||||||
|
|
||||||
|
@ -21,10 +21,10 @@ stdenv.mkDerivation {
|
||||||
|
|
||||||
src = fetchurl {
|
src = fetchurl {
|
||||||
url = "http://git-core.googlecode.com/files/git-${version}.tar.gz";
|
url = "http://git-core.googlecode.com/files/git-${version}.tar.gz";
|
||||||
sha256 = "1rhkya4kfs7iayasgj3bk8zg1pfk3h7wqhfy9d6aaqjgzb75pwy2";
|
sha1 = "ad9f833e509ba31c83efe336fd3599e89a39394b";
|
||||||
};
|
};
|
||||||
|
|
||||||
patches = [ ./docbook2texi.patch ];
|
patches = [ ./docbook2texi.patch ./symlinks-in-bin.patch ];
|
||||||
|
|
||||||
buildInputs = [curl openssl zlib expat gettext cpio makeWrapper]
|
buildInputs = [curl openssl zlib expat gettext cpio makeWrapper]
|
||||||
++ stdenv.lib.optionals withManual [ asciidoc texinfo xmlto docbook2x
|
++ stdenv.lib.optionals withManual [ asciidoc texinfo xmlto docbook2x
|
||||||
|
@ -41,6 +41,8 @@ stdenv.mkDerivation {
|
||||||
# so that `SPARSE_FLAGS' corresponds to the current architecture...
|
# so that `SPARSE_FLAGS' corresponds to the current architecture...
|
||||||
#doCheck = true;
|
#doCheck = true;
|
||||||
|
|
||||||
|
installFlags = "NO_INSTALL_HARDLINKS=1";
|
||||||
|
|
||||||
postInstall =
|
postInstall =
|
||||||
''
|
''
|
||||||
notSupported() {
|
notSupported() {
|
||||||
|
@ -116,27 +118,7 @@ stdenv.mkDerivation {
|
||||||
notSupported "$out/$prog" \
|
notSupported "$out/$prog" \
|
||||||
"reinstall with config git = { guiSupport = true; } set"
|
"reinstall with config git = { guiSupport = true; } set"
|
||||||
done
|
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
|
|
||||||
'';
|
|
||||||
|
|
||||||
enableParallelBuilding = true;
|
enableParallelBuilding = true;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
diff -ru -x '*~' git-1.8.2.1-orig/Makefile git-1.8.2.1/Makefile
|
||||||
|
--- git-1.8.2.1-orig/Makefile 2013-04-08 00:52:04.000000000 +0200
|
||||||
|
+++ git-1.8.2.1/Makefile 2013-04-22 15:46:42.906026940 +0200
|
||||||
|
@@ -2319,8 +2319,7 @@
|
||||||
|
{ test "$$bindir/" = "$$execdir/" || \
|
||||||
|
for p in git$X $(filter $(install_bindir_programs),$(ALL_PROGRAMS)); do \
|
||||||
|
$(RM) "$$execdir/$$p" && \
|
||||||
|
- test -z "$(NO_INSTALL_HARDLINKS)$(NO_CROSS_DIRECTORY_HARDLINKS)" && \
|
||||||
|
- ln "$$bindir/$$p" "$$execdir/$$p" 2>/dev/null || \
|
||||||
|
+ ln -s "$$bindir/$$p" "$$execdir/$$p" 2>/dev/null || \
|
||||||
|
cp "$$bindir/$$p" "$$execdir/$$p" || exit; \
|
||||||
|
done; \
|
||||||
|
} && \
|
Loading…
Reference in a new issue