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: 2d97191e538a57ba7350fcc011ee2596
47 Patch0: %{pname}-include_file.patch
48 Patch1: %{pname}-destdir.patch
49 Patch2: %{pname}-python.patch
50 Patch3: %{pname}-perl.patch
51 Patch4: %{pname}-firmwaredir.patch
52 Patch5: %{pname}-guile2.patch
53 Patch6: %{pname}-php7.patch
54 Patch7: kernel-4.11.patch
55 URL: http://linux-gpib.sourceforge.net/
56 BuildRequires: autoconf >= 2.50
57 BuildRequires: automake
58 BuildRequires: libtool
59 BuildRequires: rpmbuild(macros) >= 1.614
61 BuildRequires: kernel-module-build >= 3:2.6.8
65 %{?with_docs:BuildRequires: docbook-utils}
67 %{?with_guile:BuildRequires: guile-devel >= 1.4}
68 %{?with_perl:BuildRequires: perl-devel}
69 %{?with_php:BuildRequires: %{php_name}-devel >= 3:5}
70 %{?with_python:BuildRequires: python-devel >= 2}
71 BuildRequires: readline-devel
72 %{?with_tcl:BuildRequires: tcl-devel}
74 Requires: %{pname}-libs = %{version}-%{release}
75 # for agilent_82357a and ni_usb_gpib
77 # for agilent_82357a, agilent/hp_82341, agilent/hp_82350a, ni_usb_gpib
78 Suggests: linux-gpib-firmware
79 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
82 The Linux GPIB package provides support for GPIB (IEEE 488) hardware.
84 %description -l pl.UTF-8
85 Pakiet Linux GPIB służy do obsługi sprzętu GPIB (IEEE 488).
88 Summary: Linux GPIB support for legacy USB hotplug
89 Summary(pl.UTF-8): Obsługa Linux GPIB dla starego systemu hotplug USB
90 Group: Applications/System
91 Requires: %{pname} = %{version}-%{release}
95 Linux GPIB support for legacy USB hotplug.
97 %description hotplug -l pl.UTF-8
98 Obsługa Linux GPIB dla starego systemu hotplug USB.
101 Summary: Shared GPIB library
102 Summary(pl.UTF-8): Biblioteka współdzielona GPIB
108 %description libs -l pl.UTF-8
109 Biblioteka współdzielona GPIB.
112 Summary: Header file for GPIB library
113 Summary(pl.UTF-8): Plik nagłówkowy biblioteki GPIB
114 Group: Development/Libraries
115 Requires: %{pname}-libs = %{version}-%{release}
118 Header file for GPIB library.
120 %description devel -l pl.UTF-8
121 Plik nagłówkowy biblioteki GPIB.
124 Summary: Static GPIB library
125 Summary(pl.UTF-8): Biblioteka statyczna GPIB
126 Group: Development/Libraries
127 Requires: %{pname}-devel = %{version}-%{release}
132 %description static -l pl.UTF-8
133 Biblioteka statyczna GPIB.
135 %package -n guile-gpib
136 Summary: Guile bindings for GPIB library
137 Summary(pl.UTF-8): Wiązania Guile do biblioteki GPIB
138 Group: Development/Languages/Perl
139 Requires: %{pname}-libs = %{version}-%{release}
142 %description -n guile-gpib
143 Guile bindings for GPIB library.
145 %description -n guile-gpib -l pl.UTF-8
146 Wiązania Guile do biblioteki GPIB.
148 %package -n perl-gpib
149 Summary: Perl bindings for GPIB library
150 Summary(pl.UTF-8): Wiązania Perla do biblioteki GPIB
151 Group: Development/Languages/Perl
152 Requires: %{pname}-libs = %{version}-%{release}
154 %description -n perl-gpib
155 Perl bindings for GPIB library.
157 %description -n perl-gpib -l pl.UTF-8
158 Wiązania Perla do biblioteki GPIB.
160 %package -n %{php_name}-gpib
161 Summary: PHP bindings for GPIB library
162 Summary(pl.UTF-8): Wiązania PHP do biblioteki GPIB
163 Group: Development/Languages/PHP
164 Provides: php(gpib) = %{version}
165 Requires: %{pname}-libs = %{version}-%{release}
166 %{?requires_php_extension}
168 %description -n %{php_name}-gpib
169 PHP bindings for GPIB library.
171 %description -n %{php_name}-gpib -l pl.UTF-8
172 Wiązania PHP do biblioteki GPIB.
174 %package -n python-gpib
175 Summary: Python bindings for GPIB library
176 Summary(pl.UTF-8): Wiązania Pythona do biblioteki GPIB
177 Group: Libraries/Python
178 Requires: %{pname}-libs = %{version}-%{release}
179 Requires: python-libs
181 %description -n python-gpib
182 Python bindings for GPIB library.
184 %description -n python-gpib -l pl.UTF-8
185 Wiązania Pythona do biblioteki GPIB.
188 Summary: Tcl bindings for GPIB library
189 Summary(pl.UTF-8): Wiązania Tcl-a do biblioteki GPIB
191 Requires: %{pname}-libs = %{version}-%{release}
194 %description -n tcl-gpib
195 Tcl bindings for GPIB library.
197 %description -n tcl-gpib -l pl.UTF-8
198 Wiązania Tcl-a do biblioteki GPIB.
201 Summary: Linux-GPIB tools and library documentation
202 Summary(pl.UTF-8): Dokumentacja narzędzi i biblioteki Linux-GPIB
203 License: GFDL v1.2+ or GPL v2+
207 Linux-GPIB tools and library documentation.
209 %description doc -l pl.UTF-8
210 Dokumentacja narzędzi i biblioteki Linux-GPIB.
212 %define kernel_pkg()\
213 %package -n kernel%{_alt_kernel}-gpib\
214 Summary: Linux GPIB drivers\
215 Summary(pl.UTF-8): Sterowniki GPIB dla Linuksa\
216 Release: %{rel}@%{_kernel_ver_str}\
218 Requires(post,postun): /sbin/depmod\
219 %requires_releq_kernel\
220 Requires(postun): %releq_kernel\
222 %description -n kernel%{_alt_kernel}-gpib\
223 This package contains Linux drivers for GPIB (IEEE 488) hardware.\
225 %description -n kernel%{_alt_kernel}-gpib -l pl.UTF-8\
226 Ten pakiet zawiera sterowniki dla Linuksa do urządzeń GPIB (IEEE 488).\
229 %files -n kernel%{_alt_kernel}-gpib\
230 %defattr(644,root,root,755)\
231 /lib/modules/%{_kernel_ver}/kernel/gpib\
234 %post -n kernel%{_alt_kernel}-gpib\
235 %depmod %{_kernel_ver}\
237 %postun -n kernel%{_alt_kernel}-gpib\
238 %depmod %{_kernel_ver}\
241 %define build_kernel_pkg()\
243 %build_kernel_modules -C drivers/gpib -m gpib -- EARLYCPPFLAGS="-I$TOPDIR -I$TOPDIR/drivers/gpib/include -I$TOPDIR/include"\
245 %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\
249 %define install_kernel_pkg()\
252 %{?with_kernel:%{expand:%create_kernel_packages}}
255 %setup -q -n %{pname}-%{version}
265 # disable modules build by default, just install userspace header
266 echo 'SUBDIRS = gpib/include' > drivers/Makefile.am
268 # need to inject -I options before $(LINUXINCLUDE), the simplest way is to override CC
269 for f in drivers/gpib/*/Makefile ; do
270 echo 'override CC += $(EARLYCPPFLAGS)' >> $f
280 CPPFLAGS="%{rpmcppflags} -I/usr/include/guile/2.0"
283 %{?with_drivers_isa:--enable-isa} \
284 %{?with_drivers_pcmcia:--enable-pcmcia} \
285 %{!?with_docs:--disable-documentation} \
286 %{!?with_guile:--disable-guile-binding} \
287 %{!?with_perl:--disable-perl-binding} \
288 %{!?with_php:--disable-php-binding} \
289 %{!?with_python:--disable-python-binding} \
290 %{?with_static_libs:--enable-static} \
291 %{!?with_tcl:--disable-tcl-binding} \
292 --with-linux-srcdir=%{_kernelsrcdir}
294 %if %{with userspace}
299 %{expand:%build_kernel_packages}
303 rm -rf $RPM_BUILD_ROOT
304 install -d $RPM_BUILD_ROOT%{_examplesdir}
307 %{expand:%install_kernel_packages}
308 cp -a drivers/gpib/installed/* $RPM_BUILD_ROOT
311 %if %{with userspace}
313 DESTDIR=$RPM_BUILD_ROOT \
314 HOTPLUG_USB_CONF_DIR=/lib/udev \
315 UDEV_RULES_DIR=/lib/udev/rules.d \
316 USB_FIRMWARE_DIR=/lib/firmware
319 # use udev paths as base and legacy hotplug as addon (not the opposite)
320 install -d $RPM_BUILD_ROOT/etc/hotplug/usb
321 %{__mv} $RPM_BUILD_ROOT/lib/udev/*.usermap $RPM_BUILD_ROOT/etc/hotplug/usb
322 ln -snf /lib/udev/agilent_82357a $RPM_BUILD_ROOT/etc/hotplug/usb/agilent_82357a
323 ln -snf /lib/udev/ni_usb_gpib $RPM_BUILD_ROOT/etc/hotplug/usb/ni_usb_gpib
325 %{__rm} $RPM_BUILD_ROOT/lib/udev/*.usermap
328 # obsoleted by pkg-config
329 %{__rm} $RPM_BUILD_ROOT%{_libdir}/libgpib.la
332 %{__rm} $RPM_BUILD_ROOT%{_libdir}/libgpib-guile.la
333 %if %{with static_libs}
334 %{__rm} $RPM_BUILD_ROOT%{_libdir}/libgpib-guile.a
339 %{__make} -C language/perl pure_install \
340 DESTDIR=$RPM_BUILD_ROOT
342 cp -pr language/perl/examples $RPM_BUILD_ROOT%{_examplesdir}/perl-gpib-%{version}
344 %{__rm} -f $RPM_BUILD_ROOT%{perl_vendorarch}/auto/LinuxGpib/.packlist
348 install -d $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d
349 cat <<'EOF' > $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d/gpib.ini
350 ; Enable gpib extension module
351 extension=gpib_php.so
354 %{__rm} $RPM_BUILD_ROOT%{php_extensiondir}/gpib_php.la
355 %if %{with static_libs}
356 %{__rm} $RPM_BUILD_ROOT%{php_extensiondir}/gpib_php.a
365 cp -pr language/tcl/examples $RPM_BUILD_ROOT%{_examplesdir}/tcl-gpib-%{version}
367 %{__rm} $RPM_BUILD_ROOT%{_libdir}/libgpib_tcl.la
368 %if %{with static_libs}
369 %{__rm} $RPM_BUILD_ROOT%{_libdir}/libgpib_tcl.a
375 %{__rm} -r $RPM_BUILD_ROOT%{_datadir}/linux-gpib/html
380 rm -rf $RPM_BUILD_ROOT
382 %post libs -p /sbin/ldconfig
383 %postun libs -p /sbin/ldconfig
385 %post -n guile-gpib -p /sbin/ldconfig
386 %postun -n guile-gpib -p /sbin/ldconfig
388 %post -n tcl-gpib -p /sbin/ldconfig
389 %postun -n tcl-gpib -p /sbin/ldconfig
391 %post -n %{php_name}-gpib
392 %php_webserver_restart
394 %postun -n %{php_name}-gpib
395 if [ "$1" = 0 ]; then
396 %php_webserver_restart
399 %if %{with userspace}
401 %defattr(644,root,root,755)
402 %attr(755,root,root) %{_bindir}/ibterm
403 %attr(755,root,root) %{_bindir}/ibtest
404 %attr(755,root,root) %{_sbindir}/gpib_config
405 /lib/udev/rules.d/99-agilent_82357a.rules
406 /lib/udev/rules.d/99-gpib-generic.rules
407 /lib/udev/rules.d/99-ni_usb_gpib.rules
408 %attr(755,root,root) /lib/udev/agilent_82357a
409 %attr(755,root,root) /lib/udev/ni_usb_gpib
413 %defattr(644,root,root,755)
414 %attr(755,root,root) /etc/hotplug/usb/agilent_82357a
415 %attr(755,root,root) /etc/hotplug/usb/ni_usb_gpib
416 /etc/hotplug/usb/agilent_82357a.usermap
417 /etc/hotplug/usb/ni_usb_gpib.usermap
421 %defattr(644,root,root,755)
422 %doc AUTHORS ChangeLog README README.HAMEG README.hp82335 TODO
423 %attr(755,root,root) %{_libdir}/libgpib.so.*.*.*
424 %attr(755,root,root) %ghost %{_libdir}/libgpib.so.0
427 %defattr(644,root,root,755)
428 %attr(755,root,root) %{_libdir}/libgpib.so
430 %{_pkgconfigdir}/libgpib.pc
432 %if %{with static_libs}
434 %defattr(644,root,root,755)
440 %defattr(644,root,root,755)
441 %attr(755,root,root) %{_libdir}/libgpib-guile-%{version}.so
442 %attr(755,root,root) %{_libdir}/libgpib-guile.so
447 %defattr(644,root,root,755)
448 %doc language/perl/{Changes,README}
449 %{perl_vendorarch}/LinuxGpib.pm
450 %dir %{perl_vendorarch}/auto/LinuxGpib
451 %attr(755,root,root) %{perl_vendorarch}/auto/LinuxGpib/LinuxGpib.so
452 %{perl_vendorarch}/auto/LinuxGpib/autosplit.ix
453 %{_mandir}/man3/LinuxGpib.3pm*
454 %{_examplesdir}/perl-gpib-%{version}
458 %files -n %{php_name}-gpib
459 %defattr(644,root,root,755)
460 %config(noreplace) %verify(not md5 mtime size) %{php_sysconfdir}/conf.d/gpib.ini
461 %attr(755,root,root) %{php_extensiondir}/gpib_php-%{version}.so
462 %attr(755,root,root) %{php_extensiondir}/gpib_php.so
466 %files -n python-gpib
467 %defattr(644,root,root,755)
468 %doc language/python/README
469 %attr(755,root,root) %{py_sitedir}/gpib.so
470 %{py_sitedir}/Gpib.py[co]
471 %{py_sitedir}/gpib-1.0-py*.egg-info
476 %defattr(644,root,root,755)
477 %doc language/tcl/README
478 %attr(755,root,root) %{_libdir}/libgpib_tcl-%{version}.so
479 %attr(755,root,root) %{_libdir}/libgpib_tcl.so
480 %{_examplesdir}/tcl-gpib-%{version}
485 %defattr(644,root,root,755)