summary refs log tree commit diff
path: root/pkgs/tools/typesetting/asciidoctor/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/tools/typesetting/asciidoctor/default.nix')
-rw-r--r--pkgs/tools/typesetting/asciidoctor/default.nix35
1 files changed, 34 insertions, 1 deletions
diff --git a/pkgs/tools/typesetting/asciidoctor/default.nix b/pkgs/tools/typesetting/asciidoctor/default.nix
index 02b57ee3a13..f8cfe44cbd7 100644
--- a/pkgs/tools/typesetting/asciidoctor/default.nix
+++ b/pkgs/tools/typesetting/asciidoctor/default.nix
@@ -1,4 +1,8 @@
-{ stdenv, lib, bundlerApp, ruby, curl }:
+{ stdenv, lib, bundlerApp, ruby, curl
+  # Dependencies of the 'mathematical' package
+, cmake, bison, flex, glib, pkgconfig, cairo
+, pango, gdk_pixbuf, libxml2, python3, patchelf
+}:
 
 bundlerApp {
   inherit ruby;
@@ -11,8 +15,37 @@ bundlerApp {
     "asciidoctor-latex"
     "asciidoctor-pdf"
     "asciidoctor-safe"
+    "asciidoctor-mathematical"
   ];
 
+  gemConfig = {
+    mathematical = attrs: {
+      buildInputs = [
+        cmake
+        bison
+        flex
+        glib
+        pkgconfig
+        cairo
+        pango
+        gdk_pixbuf
+        libxml2
+        python3
+      ];
+
+      # The ruby build script takes care of this
+      dontUseCmakeConfigure = true;
+
+      # For some reason 'mathematical.so' is missing cairo and glib in its RPATH, add them explicitly here
+      postFixup = lib.optionalString stdenv.isLinux ''
+        soPath="$out/lib/ruby/gems/2.4.0/gems/mathematical-${attrs.version}/lib/mathematical/mathematical.so"
+        ${patchelf}/bin/patchelf \
+          --set-rpath "${lib.makeLibraryPath [ glib cairo ]}:$(${patchelf}/bin/patchelf --print-rpath "$soPath")" \
+          "$soPath"
+      '';
+    };
+  };
+
   meta = with lib; {
     description = "A faster Asciidoc processor written in Ruby";
     homepage = http://asciidoctor.org/;