diff --git a/pkgs/development/interpreters/erlang/R16.nix b/pkgs/development/interpreters/erlang/R16.nix index 3ac37b5bde17..123d813fc77a 100644 --- a/pkgs/development/interpreters/erlang/R16.nix +++ b/pkgs/development/interpreters/erlang/R16.nix @@ -25,7 +25,6 @@ mkDerivation rec { sha256 = "17f3k5j17rdsah18gywjngip6cbfgp6nb9di6il4pahmf9yvqc8g"; }; in '' - ln -s $out/lib/erlang/lib/erl_interface*/bin/erl_call $out/bin/erl_call tar xf "${manpages}" -C "$out/lib/erlang" for i in "$out"/lib/erlang/man/man[0-9]/*.[0-9]; do prefix="''${i%/*}" diff --git a/pkgs/development/interpreters/erlang/R16B02-8-basho.nix b/pkgs/development/interpreters/erlang/R16B02-8-basho.nix index fe24ad64bf83..89c97f5a0eb7 100644 --- a/pkgs/development/interpreters/erlang/R16B02-8-basho.nix +++ b/pkgs/development/interpreters/erlang/R16B02-8-basho.nix @@ -1,76 +1,38 @@ -{ stdenv, fetchurl, fetchFromGitHub, perl, gnum4, ncurses, openssl, autoconf264, gcc, erlang -, gnused, gawk, makeWrapper -, odbcSupport ? false, unixODBC ? null -, wxSupport ? false, mesa ? null, wxGTK ? null, xorg ? null -, enableDebugInfo ? false -, Carbon ? null, Cocoa ? null }: +{ pkgs, mkDerivation }: -assert wxSupport -> mesa != null && wxGTK != null && xorg != null; -assert odbcSupport -> unixODBC != null; - -with stdenv.lib; - -stdenv.mkDerivation rec { - name = "erlang-basho-" + version + "${optionalString odbcSupport "-odbc"}"; +mkDerivation rec { + baseName = "erlang"; version = "16B02"; - src = fetchFromGitHub { + src = pkgs.fetchFromGitHub { owner = "basho"; repo = "otp"; rev = "OTP_R16B02_basho8"; sha256 = "1w0hbm0axxxa45v3kl6bywc9ayir5vwqxjpnjlzc616ldszb2m0x"; }; - debugInfo = enableDebugInfo; - - buildInputs = - [ perl gnum4 ncurses openssl makeWrapper autoconf264 gcc - ] ++ optional wxSupport [ mesa wxGTK xorg.libX11 ] - ++ optional odbcSupport [ unixODBC ] - ++ optionals stdenv.isDarwin [ Carbon Cocoa ]; - - # 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' - ''; - - patchPhase = '' sed -i "s@/bin/rm@rm@" lib/odbc/configure.in erts/configure.in ''; - - postPatch = '' - patchSheBangs make - ''; - preConfigure = '' export HOME=$PWD/../ export LANG=C export ERL_TOP=$(pwd) sed -e s@/bin/pwd@pwd@g -i otp_build - sed -e s@"/usr/bin/env escript"@${erlang}/bin/escript@g -i lib/diameter/bin/diameterc - ''; + sed -e s@"/usr/bin/env escript"@$(pwd)/bootstrap/bin/escript@g -i lib/diameter/bin/diameterc - configureFlags= [ - "--with-ssl=${openssl.dev}" - "--enable-smp-support" - "--enable-threads" - "--enable-kernel-poll" - "--disable-hipe" - "${optionalString odbcSupport "--with-odbc=${unixODBC}"}" - "${optionalString stdenv.isDarwin "--enable-darwin-64bit"}" - "${optionalString stdenv.isLinux "--enable-m64-build"}" - ]; - - buildPhase = '' ./otp_build autoconf - ./otp_build setup -a --prefix=$out $configureFlags ''; + enableHipe = false; + + # Do not install docs, instead use prebuilt versions. + installTargets = "install"; postInstall = let - manpages = fetchurl { + manpages = pkgs.fetchurl { url = "http://www.erlang.org/download/otp_doc_man_R${version}.tar.gz"; sha256 = "12apxjmmd591y9g9bhr97z5jbd1jarqg7wj0y2sqhl21hc1yp75p"; }; in '' - ln -s $out/lib/erlang/lib/erl_interface*/bin/erl_call $out/bin/erl_call + sed -e s@$(pwd)/bootstrap/bin/escript@$out/bin/escript@g -i $out/lib/erlang/lib/diameter-1.4.3/bin/diameterc + tar xf "${manpages}" -C "$out/lib/erlang" for i in "$out"/lib/erlang/man/man[0-9]/*.[0-9]; do prefix="''${i%/*}" @@ -79,14 +41,6 @@ stdenv.mkDerivation rec { done ''; - # 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 ":" "${gnused}/bin/:${gawk}/bin" - ''; - - setupHook = ./setup-hook.sh; - meta = { homepage = "https://github.com/basho/otp/"; description = "Programming language used for massively scalable soft real-time systems, Basho fork"; @@ -103,7 +57,7 @@ stdenv.mkDerivation rec { ''; platforms = ["x86_64-linux" "x86_64-darwin"]; - license = stdenv.lib.licenses.asl20; - maintainers = with maintainers; [ mdaiter ]; + license = pkgs.stdenv.lib.licenses.asl20; + maintainers = with pkgs.stdenv.lib.maintainers; [ mdaiter ]; }; } diff --git a/pkgs/development/interpreters/erlang/R17.nix b/pkgs/development/interpreters/erlang/R17.nix index 3d78c6ee242a..02d7513331eb 100644 --- a/pkgs/development/interpreters/erlang/R17.nix +++ b/pkgs/development/interpreters/erlang/R17.nix @@ -25,7 +25,6 @@ mkDerivation rec { sha256 = "1hspm285bl7i9a0d4r6j6lm5yk4sb5d9xzpia3simh0z06hv5cc5"; }; in '' - ln -s $out/lib/erlang/lib/erl_interface*/bin/erl_call $out/bin/erl_call tar xf "${manpages}" -C "$out/lib/erlang" for i in "$out"/lib/erlang/man/man[0-9]/*.[0-9]; do prefix="''${i%/*}" diff --git a/pkgs/development/interpreters/erlang/generic-builder.nix b/pkgs/development/interpreters/erlang/generic-builder.nix index 0127bb933c4a..3434603f3028 100644 --- a/pkgs/development/interpreters/erlang/generic-builder.nix +++ b/pkgs/development/interpreters/erlang/generic-builder.nix @@ -1,16 +1,20 @@ -{ pkgs, stdenv, fetchurl, fetchFromGitHub, makeWrapper, autoconf, gawk, gnum4, gnused -, libxml2, libxslt, ncurses, openssl, perl +{ pkgs, stdenv, fetchurl, fetchFromGitHub, makeWrapper, gawk, gnum4, gnused +, libxml2, libxslt, ncurses, openssl, perl, gcc, autoreconfHook , openjdk ? null # javacSupport , unixODBC ? null # odbcSupport , mesa ? null, wxGTK ? null, wxmac ? null, xorg ? null # wxSupport }: -{ version +{ baseName ? "erlang" +, version , sha256 ? null , rev ? "OTP-${version}" , src ? fetchFromGitHub { inherit rev sha256; owner = "erlang"; repo = "otp"; } , enableHipe ? true , enableDebugInfo ? false +, enableThreads ? true +, enableSmpSupport ? true +, enableKernelPoll ? true , javacSupport ? false, javacPackages ? [ openjdk ] , odbcSupport ? false, odbcPackages ? [ unixODBC ] , wxSupport ? true, wxPackages ? [ mesa wxGTK xorg.libX11 ] @@ -22,6 +26,7 @@ , installTargets ? "install install-docs" , checkPhase ? "", preCheck ? "", postCheck ? "" , fixupPhase ? "", preFixup ? "", postFixup ? "" +, meta ? null }: assert wxSupport -> (if stdenv.isDarwin @@ -36,13 +41,15 @@ let wxPackages2 = if stdenv.isDarwin then [ wxmac ] else wxPackages; in stdenv.mkDerivation ({ - name = "erlang-${version}" + name = "${baseName}-${version}" + optionalString javacSupport "-javac" + optionalString odbcSupport "-odbc"; inherit src version; - buildInputs = [ perl gnum4 ncurses openssl autoconf libxslt libxml2 makeWrapper ] + buildInputs = + [ perl gnum4 ncurses openssl autoreconfHook libxslt libxml2 makeWrapper gcc + ] ++ optionals wxSupport wxPackages2 ++ optionals odbcSupport odbcPackages ++ optionals javacSupport javacPackages @@ -58,9 +65,9 @@ in stdenv.mkDerivation ({ ''; postPatch = '' - patchShebangs make - ${postPatch} + + patchShebangs make ''; preConfigure = '' @@ -68,6 +75,9 @@ in stdenv.mkDerivation ({ ''; configureFlags = [ "--with-ssl=${openssl.dev}" ] + ++ optional enableThreads "--enable-threads" + ++ optional enableSmpSupport "--enable-smp-support" + ++ optional enableKernelPoll "--enable-kernel-poll" ++ optional enableHipe "--enable-hipe" ++ optional javacSupport "--with-javac" ++ optional odbcSupport "--with-odbc=${unixODBC}" @@ -78,6 +88,8 @@ in stdenv.mkDerivation ({ # (PDFs are generated only when fop is available). postInstall = '' + ${postInstall} + ln -s $out/lib/erlang/lib/erl_interface*/bin/erl_call $out/bin/erl_call ''; @@ -125,8 +137,8 @@ in stdenv.mkDerivation ({ // 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; } +// optionalAttrs (meta != null) { inherit meta; } ) diff --git a/pkgs/top-level/beam-packages.nix b/pkgs/top-level/beam-packages.nix index 547e650a636d..3451816c0c5b 100644 --- a/pkgs/top-level/beam-packages.nix +++ b/pkgs/top-level/beam-packages.nix @@ -38,11 +38,9 @@ rec { }; # Bash fork, using custom builder. - erlang_basho_R16B02 = callPackage ../development/interpreters/erlang/R16B02-8-basho.nix { - inherit (darwin.apple_sdk.frameworks) Carbon Cocoa; + erlang_basho_R16B02 = lib.callErlang ../development/interpreters/erlang/R16B02-8-basho.nix { }; - erlang_basho_R16B02_odbc = callPackage ../development/interpreters/erlang/R16B02-8-basho.nix { - inherit (darwin.apple_sdk.frameworks) Carbon Cocoa; + erlang_basho_R16B02_odbc = erlang_basho_R16B02.override { odbcSupport = true; };