about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/typesetting/asciidoctor/default.nix
blob: 760cc41609e5ecd9b1b2f453385d38358c4b05fd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
{ stdenv, lib, bundlerApp, ruby
  # Dependencies of the 'mathematical' package
, cmake, bison, flex, glib, pkgconfig, cairo
, pango, gdk_pixbuf, libxml2, python3, patchelf
}:

bundlerApp {
  inherit ruby;
  pname = "asciidoctor";
  gemdir = ./.;

  exes = [
    "asciidoctor"
    "asciidoctor-pdf"
    "asciidoctor-safe"
  ];

  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/${ruby.gemPath}/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 = https://asciidoctor.org/;
    license = licenses.mit;
    maintainers = with maintainers; [ gpyh ];
    platforms = platforms.unix;
  };
}