2019-07-07 16:55:08 +01:00
|
|
|
{ stdenv, fetchurl, fetchpatch, openssl, zlib, asciidoc, libxml2, libxslt
|
2018-07-17 21:11:16 +01:00
|
|
|
, docbook_xsl, pkgconfig, luajit
|
2019-06-11 00:10:01 +01:00
|
|
|
, coreutils, gnused, groff, docutils
|
|
|
|
, gzip, bzip2, xz
|
2018-03-19 18:42:25 +00:00
|
|
|
, python, wrapPython, pygments, markdown
|
2014-01-19 21:46:53 +00:00
|
|
|
}:
|
2013-04-01 16:42:51 +01:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2014-04-13 06:47:14 +01:00
|
|
|
name = "cgit-${version}";
|
2018-08-08 23:57:46 +01:00
|
|
|
version = "1.2.1";
|
2013-04-01 16:42:51 +01:00
|
|
|
|
|
|
|
src = fetchurl {
|
2018-06-28 19:43:35 +01:00
|
|
|
url = "https://git.zx2c4.com/cgit/snapshot/${name}.tar.xz";
|
2018-08-08 23:57:46 +01:00
|
|
|
sha256 = "1gw2j5xc5qdx2hwiwkr8h6kgya7v9d9ff9j32ga1dys0cca7qm1w";
|
2013-04-01 16:42:51 +01:00
|
|
|
};
|
|
|
|
|
2014-05-17 10:01:57 +01:00
|
|
|
# cgit is tightly coupled with git and needs a git source tree to build.
|
2013-04-01 16:42:51 +01:00
|
|
|
# IMPORTANT: Remember to check which git version cgit needs on every version
|
2016-12-27 14:46:22 +00:00
|
|
|
# bump (look for "GIT_VER" in the top-level Makefile).
|
2013-04-01 16:42:51 +01:00
|
|
|
gitSrc = fetchurl {
|
2018-08-08 23:57:46 +01:00
|
|
|
url = "mirror://kernel/software/scm/git/git-2.18.0.tar.xz";
|
|
|
|
sha256 = "14hfwfkrci829a9316hnvkglnqqw1p03cw9k56p4fcb078wbwh4b";
|
2013-04-01 16:42:51 +01:00
|
|
|
};
|
|
|
|
|
2019-07-07 16:55:08 +01:00
|
|
|
patches = [
|
|
|
|
(fetchpatch {
|
|
|
|
name = "prevent-dos-limit-path-length.patch";
|
|
|
|
url = "https://git.zx2c4.com/cgit/patch/?id=54c407a74a35d4ee9ffae94cc5bc9096c9f7f54a";
|
|
|
|
sha256 = "1qlbpqsc293lmc9hzwf1j4jr5qlv8cm1r249v3yij5s4wki1595j";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2018-03-19 18:42:25 +00:00
|
|
|
nativeBuildInputs = [ pkgconfig ] ++ [ python wrapPython ];
|
2014-01-19 21:46:53 +00:00
|
|
|
buildInputs = [
|
2018-07-17 21:11:16 +01:00
|
|
|
openssl zlib asciidoc libxml2 libxslt docbook_xsl luajit
|
2014-01-19 21:46:53 +00:00
|
|
|
];
|
2018-03-19 18:42:25 +00:00
|
|
|
pythonPath = [ pygments markdown ];
|
2013-04-01 16:42:51 +01:00
|
|
|
|
2014-01-19 21:59:51 +00:00
|
|
|
postPatch = ''
|
|
|
|
sed -e 's|"gzip"|"${gzip}/bin/gzip"|' \
|
2016-02-01 18:45:57 +00:00
|
|
|
-e 's|"bzip2"|"${bzip2.bin}/bin/bzip2"|' \
|
2016-02-01 18:46:28 +00:00
|
|
|
-e 's|"xz"|"${xz.bin}/bin/xz"|' \
|
2014-01-19 21:59:51 +00:00
|
|
|
-i ui-snapshot.c
|
2018-09-09 13:37:30 +01:00
|
|
|
|
|
|
|
substituteInPlace filters/html-converters/man2html \
|
|
|
|
--replace 'groff' '${groff}/bin/groff'
|
2019-06-11 00:10:01 +01:00
|
|
|
|
|
|
|
substituteInPlace filters/html-converters/rst2html \
|
|
|
|
--replace 'rst2html.py' '${docutils}/bin/rst2html.py'
|
2014-01-19 21:59:51 +00:00
|
|
|
'';
|
|
|
|
|
2013-04-01 16:42:51 +01:00
|
|
|
# Give cgit a git source tree and pass configuration parameters (as make
|
|
|
|
# variables).
|
|
|
|
preBuild = ''
|
|
|
|
mkdir -p git
|
|
|
|
tar --strip-components=1 -xf "$gitSrc" -C git
|
|
|
|
|
|
|
|
makeFlagsArray+=(prefix="$out" CGIT_SCRIPT_PATH="$out/cgit/")
|
|
|
|
'';
|
|
|
|
|
|
|
|
# Install manpage.
|
|
|
|
postInstall = ''
|
|
|
|
# xmllint fails:
|
|
|
|
#make install-man
|
|
|
|
|
|
|
|
# bypassing xmllint works:
|
|
|
|
a2x --no-xmllint -f manpage cgitrc.5.txt
|
|
|
|
mkdir -p "$out/share/man/man5"
|
|
|
|
cp cgitrc.5 "$out/share/man/man5"
|
2018-03-19 18:42:25 +00:00
|
|
|
|
|
|
|
wrapPythonProgramsIn "$out/lib/cgit/filters" "$out $pythonPath"
|
2019-06-11 00:10:01 +01:00
|
|
|
|
|
|
|
for script in $out/lib/cgit/filters/*.sh $out/lib/cgit/filters/html-converters/txt2html; do
|
|
|
|
wrapProgram $script --prefix PATH : '${stdenv.lib.makeBinPath [ coreutils gnused ]}'
|
|
|
|
done
|
2013-04-01 16:42:51 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = {
|
2017-08-02 22:50:51 +01:00
|
|
|
homepage = https://git.zx2c4.com/cgit/about/;
|
2014-03-08 16:22:28 +00:00
|
|
|
repositories.git = git://git.zx2c4.com/cgit;
|
2013-04-01 16:42:51 +01:00
|
|
|
description = "Web frontend for git repositories";
|
|
|
|
license = stdenv.lib.licenses.gpl2;
|
|
|
|
platforms = stdenv.lib.platforms.linux;
|
|
|
|
maintainers = with stdenv.lib.maintainers; [ bjornfor ];
|
|
|
|
};
|
|
|
|
}
|