File freetds.spec of Package freetds
%define realname freetds
%define realver 1.00.27
%define srcext tar.bz2
%undefine so_ver
%ifarch x86_64
%define libsuffix 64
%endif
# Common info
Name: libfreetds%{?so_ver}
Version: %{realver}
Release: wiz%{?extraver:0.}1%{?dist}
License: LGPL-2.0
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: libfreetds = %{version}-%{release}
# Build-time parameters
BuildRequires: pkgconfig
BuildRequires: krb5-devel
BuildRequires: readline-devel
BuildRequires: unixODBC-devel
BuildRequires: openssl-devel
%if 0%{?suse_version}
BuildRequires: fdupes
BuildRequires: libtool
%else
BuildRequires: libtool-ltdl-devel
%endif
BuildArch: %{_build_arch}
BuildRoot: %{_tmppath}/%{name}-root
Source: ftp://ftp.freetds.org/pub/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 -n %{realname}-tools
Group: Productivity/Databases/Clients
Summary: Tools for TDS protocol
%description -n %{realname}-tools
FreeTDS includes several utilities. Some are testing tools, some demonstration
projects, some intended for day-to-day use. All have man pages.
%package -n %{realname}-devel
Group: Development/Languages/C and C++
Summary: Development files for %{name}
Requires: %{name} = %{version}-%{release}
Provides: %{name}-devel = %{version}-%{release}
%description -n %{realname}-devel
Development files for %{name}
%package -n %{realname}-doc
Group: Documentation/HTML
Summary: TDS Protocol Documentation
BuildArch: noarch
%description -n %{realname}-doc
TDS Protocol Documentation.
# Preparation step (unpackung and patching if necessary)
%prep
%setup -q -n %{realname}-%{realver}
%{__sed} -ri '/exec/ s/INSTALL/INSTALL_DATA/' doc/Makefile.in
%build
%configure \
--sysconfdir=%{_sysconfdir}/%{realname} \
--docdir=%{_defaultdocdir}/%{name} \
--disable-static \
\
--enable-krb5 \
--enable-sybase-compat \
--with-tdsver=7.4 \
CFLAGS="%{optflags} %{?gcc_lto}" \
LDFLAGS="-Wl,--as-needed -Wl,--strip-all %{?gcc_lto}"
%{__make} %{?_smp_mflags}
%install
%{__make} install DESTDIR=%{buildroot} \
TARGET_DOCDIR=%{buildroot}%{_defaultdocdir}/%{name}
%if 0%{?suse_version}
%fdupes %{buildroot}%{_datadir}
%endif
%clean
[ "%{buildroot}" != "/" ] && rm -rf %{buildroot}
%files
%defattr(-,root,root)
%doc AUTHORS COPYING* NEWS README doc/*.txt
%if 0%{?rhel}
%docdir %{_defaultdocdir}/%{name}/
%{_defaultdocdir}/%{name}/*
%endif
%dir %{_sysconfdir}/%{realname}
%config(noreplace) %attr(0644,root,root) %{_sysconfdir}/%{realname}/*.conf
%{_libdir}/*.so.%{?so_ver}*
%exclude %{_libdir}/*.la
%doc %{_mandir}/man5/*
%files -n %{realname}-tools
%doc AUTHORS COPYING* NEWS README doc/*.txt
%{_bindir}/*
%doc %{_mandir}/man1/*
# Development stuff
%files -n %{realname}-devel
%defattr(-,root,root)
%doc AUTHORS COPYING* NEWS README doc/*.txt
%{_includedir}/*.h
%{_libdir}/*.so
# Documentation
%files -n %{realname}-doc
%doc AUTHORS COPYING* NEWS README doc/*.txt
%doc doc/*.html doc/images doc/reference doc/userguide
%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