1{ 2 pname, 3 version, 4 src, 5 gitSrc, 6 buildInputs ? [ ], 7 homepage, 8 description, 9 maintainers, 10 passthru ? { }, 11}: 12 13{ 14 lib, 15 stdenv, 16 openssl, 17 zlib, 18 asciidoc, 19 libxml2, 20 libxslt, 21 docbook_xsl, 22 pkg-config, 23 coreutils, 24 gnused, 25 groff, 26 docutils, 27 gzip, 28 bzip2, 29 lzip, 30 xz, 31 zstd, 32 python3Packages, 33}: 34 35stdenv.mkDerivation { 36 inherit 37 pname 38 version 39 src 40 gitSrc 41 passthru 42 ; 43 44 separateDebugInfo = true; 45 46 nativeBuildInputs = [ 47 pkg-config 48 asciidoc 49 ] 50 ++ (with python3Packages; [ 51 python 52 wrapPython 53 ]); 54 buildInputs = buildInputs ++ [ 55 openssl 56 zlib 57 libxml2 58 libxslt 59 docbook_xsl 60 ]; 61 pythonPath = with python3Packages; [ 62 pygments 63 markdown 64 ]; 65 66 postPatch = '' 67 sed -e 's|"gzip"|"${gzip}/bin/gzip"|' \ 68 -e 's|"bzip2"|"${bzip2.bin}/bin/bzip2"|' \ 69 -e 's|"lzip"|"${lzip}/bin/lzip"|' \ 70 -e 's|"xz"|"${xz.bin}/bin/xz"|' \ 71 -e 's|"zstd"|"${zstd}/bin/zstd"|' \ 72 -i ui-snapshot.c 73 74 substituteInPlace filters/html-converters/man2html \ 75 --replace 'groff' '${groff}/bin/groff' 76 77 substituteInPlace filters/html-converters/rst2html \ 78 --replace 'rst2html.py' '${docutils}/bin/rst2html.py' 79 ''; 80 81 # Give cgit a git source tree and pass configuration parameters (as make 82 # variables). 83 preBuild = '' 84 mkdir -p git 85 tar --strip-components=1 -xf "$gitSrc" -C git 86 ''; 87 88 makeFlags = [ 89 "prefix=$(out)" 90 "CGIT_SCRIPT_PATH=$(out)/cgit/" 91 "CC=${stdenv.cc.targetPrefix}cc" 92 "AR=${stdenv.cc.targetPrefix}ar" 93 ]; 94 95 # Install manpage. 96 postInstall = '' 97 # xmllint fails: 98 #make install-man 99 100 # bypassing xmllint works: 101 a2x --no-xmllint -f manpage cgitrc.5.txt 102 mkdir -p "$out/share/man/man5" 103 cp cgitrc.5 "$out/share/man/man5" 104 105 wrapPythonProgramsIn "$out/lib/cgit/filters" "$out $pythonPath" 106 107 for script in $out/lib/cgit/filters/*.sh $out/lib/cgit/filters/html-converters/txt2html; do 108 wrapProgram $script --prefix PATH : '${ 109 lib.makeBinPath [ 110 coreutils 111 gnused 112 ] 113 }' 114 done 115 ''; 116 117 stripDebugList = [ "cgit" ]; 118 119 enableParallelBuilding = true; 120 121 meta = { 122 inherit homepage description; 123 license = lib.licenses.gpl2; 124 platforms = lib.platforms.linux; 125 maintainers = maintainers ++ (with lib.maintainers; [ qyliss ]); 126 }; 127}