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