File m2300w.spec of Package m2300w

#
# spec file for package m2300w
#
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

Name:           m2300w
BuildRequires:  autoconf
# SLE12 needs special BuildRequires.
# For suse_version values see https://en.opensuse.org/openSUSE:Build_Service_cross_distribution_howto
%if 0%{?suse_version} == 1315
# For SLE12 by default CUPS 1.7.5 is provided and alternatively CUPS 1.5.4 is provided in the "legacy" module.
# For SLE12 build it with traditional CUPS 1.5.4 to ensure it works on SLE12 both with CUPS 1.7.5 and CUPS 1.5.4
# because libcups and libcupsimage in CUPS 1.7.5 are backward compatible with CUPS 1.5.4 so that applications
# that have been built with CUPS 1.5.4 also work under CUPS 1.7.5 but the libraries in CUPS 1.7.5 provide
# some additional functions so that applications that have been built with CUPS 1.7.5 and use those
# additional functions would not work under CUPS 1.7.5.
# Only in the Printing project for SLE12 use cups154-ddk (a sub package of the cups154-SLE12 source package):
BuildRequires:  cups154
BuildRequires:  cups154-devel
%else
# Anything what is not SLE12 (i.e. SLE11 and all openSUSE versions) have "normal" BuildRequires:
BuildRequires:  cups
BuildRequires:  cups-devel
%endif
# If Ghostscript is not installed, configure fails with
#  "checking for gs... no
#   This driver requires ghostscript.
#   Please install ghostscript first."
# But ghostscript-mini is sufficient to build it
# but that does not work on SLE11 in OBS that shows
#   unresolvable: conflict for all providers of ghostscript_any needed by cups
#   (provider ghostscript-library is conflicted by installed ghostscript-mini)
#   (provider ghostscript-x11 is conflicted by installed ghostscript-mini)
# so that for SLE11 ghostscript-library is enforced:
%if 0%{?suse_version} == 1110
BuildRequires:  ghostscript-library
%else
BuildRequires:  ghostscript-mini
%endif
Url:            http://sourceforge.net/projects/m2300w/
Summary:        Konica Minolta magicolor 2300W and 2400W Printer Driver
License:        GPL-2.0+
Group:          Hardware/Printing
Version:        0.51
Release:        0
Requires:       ghostscript
Requires:       foomatic-filters
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Source0:        http://heanet.dl.sourceforge.net/sourceforge/m2300w/m2300w-%{version}.tar.bz2
# Patch100... is for openSUSE/Novell patches which which are not intended for upstream.
# The patches are not intended for upstream because the m2300w driver is no longer actively maintained.
Patch100:       m2300w-0.51-foomatic.patch
Patch101:       m2300w-0.51-resolution.patch
Patch102:       m2300w-0.51-disable_gs_test.patch
Patch103:       m2300w-fgets-overflow.patch
Patch104:       no_foomatic-rip_missing_error.patch

%description
This is an open source Linux printer driver for the Konica Minolta
magicolor 2300W and 2400W color laser printers. It requires Ghostscript
and foomatic-filters. It is recommended to use this driver with CUPS.

The current version 0.51 was released 2005-10-16 and
the m2300w driver is no longer actively maintained
which means that help, a workaround, or a bugfix
is rather unlikely if there are issues with this driver.

%prep
# Be quiet when unpacking:
%setup -q
%patch -P 100 -p1
%patch -P 101 -p1
%patch -P 102 -p1
%patch -P 103 -p1
%patch -P 104

%build
autoreconf
./configure --prefix=%{_prefix}
make CFLAGS="$RPM_OPT_FLAGS"

%install
# Install m2300w:
make install INSTROOT=$RPM_BUILD_ROOT DOCDIR=$RPM_BUILD_ROOT/%{_defaultdocdir}/%{name}
# Remove dispensable stuff (YaST2 printerdb files are obsolete since a longer time):
rm -rf $RPM_BUILD_ROOT/usr/share/YaST2
# Compress the PPDs:
gzip $RPM_BUILD_ROOT/usr/share/cups/model/Minolta/magicolor_*.ppd

%files
%defattr(-,root,root)
%{_bindir}/m2300w
%{_bindir}/m2400w
%{_bindir}/m2300w-wrapper
%dir /usr/share/cups
%dir /usr/share/cups/model
%dir /usr/share/cups/model/Minolta
/usr/share/cups/model/Minolta/magicolor_*.ppd.gz
%dir /usr/share/m2300w
/usr/share/m2300w/*
%doc %{_defaultdocdir}/%{name}

%changelog
openSUSE Build Service is sponsored by