1{ stdenv, fetchFromGitHub, which, perl, jdk
2, ocamlPackages, openssl
3, coreutils, zlib, ncurses, makeWrapper
4, gcc, binutils, gnumake, nodejs
5}:
6
7stdenv.mkDerivation rec {
8 pname = "opa";
9 version = "4310";
10 name = "${pname}-${version}";
11
12 src = fetchFromGitHub {
13 owner = "MLstate";
14 repo = "opalang";
15 rev = "a13d45af30bc955c40c4b320353fb21e4ecacbc5";
16 sha256 = "1qs91rq9xrafv2mf2v415k8lv91ab3ycz0xkpjh1mng5ca3pjlf3";
17 };
18
19 # Paths so the opa compiler code generation will use the same programs as were
20 # used to build opa.
21 codeGeneratorPaths = stdenv.lib.makeBinPath [ ocamlPackages.ocaml gcc binutils gnumake nodejs ];
22
23 preConfigure = ''
24 patchShebangs .
25 (
26 cat ./compiler/buildinfos/buildInfos.ml.pre
27 ./compiler/buildinfos/generate_buildinfos.sh . --release --version ./compiler/buildinfos/version_major.txt
28 echo let opa_git_version = ${version}
29 echo 'let opa_git_sha = "xxxx"'
30 cat ./compiler/buildinfos/buildInfos.ml.post
31 )> ./compiler/buildinfos/buildInfos.ml
32 for p in configure tools/platform_helper.sh
33 do
34 substituteInPlace $p --replace 'IS_MAC=1' 'IS_LINUX=1'
35 done
36 export CAMLP4O=${ocamlPackages.camlp4}/bin/camlp4o
37 export CAMLP4ORF=${ocamlPackages.camlp4}/bin/camlp4orf
38 '';
39
40 prefixKey = "-prefix ";
41
42 configureFlags = "-ocamlfind ${ocamlPackages.findlib}/bin/ocamlfind ";
43
44 buildInputs = [ which perl jdk openssl coreutils zlib ncurses
45 makeWrapper gcc binutils gnumake nodejs
46 ] ++ (with ocamlPackages; [
47 ocaml findlib ocaml_ssl cryptokit camlzip ulex ocamlgraph camlp4
48 ]);
49
50 NIX_LDFLAGS = stdenv.lib.optionalString (!stdenv.isDarwin) "-lgcc_s";
51
52 postInstall = ''
53 # Have compiler use same tools for code generation as used to build it.
54 for p in $out/bin/opa ; do
55 wrapProgram $p --prefix PATH ":" "${codeGeneratorPaths}" ;
56 done
57
58 # Install emacs mode.
59 mkdir -p $out/share/emacs/site-lisp/opa
60 install -m 0644 -v ./tools/editors/emacs/{opa-mode.el,site-start.el} $out/share/emacs/site-lisp/opa
61 '';
62
63 meta = {
64 description = "A concise and elegant language for writing distributed web applications";
65 longDescription = ''
66 Opa is a new generation of web development platform that lets you write distributed
67 web applications using a single technology. Among the the many features of Opa are these:
68 Opa is concise, simple, concurrent, dynamically distributed, and secure.
69 '';
70 homepage = http://opalang.org/;
71 license = stdenv.lib.licenses.gpl3;
72 maintainers = [ stdenv.lib.maintainers.kkallio ];
73 platforms = with stdenv.lib.platforms; unix;
74 };
75}