[freetds] Building RPM

Frediano Ziglio freddyz77 at tin.it
Sun Aug 6 06:48:58 EDT 2006


Il giorno dom, 06/08/2006 alle 04.03 -0400, Ciro Iriarte ha scritto:
> Hi, i'm currently trying to build an rpm for SuSE (SLES9) using the supplied 
> spec file, i have the same problem with v0.64 and v0.65.20060805
> 
> Executing(%doc): /bin/sh -e /var/tmp/rpm-tmp.70453
> + umask 022
> + cd /usr/src/packages/BUILD
> + cd freetds-0.64
> + DOCDIR=/var/tmp/freetds-buildroot/usr/share/doc/packages/freetds-doc
> + export DOCDIR
> + rm -rf /var/tmp/freetds-buildroot/usr/share/doc/packages/freetds-doc
> + /bin/mkdir -p 
> /var/tmp/freetds-buildroot/usr/share/doc/packages/freetds-doc
> + cp -pr doc/doc/freetds-0.64/userguide doc/images 
> doc/doc/freetds-0.64/reference 
> /var/tmp/freetds-buildroot/usr/share/doc/packages/freetds-doc
> + exit 0
> Finding  Provides: /usr/lib/rpm/find-provides
> Finding  Requires: /usr/lib/rpm/find-requires
> Requires(rpmlib): rpmlib(PayloadFilesHavePrefix) <= 4.0-1 
> rpmlib(CompressedFileNames) <= 3.0.4-1
> Checking for unpackaged file(s): /usr/lib/rpm/check-files 
> /var/tmp/freetds-buildroot
> error: Installed (but unpackaged) file(s) found:
>    /usr/share/doc/freetds-0.64/images/important.gif
>    /usr/share/doc/freetds-0.64/images/note.gif
>    /usr/share/doc/freetds-0.64/images/tip.gif
>    /usr/share/doc/freetds-0.64/reference/a00069.html
>    /usr/share/doc/freetds-0.64/reference/a00080.html
>    /usr/share/doc/freetds-0.64/reference/a00086.html
>    /usr/share/doc/freetds-0.64/reference/a00087.html
>    /usr/share/doc/freetds-0.64/reference/a00088.html
>    /usr/share/doc/freetds-0.64/reference/a00090.html
>    /usr/share/doc/freetds-0.64/reference/a00092.html
>    /usr/share/doc/freetds-0.64/reference/a00121.html
>    .....
>    ....
>    ....
> 
> And i end with dupplicated docs, anybody could build an rpm?
> 
> linux:/var/tmp/freetds-buildroot/usr/share/doc #.
> |-- freetds-0.64 <-- shouldn't exist
> |   |-- images
> |   |-- reference
> |   `-- userguide
> `-- packages
>     |-- freetds
>     |   |-- AUTHORS
>     |   |-- BUGS
>     |   |-- COPYING
>     |   |-- COPYING.LIB
>     |   |-- ChangeLog
>     |   |-- INSTALL
>     |   |-- NEWS
>     |   |-- README
>     |   `-- TODO
>     `-- freetds-doc
>         |-- images
>         |-- reference
>         `-- userguide
> 
> I need to build rpm files instead of using manual compiles because i need to 
> install it in many systems (easy restore too)
> 
> Thanks in advanced.
> Ciro Iriarte 
> 

Try with this patch, you should compile with

rpmbuild -ba freetds.spec

and you should put freetds-0.64.tar.gz in your source rpm
(/usr/src/redhat/SOURCES/ by default on redhat I don't know for suse but
it should be in rpm-build package even for suse).

It just change _docdir in freetds.spec to _datadir. A different way to
make the change is:

- unpackage freetds-0.64.tar.gz
$ tar zxvf freetds-0.64.tar.gz
- edit freetds.spec.in and replace _docdir with _datadir
$ cd freetds-0.64
$ perl -pi.orig -e 's/_docdir/_datadir/' freetds.spec.in
- package again freetds-0.64.tar.gz
$ cd ..
$ rm freetds-0.64.tar.gz
$ tar zcvf freetds-0.64.tar.gz freetds-0.64
- rebuild
$ rpmbuild -ta freetds-0.64.tar.gz

freddy77

-------------- next part --------------
%define	name	freetds
%define	version	0.64

# compute some additional dependency from vendor name
# 

# RedHat
%define tds_builddep_redhat unixODBC-devel >= 2.0.0
%define tds_dep_suse glibc-locale

# SUSE
%define tds_builddep_suse unixODBC-devel >= 2.0.0

%undefine tds_builddep
%{expand:%%{expand:%%{?tds_builddep_%{?_vendor}:%%%%define tds_builddep %%{?tds_builddep_%{?_vendor}}}}}
%undefine tds_dep
%{expand:%%{expand:%%{?tds_dep_%{?_vendor}:%%%%define tds_dep %%{?tds_dep_%{?_vendor}}}}}
 
Name: %{name} 
Version: %{version} 
Release: 1 
Vendor: www.freetds.org 
License: LGPL 
Group: System Environment/Libraries 
Source: http://ibiblio.org/pub/Linux/ALPHA/freetds/stable/%{name}-%{version}.tar.gz 
BuildRoot: %{_tmppath}/%{name}-buildroot
%{?tds_builddep:BuildRequires: %{tds_builddep}}
%{?tds_dep:Requires: %tds_dep}
Summary: FreeTDS is a free re-implementation of the TDS (Tabular DataStream) protocol that is used by Sybase and Microsoft for their database products. 
 
%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 unixodbc
Group: System Environment/Libraries
Summary: FreeTDS ODBC Driver for unixODBC
Requires: unixODBC >= 2.0.0
%{?tds_dep:Requires: %tds_dep}

%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 unixodbc
The freetds-unixodbc 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 
%configure --with-tdsver=4.2 --with-unixodbc=/usr/local
make RPM_OPT_FLAGS="$RPM_OPT_FLAGS"
 
%install 
rm -rf "$RPM_BUILD_ROOT"
make DESTDIR="$RPM_BUILD_ROOT" install
rm -rf "$RPM_BUILD_ROOT/%{_datadir}/freetds-%{version}"

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

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

%post unixodbc
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 unixodbc
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.*
%{_libdir}/libtds.so.*
%{_libdir}/libtdssrv.so.*
%config %{_sysconfdir}/*
 
%files devel 
%defattr (-,root,root) 
%{_libdir}/*.a
%{_libdir}/*.la
%{_libdir}/*.so
%{_includedir}/*

%files unixodbc
%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 
* Thu Sep 09 2004 Frediano Ziglio <freddy77 at angelfire.com>
- remove dependency from freetds-unixodbc
- fix field name (Copyright instead of License)
- updated URL

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

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

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

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

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

* Wed Feb 14 2001 David Hollis <dhollis at emagisoft.com> 
- First stab at RPM for 0.51 ver 


More information about the FreeTDS mailing list