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 URL: http://linux-gpib.sourceforge.net/
63 BuildRequires: autoconf >= 2.50
64 BuildRequires: automake
65 BuildRequires: libtool
66 BuildRequires: rpmbuild(macros) >= 1.745
67 %{?with_kernel:%{expand:%buildrequires_kernel kernel%%{_alt_kernel}-module-build >= 3:2.6.32}}
70 %{?with_doc:BuildRequires: docbook-utils}
72 %{?with_guile:BuildRequires: guile-devel >= 1.4}
73 %{?with_perl:BuildRequires: perl-devel}
74 %{?with_php:BuildRequires: %{php_name}-devel >= 3:5}
75 %{?with_python:BuildRequires: python-devel >= 2}
76 BuildRequires: readline-devel
77 %{?with_tcl:BuildRequires: tcl-devel}
79 Requires: %{pname}-libs = %{version}-%{release}
80 # for agilent_82357a and ni_usb_gpib
82 # for agilent_82357a, agilent/hp_82341, agilent/hp_82350a, ni_usb_gpib
83 Suggests: linux-gpib-firmware
84 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
87 The Linux GPIB package provides support for GPIB (IEEE 488) hardware.
89 %description -l pl.UTF-8
90 Pakiet Linux GPIB służy do obsługi sprzętu GPIB (IEEE 488).
93 Summary: Linux GPIB support for legacy USB hotplug
94 Summary(pl.UTF-8): Obsługa Linux GPIB dla starego systemu hotplug USB
95 Group: Applications/System
96 Requires: %{pname} = %{version}-%{release}
100 Linux GPIB support for legacy USB hotplug.
102 %description hotplug -l pl.UTF-8
103 Obsługa Linux GPIB dla starego systemu hotplug USB.
106 Summary: Shared GPIB library
107 Summary(pl.UTF-8): Biblioteka współdzielona GPIB
113 %description libs -l pl.UTF-8
114 Biblioteka współdzielona GPIB.
117 Summary: Header file for GPIB library
118 Summary(pl.UTF-8): Plik nagłówkowy biblioteki GPIB
119 Group: Development/Libraries
120 Requires: %{pname}-libs = %{version}-%{release}
123 Header file for GPIB library.
125 %description devel -l pl.UTF-8
126 Plik nagłówkowy biblioteki GPIB.
129 Summary: Static GPIB library
130 Summary(pl.UTF-8): Biblioteka statyczna GPIB
131 Group: Development/Libraries
132 Requires: %{pname}-devel = %{version}-%{release}
137 %description static -l pl.UTF-8
138 Biblioteka statyczna GPIB.
140 %package -n guile-gpib
141 Summary: Guile bindings for GPIB library
142 Summary(pl.UTF-8): Wiązania Guile do biblioteki GPIB
143 Group: Development/Languages/Perl
144 Requires: %{pname}-libs = %{version}-%{release}
147 %description -n guile-gpib
148 Guile bindings for GPIB library.
150 %description -n guile-gpib -l pl.UTF-8
151 Wiązania Guile do biblioteki GPIB.
153 %package -n perl-gpib
154 Summary: Perl bindings for GPIB library
155 Summary(pl.UTF-8): Wiązania Perla do biblioteki GPIB
156 Group: Development/Languages/Perl
157 Requires: %{pname}-libs = %{version}-%{release}
159 %description -n perl-gpib
160 Perl bindings for GPIB library.
162 %description -n perl-gpib -l pl.UTF-8
163 Wiązania Perla do biblioteki GPIB.
165 %package -n %{php_name}-gpib
166 Summary: PHP bindings for GPIB library
167 Summary(pl.UTF-8): Wiązania PHP do biblioteki GPIB
168 Group: Development/Languages/PHP
169 Provides: php(gpib) = %{version}
170 Requires: %{pname}-libs = %{version}-%{release}
171 %{?requires_php_extension}
173 %description -n %{php_name}-gpib
174 PHP bindings for GPIB library.
176 %description -n %{php_name}-gpib -l pl.UTF-8
177 Wiązania PHP do biblioteki GPIB.
179 %package -n python-gpib
180 Summary: Python 2 bindings for GPIB library
181 Summary(pl.UTF-8): Wiązania Pythona 2 do biblioteki GPIB
182 Group: Libraries/Python
183 Requires: %{pname}-libs = %{version}-%{release}
184 Requires: python-libs
186 %description -n python-gpib
187 Python 2 bindings for GPIB library.
189 %description -n python-gpib -l pl.UTF-8
190 Wiązania Pythona 2 do biblioteki GPIB.
192 %package -n python3-gpib
193 Summary: Python 3 bindings for GPIB library
194 Summary(pl.UTF-8): Wiązania Pythona 3 do biblioteki GPIB
195 Group: Libraries/Python
196 Requires: %{pname}-libs = %{version}-%{release}
197 Requires: python3-libs
199 %description -n python3-gpib
200 Python 3 bindings for GPIB library.
202 %description -n python3-gpib -l pl.UTF-8
203 Wiązania Pythona 3 do biblioteki GPIB.
206 Summary: Tcl bindings for GPIB library
207 Summary(pl.UTF-8): Wiązania Tcl-a do biblioteki GPIB
209 Requires: %{pname}-libs = %{version}-%{release}
212 %description -n tcl-gpib
213 Tcl bindings for GPIB library.
215 %description -n tcl-gpib -l pl.UTF-8
216 Wiązania Tcl-a do biblioteki GPIB.
219 Summary: Linux-GPIB tools and library documentation
220 Summary(pl.UTF-8): Dokumentacja narzędzi i biblioteki Linux-GPIB
221 License: GFDL v1.2+ or GPL v2+
225 Linux-GPIB tools and library documentation.
227 %description doc -l pl.UTF-8
228 Dokumentacja narzędzi i biblioteki Linux-GPIB.
230 %define kernel_pkg()\
231 %package -n kernel%{_alt_kernel}-gpib\
232 Summary: Linux GPIB drivers\
233 Summary(pl.UTF-8): Sterowniki GPIB dla Linuksa\
234 Release: %{rel}@%{_kernel_ver_str}\
236 Requires(post,postun): /sbin/depmod\
237 %requires_releq_kernel\
238 Requires(postun): %releq_kernel\
240 %description -n kernel%{_alt_kernel}-gpib\
241 This package contains Linux drivers for GPIB (IEEE 488) hardware.\
243 %description -n kernel%{_alt_kernel}-gpib -l pl.UTF-8\
244 Ten pakiet zawiera sterowniki dla Linuksa do urządzeń GPIB (IEEE 488).\
247 %files -n kernel%{_alt_kernel}-gpib\
248 %defattr(644,root,root,755)\
249 /lib/modules/%{_kernel_ver}/kernel/gpib\
252 %post -n kernel%{_alt_kernel}-gpib\
253 %depmod %{_kernel_ver}\
255 %postun -n kernel%{_alt_kernel}-gpib\
256 %depmod %{_kernel_ver}\
259 %define build_kernel_pkg()\
260 %{__make} VERBOSE=1 LINUX_SRCDIR=%{_kernelsrcdir} clean\
261 %{__make} VERBOSE=1 LINUX_SRCDIR=%{_kernelsrcdir}\
263 %if %{_kernel_version_code} < %{_kernel_version_magic 5 10 0}\
264 %if %{with drivers_usb}\
265 %install_kernel_modules -D installed -m lpvo_usb_gpib/lpvo_usb_gpib -d kernel/gpib\
269 %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 %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\
276 %define install_kernel_pkg()\
279 %{?with_kernel:%{expand:%create_kernel_packages}}
282 %setup -q -n %{pname}-%{version}
283 %if %{with userspace}
284 tar xzf linux-gpib-user-%{version}.tar.gz
285 cd linux-gpib-user-%{version}
297 tar xzf linux-gpib-kernel-%{version}.tar.gz
298 cd linux-gpib-kernel-%{version}
306 %if %{with userspace}
307 cd linux-gpib-user-%{version}
314 CPPFLAGS="%{rpmcppflags} -I/usr/include/guile/3.0"
317 --with-udev-libdir=/lib/udev \
318 %{!?with_doc:--disable-documentation} \
319 %{!?with_guile:--disable-guile-binding} \
320 %{!?with_perl:--disable-perl-binding} \
321 %{!?with_php:--disable-php-binding} \
322 %{!?with_python:--disable-python-binding} \
323 %{?with_static_libs:--enable-static} \
324 %{!?with_tcl:--disable-tcl-binding}
337 cd linux-gpib-kernel-%{version}
338 %{expand:%build_kernel_packages}
342 rm -rf $RPM_BUILD_ROOT
343 install -d $RPM_BUILD_ROOT%{_examplesdir}
346 cd linux-gpib-kernel-%{version}
347 %{expand:%install_kernel_packages}
348 cp -a drivers/gpib/installed/* $RPM_BUILD_ROOT
352 %if %{with userspace}
353 cd linux-gpib-user-%{version}
355 DESTDIR=$RPM_BUILD_ROOT \
356 HOTPLUG_USB_CONF_DIR=/lib/udev \
357 UDEV_RULES_DIR=/lib/udev/rules.d \
358 USB_FIRMWARE_DIR=/lib/firmware
367 # use udev paths as base and legacy hotplug as addon (not the opposite)
368 install -d $RPM_BUILD_ROOT/etc/hotplug/usb
369 %{__mv} $RPM_BUILD_ROOT/lib/udev/*.usermap $RPM_BUILD_ROOT/etc/hotplug/usb
370 ln -snf /lib/udev/agilent_82357a $RPM_BUILD_ROOT/etc/hotplug/usb/agilent_82357a
371 ln -snf /lib/udev/ni_usb_gpib $RPM_BUILD_ROOT/etc/hotplug/usb/ni_usb_gpib
374 # obsoleted by pkg-config
375 %{__rm} $RPM_BUILD_ROOT%{_libdir}/libgpib.la
378 %{__rm} $RPM_BUILD_ROOT%{_libdir}/libgpib-guile.la
379 %if %{with static_libs}
380 %{__rm} $RPM_BUILD_ROOT%{_libdir}/libgpib-guile.a
385 %{__make} -C language/perl pure_install \
386 DESTDIR=$RPM_BUILD_ROOT
388 cp -pr language/perl/examples $RPM_BUILD_ROOT%{_examplesdir}/perl-gpib-%{version}
390 %{__rm} -f $RPM_BUILD_ROOT%{perl_vendorarch}/auto/LinuxGpib/.packlist
394 install -d $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d
395 cat <<'EOF' > $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d/gpib.ini
396 ; Enable gpib extension module
397 extension=gpib_php.so
400 %{__rm} $RPM_BUILD_ROOT%{php_extensiondir}/gpib_php.la
401 %if %{with static_libs}
402 %{__rm} $RPM_BUILD_ROOT%{php_extensiondir}/gpib_php.a
411 cp -pr language/tcl/examples $RPM_BUILD_ROOT%{_examplesdir}/tcl-gpib-%{version}
413 %{__rm} $RPM_BUILD_ROOT%{_libdir}/libgpib_tcl.la
414 %if %{with static_libs}
415 %{__rm} $RPM_BUILD_ROOT%{_libdir}/libgpib_tcl.a
421 %{__rm} -r $RPM_BUILD_ROOT%{_datadir}/linux-gpib-user/html
426 rm -rf $RPM_BUILD_ROOT
428 %post libs -p /sbin/ldconfig
429 %postun libs -p /sbin/ldconfig
431 %post -n guile-gpib -p /sbin/ldconfig
432 %postun -n guile-gpib -p /sbin/ldconfig
434 %post -n tcl-gpib -p /sbin/ldconfig
435 %postun -n tcl-gpib -p /sbin/ldconfig
437 %post -n %{php_name}-gpib
438 %php_webserver_restart
440 %postun -n %{php_name}-gpib
441 if [ "$1" = 0 ]; then
442 %php_webserver_restart
445 %if %{with userspace}
447 %defattr(644,root,root,755)
448 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/gpib.conf
449 %attr(755,root,root) %{_bindir}/ibterm
450 %attr(755,root,root) %{_bindir}/ibtest
451 %attr(755,root,root) %{_bindir}/findlisteners
452 %attr(755,root,root) %{_sbindir}/gpib_config
453 /lib/udev/rules.d/98-gpib-generic.rules
454 /lib/udev/rules.d/99-agilent_82357a.rules
455 /lib/udev/rules.d/99-lpvo_usb_gpib.rules
456 /lib/udev/rules.d/99-ni_usb_gpib.rules
457 %attr(755,root,root) /lib/udev/gpib_udev_config
458 %attr(755,root,root) /lib/udev/gpib_udev_fxloader
459 %attr(755,root,root) /lib/udev/gpib_udevadm_wrapper
463 %defattr(644,root,root,755)
464 %attr(755,root,root) /etc/hotplug/usb/agilent_82357a
465 %attr(755,root,root) /etc/hotplug/usb/ni_usb_gpib
466 /etc/hotplug/usb/agilent_82357a.usermap
467 /etc/hotplug/usb/ni_usb_gpib.usermap
471 %defattr(644,root,root,755)
472 %doc linux-gpib-user-%{version}/{AUTHORS,ChangeLog,README,README.HAMEG,README.hp82335,TODO}
473 %attr(755,root,root) %{_libdir}/libgpib.so.*.*.*
474 %attr(755,root,root) %ghost %{_libdir}/libgpib.so.0
477 %defattr(644,root,root,755)
478 %attr(755,root,root) %{_libdir}/libgpib.so
480 %{_pkgconfigdir}/libgpib.pc
482 %if %{with static_libs}
484 %defattr(644,root,root,755)
490 %defattr(644,root,root,755)
491 %attr(755,root,root) %{_libdir}/libgpib-guile-%{version}.so
492 %attr(755,root,root) %{_libdir}/libgpib-guile.so
497 %defattr(644,root,root,755)
498 %doc linux-gpib-user-%{version}/language/perl/{Changes,README}
499 %{perl_vendorarch}/LinuxGpib.pm
500 %dir %{perl_vendorarch}/auto/LinuxGpib
501 %attr(755,root,root) %{perl_vendorarch}/auto/LinuxGpib/LinuxGpib.so
502 %{perl_vendorarch}/auto/LinuxGpib/autosplit.ix
503 %{_mandir}/man3/LinuxGpib.3pm*
504 %{_examplesdir}/perl-gpib-%{version}
508 %files -n %{php_name}-gpib
509 %defattr(644,root,root,755)
510 %config(noreplace) %verify(not md5 mtime size) %{php_sysconfdir}/conf.d/gpib.ini
511 %attr(755,root,root) %{php_extensiondir}/gpib_php-%{version}.so
512 %attr(755,root,root) %{php_extensiondir}/gpib_php.so
516 %files -n python-gpib
517 %defattr(644,root,root,755)
518 %doc linux-gpib-user-%{version}/language/python/README
519 %attr(755,root,root) %{py_sitedir}/gpib.so
520 %{py_sitedir}/Gpib.py[co]
521 %{py_sitedir}/gpib-1.0-py*.egg-info
525 %files -n python3-gpib
526 %defattr(644,root,root,755)
527 %doc linux-gpib-user-%{version}/language/python/README
528 %attr(755,root,root) %{py3_sitedir}/gpib.cpython-*.so
529 %{py3_sitedir}/Gpib.py
530 %{py3_sitedir}/__pycache__/Gpib.cpython-*.py[co]
531 %{py3_sitedir}/gpib-1.0-py*.egg-info
536 %defattr(644,root,root,755)
537 %doc linux-gpib-user-%{version}/language/tcl/README
538 %attr(755,root,root) %{_libdir}/libgpib_tcl-%{version}.so
539 %attr(755,root,root) %{_libdir}/libgpib_tcl.so
540 %{_examplesdir}/tcl-gpib-%{version}
545 %defattr(644,root,root,755)
546 %doc linux-gpib-user-%{version}/doc/doc_html/*