File mysql-connector-c++.spec of Package mysql-connector-c++

#
# spec file for package mysql-connector-c++
#
# Copyright (c) 2012 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 libname libmysqlcppconn6
Name:           mysql-connector-c++
Summary:        MySQL database connector for C++ (mimics JDBC 4.0 API)
Version:        1.1.1
Release:        0
Group:          Productivity/Databases/Clients
License:        SUSE-GPL-2.0-with-FLOSS-exception
Url:            http://dev.mysql.com/downloads/connector/cpp/
Source:         %{name}-%{version}.tar.gz
Patch0:         mysql-connector-c++-1.1.0-fix-cmake.patch
Patch1:         mysql-connector-c++-1.1.0-disable-tests.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  pkgconfig
BuildRequires:  cmake
BuildRequires:  boost-devel
BuildRequires:  openssl-devel
BuildRequires:  mysql-devel
BuildRequires:  gcc-c++

%description
MySQL Connector/C++ is a MySQL database connector for C++. It lets you develop applications in C++ that connect to the MySQL Server.

%package -n %{libname}
License:        SUSE-GPL-2.0-with-FLOSS-exception
Summary:        MySQL database connector for C++ (mimics JDBC 4.0 API)
Group:          Productivity/Databases/Clients

%description -n %{libname}
MySQL Connector/C++ is a MySQL database connector for C++. It lets you develop applications in C++ that connect to the MySQL Server.

%package devel
License:        SUSE-GPL-2.0-with-FLOSS-exception
Requires:       %{libname} = %{version}
Requires:       mysql-devel
Summary:        Files for Developing with %{name}
Group:          Development/Libraries/C and C++

%description devel
Includes and definitions for developing with the %{name} library.

%prep
%setup -q
%patch0 -p1
%patch1 -p1

%build
cmake \
	-DCMAKE_C_FLAGS:STRING="%{optflags}" \
	-DCMAKE_CXX_FLAGS:STRING="%{optflags}" \
	-DCMAKE_BUILD_TYPE=RelWithDebInfo \
	-DCMAKE_SKIP_RPATH=ON \
	-DCMAKE_INSTALL_PREFIX=%{_prefix} \
	-DBUILD_SHARED_LIBS=ON \
%if %{_lib} == lib64
	-DLIB_SUFFIX=64 \
%endif
	-DMYSQLCPPCONN_GCOV_ENABLE=ON \
	-DMYSQLCPPCONN_ICU_ENABLE=OFF \
	-DMYSQLCPPCONN_BUILD_EXAMPLES=OFF

make %{?_smp_mflags}

%install
make DESTDIR=%{buildroot} install

# broken docs install
rm -rf %{buildroot}/usr/{ANNOUNCEMENT,COPYING,INSTALL,Licenses_for_Third-Party_Components.txt,README}
# static lib :/
rm -rf %{buildroot}%{_libdir}/*.a

%clean
rm -rf $RPM_BUILD_ROOT

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

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

%files -n %{libname}
%defattr(-,root,root,-)
%doc ANNOUNCEMEN* COPYING README CHANGES Licenses_for_Third-Party_Components.txt
%{_libdir}/*.so.6*

%files devel
%defattr(-,root,root,-)
%{_includedir}/cppconn
%{_includedir}/*.h
%{_libdir}/*.so

%changelog
openSUSE Build Service is sponsored by