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)
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
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}
28 %if %{without userspace}
29 # nothing to be placed to debuginfo package
30 %define _enable_debug_packages 0
34 %undefine with_drivers_isa
37 %undefine with_python2
40 %define php_name php%{?php_suffix}
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}
48 Release: %{rel}%{?_pld_builder:%{?with_kernel:@%{_kernel_ver_str}}}
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}}
71 %{?with_doc:BuildRequires: docbook-utils}
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}
80 Requires: %{pname}-libs = %{version}-%{release}
81 # for agilent_82357a and ni_usb_gpib
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)
88 The Linux GPIB package provides support for GPIB (IEEE 488) hardware.
90 %description -l pl.UTF-8
91 Pakiet Linux GPIB służy do obsługi sprzętu GPIB (IEEE 488).
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}
101 Linux GPIB support for legacy USB hotplug.
103 %description hotplug -l pl.UTF-8
104 Obsługa Linux GPIB dla starego systemu hotplug USB.
107 Summary: Shared GPIB library
108 Summary(pl.UTF-8): Biblioteka współdzielona GPIB
114 %description libs -l pl.UTF-8
115 Biblioteka współdzielona GPIB.
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}
124 Header file for GPIB library.
126 %description devel -l pl.UTF-8
127 Plik nagłówkowy biblioteki GPIB.
130 Summary: Static GPIB library
131 Summary(pl.UTF-8): Biblioteka statyczna GPIB
132 Group: Development/Libraries
133 Requires: %{pname}-devel = %{version}-%{release}
138 %description static -l pl.UTF-8
139 Biblioteka statyczna GPIB.
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}
148 %description -n guile-gpib
149 Guile bindings for GPIB library.
151 %description -n guile-gpib -l pl.UTF-8
152 Wiązania Guile do biblioteki GPIB.
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}
160 %description -n perl-gpib
161 Perl bindings for GPIB library.
163 %description -n perl-gpib -l pl.UTF-8
164 Wiązania Perla do biblioteki GPIB.
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}
174 %description -n %{php_name}-gpib
175 PHP bindings for GPIB library.
177 %description -n %{php_name}-gpib -l pl.UTF-8
178 Wiązania PHP do biblioteki GPIB.
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
187 %description -n python-gpib
188 Python 2 bindings for GPIB library.
190 %description -n python-gpib -l pl.UTF-8
191 Wiązania Pythona 2 do biblioteki GPIB.
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
200 %description -n python3-gpib
201 Python 3 bindings for GPIB library.
203 %description -n python3-gpib -l pl.UTF-8
204 Wiązania Pythona 3 do biblioteki GPIB.
207 Summary: Tcl bindings for GPIB library
208 Summary(pl.UTF-8): Wiązania Tcl-a do biblioteki GPIB
210 Requires: %{pname}-libs = %{version}-%{release}
213 %description -n tcl-gpib
214 Tcl bindings for GPIB library.
216 %description -n tcl-gpib -l pl.UTF-8
217 Wiązania Tcl-a do biblioteki GPIB.
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+
226 Linux-GPIB tools and library documentation.
228 %description doc -l pl.UTF-8
229 Dokumentacja narzędzi i biblioteki Linux-GPIB.
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}\
237 Requires(post,postun): /sbin/depmod\
238 %requires_releq_kernel\
239 Requires(postun): %releq_kernel\
241 %description -n kernel%{_alt_kernel}-gpib\
242 This package contains Linux drivers for GPIB (IEEE 488) hardware.\
244 %description -n kernel%{_alt_kernel}-gpib -l pl.UTF-8\
245 Ten pakiet zawiera sterowniki dla Linuksa do urządzeń GPIB (IEEE 488).\
248 %files -n kernel%{_alt_kernel}-gpib\
249 %defattr(644,root,root,755)\
250 /lib/modules/%{_kernel_ver}/kernel/gpib\
253 %post -n kernel%{_alt_kernel}-gpib\
254 %depmod %{_kernel_ver}\
256 %postun -n kernel%{_alt_kernel}-gpib\
257 %depmod %{_kernel_ver}\
260 %define build_kernel_pkg()\
261 %{__make} VERBOSE=1 LINUX_SRCDIR=%{_kernelsrcdir} clean\
262 %{__make} VERBOSE=1 LINUX_SRCDIR=%{_kernelsrcdir}\
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\
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\
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\
277 %define install_kernel_pkg()\
280 %{?with_kernel:%{expand:%create_kernel_packages}}
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}
298 tar xzf linux-gpib-kernel-%{version}.tar.gz
299 cd linux-gpib-kernel-%{version}
308 %if %{with userspace}
309 cd linux-gpib-user-%{version}
316 CPPFLAGS="%{rpmcppflags} -I/usr/include/guile/3.0"
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}
339 cd linux-gpib-kernel-%{version}
340 %{expand:%build_kernel_packages}
344 rm -rf $RPM_BUILD_ROOT
345 install -d $RPM_BUILD_ROOT%{_examplesdir}
348 cd linux-gpib-kernel-%{version}
349 %{expand:%install_kernel_packages}
350 cp -a drivers/gpib/installed/* $RPM_BUILD_ROOT
354 %if %{with userspace}
355 cd linux-gpib-user-%{version}
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
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
376 # obsoleted by pkg-config
377 %{__rm} $RPM_BUILD_ROOT%{_libdir}/libgpib.la
380 %{__rm} $RPM_BUILD_ROOT%{_libdir}/libgpib-guile.la
381 %if %{with static_libs}
382 %{__rm} $RPM_BUILD_ROOT%{_libdir}/libgpib-guile.a
387 %{__make} -C language/perl pure_install \
388 DESTDIR=$RPM_BUILD_ROOT
390 cp -pr language/perl/examples $RPM_BUILD_ROOT%{_examplesdir}/perl-gpib-%{version}
392 %{__rm} -f $RPM_BUILD_ROOT%{perl_vendorarch}/auto/LinuxGpib/.packlist
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
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
413 cp -pr language/tcl/examples $RPM_BUILD_ROOT%{_examplesdir}/tcl-gpib-%{version}
415 %{__rm} $RPM_BUILD_ROOT%{_libdir}/libgpib_tcl.la
416 %if %{with static_libs}
417 %{__rm} $RPM_BUILD_ROOT%{_libdir}/libgpib_tcl.a
423 %{__rm} -r $RPM_BUILD_ROOT%{_datadir}/linux-gpib-user/html
428 rm -rf $RPM_BUILD_ROOT
430 %post libs -p /sbin/ldconfig
431 %postun libs -p /sbin/ldconfig
433 %post -n guile-gpib -p /sbin/ldconfig
434 %postun -n guile-gpib -p /sbin/ldconfig
436 %post -n tcl-gpib -p /sbin/ldconfig
437 %postun -n tcl-gpib -p /sbin/ldconfig
439 %post -n %{php_name}-gpib
440 %php_webserver_restart
442 %postun -n %{php_name}-gpib
443 if [ "$1" = 0 ]; then
444 %php_webserver_restart
447 %if %{with userspace}
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
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
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
479 %defattr(644,root,root,755)
480 %attr(755,root,root) %{_libdir}/libgpib.so
482 %{_pkgconfigdir}/libgpib.pc
484 %if %{with static_libs}
486 %defattr(644,root,root,755)
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
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}
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
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
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
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}
547 %defattr(644,root,root,755)
548 %doc linux-gpib-user-%{version}/doc/doc_html/*