File freetds.spec of Package freetds

%define realname freetds
%define realver  0.91
%define srcext   tar.bz2

%if %(getconf LONG_BIT) == 64
%define libsuffix 64
%else
%undef  libsuffix
%endif

# Common info
Name:          %{realname}
Version:       %{realver}
Release:       wiz%{?extraver:0.}1
License:       LGPL
Group:         Productivity/Databases/Tools
URL:           http://www.freetds.org/
Summary:       Free implementation of Sybase's db-lib, ct-lib, and ODBC libraries

# Install-time parameters
Provides:      libfreetds5 libfreetds

# Build-time parameters
BuildRequires: krb5-devel unixODBC-devel openssl-devel
BuildRoot:     %{_tmppath}/%{name}-root
Source:        http://www.ibiblio.org/pub/Linux/ALPHA/freetds/stable/%{realname}-%{realver}%{?extraver}.%{srcext}

%description
FreeTDS is a set of libraries for Unix and Linux that allows your programs
to natively talk to Microsoft SQL Server and Sybase databases.

Technically speaking, FreeTDS is an open source implementation
of the TDS (Tabular Data Stream) protocol used by these databases
for their own clients. It supports many different flavors of the protocol
and three APIs to access it. Additionally FreeTDS works with other software
such as Perl and PHP, providing access from those languages as well.

%package devel
Group:         Development/Languages/C and C++
Summary:       Development files for %{name}
Requires:      %{name} = %{version}
Provides:      libfreetds-devel

%description devel
Development files for %{name}

# Preparation step (unpackung and patching if necessary)
%prep
%setup -q -n %{name}-%{version}

%build
%configure \
 --docdir=%{_defaultdocdir}/%{name} \
 --disable-static \
 --enable-krb5 \
 --enable-sspi \
 --with-tdsver=7.1 \
 --with-openssl \
 LDFLAGS="-Wl,--as-needed -Wl,--strip-all"
%__make %{?_smp_mflags}

%install
%__make install DESTDIR=%{buildroot} \
 TARGET_DOCDIR=%{buildroot}%{_defaultdocdir}/%{name}

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

%files
%defattr(-,root,root)
%doc AUTHORS COPYING* NEWS README doc/*.txt
%if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos_version} || 0%{?scientificlinux_version}
%docdir %{_defaultdocdir}/%{name}/
%{_defaultdocdir}/%{name}/*
%endif
%config(noreplace) %{_sysconfdir}/*.conf
%{_bindir}/*
%{_libdir}/*.so.*
%exclude %{_libdir}/*.la
%doc %{_mandir}/man1/*
%doc %{_mandir}/man5/*

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

%post
/sbin/ldconfig
# odbcinst uses reference counting, so we don't
# need to take care for the update case here.
odbcinst -i -l -d %{_libdir}/libtdsodbc.so.0 -r <<EOF
[FreeTDS]
Description = Driver for Microsoft SQL Server and Sybase databases
Driver%{libsuffix} = %{_libdir}/libtdsodbc.so.0
EOF

%postun
/sbin/ldconfig
# odbcinst uses reference counting, so we don't
# need to take care for the update case here.
odbcinst -u -l -d %{_libdir}/libtdsodbc.so.0 -n FreeTDS

%changelog

%changelog devel
openSUSE Build Service is sponsored by