forked from hean01/iscan
-
Notifications
You must be signed in to change notification settings - Fork 0
/
iscan.spec
314 lines (270 loc) · 8.95 KB
/
iscan.spec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
# iscan.spec.in -- an rpm spec file template
# Copyright (C) 2004--2006 Olaf Meeuwissen
# Copyright (C) 2019 SEIKO EPSON Corporation
#
# This file is part of the "Image Scan!" build infra-structure.
#
# The "Image Scan!" build infra-structure is free software.
# You can redistribute it and/or modify it under the terms of the GNU
# General Public License as published by the Free Software Foundation;
# either version 2 of the License or at your option any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of FITNESS
# FOR A PARTICULAR PURPOSE or MERCHANTABILITY.
# See the GNU General Public License for more details.
#
# You should have received a verbatim copy of the GNU General Public
# License along with this program; if not, write to:
#
# Free Software Foundation, Inc.
# 59 Temple Place, Suite 330
# Boston, MA 02111-1307 USA
# Use RPM defaults for backward compatibility with older
# distributions.
%define _binary_filedigest_algorithm 1
%define _source_filedigest_algorithm 1
%define _binary_payload w9.gzdio
%define _source_payload w9.gzdio
# Some handy macro definitions.
#
%define pkg iscan
%define ver 2.30.4
%define rel 2
%define msg %{_tmppath}/%{pkg}-%{ver}-%{rel}.msg
%define supported_archs i386 i486 i586 i686 x86_64 amd64
%define gimp_api_versions 1.2 2.0
# general package information
Name: %{pkg}
Version: %{ver}
Release: %{rel}
Source: %{pkg}_%{ver}-%{rel}.tar.gz
License: GPL (with exception clauses) and EPSON End User Software License
Vendor: SEIKO EPSON Corporation
URL: http://download.ebz.epson.net/dsc/search/01/search/?OSC=LX
Packager: SEIKO EPSON Corporation
PreReq: sane-backends
Requires: iscan-data
Conflicts: iscan-network-nt < 1.1, iscan-plugin-cx4400 < 2.1, iscan-plugin-gt-7200 < 2.1, iscan-plugin-gt-7300 < 2.1, iscan-plugin-gt-9400 < 2.1, iscan-plugin-gt-f500 < 2.1, iscan-plugin-gt-f520 < 2.1, iscan-plugin-gt-f600 < 2.1, iscan-plugin-gt-f670 < 2.1, iscan-plugin-gt-f700 < 2.1, iscan-plugin-gt-s600 < 2.1, iscan-plugin-gt-x750 < 2.1
BuildRoot: %{_tmppath}/%{pkg}-%{ver}-%{rel}-root
BuildRequires: libusb1-devel, libxml2-devel
%ifarch %{supported_archs}
BuildRequires: gtk2-devel, libpng-devel, libjpeg-devel, libtiff-devel
%if "%{_vendor}" == "Mandriva"
BuildRequires: libltdl-devel, libgimp2.0-devel, libsane1-devel
%else
BuildRequires: libtool-ltdl-devel, gimp-devel, sane-backends-devel
%endif
%endif
Group: Applications/Multimedia
%ifnarch %{supported_archs}
Summary: SANE backend for SEIKO EPSON scanners and all-in-ones
%description
The scanner driver provided by this package can be used by any SANE
standard compliant scanner utility.
Note that some scanners are only supported on selected architectures.
%else
Summary: simple, easy to use scanner utility for EPSON scanners
%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.
%endif
# rpmbuild sections
%prep
%setup -q
%build
%if "%{_vendor}" == "Mandriva"
%define _disable_libtoolize 1
%define _requires_exceptions devel(libgcc_s)\\|devel(libm)\\|devel(libstdc++)
%endif
%ifarch %{supported_archs}
%configure \
--enable-dependency-reduction \
--enable-frontend \
--enable-gimp \
--enable-jpeg \
--enable-tiff \
--enable-png
%else
%configure
%endif
make
%install
rm -rf ${RPM_BUILD_ROOT}
make install DESTDIR=${RPM_BUILD_ROOT}
mkdir -p ${RPM_BUILD_ROOT}%{_localstatedir}/lib/%{pkg}
mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/applications
install -m 0644 %{pkg}.desktop ${RPM_BUILD_ROOT}%{_datadir}/applications
#
# Recent rpmbuild versions follow a FASCIST packaging policy and bomb
# out on any installed files that are not packaged and non-installed
# files that are. Clean up 'make install's act here.
#
sane_confdir=%{_sysconfdir}/sane.d
./mkinstalldirs -m 0755 ${RPM_BUILD_ROOT}${sane_confdir}
install -m 0644 backend/epkowa.conf ${RPM_BUILD_ROOT}${sane_confdir}
rm ${RPM_BUILD_ROOT}%{_libdir}/sane/libsane-epkowa.so
rm ${RPM_BUILD_ROOT}%{_libdir}/sane/libsane-epkowa.a
#
# Create a list of message catalogs that should be included in the RPM
# binary package. Use %lang(ll) notation so that sysadmins can choose
# the catalogs they want installed.
#
> %{msg}
cd ${RPM_BUILD_ROOT}/%{_datadir}/locale
for lang in *
do
test -f ${lang}/LC_MESSAGES/%{pkg}.mo || continue
ll=`echo ${lang} | sed 's,@.*$,,'`
echo "%lang(${ll}) %{_datadir}/locale/${lang}/LC_MESSAGES/%{pkg}.mo" \
>> %{msg}
done
%clean
make clean # rm -rf %{_builddir}/%{name}-%{version}
rm -rf ${RPM_BUILD_ROOT}
rm -f %{msg}
# rpm (un)installation scripts
# Believe it or not, but there are distros out there that do not have
# the sane service listed in their /etc/services. Also note that the
# official service name, as registered with the IANA is not sane, but
# sane-port. The saned alias is also commonly used.
#
%pre
srv=/etc/services
if [ -z "`grep 6566/tcp ${srv}`" ]
then
cat >> ${srv} <<EOF
sane-port 6566/tcp sane saned # SANE Control Port
sane-port 6566/udp sane saned # SANE Control Port
EOF
fi
%post
#
# Enable the epkowa backend unconditionally, assuming that people who
# install this package want to use it.
#
dll=%{_sysconfdir}/sane.d/dll.conf
if [ -n "`grep '#[[:space:]]*epkowa' ${dll}`" ]
then # uncomment existing entry
sed -i 's,#[[:space:]]*\(epkowa\),\1,' ${dll}
elif [ -z "`grep epkowa ${dll}`" ]
then # append brand new entry
echo epkowa >> ${dll}
fi
#
# Enable the GIMP plug-ins functionality system wide.
#
if test -x %{_bindir}/iscan
then
for prefix in %{_libdir} /opt/gnome/lib /opt/gnome/lib64
do
[ -d ${prefix} ] || continue
for version in %{gimp_api_versions}
do
dir=${prefix}/gimp/${version}/plug-ins
[ -d ${dir} ] || mkdir -p ${dir}
ln -fs %{_bindir}/iscan ${dir}
done
done
plugindir="`gimptool --gimpplugindir 2> /dev/null`"
if [ x = x"${plugindir}" ]; then
plugindir="`gimptool-2.0 --gimpplugindir 2> /dev/null`"
fi
if [ x != x"${plugindir}" ]; then
ln -fs %{_bindir}/iscan ${plugindir}/plug-ins
fi
fi
# Clean up files created in our %%post.
#
%preun
STATE_DIR=%{_localstatedir}/lib/%{pkg}
VERSION=%{ver}-%{rel}
PATH=%{_libdir}/%{pkg}:$PATH
if test -f $STATE_DIR/interpreter; then
test -s $STATE_DIR/interpreter || rm $STATE_DIR/interpreter
fi
%postun
if [ $1 = 0 ] # Disable the backend we provided.
then
dll=%{_sysconfdir}/sane.d/dll.conf
if [ -n "`grep ^epkowa ${dll}`" ]
then
sed -i 's/^epkowa/#epkowa/' ${dll}
fi
fi
#
# Clean up our data and library directories, but only if empty.
#
rmdir %{_datadir}/%{pkg} 2> /dev/null || true
rmdir %{_libdir}/%{pkg} 2> /dev/null || true
#
# Clean out any additions to the top-level usermap and clean up empty
# files and directories
#
map=%{_sysconfdir}/hotplug/usb.usermap
header='# Following info courtesy of Image Scan!'
footer='# Preceding info courtesy of Image Scan!'
if [ -f $map ]; then
if [ -n "$(grep "$header" $map)" ]; then
sed -i "/^$header/,/^$footer/d" $map
fi
test -s $map || rm $map
rmdir %{_sysconfdir}/hotplug 2> /dev/null || true
fi
#
# Clean up the GIMP plug-ins.
#
for prefix in %{_libdir} /opt/gnome/lib /opt/gnome/lib64
do
for version in %{gimp_api_versions}
do
dir=${prefix}/gimp/${version}/plug-ins
rm ${dir}/iscan 2> /dev/null || true
rmdir ${dir} 2> /dev/null || true
rmdir `dirname ${dir}` 2> /dev/null || true
done
rmdir ${prefix}/gimp 2> /dev/null || true
done
plugindir="`gimptool --gimpplugindir 2> /dev/null`"
if [ x = x"${plugindir}" ]; then
plugindir="`gimptool-2.0 --gimpplugindir 2> /dev/null`"
fi
if [ x != x"${plugindir}" ]; then
rm ${plugindir}/plug-ins/iscan 2> /dev/null || true
fi
# package contents
# Note that we generate the %%{msg} file during the %%install phase
# so that we can use %%lang(xx) notation without the need to resort
# to a manually maintained list here.
#
%files -f %{msg}
%defattr(-,root,root)
%doc NEWS README AUTHORS
%doc COPYING
%doc non-free/COPYING.EPSON.en.txt
# This should really go into ${RPM_DOC_DIR}/examples/.
%doc doc/xinetd.sane
%doc NEWS.ja README.ja
%doc non-free/COPYING.EPSON.ja.txt
%config(noreplace) %{_sysconfdir}/sane.d/epkowa.conf
%ifarch %{supported_archs}
%{_bindir}/iscan
%{_libdir}/libesmod.so*
%{_sbindir}/iscan-registry
%endif
%{_libdir}/sane/libsane-epkowa.la
%{_libdir}/sane/libsane-epkowa.so.*
%{_mandir}/man*/*
%{_localstatedir}/lib/%{pkg}
%{_datadir}/applications/%{pkg}.desktop
# significant packaging changes
%changelog
* Tue Jul 30 2019 Kenichi Shimoura <[email protected]>
- new upstream
# end of file