summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--pkgs/development/compilers/opa/default.nix63
-rw-r--r--pkgs/development/compilers/opa/libdir.patch93
-rw-r--r--pkgs/development/compilers/opa/locate.patch14
-rw-r--r--pkgs/development/ocaml-modules/cryptokit/META8
-rw-r--r--pkgs/development/ocaml-modules/cryptokit/default.nix30
-rw-r--r--pkgs/development/ocaml-modules/cryptokit/makefile.patch21
-rw-r--r--pkgs/development/ocaml-modules/ocamlgraph/default.nix40
-rw-r--r--pkgs/development/ocaml-modules/ocamlgraph/destdir.patch13
-rw-r--r--pkgs/development/ocaml-modules/ulex/default.nix2
-rw-r--r--pkgs/top-level/all-packages.nix6
10 files changed, 238 insertions, 52 deletions
diff --git a/pkgs/development/compilers/opa/default.nix b/pkgs/development/compilers/opa/default.nix
new file mode 100644
index 000000000000..3f6e3956f36e
--- /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 000000000000..05c8a89afa87
--- /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 000000000000..e67e6bab2603
--- /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
+ 
diff --git a/pkgs/development/ocaml-modules/cryptokit/META b/pkgs/development/ocaml-modules/cryptokit/META
deleted file mode 100644
index 661170835fdf..000000000000
--- a/pkgs/development/ocaml-modules/cryptokit/META
+++ /dev/null
@@ -1,8 +0,0 @@
-# Specifications for the "cryptokit" library:
-requires = ""
-description = "A library of cryptographic primitives for OCaml"
-version = "1.3"
-directory = "^"
-
-archive(byte) = "cryptokit.cma"
-archive(native) = "cryptokit.cmxa"
diff --git a/pkgs/development/ocaml-modules/cryptokit/default.nix b/pkgs/development/ocaml-modules/cryptokit/default.nix
index f4ba9a8d7d7f..8aa3f2ba77e7 100644
--- a/pkgs/development/ocaml-modules/cryptokit/default.nix
+++ b/pkgs/development/ocaml-modules/cryptokit/default.nix
@@ -1,40 +1,24 @@
-{stdenv, fetchurl, zlib, ocaml}:
+{stdenv, fetchurl, zlib, ocaml, findlib, ncurses}:
 
 let
   ocaml_version = (builtins.parseDrvName ocaml.name).version;
-  version = "1.3";
+  version = "1.5";
 in
 
 stdenv.mkDerivation {
   name = "cryptokit-${version}";
 
   src = fetchurl {
-    url = "http://forge.ocamlcore.org/frs/download.php/326/" +
+    url = "http://forge.ocamlcore.org/frs/download.php/639/" +
           "cryptokit-${version}.tar.gz";
-    sha256 = "0kqrlxkpzrj2qpniy6mhn7gx3n29s86vk4q0im2hqpxi9knkkwwy";
+    sha256 = "1r5kbsbsicrbpdrdim7h8xg2b1a8qg8sxig9q6cywzm57r33lj72";
   };
 
-  buildInputs = [zlib ocaml];
+  buildInputs = [zlib ocaml findlib ncurses];
 
-  patches = [ ./makefile.patch ];
+  buildFlags = "setup.data build";
 
-  configurePhase = ''
-    export INSTALLDIR="$out/lib/ocaml/${ocaml_version}/site-lib/cryptokit"
-    substituteInPlace Makefile \
-      --subst-var-by ZLIB_LIBDIR "${zlib}/lib" \
-      --subst-var-by ZLIB_INCLUDE "${zlib}/include" \
-      --subst-var INSTALLDIR 
-  '';
-
-  buildFlags = "all allopt";
-
-  doCheck = true;
-  
-  checkTarget = "test";
-
-  preInstall = "ensureDir $INSTALLDIR";
-
-  postInstall = "cp -a ${./META} $INSTALLDIR/META";
+  preBuild = "ensureDir $out/lib/ocaml/${ocaml_version}/site-lib/cryptokit";
 
   meta = {
     homepage = "http://pauillac.inria.fr/~xleroy/software.html";
diff --git a/pkgs/development/ocaml-modules/cryptokit/makefile.patch b/pkgs/development/ocaml-modules/cryptokit/makefile.patch
deleted file mode 100644
index b4a82c7d677f..000000000000
--- a/pkgs/development/ocaml-modules/cryptokit/makefile.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-diff -Nuar cryptokit-1.3/Makefile cryptokit-1.3.nixos/Makefile
---- cryptokit-1.3/Makefile	2005-04-20 15:19:54.000000000 +0200
-+++ cryptokit-1.3.nixos/Makefile	2010-08-17 15:22:07.000000000 +0200
-@@ -9,14 +9,13 @@
- 
- # The directory containing the Zlib library (libz.a or libz.so)
- # Leave blank if you don't have Zlib.
--ZLIB_LIBDIR=/usr/lib
--#ZLIB_LIBDIR=/usr/lib64    # for x86-64 Linux
-+ZLIB_LIBDIR=@ZLIB_LIBDIR@
- 
- # The directory containing the Zlib header file (zlib.h)
--ZLIB_INCLUDE=/usr/include
-+ZLIB_INCLUDE=@ZLIB_INCLUDE@
- 
- # Where to install the library. By default: OCaml's standard library directory.
--INSTALLDIR=`$(OCAMLC) -where`
-+INSTALLDIR=@INSTALLDIR@
- 
- # Flags for the C compiler.
- CFLAGS=-O -I$(ZLIB_INCLUDE) $(ZLIB)
diff --git a/pkgs/development/ocaml-modules/ocamlgraph/default.nix b/pkgs/development/ocaml-modules/ocamlgraph/default.nix
new file mode 100644
index 000000000000..92a465731174
--- /dev/null
+++ b/pkgs/development/ocaml-modules/ocamlgraph/default.nix
@@ -0,0 +1,40 @@
+{stdenv, fetchurl, ocaml, findlib }:
+
+let
+  ocaml_version = (builtins.parseDrvName ocaml.name).version;
+  version = "1.8.1";
+in
+
+stdenv.mkDerivation {
+  name = "ocamlgraph-${version}";
+
+  src = fetchurl {
+    url = "http://ocamlgraph.lri.fr/download/ocamlgraph-${version}.tar.gz";
+    sha256 = "0hrba69wvw9b42irkvjf6q7zzw12v5nyyc33yaq3jlf1qbzqhqxs";
+  };
+
+  buildInputs = [ ocaml findlib ];
+
+  patches = ./destdir.patch;
+
+  postPatch = ''
+    sed -i 's@$(DESTDIR)$(OCAMLLIB)/ocamlgraph@$(DESTDIR)/lib/ocaml/${ocaml_version}/site-lib/ocamlgraph@' Makefile.in
+  '';
+
+  createFindlibDestdir = true;
+
+  buildPhase = ''
+    make all
+    make install-findlib
+  '';
+
+  meta = {
+    homepage = http://ocamlgraph.lri.fr/;
+    description = "ocamlgraph is a graph library for Objective Caml.";
+    license = "GNU Library General Public License version 2, with the special exception on linking described in file LICENSE";
+    platforms = ocaml.meta.platforms;
+    maintainers = [
+      stdenv.lib.maintainers.kkallio
+    ];
+  };
+}
diff --git a/pkgs/development/ocaml-modules/ocamlgraph/destdir.patch b/pkgs/development/ocaml-modules/ocamlgraph/destdir.patch
new file mode 100644
index 000000000000..38fca1c491fa
--- /dev/null
+++ b/pkgs/development/ocaml-modules/ocamlgraph/destdir.patch
@@ -0,0 +1,13 @@
+diff -Naur -x '*~' ocamlgraph-1.8.1/Makefile.in ocamlgraph-1.8.1-new//Makefile.in
+--- ocamlgraph-1.8.1/Makefile.in	2011-10-17 09:57:03.000000000 -0430
++++ ocamlgraph-1.8.1-new//Makefile.in	2011-11-24 13:01:22.626004819 -0430
+@@ -16,8 +16,8 @@
+ ##########################################################################
+ 
+ # Where to install the binaries
+-DESTDIR	=
+ prefix	=@prefix@
++DESTDIR=$(prefix)
+ exec_prefix=@exec_prefix@
+ datarootdir=@datarootdir@
+ BINDIR	=$(DESTDIR)@bindir@
diff --git a/pkgs/development/ocaml-modules/ulex/default.nix b/pkgs/development/ocaml-modules/ulex/default.nix
index aee65a6e2ee8..19beeec1ec54 100644
--- a/pkgs/development/ocaml-modules/ulex/default.nix
+++ b/pkgs/development/ocaml-modules/ulex/default.nix
@@ -15,6 +15,8 @@ stdenv.mkDerivation {
     sha256 = "0fjlkwps14adfgxdrbb4yg65fhyimplvjjs1xqj5np197cig67x0";
   };
 
+  createFindlibDestdir = true;
+
   buildInputs = [ocaml findlib];
 
   buildFlags = "all all.opt";
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index dd577a0c4729..408cd2e7c4cc 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -2387,6 +2387,8 @@ let
 
     ocaml_expat = callPackage ../development/ocaml-modules/expat { };
 
+    ocamlgraph = callPackage ../development/ocaml-modules/ocamlgraph { };
+
     ocaml_http = callPackage ../development/ocaml-modules/http { };
 
     ocaml_lwt = callPackage ../development/ocaml-modules/lwt { };
@@ -2405,8 +2407,12 @@ let
 
     ocaml_ssl = callPackage ../development/ocaml-modules/ssl { };
 
+    opa = callPackage ../development/compilers/opa { }; 
+
     ounit = callPackage ../development/ocaml-modules/ounit { };
 
+    ulex = callPackage ../development/ocaml-modules/ulex { };
+
     ulex08 = callPackage ../development/ocaml-modules/ulex/0.8 {
       camlp5 = camlp5_5_transitional;
     };