X-Git-Url: http://git.pld-linux.org/?a=blobdiff_plain;f=linux-gpib.spec;h=b771b5be954b06a7e2cc8bdf857c3ac38a98e109;hb=08f3bc9;hp=e67df3a598b2a41aef2fffff09ade70bded21d76;hpb=1fc85825619a5f79ca67ae6eabfedf7ffce32d1b;p=packages%2Flinux-gpib.git diff --git a/linux-gpib.spec b/linux-gpib.spec index e67df3a..b771b5b 100644 --- a/linux-gpib.spec +++ b/linux-gpib.spec @@ -1,37 +1,57 @@ +# TODO: +# - where to get firmware from? +# - guile 2 support +# - PHP 7 support # # Conditional build: -%bcond_without dist_kernel # allow non-distribution kernel -%bcond_without kernel # don't build kernel modules -%bcond_without up # don't build UP module -%bcond_without smp # don't build SMP module -%bcond_without userspace # don't build userspace module -%bcond_with verbose # verbose build (V=1) -# -# main package. -# - -%define mod_name gpib - -%define _rel 0.1 -Summary: GPIB Linux Support -Summary(pl.UTF-8): Sterowniki GPIB dla Linuksa +%bcond_without kernel # kernel modules +%bcond_without userspace # userspace packages +%bcond_without verbose # verbose modules build (V=1) + +%bcond_without docs # documentation build +%bcond_with hotplug # legacy hotplug support +%bcond_without static_libs # static library +%bcond_with guile # guile binding +%bcond_without perl # Perl binding +%bcond_without php # PHP binding +%bcond_without python # Python binding +%bcond_without tcl # Tcl binding + +Summary: GPIB (IEEE 488) Linux support +Summary(pl.UTF-8): Obsługa GPIB (IEEE 488) dla Linuksa Name: linux-gpib -Version: 3.2.05 -Release: %{_rel} -License: GPL +Version: 4.0.3 +%define rel 0.1 +Release: %{rel} +License: GPL v2+ Group: Applications/System -Source0: http://dl.sourceforge.net/linux-gpib/%{name}-%{version}.tar.gz -# Source0-md5: 65044161fe86a815c9c159fe301d85c4 -#Patch0: %{name}-Makefile.am.patch +Source0: http://downloads.sourceforge.net/linux-gpib/%{name}-%{version}.tar.gz +# Source0-md5: 2d97191e538a57ba7350fcc011ee2596 +Patch0: %{name}-include_file.patch +Patch1: %{name}-destdir.patch +Patch2: %{name}-python.patch +Patch3: %{name}-perl.patch +Patch4: %{name}-firmwaredir.patch URL: http://linux-gpib.sourceforge.net/ +BuildRequires: autoconf >= 2.50 +BuildRequires: automake +BuildRequires: libtool +BuildRequires: rpmbuild(macros) >= 1.614 %if %{with kernel} -%{?with_dist_kernel:BuildRequires: kernel-module-build >= 3:2.6.7} -BuildRequires: rpmbuild(macros) >= 1.153 +BuildRequires: kernel-module-build >= 3:2.6.8 %endif -BuildRequires: kernel-headers >= 2.6.8 -BuildRequires: python -Requires(pre,post): kernel >= 2.6.8 -Requires: kernel-up >= 2.6.8 +%if %{with userspace} +BuildRequires: bison +%{?with_docs:BuildRequires: docbook-utils} +BuildRequires: flex +%{?with_guile:BuildRequires: guile-devel < 5:2.0} +%{?with_perl:BuildRequires: perl-devel} +%{?with_php:BuildRequires: php-devel < 4:7} +%{?with_python:BuildRequires: python-devel >= 2} +BuildRequires: readline-devel +%{?with_tcl:BuildRequires: tcl-devel} +%endif +Requires: %{name}-libs = %{version}-%{release} BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) %description @@ -40,190 +60,324 @@ The Linux GPIB package provides support for GPIB (IEEE 488) hardware. %description -l pl.UTF-8 Pakiet Linux GPIB służy do obsługi sprzętu GPIB (IEEE 488). -# kernel subpackages. - -%package -n kernel-%{mod_name} -Summary: Linux driver for %{name} -Summary(pl.UTF-8): Sterownik dla Linuksa do %{name} -Release: %{_rel}@%{_kernel_ver_str} -Group: Base/Kernel -Requires(post,postun): /sbin/depmod -%if %{with dist_kernel} -%requires_releq_kernel_up -Requires(postun): %releq_kernel_up -%endif - -%description -n kernel-%{mod_name} -This is driver for %{name} for Linux. - -This package contains Linux module. - -%description -n kernel-%{mod_name} -l pl.UTF-8 -Sterownik dla Linuksa do %{name}. - -Ten pakiet zawiera moduł jądra Linuksa. - -%package -n kernel-smp-%{mod_name} -Summary: Linux SMP driver for %{name} -Summary(pl.UTF-8): Sterownik dla Linuksa SMP do %{name} -Release: %{_rel}@%{_kernel_ver_str} -Group: Base/Kernel -Requires(post,postun): /sbin/depmod -%if %{with dist_kernel} -%requires_releq_kernel_smp -Requires(postun): %releq_kernel_smp -%endif - -%description -n kernel-smp-%{mod_name} -This is driver for %{name} for Linux. - -This package contains Linux SMP module. - -%description -n kernel-smp-%{mod_name} -l pl.UTF-8 -Sterownik dla Linuksa do %{name}. - -Ten pakiet zawiera moduł jądra Linuksa SMP. +%package hotplug +Summary: Linux GPIB support for legacy USB hotplug +Summary(pl.UTF-8): Obsługa Linux GPIB dla starego systemu hotplug USB +Group: Applications/System +Requires: %{name} = %{version}-%{release} +Requires: hotplug + +%description hotplug +Linux GPIB support for legacy USB hotplug. + +%description hotplug -l pl.UTF-8 +Obsługa Linux GPIB dla starego systemu hotplug USB. + +%package libs +Summary: Shared GPIB library +Summary(pl.UTF-8): Biblioteka współdzielona GPIB +Group: Libraries + +%description libs +Shared GPIB library. + +%description libs -l pl.UTF-8 +Biblioteka współdzielona GPIB. + +%package devel +Summary: Header file for GPIB library +Summary(pl.UTF-8): Plik nagłówkowy biblioteki GPIB +Group: Development/Libraries +Requires: %{name}-libs = %{version}-%{release} + +%description devel +Header file for GPIB library. + +%description devel -l pl.UTF-8 +Plik nagłówkowy biblioteki GPIB. + +%package static +Summary: Static GPIB library +Summary(pl.UTF-8): Biblioteka statyczna GPIB +Group: Development/Libraries +Requires: %{name}-devel = %{version}-%{release} + +%description static +Static GPIB library. + +%description static -l pl.UTF-8 +Biblioteka statyczna GPIB. + +%package -n perl-gpib +Summary: Perl bindings for GPIB library +Summary(pl.UTF-8): Wiązania Perla do biblioteki GPIB +Group: Development/Languages/Perl +Requires: %{name}-libs = %{version}-%{release} + +%description -n perl-gpib +Perl bindings for GPIB library. + +%description -n perl-gpib -l pl.UTF-8 +Wiązania Perla do biblioteki GPIB. + +%package -n python-gpib +Summary: Python bindings for GPIB library +Summary(pl.UTF-8): Wiązania Pythona do biblioteki GPIB +Group: Libraries/Python +Requires: %{name}-libs = %{version}-%{release} +Requires: python-libs + +%description -n python-gpib +Python bindings for GPIB library. + +%description -n python-gpib -l pl.UTF-8 +Wiązania Pythona do biblioteki GPIB. + +%package -n tcl-gpib +Summary: Tcl bindings for GPIB library +Summary(pl.UTF-8): Wiązania Tcl-a do biblioteki GPIB +Group: Libraries +Requires: %{name}-libs = %{version}-%{release} +Requires: tcl + +%description -n tcl-gpib +Tcl bindings for GPIB library. + +%description -n tcl-gpib -l pl.UTF-8 +Wiązania Tcl-a do biblioteki GPIB. + +%package doc +Summary: Linux-GPIB tools and library documentation +Summary(pl.UTF-8): Dokumentacja narzędzi i biblioteki Linux-GPIB +License: GFDL v1.2+ or GPL v2+ +Group: Documentation + +%description doc +Linux-GPIB tools and library documentation. + +%description doc -l pl.UTF-8 +Dokumentacja narzędzi i biblioteki Linux-GPIB. + +%define kernel_pkg()\ +%package -n kernel%{_alt_kernel}-gpib\ +Summary: Linux GPIB drivers\ +Summary(pl.UTF-8): Sterowniki GPIB dla Linuksa\ +Release: %{rel}@%{_kernel_ver_str}\ +Group: Base/Kernel\ +Requires(post,postun): /sbin/depmod\ +%requires_releq_kernel\ +Requires(postun): %releq_kernel\ +\ +%description -n kernel%{_alt_kernel}-gpib\ +This package contains Linux drivers for GPIB (IEEE 488) hardware.\ +\ +%description -n kernel%{_alt_kernel}-gpib -l pl.UTF-8\ +Ten pakiet zawiera sterowniki dla Linuksa do urządzeń GPIB (IEEE 488).\ +\ +%if %{with kernel}\ +%files -n kernel%{_alt_kernel}-gpib\ +%defattr(644,root,root,755)\ +/lib/modules/%{_kernel_ver}/kernel/gpib\ +%endif\ +\ +%post -n kernel%{_alt_kernel}-gpib\ +%depmod %{_kernel_ver}\ +\ +%postun -n kernel%{_alt_kernel}-gpib\ +%depmod %{_kernel_ver}\ +%{nil} + +%define build_kernel_pkg()\ +TOPDIR=$(pwd)\ +%build_kernel_modules -C drivers/gpib -m gpib -- EARLYCPPFLAGS="-I$TOPDIR -I$TOPDIR/drivers/gpib/include -I$TOPDIR/include"\ +cd drivers/gpib\ +%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\ +%{nil} + +%define install_kernel_pkg()\ +%{nil} + +%{?with_kernel:%{expand:%create_kernel_packages}} %prep %setup -q -#patch0 -p1 +%patch0 -p1 +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 + +# disable modules build by default, just install userspace header +echo 'SUBDIRS = gpib/include' > drivers/Makefile.am + +# need to inject -I options before $(LINUXINCLUDE), the simplest way is to override CC +for f in drivers/gpib/*/Makefile ; do +echo 'override CC += $(EARLYCPPFLAGS)' >> $f +done %build -%{__aclocal} -I m4 %{__libtoolize} +%{__aclocal} -I m4 %{__autoconf} +%{__autoheader} %{__automake} - %configure \ - --disable-guile-binding \ - --disable-perl-binding \ - --disable-php-binding \ - --disable-python-binding \ - --disable-tcl-binding \ - --disable-documentation +%ifarch %{ix86} + --enable-isa \ + --enable-pcmcia \ +%endif + %{!?with_docs:--disable-documentation} \ + %{!?with_guile:--disable-guile-binding} \ + %{!?with_perl:--disable-perl-binding} \ + %{!?with_php:--disable-php-binding} \ + %{!?with_python:--disable-python-binding} \ + %{?with_static_libs:--enable-static} \ + %{!?with_tcl:--disable-tcl-binding} \ + --with-linux-srcdir=%{_kernelsrcdir} %if %{with userspace} %{__make} %endif %if %{with kernel} -cd driver -for i in tms9914 agilent_82350b agilent_82357a cb7210 hp82335 hp_82341 nec7210 tnt4882 cec ines pc2 sys ; do - -cd $i -# kernel module(s) -for cfg in %{?with_dist_kernel:%{?with_smp:smp} up}%{!?with_dist_kernel:nondist}; do - if [ ! -r "%{_kernelsrcdir}/config-$cfg" ]; then - exit 1 - fi - rm -rf include - install -d include/{linux,config} - ln -sf %{_kernelsrcdir}/config-$cfg .config - ln -sf %{_kernelsrcdir}/include/linux/autoconf-$cfg.h include/linux/autoconf.h - ln -sf %{_kernelsrcdir}/include/asm-%{_target_base_arch} include/asm - ln -sf %{_kernelsrcdir}/Module.symvers-$cfg Module.symvers - touch include/config/MARKER - - cp -rdp ../include/* include - install -d include/gpib - cp -rdp include/gpib_user.h include/gpib - cp -rdp ../../config.h include - - %{__make} -C %{_kernelsrcdir} clean \ - RCS_FIND_IGNORE="-name '*.ko' -o" \ - M=$PWD O=$PWD \ - %{?with_verbose:V=1} - %{__make} -C %{_kernelsrcdir} modules \ - CC="%{__cc}" CPP="%{__cpp}" \ - M=$PWD O=$PWD \ - %{?with_verbose:V=1} - - if [ "$i" = "sys" ]; then - i=gpib_common - fi - if [ "$i" = "cec" ]; then - i=cec_gpib - fi - if [ "$i" = "ines" ]; then - i=ines_gpib - fi - if [ "$i" = "pc2" ]; then - i=pc2_gpib - fi - - mv $i{,-$cfg}.ko -done -cd .. -done +%{expand:%build_kernel_packages} %endif %install rm -rf $RPM_BUILD_ROOT -HOTPLUG_USB_CONF_DIR=/etc/hotplug/usb -USB_FIRMWARE_DIR=/usr/share/usb/ +install -d $RPM_BUILD_ROOT%{_examplesdir} + +%if %{with kernel} +%{expand:%install_kernel_packages} +cp -a drivers/gpib/installed/* $RPM_BUILD_ROOT +%endif -install -d $RPM_BUILD_ROOT{$HOTPLUG_USB_CONF_DIR,$USB_FIRMWARE_DIR} %if %{with userspace} %{__make} install \ DESTDIR=$RPM_BUILD_ROOT \ - HOTPLUG_USB_CONF_DIR=$RPM_BUILD_ROOT$HOTPLUG_USB_CONF_DIR \ - USB_FIRMWARE_DIR=$RPM_BUILD_ROOT$USB_FIRMWARE_DIR + HOTPLUG_USB_CONF_DIR=/lib/udev \ + UDEV_RULES_DIR=/lib/udev/rules.d \ + USB_FIRMWARE_DIR=/lib/firmware +# use udev paths as base and legacy hotplug as addon (not the opposite) +install -d $RPM_BUILD_ROOT/etc/hotplug/usb +%{__mv} $RPM_BUILD_ROOT/lib/udev/*.usermap $RPM_BUILD_ROOT/etc/hotplug/usb +ln -snf /lib/udev/agilent_82357a $RPM_BUILD_ROOT/etc/hotplug/usb/agilent_82357a +ln -snf /lib/udev/ni_usb_gpib $RPM_BUILD_ROOT/etc/hotplug/usb/ni_usb_gpib + +# obsoleted by pkg-config +%{__rm} $RPM_BUILD_ROOT%{_libdir}/libgpib.la + +%if %{with perl} +%{__make} -C language/perl pure_install \ + DESTDIR=$RPM_BUILD_ROOT +cp -pr language/perl/examples $RPM_BUILD_ROOT%{_examplesdir}/perl-gpib-%{version} +%{__rm} -f $RPM_BUILD_ROOT%{perl_vendorarch}/auto/LinuxGpib/.packlist %endif -%if %{with kernel} -install -d $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}{,smp}/misc - -cd driver -for i in agilent_82350b agilent_82357a cb7210 hp82335 hp_82341 nec7210 tms9914 tnt4882 cec ines pc2 sys; do -cd $i - if [ "$i" == "sys" ]; then - i=gpib_common - fi - if [ "$i" == "cec" ]; then - i=cec_gpib - fi - if [ "$i" == "ines" ]; then - i=ines_gpib - fi - if [ "$i" == "pc2" ]; then - i=pc2_gpib - fi - -install $i-%{?with_dist_kernel:up}%{!?with_dist_kernel:nondist}.ko \ - $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}/misc/$i.ko -%if %{with smp} && %{with dist_kernel} -install $i-smp.ko \ - $RPM_BUILD_ROOT/lib/modules/%{_kernel_ver}smp/misc/$i.ko -cd .. -done +%if %{with python} +%py_postclean +%endif + +%if %{with tcl} +cp -pr language/tcl/examples $RPM_BUILD_ROOT%{_examplesdir}/tcl-gpib-%{version} +%{__rm} $RPM_BUILD_ROOT%{_libdir}/libgpib_tcl.la +%if %{with static_libs} +%{__rm} $RPM_BUILD_ROOT%{_libdir}/libgpib_tcl.a +%endif +%endif + +%if %{with docs} +# packaged as %doc +%{__rm} -r $RPM_BUILD_ROOT%{_datadir}/linux-gpib/html %endif %endif %clean rm -rf $RPM_BUILD_ROOT -%post -n kernel-%{mod_name} -%depmod %{_kernel_ver} +%post libs -p /sbin/ldconfig +%postun libs -p /sbin/ldconfig + +%if %{with userspace} +%files +%defattr(644,root,root,755) +%attr(755,root,root) %{_bindir}/ibterm +%attr(755,root,root) %{_bindir}/ibtest +%attr(755,root,root) %{_sbindir}/gpib_config +/lib/udev/rules.d/99-agilent_82357a.rules +/lib/udev/rules.d/99-gpib-generic.rules +/lib/udev/rules.d/99-ni_usb_gpib.rules +%attr(755,root,root) /lib/udev/agilent_82357a +%attr(755,root,root) /lib/udev/ni_usb_gpib +%dir /lib/firmware/agilent_82357a +# TODO: +#/lib/firmware/agilent_82357a/82357a_fw.hex +#/lib/firmware/agilent_82357a/measat_releaseX1.8.hex +%dir /lib/firmware/ni_usb_gpib +# TODO: +#/lib/firmware/ni_usb_gpib/niusbb_firmware.hex +#/lib/firmware/ni_usb_gpib/niusbb_loader.hex + +%if %{with hotplug} +%files hotplug +%defattr(644,root,root,755) +%attr(755,root,root) /etc/hotplug/usb/agilent_82357a +%attr(755,root,root) /etc/hotplug/usb/ni_usb_gpib +/etc/hotplug/usb/agilent_82357a.usermap +/etc/hotplug/usb/ni_usb_gpib.usermap +%endif + +%files libs +%defattr(644,root,root,755) +%doc AUTHORS ChangeLog README README.HAMEG README.hp82335 TODO +%attr(755,root,root) %{_libdir}/libgpib.so.*.*.* +%attr(755,root,root) %ghost %{_libdir}/libgpib.so.0 -%postun -n kernel-%{mod_name} -%depmod %{_kernel_ver} +%files devel +%defattr(644,root,root,755) +%attr(755,root,root) %{_libdir}/libgpib.so +%{_includedir}/gpib +%{_pkgconfigdir}/libgpib.pc -%post -n kernel-smp-%{mod_name} -%depmod %{_kernel_ver}smp +%if %{with static_libs} +%files static +%defattr(644,root,root,755) +%{_libdir}/libgpib.a +%endif -%postun -n kernel-smp-%{mod_name} -%depmod %{_kernel_ver}smp +%if %{with perl} +%files -n perl-gpib +%defattr(644,root,root,755) +%doc language/perl/{Changes,README} +%{perl_vendorarch}/LinuxGpib.pm +%dir %{perl_vendorarch}/auto/LinuxGpib +%attr(755,root,root) %{perl_vendorarch}/auto/LinuxGpib/LinuxGpib.so +%{perl_vendorarch}/auto/LinuxGpib/autosplit.ix +%{_mandir}/man3/LinuxGpib.3pm* +%{_examplesdir}/perl-gpib-%{version} +%endif -%if %{with kernel} -%if %{with up} || %{without dist_kernel} -%files -n kernel-%{mod_name} +%if %{with python} +%files -n python-gpib +%defattr(644,root,root,755) +%doc language/python/README +%attr(755,root,root) %{py_sitedir}/gpib.so +%{py_sitedir}/Gpib.py[co] +%{py_sitedir}/gpib-1.0-py*.egg-info +%endif + +%if %{with tcl} +%files -n tcl-gpib %defattr(644,root,root,755) -/lib/modules/%{_kernel_ver}/misc/*.ko* +%doc language/tcl/README +%attr(755,root,root) %{_libdir}/libgpib_tcl-%{version}.so +%attr(755,root,root) %{_libdir}/libgpib_tcl.so +%{_examplesdir}/tcl-gpib-%{version} %endif -%if %{with smp} && %{with dist_kernel} -%files -n kernel-smp-%{mod_name} +%if %{with docs} +%files doc %defattr(644,root,root,755) -/lib/modules/%{_kernel_ver}smp/misc/*.ko* +%doc doc/doc_html/* %endif %endif