]> git.pld-linux.org Git - packages/linux-gpib.git/blob - linux-gpib.spec
- up to 4.0.4rc3
[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         _rc     rc3
37 %define         rel     0.%{_rc}.1
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.0.4
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}%{_rc}.tar.gz
47 # Source0-md5:  e12b4eeae623015c74f8ed01107e8f92
48 Patch0:         %{pname}-include_file.patch
49 Patch1:         %{pname}-destdir.patch
50 Patch2:         %{pname}-python.patch
51 Patch3:         %{pname}-perl.patch
52 Patch4:         %{pname}-firmwaredir.patch
53 Patch5:         %{pname}-guile2.patch
54 Patch6:         %{pname}-php7.patch
55 Patch7:         kernel-4.11.patch
56 URL:            http://linux-gpib.sourceforge.net/
57 BuildRequires:  autoconf >= 2.50
58 BuildRequires:  automake
59 BuildRequires:  libtool
60 BuildRequires:  rpmbuild(macros) >= 1.614
61 %if %{with kernel}
62 BuildRequires:  kernel-module-build >= 3:2.6.8
63 %endif
64 %if %{with userspace}
65 BuildRequires:  bison
66 %{?with_docs: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 bindings for GPIB library
177 Summary(pl.UTF-8):      Wiązania Pythona 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 bindings for GPIB library.
184
185 %description -n python-gpib -l pl.UTF-8
186 Wiązania Pythona do biblioteki GPIB.
187
188 %package -n tcl-gpib
189 Summary:        Tcl bindings for GPIB library
190 Summary(pl.UTF-8):      Wiązania Tcl-a do biblioteki GPIB
191 Group:          Libraries
192 Requires:       %{pname}-libs = %{version}-%{release}
193 Requires:       tcl
194
195 %description -n tcl-gpib
196 Tcl bindings for GPIB library.
197
198 %description -n tcl-gpib -l pl.UTF-8
199 Wiązania Tcl-a do biblioteki GPIB.
200
201 %package doc
202 Summary:        Linux-GPIB tools and library documentation
203 Summary(pl.UTF-8):      Dokumentacja narzędzi i biblioteki Linux-GPIB
204 License:        GFDL v1.2+ or GPL v2+
205 Group:          Documentation
206
207 %description doc
208 Linux-GPIB tools and library documentation.
209
210 %description doc -l pl.UTF-8
211 Dokumentacja narzędzi i biblioteki Linux-GPIB.
212
213 %define kernel_pkg()\
214 %package -n kernel%{_alt_kernel}-gpib\
215 Summary:        Linux GPIB drivers\
216 Summary(pl.UTF-8):      Sterowniki GPIB dla Linuksa\
217 Release:        %{rel}@%{_kernel_ver_str}\
218 Group:          Base/Kernel\
219 Requires(post,postun):  /sbin/depmod\
220 %requires_releq_kernel\
221 Requires(postun):       %releq_kernel\
222 \
223 %description -n kernel%{_alt_kernel}-gpib\
224 This package contains Linux drivers for GPIB (IEEE 488) hardware.\
225 \
226 %description -n kernel%{_alt_kernel}-gpib -l pl.UTF-8\
227 Ten pakiet zawiera sterowniki dla Linuksa do urządzeń GPIB (IEEE 488).\
228 \
229 %if %{with kernel}\
230 %files -n kernel%{_alt_kernel}-gpib\
231 %defattr(644,root,root,755)\
232 /lib/modules/%{_kernel_ver}/kernel/gpib\
233 %endif\
234 \
235 %post -n kernel%{_alt_kernel}-gpib\
236 %depmod %{_kernel_ver}\
237 \
238 %postun -n kernel%{_alt_kernel}-gpib\
239 %depmod %{_kernel_ver}\
240 %{nil}
241
242 %define build_kernel_pkg()\
243 TOPDIR=$(pwd)\
244 %build_kernel_modules -C drivers/gpib -m gpib -- EARLYCPPFLAGS="-I$TOPDIR -I$TOPDIR/drivers/gpib/include -I$TOPDIR/include"\
245 cd drivers/gpib\
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 cd ../..\
248 %{nil}
249
250 %define install_kernel_pkg()\
251 %{nil}
252
253 %{?with_kernel:%{expand:%create_kernel_packages}}
254
255 %prep
256 %setup -q -n %{pname}-%{version}%{_rc}
257 %patch0 -p1
258 %patch1 -p1
259 %patch2 -p1
260 %patch3 -p1
261 %patch4 -p1
262 %patch5 -p1
263 %patch6 -p1
264 %patch7 -p1
265
266 # disable modules build by default, just install userspace header
267 echo 'SUBDIRS = gpib/include' > drivers/Makefile.am
268
269 # need to inject -I options before $(LINUXINCLUDE), the simplest way is to override CC
270 for f in drivers/gpib/*/Makefile ; do
271 echo 'override CC += $(EARLYCPPFLAGS)' >> $f
272 done
273
274 %build
275 %{__libtoolize}
276 %{__aclocal} -I m4
277 %{__autoconf}
278 %{__autoheader}
279 %{__automake}
280 %if %{with guile}
281 CPPFLAGS="%{rpmcppflags} -I/usr/include/guile/2.0"
282 %endif
283 %configure \
284         %{?with_drivers_isa:--enable-isa} \
285         %{?with_drivers_pcmcia:--enable-pcmcia} \
286         %{!?with_docs:--disable-documentation} \
287         %{!?with_guile:--disable-guile-binding} \
288         %{!?with_perl:--disable-perl-binding} \
289         %{!?with_php:--disable-php-binding} \
290         %{!?with_python:--disable-python-binding} \
291         %{?with_static_libs:--enable-static} \
292         %{!?with_tcl:--disable-tcl-binding} \
293         --with-linux-srcdir=%{_kernelsrcdir}
294
295 %if %{with userspace}
296 %{__make}
297 %endif
298
299 %if %{with kernel}
300 %{expand:%build_kernel_packages}
301 %endif
302
303 %install
304 rm -rf $RPM_BUILD_ROOT
305 install -d $RPM_BUILD_ROOT%{_examplesdir}
306
307 %if %{with kernel}
308 %{expand:%install_kernel_packages}
309 cp -a drivers/gpib/installed/* $RPM_BUILD_ROOT
310 %endif
311
312 %if %{with userspace}
313 %{__make} install \
314         DESTDIR=$RPM_BUILD_ROOT \
315         HOTPLUG_USB_CONF_DIR=/lib/udev \
316         UDEV_RULES_DIR=/lib/udev/rules.d \
317         USB_FIRMWARE_DIR=/lib/firmware
318
319 %if %{with hotplug}
320 # use udev paths as base and legacy hotplug as addon (not the opposite)
321 install -d $RPM_BUILD_ROOT/etc/hotplug/usb
322 %{__mv} $RPM_BUILD_ROOT/lib/udev/*.usermap $RPM_BUILD_ROOT/etc/hotplug/usb
323 ln -snf /lib/udev/agilent_82357a $RPM_BUILD_ROOT/etc/hotplug/usb/agilent_82357a
324 ln -snf /lib/udev/ni_usb_gpib $RPM_BUILD_ROOT/etc/hotplug/usb/ni_usb_gpib
325 %else
326 %{__rm} $RPM_BUILD_ROOT/lib/udev/*.usermap
327 %endif
328
329 # obsoleted by pkg-config
330 %{__rm} $RPM_BUILD_ROOT%{_libdir}/libgpib.la
331
332 %if %{with guile}
333 %{__rm} $RPM_BUILD_ROOT%{_libdir}/libgpib-guile.la
334 %if %{with static_libs}
335 %{__rm} $RPM_BUILD_ROOT%{_libdir}/libgpib-guile.a
336 %endif
337 %endif
338
339 %if %{with perl}
340 %{__make} -C language/perl pure_install \
341         DESTDIR=$RPM_BUILD_ROOT
342
343 cp -pr language/perl/examples $RPM_BUILD_ROOT%{_examplesdir}/perl-gpib-%{version}
344
345 %{__rm} -f $RPM_BUILD_ROOT%{perl_vendorarch}/auto/LinuxGpib/.packlist
346 %endif
347
348 %if %{with php}
349 install -d $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d
350 cat <<'EOF' > $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d/gpib.ini
351 ; Enable gpib extension module
352 extension=gpib_php.so
353 EOF
354
355 %{__rm} $RPM_BUILD_ROOT%{php_extensiondir}/gpib_php.la
356 %if %{with static_libs}
357 %{__rm} $RPM_BUILD_ROOT%{php_extensiondir}/gpib_php.a
358 %endif
359 %endif
360
361 %if %{with python}
362 %py_postclean
363 %endif
364
365 %if %{with tcl}
366 cp -pr language/tcl/examples $RPM_BUILD_ROOT%{_examplesdir}/tcl-gpib-%{version}
367
368 %{__rm} $RPM_BUILD_ROOT%{_libdir}/libgpib_tcl.la
369 %if %{with static_libs}
370 %{__rm} $RPM_BUILD_ROOT%{_libdir}/libgpib_tcl.a
371 %endif
372 %endif
373
374 %if %{with docs}
375 # packaged as %doc
376 %{__rm} -r $RPM_BUILD_ROOT%{_datadir}/linux-gpib/html
377 %endif
378 %endif
379
380 %clean
381 rm -rf $RPM_BUILD_ROOT
382
383 %post   libs -p /sbin/ldconfig
384 %postun libs -p /sbin/ldconfig
385
386 %post   -n guile-gpib -p /sbin/ldconfig
387 %postun -n guile-gpib -p /sbin/ldconfig
388
389 %post   -n tcl-gpib -p /sbin/ldconfig
390 %postun -n tcl-gpib -p /sbin/ldconfig
391
392 %post   -n %{php_name}-gpib
393 %php_webserver_restart
394
395 %postun -n %{php_name}-gpib
396 if [ "$1" = 0 ]; then
397         %php_webserver_restart
398 fi
399
400 %if %{with userspace}
401 %files
402 %defattr(644,root,root,755)
403 %attr(755,root,root) %{_bindir}/ibterm
404 %attr(755,root,root) %{_bindir}/ibtest
405 %attr(755,root,root) %{_sbindir}/gpib_config
406 /lib/udev/rules.d/99-agilent_82357a.rules
407 /lib/udev/rules.d/99-gpib-generic.rules
408 /lib/udev/rules.d/99-ni_usb_gpib.rules
409 %attr(755,root,root) /lib/udev/agilent_82357a
410 %attr(755,root,root) /lib/udev/ni_usb_gpib
411
412 %if %{with hotplug}
413 %files hotplug
414 %defattr(644,root,root,755)
415 %attr(755,root,root) /etc/hotplug/usb/agilent_82357a
416 %attr(755,root,root) /etc/hotplug/usb/ni_usb_gpib
417 /etc/hotplug/usb/agilent_82357a.usermap
418 /etc/hotplug/usb/ni_usb_gpib.usermap
419 %endif
420
421 %files libs
422 %defattr(644,root,root,755)
423 %doc AUTHORS ChangeLog README README.HAMEG README.hp82335 TODO
424 %attr(755,root,root) %{_libdir}/libgpib.so.*.*.*
425 %attr(755,root,root) %ghost %{_libdir}/libgpib.so.0
426
427 %files devel
428 %defattr(644,root,root,755)
429 %attr(755,root,root) %{_libdir}/libgpib.so
430 %{_includedir}/gpib
431 %{_pkgconfigdir}/libgpib.pc
432
433 %if %{with static_libs}
434 %files static
435 %defattr(644,root,root,755)
436 %{_libdir}/libgpib.a
437 %endif
438
439 %if %{with guile}
440 %files -n guile-gpib
441 %defattr(644,root,root,755)
442 %attr(755,root,root) %{_libdir}/libgpib-guile-%{version}%{_rc}.so
443 %attr(755,root,root) %{_libdir}/libgpib-guile.so
444 %endif
445
446 %if %{with perl}
447 %files -n perl-gpib
448 %defattr(644,root,root,755)
449 %doc language/perl/{Changes,README}
450 %{perl_vendorarch}/LinuxGpib.pm
451 %dir %{perl_vendorarch}/auto/LinuxGpib
452 %attr(755,root,root) %{perl_vendorarch}/auto/LinuxGpib/LinuxGpib.so
453 %{perl_vendorarch}/auto/LinuxGpib/autosplit.ix
454 %{_mandir}/man3/LinuxGpib.3pm*
455 %{_examplesdir}/perl-gpib-%{version}
456 %endif
457
458 %if %{with php}
459 %files -n %{php_name}-gpib
460 %defattr(644,root,root,755)
461 %config(noreplace) %verify(not md5 mtime size) %{php_sysconfdir}/conf.d/gpib.ini
462 %attr(755,root,root) %{php_extensiondir}/gpib_php-%{version}%{_rc}.so
463 %attr(755,root,root) %{php_extensiondir}/gpib_php.so
464 %endif
465
466 %if %{with python}
467 %files -n python-gpib
468 %defattr(644,root,root,755)
469 %doc language/python/README
470 %attr(755,root,root) %{py_sitedir}/gpib.so
471 %{py_sitedir}/Gpib.py[co]
472 %{py_sitedir}/gpib-1.0-py*.egg-info
473 %endif
474
475 %if %{with tcl}
476 %files -n tcl-gpib
477 %defattr(644,root,root,755)
478 %doc language/tcl/README
479 %attr(755,root,root) %{_libdir}/libgpib_tcl-%{version}%{_rc}.so
480 %attr(755,root,root) %{_libdir}/libgpib_tcl.so
481 %{_examplesdir}/tcl-gpib-%{version}
482 %endif
483
484 %if %{with docs}
485 %files doc
486 %defattr(644,root,root,755)
487 %doc doc/doc_html/*
488 %endif
489 %endif
This page took 0.076736 seconds and 3 git commands to generate.