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