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