lol
1{ stdenv, fetchurl, perl, gnum4, ncurses, openssl
2, gnused, gawk, makeWrapper
3, Carbon, Cocoa
4, odbcSupport ? false, unixODBC ? null
5, wxSupport ? true, mesa ? null, wxGTK ? null, xorg ? null, wxmac ? null
6, javacSupport ? false, openjdk ? null
7, enableHipe ? true
8, enableDebugInfo ? false
9}:
10
11assert wxSupport -> (if stdenv.isDarwin
12 then wxmac != null
13 else mesa != null && wxGTK != null && xorg != null);
14
15assert odbcSupport -> unixODBC != null;
16assert javacSupport -> openjdk != null;
17
18with stdenv.lib;
19
20stdenv.mkDerivation rec {
21 name = "erlang-" + version + "${optionalString odbcSupport "-odbc"}"
22 + "${optionalString javacSupport "-javac"}";
23 version = "17.5";
24
25 src = fetchurl {
26 url = "http://www.erlang.org/download/otp_src_${version}.tar.gz";
27 sha256 = "0x34hj1a4j3rphqdaapdld7la4sqiqillamcz06wac0vk0684a1w";
28 };
29
30 buildInputs =
31 [ perl gnum4 ncurses openssl makeWrapper
32 ] ++ optionals wxSupport (if stdenv.isDarwin then [ wxmac ] else [ mesa wxGTK xorg.libX11 ])
33 ++ optional odbcSupport unixODBC
34 ++ optional javacSupport openjdk
35 ++ stdenv.lib.optionals stdenv.isDarwin [ Carbon Cocoa ];
36
37 patchPhase = '' sed -i "s@/bin/rm@rm@" lib/odbc/configure erts/configure '';
38
39 debugInfo = enableDebugInfo;
40
41 preConfigure = ''
42 export HOME=$PWD/../
43 sed -e s@/bin/pwd@pwd@g -i otp_build
44 '';
45
46 configureFlags= [
47 "--with-ssl=${openssl.dev}"
48 ] ++ optional enableHipe "--enable-hipe"
49 ++ optional wxSupport "--enable-wx"
50 ++ optional odbcSupport "--with-odbc=${unixODBC}"
51 ++ optional javacSupport "--with-javac"
52 ++ optional stdenv.isDarwin "--enable-darwin-64bit";
53
54 postInstall = let
55 manpages = fetchurl {
56 url = "http://www.erlang.org/download/otp_doc_man_${version}.tar.gz";
57 sha256 = "1hspm285bl7i9a0d4r6j6lm5yk4sb5d9xzpia3simh0z06hv5cc5";
58 };
59 in ''
60 ln -s $out/lib/erlang/lib/erl_interface*/bin/erl_call $out/bin/erl_call
61 tar xf "${manpages}" -C "$out/lib/erlang"
62 for i in "$out"/lib/erlang/man/man[0-9]/*.[0-9]; do
63 prefix="''${i%/*}"
64 ensureDir "$out/share/man/''${prefix##*/}"
65 ln -s "$i" "$out/share/man/''${prefix##*/}/''${i##*/}erl"
66 done
67 '';
68
69 # Some erlang bin/ scripts run sed and awk
70 postFixup = ''
71 wrapProgram $out/lib/erlang/bin/erl --prefix PATH ":" "${gnused}/bin/"
72 wrapProgram $out/lib/erlang/bin/start_erl --prefix PATH ":" "${stdenv.lib.makeBinPath [ gnused gawk ]}"
73 '';
74
75 setupHook = ./setup-hook.sh;
76
77 meta = {
78 homepage = "http://www.erlang.org/";
79 description = "Programming language used for massively scalable soft real-time systems";
80
81 longDescription = ''
82 Erlang is a programming language used to build massively scalable
83 soft real-time systems with requirements on high availability.
84 Some of its uses are in telecoms, banking, e-commerce, computer
85 telephony and instant messaging. Erlang's runtime system has
86 built-in support for concurrency, distribution and fault
87 tolerance.
88 '';
89
90 platforms = platforms.unix;
91 maintainers = [ maintainers.the-kenny maintainers.sjmackenzie ];
92 };
93}