From 59b94c36f82d442cd93709615e1b81fd78ce70e2 Mon Sep 17 00:00:00 2001 From: Eric Merritt Date: Fri, 15 May 2015 09:36:50 -0500 Subject: [PATCH] ocaml-re2: add initial version (112.06.00) to the system --- .../ocaml-modules/re2/Makefile.patch | 17 +++++++++++ .../development/ocaml-modules/re2/default.nix | 29 +++++++++++++++++++ .../ocaml-modules/re2/myocamlbuild.patch | 24 +++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 4 files changed, 72 insertions(+) create mode 100644 pkgs/development/ocaml-modules/re2/Makefile.patch create mode 100644 pkgs/development/ocaml-modules/re2/default.nix create mode 100644 pkgs/development/ocaml-modules/re2/myocamlbuild.patch diff --git a/pkgs/development/ocaml-modules/re2/Makefile.patch b/pkgs/development/ocaml-modules/re2/Makefile.patch new file mode 100644 index 00000000000..fcb6eefe62b --- /dev/null +++ b/pkgs/development/ocaml-modules/re2/Makefile.patch @@ -0,0 +1,17 @@ +--- ./lib/Makefile 2014-11-18 08:16:19.000000000 -0800 ++++ ./lib/Makefile 2015-05-23 14:48:31.000000000 -0700 +@@ -6,12 +6,12 @@ + all: libre2_stubs.a dllre2_stubs.so + + dllre2_stubs.so libre2_stubs.a: stubs.o $(LIBRE2) +- ocamlmklib -oc re2_stubs stubs.o $(LIBRE2) -lstdc++ ++ ocamlmklib -oc re2_stubs stubs.o $(LIBRE2) -lc++ + rm libre2_stubs.a # ocamlmklib just includes $(LIBRE2) inside the stubs archive + cp $(LIBRE2) libre2_stubs.a && ar r libre2_stubs.a stubs.o + + stubs.o: stubs.cpp stubs.h util.h enum_x_macro.h +- g++ -O2 -DPIC -fPIC -g -pipe -DCAML_NAME_SPACE -Wall -I. -I../../../include \ ++ $(CXX) -O2 -DPIC -fPIC -g -pipe -DCAML_NAME_SPACE -Wall -I. -I../../../include \ + -I$(RE2_HOME) -I$(ocaml-version-selected-include-path) -c stubs.cpp + + #stubs.o: %.o: %.cpp %.h diff --git a/pkgs/development/ocaml-modules/re2/default.nix b/pkgs/development/ocaml-modules/re2/default.nix new file mode 100644 index 00000000000..e89e28fe1e5 --- /dev/null +++ b/pkgs/development/ocaml-modules/re2/default.nix @@ -0,0 +1,29 @@ +{stdenv, buildOcaml, fetchurl, ocaml, core, pa_ounit, pa_test, + bin_prot, comparelib, sexplib, rsync}: + +buildOcaml rec { + name = "re2"; + version = "112.06.00"; + + minimumSupportedOcamlVersion = "4.00"; + + src = fetchurl { + url = "https://github.com/janestreet/re2/archive/${version}.tar.gz"; + sha256 = "a538765872363fcb67f12b95c07455a0afd68f5ae9008b59bb85a996d97cc752"; + }; + patches = if stdenv.isDarwin + then [./Makefile.patch ./myocamlbuild.patch] + else null; + + buildInputs = [ pa_ounit pa_test rsync ]; + propagatedBuildInputs = [ core bin_prot comparelib sexplib ]; + + hasSharedObjects = true; + + meta = with stdenv.lib; { + homepage = https://github.com/janestreet/re2; + description = "OCaml bindings for RE2"; + license = stdenv.lib.licenses.asl20; + maintainers = [ maintainers.ericbmerritt ]; + }; +} diff --git a/pkgs/development/ocaml-modules/re2/myocamlbuild.patch b/pkgs/development/ocaml-modules/re2/myocamlbuild.patch new file mode 100644 index 00000000000..46ad6fa801b --- /dev/null +++ b/pkgs/development/ocaml-modules/re2/myocamlbuild.patch @@ -0,0 +1,24 @@ +--- ./myocamlbuild.ml 2015-05-23 14:35:18.000000000 -0700 ++++ ./myocamlbuild.ml 2015-05-23 15:05:24.000000000 -0700 +@@ -626,16 +626,18 @@ + rule "Generate lib/options.ml" + ~prod:"lib/options.ml" + ~deps:["lib/options.mlp"; "lib/enum_x_macro.h"] +- (fun _ _ -> Cmd (S[A"gcc"; A"-E"; A"-P"; A"-x"; A"c"; ++ (fun _ _ -> Cmd (S[A"cc"; A"-E"; A"-P"; A"-x"; A"c"; + P"lib/options.mlp"; A"-o"; P"lib/options.ml"])); + + flag ["ocaml"; "link"; "library"; "native"] (S[A"-cclib"; A"-Llib"; + A"-cclib"; A"-lre2_stubs"; +- A"-cclib"; A"-lstdc++"]); ++ A"-ccopt"; A"--stdlib=libc++"; ++ A"-cclib"; A"-lc++"]); + flag ["ocaml"; "link"; "library"; "byte"] (S[A"-dllib"; A"dllre2_stubs.so"; + A"-cclib"; A"-Llib"; + A"-cclib"; A"-lre2_stubs"; +- A"-cclib"; A"-lstdc++"]); ++ A"-ccopt"; A"--stdlib=libc++"; ++ A"-cclib"; A"-lc++"]); + | _ -> + () + diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index a8f879c05bf..a260a98f371 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -4315,6 +4315,8 @@ let ounit = callPackage ../development/ocaml-modules/ounit { }; + re2 = callPackage ../development/ocaml-modules/re2 { }; + tyxml = callPackage ../development/ocaml-modules/tyxml { }; ulex = callPackage ../development/ocaml-modules/ulex { };