File ocaml-sqlite.spec of Package ocaml-sqlite

#
# spec file for package ocaml-sqlite
#
# 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/
#


Name:           ocaml-sqlite
Version:        4.1.3
Release:        0
%{?ocaml_preserve_bytecode}
Summary:        OCaml library for accessing SQLite3 databases
License:        BSD-2-Clause
Group:          Development/Languages/OCaml
Url:            https://github.com/mmottl/sqlite3-ocaml
Source0:        %{name}-%{version}.tar.xz
BuildRequires:  ocaml >= 3.10.0
BuildRequires:  ocaml-oasis
BuildRequires:  ocaml-ocamldoc
BuildRequires:  ocaml-rpm-macros >= 4.03
BuildRequires:  ocamlfind(str)
BuildRequires:  pkg-config
BuildRequires:  pkgconfig(sqlite3)
BuildRequires:  ncurses-devel
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
SQLite 3 database library wrapper for OCaml.

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

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

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

%description    test
This package contains testcases to verify %{name} functionality.

%prep
%setup -q

%build
rm -fv myocamlbuild.ml META* _tags
tee _oasis <<_EOF_
OASISFormat: 0.4
Name:        sqlite3
Version:     4.1.3%{version}
Synopsis:    OCaml library for accessing SQLite3 databases
Authors:     Christian Szegedy <csdontspam871@metamatix.org>
LicenseFile: COPYING
License:     %{license}
Plugins:     META(`oasis version`)
BuildTools:  ocamlbuild

Library "sqlite3"
 Path: src
 Modules: Sqlite3
 Install: true
 CSources: sqlite3_stubs.c
 CCOpt:  %{optflags} -fPIC `pkg-config --cflags sqlite3`
 CCLib: `pkg-config --libs sqlite3` -lpthread

Executable "%{name}-test-test_agg"
 Install: true
 Path: test
 MainIs: test_agg.ml
 CompiledObject: best
 BuildDepends: sqlite3

Executable "%{name}-test-test_db"
 Install: true
 Path: test
 MainIs: test_db.ml
 CompiledObject: best
 BuildDepends: sqlite3

Executable "%{name}-test-test_exec"
 Install: true
 Path: test
 MainIs: test_exec.ml
 CompiledObject: best
 BuildDepends: sqlite3

Executable "%{name}-test-test_fun"
 Install: true
 Path: test
 MainIs: test_fun.ml
 CompiledObject: best
 BuildDepends: sqlite3, str

Executable "%{name}-test-test_stmt"
 Install: true
 Path: test
 MainIs: test_stmt.ml
 CompiledObject: best
 BuildDepends: sqlite3

Document "sqlite3"
 Title:                API reference for sqlite3
 Type:                 ocamlbuild
 BuildTools+:          ocamldoc
 InstallDir:           \$htmldir
 Install:              true
 XOCamlbuildPath:      .
 XOCamlbuildLibraries: sqlite3
_EOF_
%oasis_setup
%ocaml_oasis_configure --enable-docs
%ocaml_oasis_build
%ocaml_oasis_doc

%install
%ocaml_oasis_findlib_install
#
mkdir -vp %{buildroot}/etc/ld.so.conf.d/
tee %{buildroot}/etc/ld.so.conf.d/%{name}.conf <<_EOF_
%{_libdir}/ocaml/sqlite3
_EOF_
#

%post   -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files
%defattr(-,root,root,-)
%doc COPYING.txt
/etc/ld.so.conf.d/*.conf
%dir %{_libdir}/ocaml
%dir %{_libdir}/ocaml/*
%if 0%{?ocaml_native_compiler}
%{_libdir}/ocaml/*/*.cmxs
%endif
%{_libdir}/ocaml/*/*.so

%files test
%defattr(-,root,root,-)
%{_bindir}/*

%files devel
%defattr(-,root,root,-)
%doc CHANGES.txt README.md TODO.md
%{oasis_docdir_html}
%dir %{_libdir}/ocaml
%dir %{_libdir}/ocaml/*
%{_libdir}/ocaml/*/*.a
%if 0%{?ocaml_native_compiler}
%{_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/*/META

%changelog
openSUSE Build Service is sponsored by