Sophie

Sophie

distrib > Mandriva > 10.2 > x86_64 > by-pkgid > 53170f469c05bcd90ca673505441d7cc > files > 5

MyODBC-3.51.10-1mdk.src.rpm

%define	name	MyODBC
%define	version	3.51.10
%define	release	1mdk

%define	major	1
%define libname	%mklibname myodbc %{major}

Summary:	ODBC driver for MySQL
Name:		%{name}
Version:	%{version}
Release:	%{release}
License:	Public Domain
Group:		System/Libraries
URL:		http://www.mysql.com/downloads/api-myodbc.html
Source0:	http://ftp.sunet.se/pub/unix/databases/relational/mysql/Downloads/MyODBC3/MyODBC-%{version}.tar.bz2
Patch0:		MyODBC-3.51.10-libname.diff.bz2
Patch1:		MyODBC-3.51.10-bigger_attributes_length_buffer.diff.bz2
Patch2:		MyODBC-3.51.10-bogus_locale.diff.bz2
Requires:	unixODBC
Requires:	usermode-consoleonly
Requires:	%{libname} = %{version}
BuildRequires:	MySQL-devel
BuildRequires:	unixODBC-devel
BuildRequires:	openssl-devel
BuildRequires:	automake1.7
BuildRequires:	autoconf2.5
BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root

%description
An ODBC driver for MySQL, for use with unixODBC.

%package -n	%{libname}
Summary:	ODBC driver for MySQL
Group:		System/Libraries 
 
%description -n	%{libname}
An ODBC driver for MySQL, for use with unixODBC.

%package -n	%{libname}-devel
Summary:	Development library for ODBC driver for MySQL
Group:		Development/C
Provides:	lib%{name}-devel %{name}-devel libmyodbc-devel
Obsoletes:	lib%{name}-devel %{name}-devel libmyodbc-devel
Requires:	%{libname} = %{version}

%description -n	%{libname}-devel
An ODBC driver for MySQL, for use with unixODBC.

%prep

%setup -q
%patch0 -p1
%patch1 -p0
%patch2 -p1

# lib64 fixes
find -type f -name "*.c*" -o -type f -name "*.h" | xargs perl -pi -e "s|/usr/lib|%{_libdir}|g"

# not so pretty dlname fix, but..., it works, so what more do you want?
find -type f -name "*.c*" -o -type f -name "*.h" | xargs perl -pi -e "s|libmyodbc3\.so|libmyodbc3\.so\.%{major}|g"
find -type f -name "*.c*" -o -type f -name "*.h" | xargs perl -pi -e "s|libmyodbc3S\.so|libmyodbc3S\.so\.%{major}|g"
find -type f -name "*.c*" -o -type f -name "*.h" | xargs perl -pi -e "s|libmyodbc3_r\.so|libmyodbc3_r\.so\.%{major}|g"

%build
export WANT_AUTOCONF_2_5=1
rm -f ./configure
libtoolize --copy --force && aclocal-1.7 && autoconf && automake-1.7 --foreign

%configure2_5x \
    --enable-shared \
    --enable-static \
    --enable-thread-safe \
    --enable-myodbcinst \
    --enable-imyodbc \
    --with-mysql-path=%{_prefix} \
    --with-unixODBC=%{_prefix} \
    --with-unixODBC-includes=%{_includedir} \
    --with-unixODBC-libs=%{_libdir} \
    --with-odbc-ini==%{_sysconfdir}/odbc.ini

%make

pushd setup
    qmake setup.pro -o Makefile.qt
    %make -f Makefile.qt
popd

pushd MYODBCConfig
    qmake MYODBCConfig.pro -o Makefile.qt
    %make -f Makefile.qt
popd

%install
[ "%{buildroot}" != "/" ] && rm -rf %{buildroot}

%makeinstall_std

# it's missing its soname, fix this later
install -m0755 setup/libmyodbc3S.so %{buildroot}%{_libdir}/libmyodbc3S.so.%{major}

# install it as just "MyODBC"
install -m0755 MYODBCConfig/MYODBCConfig %{buildroot}%{_bindir}/MyODBC

# Menu entries
install -d %{buildroot}%{_menudir}

# setup links for consolehelpper support to allow root System DSN config
install -d %{buildroot}%{_sbindir}
pushd %{buildroot}%{_bindir}
ln -sf consolehelper MyODBC-root
cd %{buildroot}%{_sbindir}
ln -s ../bin/MyODBC MyODBC-root
popd

# MYODBCConfig
cat << EOF > %{buildroot}%{_menudir}/MyODBC
?package(%{name}): \
needs="x11" \
section="Applications/Databases" \
longtitle="MyODBC Configuration" \
title="MyODBC" \
icon="databases_section.png" \
command="MyODBC"

?package(%{name}): \
needs="x11" \
section="Applications/Databases" \
longtitle="MyODBC Configuration (root user)" \
title="MyODBC Configuration (root user)" \
icon="databases_section.png" \
command="MyODBC-root"
EOF

%post
%{update_menus}

%postun
%{clean_menus}

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

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

%clean
[ "%{buildroot}" != "/" ] && rm -rf %{buildroot}

%files
%defattr(-,root,root)
%doc COPYING ChangeLog EXCEPTIONS README README.unix
%{_bindir}/imyodbc
%{_bindir}/myodbcinst
%{_bindir}/MyODBC*
%{_sbindir}/MyODBC*
%{_menudir}/MyODBC

%files -n %{libname}
%defattr(-,root,root)
%{_libdir}/*.so.*

%files -n %{libname}-devel
%defattr(-,root,root)
%{_libdir}/*.so
%{_libdir}/*.a
%{_libdir}/*.la

%changelog
* Mon Mar 07 2005 Oden Eriksson <oeriksson@mandrakesoft.com> 3.51.10-1mdk
- 3.51.10
- added P0,P1
- added P2 (fedora)
- lib64 fixes
- built all the binaries too, even the QT ones...
- ripped the menu magic from the unixODBC package
- misc spec file fixes

* Wed Apr 14 2004 Michael Scherer <misc@mandrake.org> 2.50.39-2mdk 
- rebuild

* Fri Nov 29 2002 Warly <warly@mandrakesoft.com> 2.50.39-1mdk
- first mandrake package, on holm@theorie.physik.uni-goettingen.de request

* Fri Jun 21 2002 Tim Powers <timp@redhat.com>
- automated rebuild

* Thu May 23 2002 Tim Powers <timp@redhat.com>
- automated rebuild

* Mon May 13 2002 Trond Eivind Glomsrød <teg@redhat.com> 2.50.39-5
- Don't do automake tricks - just do a libtoolize
- Don't use %%configure

* Wed Feb 27 2002 Trond Eivind Glomsrød <teg@redhat.com> 2.50.39-4
- Rebuild

* Thu Jan 24 2002 Trond Eivind Glomsrød <teg@redhat.com> 2.50.39-3
- Rebuild
- libtoolize, autoreconf
- specify unixODBC prefix as "/var/tmp" (which exists, but isn't used).
  If you specify /usr, gcc will complain about a system path being
  listed (and thus configure will fail) if you don't, autoconf will
  think the prefix is "yes" and do a "-Lyes/lib". POC.


* Mon Oct  1 2001 Trond Eivind Glomsrød <teg@redhat.com> 2.50.39-1
- 2.50.39

* Fri Jul 13 2001 Trond Eivind Glomsrød <teg@redhat.com>
- move requirement of unixODBC-devel from runtime to buildtime

* Tue Apr 24 2001 Trond Eivind Glomsrød <teg@redhat.com>
- Initial build.