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