From 836658e7210e6277b8091e86ca65c6a756e6881e Mon Sep 17 00:00:00 2001 From: Adam Stephens Date: Fri, 6 Sep 2024 09:57:17 -0400 Subject: [PATCH] beam-packages: add nodocs target for building ex_doc on 27+ --- .../interpreters/erlang/generic-builder.nix | 14 +++++++------- pkgs/top-level/all-packages.nix | 6 ++++++ pkgs/top-level/beam-packages.nix | 7 ++++--- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/pkgs/development/interpreters/erlang/generic-builder.nix b/pkgs/development/interpreters/erlang/generic-builder.nix index ff8aadf90980..b5502a036247 100644 --- a/pkgs/development/interpreters/erlang/generic-builder.nix +++ b/pkgs/development/interpreters/erlang/generic-builder.nix @@ -19,11 +19,11 @@ , libGLU ? null , wxGTK ? null , xorg ? null -, exdoc ? null +, ex_doc ? null , parallelBuild ? false , systemd , wxSupport ? true -, exdocSupport ? false +, ex_docSupport ? false , systemdSupport ? lib.meta.availableOn stdenv.hostPlatform systemd # systemd support in epmd # updateScript deps , writeScript @@ -64,7 +64,7 @@ , installPhase ? "" , preInstall ? "" , postInstall ? "" -, installTargets ? [ "install" "install-docs" ] +, installTargets ? if ((lib.versionOlder version "27.0") || ex_docSupport) then [ "install" "install-docs" ] else [ "install" ] , checkPhase ? "" , preCheck ? "" , postCheck ? "" @@ -80,7 +80,7 @@ else libGL != null && libGLU != null && wxGTK != null && xorg != null); assert odbcSupport -> unixODBC != null; assert javacSupport -> openjdk11 != null; -assert exdocSupport -> exdoc != null; +assert ex_docSupport -> ex_doc != null; let inherit (lib) optional optionals optionalAttrs optionalString; @@ -122,15 +122,15 @@ stdenv.mkDerivation ({ ''; # For OTP 27+ we need ex_doc to build the documentation - # When exdocSupport is enabled, grab the raw ex_doc executable from the exdoc + # When ex_docSupport is enabled, grab the raw ex_doc executable from the ex_doc # 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 '' + '' + optionalString ex_docSupport '' mkdir -p $out/bin - cp ${exdoc}/bin/.ex_doc-wrapped $out/bin/ex_doc + cp ${ex_doc}/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 diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index e69ca4d78f5b..b70715f5f36e 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -16529,6 +16529,12 @@ with pkgs; wxSupport = false; systemdSupport = false; }; + beam_nodocs = callPackage ./beam-packages.nix { + beam = beam_nodocs; + wxSupport = false; + systemdSupport = false; + ex_docSupport = false; + }; inherit (beam.interpreters) erlang erlang_27 erlang_26 erlang_25 erlang_24 diff --git a/pkgs/top-level/beam-packages.nix b/pkgs/top-level/beam-packages.nix index 45900c8b06e2..6da5b2218d5e 100644 --- a/pkgs/top-level/beam-packages.nix +++ b/pkgs/top-level/beam-packages.nix @@ -1,9 +1,11 @@ { lib , beam +, beam_nodocs , callPackage , wxGTK32 , buildPackages , stdenv +, ex_docSupport ? true , wxSupport ? true , systemd , systemdSupport ? lib.meta.availableOn stdenv.hostPlatform systemd @@ -30,9 +32,8 @@ in wxGTK = wxGTK32; parallelBuild = true; autoconf = buildPackages.autoconf269; - exdocSupport = true; - exdoc = self.packages.erlang_26.ex_doc; - inherit wxSupport systemdSupport; + inherit (beam_nodocs.packages.erlang_27) ex_doc; + inherit ex_docSupport wxSupport systemdSupport; }; erlang_26 = self.beamLib.callErlang ../development/interpreters/erlang/26.nix {