Change some deprecated functions for OCaml 4.5.0.

This commit is contained in:
Richard W.M. Jones 2017-08-08 19:07:53 +01:00
parent 93b020e1f1
commit 4808efbf9c
3 changed files with 83 additions and 30 deletions

View File

@ -1,24 +0,0 @@
--- ./src/unix/lwt_unix.ml.orig 2012-12-27 05:29:57.000000000 -0700
+++ ./src/unix/lwt_unix.ml 2013-09-18 11:00:00.000000000 -0600
@@ -596,6 +596,9 @@ type open_flag =
#if ocaml_version >= (3, 13)
| O_SHARE_DELETE
#endif
+#if ocaml_version >= (4, 1)
+ | O_CLOEXEC
+#endif
#if windows
--- ./src/unix/lwt_unix.mli.orig 2012-12-27 05:29:57.000000000 -0700
+++ ./src/unix/lwt_unix.mli 2013-09-18 11:00:00.000000000 -0600
@@ -315,6 +315,9 @@ type open_flag =
#if ocaml_version >= (3, 13)
| O_SHARE_DELETE
#endif
+#if ocaml_version >= (4, 1)
+ | O_CLOEXEC
+#endif
val openfile : string -> open_flag list -> file_perm -> file_descr Lwt.t
(** Wrapper for [Unix.openfile]. *)

69
lwt-2.5.0-ocaml45.patch Normal file
View File

@ -0,0 +1,69 @@
diff -ur lwt-2.5.0.old/myocamlbuild.ml lwt-2.5.0/myocamlbuild.ml
--- lwt-2.5.0.old/myocamlbuild.ml 2015-07-03 13:39:30.000000000 +0100
+++ lwt-2.5.0/myocamlbuild.ml 2017-08-08 19:13:04.789273169 +0100
@@ -538,7 +538,7 @@
| nm, [], intf_modules ->
ocaml_lib nm;
let cmis =
- List.map (fun m -> (String.uncapitalize m) ^ ".cmi")
+ List.map (fun m -> (String.uncapitalize_ascii m) ^ ".cmi")
intf_modules in
dep ["ocaml"; "link"; "library"; "file:"^nm^".cma"] cmis
| nm, dir :: tl, intf_modules ->
@@ -551,7 +551,7 @@
["compile"; "infer_interface"; "doc"])
tl;
let cmis =
- List.map (fun m -> dir^"/"^(String.uncapitalize m)^".cmi")
+ List.map (fun m -> dir^"/"^(String.uncapitalize_ascii m)^".cmi")
intf_modules in
dep ["ocaml"; "link"; "library"; "file:"^dir^"/"^nm^".cma"]
cmis)
diff -ur lwt-2.5.0.old/src/unix/lwt_unix.ml lwt-2.5.0/src/unix/lwt_unix.ml
--- lwt-2.5.0.old/src/unix/lwt_unix.ml 2015-07-03 13:39:30.000000000 +0100
+++ lwt-2.5.0/src/unix/lwt_unix.ml 2017-08-08 19:14:31.957333383 +0100
@@ -588,6 +588,7 @@
| O_RSYNC
| O_SHARE_DELETE
| O_CLOEXEC
+ | O_KEEPEXEC
external open_job : string -> Unix.open_flag list -> int -> (Unix.file_descr * bool) job = "lwt_unix_open_job"
@@ -1326,7 +1327,7 @@
check_descriptor ch;
Unix.shutdown ch.fd shutdown_command
-external stub_socketpair : socket_domain -> socket_type -> int -> Unix.file_descr * Unix.file_descr = "lwt_unix_socketpair_stub"
+external stub_socketpair : ?cloexec:bool -> socket_domain -> socket_type -> int -> Unix.file_descr * Unix.file_descr = "lwt_unix_socketpair_stub"
let socketpair dom typ proto =
let do_socketpair = if Sys.win32 then stub_socketpair else Unix.socketpair in
Only in lwt-2.5.0/src/unix: lwt_unix.ml~
diff -ur lwt-2.5.0.old/src/unix/lwt_unix.mli lwt-2.5.0/src/unix/lwt_unix.mli
--- lwt-2.5.0.old/src/unix/lwt_unix.mli 2015-07-03 13:39:30.000000000 +0100
+++ lwt-2.5.0/src/unix/lwt_unix.mli 2017-08-08 19:13:04.790273170 +0100
@@ -314,6 +314,7 @@
| O_RSYNC
| O_SHARE_DELETE
| O_CLOEXEC
+ | O_KEEPEXEC
val openfile : string -> open_flag list -> file_perm -> file_descr Lwt.t
(** Wrapper for [Unix.openfile]. *)
diff -ur lwt-2.5.0.old/src/unix/lwt_unix_stubs.c lwt-2.5.0/src/unix/lwt_unix_stubs.c
--- lwt-2.5.0.old/src/unix/lwt_unix_stubs.c 2015-07-03 13:39:30.000000000 +0100
+++ lwt-2.5.0/src/unix/lwt_unix_stubs.c 2017-08-08 19:15:07.469357918 +0100
@@ -453,9 +453,9 @@
SOCK_STREAM, SOCK_DGRAM, SOCK_RAW, SOCK_SEQPACKET
};
-CAMLprim value lwt_unix_socketpair_stub(value domain, value type, value protocol)
+CAMLprim value lwt_unix_socketpair_stub(value cloexec, value domain, value type, value protocol)
{
- CAMLparam3(domain, type, protocol);
+ CAMLparam4(cloexec, domain, type, protocol);
CAMLlocal1(result);
SOCKET sockets[2];
lwt_unix_socketpair(socket_domain_table[Int_val(domain)],
Only in lwt-2.5.0/src/unix: lwt_unix_stubs.c~

View File

@ -1,8 +1,11 @@
%global opt %(test -x %{_bindir}/ocamlopt && echo 1 || echo 0)
# *NB:* We are "stuck" on older LWT 2.5.0 because upstream has moved
# to jbuilder which is a quasi build system and package manager. If
# you want to move to the new version you'll have to deal with
# packaging jbuilder first.
Name: ocaml-lwt
Version: 2.5.0
Release: 14%{?dist}
Release: 15%{?dist}
Summary: OCaml lightweight thread library
# The openssl linking exception is granted.
@ -10,6 +13,9 @@ License: LGPLv2+ with exceptions
URL: http://ocsigen.org/lwt
Source0: https://github.com/ocsigen/lwt/archive/2.5.0/lwt-2.5.0.tar.gz
# Change some deprecated functions for OCaml 4.5.0.
Patch1: lwt-2.5.0-ocaml45.patch
BuildRequires: ocaml >= 3.10.0
BuildRequires: ocaml-ocamlbuild
BuildRequires: ocaml-findlib-devel
@ -40,6 +46,8 @@ developing applications that use %{name}.
%prep
%setup -q -n lwt-%{version}
%patch1 -p1
%build
./configure \
@ -59,7 +67,7 @@ chrpath --delete $OCAMLFIND_DESTDIR/stublibs/dll*.so
%check
%if %{opt}
%ifarch %{ocaml_native_compiler}
./configure --enable-ssl --enable-glib --enable-react --enable-tests \
--prefix=%{_prefix}
# Some tests fail, unclear why. Make the tests advisory for now.
@ -73,7 +81,7 @@ OCAMLPATH=$RPM_BUILD_ROOT%{_libdir}/ocaml ocamlfind query lwt.react
%files
%doc LICENSE COPYING
%{_libdir}/ocaml/lwt
%if %opt
%ifarch %{ocaml_native_compiler}
%exclude %{_libdir}/ocaml/lwt/*.a
%exclude %{_libdir}/ocaml/lwt/*.cmxa
#%exclude %{_libdir}/ocaml/lwt/*.cmx
@ -85,7 +93,7 @@ OCAMLPATH=$RPM_BUILD_ROOT%{_libdir}/ocaml ocamlfind query lwt.react
%files devel
%doc CHANGES README.md
%if %opt
%ifarch %{ocaml_native_compiler}
%{_libdir}/ocaml/lwt/*.a
%{_libdir}/ocaml/lwt/*.cmxa
#%{_libdir}/ocaml/lwt/*.cmx
@ -94,7 +102,7 @@ OCAMLPATH=$RPM_BUILD_ROOT%{_libdir}/ocaml ocamlfind query lwt.react
%changelog
* Tue Aug 08 2017 Richard W.M. Jones <rjones@redhat.com> - 2.5.0-14
* Tue Aug 08 2017 Richard W.M. Jones <rjones@redhat.com> - 2.5.0-15
- OCaml 4.05.0 rebuild.
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.5.0-13