2021-01-15 13:21:58 +00:00
|
|
|
{ lib, stdenv, fetchurl, openssl, zlib, asciidoc, libxml2, libxslt
|
2021-01-19 06:50:56 +00:00
|
|
|
, docbook_xsl, pkg-config, luajit
|
2019-06-10 23:10:01 +00:00
|
|
|
, coreutils, gnused, groff, docutils
|
2020-05-09 17:20:06 +00:00
|
|
|
, gzip, bzip2, lzip, xz, zstd
|
2018-03-19 18:42:25 +00:00
|
|
|
, python, wrapPython, pygments, markdown
|
2014-01-19 21:46:53 +00:00
|
|
|
}:
|
2013-04-01 15:42:51 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 12:41:18 +00:00
|
|
|
pname = "cgit";
|
2020-05-09 17:20:06 +00:00
|
|
|
version = "1.2.3";
|
2013-04-01 15:42:51 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2019-08-15 12:41:18 +00:00
|
|
|
url = "https://git.zx2c4.com/cgit/snapshot/${pname}-${version}.tar.xz";
|
2020-05-09 17:20:06 +00:00
|
|
|
sha256 = "193d990ym10qlslk0p8mjwp2j6rhqa7fq0y1iff65lvbyv914pss";
|
2013-04-01 15:42:51 +00:00
|
|
|
};
|
|
|
|
|
2014-05-17 09:01:57 +00:00
|
|
|
# cgit is tightly coupled with git and needs a git source tree to build.
|
2013-04-01 15:42:51 +00: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 15:42:51 +00:00
|
|
|
gitSrc = fetchurl {
|
2020-05-09 17:20:06 +00:00
|
|
|
url = "mirror://kernel/software/scm/git/git-2.25.1.tar.xz";
|
|
|
|
sha256 = "09lzwa183nblr6l8ib35g2xrjf9wm9yhk3szfvyzkwivdv69c9r2";
|
2013-04-01 15:42:51 +00:00
|
|
|
};
|
|
|
|
|
2021-07-27 17:11:46 +00:00
|
|
|
nativeBuildInputs = [ pkg-config asciidoc ] ++ [ python wrapPython ];
|
2014-01-19 21:46:53 +00:00
|
|
|
buildInputs = [
|
2021-07-27 17:11:46 +00:00
|
|
|
openssl zlib 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 15:42:51 +00: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"|' \
|
2020-05-09 17:20:06 +00:00
|
|
|
-e 's|"lzip"|"${lzip}/bin/lzip"|' \
|
2016-02-01 18:46:28 +00:00
|
|
|
-e 's|"xz"|"${xz.bin}/bin/xz"|' \
|
2020-05-09 17:20:06 +00:00
|
|
|
-e 's|"zstd"|"${zstd}/bin/zstd"|' \
|
2014-01-19 21:59:51 +00:00
|
|
|
-i ui-snapshot.c
|
2018-09-09 12:37:30 +00:00
|
|
|
|
|
|
|
substituteInPlace filters/html-converters/man2html \
|
|
|
|
--replace 'groff' '${groff}/bin/groff'
|
2019-06-10 23:10:01 +00:00
|
|
|
|
|
|
|
substituteInPlace filters/html-converters/rst2html \
|
|
|
|
--replace 'rst2html.py' '${docutils}/bin/rst2html.py'
|
2014-01-19 21:59:51 +00:00
|
|
|
'';
|
|
|
|
|
2013-04-01 15:42:51 +00: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
|
|
|
|
'';
|
|
|
|
|
2021-07-27 17:11:46 +00:00
|
|
|
makeFlags = [
|
|
|
|
"prefix=$(out)"
|
2021-07-28 17:29:35 +00:00
|
|
|
"CGIT_SCRIPT_PATH=$(out)/cgit/"
|
2021-07-27 17:11:46 +00:00
|
|
|
"CC=${stdenv.cc.targetPrefix}cc"
|
|
|
|
"AR=${stdenv.cc.targetPrefix}ar"
|
|
|
|
];
|
|
|
|
|
2013-04-01 15:42:51 +00:00
|
|
|
# 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-10 23:10:01 +00:00
|
|
|
|
|
|
|
for script in $out/lib/cgit/filters/*.sh $out/lib/cgit/filters/html-converters/txt2html; do
|
2021-01-15 13:21:58 +00:00
|
|
|
wrapProgram $script --prefix PATH : '${lib.makeBinPath [ coreutils gnused ]}'
|
2019-06-10 23:10:01 +00:00
|
|
|
done
|
2013-04-01 15:42:51 +00:00
|
|
|
'';
|
|
|
|
|
2020-11-19 05:49:00 +00:00
|
|
|
stripDebugList = [ "cgit" ];
|
|
|
|
|
2013-04-01 15:42:51 +00:00
|
|
|
meta = {
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "https://git.zx2c4.com/cgit/about/";
|
|
|
|
repositories.git = "git://git.zx2c4.com/cgit";
|
2013-04-01 15:42:51 +00:00
|
|
|
description = "Web frontend for git repositories";
|
2021-01-15 13:21:58 +00:00
|
|
|
license = lib.licenses.gpl2;
|
|
|
|
platforms = lib.platforms.linux;
|
|
|
|
maintainers = with lib.maintainers; [ bjornfor ];
|
2013-04-01 15:42:51 +00:00
|
|
|
};
|
|
|
|
}
|