2020-05-15 21:57:56 +00:00
|
|
|
{ stdenv, fetchurl, openssl, zlib, asciidoc, libxml2, libxslt
|
2020-04-24 23:36:52 +00:00
|
|
|
, docbook_xsl, pkgconfig, luajit
|
|
|
|
, coreutils, gnused, groff, docutils
|
2020-05-15 21:57:56 +00:00
|
|
|
, gzip, bzip2, lzip, xz, zstd
|
2020-04-24 23:36:52 +00:00
|
|
|
, python, wrapPython, pygments, markdown
|
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "cgit";
|
2020-05-15 21:57:56 +00:00
|
|
|
version = "1.2.3";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://git.zx2c4.com/cgit/snapshot/${pname}-${version}.tar.xz";
|
2020-05-15 21:57:56 +00:00
|
|
|
sha256 = "193d990ym10qlslk0p8mjwp2j6rhqa7fq0y1iff65lvbyv914pss";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
# cgit is tightly coupled with git and needs a git source tree to build.
|
|
|
|
# IMPORTANT: Remember to check which git version cgit needs on every version
|
|
|
|
# bump (look for "GIT_VER" in the top-level Makefile).
|
|
|
|
gitSrc = fetchurl {
|
2020-05-15 21:57:56 +00:00
|
|
|
url = "mirror://kernel/software/scm/git/git-2.25.1.tar.xz";
|
|
|
|
sha256 = "09lzwa183nblr6l8ib35g2xrjf9wm9yhk3szfvyzkwivdv69c9r2";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ pkgconfig ] ++ [ python wrapPython ];
|
|
|
|
buildInputs = [
|
|
|
|
openssl zlib asciidoc libxml2 libxslt docbook_xsl luajit
|
|
|
|
];
|
|
|
|
pythonPath = [ pygments markdown ];
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
sed -e 's|"gzip"|"${gzip}/bin/gzip"|' \
|
|
|
|
-e 's|"bzip2"|"${bzip2.bin}/bin/bzip2"|' \
|
2020-05-15 21:57:56 +00:00
|
|
|
-e 's|"lzip"|"${lzip}/bin/lzip"|' \
|
2020-04-24 23:36:52 +00:00
|
|
|
-e 's|"xz"|"${xz.bin}/bin/xz"|' \
|
2020-05-15 21:57:56 +00:00
|
|
|
-e 's|"zstd"|"${zstd}/bin/zstd"|' \
|
2020-04-24 23:36:52 +00:00
|
|
|
-i ui-snapshot.c
|
|
|
|
|
|
|
|
substituteInPlace filters/html-converters/man2html \
|
|
|
|
--replace 'groff' '${groff}/bin/groff'
|
|
|
|
|
|
|
|
substituteInPlace filters/html-converters/rst2html \
|
|
|
|
--replace 'rst2html.py' '${docutils}/bin/rst2html.py'
|
|
|
|
'';
|
|
|
|
|
|
|
|
# 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"
|
|
|
|
|
|
|
|
wrapPythonProgramsIn "$out/lib/cgit/filters" "$out $pythonPath"
|
|
|
|
|
|
|
|
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
|
|
|
|
'';
|
|
|
|
|
2020-11-24 20:58:05 +00:00
|
|
|
stripDebugList = [ "cgit" ];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = {
|
|
|
|
homepage = "https://git.zx2c4.com/cgit/about/";
|
|
|
|
repositories.git = "git://git.zx2c4.com/cgit";
|
|
|
|
description = "Web frontend for git repositories";
|
|
|
|
license = stdenv.lib.licenses.gpl2;
|
|
|
|
platforms = stdenv.lib.platforms.linux;
|
|
|
|
maintainers = with stdenv.lib.maintainers; [ bjornfor ];
|
|
|
|
};
|
|
|
|
}
|