File vsqlite++.spec of Package vsqlite++

#
# spec file for package vsqlite++
#
# Copyright (c) 2014 SUSE LINUX Products 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 _libpacname libvsqlitepp3
#
Name:           vsqlite++
Version:        0.3.12
Release:        0
Summary:        Well designed C++ sqlite 3.x wrapper library
#Upstream issue https://github.com/vinzenz/vsqlite--/issues/2 in progress
License:        BSD-3-Clause
Group:          Development/Libraries/C and C++
Url:            https://github.com/vinzenz/vsqlite--
Source0:        %{name}-%{version}.tar.xz
# Upstream patches for SLE build
Patch0:         0001-Build-system-Use-std-c-98-instead-of-std-c-03.patch
Patch1:         0002-Adding-include-limits-for-using-numeric_limits.patch
BuildRequires:  autoconf
BuildRequires:  boost-devel
BuildRequires:  dos2unix
BuildRequires:  doxygen
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  graphviz
BuildRequires:  graphviz-gd
BuildRequires:  graphviz-gnome
BuildRequires:  libtool
BuildRequires:  make
BuildRequires:  perl-base
BuildRequires:  sqlite-devel
BuildRequires:  xz
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
VSQLite++ is a C++ wrapper for sqlite3 using the C++ standard library and boost.
VSQLite++ is designed to be easy to use and focuses on simplicity.

%package -n %{_libpacname}
Summary:        Well designed C++ sqlite 3.x wrapper library
Group:          System/Libraries
Obsoletes:      %{_libpacname} < %{version}

%description -n %{_libpacname}
VSQLite++ is a C++ wrapper for sqlite3 using the C++ standard library and boost.
VSQLite++ is designed to be easy to use and focuses on simplicity.

%package devel
Summary:        Development files for %{name}
Group:          Development/Libraries/C and C++
Requires:       %{_libpacname}

%description devel
This package contains development files for %{name}.

%package doc
Summary:        Development documentation for %{name}
Group:          Development/Libraries/C and C++
%if %suse_version > 1200
BuildArch:      noarch
%endif

%description doc
This package contains development documentation files for %{name}.

%prep
%setup -q
find . -iname "*.[ch]pp" -exec dos2unix -k {} \;

%if 0%{?suse_version} < 1230
echo "Patching Makefile.am -std=c++98"
%patch0
%endif
%patch1

%build
export CFLAGS="%{optflags} -fno-strict-aliasing ${INCLUDES}"
export CXXFLAGS="%{optflags} -fno-strict-aliasing ${INCLUDES}"
sh ./autogen.sh --prefix=%{_prefix} --libdir=%{_libdir}

echo "autogen done"

%configure
sed -i -e 's! -shared ! -Wl,--as-needed\0!g' libtool
make %{?_smp_mflags}

#Update Doxyfile to suppress Deprecated stuff
#less warnings
doxygen -u Doxyfile
doxygen Doxyfile
%fdupes -s html/

%install
# devel & base
install -p -m 755 -d %{buildroot}%{_libdir}
# devel only
install -p -m 755 -d %{buildroot}%{_includedir}/sqlite/ext
install -m 644 include/sqlite/*.hpp %{buildroot}%{_includedir}/sqlite
install -m 644 include/sqlite/ext/*.hpp %{buildroot}%{_includedir}/sqlite/ext
# docs
install -p -m 755 -d %{buildroot}%{_docdir}

# build for all
make DESTDIR=%{buildroot} install %{?_smp_mflags}

%fdupes -s %{buildroot}%{_docdir}

%post -n %{_libpacname} -p /sbin/ldconfig

%postun -n %{_libpacname} -p /sbin/ldconfig

%files doc
%defattr(0644, root, root, 0755)
%doc ChangeLog README COPYING examples/sqlite_wrapper.cpp html/*

%files devel
%defattr(0644, root, root, 0755)
%doc ChangeLog README COPYING
%{_includedir}/sqlite
%{_libdir}/libvsqlitepp.so
# Don't add .la/.a to the package
%exclude %{_libdir}/libvsqlitepp.la
%exclude %{_libdir}/libvsqlitepp.a

%files -n %{_libpacname}
%defattr(0644, root, root, 0755)
%doc ChangeLog README COPYING
%{_libdir}/libvsqlitepp.so.*

%changelog
openSUSE Build Service is sponsored by