ocaml-calendar/calendar-2.04-support-ocaml5.patch
Richard W.M. Jones 92adf4cf1d Revert back to ocaml-calendar 2.04
ocaml-calendar 3.0.0 (in Fedora 39+ and briefly in RHEL 10) requires
ocaml-re, which we removed from RHEL 10, so now that package cannot
build.  We don't need ocaml-calendar 3, version 2.04 will do fine.

Revert back to it.

Unfortunately to do this I had to introduce an epoch to get this to
override previous versions from RHEL 10.

I also had to remove debuginfo because that fails for unclear reasons.

I also had to do some porting for OCaml 5.
2024-05-31 18:18:24 +01:00

72 lines
2.6 KiB
Diff

--- calendar-2.04/configure.in~ 2014-10-29 10:03:20.000000000 +0000
+++ calendar-2.04/configure.in 2024-05-31 17:39:52.981965618 +0100
@@ -56,6 +56,7 @@
3.0*) echo "${ECHO_T}Unsupported version!"; exit 2;;
3.*) OCAMLMAJOR=3; echo "${ECHO_T}Good!";;
4.*) OCAMLMAJOR=4; echo "${ECHO_T}Good!";;
+ 5.*) OCAMLMAJOR=5; echo "${ECHO_T}Good!";;
*) echo "${ECHO_T}Unsupported version!"; exit 2;;
esac
diff -ur calendar-2.04.old/src/date.ml calendar-2.04/src/date.ml
--- calendar-2.04.old/src/date.ml 2014-10-29 10:03:20.000000000 +0000
+++ calendar-2.04/src/date.ml 2024-05-31 18:02:28.444110805 +0100
@@ -70,7 +70,7 @@
(* Constructors. *)
let lt (d1 : int * int * int) (d2 : int * int * int) =
- Pervasives.compare d1 d2 < 0
+ Stdlib.compare d1 d2 < 0
(* [date_ok] returns [true] is the date belongs to the Julian period;
[false] otherwise. *)
@@ -249,10 +249,10 @@
let sub x y = { m = x.m - y.m; d = x.d - y.d }
let opp x = { m = - x.m; d = - x.d }
- (* exactly equivalent to [Pervasives.compare] but more flexible typing *)
+ (* exactly equivalent to [Stdlib.compare] but more flexible typing *)
let compare x y =
- let n = Pervasives.compare x.m y.m in
- if n = 0 then Pervasives.compare x.d y.d else n
+ let n = Stdlib.compare x.m y.m in
+ if n = 0 then Stdlib.compare x.d y.d else n
let equal x y = compare x y = 0
let hash = Hashtbl.hash
diff -ur calendar-2.04.old/src/printer.ml calendar-2.04/src/printer.ml
--- calendar-2.04.old/src/printer.ml 2014-10-29 10:03:20.000000000 +0000
+++ calendar-2.04/src/printer.ml 2024-05-31 18:03:14.806779295 +0100
@@ -181,7 +181,7 @@
let print_int pad k n = print_number fmt pad k (Lazy.force n) in
let print_string pad s =
let pad s = match pad with
- | Uppercase -> String.uppercase s
+ | Uppercase -> String.uppercase_ascii s
| Empty | Zero | Blank -> s
in
Format.pp_print_string fmt (pad (Lazy.force s))
@@ -236,7 +236,7 @@
| 'n' -> print_char '\n'
| 'p' -> print_string pad apm
| 'P' ->
- Format.pp_print_string fmt (String.lowercase (Lazy.force apm))
+ Format.pp_print_string fmt (String.lowercase_ascii (Lazy.force apm))
| 'r' ->
print_time pad shour;
print_char ' ';
diff -ur calendar-2.04.old/src/utils.ml calendar-2.04/src/utils.ml
--- calendar-2.04.old/src/utils.ml 2014-10-29 10:03:20.000000000 +0000
+++ calendar-2.04/src/utils.ml 2024-05-31 18:02:28.445110798 +0100
@@ -29,8 +29,8 @@
module Int = struct
type t = int
- let equal = Pervasives.(=)
- let compare = Pervasives.compare
+ let equal = Stdlib.(=)
+ let compare = Stdlib.compare
let hash = Hashtbl.hash
end