File iscan.spec of Package iscan

#
# spec file for package iscan
#
# Copyright (C) 2025 Packman Team <packman@links2linux.de>
# Copyright (c) 2015 SUSE LINUX 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/
#


%define version_iscan_data 1.39.1
%define plugindir %(gimptool-2.0 --gimpplugindir 2> /dev/null)
Name:           iscan
Version:        2.30.4
Release:        1
Summary:        EPSON Image Scan! front-end for scanners and all-in-ones
License:        GPL-2.0 and AVASYSPL
Group:          Hardware/Scanner
Url:            http://download.ebz.epson.net/dsc/search/01/search/?OSC=LX
Source0:        http://support.epson.net/linux/src/scanner/iscan/%{name}_%{version}-2.tar.gz
Source1:        http://support.epson.net/linux/src/scanner/iscan/iscan-data_%{version_iscan_data}-2.tar.gz
Source2:        epkowa.conf
# PATCH-FIX-UPSTREAM libpng15.patch (export from arch) -- Build iscan against libpng15 by giovanni
Patch0:         libpng15.patch
Patch1:         jpegstream.patch
# PATCH-FIX-UPSTREAM -- https://bugs.gentoo.org/692708
Patch2:         iscan-2.30.4.2-sscanf.patch
Patch3:         iscan-data.patch
Patch4:         iscan.patch
Patch5:         iscan-2.30.4.2-c99.patch
Patch6:         hain01commits2dip-obj.patch
BuildRequires:  gcc-c++
BuildRequires:  gettext-tools
BuildRequires:  libtool
BuildRequires:  libxslt-tools
BuildRequires:  systemd-rpm-macros
BuildRequires:  update-desktop-files
BuildRequires:  pkg-config
%if %suse_version < 1600
BuildRequires:  pkgconfig(gimp-2.0)
%endif
BuildRequires:  pkgconfig(gtk+-2.0)
BuildRequires:  pkgconfig(libjpeg)
BuildRequires:  pkgconfig(libpng16)
BuildRequires:  pkgconfig(libtiff-4)
BuildRequires:  pkgconfig(libusb-1.0)
BuildRequires:  pkgconfig(libxml-2.0)
BuildRequires:  pkgconfig(sane-backends)
BuildRequires:  pkgconfig(udev)
Requires:       %{name}-data = %{version_iscan_data}
%{?systemd_requires}
ExclusiveArch:	x86_64

%description
Image Scan! is a graphical scanner utility for people that do not need all
the bells and whistles provided by several of the other utilities out there
(xsane, QuiteInsane, Kooka).

At the moment it only supports SEIKO EPSON scanners and all-in-ones.
However, the scanner driver it provides can be used by any other SANE
standard compliant scanner utility.

Note that several scanners require a non-free plugin before they can be
used with this software

%package data
Version:        %{version_iscan_data}
Summary:        Image Scan! for Linux data files
Group:          Hardware/Scanner
Requires:       libxslt
BuildArch:      noarch

%description data
Provides the necessary support files for Image Scan! for Linux, including
device information and policy file generation logic.

Image Scan! for Linux will not function without this package.

%prep
%autosetup -p1 -a 1

%build
# Fix for CXX ABI different than 1002 (export from arch)
ln -s libesmod-x86_64.c2.so non-free/libesmod-x86_64.so

find -name Makefile.in -print -delete
autoreconf -vif
CFLAGS='%optflags -Wno-deprecated-declarations -std=gnu89'
CXXFLAGS="${CFLAGS}"
%configure \
  --sbindir=%{_bindir} \
  --enable-dependency-reduction \
  --enable-frontend \
  --enable-jpeg \
  --enable-tiff \
  --enable-png \
%if %suse_version < 1600
  --enable-gimp \
%endif
  --enable-static=no
%make_build

# Build data
pushd %{name}-data-%{version_iscan_data}
autoreconf -vif
%configure --libdir="%{_prefix}/lib"
%make_build
%make_build %{name}-data.hwdb
popd

%install
%make_install
install -d %{buildroot}%{plugindir}/plug-ins
%if %suse_version < 1600
gimplibdir="`pkg-config --variable=gimplibdir gimp-2.0`"
mkdir -vp %{buildroot}${gimplibdir}/plug-ins
ln -s %{_bindir}/iscan %{buildroot}${gimplibdir}/plug-ins/iscan
%endif
install -D -m 0644 backend/epkowa.conf %{buildroot}%{_sysconfdir}/sane.d/epkowa.conf
install -D -m 0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/sane.d/dll.d/epkowa.conf

find %{buildroot} \( -name \*.la -o -name \*.so \) -ls -delete

%suse_update_desktop_file -i %{name} Graphics Scanning

%find_lang %{name}

# data: install files
pushd %{name}-data-%{version_iscan_data}
%make_install
install -D -m 0644 %{name}-data.hwdb %{buildroot}/%{_udevhwdbdir}/%{name}-data.hwdb
popd

%post
/sbin/ldconfig
%udev_hwdb_update

%postun
/sbin/ldconfig
if [ $1 -eq 0 ]; then
	%udev_hwdb_update
fi

%files -f %{name}.lang
%doc NEWS README AUTHORS
%license COPYING
%license non-free/COPYING.EPSON.en.txt
%doc doc/xinetd.sane
%dir %{_sysconfdir}/sane.d
%dir %{_sysconfdir}/sane.d/dll.d
%config %{_sysconfdir}/sane.d/epkowa.conf
%config %{_sysconfdir}/sane.d/dll.d/epkowa.conf
%{_bindir}/%{name}
%{_bindir}/%{name}-registry
%{_libdir}/libesmod.so*
%{_libdir}/sane/libsane-epkowa.so*
%if %suse_version < 1600
%{_libdir}/gimp
%endif
%{_datadir}/applications/%{name}.desktop
%{_mandir}/man?/iscan.?.gz
%{_mandir}/man?/sane-epkowa.?.gz
%{_mandir}/man?/iscan-registry.?.gz

%files data
%license %{name}-data-%{version_iscan_data}/COPYING
%doc %{name}-data-%{version_iscan_data}/NEWS
%doc %{name}-data-%{version_iscan_data}/KNOWN-PROBLEMS
%doc %{name}-data-%{version_iscan_data}/SUPPORTED-DEVICES
%{_libexecdir}/iscan-data
%{_datadir}/iscan-data
%{_udevhwdbdir}/%{name}-data.hwdb

%changelog