Code sync
[external/hplip.git] / packaging / hplip.spec
1 # Define if you want to build the sane backend (default)
2 %define sane_backend            0
3 %{?_with_sane:                  %global sane_backend 1}
4 %{?_without_sane:               %global sane_backend 0}
5
6 %define hpip_major              0
7 %define hpip_libname            %mklibname hpip %{hpip_major}
8
9 %define sane_hpaio_major        1
10 %define sane_hpaio_libname      %mklibname sane-hpaio %{sane_hpaio_major}
11
12 # Suppress automatically generated Requires for devel packages
13 %define _requires_exceptions devel\(.*\)
14
15 %define subrel 2
16
17 Summary: HP Linux Imaging and Printing Project
18 Name:   hplip
19 Version:        3.11.7
20 Release:        9
21 License:        GPLv2+ and MIT
22 Group:  System Environment/Daemons
23 Source: %{name}-%{version}.tar.gz
24
25 # taken from http://patch-tracker.debian.org/package/hplip/3.11.7-1
26 Patch1: 01_rss.dpatch
27 Patch2: 10_shebang_fixes.dpatch
28 Patch3: 14_charsign_fixes.dpatch
29 Patch4: 85_rebuild_python_ui.dpatch
30 Patch5: 87_move_documentation.dpatch
31 Patch6: hp_photosmart_pro_b9100_support.dpatch
32 Patch7: pjl-duplex-binding.dpatch
33 Patch8: kde4-kdesudo-support.dpatch
34 Patch9: hp-check-groups.dpatch
35 Patch10: hp-check_debian.dpatch
36 Patch11: hp-setup-prompt-for-custom-PPD.dpatch
37 Patch12: hplip-systray-longer-timeout-for-system-tray-start.dpatch
38 Patch13: kbsd.dpatch
39 Patch14: udev-rules-use-attrs-not-sysfs-and-hp-mkuri-call-fix.dpatch
40 Patch15: hp-mkuri-take-into-account-already-installed-plugin-also-for-exit-value.dpatch
41 Patch16: ubuntu-hp-mkuri-notification-text.dpatch
42 Patch17: simple-scan-as-default.dpatch
43 Patch18: make-commafy-correctly-work-with-python-2.dpatch
44 Patch19: remove-duplicate-entry-for-cp1700-in-drv-files.dpatch
45 Patch20: black-stripes-on-pcl5c-printouts.dpatch
46 Patch21: try_libhpmud.so.0.dpatch
47 Patch22: add-lidil-two-cartridge-modes.dpatch
48 Patch23: add_missing_newline_for_error_log.dpatch
49 Patch24: CVE-2010-4267.dpatch
50 Patch25: large-sizes-borderless-on-photosmart-pro-b-series.dpatch
51 Patch26: more-user-friendly-choice-names-for-installed-cartridges.dpatch
52 Patch27: hplip-syslog-fix-debug-messages-to-error.dpatch
53 Patch28: cups-1.5.0-compatibility.dpatch
54 Patch29: mdns-py-network-printer-search-key-error.dpatch
55 Patch30: mdns-py-typo.dpatch
56 Patch31: hpfax-bug-function-used-before-importing-log.dpatch
57 Patch32: hp-systray-make-menu-title-visible-in-sni-qt-indicator.dpatch
58 Patch33: hp-systray-make-menu-appear-in-sni-qt-indicator-with-kde.dpatch
59 Patch34: hpcups-top-margins-not-respected.dpatch
60
61 BuildRoot:  %{_tmppath}/%{name}-%{version}-build
62
63 #BuildRequires: python-sip >= 4.1.1
64 #BuildRequires: net-snmp-devel
65 BuildRequires:  python
66 #hplip should use libusb-compat-devel not libusb-devel
67 BuildRequires:  pkgconfig(libusb)
68 #BuildRequires: imagemagick
69 BuildRequires:  autoconf
70 BuildRequires:  cups-devel
71 BuildRequires:  libjpeg-devel
72 #BuildRequires: python-devel
73 #BuildRequires: desktop-file-utils
74 #BuildRequires: libdbus-devel
75 #BuildRequires: udev-devel
76 #BuildRequires: polkit
77 #BuildRequires: gphoto2-devel
78 #BuildRequires:  libv4l-devel
79 Requires:       cups
80 # For dynamic ppd generation.
81 #Requires:      cupsddk-drivers >= 1.2.3-2mdv
82 #Requires:      foomatic-filters
83 #Requires:      hplip-model-data
84 #Requires:      hplip-hpijs
85 #Requires:      hplip-hpijs-ppds
86 #Requires:      python-sip >= 4.1.1
87 # Needed for communicating with ethernet-connected printers
88 #Requires:      net-snmp-mibs
89 # Needed to generate fax cover pages
90 #Requires:      python-reportlab
91 # Needed since 2.8.4 for IPC
92 #Requires:      python-dbus
93 #Requires:      polkit-agent
94 #Requires:      usermode-consoleonly
95 #Requires:      python-gobject
96 # Required by hp-scan for command line scanning
97 #Requires:      python-imaging
98 #Requires:      sane-backends-hpaio
99 # Needed to avoid misleading errors about network connectivity (RH bug #705843)
100 #Requires:      wget
101 # Some HP ppds are in foomatic-db and foomatic-db-hpijs (mdv bug #47415)
102
103 # foomatic-db-hpijs drivers are provided by hp and by this package now
104 # NOTE: remove the foomatic-db-hpijs deps sometime in 2010-10-?? ?
105 Provides:       foomatic-db-hpijs = %{version}-%{release}
106 Obsoletes:      foomatic-db-hpijs
107
108
109 %description
110 This is the HP driver package to supply Linux support for most
111 Hewlett-Packard DeskJet, LaserJet, PSC, OfficeJet, and PhotoSmart
112 printers and all-in-one peripherals (also known as Multi-Function
113 Peripherals or MFPs), which can print, scan, copy, fax, and/or access
114 flash memory cards.
115
116 It is work in progress, but printing, scanning, memory card access,
117 ink/toner/battery/consumable level checking, and inkjet printer
118 maintenance are supported on most models, when either connected to the
119 USB or LAN (built-in interfaces or selected HP JetDirect models) on a
120 Linux workstation with CUPS printing system.
121
122 For status and consumable checking and also for inkjet maintenance
123 there is the graphical tool "hp-toolbox" available (Menu:
124 "System"/"Monitoring"/"HP Printer Toolbox").
125
126 #%package libs
127 #Summary: Dynamic library for the "hplip" HP printer/all-in-one drivers
128 #Group: System/Printing
129
130 #%description libs
131 #Library needed for the "hplip" HP printer/all-in-one drivers
132
133 %package devel
134 Summary: Headers and links to compile against the "lib" ("hplip") library
135 Group: Development/C
136 #Requires: libs >= %{version}-%{release}
137 Provides: devel = %{version}-%{release}
138
139 %description devel
140 This package contains all files which one needs to compile programs using
141 the "lib" library.
142
143 #%package model-data
144 #Summary: Data file listing the HP printer models supported by HPLIP
145 #Group: System/Printing
146
147 #%description model-data
148 #HPLIP supports most current HP printers and multifunction devices, but
149 #there are some older models not supported. This package contains the
150 #list of supported models. Printerdrake installs it automatically to
151 #determine whether HPLIP has to be installed or not.
152
153 #%package doc
154 #Summary:       Documentation for HPLIP
155 #Group:         System/Printing
156
157 #%description doc
158 #This package contains documentation for the HPLIP driver.
159 #This is the HP driver package to supply Linux support for most
160 #Hewlett-Packard DeskJet, LaserJet, PSC, OfficeJet, and PhotoSmart
161 #printers and all-in-one peripherals (also known as Multi-Function
162 #Peripherals or MFPs), which can print, scan, copy, fax, and/or access
163 #flash memory cards.
164
165 %prep
166 %setup -q
167
168 %patch1 -p1
169 %patch2 -p1
170 %patch3 -p1
171 %patch4 -p1
172 %patch5 -p1
173 %patch6 -p1
174 %patch7 -p1
175 %patch8 -p1
176 %patch9 -p1
177 %patch10 -p1
178 %patch11 -p1
179 %patch12 -p1
180 %patch13 -p1
181 %patch14 -p1
182 %patch15 -p1
183 #%patch16 -p1
184 %patch17 -p1
185 %patch18 -p1
186 %patch19 -p1
187 %patch20 -p1
188 %patch21 -p1
189 %patch22 -p1
190 %patch23 -p1
191 %patch24 -p1
192 %patch25 -p1
193 %patch26 -p1
194 %patch27 -p1
195 %patch28 -p1
196 %patch29 -p1
197 %patch30 -p1
198 %patch31 -p1
199 %patch32 -p1
200 %patch33 -p1
201 %patch34 -p1
202
203 # Make all files in the source user-writable
204 chmod -R u+w .
205 touch NEWS README AUTHORS ChangeLog
206 chmod +x debian/autogen.sh
207 echo "Running autoreconf..."
208 autoreconf --force --install
209
210 %build
211 #%serverbuild
212 %configure HPLIP_PPD_PATH=/opt/etc/cups/ppd \
213         --config-cache \
214         --disable-dependency-tracking \
215         --prefix=/usr \
216         --mandir=\$${prefix}/share/man \
217         --infodir=\$${prefix}/share/info \
218         --docdir=\$${prefix}/share/doc/hplip \
219         --with-docdir=\$${prefix}/share/doc/hplip \
220         --disable-foomatic-drv-install \
221         --disable-foomatic-ppd-install \
222         --disable-foomatic-rip-hplip-install \
223         --with-drvdir=\$${prefix}/share/cups/drv \
224         --with-hpppddir=\$${prefix}/share/ppd/hplip/HP \
225         --datadir=\$${prefix}/share \
226         --libexecdir=\$${prefix}/lib \
227         --localstatedir=/var \
228         --sysconfdir=/opt/etc \
229         --without-icondir \
230         --disable-hpijs-only-build \
231         --enable-hpcups-only-build \
232         --enable-hpcups-install \
233         --enable-new-hpcups \
234         --disable-network-build \
235         --disable-pp-build \
236         --disable-scan-build \
237         --disable-gui-build \
238         --disable-fax-build \
239         --disable-dbus-build \
240         --disable-cups11-build \
241         --disable-udev-acl-rules \
242         --enable-cups-drv-install \
243         --enable-cups-ppd-install \
244         --disable-qt4 \
245         --disable-qt3 \
246         --disable-policykit
247
248 #sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
249 #sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
250 make
251
252 %install
253 #rm -rf %{buildroot}
254 mkdir -p %{buildroot}%{_bindir}
255 mkdir -p %{buildroot}%{_includedir}
256 mkdir -p %{buildroot}%{_initrddir}
257 mkdir -p %{buildroot}%{_sysconfdir}/hp
258 mkdir -p %{buildroot}/opt/var/run/hplip
259
260 # Do not use the macro here, use the standard DESTDIR method as it works
261 # with HPLIP, in contrary to the non-standard Mandriva method
262 #make test-destdir DESTDIR=%{buildroot}
263 make install DESTDIR=%{buildroot}
264
265 # Install files which the "make install" missed to install
266 install -m 644 ip/hpip.h %{buildroot}%{_includedir}
267 install -m 644 ip/xform.h %{buildroot}%{_includedir}
268
269 # Move doc in sub-package
270 #mv %{buildroot}%{_docdir}/%{name}-%{version} %{buildroot}%{_docdir}/%{name}-doc-%{version}
271
272 # Remove static libraries of SANE driver
273 rm -f %{buildroot}%{_libdir}/sane/libsane-hpaio*.so
274 rm -f %{buildroot}%{_libdir}/sane/libsane-hpaio*.la
275 rm -f %{buildroot}%{_sysconfdir}/sane.d/dll.conf
276
277 # Remove other unneeded files
278 rm -f %{buildroot}%{py_platsitedir}/*.la
279
280 #mkdir -p $RPM_BUILD_ROOT%{_datadir}/applications
281 #desktop-file-install --vendor='' \
282 #       --dir=%{buildroot}%{_datadir}/applications \
283 #       --remove-category='Application' \
284 #       --remove-category='Utility' \
285 #       --add-category='System' \
286 #       --add-category='Settings' \
287 #       --add-category='Printing' \
288 #        --add-category='Qt' \
289 #       --add-category='HardwareSettings' \
290 #      --add-category='X-MandrivaLinux-CrossDesktop' \
291 #       --remove-key='Version' \
292 #        %{buildroot}%{_datadir}/applications/hplip.desktop
293
294 #cat > $RPM_BUILD_ROOT%{_datadir}/applications/%{_real_vendor}-hp-sendfax.desktop << EOF
295 #[Desktop Entry]
296 #Name=HP Sendfax
297 #Comment=Utility for sending faxes with HP's multi-function devices
298 #Exec=%{_bindir}/hp-sendfax
299 #Icon=%{_datadir}/%{name}/data/images/32x32/fax_machine.png
300 #Terminal=false
301 #Type=Application
302 #Categories=TelephonyTools;Qt;Printing;Utility;X-MandrivaLinux-CrossDesktop;
303 #EOF
304 #' #Fix vim's stupid syntax
305
306 # The systray applet doesn't work properly (displays icon as a
307 # window), so don't ship the launcher yet.
308 rm -f %{buildroot}%{_sysconfdir}/xdg/autostart/hplip-systray.desktop
309
310
311 # switched to udev, no need for hal information
312 rm -rf  %{buildroot}%{_datadir}/hal/fdi 
313
314 rm -f   %{buildroot}%{_libdir}/*.la \
315         %{buildroot}%{python_sitearch}/*.la \
316         %{buildroot}%{_libdir}/sane/*.la
317
318 # Regenerate hpcups PPDs on upgrade if necessary (bug #579355).
319 #install -p -m755 %{SOURCE1} %{buildroot}%{_bindir}/hpcups-update-ppds
320
321 # Fedora pstotiff
322 #rm -f %{buildroot}%{_sysconfdir}/cups/pstotiff.types
323 #rm -f %{buildroot}%{_datadir}/cups/mime/pstotiff.types
324 #rm -f %{buildroot}%{_datadir}/hplip/fax/pstotiff*
325 #rm -f %{buildroot}%{_prefix}/lib/cups/filter/hpcac
326
327 # bork?
328 install -d %{buildroot}%{_sysconfdir}/cups
329 #cp -p %{buildroot}%{_datadir}/cups/mime/pstotiff.convs %{buildroot}%{_sysconfdir}/cups/pstotiff.convs
330
331 # set up consolehelper
332 #mkdir -p %{buildroot}%{_sbindir}
333 #mv %{buildroot}%{_bindir}/hp-setup %{buildroot}%{_sbindir}/hp-setup
334 #ln -s consolehelper %{buildroot}%{_bindir}/hp-setup
335
336 # Make sure pyc files are generated, otherwise we can get
337 # difficult to debug problems
338 #pushd %{buildroot}%{_datadir}/%{name}
339 #python -m compileall .
340 #popd
341
342 %triggerin -- hplip < 2.7.7
343 chkconfig --del hplip
344
345 # Restart CUPS to make the Fax PPD known to it
346 #if [ -f /etc/init.d/cups ]; then
347 #       /sbin/service cups condrestart || :
348 #fi
349
350 #%post -n hplip-model-data
351 #/sbin/udevadm trigger --subsystem-match=usb --attr-match=idVendor=03f0
352
353 # Restart CUPS to make the removal of the Fax PPD known to it
354 #if [ -f /etc/init.d/cups ]; then
355 #       /sbin/service cups condrestart || :
356 #fi
357
358 %clean
359 rm -rf %{buildroot}
360
361 %files
362 #%manifest hplip.manifest
363 %defattr(-,root,root)
364 #doc COPYING doc/*
365 #%config(noreplace) %{_sysconfdir}/hp
366 #%dir /opt/var/run/hplip/
367 #%{_bindir}/hp-align
368 #%{_bindir}/hp-clean
369 #%{_bindir}/hp-colorcal
370 #%{_bindir}/hp-devicesettings
371 #%{_bindir}/hp-fab
372 #%{_bindir}/hp-faxsetup
373 #%{_bindir}/hp-firmware
374 #%{_bindir}/hp-info
375 #%{_bindir}/hp-levels
376 #%{_bindir}/hp-linefeedcal
377 #%{_bindir}/hp-makecopies
378 #%{_bindir}/hp-makeuri
379 #%{_bindir}/hp-mkuri
380 #%{_bindir}/hp-pkservice
381 #%{_bindir}/hp-plugin
382 #%{_bindir}/hp-pqdiag
383 #%{_bindir}/hp-printsettings
384 #%{_bindir}/hp-probe
385 #%{_bindir}/hp-query
386 #%{_bindir}/hp-scan
387 #%{_bindir}/hp-sendfax
388 #%{_bindir}/hp-setup
389 #%{_sbindir}/hp-setup
390 #%{_bindir}/hp-testpage
391 #%{_bindir}/hp-timedate
392 #%{_bindir}/hp-unload
393 #%{_bindir}/hp-wificonfig
394
395 #%exclude %{_datadir}/hplip/data/models
396 # C libraries for Python
397 #%{_libdir}/python*/*/*.so*
398 # CUPS backends (0755 permissions, so that CUPS 1.2 runs these backends
399 # as lp user)
400 # Note: this must be /usr/lib not %{_libdir}, since that's the
401 # CUPS serverbin directory.
402 #%attr(0755,root,root) %{_prefix}/lib/cups/backend/hp*
403 #%{_prefix}/lib/cups/filter/hplipjs
404 %{_prefix}/lib/cups/filter/hpcups
405 #%{_prefix}/lib/cups/filter/hpcupsfax
406 #%{_prefix}/lib/cups/filter/hpps
407 #%{_prefix}/lib/cups/filter/pstotiff
408 #%{_datadir}/cups/mime/pstotiff.convs
409 #%config(noreplace) %{_sysconfdir}/cups/pstotiff.convs
410 #%{_datadir}/ppd/HP/HP-Fax*.ppd*
411 #%{_datadir}/cups/drv/hp/hpcups.drv
412 # Files
413 #%dir %{_datadir}/hplip
414 #%{_datadir}/hplip/align.py*
415 #%{_datadir}/hplip/clean.py*
416 #%{_datadir}/hplip/colorcal.py*
417 #%{_datadir}/hplip/devicesettings.py*
418 #%{_datadir}/hplip/fab.py*
419 #%{_datadir}/hplip/fax
420 #%{_datadir}/hplip/faxsetup.py*
421 #%{_datadir}/hplip/firmware.py*
422 #%{_datadir}/hplip/hpdio.py*
423 #%{_datadir}/hplip/hpssd*
424 #%{_datadir}/hplip/info.py*
425 #%{_datadir}/hplip/__init__.py*
426 #%{_datadir}/hplip/levels.py*
427 #%{_datadir}/hplip/linefeedcal.py*
428 #%{_datadir}/hplip/makecopies.py*
429 #%{_datadir}/hplip/makeuri.py*
430 #%{_datadir}/hplip/pkservice.py*
431 #%{_datadir}/hplip/plugin.py*
432 #%{_datadir}/hplip/pqdiag.py*
433 #%{_datadir}/hplip/printsettings.py*
434 #%{_datadir}/hplip/probe.py*
435 #%{_datadir}/hplip/query.py*
436 #%{_datadir}/hplip/scan.py*
437 #%{_datadir}/hplip/sendfax.py*
438 #%{_datadir}/hplip/setup.py*
439 #%{_datadir}/hplip/testpage.py*
440 #%{_datadir}/hplip/timedate.py*
441 #%{_datadir}/hplip/unload.py*
442 #%{_datadir}/hplip/wificonfig.py*
443 # Directories
444 #%{_datadir}/hplip/base
445 #%{_datadir}/hplip/copier
446 #%dir %{_datadir}/hplip/data
447 #%{_datadir}/hplip/data/ldl
448 #%{_datadir}/hplip/data/localization
449 #%{_datadir}/hplip/data/models
450 #%{_datadir}/hplip/data/pcl
451 #%{_datadir}/hplip/data/ps
452 #%{_datadir}/hplip/installer
453 #%{_datadir}/hplip/pcard
454 #%{_datadir}/hplip/prnt
455 #%{_datadir}/hplip/scan
456 #%{_datadir}/polkit-1/actions/com.hp.hplip.policy
457 #%{_datadir}/dbus-1/system-services/com.hp.hplip.service
458 #%{_localstatedir}/lib/hp/hplip.state
459 #%config(noreplace) %{_sysconfdir}/dbus-1/system.d/com.hp.hplip.conf
460
461 #%files doc
462 #%defattr(-,root,root)
463 #%doc %{_docdir}/%{name}-doc-%{version}
464
465 #%files libs
466 #%defattr(-,root,root)
467 #%{_libdir}/libhpip*.so.*
468 #%{_libdir}/libhpmud.so.*
469
470 %files devel
471 %defattr(-,root,root)
472 %{_includedir}/hpip.h
473 %{_includedir}/xform.h
474 #%{_libdir}/libhpip*.so
475 #%{_libdir}/libhpmud.so
476
477 #%files model-data
478 #%defattr(-,root,root)
479 #%{_sysconfdir}/udev/rules.d/*.rules
480 #%{_datadir}/hplip/data/models
481
482 %changelog