2021-06-03 14:58:02 +02:00
|
|
|
{ pkgs
|
|
|
|
, lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, makeWrapper
|
|
|
|
, gawk
|
|
|
|
, gnum4
|
|
|
|
, gnused
|
|
|
|
, libxml2
|
|
|
|
, libxslt
|
|
|
|
, ncurses
|
|
|
|
, openssl
|
|
|
|
, perl
|
|
|
|
, autoconf
|
2021-02-13 21:56:48 +01:00
|
|
|
, openjdk11 ? null # javacSupport
|
2017-06-04 20:26:37 +02:00
|
|
|
, unixODBC ? null # odbcSupport
|
2021-06-03 14:58:02 +02:00
|
|
|
, libGL ? null
|
|
|
|
, libGLU ? null
|
|
|
|
, wxGTK ? null
|
|
|
|
, wxmac ? null
|
|
|
|
, xorg ? null
|
2020-06-10 20:02:50 +02:00
|
|
|
, parallelBuild ? false
|
2021-06-03 14:58:02 +02:00
|
|
|
, systemd
|
|
|
|
, wxSupport ? true
|
|
|
|
# updateScript deps
|
|
|
|
, writeScript
|
|
|
|
, common-updater-scripts
|
|
|
|
, coreutils
|
|
|
|
, git
|
2017-06-04 20:26:37 +02:00
|
|
|
}:
|
2017-06-07 23:21:14 +02:00
|
|
|
{ baseName ? "erlang"
|
|
|
|
, version
|
2017-06-04 20:26:37 +02:00
|
|
|
, sha256 ? null
|
|
|
|
, rev ? "OTP-${version}"
|
|
|
|
, src ? fetchFromGitHub { inherit rev sha256; owner = "erlang"; repo = "otp"; }
|
|
|
|
, enableHipe ? true
|
|
|
|
, enableDebugInfo ? false
|
2017-06-07 23:21:14 +02:00
|
|
|
, enableThreads ? true
|
|
|
|
, enableSmpSupport ? true
|
|
|
|
, enableKernelPoll ? true
|
2021-06-03 14:58:02 +02:00
|
|
|
, javacSupport ? false
|
|
|
|
, javacPackages ? [ openjdk11 ]
|
|
|
|
, odbcSupport ? false
|
|
|
|
, odbcPackages ? [ unixODBC ]
|
2020-12-23 23:36:58 +01:00
|
|
|
, withSystemd ? stdenv.isLinux # systemd support in epmd
|
2021-02-14 08:31:53 +01:00
|
|
|
, opensslPackage ? openssl
|
2021-01-31 12:24:24 +01:00
|
|
|
, wxPackages ? [ libGL libGLU wxGTK xorg.libX11 ]
|
2021-06-03 14:58:02 +02:00
|
|
|
, preUnpack ? ""
|
|
|
|
, postUnpack ? ""
|
|
|
|
, patches ? [ ]
|
|
|
|
, patchPhase ? ""
|
|
|
|
, prePatch ? ""
|
|
|
|
, postPatch ? ""
|
|
|
|
, configureFlags ? [ ]
|
|
|
|
, configurePhase ? ""
|
|
|
|
, preConfigure ? ""
|
|
|
|
, postConfigure ? ""
|
|
|
|
, buildPhase ? ""
|
|
|
|
, preBuild ? ""
|
|
|
|
, postBuild ? ""
|
|
|
|
, installPhase ? ""
|
|
|
|
, preInstall ? ""
|
|
|
|
, postInstall ? ""
|
2019-11-04 12:23:53 +01:00
|
|
|
, installTargets ? [ "install" "install-docs" ]
|
2021-06-03 14:58:02 +02:00
|
|
|
, checkPhase ? ""
|
|
|
|
, preCheck ? ""
|
|
|
|
, postCheck ? ""
|
|
|
|
, fixupPhase ? ""
|
|
|
|
, preFixup ? ""
|
|
|
|
, postFixup ? ""
|
|
|
|
, meta ? { }
|
2017-06-04 20:26:37 +02:00
|
|
|
}:
|
|
|
|
|
|
|
|
assert wxSupport -> (if stdenv.isDarwin
|
2021-06-03 14:58:02 +02:00
|
|
|
then wxmac != null
|
|
|
|
else libGL != null && libGLU != null && wxGTK != null && xorg != null);
|
2017-06-04 20:26:37 +02:00
|
|
|
|
|
|
|
assert odbcSupport -> unixODBC != null;
|
2021-02-13 21:56:48 +01:00
|
|
|
assert javacSupport -> openjdk11 != null;
|
2017-06-04 20:26:37 +02:00
|
|
|
|
|
|
|
let
|
2021-01-23 14:15:07 +01:00
|
|
|
inherit (lib) optional optionals optionalAttrs optionalString;
|
2017-06-04 20:26:37 +02:00
|
|
|
wxPackages2 = if stdenv.isDarwin then [ wxmac ] else wxPackages;
|
|
|
|
|
2021-06-03 14:58:02 +02:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation ({
|
2017-06-07 23:21:14 +02:00
|
|
|
name = "${baseName}-${version}"
|
2017-06-04 20:26:37 +02:00
|
|
|
+ optionalString javacSupport "-javac"
|
|
|
|
+ optionalString odbcSupport "-odbc";
|
|
|
|
|
|
|
|
inherit src version;
|
|
|
|
|
2019-06-17 09:54:44 +02:00
|
|
|
nativeBuildInputs = [ autoconf makeWrapper perl gnum4 libxslt libxml2 ];
|
2017-08-03 21:22:30 +02:00
|
|
|
|
2021-02-14 08:31:53 +01:00
|
|
|
buildInputs = [ ncurses opensslPackage ]
|
2017-06-04 20:26:37 +02:00
|
|
|
++ optionals wxSupport wxPackages2
|
|
|
|
++ optionals odbcSupport odbcPackages
|
|
|
|
++ optionals javacSupport javacPackages
|
2018-01-25 20:17:34 +01:00
|
|
|
++ optional withSystemd systemd
|
2021-02-28 20:58:22 +01:00
|
|
|
++ optionals stdenv.isDarwin (with pkgs.darwin.apple_sdk.frameworks; [ AGL Carbon Cocoa WebKit ]);
|
2017-06-04 20:26:37 +02:00
|
|
|
|
|
|
|
debugInfo = enableDebugInfo;
|
|
|
|
|
erlang: disable parallel building
This fixes build errors like
GEN asn1ct_eval_ext.erl
{"init terminating in do_boot",{undef,[{asn1ct_func,start_link,[],[]},{prepare_templates,gen_asn1ct_eval,1,[{file,"prepare_templates.erl"},{line,58}]},{init,start_em,1,[]},{init,do_boot,3,[]}]}}
init terminating in do_boot ({undef,[{asn1ct_func,start_link,[],[]},{prepare_templates,gen_asn1ct_eval,1,[{_},{_}]},{init,start_em,1,[]},{init,do_boot,3,[]}]})
that occur on some machines but not others.
2018-12-07 02:10:03 +01:00
|
|
|
# On some machines, parallel build reliably crashes on `GEN asn1ct_eval_ext.erl` step
|
2020-06-10 20:02:50 +02:00
|
|
|
enableParallelBuilding = parallelBuild;
|
2018-08-22 22:58:32 +02:00
|
|
|
|
2017-06-04 20:26:37 +02:00
|
|
|
postPatch = ''
|
2017-06-07 23:21:14 +02:00
|
|
|
patchShebangs make
|
2018-03-22 17:41:59 +01:00
|
|
|
|
|
|
|
${postPatch}
|
2017-06-04 20:26:37 +02:00
|
|
|
'';
|
|
|
|
|
|
|
|
preConfigure = ''
|
|
|
|
./otp_build autoconf
|
|
|
|
'';
|
|
|
|
|
2021-05-12 15:27:31 +02:00
|
|
|
configureFlags = [ "--with-ssl=${lib.getOutput "out" opensslPackage}" ]
|
|
|
|
++ [ "--with-ssl-incl=${lib.getDev opensslPackage}" ] # This flag was introduced in R24
|
2017-06-07 23:21:14 +02:00
|
|
|
++ optional enableThreads "--enable-threads"
|
|
|
|
++ optional enableSmpSupport "--enable-smp-support"
|
|
|
|
++ optional enableKernelPoll "--enable-kernel-poll"
|
2017-06-04 20:26:37 +02:00
|
|
|
++ optional enableHipe "--enable-hipe"
|
|
|
|
++ optional javacSupport "--with-javac"
|
|
|
|
++ optional odbcSupport "--with-odbc=${unixODBC}"
|
|
|
|
++ optional wxSupport "--enable-wx"
|
2018-01-25 20:17:34 +01:00
|
|
|
++ optional withSystemd "--enable-systemd"
|
2020-08-30 11:41:14 +02:00
|
|
|
++ optional stdenv.isDarwin "--enable-darwin-64bit"
|
|
|
|
++ configureFlags;
|
2017-06-04 20:26:37 +02:00
|
|
|
|
|
|
|
# install-docs will generate and install manpages and html docs
|
|
|
|
# (PDFs are generated only when fop is available).
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
ln -s $out/lib/erlang/lib/erl_interface*/bin/erl_call $out/bin/erl_call
|
2018-03-22 17:41:59 +01:00
|
|
|
|
|
|
|
${postInstall}
|
2017-06-04 20:26:37 +02:00
|
|
|
'';
|
|
|
|
|
|
|
|
# Some erlang bin/ scripts run sed and awk
|
|
|
|
postFixup = ''
|
|
|
|
wrapProgram $out/lib/erlang/bin/erl --prefix PATH ":" "${gnused}/bin/"
|
2021-01-23 14:15:07 +01:00
|
|
|
wrapProgram $out/lib/erlang/bin/start_erl --prefix PATH ":" "${lib.makeBinPath [ gnused gawk ]}"
|
2017-06-04 20:26:37 +02:00
|
|
|
'';
|
|
|
|
|
2021-04-12 19:59:37 +02:00
|
|
|
passthru = {
|
|
|
|
updateScript =
|
|
|
|
let major = builtins.head (builtins.splitVersion version);
|
2021-06-03 14:58:02 +02:00
|
|
|
in
|
|
|
|
writeScript "update.sh" ''
|
|
|
|
#!${stdenv.shell}
|
|
|
|
set -ox errexit
|
|
|
|
PATH=${lib.makeBinPath [ common-updater-scripts coreutils git gnused ]}
|
|
|
|
latest=$(list-git-tags https://github.com/erlang/otp.git | sed -n 's/^OTP-${major}/${major}/p' | sort -V | tail -1)
|
|
|
|
if [ "$latest" != "${version}" ]; then
|
|
|
|
nixpkgs="$(git rev-parse --show-toplevel)"
|
|
|
|
nix_file="$nixpkgs/pkgs/development/interpreters/erlang/R${major}.nix"
|
|
|
|
update-source-version ${baseName}R${major} "$latest" --version-key=version --print-changes --file="$nix_file"
|
|
|
|
else
|
|
|
|
echo "${baseName}R${major} is already up-to-date"
|
|
|
|
fi
|
|
|
|
'';
|
2021-04-12 19:59:37 +02:00
|
|
|
};
|
|
|
|
|
2021-01-23 14:15:07 +01:00
|
|
|
meta = with lib; ({
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "https://www.erlang.org/";
|
2019-07-10 21:52:51 +02:00
|
|
|
downloadPage = "https://www.erlang.org/download.html";
|
2017-06-04 20:26:37 +02:00
|
|
|
description = "Programming language used for massively scalable soft real-time systems";
|
|
|
|
|
|
|
|
longDescription = ''
|
|
|
|
Erlang is a programming language used to build massively scalable
|
|
|
|
soft real-time systems with requirements on high availability.
|
|
|
|
Some of its uses are in telecoms, banking, e-commerce, computer
|
|
|
|
telephony and instant messaging. Erlang's runtime system has
|
|
|
|
built-in support for concurrency, distribution and fault
|
|
|
|
tolerance.
|
|
|
|
'';
|
|
|
|
|
2019-12-23 03:27:52 +01:00
|
|
|
platforms = platforms.unix;
|
2021-01-23 21:25:40 +01:00
|
|
|
maintainers = teams.beam.members;
|
2017-06-04 20:26:37 +02:00
|
|
|
license = licenses.asl20;
|
2017-12-08 12:49:47 +01:00
|
|
|
} // meta);
|
2017-06-04 20:26:37 +02:00
|
|
|
}
|
2021-06-03 14:58:02 +02:00
|
|
|
// optionalAttrs (preUnpack != "") { inherit preUnpack; }
|
|
|
|
// optionalAttrs (postUnpack != "") { inherit postUnpack; }
|
|
|
|
// optionalAttrs (patches != [ ]) { inherit patches; }
|
|
|
|
// optionalAttrs (prePatch != "") { inherit prePatch; }
|
|
|
|
// optionalAttrs (patchPhase != "") { inherit patchPhase; }
|
2017-06-04 20:26:37 +02:00
|
|
|
// optionalAttrs (configurePhase != "") { inherit configurePhase; }
|
2021-06-03 14:58:02 +02:00
|
|
|
// optionalAttrs (preConfigure != "") { inherit preConfigure; }
|
|
|
|
// optionalAttrs (postConfigure != "") { inherit postConfigure; }
|
|
|
|
// optionalAttrs (buildPhase != "") { inherit buildPhase; }
|
|
|
|
// optionalAttrs (preBuild != "") { inherit preBuild; }
|
|
|
|
// optionalAttrs (postBuild != "") { inherit postBuild; }
|
|
|
|
// optionalAttrs (checkPhase != "") { inherit checkPhase; }
|
|
|
|
// optionalAttrs (preCheck != "") { inherit preCheck; }
|
|
|
|
// optionalAttrs (postCheck != "") { inherit postCheck; }
|
|
|
|
// optionalAttrs (installPhase != "") { inherit installPhase; }
|
|
|
|
// optionalAttrs (installTargets != [ ]) { inherit installTargets; }
|
|
|
|
// optionalAttrs (preInstall != "") { inherit preInstall; }
|
|
|
|
// optionalAttrs (fixupPhase != "") { inherit fixupPhase; }
|
|
|
|
// optionalAttrs (preFixup != "") { inherit preFixup; }
|
|
|
|
// optionalAttrs (postFixup != "") { inherit postFixup; }
|
2017-06-04 20:26:37 +02:00
|
|
|
)
|