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