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