16 self = stdenv.mkDerivation rec {
20 src = fetchFromGitLab {
24 hash = "sha256-UxbgYspocoy9ul2dhIhvIwqKMeWSG7vJY1df3UkgpHQ=";
27 enableParallelBuilding = true;
33 ] ++ lib.optional stdenv.hostPlatform.isDarwin gcc;
44 substituteInPlace src/makefile \
45 --replace "shell pkg-config" "shell $PKG_CONFIG"
46 substituteInPlace makefile \
47 --replace 'gzip' 'gzip -n'
49 + lib.optionalString stdenv.cc.isClang ''
50 substituteInPlace src/makefile \
51 --replace 'CXX=g++' 'CXX=clang++'
55 makeFlags="PREFIX=$out conf_dir=$out/etc/highlight/ CXX=$CXX AR=$AR"
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
64 postCheck = lib.optionalString (!stdenv.hostPlatform.isDarwin) ''
65 perl -Iextras/swig extras/swig/testmod.pl
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.
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 = with maintainers; [ willibutz ];
84 if stdenv.hostPlatform.isDarwin then self else perl.pkgs.toPerlModule self