File freetds.spec of Package freetds

%define	name	freetds
%define	version	0.91.90
 
Name:		%{name} 
Version:	%{version} 
Release:	3.1

License:	LGPL 
URL:		http://www.freetds.org/
Group:		System Environment/Libraries 
Source:		%{name}-%{version}.tar.bz2
BuildRoot:	%{_tmppath}/%{name}-buildroot 
Summary:	FreeTDS is a free re-implementation of the TDS (Tabular DataStream) protocol

BuildRequires:	unixODBC-devel unixODBC 
%if 0%{?suse_version}
Requires:	glibc-locale
%endif

%description 
FreeTDS is a project to document and implement the TDS (Tabular DataStream) 
protocol. TDS is used by Sybase and Microsoft for client to database server 
communications. FreeTDS includes call level interfaces for DB-Lib, CT-Lib, 
and ODBC.  


%package	devel 
Group:		Development/Libraries 
Summary:	Include files needed for development with FreeTDS 
Requires:	freetds = %{version}

%package	 -n libtdsodbc0
Group:		System Environment/Libraries
Summary:	FreeTDS ODBC Driver for unixODBC
Requires:	unixODBC >= 2.0.0

%package	doc
Group:		Documentation
Summary:	User documentation for FreeTDS
 
%description devel
The freetds-devel package contains the files necessary for development with 
the FreeTDS libraries. 

%description  -n libtdsodbc0
The libtdsodbc0 package contains ODBC driver build for unixODBC.

%description doc
The freetds-doc package contains the useguide and reference of FreeTDS 
and can be installed even if FreeTDS main package is not installed

%prep
%setup 
 
%build
ODBCDIR=`odbc_config --prefix || true`
if test ! -r "$ODBCDIR/include/sql.h"; then
	ODBCDIR=/usr/local
fi
if test ! -r "$ODBCDIR/include/sql.h"; then
	ODBCDIR=/usr
fi
%if 0%{?suse_version} < 1110
# autoreconf --force --install
%endif
%configure						\
	--prefix=/usr					\
	--with-unixodbc="$ODBCDIR"			\
	--enable-threadsafe				\
	--sysconfdir=%{_sysconfdir}			\
	--with-tdsver=4.2				\
	--with-docdir=/usr/share/doc/packages/freetds	
make RPM_OPT_FLAGS="$RPM_OPT_FLAGS"
 
%install 
rm -rf "$RPM_BUILD_ROOT"
mkdir %buildroot
make DESTDIR="$RPM_BUILD_ROOT" install
rm -rf "$RPM_BUILD_ROOT/%{_datadir}/doc/freetds-%{version}"

%post 
/sbin/ldconfig 2> /dev/null

%postun
/sbin/ldconfig 2> /dev/null

%post  -n libtdsodbc0
echo "[FreeTDS]
Description = FreeTDS unixODBC Driver
Driver = %{_libdir}/libtdsodbc.so.0
Setup = %{_libdir}/libtdsodbc.so.0" | odbcinst -i -d -r > /dev/null 2>&1 || true
echo "[SQL Server]
Description = FreeTDS unixODBC Driver
Driver = %{_libdir}/libtdsodbc.so.0
Setup = %{_libdir}/libtdsodbc.so.0" | odbcinst -i -d -r > /dev/null 2>&1 || true

%preun  -n libtdsodbc0
odbcinst -u -d -n 'FreeTDS' > /dev/null 2>&1 || true
odbcinst -u -d -n 'SQL Server' > /dev/null 2>&1 || true

%clean 
rm -rf $RPM_BUILD_ROOT 
 
%files 
%defattr(-,root,root) 
%doc AUTHORS BUGS COPYING* ChangeLog INSTALL NEWS README TODO 
%{_bindir}/*
%{_mandir}/man?/*
%{_libdir}/libct.so.*
%{_libdir}/libsybdb.so.*
%config %{_sysconfdir}/*
 
%files devel 
%defattr (-,root,root) 
%{_libdir}/*.a
%{_libdir}/*.la
%{_libdir}/*.so
%{_includedir}/*

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

%files doc
%defattr (-,root,root)
%doc doc/doc/freetds-%{version}/userguide doc/images doc/doc/freetds-%{version}/reference
 
%changelog
* Wed Oct 23 2013 holger.manthey@bertelsmann.de
- update to 0.91.90

* Mon Mar 23 2009 holger.manthey@bertelsmann.de
- fixed for buildservice for openSUSE 11.1

* Thu May  8 2008 Matthias Eckermann <mge@arcor.de>
- adopted for openSUSE buildservice

* Wed Mar 28 2007 Frediano Ziglio <freddy77@gmail.com>
- removed libtdssrv

* Thu Sep 09 2004 Frediano Ziglio <freddy77@angelfire.com>
- remove dependency from freetds-libtdsodbc0
- fix field name (Copyright instead of License)
- updated URL

* Sun Mar 30 2003 Frediano Ziglio <freddy77@angelfire.com>
- add reference to doc package

* Wed Feb  5 2003 Ian Grant <Ian.Grant@cl.cam.ac.uk>
- 0.61 tweaked. Added libtdssrv libraries and tools in /usr/bin + man pages

* Sun Dec 30 2002 David Hollis <dhollis@davehollis.com>
- 0.60 tweaked.  Move .a & .la files to -devel package

* Thu Dec 20 2001 Brian Bruns <camber@ais.org> 
- Modifications for 0.53 ver and removing interfaces file

* Wed Jun 28 2001 Brian Bruns <camber@ais.org> 
- Modifications for 0.52 ver and ODBC drivers 

* Wed Feb 14 2001 David Hollis <dhollis@emagisoft.com> 
- First stab at RPM for 0.51 ver 
openSUSE Build Service is sponsored by