Blame SPECS/ocaml-csexp.spec

480571
%ifnarch %{ocaml_native_compiler}
480571
%global debug_package %{nil}
480571
%endif
480571
480571
%global srcname csexp
480571
480571
# This package is needed to build dune.  To avoid circular dependencies, this
480571
# package cannot depend on dune, or any package that depends on dune.
480571
# Therefore, we:
480571
# - hack up our own build, rather than using dune to do the build
480571
# - bypass the need for ocaml-result (which requires dune to build)
480571
# - skip tests, which require ppx_expect, which is built with dune
480571
# - skip building documentation, which requires odoc, which is built with dune
480571
# If you know what you are doing, build with dune anyway using this conditional.
480571
%bcond_with dune
480571
480571
Name:           ocaml-%{srcname}
480571
Version:        1.3.2
480571
Release:        6%{?dist}
480571
Summary:        Parsing and printing of S-expressions in canonical form
480571
480571
License:        MIT
480571
URL:            https://github.com/ocaml-dune/csexp
480571
Source0:        %{url}/releases/download/%{version}/%{srcname}-%{version}.tbz
480571
480571
# Depend on Stdlib.Result instead of ocaml-result.  See comment above.
480571
# This patch is not appropriate for upstream, which needs to keep compatibility
480571
# with older OCaml versions.
480571
Patch0:         %{name}-result.patch
480571
480571
BuildRequires:  ocaml >= 4.02.3
480571
%if %{with dune}
480571
BuildRequires:  ocaml-dune >= 1.11
480571
BuildRequires:  ocaml-odoc
480571
BuildRequires:  ocaml-result-devel >= 1.5
480571
%endif
480571
480571
%description
480571
This project provides minimal support for parsing and printing
480571
S-expressions in canonical form, which is a very simple and canonical
480571
binary encoding of S-expressions.
480571
480571
%package        devel
480571
Summary:        Development files for %{name}
480571
Requires:       %{name}%{?_isa} = %{version}-%{release}
480571
%if %{with dune}
480571
Requires:       ocaml-result-devel%{?_isa}
480571
%endif
480571
480571
%description    devel
480571
The %{name}-devel package contains libraries and signature files for
480571
developing applications that use %{name}.
480571
480571
%prep
480571
%autosetup -N -n %{srcname}-%{version}
480571
%if %{without dune}
480571
%autopatch -p1
480571
%endif
480571
480571
%build
480571
%if %{with dune}
480571
dune build %{?_smp_mflags} --display=verbose @install
480571
dune build %{?_smp_mflags} @doc
480571
%else
480571
OFLAGS="-strict-sequence -strict-formats -short-paths -keep-locs -g -opaque"
480571
OCFLAGS="$OFLAGS -bin-annot"
480571
cd src
480571
ocamlc $OCFLAGS -output-obj csexp.mli
480571
ocamlc $OCFLAGS -a -o csexp.cma csexp.ml
480571
%ifarch %{ocaml_native_compiler}
480571
ocamlopt $OFLAGS -ccopt "%{optflags}" -cclib "$RPM_LD_FLAGS" -a \
480571
  -o csexp.cmxa csexp.ml
480571
ocamlopt $OFLAGS -ccopt "%{optflags}" -cclib "$RPM_LD_FLAGS" -shared \
480571
  -o csexp.cmxs csexp.ml
480571
%endif
480571
cd -
480571
%endif
480571
480571
%install
480571
%if %{with dune}
480571
dune install --destdir=%{buildroot}
480571
480571
# We do not want the dune markers
480571
find _build/default/_doc/_html -name .dune-keep -delete
480571
480571
# We do not want the ml files
480571
find %{buildroot}%{_libdir}/ocaml -name \*.ml -delete
480571
480571
# We install the documentation with the doc macro
480571
rm -fr %{buildroot}%{_prefix}/doc
480571
480571
%ifarch %{ocaml_native_compiler}
480571
# Add missing executable bits
480571
find %{buildroot}%{_libdir}/ocaml -name \*.cmxs -exec chmod a+x {} \+
480571
%endif
480571
%else
480571
# Install without dune.  See comment at the top.
480571
mkdir -p %{buildroot}%{_libdir}/ocaml/%{srcname}
480571
cp -p src/csexp.{cma,cmi,cmt,cmti,mli} %{buildroot}%{_libdir}/ocaml/%{srcname}
480571
%ifarch %{ocaml_native_compiler}
480571
cp -p src/csexp.{a,cmx,cmxa,cmxs} %{buildroot}%{_libdir}/ocaml/%{srcname}
480571
%endif
480571
cp -p csexp.opam %{buildroot}%{_libdir}/ocaml/%{srcname}/opam
480571
480571
cat >> %{buildroot}%{_libdir}/ocaml/%{srcname}/META << EOF
480571
version = "%{version}"
480571
description = "Parsing and printing of S-expressions in canonical form"
480571
archive(byte) = "csexp.cma"
480571
%ifarch %{ocaml_native_compiler}
480571
archive(native) = "csexp.cmxa"
480571
%endif
480571
plugin(byte) = "csexp.cma"
480571
%ifarch %{ocaml_native_compiler}
480571
plugin(native) = "csexp.cmxs"
480571
%endif
480571
EOF
480571
480571
cat >> %{buildroot}%{_libdir}/ocaml/%{srcname}/dune-package << EOF
480571
(lang dune 2.5)
480571
(name csexp)
480571
(version %{version})
480571
(library
480571
 (name csexp)
480571
 (kind normal)
480571
%ifarch %{ocaml_native_compiler}
480571
 (archives (byte csexp.cma) (native csexp.cmxa))
480571
 (plugins (byte csexp.cma) (native csexp.cmxs))
480571
 (native_archives csexp.a)
480571
%else
480571
 (archives (byte csexp.cma))
480571
 (plugins (byte csexp.cma))
480571
%endif
480571
 (main_module_name Csexp)
480571
%ifarch %{ocaml_native_compiler}
480571
 (modes byte native)
480571
%else
480571
 (modes byte)
480571
%endif
480571
 (modules
480571
  (singleton (name Csexp) (obj_name csexp) (visibility public) (impl) (intf))))
480571
EOF
480571
%endif
480571
480571
# Cannot do this until ocaml-ppx-expect is available in Fedora.
480571
#%%if %%{with dune}
480571
#%%check
480571
#dune runtest
480571
#%%endif
480571
480571
%files
480571
%doc README.md
480571
%license LICENSE.md
480571
%dir %{_libdir}/ocaml/%{srcname}/
480571
%{_libdir}/ocaml/%{srcname}/META
480571
%{_libdir}/ocaml/%{srcname}/*.cma
480571
%{_libdir}/ocaml/%{srcname}/*.cmi
480571
%ifarch %{ocaml_native_compiler}
480571
%{_libdir}/ocaml/%{srcname}/*.cmxs
480571
%endif
480571
480571
%files devel
480571
%{_libdir}/ocaml/%{srcname}/dune-package
480571
%{_libdir}/ocaml/%{srcname}/opam
480571
%ifarch %{ocaml_native_compiler}
480571
%{_libdir}/ocaml/%{srcname}/*.a
480571
%{_libdir}/ocaml/%{srcname}/*.cmx
480571
%{_libdir}/ocaml/%{srcname}/*.cmxa
480571
%endif
480571
%{_libdir}/ocaml/%{srcname}/*.cmt
480571
%{_libdir}/ocaml/%{srcname}/*.cmti
480571
%{_libdir}/ocaml/%{srcname}/*.mli
480571
480571
%changelog
480571
* Fri Mar 11 2022 Richard W.M. Jones <rjones@redhat.com> - 1.3.2-6
480571
- Rebuild for EPEL
480571
resolves: rhbz#2060850
480571
480571
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 1.3.2-5
480571
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
480571
  Related: rhbz#1991688
480571
480571
* Wed Jun 23 2021 Richard W.M. Jones <rjones@redhat.com> - 1.3.2-4
480571
- Bump and rebuild
480571
  resolves: rhbz#1975302
480571
480571
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 1.3.2-3
480571
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
480571
480571
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.3.2-2
480571
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
480571
480571
* Fri Sep 18 2020 Jerry James <loganjerry@gmail.com> - 1.3.2-1
480571
- Version 1.3.2
480571
480571
* Thu Sep 10 2020 Jerry James <loganjerry@gmail.com> - 1.3.1-1
480571
- Initial RPM