Blame SPECS/ocaml-csexp.spec

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