Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 84 lines 2.0 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitLab, 5 getopt, 6 lua, 7 boost, 8 libxcrypt, 9 pkg-config, 10 swig, 11 perl, 12 gcc, 13}: 14 15let 16 self = stdenv.mkDerivation rec { 17 pname = "highlight"; 18 version = "4.16"; 19 20 src = fetchFromGitLab { 21 owner = "saalen"; 22 repo = "highlight"; 23 rev = "v${version}"; 24 hash = "sha256-SAOlW2IaYY2GzQ+1FClqm62pcxdtf1cow2R4MRS/2Vg="; 25 }; 26 27 enableParallelBuilding = true; 28 29 nativeBuildInputs = [ 30 pkg-config 31 swig 32 perl 33 ] 34 ++ lib.optional stdenv.hostPlatform.isDarwin gcc; 35 36 buildInputs = [ 37 getopt 38 lua 39 boost 40 libxcrypt 41 ]; 42 43 postPatch = '' 44 substituteInPlace src/makefile \ 45 --replace "shell pkg-config" "shell $PKG_CONFIG" 46 substituteInPlace makefile \ 47 --replace 'gzip' 'gzip -n' 48 '' 49 + lib.optionalString stdenv.cc.isClang '' 50 substituteInPlace src/makefile \ 51 --replace 'CXX=g++' 'CXX=clang++' 52 ''; 53 54 preConfigure = '' 55 makeFlags="PREFIX=$out conf_dir=$out/etc/highlight/ CXX=$CXX AR=$AR" 56 ''; 57 58 # This has to happen _before_ the main build because it does a 59 # `make clean' for some reason. 60 preBuild = lib.optionalString (!stdenv.hostPlatform.isDarwin) '' 61 make -C extras/swig $makeFlags perl 62 ''; 63 64 postCheck = lib.optionalString (!stdenv.hostPlatform.isDarwin) '' 65 perl -Iextras/swig extras/swig/testmod.pl 66 ''; 67 68 preInstall = lib.optionalString (!stdenv.hostPlatform.isDarwin) '' 69 mkdir -p $out/${perl.libPrefix} 70 install -m644 extras/swig/highlight.{so,pm} $out/${perl.libPrefix} 71 make -C extras/swig clean # Clean up intermediate files. 72 ''; 73 74 meta = with lib; { 75 description = "Source code highlighting tool"; 76 mainProgram = "highlight"; 77 homepage = "http://www.andre-simon.de/doku/highlight/en/highlight.php"; 78 platforms = platforms.unix; 79 maintainers = [ ]; 80 }; 81 }; 82 83in 84if stdenv.hostPlatform.isDarwin then self else perl.pkgs.toPerlModule self