[packages/ocaml-easy-format] - new URLs, updated to 1.3.2; now uses dune - added compile patch from git (fixes deprecation errors

qboosh qboosh at pld-linux.org
Wed Sep 15 22:04:37 CEST 2021


commit cf5c402984a81f1b69338d4c24dd51e3c383bd66
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Wed Sep 15 22:09:10 2021 +0200

    - new URLs, updated to 1.3.2; now uses dune
    - added compile patch from git (fixes deprecation errors)

 ocaml-easy-format-compile.patch | 397 ++++++++++++++++++++++++++++++++++++++++
 ocaml-easy-format.spec          |  43 +++--
 2 files changed, 424 insertions(+), 16 deletions(-)
---
diff --git a/ocaml-easy-format.spec b/ocaml-easy-format.spec
index 2606184..baf0f3b 100644
--- a/ocaml-easy-format.spec
+++ b/ocaml-easy-format.spec
@@ -2,7 +2,7 @@
 # Conditional build:
 %bcond_without	ocaml_opt	# build opt (native code)
 
-%ifnarch %{ix86} %{x8664} arm aarch64 ppc sparc sparcv9
+%ifnarch %{ix86} %{x8664} %{arm} aarch64 ppc sparc sparcv9
 %undefine	with_ocaml_opt
 %endif
 
@@ -10,14 +10,19 @@
 Summary:	easy(ier) pretty printing for OCaml
 Summary(pl.UTF-8):	Łatwiejsze ładne wypisywanie dla OCamla
 Name:		ocaml-%{module}
-Version:	1.0.2
-Release:	9
+Version:	1.3.2
+Release:	1
 License:	BSD
 Group:		Libraries
-Source0:	http://mjambon.com/releases/easy-format/%{module}-%{version}.tar.gz
-# Source0-md5:	82f6db85477831cab11e4cfe80321225
-URL:		http://mjambon.com/easy-format.html
-BuildRequires:	ocaml >= 3.04-7
+#Source0Download: https://github.com/ocaml-community/easy-format/releases
+Source0:	https://github.com/ocaml-community/easy-format/releases/download/%{version}/%{module}-%{version}.tbz
+# Source0-md5:	8e8e2da60d3566ab1bce5e5784ae75f9
+# https://github.com/ocaml-community/easy-format/commit/c6d5ab5ef62e7a1ec20ae8a22a39b0f06ad710a8.patch
+Patch0:		%{name}-compile.patch
+URL:		https://github.com/ocaml-community/easy-format
+BuildRequires:	ocaml >= 1:4.02.3
+BuildRequires:	ocaml-dune >= 1.10
+BuildRequires:	ocaml-findlib
 %requires_eq	ocaml-runtime
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
@@ -68,38 +73,44 @@ biblioteki easy-format.
 
 %prep
 %setup -q -n %{module}-%{version}
+%patch0 -p1
 
 %build
-%{__make} -j1 all %{?with_ocaml_opt:opt} \
-	CC="%{__cc} %{rpmcflags} -fPIC"
+dune build @all %{?_smp_mflags} --display=verbose
 
 %install
 rm -rf $RPM_BUILD_ROOT
-export OCAMLFIND_DESTDIR=$RPM_BUILD_ROOT%{_libdir}/ocaml
-install -d $OCAMLFIND_DESTDIR/stublibs
 
-%{__make} install \
-	DESTDIR=$RPM_BUILD_ROOT
+dune install --destdir=$RPM_BUILD_ROOT
+
+# just sources
+%{__rm} $RPM_BUILD_ROOT%{_libdir}/ocaml/%{module}/easy_format.ml
+# packaged as %doc
+%{__rm} -r $RPM_BUILD_ROOT%{_prefix}/doc/%{module}
 
 %clean
 rm -rf $RPM_BUILD_ROOT
 
 %files
 %defattr(644,root,root,755)
+%doc CHANGES.md LICENSE README.md
 %dir %{_libdir}/ocaml/%{module}
 %{_libdir}/ocaml/%{module}/META
-%{_libdir}/ocaml/%{module}/easy_format.cmo
+%{_libdir}/ocaml/%{module}/easy_format.cma
 %if %{with ocaml_opt}
 %attr(755,root,root) %{_libdir}/ocaml/%{module}/easy_format.cmxs
 %endif
 
 %files devel
 %defattr(644,root,root,755)
-%doc README.md Changes LICENSE
+%{_libdir}/ocaml/%{module}/dune-package
+%{_libdir}/ocaml/%{module}/opam
 %{_libdir}/ocaml/%{module}/easy_format.cmi
+%{_libdir}/ocaml/%{module}/easy_format.cmt*
 # doc?
 %{_libdir}/ocaml/%{module}/easy_format.mli
 %if %{with ocaml_opt}
-%{_libdir}/ocaml/%{module}/easy_format.o
+%{_libdir}/ocaml/%{module}/easy_format.a
 %{_libdir}/ocaml/%{module}/easy_format.cmx
+%{_libdir}/ocaml/%{module}/easy_format.cmxa
 %endif
diff --git a/ocaml-easy-format-compile.patch b/ocaml-easy-format-compile.patch
new file mode 100644
index 0000000..018ddc7
--- /dev/null
+++ b/ocaml-easy-format-compile.patch
@@ -0,0 +1,397 @@
+From fd030d0e5adeb7e172d7df1ebeac2cfaa9fed784 Mon Sep 17 00:00:00 2001
+From: Christoph Cullmann <cullmann at kde.org>
+Date: Tue, 12 Nov 2019 15:37:19 +0100
+Subject: [PATCH 1/2] fix compile with e.g. ocaml 4.09
+
+---
+ src/easy_format.ml | 94 +++++++++++++++++++++++-----------------------
+ 1 file changed, 47 insertions(+), 47 deletions(-)
+
+diff --git a/src/easy_format.ml b/src/easy_format.ml
+index a074de3..73c431c 100644
+--- a/src/easy_format.ml
++++ b/src/easy_format.ml
+@@ -199,8 +199,8 @@ struct
+     documentation of the Format module.
+   *)
+   let set_escape fmt escape =
+-    let print0, flush0 = pp_get_formatter_output_functions fmt () in
+-    let tagf0 = pp_get_formatter_tag_functions fmt () in
++    let print0, flush0 = Format.pp_get_formatter_output_functions fmt () [@warning "-3"] in
++    let tagf0 = Format.pp_get_formatter_tag_functions fmt () [@warning "-3"] in
+ 
+     let is_tag = ref false in
+ 
+@@ -228,8 +228,8 @@ struct
+         mark_close_tag = mct
+     }
+     in
+-    pp_set_formatter_output_functions fmt print flush0;
+-    pp_set_formatter_tag_functions fmt tagf
++    Format.pp_set_formatter_output_functions fmt print flush0;
++    Format.pp_set_formatter_tag_functions fmt tagf [@warning "-3"]
+ 
+ 
+   let set_escape_string fmt esc =
+@@ -243,7 +243,7 @@ struct
+ 
+   let define_styles fmt escape l =
+     if l <> [] then (
+-      pp_set_tags fmt true;
++      Format.pp_set_tags fmt true;
+       let tbl1 = Hashtbl.create (2 * List.length l) in
+       let tbl2 = Hashtbl.create (2 * List.length l) in
+       List.iter (
+@@ -261,12 +261,12 @@ struct
+       in
+ 
+       let tagf = {
+-        (pp_get_formatter_tag_functions fmt ()) with
++        (Format.pp_get_formatter_tag_functions fmt () [@warning "-3"] ) with
+           mark_open_tag = mark_open_tag;
+           mark_close_tag = mark_close_tag
+       }
+       in
+-      pp_set_formatter_tag_functions fmt tagf
++      Format.pp_set_formatter_tag_functions fmt tagf [@warning "-3"]
+     );
+ 
+     (match escape with
+@@ -319,19 +319,19 @@ struct
+ 
+   let open_tag fmt = function
+       None -> ()
+-    | Some s -> pp_open_tag fmt s
++    | Some s -> Format.pp_open_tag fmt s [@warning "-3"]
+ 
+   let close_tag fmt = function
+       None -> ()
+-    | Some _ -> pp_close_tag fmt ()
++    | Some _ -> Format.pp_close_tag fmt () [@warning "-3"]
+ 
+   let tag_string fmt o s =
+     match o with
+         None -> pp_print_string fmt s
+       | Some tag ->
+-          pp_open_tag fmt tag;
+-          pp_print_string fmt s;
+-          pp_close_tag fmt ()
++          Format.pp_open_tag fmt tag [@warning "-3"] ;
++          Format.pp_print_string fmt s;
++          Format.pp_close_tag fmt () [@warning "-3"]
+ 
+   let rec fprint_t fmt = function
+       Atom (s, p) ->
+@@ -354,12 +354,12 @@ struct
+     List.iter (
+       fun x ->
+         if p.space_before_separator then
+-          pp_print_string fmt " ";
++          Format.pp_print_string fmt " ";
+         tag_string fmt p.separator_style sep;
+         if p.space_after_separator then
+-          pp_print_space fmt ()
++          Format.pp_print_space fmt ()
+         else
+-          pp_print_cut fmt ();
++          Format.pp_print_cut fmt ();
+         fprint_t fmt x
+     ) tl;
+     close_tag fmt p.body_style
+@@ -370,12 +370,12 @@ struct
+     List.iter (
+       fun x ->
+         if p.space_before_separator then
+-          pp_print_space fmt ()
++          Format.pp_print_space fmt ()
+         else
+-          pp_print_cut fmt ();
++          Format.pp_print_cut fmt ();
+         tag_string fmt p.separator_style sep;
+         if p.space_after_separator then
+-          pp_print_string fmt " ";
++          Format.pp_print_string fmt " ";
+         fprint_t fmt x
+     ) tl;
+     close_tag fmt p.body_style
+@@ -387,7 +387,7 @@ struct
+         fprint_t fmt lab;
+         close_tag fmt lp.label_style;
+         if lp.space_after_label then
+-          pp_print_string fmt " "
++          Format.pp_print_string fmt " "
+ 
+   (* Either horizontal or vertical list *)
+   and fprint_list fmt label ((op, _sep, cl, p) as param) = function
+@@ -395,7 +395,7 @@ struct
+         fprint_opt_label fmt label;
+         tag_string fmt p.opening_style op;
+         if p.space_after_opening || p.space_before_closing then
+-          pp_print_string fmt " ";
++          Format.pp_print_string fmt " ";
+         tag_string fmt p.closing_style cl
+ 
+     | hd :: tl as l ->
+@@ -414,9 +414,9 @@ struct
+     tag_string fmt p.opening_style op;
+ 
+     if p.space_after_opening then
+-      pp_print_space fmt ()
++      Format.pp_print_space fmt ()
+     else
+-      pp_print_cut fmt ();
++      Format.pp_print_cut fmt ();
+ 
+     let open_extra, close_extra = extra_box p l in
+     open_extra fmt;
+@@ -424,11 +424,11 @@ struct
+     close_extra fmt;
+ 
+     if p.space_before_closing then
+-      pp_print_break fmt 1 (-indent)
++      Format.pp_print_break fmt 1 (-indent)
+     else
+-      pp_print_break fmt 0 (-indent);
++      Format.pp_print_break fmt 0 (-indent);
+     tag_string fmt p.closing_style cl;
+-    pp_close_box fmt ()
++    Format.pp_close_box fmt ()
+ 
+   and fprint_list_stick_right fmt label (op, sep, cl, p) hd tl l =
+     let base_indent = p.indent_body in
+@@ -443,9 +443,9 @@ struct
+     tag_string fmt p.opening_style op;
+ 
+     if p.space_after_opening then
+-      pp_print_space fmt ()
++      Format.pp_print_space fmt ()
+     else
+-      pp_print_cut fmt ();
++      Format.pp_print_cut fmt ();
+ 
+     let open_extra, close_extra = extra_box p l in
+     open_extra fmt;
+@@ -454,23 +454,23 @@ struct
+     List.iter (
+       fun x ->
+         if p.space_before_separator then
+-          pp_print_break fmt 1 (-sep_indent)
++          Format.pp_print_break fmt 1 (-sep_indent)
+         else
+-          pp_print_break fmt 0 (-sep_indent);
++          Format.pp_print_break fmt 0 (-sep_indent);
+         tag_string fmt p.separator_style sep;
+         if p.space_after_separator then
+-          pp_print_string fmt " ";
++          Format.pp_print_string fmt " ";
+         fprint_t fmt x
+     ) tl;
+ 
+     close_extra fmt;
+ 
+     if p.space_before_closing then
+-      pp_print_break fmt 1 (-indent)
++      Format.pp_print_break fmt 1 (-indent)
+     else
+-      pp_print_break fmt 0 (-indent);
++      Format.pp_print_break fmt 0 (-indent);
+     tag_string fmt p.closing_style cl;
+-    pp_close_box fmt ()
++    Format.pp_close_box fmt ()
+ 
+ 
+ 
+@@ -479,23 +479,23 @@ struct
+       [] ->
+         tag_string fmt p.opening_style op;
+         if p.space_after_opening || p.space_before_closing then
+-          pp_print_string fmt " ";
++          Format.pp_print_string fmt " ";
+         tag_string fmt p.closing_style cl
+ 
+     | hd :: tl as l ->
+         tag_string fmt p.opening_style op;
+         if p.space_after_opening then
+-          pp_print_string fmt " ";
++          Format.pp_print_string fmt " ";
+ 
+         pp_open_nonaligned_box fmt p 0 l ;
+         if p.separators_stick_left then
+           fprint_list_body_stick_left fmt p sep hd tl
+         else
+           fprint_list_body_stick_right fmt p sep hd tl;
+-        pp_close_box fmt ();
++        Format.pp_close_box fmt ();
+ 
+         if p.space_before_closing then
+-          pp_print_string fmt " ";
++          Format.pp_print_string fmt " ";
+         tag_string fmt p.closing_style cl
+ 
+ 
+@@ -512,7 +512,7 @@ struct
+ 
+       | _ ->
+           let indent = lp.indent_after_label in
+-          pp_open_hvbox fmt 0;
++          Format.pp_open_hvbox fmt 0;
+ 
+           open_tag fmt lp.label_style;
+           fprint_t fmt lab;
+@@ -521,26 +521,26 @@ struct
+           (match lp.label_break with
+            | `Auto ->
+                if lp.space_after_label then
+-                 pp_print_break fmt 1 indent
++                 Format.pp_print_break fmt 1 indent
+                else
+-                 pp_print_break fmt 0 indent
++                 Format.pp_print_break fmt 0 indent
+            | `Always
+            | `Always_rec ->
+-               pp_force_newline fmt ();
+-               pp_print_string fmt (String.make indent ' ')
++               Format.pp_force_newline fmt ();
++               Format.pp_print_string fmt (String.make indent ' ')
+            | `Never ->
+                if lp.space_after_label then
+-                 pp_print_char fmt ' '
++                 Format.pp_print_char fmt ' '
+                else
+                  ()
+           );
+           fprint_t fmt x;
+-          pp_close_box fmt ()
++          Format.pp_close_box fmt ()
+ 
+   let to_formatter fmt x =
+     let x = rewrite x in
+     fprint_t fmt x;
+-    pp_print_flush fmt ()
++    Format.pp_print_flush fmt ()
+ 
+   let to_buffer ?(escape = `None) ?(styles = []) buf x =
+     let fmt = Format.formatter_of_buffer buf in
+@@ -577,7 +577,7 @@ struct
+         (* Will most likely not be compact *)
+         let fmt = formatter_of_buffer buf in
+         f fmt;
+-        pp_print_flush fmt ()
++        Format.pp_print_flush fmt ()
+ 
+   and fprint_list buf (op, sep, cl, _) = function
+       [] -> bprintf buf "%s%s" op cl
+@@ -606,7 +606,7 @@ struct
+   let to_formatter fmt x =
+     let s = to_string x in
+     Format.fprintf fmt "%s" s;
+-    pp_print_flush fmt ()
++    Format.pp_print_flush fmt ()
+ 
+   let to_channel oc x =
+     let buf = Buffer.create 500 in
+
+From 8832bada0c0223dd3a6488d31eff7ff2ed45e6d4 Mon Sep 17 00:00:00 2001
+From: Rudi Grinberg <me at rgrinberg.com>
+Date: Wed, 13 Nov 2019 00:12:38 +0900
+Subject: [PATCH 2/2] Remove [open Format]
+
+Signed-off-by: Rudi Grinberg <me at rgrinberg.com>
+---
+ src/easy_format.ml | 32 +++++++++++++++-----------------
+ 1 file changed, 15 insertions(+), 17 deletions(-)
+
+diff --git a/src/easy_format.ml b/src/easy_format.ml
+index 73c431c..1ba907c 100644
+--- a/src/easy_format.ml
++++ b/src/easy_format.ml
+@@ -1,5 +1,3 @@
+-open Format
+-
+ let rev_split l =
+   let rec inner xs ys = function
+     | (x, y) :: xys ->
+@@ -90,7 +88,7 @@ type t =
+     Atom of string * atom_param
+   | List of (string * string * string * list_param) * t list
+   | Label of (t * label_param) * t
+-  | Custom of (formatter -> unit)
++  | Custom of (Format.formatter -> unit)
+ 
+ type escape =
+     [ `None
+@@ -279,10 +277,10 @@ struct
+     match p.wrap_body with
+         `Always_wrap
+       | `Never_wrap
+-      | `Wrap_atoms -> pp_open_hvbox fmt indent
++      | `Wrap_atoms -> Format.pp_open_hvbox fmt indent
+       | `Force_breaks
+-      | `Force_breaks_rec -> pp_open_vbox fmt indent
+-      | `No_breaks -> pp_open_hbox fmt ()
++      | `Force_breaks_rec -> Format.pp_open_vbox fmt indent
++      | `No_breaks -> Format.pp_open_hbox fmt ()
+ 
+   let extra_box p l =
+     let wrap =
+@@ -296,8 +294,8 @@ struct
+             List.for_all (function Atom _ -> true | _ -> false) l
+     in
+     if wrap then
+-      ((fun fmt -> pp_open_hovbox fmt 0),
+-       (fun fmt -> pp_close_box fmt ()))
++      ((fun fmt -> Format.pp_open_hovbox fmt 0),
++       (fun fmt -> Format.pp_close_box fmt ()))
+     else
+       ((fun _ -> ()),
+        (fun _ -> ()))
+@@ -305,16 +303,16 @@ struct
+ 
+   let pp_open_nonaligned_box fmt p indent l =
+     match p.wrap_body with
+-        `Always_wrap -> pp_open_hovbox fmt indent
+-      | `Never_wrap -> pp_open_hvbox fmt indent
++        `Always_wrap -> Format.pp_open_hovbox fmt indent
++      | `Never_wrap -> Format.pp_open_hvbox fmt indent
+       | `Wrap_atoms ->
+           if List.for_all (function Atom _ -> true | _ -> false) l then
+-            pp_open_hovbox fmt indent
++            Format.pp_open_hovbox fmt indent
+           else
+-            pp_open_hvbox fmt indent
++            Format.pp_open_hvbox fmt indent
+       | `Force_breaks
+-      | `Force_breaks_rec -> pp_open_vbox fmt indent
+-      | `No_breaks -> pp_open_hbox fmt ()
++      | `Force_breaks_rec -> Format.pp_open_vbox fmt indent
++      | `No_breaks -> Format.pp_open_hbox fmt ()
+ 
+ 
+   let open_tag fmt = function
+@@ -327,7 +325,7 @@ struct
+ 
+   let tag_string fmt o s =
+     match o with
+-        None -> pp_print_string fmt s
++        None -> Format.pp_print_string fmt s
+       | Some tag ->
+           Format.pp_open_tag fmt tag [@warning "-3"] ;
+           Format.pp_print_string fmt s;
+@@ -553,7 +551,7 @@ struct
+     Buffer.contents buf
+ 
+   let to_channel ?(escape = `None) ?(styles = []) oc x =
+-    let fmt = formatter_of_out_channel oc in
++    let fmt = Format.formatter_of_out_channel oc in
+     define_styles fmt escape styles;
+     to_formatter fmt x
+ 
+@@ -575,7 +573,7 @@ struct
+     | Label (label, x) -> fprint_pair buf label x
+     | Custom f ->
+         (* Will most likely not be compact *)
+-        let fmt = formatter_of_buffer buf in
++        let fmt = Format.formatter_of_buffer buf in
+         f fmt;
+         Format.pp_print_flush fmt ()
+ 
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/ocaml-easy-format.git/commitdiff/cf5c402984a81f1b69338d4c24dd51e3c383bd66



More information about the pld-cvs-commit mailing list