%global opt %(test -x %{_bindir}/ocamlopt && echo 1 || echo 0) %global debug_package %{nil} %global _use_internal_dependency_generator 0 %global __find_requires /usr/lib/rpm/ocaml-find-requires.sh %global __find_provides /usr/lib/rpm/ocaml-find-provides.sh %define libname %(echo %{name} | sed -e 's/^ocaml-//') Name: ocaml-yojson Version: 1.1.8 Release: 1%{?dist} Summary: An optimized parsing and printing library for the JSON format License: BSD URL: http://mjambon.com/yojson.html Source0: http://mjambon.com/releases/yojson/yojson-%{version}.tar.gz Patch0: %{libname}-1.1.8-destdir.patch BuildRequires: ocaml >= 3.10.0 BuildRequires: ocaml-findlib-devel BuildRequires: ocaml-ocamldoc BuildRequires: ocaml-biniou-devel BuildRequires: ocaml-cppo BuildRequires: ocaml-easy-format-devel %description Yojson is an optimized parsing and printing library for the JSON format. It addresses a few shortcomings of json-wheel including 2x speedup, polymorphic variants and optional syntax for tuples and variants. ydump is a pretty-printing command-line program provided with the yojson package. The program atdgen can be used to derive OCaml-JSON serializers and deserializers from type definitions. %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 %setup -q -n %{libname}-%{version} %patch0 -p1 -b .destdir %build make %if %opt make opt %endif %install rm -rf $RPM_BUILD_ROOT # These rules work if the library uses 'ocamlfind install' to install itself. export DESTDIR=$RPM_BUILD_ROOT export OCAMLFIND_DESTDIR=$RPM_BUILD_ROOT%{_libdir}/ocaml mkdir -p $RPM_BUILD_ROOT%{_bindir} mkdir -p $OCAMLFIND_DESTDIR make install strip $RPM_BUILD_ROOT%{_bindir}/ydump strip $OCAMLFIND_DESTDIR/%{libname}/*.cmxs %files %doc LICENSE %{_bindir}/ydump %{_libdir}/ocaml/%{libname}/ %if %opt %exclude %{_libdir}/ocaml/*/*.cmx %endif %exclude %{_libdir}/ocaml/*/*.mli %exclude %{_libdir}/ocaml/*/*.o %files devel %doc LICENSE README.md Changes %if %opt %{_libdir}/ocaml/*/*.cmx %endif %{_libdir}/ocaml/*/*.mli %{_libdir}/ocaml/*/*.o %changelog * Mon Jan 20 2014 Michel Salim - 1.1.8-1 - Initial package