-
Notifications
You must be signed in to change notification settings - Fork 3
/
cnijfilter-common.spec
executable file
·352 lines (291 loc) · 9.38 KB
/
cnijfilter-common.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
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
%bcond_with prepare_fastbuild
%bcond_with fastbuild
%bcond_with build_common_package
%define VERSION 3.80
%define RELEASE 2
%define _arc %(getconf LONG_BIT)
%define _is64 %(if [ `getconf LONG_BIT` = "64" ] ; then printf "64"; fi)
%define _cupsbindir /usr/lib/cups
%define _cupsbindir64 /usr/lib64/cups
%define _prefix /usr/local
%define _bindir %{_prefix}/bin
%define _libdir /usr/lib%{_is64}
%define _ppddir /usr
%define CNBP_LIBS libcnbpcmcm libcnbpcnclapi libcnbpcnclbjcmd libcnbpcnclui libcnbpess libcnbpo
%define COM_LIBS libcnnet
%define PRINT_PKG_PROGRAM ppd cnijfilter maintenance lgmon cngpijmon
%define PKG %{MODEL}series
Summary: IJ Printer Driver Ver.%{VERSION} for Linux
Name: cnijfilter-%{PKG}
Version: %{VERSION}
Release: %{RELEASE}
License: See the LICENSE*.txt file.
Vendor: CANON INC.
Group: Applications/Publishing
Source0: cnijfilter-source-%{version}-%{release}.tar.gz
BuildRoot: %{_tmppath}/%{name}-root
#Requires: cups popt
Requires: cnijfilter-common >= %{version} cups popt libxml2 gtk2 libtiff libpng
#BuildRequires: gtk-devel cups-devel
Packager: Will Newton
%if %{with build_common_package}
%package -n cnijfilter-common
Summary: IJ Printer Driver Ver.%{VERSION} for Linux
License: See the LICENSE*.txt file.
Vendor: CANON INC.
Group: Applications/Publishing
Requires: cups popt
%endif
%description
IJ Printer Driver for Linux.
This IJ Printer Driver provides printing functions for Canon Inkjet
printers operating under the CUPS (Common UNIX Printing System) environment.
%if %{with build_common_package}
%description -n cnijfilter-common
IJ Printer Driver for Linux.
This IJ Printer Driver provides printing functions for Canon Inkjet
printers operating under the CUPS (Common UNIX Printing System) environment.
%endif
%prep
echo $RPM_BUILD_ROOT
%if %{with fastbuild}
%setup -T -D -n cnijfilter-source-%{version}-%{RELEASE}
%else
%setup -q -n cnijfilter-source-%{version}-%{RELEASE}
%endif
%if ! %{with prepare_fastbuild}
%if ! %{defined MODEL}
echo "#### Usage : rpmbuild -bb [spec file] --define=\"MODEL ipXXXX\" --define=\"MODEL_NUM YYY\" ####"
exit 1
%endif
%if ! %{defined MODEL_NUM}
echo "#### Usage : rpmbuild -bb [spec file] --define=\"MODEL ipXXXX\" --define=\"MODEL_NUM YYY\" ####"
exit 1
%endif
%endif
%build
%if %{with prepare_fastbuild}
pushd ppd
./autogen.sh --prefix=/usr --program-suffix=CN_IJ_MODEL
popd
pushd cnijfilter
./autogen.sh --prefix=%{_prefix} --program-suffix=CN_IJ_MODEL --enable-libpath=%{_libdir}/bjlib --enable-binpath=%{_bindir}
popd
pushd maintenance
./autogen.sh --prefix=%{_prefix} --program-suffix=CN_IJ_MODEL --datadir=%{_prefix}/share --enable-libpath=%{_libdir}/bjlib
popd
pushd lgmon
./autogen.sh --prefix=%{_prefix} --program-suffix=CN_IJ_MODEL --enable-progpath=%{_bindir}
popd
pushd cngpijmon
./autogen.sh --prefix=%{_prefix} --program-suffix=CN_IJ_MODEL --enable-progpath=%{_bindir} --datadir=%{_prefix}/share
popd
%else
%if %{with fastbuild}
for prg_name in %{PRINT_PKG_PROGRAM};do
pushd ${prg_name}
find . -name Makefile -print > file_lists
find . -name config.h -print >> file_lists
for fn in `cat file_lists`; do
if [ ! -f $fn.org ]; then
cp $fn $fn.org
fi
sed -e s/CN_IJ_MODEL_NUM/%{MODEL_NUM}/g $fn.org | sed -e s/CN_IJ_MODEL/%{MODEL}/ > cn_ij_tmp; mv cn_ij_tmp $fn
done
make clean
make
popd
done
%else
pushd ppd
./autogen.sh --prefix=/usr --program-suffix=%{MODEL}
make clean
make
popd
pushd cnijfilter
./autogen.sh --prefix=%{_prefix} --program-suffix=%{MODEL} --enable-libpath=%{_libdir}/bjlib --enable-binpath=%{_bindir}
make clean
make
popd
pushd maintenance
./autogen.sh --prefix=%{_prefix} --program-suffix=%{MODEL} --datadir=%{_prefix}/share --enable-libpath=%{_libdir}/bjlib
make clean
make
popd
pushd lgmon
./autogen.sh --prefix=%{_prefix} --program-suffix=%{MODEL} --enable-progpath=%{_bindir}
make clean
make
popd
pushd cngpijmon
./autogen.sh --prefix=%{_prefix} --program-suffix=%{MODEL} --enable-progpath=%{_bindir} --datadir=%{_prefix}/share
make clean
make
popd
%endif
%endif
%if %{with build_common_package}
pushd libs
./autogen.sh --prefix=%{_prefix}
popd
pushd cngpij
./autogen.sh --prefix=%{_prefix} --enable-progpath=%{_bindir}
popd
pushd cngpijmnt
./autogen.sh --prefix=%{_prefix} --enable-progpath=%{_bindir}
popd
pushd pstocanonij
./autogen.sh --prefix=/usr --enable-progpath=%{_bindir}
popd
pushd backend
./autogen.sh --prefix=/usr
popd
pushd backendnet
./autogen.sh --prefix=%{_prefix} --enable-libpath=%{_libdir}/bjlib --enable-progpath=%{_bindir} LDFLAGS="-L../../com/libs_bin%{_arc}"
popd
pushd cngpijmon/cnijnpr
./autogen.sh --prefix=%{_prefix} --enable-libpath=%{_libdir}/bjlib
popd
make
%endif
%install
# make and install files for printer packages
pushd ppd
make install DESTDIR=${RPM_BUILD_ROOT}
popd
pushd cnijfilter
make install DESTDIR=${RPM_BUILD_ROOT}
popd
pushd maintenance
make install DESTDIR=${RPM_BUILD_ROOT}
popd
pushd lgmon
make install DESTDIR=${RPM_BUILD_ROOT}
popd
pushd cngpijmon
make install DESTDIR=${RPM_BUILD_ROOT}
popd
mkdir -p ${RPM_BUILD_ROOT}%{_libdir}/bjlib
install -c -m 644 %{MODEL_NUM}/database/* ${RPM_BUILD_ROOT}%{_libdir}/bjlib
install -c -s -m 755 %{MODEL_NUM}/libs_bin%{_arc}/*.so.* ${RPM_BUILD_ROOT}%{_libdir}
%if %{with build_common_package}
mkdir -p ${RPM_BUILD_ROOT}%{_bindir}
mkdir -p ${RPM_BUILD_ROOT}%{_cupsbindir}/filter
mkdir -p ${RPM_BUILD_ROOT}%{_cupsbindir}/backend
mkdir -p ${RPM_BUILD_ROOT}%{_cupsbindir64}/filter
mkdir -p ${RPM_BUILD_ROOT}%{_cupsbindir64}/backend
mkdir -p ${RPM_BUILD_ROOT}%{_prefix}/share/cups/model
mkdir -p ${RPM_BUILD_ROOT}/etc/udev/rules.d/
install -c -m 644 com/ini/cnnet.ini ${RPM_BUILD_ROOT}%{_libdir}/bjlib
make install DESTDIR=${RPM_BUILD_ROOT}
install -c -s -m 755 com/libs_bin%{_arc}/*.so.* ${RPM_BUILD_ROOT}%{_libdir}
install -c -m 755 ${RPM_BUILD_ROOT}%{_cupsbindir}/filter/pstocanonij ${RPM_BUILD_ROOT}%{_cupsbindir64}/filter/pstocanonij
install -c -m 755 ${RPM_BUILD_ROOT}%{_cupsbindir}/backend/cnijusb ${RPM_BUILD_ROOT}%{_cupsbindir64}/backend/cnijusb
install -c -m 755 ${RPM_BUILD_ROOT}%{_cupsbindir}/backend/cnijnet ${RPM_BUILD_ROOT}%{_cupsbindir64}/backend/cnijnet
install -c -m 644 etc/*.rules ${RPM_BUILD_ROOT}/etc/udev/rules.d/
%endif
%clean
rm -rf $RPM_BUILD_ROOT
%post
if [ -x /sbin/ldconfig ]; then
/sbin/ldconfig
fi
%postun
# remove cnbp* libs
for LIBS in %{CNBP_LIBS}
do
if [ -h %{_libdir}/${LIBS}%{MODEL_NUM}.so ]; then
rm -f %{_libdir}/${LIBS}%{MODEL_NUM}.so
fi
done
# remove directory
if [ "$1" = 0 ] ; then
rmdir -p --ignore-fail-on-non-empty %{_prefix}/share/locale/*/LC_MESSAGES
rmdir -p --ignore-fail-on-non-empty %{_prefix}/share/cngpijmon%{MODEL}
rmdir -p --ignore-fail-on-non-empty %{_prefix}/share/maintenance%{MODEL}
rmdir -p --ignore-fail-on-non-empty %{_bindir}
fi
if [ -x /sbin/ldconfig ]; then
/sbin/ldconfig
fi
%if %{with build_common_package}
%post -n cnijfilter-common
if [ -e /usr/lib64/cups/backend/usb ] ; then
rm -f /usr/lib/cups/filter/pstocanonij
rm -f /usr/lib/cups/backend/cnijusb
rm -f /usr/lib/cups/backend/cnijnet
rmdir -p --ignore-fail-on-non-empty /usr/lib/cups/filter
rmdir -p --ignore-fail-on-non-empty /usr/lib/cups/backend
elif [ -e /usr/lib/cups/backend/usb ] ; then
rm -f /usr/lib64/cups/filter/pstocanonij
rm -f /usr/lib64/cups/backend/cnijusb
rm -f /usr/lib64/cups/backend/cnijnet
rmdir -p --ignore-fail-on-non-empty /usr/lib64/cups/filter
rmdir -p --ignore-fail-on-non-empty /usr/lib64/cups/backend
fi
if [ -x /sbin/ldconfig ]; then
/sbin/ldconfig
fi
if [ -x /sbin/udevadm ]; then
/sbin/udevadm control --reload-rules 2> /dev/null
/sbin/udevadm trigger --action=add --subsystem-match=usb 2> /dev/null
fi
%postun -n cnijfilter-common
for LIBS in %{COM_LIBS}
do
if [ -h %{_libdir}/${LIBS}.so ]; then
rm -f %{_libdir}/${LIBS}.so
fi
done
if [ "$1" = 0 ] ; then
rmdir -p --ignore-fail-on-non-empty %{_libdir}/bjlib
fi
if [ -x /sbin/ldconfig ]; then
/sbin/ldconfig
fi
%endif
%files
%defattr(-,root,root)
%{_bindir}/cngpijmon%{MODEL}
%{_bindir}/lgmon%{MODEL}
%{_bindir}/maintenance%{MODEL}
%{_ppddir}/share/cups/model/canon%{MODEL}.ppd
%{_prefix}/share/locale/*/LC_MESSAGES/cngpijmon%{MODEL}.mo
%{_prefix}/share/locale/*/LC_MESSAGES/maintenance%{MODEL}.mo
%{_prefix}/share/cngpijmon%{MODEL}/*
%{_prefix}/share/maintenance%{MODEL}/*
%{_bindir}/cif%{MODEL}
%{_libdir}/libcnbp*%{MODEL_NUM}.so*
%{_libdir}/bjlib/cif%{MODEL}.conf
%{_libdir}/bjlib/cnb_%{MODEL_NUM}0.tbl
%{_libdir}/bjlib/cnbpname%{MODEL_NUM}.tbl
%doc LICENSE-cnijfilter-%{VERSION}JP.txt
%doc LICENSE-cnijfilter-%{VERSION}EN.txt
%doc LICENSE-cnijfilter-%{VERSION}SC.txt
%doc LICENSE-cnijfilter-%{VERSION}FR.txt
%doc lproptions/lproptions-%{MODEL}-%{VERSION}JP.txt
%doc lproptions/lproptions-%{MODEL}-%{VERSION}EN.txt
%doc lproptions/lproptions-%{MODEL}-%{VERSION}SC.txt
%doc lproptions/lproptions-%{MODEL}-%{VERSION}FR.txt
%if %{with build_common_package}
%files -n cnijfilter-common
%defattr(-,root,root)
%{_cupsbindir}/filter/pstocanonij
%{_cupsbindir}/backend/cnijusb
%{_cupsbindir}/backend/cnijnet
%{_cupsbindir64}/filter/pstocanonij
%{_cupsbindir64}/backend/cnijusb
%{_cupsbindir64}/backend/cnijnet
%{_bindir}/cngpij
%{_bindir}/cngpijmnt
%{_bindir}/cnijnpr
%{_bindir}/cnijnetprn
%{_libdir}/libcnnet.so*
%attr(644, lp, lp) %{_libdir}/bjlib/cnnet.ini
/etc/udev/rules.d/*.rules
%doc LICENSE-cnijfilter-%{VERSION}JP.txt
%doc LICENSE-cnijfilter-%{VERSION}EN.txt
%doc LICENSE-cnijfilter-%{VERSION}SC.txt
%doc LICENSE-cnijfilter-%{VERSION}FR.txt
%endif
%ChangeLog