## START: Set by rpmautospec
## (rpmautospec version 0.7.3)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 1;
    base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
    print(release_number + base_release_number - 1);
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
## END: Set by rpmautospec

# OCaml packages not built on i686 since OCaml 5 / Fedora 39.
ExcludeArch: %{ix86}

%global giturl  https://github.com/ocaml/opam

Name:           opam
Version:        2.2.1
Release:        %autorelease
Summary:        Source-based package manager for OCaml

License:        LGPL-2.1-only WITH OCaml-LGPL-linking-exception
URL:            https://opam.ocaml.org/
VCS:            git:%{giturl}.git
Source0:        %{giturl}/releases/download/%{version}/%{name}-full-%{version}.tar.gz
Source1:        %{giturl}/releases/download/%{version}/%{name}-full-%{version}.tar.gz.sig
Source2:        https://opam.ocaml.org/opam-dev-pubkey.pgp

BuildRequires:  diffutils
BuildRequires:  gcc-c++
BuildRequires:  git-core
BuildRequires:  gnupg2
BuildRequires:  libacl-devel
BuildRequires:  make
BuildRequires:  ocaml >= 4.08.0
BuildRequires:  ocaml-base64-devel >= 3.1.0
BuildRequires:  ocaml-cmdliner-devel >= 1.1.0
BuildRequires:  ocaml-cudf-devel >= 0.7
BuildRequires:  ocaml-dose3-devel >= 6.1
BuildRequires:  ocaml-dune >= 2.0.0
BuildRequires:  ocaml-findlib
BuildRequires:  ocaml-jsonm-devel
BuildRequires:  ocaml-mccs-devel
BuildRequires:  ocaml-ocamlgraph-devel
BuildRequires:  ocaml-opam-0install-cudf-devel >= 0.4
BuildRequires:  ocaml-opam-file-format-devel >= 2.1.4
BuildRequires:  ocaml-re-devel >= 1.10.0
BuildRequires:  ocaml-sha-devel >= 1.13
BuildRequires:  ocaml-spdx-licenses-devel >= 1.0.0
BuildRequires:  ocaml-swhid-core-devel
BuildRequires:  ocaml-uutf-devel
BuildRequires:  ocaml-z3-devel
BuildRequires:  openssl

# Needed to install packages and run opam init.
Requires:       bubblewrap
Requires:       bzip2
Requires:       diffutils
Requires:       gcc
Requires:       gzip
Requires:       make
Requires:       patch
Requires:       tar
Requires:       unzip
Requires:       xz

Requires:       opam-installer%{?_isa} = %{version}-%{release}

%description
Opam is a source-based package manager for OCaml. It supports multiple
simultaneous compiler installations, flexible package constraints, and
a Git-friendly development workflow.

%package installer
Summary:        Standalone script for opam install files

%description installer
Standalone script for working with opam .install files, see the opam
package for more information.

%prep
%{gpgverify} --data=%{SOURCE0} --signature=%{SOURCE1} --keyring=%{SOURCE2}
%autosetup -n %{name}-full-%{version} -p1

%build
export DUNE_ARGS='--verbose'
export DUNE_PROFILE_ARG='release'

%configure
%make_build

%install
export DUNE_ARGS='--verbose'
export DUNE_PROFILE_ARG='release'
%make_install

# However it looks like some (extra) documentation gets
# installed in the wrong place so... delete it.
rm -rf %{buildroot}%{_prefix}/doc

# It seems that some tests fail under mock.
# I am not sure why at the moment. So for now I'll just turn them off.
#%%check
#make tests

%files
%license LICENSE
%{_bindir}/opam
%exclude %{_mandir}/man1/opam-installer.1*
%{_mandir}/man1/*.1*

%files installer
%license LICENSE
# Upstream puts this documentation under opam-installer, not opam.
# Since I have opam require opam-installer anyway, this seems reasonable.
# (And there are lots of man pages in the opam package, so it has docs).
%doc README.md CHANGES AUTHORS CONTRIBUTING.md
%{_bindir}/opam-installer
%{_mandir}/man1/opam-installer.1*

%changelog
## START: Generated by rpmautospec
* Thu Aug 22 2024 Jerry James <loganjerry@gmail.com> - 2.2.1-1
- Version 2.2.1

* Wed Jul 17 2024 Jerry James <loganjerry@gmail.com> - 2.2.0-1
- Version 2.2.0
- Fix the VCS field
- Sort BRs and Rs so I can tell what is there
- Allow parallel builds

* Wed Jun 19 2024 Richard W.M. Jones <rjones@redhat.com> - 2.1.6-3
- OCaml 5.2.0 ppc64le fix

* Thu May 30 2024 Richard W.M. Jones <rjones@redhat.com> - 2.1.6-2
- OCaml 5.2.0 for Fedora 41

* Thu May 23 2024 Jerry James <loganjerry@gmail.com> - 2.1.6-1
- Version 2.1.6
- Drop upstreamed dune 3.11 patch
- Add VCS field
- BR openssl for the tests
- Drop unneeded m4 dependency
- Depend on xz at runtime

* Thu Jan 25 2024 Fedora Release Engineering <releng@fedoraproject.org> - 2.1.5-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Sun Jan 21 2024 Fedora Release Engineering <releng@fedoraproject.org> - 2.1.5-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Mon Dec 18 2023 Richard W.M. Jones <rjones@redhat.com> - 2.1.5-9
- OCaml 5.1.1 + s390x code gen fix for Fedora 40

* Tue Dec 12 2023 Richard W.M. Jones <rjones@redhat.com> - 2.1.5-8
- OCaml 5.1.1 rebuild for Fedora 40

* Thu Oct 05 2023 Richard W.M. Jones <rjones@redhat.com> - 2.1.5-7
- OCaml 5.1 rebuild for Fedora 40

* Thu Oct 05 2023 Jerry James <loganjerry@gmail.com> - 2.1.5-6
- Adapt to a change in dune 3.11

* Sun Sep 10 2023 Jerry James <loganjerry@gmail.com> - 2.1.5-5
- Rebuild for ocaml-ocamlgraph 2.1.0

* Thu Jul 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 2.1.5-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild

* Wed Jul 12 2023 Richard W.M. Jones <rjones@redhat.com> - 2.1.5-3
- OCaml 5.0 rebuild for Fedora 39

* Tue Jul 11 2023 Richard W.M. Jones <rjones@redhat.com> - 2.1.5-2
- ExcludeArch i686 (https://lists.fedoraproject.org/archives/list/devel@lis
  ts.fedoraproject.org/message/SPML7CUBSZNI36NLXGVHEG7DNHU3EWOJ/)

* Tue Jul 11 2023 Jerry James <loganjerry@gmail.com> - 2.1.5-1
- Version 2.1.5

* Wed Mar 22 2023 Jerry James <loganjerry@gmail.com> - 2.1.4-1
- Version 2.1.4.  Drop upstreamed patches.

* Tue Jan 24 2023 Richard W.M. Jones <rjones@redhat.com> - 2.1.3-5
- Rebuild OCaml packages for F38

* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 2.1.3-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild

* Tue Sep 20 2022 Jerry James <loganjerry@gmail.com> - 2.1.3-3
- Rebuild for ocaml-cmdliner 1.1.1

* Sat Aug 20 2022 Jerry James <loganjerry@gmail.com> - 2.1.3-2
- Bump and rebuild to fix z3 dependency in F37

* Sat Aug 20 2022 Robin Lee <cheeselee@fedoraproject.org> - 2.1.3-1
- Version 2.1.3 (RHBZ#2117903)

* Fri Aug 19 2022 Jerry James <loganjerry@gmail.com> - 2.1.2-7
- Rebuild for z3 4.11.0.  Convert License tag to SPDX.

* Mon Aug 08 2022 Jerry James <loganjerry@gmail.com> - 2.1.2-6
- Rebuild for z3 4.10.2

* Fri Jul 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 2.1.2-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild

* Sun Jun 19 2022 Richard W.M. Jones <rjones@redhat.com> - 2.1.2-4
- local build

* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 2.1.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild

* Fri Dec 31 2021 Jerry James <loganjerry@gmail.com> - 2.1.2-2
- Rebuild for ocaml-zip 1.11

* Sat Dec 18 2021 Robin Lee <cheeselee@fedoraproject.org> - 2.1.2-1
- Version 2.1.2 (RHBZ#2030270)

* Sat Nov 06 2021 Robin Lee <cheeselee@fedoraproject.org> - 2.1.1-1
- New release (RHBZ#2019288, RHBZ#2020451)

* Tue Oct 05 2021 Richard W.M. Jones <rjones@redhat.com> - 2.1.0-3
- OCaml 4.13.1 build

* Fri Aug 27 2021 Jerry James <loganjerry@gmail.com> - 2.1.0-1
- Version 2.1.0
- Drop upstreamed makefile patch
- Add patch to use ocaml-base64 due to lack of base64 support in extlib
- Add debian patch to adapt to dose3 6.0.1+
- Build with bzip2, libacl, and z3 support

* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.6-13
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild

* Mon Mar  1 21:51:49 GMT 2021 Richard W.M. Jones <rjones@redhat.com> - 2.0.6-12
- OCaml 4.12.0 build

* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.6-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild

* Tue Sep 01 2020 Richard W.M. Jones <rjones@redhat.com> - 2.0.6-10
- OCaml 4.11.1 rebuild

* Fri Aug 21 2020 Richard W.M. Jones <rjones@redhat.com> - 2.0.6-9
- OCaml 4.11.0 rebuild

* Sat Aug 01 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.6-8
- Second attempt - Rebuilt for
  https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild

* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.6-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild

* Sat May 30 2020 Richard W.M. Jones <rjones@redhat.com> - 2.0.6-6
- Rebuild for updated ocaml-extlib (RHBZ#1837823).

* Tue May 05 2020 Richard W.M. Jones <rjones@redhat.com> - 2.0.6-5
- OCaml 4.11.0+dev2-2020-04-22 rebuild

* Wed Apr 22 2020 Richard W.M. Jones <rjones@redhat.com> - 2.0.6-4
- OCaml 4.11.0 pre-release attempt 2

* Sat Apr 04 2020 Richard W.M. Jones <rjones@redhat.com> - 2.0.6-3
- Update all OCaml dependencies for RPM 4.16.

* Thu Feb 27 2020 Richard W.M. Jones <rjones@redhat.com> - 2.0.6-2
- OCaml 4.10.0 final.

* Fri Feb 07 2020 Ben Rosser <rosser.bjr@gmail.com> - 2.0.6-1
- Update to version 2.0.6.

* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.5-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild

* Sun Jan 19 2020 Richard W.M. Jones <rjones@redhat.com> - 2.0.5-3
- OCaml 4.10.0+beta1 rebuild.

* Fri Aug 16 2019 Richard W.M. Jones <rjones@redhat.com> - 2.0.5-2
- OCaml 4.08.1 (final) rebuild.

* Wed Aug 07 2019 Ben Rosser <rosser.bjr@gmail.com> - 2.0.5-1
- Update to latest upstream release.
- dune switch "-p" infers "--profile release", so remove it from JBUILDER_ARGS.

* Thu Aug 01 2019 Richard W.M. Jones <rjones@redhat.com> - 2.0.1-4
- OCaml 4.08.1 (rc2) rebuild.
- Miscellaneous build fixes to disable warnings.

* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild

* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

* Thu Nov 01 2018 Ben Rosser <rosser.bjr@gmail.com> - 2.0.1-1
- Updated to latest upstream release (rhbz#1643738).

* Wed Oct 24 2018 Ben Rosser <rosser.bjr@gmail.com> - 2.0.0-4
- Add requires on make and m4 for opam init setup.

* Tue Oct 02 2018 Ben Rosser <rosser.bjr@gmail.com> - 2.0.0-3
- Add Requires on bubblewrap, gcc as well.

* Sat Sep 22 2018 Ben Rosser <rosser.bjr@gmail.com> - 2.0.0-2
- Add missing Requires on patch, unzip (rhbz#1631969).

* Wed Aug 22 2018 Ben Rosser <rosser.bjr@gmail.com> - 2.0.0-1
- Updated to opam 2.0.0 final release!

* Tue Aug 21 2018 Ben Rosser <rosser.bjr@gmail.com> - 2.0.0-0.9.rc1
- Updated to opam 2.0 rc1.
- Fix FTBFS on Fedora 29/Rawhide.

* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.0-0.8.beta6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

* Mon Apr 30 2018 Ben Rosser <rosser.bjr@gmail.com> - 2.0.0-0.7.beta6
- Add missing dependency on bzip2 (#1572862).

* Thu Feb 08 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.0-0.6.beta6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Wed Dec 13 2017 Ben Rosser <rosser.bjr@gmail.com> - 2.0.0-0.5.beta6
- Update to beta6, with a few fixes from beta5.

* Mon Dec 04 2017 Ben Rosser <rosser.bjr@gmail.com> - 2.0.0-0.4.beta5
- Add upstream patch correctly indicating LGPLv2 license of a few files.

* Tue Nov 28 2017 Ben Rosser <rosser.bjr@gmail.com> - 2.0.0-0.3.beta5
- Updated to latest upstream release.
- Split opam-installer out as a subpackage.

* Mon Oct 02 2017 Ben Rosser <rosser.bjr@gmail.com> - 2.0.0-0.2.beta4
- Updated to latest upstream release.

* Tue Aug 15 2017 Ben Rosser <rosser.bjr@gmail.com> 2.0.0-0.1.beta31
- Initial package.

## END: Generated by rpmautospec