Sophie

Sophie

distrib > Mandriva > 2006.0 > x86_64 > by-pkgid > 45d4038a4909f904e6c8eea9df2ca597 > files > 2

foomatic-db-engine-3.0.2-1.20050823.1mdk.src.rpm

%define version 3.0.2
%define releasedate 20050823
%define release 1.%{releasedate}.1mdk

%define debug 0

##### RPM PROBLEM WORKAROUNDS

# Suppress automatically generated Requires for Perl libraries.
#define _requires_exceptions perl\(.*\)
  
#define _unpackaged_files_terminate_build       0 
#define _missing_doc_files_terminate_build      0

##### GENERAL DEFINITIONS

Name:		foomatic-db-engine
Version:	%{version}
Release:	%{release}
Summary:        Foomatic database access, printer admin, and printing utils
License:        GPL
Group:          System/Servers
Url:            http://www.linuxprinting.org/
Requires:       foomatic-filters >= 3.0.2-1.20050816.1mdk perl-base >= 2:5.8.7

BuildRequires:	autoconf2.5 automake
BuildRequires:	perl-devel, file, libxml2-devel

##### FOOMATIC SOURCES

Source:		http://www.linuxprinting.org/download/foomatic/foomatic-db-engine-%{version}-%{releasedate}.tar.bz2

##### BUILD ROOT

BuildRoot:	%_tmppath/%name-%version-%release-root

##### PACKAGE DESCRIPTIONS

%description
Foomatic is a comprehensive, spooler-independent database of printers,
printer drivers, and driver descriptions. It contains utilities to
generate PPD (Postscript Printer Description) files and printer queues
for CUPS, LPD, GNUlpr, LPRng, PPR, and PDQ using the database. There
is also the possibility to read the PJL options out of PJL-capable
laser printers and take them into account at the driver description
file generation.

There are spooler-independent command line interfaces to manipulate
queues (foomatic-configure) and to print files/manipulate jobs
(foomatic printjob).
 
The site http://www.linuxprinting.org/ is based on this database.

This package contains the tools for accessing the Foomatic database,
for printer administration, and for printing.




%prep
# remove old directory
rm -rf $RPM_BUILD_DIR/%{name}-%{version}-*

##### FOOMATIC

# Source trees for installation
%setup -q -n %{name}-%{version}-%{releasedate}



%build

# Change compiler flags for debugging when in debug mode
%if %debug
export DONT_STRIP=1
export CFLAGS="`echo %optflags |sed -e 's/-O3/-g/' |sed -e 's/-O2/-g/'`"
export CXXFLAGS="`echo %optflags |sed -e 's/-O3/-g/' |sed -e 's/-O2/-g/'`"
export RPM_OPT_FLAGS="`echo %optflags |sed -e 's/-O3/-g/' |sed -e 's/-O2/-g/'`"
%endif


# Makefile generation ("./make_configure" for CVS snapshots)
./make_configure
# Fix for lib64 architectures, avoid patch
perl -pi -e "s@/usr/lib/(cups|pdq|ppr)@%{_libdir}/\1@g" configure
%configure

# Fix for new library "make install" behaviour of Perl 5.8.1.
perl -p -i -e 's/PREFIX=\$\(DESTDIR\)\$\(PERLPREFIX\)/PREFIX=\$\(PERLPREFIX\)/' Makefile

# Final build of Foomatic package
# Use the real file names of the printing utilities to be independent of the
# update-alternatives configuration

# Do not use "make" macro, as parallelized build of Foomatic does not
# work.

make	LPD_LPR=/usr/bin/lpr-lpd \
        LPD_LPQ=/usr/bin/lpq-lpd \
        LPD_LPRM=/usr/bin/lprm-lpd \
        LPD_LPC=/usr/sbin/lpc-lpd \
        CUPS_LPR=/usr/bin/lpr-cups \
        CUPS_LPQ=/usr/bin/lpq-cups \
        CUPS_LPRM=/usr/bin/lprm-cups \
        CUPS_LPC=/usr/sbin/lpc-cups \
        CUPS_LP=/usr/bin/lp-cups \
        CUPS_CANCEL=/usr/bin/cancel-cups \
        CUPS_LPSTAT=/usr/bin/lpstat-cups \
        PDQ_PRINTRC=/etc/pdq/printrc \
        PREFIX=%{_prefix} \
        PERL_INSTALLDIRS=vendor \
        DESTDIR=%buildroot

chmod a+rx mkinstalldirs



%install

rm -rf %{buildroot}

# Change compiler flags for debugging when in debug mode
%if %debug
export DONT_STRIP=1
export CFLAGS="`echo %optflags |sed -e 's/-O3/-g/' |sed -e 's/-O2/-g/'`"
export CXXFLAGS="`echo %optflags |sed -e 's/-O3/-g/' |sed -e 's/-O2/-g/'`"
export RPM_OPT_FLAGS="`echo %optflags |sed -e 's/-O3/-g/' |sed -e 's/-O2/-g/'`"
%endif


# Make directories
install -d %{buildroot}%{_bindir}
install -d %{buildroot}%{_libdir}
install -d %{buildroot}%{_sysconfdir}
install -d %{buildroot}%{_mandir}/man1
install -d %{buildroot}%{_mandir}/man8

##### FOOMATIC

# Install program files
eval `perl '-V:installsitelib'`
mkdir -p %{buildroot}/$installsitelib
export INSTALLSITELIB=%{buildroot}/$installsitelib
make	PREFIX=%{_prefix} \
        DESTDIR=%buildroot \
        INSTALLSITELIB=%{buildroot}/$installsitelib \
        install

# Install documentation
install -d %buildroot%{_docdir}/foomatic-db-engine-%{version}
cp README USAGE TODO ChangeLog Foomatic-Devel-Ideas.txt\
	%buildroot%{_docdir}/foomatic-db-engine-%{version}

# Use update-alternatives to make "foomatic-printjob" also possible through
# the usual printing commands
 
( cd %{buildroot}%{_bindir}
  ln -s foomatic-printjob lpr-foomatic
  ln -s foomatic-printjob lpq-foomatic
  ln -s foomatic-printjob lprm-foomatic
)
( cd %{buildroot}%{_sbindir}
  ln -s %{_bindir}/foomatic-printjob lpc-foomatic
)


# Correct permissions
chmod -R a+rX %{buildroot}%{_docdir}
chmod -R a-X %{buildroot}%{_docdir}/*/*
chmod -R go-w %{buildroot}%{_docdir}
chmod -R u+w %{buildroot}%{_docdir}
chmod -R a-X %{buildroot}%{perl_vendorlib}/Foomatic/*.pm



##### FILES

%files
%defattr(-,root,root)
%docdir %{_docdir}/%{name}-%{version}
%{_docdir}/%{name}-%{version}
%_bindir/*
%_sbindir/*
%perl_vendorlib/Foomatic
%_datadir/foomatic/templates
%{_mandir}/man*/*


%post -n foomatic-db-engine
# Set up update-alternatives entries
%{_sbindir}/update-alternatives --install %{_bindir}/lpr lpr %{_bindir}/lpr-foomatic 1
%{_sbindir}/update-alternatives --install %{_bindir}/lpq lpq %{_bindir}/lpq-foomatic 1
%{_sbindir}/update-alternatives --install %{_bindir}/lprm lprm %{_bindir}/lprm-foomatic 1
%{_sbindir}/update-alternatives --install %{_sbindir}/lpc lpc %{_sbindir}/lpc-foomatic 1


%preun -n foomatic-db-engine
if [ "$1" -eq "0" ]; then
  # On removal
  # Remove update-alternatives entries
  %{_sbindir}/update-alternatives --remove lpr /usr/bin/lpr-foomatic
  %{_sbindir}/update-alternatives --remove lpq /usr/bin/lpq-foomatic
  %{_sbindir}/update-alternatives --remove lprm /usr/bin/lprm-foomatic
  %{_sbindir}/update-alternatives --remove lpc /usr/sbin/lpc-foomatic
fi


%clean
rm -rf %{buildroot}

%changelog
* Tue Aug 23 2005 Till Kamppeter <till@mandriva.com> 3.0.2-1.20050823.1mdk
- Updated foomatic-db-engine to the state of the 23/08/2005 (Output of
  "foomatic-configure -O" now also contains the links to the available
  ready-made PPDs).

* Mon Aug 15 2005 Till Kamppeter <till@mandriva.com> 3.0.2-1.20050816.1mdk
- Updated foomatic-db-engine to the state of the 16/08/2005 (Support for
  the new "beh" CUPS backend in foomatic-filters).

* Tue Aug  2 2005 Till Kamppeter <till@mandriva.com> 3.0.2-1.20050802.1mdk
- Updated foomatic-db-engine to the state of the 02/08/2005 (Fixed Adobe
  link in README file).

* Sun May 29 2005 Till Kamppeter <till@mandrakesoft.com> 3.0.2-1.20050530.1mdk
- Updated foomatic-db-engine to the state of the 30/05/2005 (Added support
  for PPD file names with spaces, bug 16172).

* Thu May 19 2005 Rafael Garcia-Suarez <rgarciasuarez@mandriva.com> 3.0.2-1.20050224.5mdk
- Don't require a specific version of perl-base, to make upgrades possible

* Wed Feb 23 2005 Till Kamppeter <till@mandrakesoft.com> 3.0.2-1.20050224.4mdk
- Rebuild as previous build was messed up.

* Wed Feb 23 2005 Till Kamppeter <till@mandrakesoft.com> 3.0.2-1.20050224.3mdk
- Updated foomatic-db-engine to the state of the 28/01/2005 (Bug fixes on
  modifying print queues with non-Foomatic PPD files).

* Tue Feb  1 2005 Till Kamppeter <till@mandrakesoft.com> 3.0.2-1.20050128.3mdk
- Added versioned requirement of perl-base.

* Fri Jan 28 2005 Till Kamppeter <till@mandrakesoft.com> 3.0.2-1.20050128.2mdk
- Let previous build directory be deleted when building this RPM.
- Include "foomatic-cleanupdrivers".

* Fri Jan 28 2005 Till Kamppeter <till@mandrakesoft.com> 3.0.2-1.20050128.1mdk
- Updated foomatic-db-engine to the state of the 28/01/2005.