3 %bcond_without kernel # kernel modules
4 %bcond_without drivers_isa # ISA kernel drivers [ix86 only]
5 %bcond_without drivers_pcmcia # PCMCIA support in kernel drivers
6 %bcond_without drivers_usb # USB kernel drivers
7 %bcond_without userspace # userspace packages
8 %bcond_without verbose # verbose modules build (V=1)
10 %bcond_without docs # documentation build
11 %bcond_with hotplug # legacy hotplug support
12 %bcond_without static_libs # static library
13 %bcond_without guile # guile binding
14 %bcond_without perl # Perl binding
15 %bcond_with php # PHP binding
16 %bcond_without python # Python 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}
29 %undefine with_drivers_isa
30 %undefine with_drivers_pcmcia
33 %include /usr/lib/rpm/macros.perl
34 %define php_name php%{?php_suffix}
37 %define pname linux-gpib
38 Summary: GPIB (IEEE 488) Linux support
39 Summary(pl.UTF-8): Obsługa GPIB (IEEE 488) dla Linuksa
40 Name: %{pname}%{?_pld_builder:%{?with_kernel:-kernel}}%{_alt_kernel}
42 Release: %{rel}%{?_pld_builder:%{?with_kernel:@%{_kernel_ver_str}}}
44 Group: Applications/System
45 Source0: http://downloads.sourceforge.net/linux-gpib/%{pname}-%{version}.tar.gz
46 # Source0-md5: 0241dcc2d16f6d12a7aa2c3a623a55ff
47 Patch2: %{pname}-python.patch
48 Patch3: %{pname}-perl.patch
49 Patch4: %{pname}-firmwaredir.patch
50 Patch5: %{pname}-guile2.patch
51 Patch6: %{pname}-php7.patch
52 Patch7: kernel-5.0.patch
53 URL: http://linux-gpib.sourceforge.net/
54 BuildRequires: autoconf >= 2.50
55 BuildRequires: automake
56 BuildRequires: libtool
57 BuildRequires: rpmbuild(macros) >= 1.614
59 BuildRequires: kernel-module-build >= 3:2.6.8
63 %{?with_docs:BuildRequires: docbook-utils}
65 %{?with_guile:BuildRequires: guile-devel >= 1.4}
66 %{?with_perl:BuildRequires: perl-devel}
67 %{?with_php:BuildRequires: %{php_name}-devel >= 3:5}
68 %{?with_python:BuildRequires: python-devel >= 2}
69 BuildRequires: readline-devel
70 %{?with_tcl:BuildRequires: tcl-devel}
72 Requires: %{pname}-libs = %{version}-%{release}
73 # for agilent_82357a and ni_usb_gpib
75 # for agilent_82357a, agilent/hp_82341, agilent/hp_82350a, ni_usb_gpib
76 Suggests: linux-gpib-firmware
77 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
80 The Linux GPIB package provides support for GPIB (IEEE 488) hardware.
82 %description -l pl.UTF-8
83 Pakiet Linux GPIB służy do obsługi sprzętu GPIB (IEEE 488).
86 Summary: Linux GPIB support for legacy USB hotplug
87 Summary(pl.UTF-8): Obsługa Linux GPIB dla starego systemu hotplug USB
88 Group: Applications/System
89 Requires: %{pname} = %{version}-%{release}
93 Linux GPIB support for legacy USB hotplug.
95 %description hotplug -l pl.UTF-8
96 Obsługa Linux GPIB dla starego systemu hotplug USB.
99 Summary: Shared GPIB library
100 Summary(pl.UTF-8): Biblioteka współdzielona GPIB
106 %description libs -l pl.UTF-8
107 Biblioteka współdzielona GPIB.
110 Summary: Header file for GPIB library
111 Summary(pl.UTF-8): Plik nagłówkowy biblioteki GPIB
112 Group: Development/Libraries
113 Requires: %{pname}-libs = %{version}-%{release}
116 Header file for GPIB library.
118 %description devel -l pl.UTF-8
119 Plik nagłówkowy biblioteki GPIB.
122 Summary: Static GPIB library
123 Summary(pl.UTF-8): Biblioteka statyczna GPIB
124 Group: Development/Libraries
125 Requires: %{pname}-devel = %{version}-%{release}
130 %description static -l pl.UTF-8
131 Biblioteka statyczna GPIB.
133 %package -n guile-gpib
134 Summary: Guile bindings for GPIB library
135 Summary(pl.UTF-8): Wiązania Guile do biblioteki GPIB
136 Group: Development/Languages/Perl
137 Requires: %{pname}-libs = %{version}-%{release}
140 %description -n guile-gpib
141 Guile bindings for GPIB library.
143 %description -n guile-gpib -l pl.UTF-8
144 Wiązania Guile do biblioteki GPIB.
146 %package -n perl-gpib
147 Summary: Perl bindings for GPIB library
148 Summary(pl.UTF-8): Wiązania Perla do biblioteki GPIB
149 Group: Development/Languages/Perl
150 Requires: %{pname}-libs = %{version}-%{release}
152 %description -n perl-gpib
153 Perl bindings for GPIB library.
155 %description -n perl-gpib -l pl.UTF-8
156 Wiązania Perla do biblioteki GPIB.
158 %package -n %{php_name}-gpib
159 Summary: PHP bindings for GPIB library
160 Summary(pl.UTF-8): Wiązania PHP do biblioteki GPIB
161 Group: Development/Languages/PHP
162 Provides: php(gpib) = %{version}
163 Requires: %{pname}-libs = %{version}-%{release}
164 %{?requires_php_extension}
166 %description -n %{php_name}-gpib
167 PHP bindings for GPIB library.
169 %description -n %{php_name}-gpib -l pl.UTF-8
170 Wiązania PHP do biblioteki GPIB.
172 %package -n python-gpib
173 Summary: Python bindings for GPIB library
174 Summary(pl.UTF-8): Wiązania Pythona do biblioteki GPIB
175 Group: Libraries/Python
176 Requires: %{pname}-libs = %{version}-%{release}
177 Requires: python-libs
179 %description -n python-gpib
180 Python bindings for GPIB library.
182 %description -n python-gpib -l pl.UTF-8
183 Wiązania Pythona do biblioteki GPIB.
186 Summary: Tcl bindings for GPIB library
187 Summary(pl.UTF-8): Wiązania Tcl-a do biblioteki GPIB
189 Requires: %{pname}-libs = %{version}-%{release}
192 %description -n tcl-gpib
193 Tcl bindings for GPIB library.
195 %description -n tcl-gpib -l pl.UTF-8
196 Wiązania Tcl-a do biblioteki GPIB.
199 Summary: Linux-GPIB tools and library documentation
200 Summary(pl.UTF-8): Dokumentacja narzędzi i biblioteki Linux-GPIB
201 License: GFDL v1.2+ or GPL v2+
205 Linux-GPIB tools and library documentation.
207 %description doc -l pl.UTF-8
208 Dokumentacja narzędzi i biblioteki Linux-GPIB.
210 %define kernel_pkg()\
211 %package -n kernel%{_alt_kernel}-gpib\
212 Summary: Linux GPIB drivers\
213 Summary(pl.UTF-8): Sterowniki GPIB dla Linuksa\
214 Release: %{rel}@%{_kernel_ver_str}\
216 Requires(post,postun): /sbin/depmod\
217 %requires_releq_kernel\
218 Requires(postun): %releq_kernel\
220 %description -n kernel%{_alt_kernel}-gpib\
221 This package contains Linux drivers for GPIB (IEEE 488) hardware.\
223 %description -n kernel%{_alt_kernel}-gpib -l pl.UTF-8\
224 Ten pakiet zawiera sterowniki dla Linuksa do urządzeń GPIB (IEEE 488).\
227 %files -n kernel%{_alt_kernel}-gpib\
228 %defattr(644,root,root,755)\
229 /lib/modules/%{_kernel_ver}/kernel/gpib\
232 %post -n kernel%{_alt_kernel}-gpib\
233 %depmod %{_kernel_ver}\
235 %postun -n kernel%{_alt_kernel}-gpib\
236 %depmod %{_kernel_ver}\
239 %define build_kernel_pkg()\
241 %{?with_drivers_isa:--enable-isa} \\\
242 %{?with_drivers_pcmcia:--enable-pcmcia} \\\
243 %{!?with_docs:--disable-documentation} \\\
244 %{!?with_guile:--disable-guile-binding} \\\
245 %{!?with_perl:--disable-perl-binding} \\\
246 %{!?with_python:--disable-python-binding} \\\
247 %{!?with_tcl:--disable-tcl-binding} \\\
248 --with-linux-srcdir=%{_kernelsrcdir}\
251 %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,lpvo_usb_gpib/lpvo_usb_gpib,ni_usb/ni_usb_gpib} -d kernel/gpib\
255 %define install_kernel_pkg()\
258 %{?with_kernel:%{expand:%create_kernel_packages}}
261 %setup -q -n %{pname}-%{version}
262 %if %{with userspace}
263 tar xzf linux-gpib-user-%{version}.tar.gz
264 cd linux-gpib-user-%{version}
274 tar xzf linux-gpib-kernel-%{version}.tar.gz
275 cd linux-gpib-kernel-%{version}
278 # disable modules build by default, just install userspace header
279 echo 'SUBDIRS = gpib/include' > drivers/Makefile.am
281 # need to inject -I options before $(LINUXINCLUDE), the simplest way is to override CC
282 for f in drivers/gpib/*/Makefile ; do
283 echo 'override CC += $(EARLYCPPFLAGS)' >> $f
288 %if %{with userspace}
289 cd linux-gpib-user-%{version}
296 CPPFLAGS="%{rpmcppflags} -I/usr/include/guile/2.0"
299 %{?with_drivers_isa:--enable-isa} \
300 %{?with_drivers_pcmcia:--enable-pcmcia} \
301 %{!?with_docs:--disable-documentation} \
302 %{!?with_guile:--disable-guile-binding} \
303 %{!?with_perl:--disable-perl-binding} \
304 %{!?with_php:--disable-php-binding} \
305 %{!?with_python:--disable-python-binding} \
306 %{?with_static_libs:--enable-static} \
307 %{!?with_tcl:--disable-tcl-binding}
314 cd linux-gpib-kernel-%{version}
315 %{expand:%build_kernel_packages}
319 rm -rf $RPM_BUILD_ROOT
320 install -d $RPM_BUILD_ROOT%{_examplesdir}
323 cd linux-gpib-kernel-%{version}
324 %{expand:%install_kernel_packages}
325 cp -a drivers/gpib/installed/* $RPM_BUILD_ROOT
329 %if %{with userspace}
330 cd linux-gpib-user-%{version}
332 DESTDIR=$RPM_BUILD_ROOT \
333 HOTPLUG_USB_CONF_DIR=/lib/udev \
334 UDEV_RULES_DIR=/lib/udev/rules.d \
335 USB_FIRMWARE_DIR=/lib/firmware
338 # use udev paths as base and legacy hotplug as addon (not the opposite)
339 install -d $RPM_BUILD_ROOT/etc/hotplug/usb
340 %{__mv} $RPM_BUILD_ROOT/lib/udev/*.usermap $RPM_BUILD_ROOT/etc/hotplug/usb
341 ln -snf /lib/udev/agilent_82357a $RPM_BUILD_ROOT/etc/hotplug/usb/agilent_82357a
342 ln -snf /lib/udev/ni_usb_gpib $RPM_BUILD_ROOT/etc/hotplug/usb/ni_usb_gpib
344 %{__rm} $RPM_BUILD_ROOT/lib/udev/*.usermap
347 # obsoleted by pkg-config
348 %{__rm} $RPM_BUILD_ROOT%{_libdir}/libgpib.la
351 %{__rm} $RPM_BUILD_ROOT%{_libdir}/libgpib-guile.la
352 %if %{with static_libs}
353 %{__rm} $RPM_BUILD_ROOT%{_libdir}/libgpib-guile.a
358 %{__make} -C language/perl pure_install \
359 DESTDIR=$RPM_BUILD_ROOT
361 cp -pr language/perl/examples $RPM_BUILD_ROOT%{_examplesdir}/perl-gpib-%{version}
363 %{__rm} -f $RPM_BUILD_ROOT%{perl_vendorarch}/auto/LinuxGpib/.packlist
367 install -d $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d
368 cat <<'EOF' > $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d/gpib.ini
369 ; Enable gpib extension module
370 extension=gpib_php.so
373 %{__rm} $RPM_BUILD_ROOT%{php_extensiondir}/gpib_php.la
374 %if %{with static_libs}
375 %{__rm} $RPM_BUILD_ROOT%{php_extensiondir}/gpib_php.a
384 cp -pr language/tcl/examples $RPM_BUILD_ROOT%{_examplesdir}/tcl-gpib-%{version}
386 %{__rm} $RPM_BUILD_ROOT%{_libdir}/libgpib_tcl.la
387 %if %{with static_libs}
388 %{__rm} $RPM_BUILD_ROOT%{_libdir}/libgpib_tcl.a
394 %{__rm} -r $RPM_BUILD_ROOT%{_datadir}/linux-gpib-user/html
398 rm -rf $RPM_BUILD_ROOT
400 %post libs -p /sbin/ldconfig
401 %postun libs -p /sbin/ldconfig
403 %post -n guile-gpib -p /sbin/ldconfig
404 %postun -n guile-gpib -p /sbin/ldconfig
406 %post -n tcl-gpib -p /sbin/ldconfig
407 %postun -n tcl-gpib -p /sbin/ldconfig
409 %post -n %{php_name}-gpib
410 %php_webserver_restart
412 %postun -n %{php_name}-gpib
413 if [ "$1" = 0 ]; then
414 %php_webserver_restart
417 %if %{with userspace}
419 %defattr(644,root,root,755)
420 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/gpib.conf
421 %attr(755,root,root) %{_bindir}/ibterm
422 %attr(755,root,root) %{_bindir}/ibtest
423 %attr(755,root,root) %{_sbindir}/gpib_config
424 /lib/udev/rules.d/99-agilent_82357a.rules
425 /lib/udev/rules.d/99-gpib-generic.rules
426 /lib/udev/rules.d/99-ni_usb_gpib.rules
427 %attr(755,root,root) /lib/udev/agilent_82357a
428 %attr(755,root,root) /lib/udev/ni_usb_gpib
432 %defattr(644,root,root,755)
433 %attr(755,root,root) /etc/hotplug/usb/agilent_82357a
434 %attr(755,root,root) /etc/hotplug/usb/ni_usb_gpib
435 /etc/hotplug/usb/agilent_82357a.usermap
436 /etc/hotplug/usb/ni_usb_gpib.usermap
440 %defattr(644,root,root,755)
441 %doc linux-gpib-user-%{version}/{AUTHORS,ChangeLog,README,README.HAMEG,README.hp82335,TODO}
442 %attr(755,root,root) %{_libdir}/libgpib.so.*.*.*
443 %attr(755,root,root) %ghost %{_libdir}/libgpib.so.0
446 %defattr(644,root,root,755)
447 %attr(755,root,root) %{_libdir}/libgpib.so
449 %{_pkgconfigdir}/libgpib.pc
451 %if %{with static_libs}
453 %defattr(644,root,root,755)
459 %defattr(644,root,root,755)
460 %attr(755,root,root) %{_libdir}/libgpib-guile-%{version}.so
461 %attr(755,root,root) %{_libdir}/libgpib-guile.so
466 %defattr(644,root,root,755)
467 %doc linux-gpib-user-%{version}/language/perl/{Changes,README}
468 %{perl_vendorarch}/LinuxGpib.pm
469 %dir %{perl_vendorarch}/auto/LinuxGpib
470 %attr(755,root,root) %{perl_vendorarch}/auto/LinuxGpib/LinuxGpib.so
471 %{perl_vendorarch}/auto/LinuxGpib/autosplit.ix
472 %{_mandir}/man3/LinuxGpib.3pm*
473 %{_examplesdir}/perl-gpib-%{version}
477 %files -n %{php_name}-gpib
478 %defattr(644,root,root,755)
479 %config(noreplace) %verify(not md5 mtime size) %{php_sysconfdir}/conf.d/gpib.ini
480 %attr(755,root,root) %{php_extensiondir}/gpib_php-%{version}.so
481 %attr(755,root,root) %{php_extensiondir}/gpib_php.so
485 %files -n python-gpib
486 %defattr(644,root,root,755)
487 %doc linux-gpib-user-%{version}/language/python/README
488 %attr(755,root,root) %{py_sitedir}/gpib.so
489 %{py_sitedir}/Gpib.py[co]
490 %{py_sitedir}/gpib-1.0-py*.egg-info
495 %defattr(644,root,root,755)
496 %doc linux-gpib-user-%{version}/language/tcl/README
497 %attr(755,root,root) %{_libdir}/libgpib_tcl-%{version}.so
498 %attr(755,root,root) %{_libdir}/libgpib_tcl.so
499 %{_examplesdir}/tcl-gpib-%{version}
504 %defattr(644,root,root,755)
505 %doc linux-gpib-user-%{version}/doc/doc_html/*