about summary refs log tree commit diff
path: root/pkgs/development/interpreters/erlang/generic-builder.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/interpreters/erlang/generic-builder.nix')
-rw-r--r--pkgs/development/interpreters/erlang/generic-builder.nix16
1 files changed, 16 insertions, 0 deletions
diff --git a/pkgs/development/interpreters/erlang/generic-builder.nix b/pkgs/development/interpreters/erlang/generic-builder.nix
index 6e9373b4a5636..32d1466f326e4 100644
--- a/pkgs/development/interpreters/erlang/generic-builder.nix
+++ b/pkgs/development/interpreters/erlang/generic-builder.nix
@@ -18,9 +18,11 @@
 , libGLU ? null
 , wxGTK ? null
 , xorg ? null
+, exdoc ? null
 , parallelBuild ? false
 , systemd
 , wxSupport ? true
+, exdocSupport ? false
 , systemdSupport ? lib.meta.availableOn stdenv.hostPlatform systemd # systemd support in epmd
   # updateScript deps
 , writeScript
@@ -77,6 +79,7 @@ else libGL != null && libGLU != null && wxGTK != null && xorg != null);
 
 assert odbcSupport -> unixODBC != null;
 assert javacSupport -> openjdk11 != null;
+assert exdocSupport -> exdoc != null;
 
 let
   inherit (lib) optional optionals optionalAttrs optionalString;
@@ -114,8 +117,21 @@ stdenv.mkDerivation ({
     ${postPatch}
   '';
 
+  # For OTP 27+ we need ex_doc to build the documentation
+  # When exdocSupport is enabled, grab the raw ex_doc executable from the exdoc
+  # derivation. Next, patch the first line to use the escript that will be
+  # built during the build phase of this derivation. Finally, building the
+  # documentation requires the erlang-logo.png asset.
   preConfigure = ''
     ./otp_build autoconf
+  '' + optionalString exdocSupport ''
+    mkdir -p $out/bin
+    cp ${exdoc}/bin/.ex_doc-wrapped $out/bin/ex_doc
+    sed -i "1 s:^.*$:#!$out/bin/escript:" $out/bin/ex_doc
+    export EX_DOC=$out/bin/ex_doc
+
+    mkdir -p $out/lib/erlang/system/doc/assets
+    cp $src/system/doc/assets/erlang-logo.png $out/lib/erlang/system/doc/assets
   '';
 
   configureFlags = [ "--with-ssl=${lib.getOutput "out" opensslPackage}" ]