Updates ocaml-sexplib and ocaml-typeconv

Fixes OCaml / camlp5 version mismatch
This commit is contained in:
Vincent Laporte 2014-09-19 19:09:37 +01:00
parent f5c43d9f62
commit 8febae5dfd
9 changed files with 106 additions and 235 deletions

View file

@ -0,0 +1,27 @@
{stdenv, fetchurl, ocaml, findlib, typeconv}:
let
ocaml_version = (builtins.parseDrvName ocaml.name).version;
in
assert stdenv.lib.versionOlder "3.12" ocaml_version;
stdenv.mkDerivation {
name = "ocaml-sexplib-108.08.00";
src = fetchurl {
url = https://ocaml.janestreet.com/ocaml-core/108.08.00/individual/sexplib-108.08.00.tar.gz;
sha256 = "11z1k1d7dbb5m957klgalimpr0r602xp5zkkbgbffib1bphasarg";
};
buildInputs = [ocaml findlib typeconv ];
createFindlibDestdir = true;
meta = {
homepage = https://ocaml.janestreet.com/;
description = "Library for serializing OCaml values to and from S-expressions";
license = stdenv.lib.asl20;
platforms = ocaml.meta.platforms;
};
}

View file

@ -1,22 +1,27 @@
{stdenv, fetchurl, ocaml, findlib, ocaml_typeconv}:
let
ocaml_version = (builtins.parseDrvName ocaml.name).version;
in
assert stdenv.lib.versionOlder "4.00" ocaml_version;
stdenv.mkDerivation {
name = "ocaml-sexplib-7.0.5";
name = "ocaml-sexplib-111.25.0";
src = fetchurl {
url = "http://forge.ocamlcore.org/frs/download.php/832/sexplib-7.0.5.tar.gz";
sha256 = "b1022da052254581aae51fb634345920364439f715a2c786abcd0b828c2ce697";
url = https://ocaml.janestreet.com/ocaml-core/111.25.00/individual/sexplib-111.25.00.tar.gz;
sha256 = "0qh0zqp5nakqpmmhh4x7cg03vqj3j2bj4zj0nqdlksai188p9ila";
};
patches = [ ./sexp-3.10-compat.patch ./sexplib-7.0.5-patch-ocamlbuild-ocaml4.patch ];
buildInputs = [ocaml findlib ocaml_typeconv ];
createFindlibDestdir = true;
meta = {
homepage = "http://forge.ocamlcore.org/projects/sexplib/";
homepage = https://ocaml.janestreet.com/;
description = "Library for serializing OCaml values to and from S-expressions";
license = "LGPL";
license = stdenv.lib.asl20;
platforms = ocaml.meta.platforms;
};
}

View file

@ -1,167 +0,0 @@
diff -ur orig/sexplib-7.0.5/lib/conv.ml sexplib-7.0.5/lib/conv.ml
--- orig/sexplib-7.0.5/lib/conv.ml 2012-03-20 17:41:54.000000000 +0100
+++ sexplib-7.0.5/lib/conv.ml 2012-03-26 20:04:58.128032729 +0200
@@ -665,7 +665,7 @@
| Parse_error pe ->
let ppos =
match pe.parse_state with
- | `Sexp { parse_pos } | `Annot { parse_pos } -> parse_pos
+ | `Sexp { parse_pos = parse_pos } | `Annot { parse_pos = parse_pos } -> parse_pos
in
List [
Atom "Sexplib.Sexp.Parse_error";
diff -ur orig/sexplib-7.0.5/lib/pre_sexp.ml sexplib-7.0.5/lib/pre_sexp.ml
--- orig/sexplib-7.0.5/lib/pre_sexp.ml 2012-03-20 17:41:54.000000000 +0100
+++ sexplib-7.0.5/lib/pre_sexp.ml 2012-03-26 20:04:58.129032741 +0200
@@ -172,13 +172,7 @@
(* Output of S-expressions to file *)
let save_of_output ?perm output_function file sexp =
- let tmp_name, oc =
- let temp_dir =
- if Filename.is_relative file then "."
- else Filename.dir_sep
- in
- Filename.open_temp_file ~temp_dir file "tmp"
- in
+ let tmp_name, oc = Filename.open_temp_file file "tmp" in
try
output_function oc sexp;
close_out oc;
@@ -316,9 +310,9 @@
else if text_char < 0 then fail "text_char < 0"
else if global_offset < 0 then fail "global_offset < 0"
else if buf_pos < 0 then fail "buf_pos < 0"
- else { text_line; text_char; global_offset; buf_pos }
+ else { text_line = text_line; text_char = text_char; global_offset = global_offset; buf_pos = buf_pos }
- let with_buf_pos t buf_pos = { t with buf_pos }
+ let with_buf_pos t buf_pos = { t with buf_pos = buf_pos }
end
type ('a, 't) parse_result =
@@ -347,11 +341,11 @@
exception Parse_error of parse_error
-let bump_text_line { parse_pos } =
+let bump_text_line { parse_pos = parse_pos } =
parse_pos.Parse_pos.text_line <- parse_pos.Parse_pos.text_line + 1;
parse_pos.Parse_pos.text_char <- 0
-let bump_text_pos { parse_pos } =
+let bump_text_pos { parse_pos = parse_pos } =
parse_pos.Parse_pos.text_char <- parse_pos.Parse_pos.text_char + 1
let bump_pos_cont state str ~max_pos ~pos cont =
@@ -378,18 +372,18 @@
parse_pos.Parse_pos.buf_pos <- buf_pos;
parse_pos.Parse_pos.global_offset <- parse_pos.Parse_pos.global_offset + len
-let mk_parse_pos { parse_pos } buf_pos =
+let mk_parse_pos { parse_pos = parse_pos } buf_pos =
set_parse_pos parse_pos buf_pos;
parse_pos
let raise_parse_error parse_state location buf_pos err_msg =
begin
match parse_state with
- | `Sexp { parse_pos } | `Annot { parse_pos } ->
+ | `Sexp { parse_pos = parse_pos } | `Annot { parse_pos = parse_pos } ->
set_parse_pos parse_pos buf_pos;
parse_pos.Parse_pos.text_char <- parse_pos.Parse_pos.text_char + 1;
end;
- let parse_error = { location; err_msg; parse_state } in
+ let parse_error = { location = location; err_msg = err_msg; parse_state = parse_state } in
raise (Parse_error parse_error)
let raise_unexpected_char parse_state location buf_pos c =
@@ -657,7 +651,7 @@
let max_pos = check_str_bounds "parse" ~pos ~len str in \
let state = \
{ \
- parse_pos; \
+ parse_pos = parse_pos; \
pstack = INIT_PSTACK; \
pbuf = Buffer.create 128; \
} \
@@ -681,20 +675,20 @@
let mk_annot_pos
({ Parse_pos.text_line = line; text_char = col } as parse_pos) pos =
- { Annot.line; col; offset = get_glob_ofs parse_pos pos }
+ { Annot.line = line; col = col; offset = get_glob_ofs parse_pos pos }
let mk_annot_pos1
({ Parse_pos.text_line = line; text_char = col } as parse_pos) pos =
- { Annot.line; col = col + 1; offset = get_glob_ofs parse_pos pos }
+ { Annot.line = line; col = col + 1; offset = get_glob_ofs parse_pos pos }
-let add_annot_pos { parse_pos; pstack } pos =
+let add_annot_pos { parse_pos = parse_pos; pstack = pstack } pos =
pstack.Annot.positions <- mk_annot_pos parse_pos pos :: pstack.Annot.positions
-let add_annot_pos1 { parse_pos; pstack } pos =
+let add_annot_pos1 { parse_pos = parse_pos; pstack = pstack } pos =
pstack.Annot.positions <-
mk_annot_pos1 parse_pos pos :: pstack.Annot.positions
-let get_annot_range { parse_pos; pstack } pos =
+let get_annot_range { parse_pos = parse_pos; pstack = pstack } pos =
let start_pos =
match pstack.Annot.positions with
| [] -> assert false (* impossible *)
@@ -708,7 +702,7 @@
offset = get_glob_ofs parse_pos pos;
}
in
- { Annot.start_pos; end_pos }
+ { Annot.start_pos = start_pos; end_pos = end_pos }
let mk_annot_atom parse_state str pos =
Annot.Atom (get_annot_range parse_state pos, Atom str)
@@ -780,7 +774,7 @@
let rec loop this_parse ~pos ~len ~is_incomplete =
if len > 0 then
match this_parse ~pos ~len buf with
- | Done (sexp, ({ Parse_pos.buf_pos } as parse_pos)) ->
+ | Done (sexp, ({ Parse_pos.buf_pos = buf_pos } as parse_pos)) ->
rev_sexps_ref := sexp :: !rev_sexps_ref;
let n_parsed = buf_pos - pos in
let this_parse = mk_this_parse ~parse_pos my_parse in
@@ -813,7 +807,7 @@
let of_string_bigstring loc this_parse ws_buf get_len get_sub str =
match this_parse str with
- | Done (_, { Parse_pos.buf_pos }) when buf_pos <> get_len str ->
+ | Done (_, { Parse_pos.buf_pos = buf_pos }) when buf_pos <> get_len str ->
let prefix_len = min (get_len str - buf_pos) 20 in
let prefix = get_sub str buf_pos prefix_len in
let msg =
@@ -874,7 +868,7 @@
failwith (sprintf "Sexplib.Sexp.gen_load_sexp: end of file: %s" file)
else
match this_parse ~pos:0 ~len buf with
- | Done (sexp, ({ Parse_pos.buf_pos } as parse_pos))
+ | Done (sexp, ({ Parse_pos.buf_pos = buf_pos } as parse_pos))
when strict ->
let rec strict_loop this_parse ~pos ~len =
match this_parse ~pos ~len buf with
@@ -938,7 +932,7 @@
let get_conv_exn ~file ~exc annot_sexp =
let range = get_range annot_sexp in
- let { start_pos = { line; col } } = range in
+ let { start_pos = { line = line; col = col } } = range in
let loc = sprintf "%s:%d:%d" file line col in
Of_sexp_error (Annot.Conv_exn (loc, exc), get_sexp annot_sexp)
end
@@ -1003,7 +997,7 @@
let sexp = of_string str in
try f sexp
with Of_sexp_error (exc, sub_sexp) ->
- raise (Of_string_conv_exn.E { Of_string_conv_exn.exc; sexp; sub_sexp })
+ raise (Of_string_conv_exn.E { Of_string_conv_exn.exc = exc; sexp = sexp; sub_sexp = sub_sexp })
let of_string_conv_exn str f = gen_of_string_conv_exn of_string str f
let of_bigstring_conv_exn bstr f = gen_of_string_conv_exn of_bigstring bstr f

View file

@ -1,29 +0,0 @@
Patch from the fedora repository.
--- sexplib-7.0.5.old/myocamlbuild.ml 2012-03-20 16:41:54.000000000 +0000
+++ sexplib-7.0.5/myocamlbuild.ml 2012-07-30 11:38:21.829869635 +0100
@@ -438,7 +438,13 @@
BaseEnvLight.var_choose cond_specs env
in
flag tags & spec)
- t.flags
+ t.flags;
+
+ flag ["ocaml"; "compile"; "byte"; "use_toploop"] (S[A"-I"; A"+compiler-libs"]);
+ flag ["ocaml"; "link"; "byte"; "use_toploop"] (S[A"-I"; A"+compiler-libs"; A"+compiler-libs/ocamltoplevel.cma"]);
+ flag ["ocaml"; "compile"; "native"; "use_toploop"] (S[A"-I"; A"+compiler-libs"]);
+ flag ["ocaml"; "link"; "native"; "use_toploop"] (S[A"-I"; A"+compiler-libs"; A"+compiler-libs/ocamltoplevel.cmxa"]);
+
| _ ->
()
--- sexplib-7.0.5.old/_tags 2012-03-20 16:41:54.000000000 +0000
+++ sexplib-7.0.5/_tags 2012-07-30 11:37:01.749255839 +0100
@@ -49,6 +49,7 @@
<lib_test/*.ml{,i}>: pkg_camlp4.extend
# Library sexplib_top
"top": include
+<top/*.ml{,i}>: use_toploop
# Executable sexp_test
"lib_test/sexp_test.byte": use_sexplib
"lib_test/sexp_test.byte": pkg_unix

View file

@ -0,0 +1,28 @@
{stdenv, fetchurl, ocaml, findlib}:
let
ocaml_version = (builtins.parseDrvName ocaml.name).version;
in
assert stdenv.lib.versionOlder "3.12" ocaml_version;
stdenv.mkDerivation {
name = "ocaml-typeconv-108.08.00";
src = fetchurl {
url = https://ocaml.janestreet.com/ocaml-core/108.08.00/individual/type_conv-108.08.00.tar.gz;
sha256 = "08ysikwwp69zvc147lzzg79nwlrzrk738rj0ggcfadi8h5il42sl";
};
buildInputs = [ocaml findlib];
createFindlibDestdir = true;
meta = with stdenv.lib; {
homepage = https://ocaml.janestreet.com/;
description = "Support library for OCaml preprocessor type conversions";
license = licenses.apl20;
platforms = ocaml.meta.platforms;
maintainers = with maintainers; [ z77z ];
};
}

View file

@ -1,23 +0,0 @@
{stdenv, fetchurl, ocaml, findlib}:
# note: works only with ocaml >3.12
stdenv.mkDerivation {
name = "ocaml-typeconv-3.0.5";
src = fetchurl {
url = "http://forge.ocamlcore.org/frs/download.php/821/type_conv-3.0.5.tar.gz";
sha256 = "90ac6c401a600a23012a3f513def6f67d4979b11bd551f4d0af78f0f0b479198";
};
buildInputs = [ocaml findlib ];
createFindlibDestdir = true;
meta = {
homepage = "http://forge.ocamlcore.org/projects/type-conv/";
description = "Support library for OCaml preprocessor type conversions";
license = "LGPL";
platforms = ocaml.meta.platforms;
};
}

View file

@ -1,5 +1,11 @@
{stdenv, fetchurl, ocaml, findlib}:
let
ocaml_version = (builtins.parseDrvName ocaml.name).version;
in
assert stdenv.lib.versionOlder "4.00" ocaml_version;
stdenv.mkDerivation {
name = "ocaml-typeconv-109.60.01";

View file

@ -8,6 +8,8 @@ let
metafile = ./META;
in
assert !stdenv.lib.versionOlder "4.00" ocaml_version;
stdenv.mkDerivation {
name = "${pname}${if transitional then "_transitional" else ""}-${version}";

View file

@ -3287,16 +3287,26 @@ let
ber_metaocaml_003 = callPackage ../development/compilers/ocaml/ber-metaocaml-003.nix { };
mkOcamlPackages = ocaml: self: let callPackage = newScope self; in rec {
mkOcamlPackages = ocaml: self:
let
callPackage = newScope self;
ocaml_version = (builtins.parseDrvName ocaml.name).version;
in rec {
inherit ocaml;
camlidl = callPackage ../development/tools/ocaml/camlidl { };
camlp5_5_strict = callPackage ../development/tools/ocaml/camlp5/5.15.nix { };
camlp5_old_strict =
if lib.versionOlder "4.00" ocaml_version
then camlp5_6_strict
else callPackage ../development/tools/ocaml/camlp5/5.15.nix { };
camlp5_5_transitional = callPackage ../development/tools/ocaml/camlp5/5.15.nix {
transitional = true;
};
camlp5_old_transitional =
if lib.versionOlder "4.00" ocaml_version
then camlp5_6_transitional
else callPackage ../development/tools/ocaml/camlp5/5.15.nix {
transitional = true;
};
camlp5_6_strict = callPackage ../development/tools/ocaml/camlp5 { };
@ -3426,11 +3436,23 @@ let
camlp5 = camlp5_transitional;
};
ocaml_typeconv = callPackage ../development/ocaml-modules/typeconv { };
typeconv_108_08_00 = callPackage ../development/ocaml-modules/typeconv/108.08.00.nix { };
ocaml_typeconv =
if lib.versionOlder "4.00" ocaml_version
then callPackage ../development/ocaml-modules/typeconv { }
else if lib.versionOlder "3.12" ocaml_version
then typeconv_108_08_00
else null;
ocaml_typeconv_3_0_5 = callPackage ../development/ocaml-modules/typeconv/3.0.5.nix { };
ocaml_sexplib = callPackage ../development/ocaml-modules/sexplib { };
sexplib_108_08_00 = callPackage ../development/ocaml-modules/sexplib/108.08.00.nix {
typeconv = typeconv_108_08_00;
};
ocaml_sexplib =
if lib.versionOlder "4.00" ocaml_version
then callPackage ../development/ocaml-modules/sexplib { }
else if lib.versionOlder "3.12" ocaml_version
then sexplib_108_08_00
else null;
ocaml_extlib = callPackage ../development/ocaml-modules/extlib { };
ocaml_extlib_maximal = callPackage ../development/ocaml-modules/extlib {
@ -11230,7 +11252,7 @@ let
ocaml = ocaml_3_11_2;
inherit (ocamlPackages_3_11_2) findlib lablgtk ocaml_expat gmetadom ocaml_http
lablgtkmathview ocaml_mysql ocaml_sqlite3 ocamlnet camlzip ocaml_pcre;
ulex08 = ocamlPackages_3_11_2.ulex08.override { camlp5 = ocamlPackages_3_11_2.camlp5_5_transitional; };
ulex08 = ocamlPackages_3_11_2.ulex08.override { camlp5 = ocamlPackages_3_11_2.camlp5_old_transitional; };
};
matita_130312 = lowPrio (callPackage ../applications/science/logic/matita/130312.nix {