2008-06-11 13:31:44 +01:00
|
|
|
{ fetchurl, stdenv, curl, openssl, zlib, expat, perl, gettext, cpio
|
2009-11-03 15:57:31 +00:00
|
|
|
, asciidoc, texinfo, xmlto, docbook2x, docbook_xsl, docbook_xml_dtd_45
|
2008-05-22 09:06:52 +01:00
|
|
|
, libxslt, tcl, tk, makeWrapper
|
2008-06-11 13:31:44 +01:00
|
|
|
, svnSupport, subversion, perlLibs
|
|
|
|
, guiSupport
|
|
|
|
}:
|
2008-05-22 09:06:52 +01:00
|
|
|
|
|
|
|
# `git-svn' support requires Subversion and various Perl libraries.
|
2008-08-03 13:23:27 +01:00
|
|
|
assert svnSupport -> (subversion != null && perlLibs != [] && subversion.perlBindings);
|
2008-05-22 09:06:52 +01:00
|
|
|
|
2007-11-14 21:41:01 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2010-02-13 17:39:25 +00:00
|
|
|
name = "git-1.6.6.2";
|
2007-04-26 17:14:01 +01:00
|
|
|
|
|
|
|
src = fetchurl {
|
2007-11-14 21:41:01 +00:00
|
|
|
url = "mirror://kernel/software/scm/git/${name}.tar.bz2";
|
2010-02-13 17:39:25 +00:00
|
|
|
sha256 = "01waixqdyalm42r54bj9z3xhp8v3ll2yd1c9sad67q1njflap0ab";
|
2007-04-26 17:14:01 +01:00
|
|
|
};
|
|
|
|
|
2009-12-12 18:10:26 +00:00
|
|
|
patches = [ ./docbook2texi.patch ];
|
2008-03-12 15:21:45 +00:00
|
|
|
|
2008-06-11 13:31:44 +01:00
|
|
|
buildInputs = [curl openssl zlib expat gettext cpio makeWrapper]
|
2008-03-11 14:07:58 +00:00
|
|
|
++ # documentation tools
|
|
|
|
[ asciidoc texinfo xmlto docbook2x
|
2009-11-03 15:57:31 +00:00
|
|
|
docbook_xsl docbook_xml_dtd_45 libxslt ]
|
2008-06-11 13:31:44 +01:00
|
|
|
++ stdenv.lib.optionals guiSupport [tcl tk];
|
2007-04-26 17:14:01 +01:00
|
|
|
|
2008-06-11 13:31:44 +01:00
|
|
|
makeFlags = "prefix=\${out} PERL_PATH=${perl}/bin/perl SHELL_PATH=${stdenv.shell}";
|
2007-11-14 21:41:01 +00:00
|
|
|
|
2008-08-22 22:35:25 +01:00
|
|
|
# FIXME: "make check" requires Sparse; the Makefile must be tweaked
|
|
|
|
# so that `SPARSE_FLAGS' corresponds to the current architecture...
|
|
|
|
#doCheck = true;
|
|
|
|
|
2008-02-22 16:51:51 +00:00
|
|
|
postInstall =
|
2008-06-11 13:31:44 +01:00
|
|
|
''
|
2008-07-03 13:51:23 +01:00
|
|
|
notSupported(){
|
|
|
|
echo -e "#\!/bin/sh\necho '`basename $1` not supported, $2'\nexit 1" > "$1"
|
|
|
|
chmod +x $1
|
|
|
|
}
|
|
|
|
|
2008-06-11 13:31:44 +01:00
|
|
|
# Install Emacs mode.
|
|
|
|
echo "installing Emacs mode..."
|
|
|
|
ensureDir $out/share/emacs/site-lisp
|
|
|
|
cp -p contrib/emacs/*.el $out/share/emacs/site-lisp
|
|
|
|
'' # */
|
2008-06-28 16:22:31 +01:00
|
|
|
|
2008-05-19 19:29:07 +01:00
|
|
|
+ (if svnSupport then
|
|
|
|
|
|
|
|
''# wrap git-svn
|
2009-04-23 00:04:18 +01:00
|
|
|
gitperllib=$out/lib/perl5/site_perl
|
2008-05-19 19:29:07 +01:00
|
|
|
for i in ${builtins.toString perlLibs}; do
|
2009-04-23 00:04:18 +01:00
|
|
|
gitperllib=$gitperllib:$i/lib/perl5/site_perl
|
2008-05-19 19:29:07 +01:00
|
|
|
done
|
2008-08-22 22:35:25 +01:00
|
|
|
wrapProgram "$out/libexec/git-core/git-svn" \
|
2008-06-11 13:31:44 +01:00
|
|
|
--set GITPERLLIB "$gitperllib" \
|
|
|
|
--prefix PATH : "${subversion}/bin" ''
|
2008-07-03 13:51:23 +01:00
|
|
|
else '' # replace git-svn by notification script
|
|
|
|
notSupported $out/bin/git-svn "reinstall with config git = { svnSupport = true } set"
|
|
|
|
'')
|
2008-05-22 09:06:52 +01:00
|
|
|
|
2008-03-11 14:07:58 +00:00
|
|
|
+ ''# Install man pages and Info manual
|
|
|
|
make PERL_PATH="${perl}/bin/perl" cmd-list.made install install-info \
|
2008-03-15 20:52:21 +00:00
|
|
|
-C Documentation ''
|
|
|
|
|
2008-06-11 13:31:44 +01:00
|
|
|
+ (if guiSupport then ''
|
|
|
|
# Wrap Tcl/Tk programs
|
2008-08-22 22:35:25 +01:00
|
|
|
for prog in bin/gitk libexec/git-core/git-gui
|
2008-04-12 13:52:31 +01:00
|
|
|
do
|
2008-08-22 22:35:25 +01:00
|
|
|
wrapProgram "$out/$prog" \
|
2008-06-11 13:31:44 +01:00
|
|
|
--set TK_LIBRARY "${tk}/lib/tk8.4" \
|
|
|
|
--prefix PATH : "${tk}/bin"
|
|
|
|
done
|
2008-07-03 13:51:23 +01:00
|
|
|
'' else ''
|
2008-08-22 22:35:25 +01:00
|
|
|
# Don't wrap Tcl/Tk, replace them by notification scripts
|
|
|
|
for prog in bin/gitk libexec/git-core/git-gui
|
2008-07-03 13:51:23 +01:00
|
|
|
do
|
2008-08-22 22:35:25 +01:00
|
|
|
notSupported "$out/$prog" \
|
2009-01-13 16:36:47 +00:00
|
|
|
"reinstall with config git = { guiSupport = true; } set"
|
2008-07-03 13:51:23 +01:00
|
|
|
done
|
|
|
|
'')
|
2008-04-10 23:12:11 +01:00
|
|
|
|
2008-08-07 18:30:35 +01:00
|
|
|
+ ''# install bash completion script
|
|
|
|
d="$out/etc/bash_completion.d"
|
|
|
|
ensureDir $d; cp contrib/completion/git-completion.bash "$d"
|
2009-09-27 00:33:11 +01:00
|
|
|
''
|
2009-10-20 15:08:58 +01:00
|
|
|
# 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!
|
2009-09-27 00:33:11 +01:00
|
|
|
+ ''#
|
|
|
|
declare -A seen
|
|
|
|
find $out -type f | while read f; do
|
|
|
|
sum=$(md5sum "$f");
|
|
|
|
sum=''\${sum/ */}
|
|
|
|
if [ -z "''\${seen["$sum"]}" ]; then
|
|
|
|
seen["$sum"]="$f"
|
|
|
|
else
|
|
|
|
rm "$f"; ln -s "''\${seen["$sum"]}" "$f"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2008-08-07 18:30:35 +01:00
|
|
|
'';
|
2008-02-20 10:29:32 +00:00
|
|
|
|
2007-11-14 21:41:01 +00:00
|
|
|
meta = {
|
2008-02-20 10:29:32 +00:00
|
|
|
license = "GPLv2";
|
2010-01-18 16:07:48 +00:00
|
|
|
homepage = http://git-scm.com/;
|
2008-03-30 23:19:20 +01:00
|
|
|
description = "Git, a popular distributed version control system";
|
|
|
|
|
|
|
|
longDescription = ''
|
|
|
|
Git, a popular distributed version control system designed to
|
|
|
|
handle very large projects with speed and efficiency.
|
|
|
|
'';
|
|
|
|
|
2010-01-18 16:07:48 +00:00
|
|
|
maintainers =
|
|
|
|
[ # Add your name here!
|
|
|
|
stdenv.lib.maintainers.ludo
|
2010-02-18 00:28:15 +00:00
|
|
|
stdenv.lib.maintainers.simons
|
2010-01-18 16:07:48 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
platforms = stdenv.lib.platforms.gnu; # arbitrary choice
|
2007-11-14 21:41:01 +00:00
|
|
|
};
|
2007-04-26 17:14:01 +01:00
|
|
|
}
|