]> git.pld-linux.org Git - packages/linux-gpib.git/blobdiff - linux-gpib.spec
- disabled php extension, build nondeterministic on builders
[packages/linux-gpib.git] / linux-gpib.spec
index b771b5be954b06a7e2cc8bdf857c3ac38a98e109..6c271277015f598df498e501d6b0afe3afe724ef 100644 (file)
@@ -1,37 +1,56 @@
-# TODO:
-# - where to get firmware from?
-# - guile 2 support
-# - PHP 7 support
 #
 # Conditional build:
 %bcond_without kernel          # kernel modules
+%bcond_without drivers_isa     # ISA kernel drivers [ix86 only]
+%bcond_without drivers_pcmcia  # PCMCIA support in kernel drivers
+%bcond_without drivers_usb     # USB kernel drivers
 %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 guile           # guile binding
 %bcond_without perl            # Perl binding
-%bcond_without php             # PHP binding
+%bcond_with    php             # PHP binding
 %bcond_without python          # Python binding
 %bcond_without tcl             # Tcl binding
 
+# The goal here is to have main, userspace, package built once with
+# simple release number, and only rebuild kernel packages with kernel
+# version as part of release number, without the need to bump release
+# with every kernel change.
+%if 0%{?_pld_builder:1} && %{with kernel} && %{with userspace}
+%{error:kernel and userspace cannot be built at the same time on PLD builders}
+exit 1
+%endif
+
+%ifnarch %{ix86}
+%undefine      with_drivers_isa
+%undefine      with_drivers_pcmcia
+%endif
+
+%include       /usr/lib/rpm/macros.perl
+%define                php_name        php%{?php_suffix}
+
+%define                rel     7
+%define                pname   linux-gpib
 Summary:       GPIB (IEEE 488) Linux support
 Summary(pl.UTF-8):     Obsługa GPIB (IEEE 488) dla Linuksa
-Name:          linux-gpib
+Name:          %{pname}%{?_pld_builder:%{?with_kernel:-kernel}}%{_alt_kernel}
 Version:       4.0.3
-%define        rel     0.1
-Release:       %{rel}
+Release:       %{rel}%{?_pld_builder:%{?with_kernel:@%{_kernel_ver_str}}}
 License:       GPL v2+
 Group:         Applications/System
-Source0:       http://downloads.sourceforge.net/linux-gpib/%{name}-%{version}.tar.gz
+Source0:       http://downloads.sourceforge.net/linux-gpib/%{pname}-%{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
+Patch0:                %{pname}-include_file.patch
+Patch1:                %{pname}-destdir.patch
+Patch2:                %{pname}-python.patch
+Patch3:                %{pname}-perl.patch
+Patch4:                %{pname}-firmwaredir.patch
+Patch5:                %{pname}-guile2.patch
+Patch6:                %{pname}-php7.patch
 URL:           http://linux-gpib.sourceforge.net/
 BuildRequires: autoconf >= 2.50
 BuildRequires: automake
@@ -44,14 +63,18 @@ BuildRequires:      kernel-module-build >= 3:2.6.8
 BuildRequires: bison
 %{?with_docs:BuildRequires:    docbook-utils}
 BuildRequires: flex
-%{?with_guile:BuildRequires:   guile-devel < 5:2.0}
+%{?with_guile:BuildRequires:   guile-devel >= 1.4}
 %{?with_perl:BuildRequires:    perl-devel}
-%{?with_php:BuildRequires:     php-devel < 4:7}
+%{?with_php:BuildRequires:     %{php_name}-devel >= 3:5}
 %{?with_python:BuildRequires:  python-devel >= 2}
 BuildRequires: readline-devel
 %{?with_tcl:BuildRequires:     tcl-devel}
 %endif
-Requires:      %{name}-libs = %{version}-%{release}
+Requires:      %{pname}-libs = %{version}-%{release}
+# for agilent_82357a and ni_usb_gpib
+Suggests:      fxload
+# for agilent_82357a, agilent/hp_82341, agilent/hp_82350a, ni_usb_gpib
+Suggests:      linux-gpib-firmware
 BuildRoot:     %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
 %description
@@ -64,7 +87,7 @@ Pakiet Linux GPIB służy do obsługi sprzętu GPIB (IEEE 488).
 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:      %{pname} = %{version}-%{release}
 Requires:      hotplug
 
 %description hotplug
@@ -88,7 +111,7 @@ Biblioteka współdzielona GPIB.
 Summary:       Header file for GPIB library
 Summary(pl.UTF-8):     Plik nagłówkowy biblioteki GPIB
 Group:         Development/Libraries
-Requires:      %{name}-libs = %{version}-%{release}
+Requires:      %{pname}-libs = %{version}-%{release}
 
 %description devel
 Header file for GPIB library.
@@ -100,7 +123,7 @@ Plik nagłówkowy biblioteki GPIB.
 Summary:       Static GPIB library
 Summary(pl.UTF-8):     Biblioteka statyczna GPIB
 Group:         Development/Libraries
-Requires:      %{name}-devel = %{version}-%{release}
+Requires:      %{pname}-devel = %{version}-%{release}
 
 %description static
 Static GPIB library.
@@ -108,11 +131,24 @@ Static GPIB library.
 %description static -l pl.UTF-8
 Biblioteka statyczna GPIB.
 
+%package -n guile-gpib
+Summary:       Guile bindings for GPIB library
+Summary(pl.UTF-8):     Wiązania Guile do biblioteki GPIB
+Group:         Development/Languages/Perl
+Requires:      %{pname}-libs = %{version}-%{release}
+Requires:      guile-libs
+
+%description -n guile-gpib
+Guile bindings for GPIB library.
+
+%description -n guile-gpib -l pl.UTF-8
+Wiązania Guile do biblioteki 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}
+Requires:      %{pname}-libs = %{version}-%{release}
 
 %description -n perl-gpib
 Perl bindings for GPIB library.
@@ -120,11 +156,25 @@ Perl bindings for GPIB library.
 %description -n perl-gpib -l pl.UTF-8
 Wiązania Perla do biblioteki GPIB.
 
+%package -n %{php_name}-gpib
+Summary:       PHP bindings for GPIB library
+Summary(pl.UTF-8):     Wiązania PHP do biblioteki GPIB
+Group:         Development/Languages/PHP
+Provides:      php(gpib) = %{version}
+Requires:      %{pname}-libs = %{version}-%{release}
+%{?requires_php_extension}
+
+%description -n %{php_name}-gpib
+PHP bindings for GPIB library.
+
+%description -n %{php_name}-gpib -l pl.UTF-8
+Wiązania PHP 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:      %{pname}-libs = %{version}-%{release}
 Requires:      python-libs
 
 %description -n python-gpib
@@ -137,7 +187,7 @@ Wiązania Pythona do biblioteki 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:      %{pname}-libs = %{version}-%{release}
 Requires:      tcl
 
 %description -n tcl-gpib
@@ -191,7 +241,8 @@ Ten pakiet zawiera sterowniki dla Linuksa do urządzeń GPIB (IEEE 488).\
 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\
+%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\
+cd ../..\
 %{nil}
 
 %define install_kernel_pkg()\
@@ -200,12 +251,14 @@ cd drivers/gpib\
 %{?with_kernel:%{expand:%create_kernel_packages}}
 
 %prep
-%setup -q
+%setup -q -n %{pname}-%{version}
 %patch0 -p1
 %patch1 -p1
 %patch2 -p1
 %patch3 -p1
 %patch4 -p1
+%patch5 -p1
+%patch6 -p1
 
 # disable modules build by default, just install userspace header
 echo 'SUBDIRS = gpib/include' > drivers/Makefile.am
@@ -221,11 +274,12 @@ done
 %{__autoconf}
 %{__autoheader}
 %{__automake}
-%configure \
-%ifarch %{ix86}
-       --enable-isa \
-       --enable-pcmcia \
+%if %{with guile}
+CPPFLAGS="%{rpmcppflags} -I/usr/include/guile/2.0"
 %endif
+%configure \
+       %{?with_drivers_isa:--enable-isa} \
+       %{?with_drivers_pcmcia:--enable-pcmcia} \
        %{!?with_docs:--disable-documentation} \
        %{!?with_guile:--disable-guile-binding} \
        %{!?with_perl:--disable-perl-binding} \
@@ -258,28 +312,56 @@ cp -a drivers/gpib/installed/* $RPM_BUILD_ROOT
        HOTPLUG_USB_CONF_DIR=/lib/udev \
        UDEV_RULES_DIR=/lib/udev/rules.d \
        USB_FIRMWARE_DIR=/lib/firmware
+
+%if %{with hotplug}
 # 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
+%else
+%{__rm} $RPM_BUILD_ROOT/lib/udev/*.usermap
+%endif
 
 # obsoleted by pkg-config
 %{__rm} $RPM_BUILD_ROOT%{_libdir}/libgpib.la
 
+%if %{with guile}
+%{__rm} $RPM_BUILD_ROOT%{_libdir}/libgpib-guile.la
+%if %{with static_libs}
+%{__rm} $RPM_BUILD_ROOT%{_libdir}/libgpib-guile.a
+%endif
+%endif
+
 %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 php}
+install -d $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d
+cat <<'EOF' > $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d/gpib.ini
+; Enable gpib extension module
+extension=gpib_php.so
+EOF
+
+%{__rm} $RPM_BUILD_ROOT%{php_extensiondir}/gpib_php.la
+%if %{with static_libs}
+%{__rm} $RPM_BUILD_ROOT%{php_extensiondir}/gpib_php.a
+%endif
+%endif
+
 %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
@@ -298,6 +380,20 @@ rm -rf $RPM_BUILD_ROOT
 %post  libs -p /sbin/ldconfig
 %postun        libs -p /sbin/ldconfig
 
+%post  -n guile-gpib -p /sbin/ldconfig
+%postun        -n guile-gpib -p /sbin/ldconfig
+
+%post  -n tcl-gpib -p /sbin/ldconfig
+%postun        -n tcl-gpib -p /sbin/ldconfig
+
+%post  -n %{php_name}-gpib
+%php_webserver_restart
+
+%postun        -n %{php_name}-gpib
+if [ "$1" = 0 ]; then
+       %php_webserver_restart
+fi
+
 %if %{with userspace}
 %files
 %defattr(644,root,root,755)
@@ -309,14 +405,6 @@ rm -rf $RPM_BUILD_ROOT
 /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
@@ -345,6 +433,13 @@ rm -rf $RPM_BUILD_ROOT
 %{_libdir}/libgpib.a
 %endif
 
+%if %{with guile}
+%files -n guile-gpib
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_libdir}/libgpib-guile-%{version}.so
+%attr(755,root,root) %{_libdir}/libgpib-guile.so
+%endif
+
 %if %{with perl}
 %files -n perl-gpib
 %defattr(644,root,root,755)
@@ -357,6 +452,14 @@ rm -rf $RPM_BUILD_ROOT
 %{_examplesdir}/perl-gpib-%{version}
 %endif
 
+%if %{with php}
+%files -n %{php_name}-gpib
+%defattr(644,root,root,755)
+%config(noreplace) %verify(not md5 mtime size) %{php_sysconfdir}/conf.d/gpib.ini
+%attr(755,root,root) %{php_extensiondir}/gpib_php-%{version}.so
+%attr(755,root,root) %{php_extensiondir}/gpib_php.so
+%endif
+
 %if %{with python}
 %files -n python-gpib
 %defattr(644,root,root,755)
This page took 0.071356 seconds and 4 git commands to generate.