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