File MyODBC-unixODBC.spec of Package MyODBC-unixODBC.470

#
# spec file for package MyODBC-unixODBC
#
# 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:           MyODBC-unixODBC
Version:        5.1.8
Release:        0
%define         manager unixODBC
Summary:        ODBC Interface for Communication with MySQL Compiled with UnixODBC
License:        SUSE-GPL-2.0-with-FLOSS-exception
Group:          Productivity/Databases/Tools
Url:            http://www.mysql.com/products/myodbc/index.html
Source0:        mysql-connector-odbc-%{version}.tar.gz
Source1:        odbcinst.ini.%{manager}.sample
Source2:        odbc.ini.%{manager}.sample
Source3:        README
Source100:      MyODBC-unixODBC-rpmlintrc
Patch1:         MyODBC-unixODBC-my_free.patch
Patch3:         MyODBC-unixODBC-64bit.patch
Patch4:         MyODBC-unixODBC-my_init_dynamic_array_flags.patch
Patch5:         MyODBC-unixODBC-my_malloc_when_using_my_free.patch
Patch6:         MyODBC-unixODBC-is_minimum_version.patch
Patch7:         MyODBC-unixODBC-remove_use_of_test_macro.patch
BuildRequires:  libtool
BuildRequires:  mysql-devel
BuildRequires:  unixODBC-devel
Supplements:    packageand(unixODBC:mysql-shared)
Obsoletes:      MyODBC-libiodbc < %{version}
Provides:       MyODBC-libiodbc = %{version}
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
MyODBC is an interface for communication with MySQL. It is one of the
most popular ODBC drivers in the open source market, used by many users
to access the MySQL functionality. It is compiled with unixODBC.

%prep
%setup -q -n mysql-connector-odbc-%{version}
%patch1 -p1
%patch3 -p1
if grep -l 'my_init_dynamic_array(A,B,C,D,E)' /usr/include/mysql/my_sys.h; then
%patch4
fi
%patch5 -p1
%patch6 -p1
%patch7 -p1

%build
# mysql 5.5.10 has stopped #define'ing THREAD in its exports, and has
# started #define'ing MY_PTHREAD_FASTMUTEX, and neither of those changes
# sit well with mysql-connector-odbc 5.1.8.  Revisit need for these hacks
# when updating to newer release.
export CFLAGS="%{optflags} -fno-strict-aliasing -DTHREAD=1 -UMY_PTHREAD_FASTMUTEX"

autoreconf -fi
%configure \
    --with-mysql-libs=%{_libdir}/mysql \
    --with-mysql-includes=%{_includedir}/mysql \
    --with-unixODBC=%{_prefix} \
    --with-odbc-ini=%{_sysconfdir}/%{manager}/odbc.ini \
    --disable-gui --disable-test

make %{?_smp_mflags}

%install
make "DESTDIR=%{buildroot}" install

# documentation
install -d -m 755 %{buildroot}/%{_defaultdocdir}/%{name}/
install -m 644 {ChangeLog,README,README.debug,INSTALL,LICENSE.gpl} %{buildroot}/%{_defaultdocdir}/%{name}/
rm %{buildroot}/%{_datadir}/mysql-connector-odbc/{ChangeLog,README,README.debug,INSTALL,LICENSE.gpl}

# samples
mkdir %{buildroot}/%{_defaultdocdir}/%{name}/ini/
sed -e 's/@driverpath@/\/usr\/%{_lib}\/%{manager}/g' -e 's/@version@/%{version}/g' %{SOURCE1} >%{buildroot}/%{_defaultdocdir}/%{name}/ini/odbcinst.ini.sample
sed -e 's/@driverpath@/\/usr\/%{_lib}\/%{manager}/g' -e 's/@version@/%{version}/g' %{SOURCE2} >%{buildroot}/%{_defaultdocdir}/%{name}/ini/odbc.ini.sample
install -m 644 %{SOURCE3} %{buildroot}/%{_defaultdocdir}/%{name}/ini/

# remove .la files
rm %{buildroot}/%{_libdir}/*.la

%files
%defattr(-,root,root)
%doc %{_defaultdocdir}/%{name}/
%{_bindir}/myodbc-installer
%{_libdir}/lib*so

%changelog
openSUSE Build Service is sponsored by