Name:           ocaml-yaml
Version:        3.1.0
Release:        %autorelease
Summary:        Parse and generate YAML 1.1/1.2 files

License:        ISC
URL:            https://avsm.github.io/ocaml-yaml/
Source0:        https://github.com/avsm/ocaml-yaml/releases/download/v%{version}/yaml-%{version}.tbz

BuildRequires:  ocaml >= 4.13.0
BuildRequires:  ocaml-bos-devel
BuildRequires:  ocaml-ctypes-devel >= 0.14.0
BuildRequires:  ocaml-dune >= 2.0
BuildRequires:  ocaml-dune-configurator-devel
BuildRequires:  ocaml-ppx-sexp-conv-devel >= 0.9.0
BuildRequires:  ocaml-sexplib-devel

# Test dependencies
# Fedora does not have crowbar, ezjsonm, or junit_alcotest
%if 0
BuildRequires:  ocaml-alcotest-devel
BuildRequires:  ocaml-crowbar-devel
BuildRequires:  ocaml-ezjsonm-devel
BuildRequires:  ocaml-fmt-devel
BuildRequires:  ocaml-junit-alcotest-devel
BuildRequires:  ocaml-logs-devel
BuildRequires:  ocaml-mdx-devel >= 2.10
%endif

# The bundled version of libyaml has been modified for better integration
# with ocaml-ctypes
Provides:       bundled(libyaml) = 0.2.5

%description
This is an OCaml library to parse and generate the YAML file format.  It
is intended to be interoperable with the Ezjsonm
(https://github.com/mirage/ezjsonm) JSON handling library, if the simple
common subset of Yaml is used.  Anchors and other advanced Yaml features
are not implemented in the JSON compatibility layer.

%package        devel
Summary:        Development files for %{name}
Requires:       %{name}%{?_isa} = %{version}-%{release}
Requires:       ocaml-bos-devel%{?_isa}
Requires:       ocaml-ctypes-devel%{?_isa}

%description    devel
The %{name}-devel package contains libraries and signature
files for developing applications that use %{name}.

%package        sexp
Summary:        Parse and generate YAML 1.1/1.2 files with sexp support
Requires:       %{name}%{?_isa} = %{version}-%{release}

%description    sexp
This package adds sexp support to the functionality of ocaml-yaml.

%package        sexp-devel
Summary:        Development files for %{name}-sexp
Requires:       %{name}-devel%{?_isa} = %{version}-%{release}
Requires:       %{name}-sexp%{?_isa} = %{version}-%{release}
Requires:       ocaml-ppx-sexp-conv-devel%{?_isa}
Requires:       ocaml-sexplib-devel%{?_isa}

%description    sexp-devel
The %{name}-sexp-devel package contains libraries and signature
files for developing applications that use %{name}-sexp.

%prep
%autosetup -n yaml-%{version}

%build
%dune_build

%install
%dune_install -s

%if 0
%check
%dune_check
%endif

%files -f .ofiles-yaml
%license LICENSE.md
%doc README.md CHANGES.md

%files devel -f .ofiles-yaml-devel

%files sexp -f .ofiles-yaml-sexp
%license LICENSE.md
%doc README.md CHANGES.md

%files sexp-devel -f .ofiles-yaml-sexp-devel

%changelog
%autochangelog