Blob Blame History Raw
# This package doesn't seem to want to make debuginfo either. :(
%global debug_package %{nil}

%global pre_tag beta3

Name:           ocaml-opam-file-format
Version:        2.0.0
Release:        0.4.%{pre_tag}%{?dist}
Summary:        Parser and printer for the opam file syntax

%global libname %(echo %{name} | sed -e 's/^ocaml-//')

# This is apparently a standard "OCaml exception" and is detailed
# in the license file. That wasn't included in the repo, but I filed
# a ticket (https://github.com/ocaml/opam-file-format/issues/5)
# and now it is, so I've added the commit that added license as a patch.
License:        LGPLv2 with exceptions
URL:            https://github.com/ocaml/opam-file-format/
Source0:        https://github.com/ocaml/%{libname}/archive/%{version}-%{pre_tag}/%{name}-%{version}.tar.gz

# See above; this got added into the library post-release.
Patch0:         https://github.com/ocaml/opam-file-format/commit/f13e7e665013d2abf6e369f8cb780fe4f491ce94.patch

BuildRequires:  ocaml

%description
Parser and printer for the opam file syntax.

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

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

%prep
%autosetup -n %{libname}-%{version}-%{pre_tag} -p1

# Generate debuginfo, or try to.
sed 's/ocamlc/ocamlc -g/g' -i src/Makefile
sed 's/ocamlopt/ocamlopt -g/g' -i src/Makefile

%build
make byte %{?_smp_mflags}
%ifarch %{ocaml_native_compiler}
make native %{?_smp_mflags}
%endif

%install
make install LIBDIR=%{_libdir}/ocaml DESTDIR=%{buildroot}

# The mli files don't seem to get installed by the makefile.
# This is suboptimal.
cp -a src/*.mli %{buildroot}%{_libdir}/ocaml/%{libname}/

%files
# There is no documentation.
%license LICENSE
%{_libdir}/ocaml/%{libname}
%ifarch %{ocaml_native_compiler}
%exclude %{_libdir}/ocaml/%{libname}/*.a
%exclude %{_libdir}/ocaml/%{libname}/*.cmxa
%exclude %{_libdir}/ocaml/%{libname}/*.cmx
%endif
%exclude %{_libdir}/ocaml/%{libname}/*.mli

%files devel
%license LICENSE
%ifarch %{ocaml_native_compiler}
%{_libdir}/ocaml/%{libname}/*.a
%{_libdir}/ocaml/%{libname}/*.cmxa
%{_libdir}/ocaml/%{libname}/*.cmx
%endif
%{_libdir}/ocaml/*/*.mli

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

* Sat Dec 02 2017 Richard W.M. Jones <rjones@redhat.com> - 2.0.0-0.3.beta3
- OCaml 4.06.0 rebuild.

* Tue Aug 15 2017 Ben Rosser <rosser.bjr@gmail.com> 2.0.0-0.2.beta3
- Modernize ocaml packaging, use macro for testing native compiler.
- Remove manual invocation of ocaml dependency generator.
- Add -g to ocamlc, ocamlopt invocations, but this still doesn't make debuginfo.
- Use global instead of define for libname macro.

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