at 23.11-beta 79 lines 2.2 kB view raw
1{ pname, version, src, gitSrc, buildInputs ? [] 2, homepage, description, maintainers 3}: 4 5{ lib, stdenv, openssl, zlib, asciidoc, libxml2, libxslt 6, docbook_xsl, pkg-config 7, coreutils, gnused, groff, docutils 8, gzip, bzip2, lzip, xz, zstd 9, python3Packages 10}: 11 12stdenv.mkDerivation { 13 inherit pname version src gitSrc; 14 15 nativeBuildInputs = [ 16 pkg-config asciidoc 17 ] ++ (with python3Packages; [ python wrapPython ]); 18 buildInputs = buildInputs ++ [ 19 openssl zlib libxml2 libxslt docbook_xsl 20 ]; 21 pythonPath = with python3Packages; [ pygments markdown ]; 22 23 postPatch = '' 24 sed -e 's|"gzip"|"${gzip}/bin/gzip"|' \ 25 -e 's|"bzip2"|"${bzip2.bin}/bin/bzip2"|' \ 26 -e 's|"lzip"|"${lzip}/bin/lzip"|' \ 27 -e 's|"xz"|"${xz.bin}/bin/xz"|' \ 28 -e 's|"zstd"|"${zstd}/bin/zstd"|' \ 29 -i ui-snapshot.c 30 31 substituteInPlace filters/html-converters/man2html \ 32 --replace 'groff' '${groff}/bin/groff' 33 34 substituteInPlace filters/html-converters/rst2html \ 35 --replace 'rst2html.py' '${docutils}/bin/rst2html.py' 36 ''; 37 38 # Give cgit a git source tree and pass configuration parameters (as make 39 # variables). 40 preBuild = '' 41 mkdir -p git 42 tar --strip-components=1 -xf "$gitSrc" -C git 43 ''; 44 45 makeFlags = [ 46 "prefix=$(out)" 47 "CGIT_SCRIPT_PATH=$(out)/cgit/" 48 "CC=${stdenv.cc.targetPrefix}cc" 49 "AR=${stdenv.cc.targetPrefix}ar" 50 ]; 51 52 # Install manpage. 53 postInstall = '' 54 # xmllint fails: 55 #make install-man 56 57 # bypassing xmllint works: 58 a2x --no-xmllint -f manpage cgitrc.5.txt 59 mkdir -p "$out/share/man/man5" 60 cp cgitrc.5 "$out/share/man/man5" 61 62 wrapPythonProgramsIn "$out/lib/cgit/filters" "$out $pythonPath" 63 64 for script in $out/lib/cgit/filters/*.sh $out/lib/cgit/filters/html-converters/txt2html; do 65 wrapProgram $script --prefix PATH : '${lib.makeBinPath [ coreutils gnused ]}' 66 done 67 ''; 68 69 stripDebugList = [ "cgit" ]; 70 71 enableParallelBuilding = true; 72 73 meta = { 74 inherit homepage description; 75 license = lib.licenses.gpl2; 76 platforms = lib.platforms.linux; 77 maintainers = maintainers ++ (with lib.maintainers; [ qyliss ]); 78 }; 79}