--- unixODBC.spec.nodsc 2012-06-06 10:17:10.752568671 +0200 +++ unixODBC.spec 2012-06-06 10:24:35.395122156 +0200 @@ -1,5 +1,8 @@ +%{?scl:%scl_package unixODBC} +%{!?scl:%global pkg_name unixODBC} + Summary: A complete ODBC driver manager for Linux -Name: unixODBC +Name: %{?scl_prefix}unixODBC Version: 2.3.1 Release: 1%{?dist} Group: System Environment/Libraries @@ -7,7 +10,7 @@ URL: http://www.unixODBC.org/ # Programs are GPL, libraries are LGPL, except News Server library is GPL. License: GPLv2+ and LGPLv2+ -Source: http://www.unixODBC.org/%{name}-%{version}.tar.gz +Source: http://www.unixODBC.org/%{pkg_name}-%{version}.tar.gz Source1: odbcinst.ini Source4: conffile.h Source5: README.fedora @@ -17,12 +20,12 @@ Patch6: export-symbols.patch Patch8: so-version-bump.patch Patch9: keep-typedefs.patch -Conflicts: iodbc +Conflicts: %{?scl_prefix}iodbc BuildRequires: automake autoconf libtool libtool-ltdl-devel bison flex BuildRequires: readline-devel -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root +%{?scl:Requires:%scl_runtime} %description Install unixODBC if you want to access databases through ODBC. @@ -40,7 +43,7 @@ drivers. If you want to develop programs ODBC, you need to install this package. %prep -%setup -q +%setup -q %{?scl:-n %{pkg_name}-%{version}} %patch1 -p1 %patch6 -p1 %patch8 -p1 @@ -75,10 +78,34 @@ export CFLAGS CXXFLAGS make all %install -rm -rf $RPM_BUILD_ROOT - make DESTDIR=$RPM_BUILD_ROOT install -install -m644 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir} + +# we need to pass right path prefix to libraries in odbcinst.ini, +# the easiest way how to achieve this is to generate the file here +cat > $RPM_BUILD_ROOT%{_sysconfdir}/odbcinst.ini << EOF +# Example driver definitions + +# Driver from the postgresql-odbc package +# Setup from the unixODBC package +[PostgreSQL] +Description = ODBC for PostgreSQL +Driver = %{_prefix}/lib/psqlodbc.so +Setup = %{_prefix}/lib/libodbcpsqlS.so +Driver64 = %{_prefix}/lib64/psqlodbc.so +Setup64 = %{_prefix}/lib64/libodbcpsqlS.so +FileUsage = 1 + + +# Driver from the mysql-connector-odbc package +# Setup from the unixODBC package +[MySQL] +Description = ODBC for MySQL +Driver = %{_prefix}/lib/libmyodbc5.so +Setup = %{_prefix}/lib/libodbcmyS.so +Driver64 = %{_prefix}/lib64/libmyodbc5.so +Setup64 = %{_prefix}/lib64/libodbcmyS.so +FileUsage = 1 +EOF # multilib header hacks # we only apply this to known Red Hat multilib arches, per bug #181335 @@ -127,9 +154,6 @@ do mv -f devel-so-list.x devel-so-list done -%clean -rm -rf $RPM_BUILD_ROOT - %files -f base-so-list %defattr(-,root,root) %doc README COPYING AUTHORS ChangeLog NEWS doc