diff options
author | Karn Kallio <tierpluspluslists@gmail.com> | 2011-11-27 23:58:46 +0000 |
---|---|---|
committer | Karn Kallio <tierpluspluslists@gmail.com> | 2011-11-27 23:58:46 +0000 |
commit | 9ac48a630ebcd9993f4f68e74b8e46f3aa397ebb (patch) | |
tree | 923c638965b4e732410f98fe6b989d32995f9325 /pkgs/development/compilers/opa | |
parent | 23d4fe544f9d332886fb7eb03357d74e6335735b (diff) |
Add OPA to Nixpkgs.
svn path=/nixpkgs/trunk/; revision=30578
Diffstat (limited to 'pkgs/development/compilers/opa')
-rw-r--r-- | pkgs/development/compilers/opa/default.nix | 63 | ||||
-rw-r--r-- | pkgs/development/compilers/opa/libdir.patch | 93 | ||||
-rw-r--r-- | pkgs/development/compilers/opa/locate.patch | 14 |
3 files changed, 170 insertions, 0 deletions
diff --git a/pkgs/development/compilers/opa/default.nix b/pkgs/development/compilers/opa/default.nix new file mode 100644 index 0000000000000..3f6e3956f36ec --- /dev/null +++ b/pkgs/development/compilers/opa/default.nix @@ -0,0 +1,63 @@ +{ stdenv, fetchurl, which, ocaml, perl, jdk +, findlib, ocaml_ssl, openssl, cryptokit, camlzip, ulex +, ocamlgraph, coreutils, zlib, ncurses, makeWrapper +, gcc, binutils, gnumake } : + +stdenv.mkDerivation rec { + pname = "opa"; + version = "962"; + name = "${pname}-${version}"; + + src = fetchurl { + url = "https://github.com/MLstate/opalang/tarball/v${version}"; + name = "opa-${version}.tar.gz"; + sha256 = "0g4kq2kxbld0iqlzb076b7g43d8fh4sfxam615z15mbk1jcvpf9l"; + }; + + # Paths so the opa compiler code generation will use the same programs as were + # used to build opa. + codeGeneratorPaths = "${ocaml}/bin:${gcc}/bin:${binutils}/bin:${gnumake}/bin"; + + prePatch = '' + find . -type f -exec sed -i 's@/usr/bin/env@${coreutils}/bin/env@' {} \; + find . -type f -exec sed -i 's@/usr/bin/perl@${perl}/bin/perl@' {} \; + ''; + + patches = [ ./locate.patch ./libdir.patch ]; + + preConfigure = '' + configureFlags="$configureFlags -prefix $out" + ''; + + dontAddPrefix = true; + + configureFlags = "-ocamlfind ${findlib}/bin/ocamlfind -openssl ${openssl}/lib"; + + buildInputs = [ which ocaml perl jdk findlib ocaml_ssl openssl cryptokit camlzip ulex + ocamlgraph coreutils zlib ncurses makeWrapper gcc binutils gnumake ]; + + postInstall = '' + # Have compiler use same tools for code generation as used to build it. + for p in $out/bin/opa ; do + wrapProgram $p --prefix PATH ":" "${codeGeneratorPaths}" ; + done + + # Install emacs mode. + ensureDir $out/share/emacs/site-lisp/opa + install -m 0644 -v ./utils/emacs/{opa-mode.el,site-start.el} $out/share/emacs/site-lisp/opa + ''; + + meta = { + description = "Opa is a concise and elegant language for writing distributed web applications. Both client and server sides."; + longDescription = '' + Opa is a new generation of web development platform that lets you write distributed + web applications using a single technology. Among the the many features of Opa are these: + Opa is concise, simple, concurrent, dynamically distributed, and secure. + ''; + + homepage = http://opalang.org/; + license = stdenv.lib.licenses.gpl3; + maintainers = [ stdenv.lib.maintainers.kkallio ]; + platforms = "x86_64-linux"; + }; +} diff --git a/pkgs/development/compilers/opa/libdir.patch b/pkgs/development/compilers/opa/libdir.patch new file mode 100644 index 0000000000000..05c8a89afa87b --- /dev/null +++ b/pkgs/development/compilers/opa/libdir.patch @@ -0,0 +1,93 @@ +These patches have the compiler place path flags in various places so that +ocaml and c libraries are found in their Nixpkgs locations. + +diff -x '*~' -Naur MLstate-opalang-6b295a9//build_rules.ml MLstate-opalang-6b295a9-new//build_rules.ml +--- MLstate-opalang-6b295a9//build_rules.ml 2011-11-21 08:07:04.000000000 -0430 ++++ MLstate-opalang-6b295a9-new//build_rules.ml 2011-11-27 00:34:35.845277134 -0430 +@@ -373,7 +373,11 @@ + | Some dep -> dep::list + ) (tags_of_pathname (env "%.opa_plugin")) [] + in +- let lib_dir s = [A"--ml";A"-I";A"--ml";P (if Pathname.exists s then ".." / s else ("+"^s))] in ++ let cryptokitdir_opt = function ++ | Some path -> path ++ | None -> "" ++ in ++ let lib_dir s = [A"--ml";A"-I";A"--ml";P (if Pathname.exists s then ".." / s else (if s = "cryptokit" then (cryptokitdir_opt Config.Libdir.cryptokit) else ("+"^s)))] in + let include_dirs = List.flatten (List.map lib_dir caml_use_lib) in + let files = List.map ((^) path) files in + build_list build files; +diff -x '*~' -Naur MLstate-opalang-6b295a9//config.mli MLstate-opalang-6b295a9-new//config.mli +--- MLstate-opalang-6b295a9//config.mli 2011-11-21 08:07:04.000000000 -0430 ++++ MLstate-opalang-6b295a9-new//config.mli 2011-11-27 00:30:39.312443906 -0430 +@@ -43,6 +43,9 @@ + (** Flag for Dbm present *) + val has_dbm : bool + ++(** openssh link directory *) ++val openssl : string option ++ + (** library directories, if the libs are enabled *) + val libnatpmp : (string*string*string) option (** name of the lib, lib dir, include dir *) + +diff -x '*~' -Naur MLstate-opalang-6b295a9//configure MLstate-opalang-6b295a9-new//configure +--- MLstate-opalang-6b295a9//configure 2011-11-21 08:07:04.000000000 -0430 ++++ MLstate-opalang-6b295a9-new//configure 2011-11-27 00:40:52.496151405 -0430 +@@ -27,6 +27,7 @@ + + NO_CAMLIDL=1 + NO_DBM=1 ++CONFIG_LIB_OPENSSL="" + + while [ $# -gt 0 ]; do + case "$1" in +@@ -51,6 +52,11 @@ + shift + OCAMLOPT=$1 + ;; ++ -openssl) ++ if [ $# -lt 2 ]; then echo "Error: option $1 requires an argument" >&2; exit 1; fi ++ shift ++ CONFIG_LIB_OPENSSL=$1 ++ ;; + -ocamlfind) + if [ $# -lt 2 ]; then echo "Error: option $1 requires an argument" >&2; exit 1; fi + shift +@@ -647,6 +653,8 @@ + let miniupnpc = $(camlopt "$HAS_MINIUPNPC" "$(camlstrtuple "${MINIUPNPC[@]}")") + let has_dbm = $(camlbool "$HAS_DBM") + ++let openssl = $(camlopt "$CONFIG_LIB_OPENSSL" '"'"$CONFIG_LIB_OPENSSL"'"') ++ + let available = [ $TAGS_LIST] + let all_tags = [ $(for t in $ALL_TAGS_LIST; do echo -n "\"$t\"; "; done)] + +diff -x '*~' -Naur MLstate-opalang-6b295a9//qml2ocaml/qml2ocamlOptions.ml MLstate-opalang-6b295a9-new//qml2ocaml/qml2ocamlOptions.ml +--- MLstate-opalang-6b295a9//qml2ocaml/qml2ocamlOptions.ml 2011-11-21 08:07:04.000000000 -0430 ++++ MLstate-opalang-6b295a9-new//qml2ocaml/qml2ocamlOptions.ml 2011-11-27 00:32:57.721442828 -0430 +@@ -44,6 +44,7 @@ + + let options_linker = + ["-w a"] ++ @ (match Config.openssl with | Some dir -> ["-ccopt"; "-L"^dir] | None -> []) + @ (if Base.is_windows then + ["-cclib"; "Dnsapi.lib"; "-cclib"; "libeay32.lib"; "-cclib"; "ssleay32.lib" (*; "ssl_stubs.obj" *)] + else []) +@@ -51,11 +52,13 @@ + (** + Absolute path for include directory, will be passed with the option -I to the ocaml compiler. + *) ++ let uselibdirpath = fun po p -> match po with | Some path -> path | None -> p ++ + let server_include_dir = [ +- "+zip" ; "+site-lib/zip" ; "+site-lib/camlzip" ; +- "+ssl" ; "+site-lib/ssl" ; +- "+cryptokit"; "+site-lib/cryptokit" ; +- "+ulex" ; "+site-lib/ulex" ; ++ uselibdirpath Config.Libdir.camlzip "+zip" ; "+site-lib/zip" ; "+site-lib/camlzip" ; ++ uselibdirpath Config.Libdir.ssl "+ssl" ; "+site-lib/ssl" ; ++ uselibdirpath Config.Libdir.cryptokit "+cryptokit"; "+site-lib/cryptokit" ; ++ uselibdirpath Config.Libdir.ulex "+ulex" ; "+site-lib/ulex" ; + ] @ ( + if Config.has_dbm then [ + "+dbm" ; "+site-lib/dbm" ; diff --git a/pkgs/development/compilers/opa/locate.patch b/pkgs/development/compilers/opa/locate.patch new file mode 100644 index 0000000000000..e67e6bab26031 --- /dev/null +++ b/pkgs/development/compilers/opa/locate.patch @@ -0,0 +1,14 @@ +Needed to have ocamlfind discover ocamlgraph with Nixpkgs. + +diff -x '*~' -Naur MLstate-opalang-ee92891/configure MLstate-opalang-ee92891-new//configure +--- MLstate-opalang-ee92891/configure 2011-09-30 05:41:18.000000000 -0430 ++++ MLstate-opalang-ee92891-new//configure 2011-11-24 13:47:01.332558705 -0430 +@@ -567,7 +567,7 @@ + fi + + # - checking ocamlgraph +-if ! CONFIG_LIB_OCAMLGRAPH=$(locate-ocaml-lib "Graph" "ocamlgraph/graph") ++if ! CONFIG_LIB_OCAMLGRAPH=$(locate-ocaml-lib "Graph" "ocamlgraph" "graph") + then lib-not-found "ocamlgraph" "libocamlgraph-ocaml-dev" + fi + |