File ocaml-xmlm.spec of Package ocaml-xmlm

#
# spec file for package ocaml-xmlm
#
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


%define modname xmlm
Name:           ocaml-%{modname}
Version:        1.0.2
Release:        0
%{?ocaml_preserve_bytecode}
Summary:        Streaming XML input/output for OCaml
License:        BSD-2-Clause
Group:          Development/Languages/OCaml
Url:            http://erratique.ch/software/xmlm
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Source0:        %{modname}-%{version}.tar.gz
BuildRequires:  ocaml
BuildRequires:  ocaml-findlib
BuildRequires:  ocaml-ocamlbuild
BuildRequires:  ocaml-rpm-macros >= 4.02.1

%description
Xmlm is an OCaml module for streaming XML input/output. It aims
at making XML processing robust and painless. The streaming interface
can process documents without building an in-memory representation. It
lets the programmer translate its data structures to XML documents and
vice-versa. Functions are provided to easily transform arborescent
data structures to/from XML documents.

%package        devel
Summary:        Development files for %{name}
Group:          Development/Languages/OCaml
Requires:       %{name} = %{version}

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

%prep
%setup -q -n %{modname}-%{version}

%build
sh -x ./build xmltrip.byte
%if 0%{?ocaml_native_compiler}
sh -x ./build xmltrip.native
%endif
sed -i~ '
s@^version.*@version = "%{version}"@
/^description/d
' src/META
diff -u src/META~ src/META || :

%install
export INSTALLDIR=%{buildroot}%{_libdir}/ocaml/%{modname}
mkdir -p $INSTALLDIR %{buildroot}%{_bindir}
%if 0%{?ocaml_native_compiler}
sh -x ./build install-plugin
cp -v \
	xmltrip.native \
	%{buildroot}%{_bindir}/xmltrip
%else
sh -x ./build install-byte
cp -v \
	xmltrip.byte \
	%{buildroot}%{_bindir}/xmltrip
%endif

%files
%defattr(-,root,root)
%doc CHANGES README
%{_bindir}/xmltrip
%dir %{_libdir}/ocaml
%dir %{_libdir}/ocaml/*
%if 0%{?ocaml_native_compiler}
%{_libdir}/ocaml/*/*.cmxs
%endif

%files devel
%defattr(-,root,root)
%dir %{_libdir}/ocaml
%dir %{_libdir}/ocaml/*
%if 0%{?ocaml_native_compiler}
%{_libdir}/ocaml/*/*.cmx
%{_libdir}/ocaml/*/*.o
%endif
%{_libdir}/ocaml/*/*.cmi
%{_libdir}/ocaml/*/*.cmo
%{_libdir}/ocaml/*/*.ml
%{_libdir}/ocaml/*/*.mli
%{_libdir}/ocaml/*/META

%changelog
openSUSE Build Service is sponsored by