File ocaml-extlib.spec of Package ocaml-extlib

#
# spec file for package ocaml-extlib
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2011 Andrew Psaltis <ampsaltis at gmail dot com>
#
# 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/
#


Name:           ocaml-extlib
Version:        1.7.2
Release:        0
%{?ocaml_preserve_bytecode}
Summary:        OCaml ExtLib additions to the standard library
License:        LGPL-2.1+
Group:          Development/Languages/OCaml
Url:            https://github.com/ygrek/ocaml-extlib
Source0:        extlib-%{version}.tar.gz
BuildRequires:  ocaml
BuildRequires:  ocaml-oasis
BuildRequires:  ocaml-ocamldoc
BuildRequires:  ocaml-rpm-macros >= 4.03
BuildRequires:  ocamlfind(ocamlbuild_cppo)
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
ExtLib is a project aiming at providing a complete - yet small -
standard library for the OCaml programming language. The purpose of
this library is to add new functions to OCaml Standard Library
modules, to modify some functions in order to get better performances
or more safety (tail-recursive) but also to provide new modules which
should be useful for the average OCaml programmer.

%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 extlib-%{version}

%build
rm -fv setup.ml myocamlbuild.ml META* _* */_* */META*
#
tee cppo <<_EOF_
#!/bin/bash
exec $(type -p cppo) `ocaml src/configure.ml | xargs` "\$@"
_EOF_
chmod -v 00755 cppo
export PATH=$PWD:$PATH
#
tee src/_tags <<_EOF_
<**/*.ml>: pp(cppo)
<**/*.mli>: pp(cppo)
_EOF_
# obs service changes every ^Version line ...
sh -c "sed 's/^Version.*/Version: %{version}/' | tee _oasis" <<_EOF_
OASISFormat: 0.4
Name:        %{name}
Version:     %{version}
Synopsis:    Extended Standard Library for OCaml
Authors:     ygrek@autistici.org
License:     %{license}
Plugins:     META(`oasis version`)
BuildTools:  ocamlbuild, cppo
OCamlVersion: >= 4.03
AlphaFeatures: ocamlbuild_more_args
XOCamlbuildPluginTags: package(ocamlbuild_cppo)

Library extlib
 Install: true
 Path: src
 Modules: \
 Base64, \
 BitSet, \
 Dllist, \
 DynArray, \
 Enum, \
 ExtArray, \
 ExtBuffer, \
 ExtBytes, \
 ExtHashtbl, \
 ExtLib, \
 ExtList, \
 ExtString, \
 Global, \
 IO, \
 OptParse, \
 Option, \
 PMap, \
 RefList, \
 Std, \
 UChar, \
 UTF8, \
 Unzip

Document "extlib"
 Title:                API reference for extlib
 Type:                 ocamlbuild
 BuildTools+:          ocamldoc
 InstallDir:           \$htmldir
 Install:              true
 XOCamlbuildPath:      .
 XOCamlbuildLibraries: extlib

_EOF_

%oasis_setup
%ocaml_oasis_configure --enable-docs --enable-tests
%ocaml_oasis_build
%ocaml_oasis_doc

%install
%ocaml_oasis_findlib_install

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

%files devel
%defattr(-,root,root,-)
%{oasis_docdir_html}
%dir %{_libdir}/ocaml
%dir %{_libdir}/ocaml/*
%if 0%{?ocaml_native_compiler}
%{_libdir}/ocaml/*/*.a
%{_libdir}/ocaml/*/*.cmx
%{_libdir}/ocaml/*/*.cmxa
%endif
%{_libdir}/ocaml/*/*.annot
%{_libdir}/ocaml/*/*.cma
%{_libdir}/ocaml/*/*.cmi
%{_libdir}/ocaml/*/*.cmt
%{_libdir}/ocaml/*/*.cmti
%{_libdir}/ocaml/*/*.mli
%{_libdir}/ocaml/*/*.ml
%{_libdir}/ocaml/*/META

%changelog
openSUSE Build Service is sponsored by