From 92adf4cf1d71b225a6994d827eea117d86ea6dc0 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Fri, 31 May 2024 17:21:54 +0100 Subject: [PATCH] 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. --- .gitignore | 1 - calendar-2.03.2-enable-debug.patch | 11 +++ calendar-2.04-support-ocaml5.patch | 71 ++++++++++++++++++ ocaml-calendar.spec | 115 +++++++++++------------------ sources | 2 +- 5 files changed, 127 insertions(+), 73 deletions(-) create mode 100644 calendar-2.03.2-enable-debug.patch create mode 100644 calendar-2.04-support-ocaml5.patch diff --git a/.gitignore b/.gitignore index ba78ab2..b228034 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,3 @@ calendar-2.01.1.tar.gz /calendar-2.03.1.tar.gz /calendar-2.03.2.tar.gz /calendar-2.04.tar.gz -/calendar-3.0.0.tar.gz diff --git a/calendar-2.03.2-enable-debug.patch b/calendar-2.03.2-enable-debug.patch new file mode 100644 index 0000000..6fc0d02 --- /dev/null +++ b/calendar-2.03.2-enable-debug.patch @@ -0,0 +1,11 @@ +--- calendar-2.03.2/Makefile.in.old 2013-09-14 16:15:43.760253519 +0100 ++++ calendar-2.03.2/Makefile.in 2013-09-14 16:16:03.233279962 +0100 +@@ -86,7 +86,7 @@ + + CAMLIBS = $(addprefix -I , $(DIRS)) + +-CAMLFLAGS= $(CAMLIBS) ++CAMLFLAGS= -g $(CAMLIBS) + BYTEFLAGS= $(CAMLFLAGS) + LINK_OPTFLAGS = $(CAMLFLAGS) -noassert + OPTFLAGS = $(LINK_OPTFLAGS) -for-pack CalendarLib diff --git a/calendar-2.04-support-ocaml5.patch b/calendar-2.04-support-ocaml5.patch new file mode 100644 index 0000000..100ce7a --- /dev/null +++ b/calendar-2.04-support-ocaml5.patch @@ -0,0 +1,71 @@ +--- 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 + diff --git a/ocaml-calendar.spec b/ocaml-calendar.spec index 5b584b8..4f00fa3 100644 --- a/ocaml-calendar.spec +++ b/ocaml-calendar.spec @@ -1,32 +1,30 @@ -# OCaml packages not built on i686 since OCaml 5 / Fedora 39. -ExcludeArch: %{ix86} - -%ifnarch %{ocaml_native_compiler} +%undefine _package_note_flags %global debug_package %{nil} -%endif - -# ocaml-alcotest requires ocaml-astring, ocaml-cmdliner, ocaml-fmt, and ocaml-uutf, -# none of which are otherwise needed for building the OCaml-dependent packages -# found in RHEL and ELN. We want to avoid the extra dependencies there. -%bcond tests %[!0%{?rhel}] Name: ocaml-calendar -Version: 3.0.0 -Release: 9%{?dist} +Epoch: 1 +Version: 2.04 +Release: 46%{?dist} Summary: Objective Caml library for managing dates and times -License: LGPL-2.1-or-later WITH OCaml-LGPL-linking-exception +License: LGPLv2 -URL: https://ocaml-community.github.io/calendar/ -VCS: https://github.com/ocaml-community/calendar -Source0: %{vcs}/archive/v%{version}/calendar-%{version}.tar.gz +URL: http://calendar.forge.ocamlcore.org/ +Source0: https://forge.ocamlcore.org/frs/download.php/1481/calendar-2.04.tar.gz -BuildRequires: ocaml >= 4.03 -BuildRequires: ocaml-dune >= 1.0 -BuildRequires: ocaml-re-devel >= 1.7.2 +Patch: calendar-2.03.2-enable-debug.patch +Patch: calendar-2.04-support-ocaml5.patch -%if %{with tests} -BuildRequires: ocaml-alcotest-devel -%endif +BuildRequires: make +BuildRequires: ocaml >= 4.00.1 +BuildRequires: ocaml-findlib-devel >= 1.3.3-3 +BuildRequires: ocaml-ocamldoc +BuildRequires: gawk +BuildRequires: autoconf + +# Ignore all generated modules *except* CalendarLib, since everything +# now appears in that namespace. +%global __ocaml_requires_opts -i Calendar_builder -i Calendar_sig -i Date -i Date_sig -i Fcalendar -i Ftime -i Period -i Printer -i Time -i Time_sig -i Time_Zone -i Utils -i Version +%global __ocaml_provides_opts -i Calendar_builder -i Calendar_sig -i Date -i Date_sig -i Fcalendar -i Ftime -i Period -i Printer -i Time -i Time_sig -i Time_Zone -i Utils -i Version %description @@ -35,7 +33,7 @@ Objective Caml library for managing dates and times. %package devel Summary: Development files for %{name} -Requires: %{name}%{?_isa} = %{version}-%{release} +Requires: %{name} = %{version}-%{release} %description devel @@ -48,65 +46,40 @@ developing applications that use %{name}. %build -%dune_build +autoconf +./configure --libdir=%{_libdir} +make +make doc + +mv TODO TODO.old +iconv -f iso-8859-1 -t utf-8 < TODO.old > TODO %install -%dune_install +export DESTDIR=$RPM_BUILD_ROOT +export OCAMLFIND_DESTDIR=$RPM_BUILD_ROOT%{_libdir}/ocaml +mkdir -p $OCAMLFIND_DESTDIR $OCAMLFIND_DESTDIR/stublibs +make install -%if %{with tests} -%check -%dune_check +%files +%doc CHANGES README TODO LGPL COPYING +%{_libdir}/ocaml/calendar +%ifarch %{ocaml_native_compiler} +%exclude %{_libdir}/ocaml/calendar/*.cmx %endif +%exclude %{_libdir}/ocaml/calendar/*.mli -%files -f .ofiles -%doc CHANGES README.md TODO -%license LGPL COPYING - - -%files devel -f .ofiles-devel -%doc CHANGES README.md TODO calendarFAQ-2.6.txt -%license LGPL COPYING +%files devel +%doc CHANGES README TODO LGPL COPYING calendarFAQ-2.6.txt doc/* +%ifarch %{ocaml_native_compiler} +%{_libdir}/ocaml/calendar/*.cmx +%endif +%{_libdir}/ocaml/calendar/*.mli %changelog -* Thu May 30 2024 Richard W.M. Jones - 3.0.0-9 -- OCaml 5.2.0 for Fedora 41 - -* Thu May 23 2024 Jerry James - 3.0.0-8 -- Simplify with %%bcond -- Add VCS field - -* Thu Jan 25 2024 Fedora Release Engineering - 3.0.0-8 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild - -* Sun Jan 21 2024 Fedora Release Engineering - 3.0.0-7 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild - -* Mon Dec 18 2023 Richard W.M. Jones - 3.0.0-6 -- OCaml 5.1.1 + s390x code gen fix for Fedora 40 - -* Tue Dec 12 2023 Richard W.M. Jones - 3.0.0-5 -- OCaml 5.1.1 rebuild for Fedora 40 - -* Thu Oct 05 2023 Richard W.M. Jones - 3.0.0-4 -- OCaml 5.1 rebuild for Fedora 40 - -* Thu Jul 20 2023 Fedora Release Engineering - 3.0.0-3 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild - -* Tue Jul 11 2023 Richard W.M. Jones - 3.0.0-2 -- OCaml 5.0 rebuild for Fedora 39 - -* Mon Jul 10 2023 Jerry James - 3.0.0-1 -- Version 3.0.0 -- New project URLs -- Convert License tag to SPDX -- Drop obsolete debuginfo patch -- Build with dune - * Tue Jan 24 2023 Richard W.M. Jones - 2.04-46 - Rebuild OCaml packages for F38 diff --git a/sources b/sources index 6e5b9c6..ed73d34 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (calendar-3.0.0.tar.gz) = cf8a5cfbfb8879da7bcacf765d5461523cbc4f0c13133dfb2f311b051ed95b5f72815af5ca2836294a793d9b57bfc4cc1abbb8b54e17954cb4ecc99e1743bdc3 +625b4f32c9ff447501868fa1c44f4f4f calendar-2.04.tar.gz