about summary refs log tree commit diff
path: root/pkgs/development/interpreters/erlang
diff options
context:
space:
mode:
authorGleb Peregud <gleber.p@gmail.com>2017-06-04 20:26:37 +0200
committerGleb Peregud <gleber.p@gmail.com>2017-06-08 11:29:47 +0200
commit3426c88bff6988056163f147e06dcfac2556b588 (patch)
treebc1229f15dbd0e56e8ebd2903556c22ea851426b /pkgs/development/interpreters/erlang
parent96f4cac65901256c3a3388dbe491de30f65543c7 (diff)
downloadnixlib-3426c88bff6988056163f147e06dcfac2556b588.tar
nixlib-3426c88bff6988056163f147e06dcfac2556b588.tar.gz
nixlib-3426c88bff6988056163f147e06dcfac2556b588.tar.bz2
nixlib-3426c88bff6988056163f147e06dcfac2556b588.tar.lz
nixlib-3426c88bff6988056163f147e06dcfac2556b588.tar.xz
nixlib-3426c88bff6988056163f147e06dcfac2556b588.tar.zst
nixlib-3426c88bff6988056163f147e06dcfac2556b588.zip
erlang: Generalize Erlang/OTP derivations.
Switch official Erlang versions to use a common builder.
Diffstat (limited to 'pkgs/development/interpreters/erlang')
-rw-r--r--pkgs/development/interpreters/erlang/R16.nix57
-rw-r--r--pkgs/development/interpreters/erlang/R16B02-8-basho.nix4
-rw-r--r--pkgs/development/interpreters/erlang/R17.nix74
-rw-r--r--pkgs/development/interpreters/erlang/R18.nix103
-rw-r--r--pkgs/development/interpreters/erlang/R19.nix99
-rw-r--r--pkgs/development/interpreters/erlang/generic-builder.nix132
6 files changed, 156 insertions, 313 deletions
diff --git a/pkgs/development/interpreters/erlang/R16.nix b/pkgs/development/interpreters/erlang/R16.nix
index e2e0151de371..3ac37b5bde17 100644
--- a/pkgs/development/interpreters/erlang/R16.nix
+++ b/pkgs/development/interpreters/erlang/R16.nix
@@ -1,17 +1,6 @@
-{ stdenv, fetchurl, perl, gnum4, ncurses, openssl
-, gnused, gawk, makeWrapper
-, odbcSupport ? false, unixODBC ? null
-, wxSupport ? false, mesa ? null, wxGTK ? null, xorg ? null
-, enableDebugInfo ? false
-, Carbon ? null, Cocoa ? null }:
+{ mkDerivation, fetchurl }:
 
-assert wxSupport -> mesa != null && wxGTK != null && xorg != null;
-assert odbcSupport -> unixODBC != null;
-
-with stdenv.lib;
-
-stdenv.mkDerivation rec {
-  name = "erlang-" + version + "${optionalString odbcSupport "-odbc"}";
+mkDerivation rec {
   version = "16B03-1";
 
   src = fetchurl {
@@ -19,28 +8,17 @@ stdenv.mkDerivation rec {
     sha256 = "1rvyfh22g1fir1i4xn7v2md868wcmhajwhfsq97v7kn5kd2m7khp";
   };
 
-  debugInfo = enableDebugInfo;
-
-  buildInputs =
-    [ perl gnum4 ncurses openssl makeWrapper
-    ] ++ optionals 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'
+    sed -i "s@/bin/rm@rm@" lib/odbc/configure erts/configure
   '';
 
-  patchPhase = '' sed -i "s@/bin/rm@rm@" lib/odbc/configure erts/configure '';
-
   preConfigure = ''
     export HOME=$PWD/../
     sed -e s@/bin/pwd@pwd@g -i otp_build
   '';
 
-  configureFlags= "--with-ssl=${openssl.dev} ${optionalString odbcSupport "--with-odbc=${unixODBC}"} ${optionalString stdenv.isDarwin "--enable-darwin-64bit"}";
-
+  # Do not install docs, instead use prebuilt versions.
+  installTargets = "install";
   postInstall = let
     manpages = fetchurl {
       url = "http://www.erlang.org/download/otp_doc_man_R${version}.tar.gz";
@@ -55,29 +33,4 @@ stdenv.mkDerivation rec {
       ln -s "$i" "$out/share/man/''${prefix##*/}/''${i##*/}erl"
     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 ":" "${stdenv.lib.makeBinPath [ gnused gawk ]}"
-  '';
-
-  setupHook = ./setup-hook.sh;
-
-  meta = {
-    homepage = "http://www.erlang.org/";
-    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 = [ maintainers.the-kenny ];
-  };
 }
diff --git a/pkgs/development/interpreters/erlang/R16B02-8-basho.nix b/pkgs/development/interpreters/erlang/R16B02-8-basho.nix
index 80f524019df0..fe24ad64bf83 100644
--- a/pkgs/development/interpreters/erlang/R16B02-8-basho.nix
+++ b/pkgs/development/interpreters/erlang/R16B02-8-basho.nix
@@ -36,6 +36,10 @@ stdenv.mkDerivation rec {
 
   patchPhase = '' sed -i "s@/bin/rm@rm@" lib/odbc/configure.in erts/configure.in '';
 
+  postPatch = ''
+    patchSheBangs make
+  '';
+
   preConfigure = ''
     export HOME=$PWD/../
     export LANG=C
diff --git a/pkgs/development/interpreters/erlang/R17.nix b/pkgs/development/interpreters/erlang/R17.nix
index 0869285d4965..3d78c6ee242a 100644
--- a/pkgs/development/interpreters/erlang/R17.nix
+++ b/pkgs/development/interpreters/erlang/R17.nix
@@ -1,26 +1,6 @@
-{ stdenv, fetchurl, perl, gnum4, ncurses, openssl
-, gnused, gawk, makeWrapper
-, Carbon, Cocoa
-, odbcSupport ? false, unixODBC ? null
-, wxSupport ? true, mesa ? null, wxGTK ? null, xorg ? null, wxmac ? null
-, javacSupport ? false, openjdk ? null
-, enableHipe ? true
-, enableDebugInfo ? false
-, enableDirtySchedulers ? false
-}:
+{ mkDerivation, fetchurl }:
 
-assert wxSupport -> (if stdenv.isDarwin
-  then wxmac != null
-  else mesa != null && wxGTK != null && xorg != null);
-
-assert odbcSupport -> unixODBC != null;
-assert javacSupport ->  openjdk != null;
-
-with stdenv.lib;
-
-stdenv.mkDerivation rec {
-  name = "erlang-" + version + "${optionalString odbcSupport "-odbc"}"
-  + "${optionalString javacSupport "-javac"}";
+mkDerivation rec {
   version = "17.5";
 
   src = fetchurl {
@@ -28,36 +8,17 @@ stdenv.mkDerivation rec {
     sha256 = "0x34hj1a4j3rphqdaapdld7la4sqiqillamcz06wac0vk0684a1w";
   };
 
-  buildInputs =
-    [ perl gnum4 ncurses openssl makeWrapper
-    ] ++ optionals wxSupport (if stdenv.isDarwin then [ wxmac ] else [ mesa wxGTK xorg.libX11 ])
-      ++ optional odbcSupport unixODBC
-      ++ optional javacSupport openjdk
-      ++ stdenv.lib.optionals stdenv.isDarwin [ Carbon Cocoa ];
-
-  patchPhase = ''
-    # Clang 4 (rightfully) thinks signed comparisons of pointers with NULL are nonsense
-    substituteInPlace lib/wx/c_src/wxe_impl.cpp --replace 'temp > NULL' 'temp != NULL'
-
+  prePatch = ''
     sed -i "s@/bin/rm@rm@" lib/odbc/configure erts/configure
   '';
 
-  debugInfo = enableDebugInfo;
-
   preConfigure = ''
     export HOME=$PWD/../
     sed -e s@/bin/pwd@pwd@g -i otp_build
   '';
 
-  configureFlags= [
-    "--with-ssl=${openssl.dev}"
-  ] ++ optional enableHipe "--enable-hipe"
-    ++ optional enableDirtySchedulers "--enable-dirty-schedulers"
-    ++ optional wxSupport "--enable-wx"
-    ++ optional odbcSupport "--with-odbc=${unixODBC}"
-    ++ optional javacSupport "--with-javac"
-    ++ optional stdenv.isDarwin "--enable-darwin-64bit";
-
+  # Do not install docs, instead use prebuilt versions.
+  installTargets = "install";
   postInstall = let
     manpages = fetchurl {
       url = "http://www.erlang.org/download/otp_doc_man_${version}.tar.gz";
@@ -72,29 +33,4 @@ stdenv.mkDerivation rec {
       ln -s "$i" "$out/share/man/''${prefix##*/}/''${i##*/}erl"
     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 ":" "${stdenv.lib.makeBinPath [ gnused gawk ]}"
-  '';
-
-  setupHook = ./setup-hook.sh;
-
-  meta = {
-    homepage = "http://www.erlang.org/";
-    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 = [ maintainers.the-kenny maintainers.sjmackenzie ];
-  };
 }
diff --git a/pkgs/development/interpreters/erlang/R18.nix b/pkgs/development/interpreters/erlang/R18.nix
index 1ed9bfbd70a2..0d20ae662a50 100644
--- a/pkgs/development/interpreters/erlang/R18.nix
+++ b/pkgs/development/interpreters/erlang/R18.nix
@@ -1,113 +1,22 @@
-{ stdenv, fetchurl, fetchpatch, fetchFromGitHub, perl, gnum4, ncurses, openssl
-, gnused, gawk, autoconf, libxslt, libxml2, makeWrapper
-, Carbon, Cocoa
-, odbcSupport ? false, unixODBC ? null
-, wxSupport ? true, mesa ? null, wxGTK ? null, xorg ? null, wxmac ? null
-, javacSupport ? false, openjdk ? null
-, enableHipe ? true
-, enableDebugInfo ? false
-, enableDirtySchedulers ? false
-}:
-
-assert wxSupport -> (if stdenv.isDarwin
-  then wxmac != null
-  else mesa != null && wxGTK != null && xorg != null);
-
-assert odbcSupport -> unixODBC != null;
-assert javacSupport ->  openjdk != null;
-
-with stdenv.lib;
-
-stdenv.mkDerivation rec {
-  name = "erlang-" + version + "${optionalString odbcSupport "-odbc"}"
-  + "${optionalString javacSupport "-javac"}";
-  version = "18.3.4.4";
-
-  # Minor OTP releases are not always released as tarbals at
-  # http://erlang.org/download/ So we have to download from
-  # github. And for the same reason we can't use a prebuilt manpages
-  # tarball and need to build manpages ourselves.
-  src = fetchFromGitHub {
-    owner = "erlang";
-    repo = "otp";
-    rev = "OTP-${version}";
-    sha256 = "0wilm21yi9m3v6j26vc04hsa58cxca5z4q9yxx71hm81cbm1xbwk";
-  };
-
-  buildInputs =
-    [ perl gnum4 ncurses openssl autoconf libxslt libxml2 makeWrapper
-    ] ++ optionals wxSupport (if stdenv.isDarwin then [ wxmac ] else [ mesa wxGTK xorg.libX11 ])
-      ++ optional odbcSupport unixODBC
-      ++ optional javacSupport openjdk
-      ++ stdenv.lib.optionals stdenv.isDarwin [ Carbon Cocoa ];
-
-  debugInfo = enableDebugInfo;
+{ mkDerivation, fetchurl }:
 
+let
   rmAndPwdPatch = fetchurl {
      url = "https://github.com/erlang/otp/commit/98b8650d22e94a5ff839170833f691294f6276d0.patch";
      sha256 = "0cd5pkqrigiqz6cyma5irqwzn0bi17k371k9vlg8ir31h3zmqfip";
   };
 
   envAndCpPatch = fetchurl {
-     url = "https://github.com/binarin/otp/commit/9f9841eb7327c9fe73e84e197fd2965a97b639cf.patch";
+     url = "https://github.com/erlang/otp/commit/9f9841eb7327c9fe73e84e197fd2965a97b639cf.patch";
      sha256 = "10h5348p6g279b4q01i5jdqlljww5chcvrx5b4b0dv79pk0p0m9f";
   };
 
-  # 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'
-  '';
+in mkDerivation rec {
+  version = "18.3.4.4";
+  sha256 = "0wilm21yi9m3v6j26vc04hsa58cxca5z4q9yxx71hm81cbm1xbwk";
 
   patches = [
     rmAndPwdPatch
     envAndCpPatch
   ];
-
-  preConfigure = ''
-    ./otp_build autoconf
-  '';
-
-  configureFlags= [
-    "--with-ssl=${openssl.dev}"
-  ] ++ optional enableHipe "--enable-hipe"
-    ++ optional enableDirtySchedulers "--enable-dirty-schedulers"
-    ++ optional wxSupport "--enable-wx"
-    ++ optional odbcSupport "--with-odbc=${unixODBC}"
-    ++ optional javacSupport "--with-javac"
-    ++ optional stdenv.isDarwin "--enable-darwin-64bit";
-
-  # install-docs will generate and install manpages and html docs
-  # (PDFs are generated only when fop is available).
-  installTargets = "install install-docs";
-
-  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 = {
-    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 ];
-    license = licenses.asl20;
-  };
 }
diff --git a/pkgs/development/interpreters/erlang/R19.nix b/pkgs/development/interpreters/erlang/R19.nix
index 4b1e3f4cb2f9..680111dbd77a 100644
--- a/pkgs/development/interpreters/erlang/R19.nix
+++ b/pkgs/development/interpreters/erlang/R19.nix
@@ -1,101 +1,10 @@
-{ stdenv, fetchurl, fetchFromGitHub, perl, gnum4, ncurses, openssl
-, gnused, gawk, autoconf, libxslt, libxml2, makeWrapper
-, Carbon, Cocoa
-, odbcSupport ? false, unixODBC ? null
-, wxSupport ? true, mesa ? null, wxGTK ? null, xorg ? null, wxmac ? null
-, javacSupport ? false, openjdk ? null
-, enableHipe ? true
-, enableDebugInfo ? false
-, enableDirtySchedulers ? false
-}:
+{ mkDerivation, fetchurl }:
 
-assert wxSupport -> (if stdenv.isDarwin
-  then wxmac != null
-  else mesa != null && wxGTK != null && xorg != null);
-
-assert odbcSupport -> unixODBC != null;
-assert javacSupport ->  openjdk != null;
-
-with stdenv.lib;
-
-stdenv.mkDerivation rec {
-  name = "erlang-" + version + "${optionalString odbcSupport "-odbc"}"
-  + "${optionalString javacSupport "-javac"}";
+mkDerivation rec {
   version = "19.3";
-
-  # Minor OTP releases are not always released as tarbals at
-  # http://erlang.org/download/ So we have to download from
-  # github. And for the same reason we can't use a prebuilt manpages
-  # tarball and need to build manpages ourselves.
-  src = fetchFromGitHub {
-    owner = "erlang";
-    repo = "otp";
-    rev = "OTP-${version}";
-    sha256 = "0pp2hl8jf4iafpnsmf0q7jbm313daqzif6ajqcmjyl87m5pssr86";
-  };
-
-  buildInputs =
-    [ perl gnum4 ncurses openssl autoconf libxslt libxml2 makeWrapper
-    ] ++ optionals wxSupport (if stdenv.isDarwin then [ wxmac ] else [ mesa wxGTK xorg.libX11 ])
-      ++ optional odbcSupport unixODBC
-      ++ optional javacSupport openjdk
-      ++ stdenv.lib.optionals stdenv.isDarwin [ Carbon Cocoa ];
-
-  debugInfo = enableDebugInfo;
+  sha256 = "0pp2hl8jf4iafpnsmf0q7jbm313daqzif6ajqcmjyl87m5pssr86";
 
   prePatch = ''
-    substituteInPlace configure.in \
-      --replace '`sw_vers -productVersion`' '10.10'
-
-    # Clang 4 (rightfully) thinks signed comparisons of pointers with NULL are nonsense
-    substituteInPlace lib/wx/c_src/wxe_impl.cpp --replace 'temp > NULL' 'temp != NULL'
+    substituteInPlace configure.in --replace '`sw_vers -productVersion`' '10.10'
   '';
-
-  preConfigure = ''
-    ./otp_build autoconf
-  '';
-
-  configureFlags= [
-    "--with-ssl=${openssl.dev}"
-  ] ++ optional enableHipe "--enable-hipe"
-    ++ optional enableDirtySchedulers "--enable-dirty-schedulers"
-    ++ optional wxSupport "--enable-wx"
-    ++ optional odbcSupport "--with-odbc=${unixODBC}"
-    ++ optional javacSupport "--with-javac"
-    ++ optional stdenv.isDarwin "--enable-darwin-64bit";
-
-  # install-docs will generate and install manpages and html docs
-  # (PDFs are generated only when fop is available).
-  installTargets = "install install-docs";
-
-  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 = {
-    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; [ yurrriq couchemar DerTim1 mdaiter ];
-    license = licenses.asl20;
-  };
 }
diff --git a/pkgs/development/interpreters/erlang/generic-builder.nix b/pkgs/development/interpreters/erlang/generic-builder.nix
new file mode 100644
index 000000000000..0127bb933c4a
--- /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; }
+)