[packages/linux-gpib] - added php7 patch, package php binding

qboosh qboosh at pld-linux.org
Thu Jul 14 19:05:10 CEST 2016


commit 76a67c9afd5202b3700ef3a5498572e30a85f2d9
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Thu Jul 14 19:05:28 2016 +0200

    - added php7 patch, package php binding

 linux-gpib-php7.patch | 37 +++++++++++++++++++++++++++++++++++
 linux-gpib.spec       | 53 +++++++++++++++++++++++++++++++++++++++++++++++++--
 2 files changed, 88 insertions(+), 2 deletions(-)
---
diff --git a/linux-gpib.spec b/linux-gpib.spec
index d379ad6..b2946a2 100644
--- a/linux-gpib.spec
+++ b/linux-gpib.spec
@@ -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)
diff --git a/linux-gpib-php7.patch b/linux-gpib-php7.patch
new file mode 100644
index 0000000..045fbf0
--- /dev/null
+++ b/linux-gpib-php7.patch
@@ -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);
+ }
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/linux-gpib.git/commitdiff/76a67c9afd5202b3700ef3a5498572e30a85f2d9



More information about the pld-cvs-commit mailing list