%global debug_package %{nil}

Name:           ocaml-hmap
Version:        0.8.0
Release:        1%{?dist}
Summary:        Heterogeneous value maps for OCaml

License:        ISC
URL:            https://github.com/dbuenzli/hmap
Source0:        %{url}/archive/refs/tags/v%{version}.tar.gz#/%{name}-%{version}.tar.gz

BuildRequires:  ocaml-findlib
BuildRequires:  ocaml-ocamlbuild

%description
Hmap provides heterogeneous value maps for OCaml. These maps bind keys to values
with arbitrary types. Keys witness the type of the value they are bound to which
allows to add and lookup bindings in a type safe manner.

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

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

%prep
%autosetup -p1 -n hmap-%{version}

%build
./build lib-byte
./build lib-native
./build test

%install
export OCAMLFIND_DESTDIR=%{buildroot}%{ocamldir}
mkdir -p ${OCAMLFIND_DESTDIR}/stublibs
ocamlfind install hmap pkg/META _build/src/*.{cma,cmi,a,cmx,cmxa,mli,ml}

%check
./test.byte
./test.native

%files
%{ocamldir}/hmap/META
%{ocamldir}/hmap/*.{cma,cmi}
%license LICENSE.md

%files devel
%{ocamldir}/hmap/*.{a,cmx,cmxa,mli,ml}

%changelog
* Tue Jul 16 2024 Marian Koncek <mkoncek@redhat.com> - 0.7.32-1
- Initial build