d2d0e7c
%global opt %(test -x %{_bindir}/ocamlopt && echo 1 || echo 0)
d2d0e7c
%if !%{opt}
d2d0e7c
%global debug_package %{nil}
d2d0e7c
%endif
d2d0e7c
d2d0e7c
Name:           ocaml-yojson
d2d0e7c
Version:        1.1.8
a95984a
Release:        5%{?dist}
d2d0e7c
Summary:        An optimized parsing and printing library for the JSON format
d2d0e7c
d2d0e7c
License:        BSD
d2d0e7c
URL:            http://mjambon.com/yojson.html
d2d0e7c
Source0:        http://mjambon.com/releases/yojson/yojson-%{version}.tar.gz
d2d0e7c
# Example JSON files for testing
d2d0e7c
Source1:        test-valid.json
d2d0e7c
Source2:        test-invalid.json
d2d0e7c
d2d0e7c
BuildRequires:  ocaml >= 3.10.0
d2d0e7c
BuildRequires:  ocaml-findlib
d2d0e7c
BuildRequires:  ocaml-ocamldoc
d2d0e7c
BuildRequires:  ocaml-biniou-devel
d2d0e7c
BuildRequires:  ocaml-cppo
d2d0e7c
BuildRequires:  ocaml-easy-format-devel
d2d0e7c
d2d0e7c
%global libname %(sed -e 's/^ocaml-//' <<< %{name})
d2d0e7c
d2d0e7c
%description
d2d0e7c
Yojson is an optimized parsing and printing library for the JSON
d2d0e7c
format. It addresses a few shortcomings of json-wheel including 2x
d2d0e7c
speedup, polymorphic variants and optional syntax for tuples and
d2d0e7c
variants.
d2d0e7c
d2d0e7c
ydump is a pretty-printing command-line program provided with the
d2d0e7c
yojson package.
d2d0e7c
d2d0e7c
The program atdgen can be used to derive OCaml-JSON serializers and
d2d0e7c
deserializers from type definitions.
d2d0e7c
d2d0e7c
d2d0e7c
%package        devel
d2d0e7c
Summary:        Development files for %{name}
d2d0e7c
Requires:       %{name}%{?_isa} = %{version}-%{release}
d2d0e7c
d2d0e7c
%description    devel
d2d0e7c
The %{name}-devel package contains libraries and signature files for
d2d0e7c
developing applications that use %{name}.
d2d0e7c
d2d0e7c
d2d0e7c
%prep
d2d0e7c
%setup -q -n %{libname}-%{version}
d2d0e7c
d2d0e7c
d2d0e7c
%build
d2d0e7c
# not SMP-safe
d2d0e7c
make META all
d2d0e7c
%if %opt
d2d0e7c
make opt
d2d0e7c
%endif
d2d0e7c
d2d0e7c
d2d0e7c
%install
d2d0e7c
# These rules work if the library uses 'ocamlfind install' to install itself.
d2d0e7c
export PREFIX=$RPM_BUILD_ROOT%{_prefix}
d2d0e7c
export OCAMLFIND_DESTDIR=$RPM_BUILD_ROOT%{_libdir}/ocaml
d2d0e7c
mkdir -p $RPM_BUILD_ROOT%{_bindir}
d2d0e7c
mkdir -p $OCAMLFIND_DESTDIR
d2d0e7c
make install
d2d0e7c
d2d0e7c
d2d0e7c
%check
d2d0e7c
# Against valid JSON
d2d0e7c
$RPM_BUILD_ROOT%{_bindir}/ydump %{SOURCE1} >/dev/null 2>valid-err.log
d2d0e7c
[ -z "$(cat valid-err.log)" ]
d2d0e7c
d2d0e7c
# Against invalid JSON
d2d0e7c
[ ! $($RPM_BUILD_ROOT%{_bindir}/ydump %{SOURCE2} 2>/dev/null) ]
d2d0e7c
d2d0e7c
d2d0e7c
%files
d2d0e7c
%doc LICENSE
d2d0e7c
%{_libdir}/ocaml/%{libname}/
d2d0e7c
%if %opt
d2d0e7c
%{_bindir}/ydump
d2d0e7c
%exclude %{_libdir}/ocaml/*/*.cmx
d2d0e7c
%exclude %{_libdir}/ocaml/*/*.o
d2d0e7c
%endif
d2d0e7c
%exclude %{_libdir}/ocaml/*/*.mli
d2d0e7c
d2d0e7c
d2d0e7c
%files devel
d2d0e7c
%doc LICENSE README.md Changes examples
d2d0e7c
%if %opt
d2d0e7c
%{_libdir}/ocaml/*/*.cmx
d2d0e7c
%{_libdir}/ocaml/*/*.o
d2d0e7c
%endif
d2d0e7c
%{_libdir}/ocaml/*/*.mli
d2d0e7c
d2d0e7c
d2d0e7c
%changelog
a95984a
* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1.8-5
a95984a
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
a95984a
6662e50
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1.8-4
6662e50
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
6662e50
Jaromir Capik 4545da1
* Thu Apr 24 2014 Jaromir Capik <jcapik@redhat.com> - 1.1.8-3
Jaromir Capik 4545da1
- Removing ExclusiveArch
Jaromir Capik 4545da1
d2d0e7c
* Sat Feb  8 2014 Michel Salim <salimma@fedoraproject.org> - 1.1.8-2
d2d0e7c
- Incorporate review feedback
d2d0e7c
d2d0e7c
* Mon Jan 20 2014 Michel Salim <salimma@fedoraproject.org> - 1.1.8-1
d2d0e7c
- Initial package