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