]> git.pld-linux.org Git - packages/linux-gpib.git/commitdiff
- added php7 patch, package php binding
authorJakub Bogusz <qboosh@pld-linux.org>
Thu, 14 Jul 2016 17:05:28 +0000 (19:05 +0200)
committerJakub Bogusz <qboosh@pld-linux.org>
Thu, 14 Jul 2016 17:05:28 +0000 (19:05 +0200)
linux-gpib-php7.patch [new file with mode: 0644]
linux-gpib.spec

diff --git a/linux-gpib-php7.patch b/linux-gpib-php7.patch
new file mode 100644 (file)
index 0000000..045fbf0
--- /dev/null
@@ -0,0 +1,37 @@
+--- linux-gpib-4.0.3/language/php/gpib.c.orig  2016-04-09 15:33:09.000000000 +0200
++++ linux-gpib-4.0.3/language/php/gpib.c       2016-07-14 16:47:47.929605503 +0200
+@@ -60,6 +60,10 @@
+ #include "php.h"
+ #include "ext/standard/info.h"
++#if PHP_MAJOR_VERSION >= 7
++#define PZVAL_IS_REF(pz) Z_ISREF_P(pz)
++#endif
++
+ /* ---- macros for declarations -------------------------- */
+ #define FUN_ACCESSOR(functionName) \
+@@ -495,7 +499,11 @@
+               ) == FAILURE) {
+               return;
+       }
++#if PHP_MAJOR_VERSION >= 7
++      RETURN_STRING((char*)gpib_error_string(n));
++#else
+       RETURN_STRING((char*)gpib_error_string(n), 1);
++#endif
+ }
+ #endif
+@@ -550,7 +558,11 @@
+         memset(p,0,len+1);
+       r=ibrd(n,p,len);
+         p[ibcnt]='\0';
++#if PHP_MAJOR_VERSION >= 7
++        ZVAL_STRING(z,p);
++#else
+         ZVAL_STRING(z,p,1);
++#endif
+       free(p);
+       RETURN_LONG(r);
+ }
index d379ad6f9f7c61b1a54c876b157324af84c87fe5..b2946a221881ca24400078ae82a3689dc454f4e7 100644 (file)
@@ -1,6 +1,5 @@
 # TODO:
 # - where to get firmware from?
-# - PHP 7 support
 #
 # Conditional build:
 %bcond_without kernel          # kernel modules
@@ -16,6 +15,8 @@
 %bcond_without python          # Python binding
 %bcond_without tcl             # Tcl binding
 
+%include       /usr/lib/rpm/macros.perl
+%define                php_name        php%{?php_suffix}
 Summary:       GPIB (IEEE 488) Linux support
 Summary(pl.UTF-8):     Obsługa GPIB (IEEE 488) dla Linuksa
 Name:          linux-gpib
@@ -32,6 +33,7 @@ Patch2:               %{name}-python.patch
 Patch3:                %{name}-perl.patch
 Patch4:                %{name}-firmwaredir.patch
 Patch5:                %{name}-guile2.patch
+Patch6:                %{name}-php7.patch
 URL:           http://linux-gpib.sourceforge.net/
 BuildRequires: autoconf >= 2.50
 BuildRequires: automake
@@ -46,7 +48,7 @@ BuildRequires:        bison
 BuildRequires: flex
 %{?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}
@@ -133,6 +135,20 @@ 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:      %{name}-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
@@ -220,6 +236,7 @@ cd drivers/gpib\
 %patch3 -p1
 %patch4 -p1
 %patch5 -p1
+%patch6 -p1
 
 # disable modules build by default, just install userspace header
 echo 'SUBDIRS = gpib/include' > drivers/Makefile.am
@@ -294,16 +311,32 @@ ln -snf /lib/udev/ni_usb_gpib $RPM_BUILD_ROOT/etc/hotplug/usb/ni_usb_gpib
 %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
@@ -328,6 +361,14 @@ rm -rf $RPM_BUILD_ROOT
 %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)
@@ -394,6 +435,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.133442 seconds and 4 git commands to generate.