2018-07-21 02:44:44 +02:00
|
|
|
{ pkgs, stdenv, fetchFromGitHub, makeWrapper, gawk, gnum4, gnused
|
2017-08-03 21:22:30 +02:00
|
|
|
, libxml2, libxslt, ncurses, openssl, perl, autoreconfHook
|
2017-06-04 20:26:37 +02:00
|
|
|
, openjdk ? null # javacSupport
|
|
|
|
, unixODBC ? null # odbcSupport
|
2018-02-24 14:12:44 +01:00
|
|
|
, libGLU_combined ? null, wxGTK ? null, wxmac ? null, xorg ? null # wxSupport
|
2018-01-25 20:17:34 +01:00
|
|
|
, withSystemd ? stdenv.isLinux, systemd # systemd support in epmd
|
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
|
2017-06-04 20:26:37 +02:00
|
|
|
, javacSupport ? false, javacPackages ? [ openjdk ]
|
|
|
|
, odbcSupport ? false, odbcPackages ? [ unixODBC ]
|
2018-10-10 20:15:14 +02:00
|
|
|
, wxSupport ? !stdenv.isDarwin, wxPackages ? [ libGLU_combined wxGTK xorg.libX11 ]
|
2017-06-04 20:26:37 +02:00
|
|
|
, preUnpack ? "", postUnpack ? ""
|
|
|
|
, patches ? [], patchPhase ? "", prePatch ? "", postPatch ? ""
|
|
|
|
, configureFlags ? [], configurePhase ? "", preConfigure ? "", postConfigure ? ""
|
|
|
|
, buildPhase ? "", preBuild ? "", postBuild ? ""
|
|
|
|
, installPhase ? "", preInstall ? "", postInstall ? ""
|
|
|
|
, installTargets ? "install install-docs"
|
|
|
|
, checkPhase ? "", preCheck ? "", postCheck ? ""
|
|
|
|
, fixupPhase ? "", preFixup ? "", postFixup ? ""
|
2017-12-08 12:49:47 +01:00
|
|
|
, meta ? {}
|
2017-06-04 20:26:37 +02:00
|
|
|
}:
|
|
|
|
|
|
|
|
assert wxSupport -> (if stdenv.isDarwin
|
|
|
|
then wxmac != null
|
2018-02-24 14:12:44 +01:00
|
|
|
else libGLU_combined != null && wxGTK != null && xorg != null);
|
2017-06-04 20:26:37 +02:00
|
|
|
|
|
|
|
assert odbcSupport -> unixODBC != null;
|
|
|
|
assert javacSupport -> openjdk != null;
|
|
|
|
|
|
|
|
let
|
|
|
|
inherit (stdenv.lib) optional optionals optionalAttrs optionalString;
|
|
|
|
wxPackages2 = if stdenv.isDarwin then [ wxmac ] else wxPackages;
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
2017-09-06 00:03:42 +02:00
|
|
|
nativeBuildInputs = [ autoreconfHook makeWrapper perl gnum4 libxslt libxml2 ];
|
2017-08-03 21:22:30 +02:00
|
|
|
|
2017-09-06 00:03:42 +02:00
|
|
|
buildInputs = [ ncurses openssl ]
|
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
|
2017-06-04 20:26:37 +02:00
|
|
|
++ optionals stdenv.isDarwin (with pkgs.darwin.apple_sdk.frameworks; [ Carbon Cocoa ]);
|
|
|
|
|
|
|
|
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
|
|
|
|
enableParallelBuilding = false;
|
2018-08-22 22:58:32 +02:00
|
|
|
|
2017-06-04 20:26:37 +02:00
|
|
|
# Clang 4 (rightfully) thinks signed comparisons of pointers with NULL are nonsense
|
|
|
|
prePatch = ''
|
|
|
|
substituteInPlace lib/wx/c_src/wxe_impl.cpp --replace 'temp > NULL' 'temp != NULL'
|
|
|
|
|
|
|
|
${prePatch}
|
|
|
|
'';
|
|
|
|
|
|
|
|
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
|
|
|
|
'';
|
|
|
|
|
|
|
|
configureFlags = [ "--with-ssl=${openssl.dev}" ]
|
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"
|
2017-06-04 20:26:37 +02:00
|
|
|
++ optional stdenv.isDarwin "--enable-darwin-64bit";
|
|
|
|
|
|
|
|
# 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/"
|
|
|
|
wrapProgram $out/lib/erlang/bin/start_erl --prefix PATH ":" "${stdenv.lib.makeBinPath [ gnused gawk ]}"
|
|
|
|
'';
|
|
|
|
|
|
|
|
setupHook = ./setup-hook.sh;
|
|
|
|
|
2017-12-08 12:49:47 +01:00
|
|
|
meta = with stdenv.lib; ({
|
2017-08-01 22:03:30 +02:00
|
|
|
homepage = http://www.erlang.org/;
|
2017-06-04 20:26:37 +02:00
|
|
|
downloadPage = "http://www.erlang.org/download.html";
|
|
|
|
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.
|
|
|
|
'';
|
|
|
|
|
2018-11-18 12:45:54 +01:00
|
|
|
# aarch64 is supposed to work but started failing in https://hydra.nixos.org/build/83735973
|
|
|
|
platforms = subtractLists [ "aarch64-linux" ] platforms.unix;
|
2017-06-04 20:26:37 +02:00
|
|
|
maintainers = with maintainers; [ the-kenny sjmackenzie couchemar gleber ];
|
|
|
|
license = licenses.asl20;
|
2017-12-08 12:49:47 +01:00
|
|
|
} // meta);
|
2017-06-04 20:26:37 +02:00
|
|
|
}
|
|
|
|
// optionalAttrs (preUnpack != "") { inherit preUnpack; }
|
|
|
|
// optionalAttrs (postUnpack != "") { inherit postUnpack; }
|
|
|
|
// optionalAttrs (patches != []) { inherit patches; }
|
|
|
|
// optionalAttrs (patchPhase != "") { inherit patchPhase; }
|
|
|
|
// optionalAttrs (configureFlags != []) { inherit configureFlags; }
|
|
|
|
// optionalAttrs (configurePhase != "") { inherit configurePhase; }
|
|
|
|
// 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; }
|
|
|
|
)
|