about summary refs log tree commit diff
path: root/nixpkgs
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2019-10-20 00:35:05 +0000
committerAlyssa Ross <hi@alyssa.is>2019-12-16 22:03:18 +0000
commiteb74f12f255fb760f1dc5254f6c53c53ae0be855 (patch)
tree63a68524ca3a576f9ba5f6b61d0bd4151784f75b /nixpkgs
parent886653f6768e21ac602e21218993382cf33254a0 (diff)
downloadnixlib-eb74f12f255fb760f1dc5254f6c53c53ae0be855.tar
nixlib-eb74f12f255fb760f1dc5254f6c53c53ae0be855.tar.gz
nixlib-eb74f12f255fb760f1dc5254f6c53c53ae0be855.tar.bz2
nixlib-eb74f12f255fb760f1dc5254f6c53c53ae0be855.tar.lz
nixlib-eb74f12f255fb760f1dc5254f6c53c53ae0be855.tar.xz
nixlib-eb74f12f255fb760f1dc5254f6c53c53ae0be855.tar.zst
nixlib-eb74f12f255fb760f1dc5254f6c53c53ae0be855.zip
highlight: export Perl bindings
Diffstat (limited to 'nixpkgs')
-rw-r--r--nixpkgs/pkgs/tools/text/highlight/default.nix33
1 files changed, 29 insertions, 4 deletions
diff --git a/nixpkgs/pkgs/tools/text/highlight/default.nix b/nixpkgs/pkgs/tools/text/highlight/default.nix
index eb86bc79d5c1..ed4f25c31afb 100644
--- a/nixpkgs/pkgs/tools/text/highlight/default.nix
+++ b/nixpkgs/pkgs/tools/text/highlight/default.nix
@@ -1,8 +1,9 @@
-{ stdenv, fetchFromGitLab, getopt, lua, boost, pkgconfig, gcc }:
+{ stdenv, fetchFromGitLab, fetchpatch
+, getopt, lua, boost, pkgconfig, swig, perl, gcc }:
 
 with stdenv.lib;
 
-stdenv.mkDerivation rec {
+perl.pkgs.toPerlModule (stdenv.mkDerivation rec {
   pname = "highlight";
   version = "3.53";
 
@@ -15,7 +16,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  nativeBuildInputs = [ pkgconfig ] ++ optional stdenv.isDarwin  gcc ;
+  nativeBuildInputs = [ pkgconfig swig perl ] ++ optional stdenv.isDarwin gcc;
 
   buildInputs = [ getopt lua boost ];
 
@@ -24,14 +25,38 @@ stdenv.mkDerivation rec {
         --replace 'CXX=g++' 'CXX=clang++'
   '';
 
+  patches = [
+    (fetchpatch {
+      url = "https://gitlab.com/saalen/highlight/commit/a6e9f5b28cdfee7141847e3b1bc392ff06be615d.patch";
+      sha256 = "0rjs1009a0x8bw0nzr05fn5a7df32h5y7r6691blkp2x6iw21nz2";
+    })
+  ];
+
   preConfigure = ''
     makeFlags="PREFIX=$out conf_dir=$out/etc/highlight/ CXX=$CXX AR=$AR"
   '';
 
+  # This has to happen _before_ the main build because it does a
+  # `make clean' for some reason.
+  preBuild = ''
+    make -C extras/swig $makeFlags perl
+  '';
+
+  doCheck = true;
+  postCheck = ''
+    perl -Iextras/swig extras/swig/testmod.pl
+  '';
+
+  preInstall = ''
+    mkdir -p $out/${perl.libPrefix}
+    install -m644 extras/swig/highlight.{so,pm} $out/${perl.libPrefix}
+    make -C extras/swig clean # Clean up intermediate files.
+  '';
+
   meta = with stdenv.lib; {
     description = "Source code highlighting tool";
     homepage = "http://www.andre-simon.de/doku/highlight/en/highlight.php";
     platforms = platforms.unix;
     maintainers = with maintainers; [ ndowens willibutz ];
   };
-}
+})