OCaml 5.0.0 rebuild

Other changes:
- Convert License tag to SPDX
- Enable tests
- Use new dune macros
This commit is contained in:
Jerry James 2023-07-10 22:27:54 -06:00
parent dbaf614c0e
commit 6e43115a41
3 changed files with 202 additions and 93 deletions

View File

@ -0,0 +1,11 @@
--- ocaml-gettext-0.4.2/src/lib/gettext-camomile/gettextCamomile.ml.orig 2020-06-11 14:40:42.000000000 -0600
+++ ocaml-gettext-0.4.2/src/lib/gettext-camomile/gettextCamomile.ml 2023-06-22 13:41:46.930127479 -0600
@@ -20,7 +20,7 @@
(* USA *)
(**************************************************************************)
-open CamomileLibraryDefault.Camomile
+open Camomile
open GettextTypes
(** Error reported when something goes wrong during Camomile initialization.

152
ocaml-gettext-ocaml5.patch Normal file
View File

@ -0,0 +1,152 @@
--- ocaml-gettext-0.4.2/gettext-camomile.opam.orig 2020-06-11 14:40:42.000000000 -0600
+++ ocaml-gettext-0.4.2/gettext-camomile.opam 2023-06-22 13:31:24.299464751 -0600
@@ -19,9 +19,8 @@ depends: [
"ocaml" {>= "4.03.0"}
"dune" {>= "1.11.0"}
"camomile"
- "base-bytes"
"gettext" {= version}
- "ounit" {with-test & > "2.0.8"}
+ "ounit2" {with-test & > "2.2.6"}
"fileutils" {with-test}
]
synopsis: "Internationalization library using camomile (i18n)"
--- ocaml-gettext-0.4.2/gettext.opam.orig 2020-06-11 14:40:42.000000000 -0600
+++ ocaml-gettext-0.4.2/gettext.opam 2023-06-22 13:30:52.810938219 -0600
@@ -20,8 +20,7 @@ depends: [
"dune" {>= "1.11.0"}
"cppo" {build}
"fileutils"
- "base-bytes"
- "ounit" {with-test & > "2.0.8"}
+ "ounit2" {with-test & > "2.2.6"}
]
synopsis: "Internationalization library (i18n)"
description:"""
--- ocaml-gettext-0.4.2/gettext-stub.opam.orig 2020-06-11 14:40:42.000000000 -0600
+++ ocaml-gettext-0.4.2/gettext-stub.opam 2023-06-22 13:32:14.938703327 -0600
@@ -19,9 +19,8 @@ depends: [
"ocaml" {>= "4.03.0"}
"dune" {>= "1.11.0"}
"dune-configurator"
- "base-bytes"
"gettext" {= version}
- "ounit" {with-test & > "2.0.8"}
+ "ounit2" {with-test & > "2.2.6"}
"fileutils" {with-test}
]
depexts: [
--- ocaml-gettext-0.4.2/src/lib/gettext-stub/gettextStubCompat_stubs.c.orig 2020-06-11 14:40:42.000000000 -0600
+++ ocaml-gettext-0.4.2/src/lib/gettext-stub/gettextStubCompat_stubs.c 2023-06-22 13:33:17.080769220 -0600
@@ -76,7 +76,7 @@ CAMLprim value gettextStubCompat_gettext
value v_msgid)
{
CAMLparam1(v_msgid);
- CAMLreturn(copy_string(gettext(String_val(v_msgid))));
+ CAMLreturn(caml_copy_string(gettext(String_val(v_msgid))));
}
CAMLprim value gettextStubCompat_dgettext(
@@ -85,7 +85,7 @@ CAMLprim value gettextStubCompat_dgettex
{
CAMLparam2(v_domainname, v_msgid);
CAMLreturn(
- copy_string(
+ caml_copy_string(
dgettext(
String_val(v_domainname),
String_val(v_msgid))));
@@ -98,7 +98,7 @@ CAMLprim value gettextStubCompat_dcgette
{
CAMLparam3(v_domainname, v_msgid, v_category);
CAMLreturn(
- copy_string(
+ caml_copy_string(
dcgettext(
String_val(v_domainname),
String_val(v_msgid),
@@ -112,7 +112,7 @@ CAMLprim value gettextStubCompat_ngettex
{
CAMLparam3(v_msgid1, v_msgid2, v_n);
CAMLreturn(
- copy_string(
+ caml_copy_string(
ngettext(
String_val(v_msgid1),
String_val(v_msgid2),
@@ -127,7 +127,7 @@ CAMLprim value gettextStubCompat_dngette
{
CAMLparam4(v_domainname, v_msgid1, v_msgid2, v_n);
CAMLreturn(
- copy_string(
+ caml_copy_string(
dngettext(
String_val(v_domainname),
String_val(v_msgid1),
@@ -158,7 +158,7 @@ CAMLprim value gettextStubCompat_dcngett
"NULL string not expected at "STRINGIFY(__LINE__)" in "__FILE__);
};
- CAMLreturn(copy_string(res));
+ CAMLreturn(caml_copy_string(res));
}
CAMLprim value gettextStubCompat_textdomain(
--- ocaml-gettext-0.4.2/test/common/dune.orig 2020-06-11 14:40:42.000000000 -0600
+++ ocaml-gettext-0.4.2/test/common/dune 2023-06-22 13:33:50.049275086 -0600
@@ -1,3 +1,3 @@
(library
(name common)
- (libraries gettext.base oUnit))
+ (libraries gettext.base ounit2))
--- ocaml-gettext-0.4.2/test/dune.orig 2020-06-11 14:40:42.000000000 -0600
+++ ocaml-gettext-0.4.2/test/dune 2023-06-22 13:34:09.487983748 -0600
@@ -6,7 +6,7 @@
../src/bin/ocaml-xgettext/xgettext.exe
(glob_files testdata/*)
(glob_files testdata/fr_FR/LC_MESSAGES/*))
- (libraries oUnit str fileutils gettext.extension common)
+ (libraries ounit2 str fileutils gettext.extension common)
(action
(run %{test}
-runner sequential
--- ocaml-gettext-0.4.2/test/test-camomile/dune.orig 2020-06-11 14:40:42.000000000 -0600
+++ ocaml-gettext-0.4.2/test/test-camomile/dune 2023-06-22 13:34:24.840753623 -0600
@@ -4,6 +4,6 @@
(deps
(glob_files testdata/*)
(glob_files ../testdata/fr_FR/LC_MESSAGES/*))
- (libraries common gettext-camomile oUnit fileutils)
+ (libraries common gettext-camomile ounit2 fileutils)
(action
(run %{test} -test-dir ../testdata)))
--- ocaml-gettext-0.4.2/test/test.ml.orig 2020-06-11 14:40:42.000000000 -0600
+++ ocaml-gettext-0.4.2/test/test.ml 2023-06-22 13:35:08.719095972 -0600
@@ -221,7 +221,7 @@ let install_test =
Printf.sprintf "%s warning" fl_mo >:: fun ctxt ->
let tests = make_tests ctxt in
let out = Buffer.create 13 in
- let capture_out strm = Stream.iter (Buffer.add_char out) strm in
+ let capture_out strm = Seq.iter (Buffer.add_char out) strm in
let fl_mo = concat tests.test_dir fl_mo in
let fl_dst = make_filename (tests.install_dir :: fl_dsts) in
assert_command
@@ -392,7 +392,7 @@ let compile_ocaml =
[]
in
let out = Buffer.create 13 in
- let capture_out strm = Stream.iter (Buffer.add_char out) strm in
+ let capture_out strm = Seq.iter (Buffer.add_char out) strm in
let match_exp_err = Str.regexp (".*"^(Str.quote exp_err)^".*") in
assert_command
~exit_code:(Unix.WEXITED exp_return_code)
--- ocaml-gettext-0.4.2/test/test-stub/dune.orig 2020-06-11 14:40:42.000000000 -0600
+++ ocaml-gettext-0.4.2/test/test-stub/dune 2023-06-22 13:34:43.239477852 -0600
@@ -4,6 +4,6 @@
(deps
(glob_files ../testdata/*)
(glob_files ../testdata/fr_FR/LC_MESSAGES/*))
- (libraries common gettext-stub oUnit)
+ (libraries common gettext-stub ounit2)
(action
(run %{test} -test-dir ../testdata)))

View File

@ -1,6 +1,3 @@
%undefine _package_note_flags
%global opt %(test -x %{_bindir}/ocamlopt && echo 1 || echo 0)
# Optionally disable camomile dep on RHEL.
%if !0%{?rhel}
%bcond_without camomile
@ -10,27 +7,28 @@
Name: ocaml-gettext
Version: 0.4.2
Release: 11%{?dist}
Release: 12%{?dist}
Summary: OCaml library for i18n
License: LGPLv2+ with exceptions
License: LGPL-2.1-or-later with OCaml-LGPL-linking-exception
URL: https://github.com/gildor478/ocaml-gettext
Source0: https://github.com/gildor478/%{name}/archive/v%{version}.tar.gz
BuildRequires: make
BuildRequires: ocaml >= 4.00.1
BuildRequires: ocaml-findlib-devel >= 1.3.3-3
BuildRequires: ocaml-compiler-libs
BuildRequires: ocaml-ocamldoc
# Updates for OCaml 5. Based in part on
# https://github.com/gildor478/ocaml-gettext/pull/24
Patch0: %{name}-ocaml5.patch
# Adapt to changes in camomile 2.0
Patch1: %{name}-camomile2.patch
BuildRequires: ocaml >= 4.03.0
BuildRequires: ocaml-fileutils-devel >= 0.4.4-4
BuildRequires: ocaml-dune-devel
BuildRequires: ocaml-dune >= 1.11.0
BuildRequires: ocaml-dune-configurator-devel
BuildRequires: ocaml-cppo
BuildRequires: docbook-style-xsl
BuildRequires: libxslt
BuildRequires: libxml2
BuildRequires: chrpath
BuildRequires: autoconf
%if !0%{?rhel}
BuildRequires: ocaml-ounit-devel
%endif
@ -38,16 +36,12 @@ BuildRequires: ocaml-ounit-devel
BuildRequires: ocaml-camomile-devel >= 0.8.6-3
BuildRequires: ocaml-camomile-data
%endif
BuildRequires: autoconf, automake
%if %{with camomile}
# ocaml-gettext program needs camomile data files
Requires: ocaml-camomile-data
%endif
%global __ocaml_requires_opts -i Asttypes -i Parsetree
%global __ocaml_provides_opts -i Pr_gettext
%description
Ocaml-gettext provides support for internationalization of Ocaml
@ -63,10 +57,10 @@ Constraints :
%package devel
Summary: Development files for %{name}
Requires: %{name} = %{version}-%{release}
Requires: %{name}%{?_isa} = %{version}-%{release}
# BZ 446919.
Requires: ocaml-fileutils-devel >= 0.4.0
Requires: ocaml-fileutils-devel%{?_isa} >= 0.4.0
%description devel
@ -77,7 +71,7 @@ developing applications that use %{name}.
%if %{with camomile}
%package camomile
Summary: Parts of %{name} which depend on Camomile
Requires: %{name} = %{version}-%{release}
Requires: %{name}%{?_isa} = %{version}-%{release}
%description camomile
@ -87,8 +81,9 @@ depend on Camomile.
%package camomile-devel
Summary: Development files for %{name}-camomile
Requires: %{name}-devel = %{version}-%{release}
Requires: %{name}-camomile = %{version}-%{release}
Requires: %{name}-devel%{?_isa} = %{version}-%{release}
Requires: %{name}-camomile%{?_isa} = %{version}-%{release}
Requires: ocaml-camomile-devel%{?_isa}
%description camomile-devel
@ -99,12 +94,7 @@ signature files for developing applications that use
%prep
%setup -q -n %{name}-%{version}
%autopatch -p1
# Remove dependency on batteries.
sed -i -e 's/batteries//' test/dune
sed -i -e 's/batteries//' test/test-stub/dune
%autosetup -p1
%if %{without camomile}
# Remove dependency on camomile.
@ -115,63 +105,26 @@ sed -i -e 's/camomile//' `find -name dune`
%build
make build
#check
# Tests require batteries, so they are disabled at present.
# Under discussion with upstream.
%dune_build
%install
mkdir -p $RPM_BUILD_ROOT%{_libdir}/ocaml
mkdir -p $RPM_BUILD_ROOT%{_bindir}
dune install --destdir=$RPM_BUILD_ROOT
# Remove this, we will use our own rules for documentation.
rm -rf $RPM_BUILD_ROOT/usr/doc
%if %{without camomile}
# If you use --without camomile but happen to have the camomile
# packages installed then it will still build them.
rm -rf $RPM_BUILD_ROOT/%{_libdir}/ocaml/gettext-camomile
%endif
%dune_install -s
sed -i '\@%{_bindir}@d;\@%{_mandir}@d' .ofiles-gettext
cat .ofiles-gettext-stub >> .ofiles-gettext
cat .ofiles-gettext-stub-devel >> .ofiles-gettext-devel
%files
%doc LICENSE.txt
%{_libdir}/ocaml/gettext
%{_libdir}/ocaml/gettext-stub
%if %opt
%exclude %{_libdir}/ocaml/gettext/*.cmxa
%exclude %{_libdir}/ocaml/gettext/*/*.a
%exclude %{_libdir}/ocaml/gettext/*/*.cmxa
%exclude %{_libdir}/ocaml/gettext/*/*.cmx
%exclude %{_libdir}/ocaml/gettext-stub/*.a
%exclude %{_libdir}/ocaml/gettext-stub/*.cmxa
%exclude %{_libdir}/ocaml/gettext-stub/*.cmx
%endif
%exclude %{_libdir}/ocaml/gettext/*/*.ml
%exclude %{_libdir}/ocaml/gettext/*/*.mli
%exclude %{_libdir}/ocaml/gettext-stub/*.ml
%{_libdir}/ocaml/stublibs/*.so
%check
%dune_check
%files devel
%files -f .ofiles-gettext
%license LICENSE.txt
%files devel -f .ofiles-gettext-devel
%doc README.md CHANGES.md THANKS TODO.md
# %doc build/share/doc/html/*
%if %opt
%{_libdir}/ocaml/gettext/*.cmxa
%{_libdir}/ocaml/gettext/*/*.a
%{_libdir}/ocaml/gettext/*/*.cmxa
%{_libdir}/ocaml/gettext/*/*.cmx
%{_libdir}/ocaml/gettext-stub/*.a
%{_libdir}/ocaml/gettext-stub/*.cmxa
%{_libdir}/ocaml/gettext-stub/*.cmx
%endif
%{_libdir}/ocaml/gettext/*/*.ml
%{_libdir}/ocaml/gettext/*/*.mli
%{_libdir}/ocaml/gettext-stub/*.ml
%{_bindir}/ocaml-gettext
%{_bindir}/ocaml-xgettext
%{_mandir}/man1/ocaml-gettext.1*
@ -180,29 +133,22 @@ rm -rf $RPM_BUILD_ROOT/%{_libdir}/ocaml/gettext-camomile
%if %{with camomile}
%files camomile
%doc LICENSE.txt
%{_libdir}/ocaml/gettext-camomile
%if %opt
%exclude %{_libdir}/ocaml/gettext-camomile/*.a
%exclude %{_libdir}/ocaml/gettext-camomile/*.cmxa
%exclude %{_libdir}/ocaml/gettext-camomile/*.cmx
%endif
%exclude %{_libdir}/ocaml/gettext-camomile/*.mli
%files camomile -f .ofiles-gettext-camomile
%license LICENSE.txt
%files camomile-devel
%files camomile-devel -f .ofiles-gettext-camomile-devel
%doc README.md
%if %opt
%{_libdir}/ocaml/gettext-camomile/*.a
%{_libdir}/ocaml/gettext-camomile/*.cmxa
%{_libdir}/ocaml/gettext-camomile/*.cmx
%endif
%{_libdir}/ocaml/gettext-camomile/*.mli
%endif
%changelog
* Mon Jul 10 2023 Jerry James <loganjerry@gmail.com> - 0.4.2-12
- OCaml 5.0.0 rebuild
- Convert License tag to SPDX
- Enable tests
- Use new dune macros
* Tue Jan 24 2023 Richard W.M. Jones <rjones@redhat.com> - 0.4.2-11
- Rebuild OCaml packages for F38