]> git.pld-linux.org Git - packages/linux-gpib.git/blob - linux-gpib.spec
- fix patch depth
[packages/linux-gpib.git] / linux-gpib.spec
1 #
2 # Conditional build:
3 %bcond_without  kernel          # kernel modules
4 %bcond_without  drivers_isa     # ISA kernel drivers [ix86 only]
5 %bcond_without  drivers_usb     # USB kernel drivers
6 %bcond_without  userspace       # userspace packages
7 %bcond_without  verbose         # verbose modules build (V=1)
8
9 %bcond_without  doc             # documentation build
10 %bcond_with     hotplug         # legacy hotplug support
11 %bcond_without  static_libs     # static library
12 %bcond_without  guile           # guile binding
13 %bcond_without  perl            # Perl binding
14 %bcond_with     php             # PHP binding
15 %bcond_without  python          # Python (any) binding
16 %bcond_without  python2         # Python 2.x binding
17 %bcond_without  tcl             # Tcl binding
18
19 # The goal here is to have main, userspace, package built once with
20 # simple release number, and only rebuild kernel packages with kernel
21 # version as part of release number, without the need to bump release
22 # with every kernel change.
23 %if 0%{?_pld_builder:1} && %{with kernel} && %{with userspace}
24 %{error:kernel and userspace cannot be built at the same time on PLD builders}
25 exit 1
26 %endif
27
28 %if %{without userspace}
29 # nothing to be placed to debuginfo package
30 %define         _enable_debug_packages  0
31 %endif
32
33 %ifnarch %{ix86}
34 %undefine       with_drivers_isa
35 %endif
36 %if %{without python}
37 %undefine       with_python2
38 %endif
39
40 %define         php_name        php%{?php_suffix}
41
42 %define         rel     2
43 %define         pname   linux-gpib
44 Summary:        GPIB (IEEE 488) Linux support
45 Summary(pl.UTF-8):      Obsługa GPIB (IEEE 488) dla Linuksa
46 Name:           %{pname}%{?_pld_builder:%{?with_kernel:-kernel}}%{_alt_kernel}
47 Version:        4.3.6
48 Release:        %{rel}%{?_pld_builder:%{?with_kernel:@%{_kernel_ver_str}}}
49 License:        GPL v2+
50 Group:          Applications/System
51 Source0:        http://downloads.sourceforge.net/linux-gpib/%{pname}-%{version}.tar.gz
52 # Source0-md5:  ffefc4e5c03b891c57f406a4b82395b7
53 Patch2:         %{pname}-python.patch
54 Patch3:         %{pname}-perl.patch
55 Patch4:         %{pname}-firmwaredir.patch
56 Patch5:         %{pname}-guile2.patch
57 Patch6:         %{pname}-php7.patch
58 Patch8:         kernel-5.2.patch
59 Patch9:         kernel-5.10.patch
60 Patch10:        pkgconfig-version.patch
61 Patch11:        linux-gpib-guile3.patch
62 Patch12:        isa-dma.patch
63 URL:            http://linux-gpib.sourceforge.net/
64 BuildRequires:  autoconf >= 2.50
65 BuildRequires:  automake
66 BuildRequires:  libtool
67 BuildRequires:  rpmbuild(macros) >= 1.745
68 %{?with_kernel:%{expand:%buildrequires_kernel kernel%%{_alt_kernel}-module-build >= 3:2.6.32}}
69 %if %{with userspace}
70 BuildRequires:  bison
71 %{?with_doc:BuildRequires:      docbook-utils}
72 BuildRequires:  flex
73 %{?with_guile:BuildRequires:    guile-devel >= 1.4}
74 %{?with_perl:BuildRequires:     perl-devel}
75 %{?with_php:BuildRequires:      %{php_name}-devel >= 3:5}
76 %{?with_python:BuildRequires:   python-devel >= 2}
77 BuildRequires:  readline-devel
78 %{?with_tcl:BuildRequires:      tcl-devel}
79 %endif
80 Requires:       %{pname}-libs = %{version}-%{release}
81 # for agilent_82357a and ni_usb_gpib
82 Suggests:       fxload
83 # for agilent_82357a, agilent/hp_82341, agilent/hp_82350a, ni_usb_gpib
84 Suggests:       linux-gpib-firmware
85 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
86
87 %description
88 The Linux GPIB package provides support for GPIB (IEEE 488) hardware.
89
90 %description -l pl.UTF-8
91 Pakiet Linux GPIB służy do obsługi sprzętu GPIB (IEEE 488).
92
93 %package hotplug
94 Summary:        Linux GPIB support for legacy USB hotplug
95 Summary(pl.UTF-8):      Obsługa Linux GPIB dla starego systemu hotplug USB
96 Group:          Applications/System
97 Requires:       %{pname} = %{version}-%{release}
98 Requires:       hotplug
99
100 %description hotplug
101 Linux GPIB support for legacy USB hotplug.
102
103 %description hotplug -l pl.UTF-8
104 Obsługa Linux GPIB dla starego systemu hotplug USB.
105
106 %package libs
107 Summary:        Shared GPIB library
108 Summary(pl.UTF-8):      Biblioteka współdzielona GPIB
109 Group:          Libraries
110
111 %description libs
112 Shared GPIB library.
113
114 %description libs -l pl.UTF-8
115 Biblioteka współdzielona GPIB.
116
117 %package devel
118 Summary:        Header file for GPIB library
119 Summary(pl.UTF-8):      Plik nagłówkowy biblioteki GPIB
120 Group:          Development/Libraries
121 Requires:       %{pname}-libs = %{version}-%{release}
122
123 %description devel
124 Header file for GPIB library.
125
126 %description devel -l pl.UTF-8
127 Plik nagłówkowy biblioteki GPIB.
128
129 %package static
130 Summary:        Static GPIB library
131 Summary(pl.UTF-8):      Biblioteka statyczna GPIB
132 Group:          Development/Libraries
133 Requires:       %{pname}-devel = %{version}-%{release}
134
135 %description static
136 Static GPIB library.
137
138 %description static -l pl.UTF-8
139 Biblioteka statyczna GPIB.
140
141 %package -n guile-gpib
142 Summary:        Guile bindings for GPIB library
143 Summary(pl.UTF-8):      Wiązania Guile do biblioteki GPIB
144 Group:          Development/Languages/Perl
145 Requires:       %{pname}-libs = %{version}-%{release}
146 Requires:       guile-libs
147
148 %description -n guile-gpib
149 Guile bindings for GPIB library.
150
151 %description -n guile-gpib -l pl.UTF-8
152 Wiązania Guile do biblioteki GPIB.
153
154 %package -n perl-gpib
155 Summary:        Perl bindings for GPIB library
156 Summary(pl.UTF-8):      Wiązania Perla do biblioteki GPIB
157 Group:          Development/Languages/Perl
158 Requires:       %{pname}-libs = %{version}-%{release}
159
160 %description -n perl-gpib
161 Perl bindings for GPIB library.
162
163 %description -n perl-gpib -l pl.UTF-8
164 Wiązania Perla do biblioteki GPIB.
165
166 %package -n %{php_name}-gpib
167 Summary:        PHP bindings for GPIB library
168 Summary(pl.UTF-8):      Wiązania PHP do biblioteki GPIB
169 Group:          Development/Languages/PHP
170 Provides:       php(gpib) = %{version}
171 Requires:       %{pname}-libs = %{version}-%{release}
172 %{?requires_php_extension}
173
174 %description -n %{php_name}-gpib
175 PHP bindings for GPIB library.
176
177 %description -n %{php_name}-gpib -l pl.UTF-8
178 Wiązania PHP do biblioteki GPIB.
179
180 %package -n python-gpib
181 Summary:        Python 2 bindings for GPIB library
182 Summary(pl.UTF-8):      Wiązania Pythona 2 do biblioteki GPIB
183 Group:          Libraries/Python
184 Requires:       %{pname}-libs = %{version}-%{release}
185 Requires:       python-libs
186
187 %description -n python-gpib
188 Python 2 bindings for GPIB library.
189
190 %description -n python-gpib -l pl.UTF-8
191 Wiązania Pythona 2 do biblioteki GPIB.
192
193 %package -n python3-gpib
194 Summary:        Python 3 bindings for GPIB library
195 Summary(pl.UTF-8):      Wiązania Pythona 3 do biblioteki GPIB
196 Group:          Libraries/Python
197 Requires:       %{pname}-libs = %{version}-%{release}
198 Requires:       python3-libs
199
200 %description -n python3-gpib
201 Python 3 bindings for GPIB library.
202
203 %description -n python3-gpib -l pl.UTF-8
204 Wiązania Pythona 3 do biblioteki GPIB.
205
206 %package -n tcl-gpib
207 Summary:        Tcl bindings for GPIB library
208 Summary(pl.UTF-8):      Wiązania Tcl-a do biblioteki GPIB
209 Group:          Libraries
210 Requires:       %{pname}-libs = %{version}-%{release}
211 Requires:       tcl
212
213 %description -n tcl-gpib
214 Tcl bindings for GPIB library.
215
216 %description -n tcl-gpib -l pl.UTF-8
217 Wiązania Tcl-a do biblioteki GPIB.
218
219 %package doc
220 Summary:        Linux-GPIB tools and library documentation
221 Summary(pl.UTF-8):      Dokumentacja narzędzi i biblioteki Linux-GPIB
222 License:        GFDL v1.2+ or GPL v2+
223 Group:          Documentation
224
225 %description doc
226 Linux-GPIB tools and library documentation.
227
228 %description doc -l pl.UTF-8
229 Dokumentacja narzędzi i biblioteki Linux-GPIB.
230
231 %define kernel_pkg()\
232 %package -n kernel%{_alt_kernel}-gpib\
233 Summary:        Linux GPIB drivers\
234 Summary(pl.UTF-8):      Sterowniki GPIB dla Linuksa\
235 Release:        %{rel}@%{_kernel_ver_str}\
236 Group:          Base/Kernel\
237 Requires(post,postun):  /sbin/depmod\
238 %requires_releq_kernel\
239 Requires(postun):       %releq_kernel\
240 \
241 %description -n kernel%{_alt_kernel}-gpib\
242 This package contains Linux drivers for GPIB (IEEE 488) hardware.\
243 \
244 %description -n kernel%{_alt_kernel}-gpib -l pl.UTF-8\
245 Ten pakiet zawiera sterowniki dla Linuksa do urządzeń GPIB (IEEE 488).\
246 \
247 %if %{with kernel}\
248 %files -n kernel%{_alt_kernel}-gpib\
249 %defattr(644,root,root,755)\
250 /lib/modules/%{_kernel_ver}/kernel/gpib\
251 %endif\
252 \
253 %post -n kernel%{_alt_kernel}-gpib\
254 %depmod %{_kernel_ver}\
255 \
256 %postun -n kernel%{_alt_kernel}-gpib\
257 %depmod %{_kernel_ver}\
258 %{nil}
259
260 %define build_kernel_pkg()\
261 %{__make} VERBOSE=1 LINUX_SRCDIR=%{_kernelsrcdir} clean\
262 %{__make} VERBOSE=1 LINUX_SRCDIR=%{_kernelsrcdir}\
263 cd drivers/gpib\
264 %if %{_kernel_version_code} < %{_kernel_version_magic 5 10 0}\
265 %if %{with drivers_usb}\
266 %install_kernel_modules -D installed -m lpvo_usb_gpib/lpvo_usb_gpib -d kernel/gpib\
267 %endif\
268 %endif\
269 %ifarch %{ix86}\
270 %install_kernel_modules -D installed -m agilent_82350b/agilent_82350b,cb7210/cb7210,cec/cec_gpib,hp_82335/hp82335,ines/ines_gpib,nec7210/nec7210,sys/gpib_common,tms9914/tms9914,tnt4882/tnt4882%{?with_drivers_isa:,pc2/pc2_gpib}%{?with_drivers_usb:,agilent_82357a/agilent_82357a,ni_usb/ni_usb_gpib} -d kernel/gpib\
271 %else\
272 %install_kernel_modules -D installed -m agilent_82350b/agilent_82350b,cb7210/cb7210,cec/cec_gpib,hp_82335/hp82335,hp_82341/hp_82341,ines/ines_gpib,nec7210/nec7210,sys/gpib_common,tms9914/tms9914,tnt4882/tnt4882%{?with_drivers_isa:,pc2/pc2_gpib}%{?with_drivers_usb:,agilent_82357a/agilent_82357a,ni_usb/ni_usb_gpib} -d kernel/gpib\
273 %endif\
274 cd ../..\
275 %{nil}
276
277 %define install_kernel_pkg()\
278 %{nil}
279
280 %{?with_kernel:%{expand:%create_kernel_packages}}
281
282 %prep
283 %setup -q -n %{pname}-%{version}
284 %if %{with userspace}
285 tar xzf linux-gpib-user-%{version}.tar.gz
286 cd linux-gpib-user-%{version}
287 %patch2 -p1
288 %patch3 -p1
289 %patch4 -p1
290 %patch5 -p1
291 #%patch6 -p1
292 %patch10 -p1
293 %patch11 -p1
294 cd ..
295 %endif
296
297 %if %{with kernel}
298 tar xzf linux-gpib-kernel-%{version}.tar.gz
299 cd linux-gpib-kernel-%{version}
300 %patch9 -p1
301 %ifarch %{ix86}
302 %patch8 -p1
303 %endif
304 %patch12 -p1
305 %endif
306
307 %build
308 %if %{with userspace}
309 cd linux-gpib-user-%{version}
310 %{__libtoolize}
311 %{__aclocal}
312 %{__autoconf}
313 %{__autoheader}
314 %{__automake}
315 %if %{with guile}
316 CPPFLAGS="%{rpmcppflags} -I/usr/include/guile/3.0"
317 %endif
318 %configure \
319         --with-udev-libdir=/lib/udev \
320         %{!?with_doc:--disable-documentation} \
321         %{!?with_guile:--disable-guile-binding} \
322         %{!?with_perl:--disable-perl-binding} \
323         %{!?with_php:--disable-php-binding} \
324         %{!?with_python:--disable-python-binding} \
325         %{?with_static_libs:--enable-static} \
326         %{!?with_tcl:--disable-tcl-binding}
327
328 %{__make}
329
330 %if %{with python2}
331 cd language/python
332 %py_build
333 cd ../..
334 %endif
335 cd ..
336 %endif
337
338 %if %{with kernel}
339 cd linux-gpib-kernel-%{version}
340 %{expand:%build_kernel_packages}
341 %endif
342
343 %install
344 rm -rf $RPM_BUILD_ROOT
345 install -d $RPM_BUILD_ROOT%{_examplesdir}
346
347 %if %{with kernel}
348 cd linux-gpib-kernel-%{version}
349 %{expand:%install_kernel_packages}
350 cp -a drivers/gpib/installed/* $RPM_BUILD_ROOT
351 cd ..
352 %endif
353
354 %if %{with userspace}
355 cd linux-gpib-user-%{version}
356 %{__make} install \
357         DESTDIR=$RPM_BUILD_ROOT \
358         HOTPLUG_USB_CONF_DIR=/lib/udev \
359         UDEV_RULES_DIR=/lib/udev/rules.d \
360         USB_FIRMWARE_DIR=/lib/firmware
361
362 %if %{with python2}
363 cd language/python
364 %py_install
365 cd ../..
366 %endif
367
368 %if %{with hotplug}
369 # use udev paths as base and legacy hotplug as addon (not the opposite)
370 install -d $RPM_BUILD_ROOT/etc/hotplug/usb
371 %{__mv} $RPM_BUILD_ROOT/lib/udev/*.usermap $RPM_BUILD_ROOT/etc/hotplug/usb
372 ln -snf /lib/udev/agilent_82357a $RPM_BUILD_ROOT/etc/hotplug/usb/agilent_82357a
373 ln -snf /lib/udev/ni_usb_gpib $RPM_BUILD_ROOT/etc/hotplug/usb/ni_usb_gpib
374 %endif
375
376 # obsoleted by pkg-config
377 %{__rm} $RPM_BUILD_ROOT%{_libdir}/libgpib.la
378
379 %if %{with guile}
380 %{__rm} $RPM_BUILD_ROOT%{_libdir}/libgpib-guile.la
381 %if %{with static_libs}
382 %{__rm} $RPM_BUILD_ROOT%{_libdir}/libgpib-guile.a
383 %endif
384 %endif
385
386 %if %{with perl}
387 %{__make} -C language/perl pure_install \
388         DESTDIR=$RPM_BUILD_ROOT
389
390 cp -pr language/perl/examples $RPM_BUILD_ROOT%{_examplesdir}/perl-gpib-%{version}
391
392 %{__rm} -f $RPM_BUILD_ROOT%{perl_vendorarch}/auto/LinuxGpib/.packlist
393 %endif
394
395 %if %{with php}
396 install -d $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d
397 cat <<'EOF' > $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d/gpib.ini
398 ; Enable gpib extension module
399 extension=gpib_php.so
400 EOF
401
402 %{__rm} $RPM_BUILD_ROOT%{php_extensiondir}/gpib_php.la
403 %if %{with static_libs}
404 %{__rm} $RPM_BUILD_ROOT%{php_extensiondir}/gpib_php.a
405 %endif
406 %endif
407
408 %if %{with python}
409 %py_postclean
410 %endif
411
412 %if %{with tcl}
413 cp -pr language/tcl/examples $RPM_BUILD_ROOT%{_examplesdir}/tcl-gpib-%{version}
414
415 %{__rm} $RPM_BUILD_ROOT%{_libdir}/libgpib_tcl.la
416 %if %{with static_libs}
417 %{__rm} $RPM_BUILD_ROOT%{_libdir}/libgpib_tcl.a
418 %endif
419 %endif
420
421 %if %{with doc}
422 # packaged as %doc
423 %{__rm} -r $RPM_BUILD_ROOT%{_datadir}/linux-gpib-user/html
424 %endif
425 %endif
426
427 %clean
428 rm -rf $RPM_BUILD_ROOT
429
430 %post   libs -p /sbin/ldconfig
431 %postun libs -p /sbin/ldconfig
432
433 %post   -n guile-gpib -p /sbin/ldconfig
434 %postun -n guile-gpib -p /sbin/ldconfig
435
436 %post   -n tcl-gpib -p /sbin/ldconfig
437 %postun -n tcl-gpib -p /sbin/ldconfig
438
439 %post   -n %{php_name}-gpib
440 %php_webserver_restart
441
442 %postun -n %{php_name}-gpib
443 if [ "$1" = 0 ]; then
444         %php_webserver_restart
445 fi
446
447 %if %{with userspace}
448 %files
449 %defattr(644,root,root,755)
450 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/gpib.conf
451 %attr(755,root,root) %{_bindir}/ibterm
452 %attr(755,root,root) %{_bindir}/ibtest
453 %attr(755,root,root) %{_bindir}/findlisteners
454 %attr(755,root,root) %{_sbindir}/gpib_config
455 /lib/udev/rules.d/98-gpib-generic.rules
456 /lib/udev/rules.d/99-agilent_82357a.rules
457 /lib/udev/rules.d/99-lpvo_usb_gpib.rules
458 /lib/udev/rules.d/99-ni_usb_gpib.rules
459 %attr(755,root,root) /lib/udev/gpib_udev_config
460 %attr(755,root,root) /lib/udev/gpib_udev_fxloader
461 %attr(755,root,root) /lib/udev/gpib_udevadm_wrapper
462
463 %if %{with hotplug}
464 %files hotplug
465 %defattr(644,root,root,755)
466 %attr(755,root,root) /etc/hotplug/usb/agilent_82357a
467 %attr(755,root,root) /etc/hotplug/usb/ni_usb_gpib
468 /etc/hotplug/usb/agilent_82357a.usermap
469 /etc/hotplug/usb/ni_usb_gpib.usermap
470 %endif
471
472 %files libs
473 %defattr(644,root,root,755)
474 %doc linux-gpib-user-%{version}/{AUTHORS,ChangeLog,README,README.HAMEG,README.hp82335,TODO}
475 %attr(755,root,root) %{_libdir}/libgpib.so.*.*.*
476 %attr(755,root,root) %ghost %{_libdir}/libgpib.so.0
477
478 %files devel
479 %defattr(644,root,root,755)
480 %attr(755,root,root) %{_libdir}/libgpib.so
481 %{_includedir}/gpib
482 %{_pkgconfigdir}/libgpib.pc
483
484 %if %{with static_libs}
485 %files static
486 %defattr(644,root,root,755)
487 %{_libdir}/libgpib.a
488 %endif
489
490 %if %{with guile}
491 %files -n guile-gpib
492 %defattr(644,root,root,755)
493 %attr(755,root,root) %{_libdir}/libgpib-guile-%{version}.so
494 %attr(755,root,root) %{_libdir}/libgpib-guile.so
495 %endif
496
497 %if %{with perl}
498 %files -n perl-gpib
499 %defattr(644,root,root,755)
500 %doc linux-gpib-user-%{version}/language/perl/{Changes,README}
501 %{perl_vendorarch}/LinuxGpib.pm
502 %dir %{perl_vendorarch}/auto/LinuxGpib
503 %attr(755,root,root) %{perl_vendorarch}/auto/LinuxGpib/LinuxGpib.so
504 %{perl_vendorarch}/auto/LinuxGpib/autosplit.ix
505 %{_mandir}/man3/LinuxGpib.3pm*
506 %{_examplesdir}/perl-gpib-%{version}
507 %endif
508
509 %if %{with php}
510 %files -n %{php_name}-gpib
511 %defattr(644,root,root,755)
512 %config(noreplace) %verify(not md5 mtime size) %{php_sysconfdir}/conf.d/gpib.ini
513 %attr(755,root,root) %{php_extensiondir}/gpib_php-%{version}.so
514 %attr(755,root,root) %{php_extensiondir}/gpib_php.so
515 %endif
516
517 %if %{with python2}
518 %files -n python-gpib
519 %defattr(644,root,root,755)
520 %doc linux-gpib-user-%{version}/language/python/README
521 %attr(755,root,root) %{py_sitedir}/gpib.so
522 %{py_sitedir}/Gpib.py[co]
523 %{py_sitedir}/gpib-1.0-py*.egg-info
524 %endif
525
526 %if %{with python}
527 %files -n python3-gpib
528 %defattr(644,root,root,755)
529 %doc linux-gpib-user-%{version}/language/python/README
530 %attr(755,root,root) %{py3_sitedir}/gpib.cpython-*.so
531 %{py3_sitedir}/Gpib.py
532 %{py3_sitedir}/__pycache__/Gpib.cpython-*.py[co]
533 %{py3_sitedir}/gpib-1.0-py*.egg-info
534 %endif
535
536 %if %{with tcl}
537 %files -n tcl-gpib
538 %defattr(644,root,root,755)
539 %doc linux-gpib-user-%{version}/language/tcl/README
540 %attr(755,root,root) %{_libdir}/libgpib_tcl-%{version}.so
541 %attr(755,root,root) %{_libdir}/libgpib_tcl.so
542 %{_examplesdir}/tcl-gpib-%{version}
543 %endif
544
545 %if %{with doc}
546 %files doc
547 %defattr(644,root,root,755)
548 %doc linux-gpib-user-%{version}/doc/doc_html/*
549 %endif
550 %endif
This page took 0.110236 seconds and 4 git commands to generate.