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