diff options
author | Gleb Peregud <gleber.p@gmail.com> | 2017-06-04 20:26:37 +0200 |
---|---|---|
committer | Gleb Peregud <gleber.p@gmail.com> | 2017-06-08 11:29:47 +0200 |
commit | 3426c88bff6988056163f147e06dcfac2556b588 (patch) | |
tree | bc1229f15dbd0e56e8ebd2903556c22ea851426b /pkgs/development/interpreters/erlang/generic-builder.nix | |
parent | 96f4cac65901256c3a3388dbe491de30f65543c7 (diff) | |
download | nixpkgs-3426c88bff6988056163f147e06dcfac2556b588.tar nixpkgs-3426c88bff6988056163f147e06dcfac2556b588.tar.gz nixpkgs-3426c88bff6988056163f147e06dcfac2556b588.tar.bz2 nixpkgs-3426c88bff6988056163f147e06dcfac2556b588.tar.lz nixpkgs-3426c88bff6988056163f147e06dcfac2556b588.tar.xz nixpkgs-3426c88bff6988056163f147e06dcfac2556b588.tar.zst nixpkgs-3426c88bff6988056163f147e06dcfac2556b588.zip |
erlang: Generalize Erlang/OTP derivations.
Switch official Erlang versions to use a common builder.
Diffstat (limited to 'pkgs/development/interpreters/erlang/generic-builder.nix')
-rw-r--r-- | pkgs/development/interpreters/erlang/generic-builder.nix | 132 |
1 files changed, 132 insertions, 0 deletions
diff --git a/pkgs/development/interpreters/erlang/generic-builder.nix b/pkgs/development/interpreters/erlang/generic-builder.nix new file mode 100644 index 00000000000..0127bb933c4 --- /dev/null +++ b/pkgs/development/interpreters/erlang/generic-builder.nix @@ -0,0 +1,132 @@ +{ pkgs, stdenv, fetchurl, fetchFromGitHub, makeWrapper, autoconf, gawk, gnum4, gnused +, libxml2, libxslt, ncurses, openssl, perl +, openjdk ? null # javacSupport +, unixODBC ? null # odbcSupport +, mesa ? null, wxGTK ? null, wxmac ? null, xorg ? null # wxSupport +}: + +{ version +, sha256 ? null +, rev ? "OTP-${version}" +, src ? fetchFromGitHub { inherit rev sha256; owner = "erlang"; repo = "otp"; } +, enableHipe ? true +, enableDebugInfo ? false +, javacSupport ? false, javacPackages ? [ openjdk ] +, odbcSupport ? false, odbcPackages ? [ unixODBC ] +, wxSupport ? true, wxPackages ? [ mesa wxGTK xorg.libX11 ] +, 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 ? "" +}: + +assert wxSupport -> (if stdenv.isDarwin + then wxmac != null + else mesa != null && wxGTK != null && xorg != null); + +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 ({ + name = "erlang-${version}" + + optionalString javacSupport "-javac" + + optionalString odbcSupport "-odbc"; + + inherit src version; + + buildInputs = [ perl gnum4 ncurses openssl autoconf libxslt libxml2 makeWrapper ] + ++ optionals wxSupport wxPackages2 + ++ optionals odbcSupport odbcPackages + ++ optionals javacSupport javacPackages + ++ optionals stdenv.isDarwin (with pkgs.darwin.apple_sdk.frameworks; [ Carbon Cocoa ]); + + debugInfo = enableDebugInfo; + + # 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 = '' + patchShebangs make + + ${postPatch} + ''; + + preConfigure = '' + ./otp_build autoconf + ''; + + configureFlags = [ "--with-ssl=${openssl.dev}" ] + ++ optional enableHipe "--enable-hipe" + ++ optional javacSupport "--with-javac" + ++ optional odbcSupport "--with-odbc=${unixODBC}" + ++ optional wxSupport "--enable-wx" + ++ 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 + ''; + + # 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; + + meta = with stdenv.lib; { + homepage = "http://www.erlang.org/"; + 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. + ''; + + platforms = platforms.unix; + maintainers = with maintainers; [ the-kenny sjmackenzie couchemar gleber ]; + license = licenses.asl20; + }; +} +// 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 (postInstall != "") { inherit postInstall; } +// optionalAttrs (fixupPhase != "") { inherit fixupPhase; } +// optionalAttrs (preFixup != "") { inherit preFixup; } +// optionalAttrs (postFixup != "") { inherit postFixup; } +) |