%undefine _package_note_flags
%ifnarch %{ocaml_native_compiler}
%global debug_package %{nil}
%endif
%global srcname psmt2-frontend
Name: ocaml-%{srcname}
Version: 0.4.0
Release: 3%{?dist}
Summary: Parser and typechecker for an extension of SMT-LIB 2
License: ASL 2.0
URL: https://github.com/OCamlPro-Coquera/psmt2-frontend
Source0: %{url}/archive/%{version}/%{srcname}-%{version}.tar.gz
BuildRequires: make
BuildRequires: ocaml >= 4.04.2
BuildRequires: ocaml-dune >= 2.6.0
BuildRequires: ocaml-findlib
BuildRequires: ocaml-menhir
BuildRequires: ocaml-odoc
BuildRequires: %{py3_dist sphinx}
BuildRequires: %{py3_dist sphinx-rtd-theme}
%global _docdir_fmt %{name}
%description
This package contains a library to parse and typecheck a conservative
extension of the SMT-LIB 2 standard with prenex polymorphism.
%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}.
%package docs
Summary: Documentation for %{name}
%description docs
Documentation for %{name}.
%prep
%autosetup -n %{srcname}-%{version}
# Do not use git to find the version; we don't have a git checkout
sed -i '/^git =/d;/^branch=/d;s/^\(version = \).*/\1"%{version}"/' sphinx/conf.py
%build
dune build %{?_smp_mflags} --verbose --profile release
dune build %{?_smp_mflags} @doc
make sphinx
%install
dune install --destdir=%{buildroot}
# We do not want the dune markers
find _build/default/_doc/_html -name .dune-keep -delete
# We do not want the ml files
find %{buildroot}%{_libdir}/ocaml -name \*.ml -delete
# We install the documentation with the doc macro
rm -fr %{buildroot}%{_prefix}/doc
%check
dune runtest --profile release
%files
%doc CHANGES.md README.md
%license LICENSE
%{_bindir}/psmt2-frontend_bin
%{_libdir}/ocaml/%{srcname}_bin/
%dir %{_libdir}/ocaml/%{srcname}/
%{_libdir}/ocaml/%{srcname}/META
%{_libdir}/ocaml/%{srcname}/*.cma
%{_libdir}/ocaml/%{srcname}/*.cmi
%ifarch %{ocaml_native_compiler}
%{_libdir}/ocaml/%{srcname}/*.cmxs
%endif
%files devel
%{_libdir}/ocaml/%{srcname}/dune-package
%{_libdir}/ocaml/%{srcname}/opam
%ifarch %{ocaml_native_compiler}
%{_libdir}/ocaml/%{srcname}/*.a
%{_libdir}/ocaml/%{srcname}/*.cmx
%{_libdir}/ocaml/%{srcname}/*.cmxa
%endif
%{_libdir}/ocaml/%{srcname}/*.cmt
%{_libdir}/ocaml/%{srcname}/*.cmti
%{_libdir}/ocaml/%{srcname}/*.mli
%files docs
%doc docs/sphinx _build/default/_doc/_html
%changelog
* Fri Feb 04 2022 Richard W.M. Jones <rjones@redhat.com> - 0.4.0-3
- OCaml 4.13.1 rebuild to remove package notes
* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.4.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Mon Dec 27 2021 Jerry James <loganjerry@gmail.com> - 0.4.0-1
- Version 0.4.0
- Drop obsolete -autoconf patch
- Add %%check script
- Add -docs subpackage
* Tue Oct 05 2021 Richard W.M. Jones <rjones@redhat.com> - 0.1-11
- OCaml 4.13.1 build
* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.1-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Mon Jul 19 2021 Jerry James <loganjerry@gmail.com> - 0.1-9
- Move META to the main package
* Mon Mar 29 2021 Jerry James <loganjerry@gmail.com> - 0.1-9
- Add -autoconf patch for autoconf 2.71 (bz 1943044)
* Tue Mar 2 11:16:19 GMT 2021 Richard W.M. Jones <rjones@redhat.com> - 0.1-8
- OCaml 4.12.0 build
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.1-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Tue Sep 01 2020 Richard W.M. Jones <rjones@redhat.com> - 0.1-6
- OCaml 4.11.1 rebuild
* Sat Aug 22 2020 Richard W.M. Jones <rjones@redhat.com> - 0.1-5
- Bump and rebuild
* Fri Aug 21 2020 Richard W.M. Jones <rjones@redhat.com> - 0.1-4
- OCaml 4.11.0 rebuild
* Sat Aug 01 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.1-3
- Second attempt - Rebuilt for
https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Wed Jun 17 2020 Jerry James <loganjerry@gmail.com> - 0.1-1
- Initial RPM