SHA256
1
0
forked from pool/freetds
freetds/freetds.spec

129 lines
3.3 KiB
RPMSpec
Raw Normal View History

Name: freetds
Version: 0.9.1rc2
%define dirver 0.91.dev.20110715RC2
%define filever 0.91rc
Release: 10
License: LGPL
URL: http://www.freetds.org/
Group: Productivity/Databases/Clients
Source: %{name}-%{filever}.tar.bz2
BuildRoot: %{_tmppath}/%{name}-%(version)-buildroot
Summary: A free re-implementation of the TDS (Tabular DataStream) protocol
BuildRequires: unixODBC-devel unixODBC gcc-c++ fdupes
%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/C and C++
Summary: Include files needed for development with FreeTDS
Requires: freetds = %{version}
%description devel
The freetds-devel package contains the files necessary for development with
the FreeTDS libraries.
%package -n libtdsodbc0
Group: Productivity/Databases/Clients
Summary: FreeTDS ODBC Driver for unixODBC
Requires: unixODBC >= 2.0.0
%description -n libtdsodbc0
The freetds-unixodbc package contains ODBC driver build for unixODBC.
%package doc
Group: Productivity/Databases/Clients
Summary: User documentation for FreeTDS
%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 -n %{name}-%{dirver}
%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
autoreconf --force --install
%configure \
--prefix=/usr \
--with-unixodbc="$ODBCDIR" \
--enable-threadsafe \
--sysconfdir=%{_sysconfdir} \
--with-tdsver=4.2 \
--with-docdir=%{_docdir}/freetds \
--disable-static \
--with-pic
make %{?_smp_flags} RPM_OPT_FLAGS="$RPM_OPT_FLAGS"
%install
%make_install
mkdir -p %{buildroot}%{_docdir}/freetds/
mv %{buildroot}/usr/share/doc/freetds-*/* %{buildroot}%{_docdir}/freetds/
rm -rf %{buildroot}%{_docdir}/freetds-* %{buildroot}/%{_datadir}/doc/freetds-*
%fdupes %{buildroot}/%{_docdir}/freetds/userguide
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%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
/sbin/ldconfig 2> /dev/null
%postun -n libtdsodbc0
/sbin/ldconfig 2> /dev/null
%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 %{buildroot}
%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)
%exclude %{_libdir}/*.la
%{_libdir}/*.so
%{_includedir}/*
%files -n libtdsodbc0
%defattr(-,root,root)
%{_libdir}/libtdsodbc.so.*
%files doc
%defattr (-,root,root)
/usr/share/doc/packages/freetds/
%changelog