summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2021-01-27 12:16:07 +0100
committerRemi Collet <remi@remirepo.net>2021-01-27 12:16:07 +0100
commitb859fd4f4c2df1a7a34fa6106836a9478542b9fa (patch)
treeb42104a91c031258dfc34f8d064023bc44e02b17
parentddf0a070312f3ea6a827411cc7263be3ba8e7e27 (diff)
add patch for PHP 8
-rw-r--r--libvirt-php8.patch329
-rw-r--r--php-libvirt.spec13
2 files changed, 339 insertions, 3 deletions
diff --git a/libvirt-php8.patch b/libvirt-php8.patch
new file mode 100644
index 0000000..c60a5da
--- /dev/null
+++ b/libvirt-php8.patch
@@ -0,0 +1,329 @@
+From 103665cce450db8e8c6cc0f8c3fe1e69186f3bb2 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
+Date: Mon, 4 May 2020 18:18:23 +0100
+Subject: [PATCH] src: don't declare global variables in header files
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+In Fedora 32 and later the linker will no longer merge duplicate global
+variables. Thus headers need fixing to properly use "extern" and put the
+actual declaration in the source files.
+
+Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
+Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
+---
+ src/libvirt-connection.c | 2 ++
+ src/libvirt-connection.h | 2 +-
+ src/libvirt-domain.c | 2 ++
+ src/libvirt-domain.h | 2 +-
+ src/libvirt-network.c | 2 ++
+ src/libvirt-network.h | 2 +-
+ src/libvirt-nodedev.c | 2 ++
+ src/libvirt-nodedev.h | 2 +-
+ src/libvirt-nwfilter.c | 2 ++
+ src/libvirt-nwfilter.h | 2 +-
+ src/libvirt-php.c | 2 ++
+ src/libvirt-php.h | 2 +-
+ src/libvirt-snapshot.c | 2 ++
+ src/libvirt-snapshot.h | 2 +-
+ src/libvirt-storage.c | 3 +++
+ src/libvirt-storage.h | 4 ++--
+ src/libvirt-stream.c | 2 ++
+ src/libvirt-stream.h | 2 +-
+ 18 files changed, 29 insertions(+), 10 deletions(-)
+
+diff --git a/src/libvirt-connection.c b/src/libvirt-connection.c
+index 9e70031..adc0045 100644
+--- a/src/libvirt-connection.c
++++ b/src/libvirt-connection.c
+@@ -11,6 +11,8 @@
+
+ DEBUG_INIT("connection");
+
++int le_libvirt_connection;
++
+ /*
+ * Private function name: free_resources_on_connection
+ * Since version: 0.4.2
+diff --git a/src/libvirt-connection.h b/src/libvirt-connection.h
+index 0cae5ec..20f79e0 100644
+--- a/src/libvirt-connection.h
++++ b/src/libvirt-connection.h
+@@ -46,7 +46,7 @@
+ RETURN_FALSE; \
+ } while (0)
+
+-int le_libvirt_connection;
++extern int le_libvirt_connection;
+
+ typedef struct _php_libvirt_connection {
+ virConnectPtr conn;
+diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
+index f594253..419630b 100644
+--- a/src/libvirt-domain.c
++++ b/src/libvirt-domain.c
+@@ -15,6 +15,8 @@
+
+ DEBUG_INIT("domain");
+
++int le_libvirt_domain;
++
+ void
+ php_libvirt_domain_dtor(virt_resource *rsrc TSRMLS_DC)
+ {
+diff --git a/src/libvirt-domain.h b/src/libvirt-domain.h
+index 8b80c9c..8640df8 100644
+--- a/src/libvirt-domain.h
++++ b/src/libvirt-domain.h
+@@ -120,7 +120,7 @@
+ PHP_FE(libvirt_list_active_domains, arginfo_libvirt_conn) \
+ PHP_FE(libvirt_list_inactive_domains, arginfo_libvirt_conn)
+
+-int le_libvirt_domain;
++extern int le_libvirt_domain;
+
+ typedef struct _php_libvirt_domain {
+ virDomainPtr domain;
+diff --git a/src/libvirt-network.c b/src/libvirt-network.c
+index 673790a..3888780 100644
+--- a/src/libvirt-network.c
++++ b/src/libvirt-network.c
+@@ -11,6 +11,8 @@
+
+ DEBUG_INIT("network");
+
++int le_libvirt_network;
++
+ void
+ php_libvirt_network_dtor(virt_resource *rsrc TSRMLS_DC)
+ {
+diff --git a/src/libvirt-network.h b/src/libvirt-network.h
+index 604b803..634c681 100644
+--- a/src/libvirt-network.h
++++ b/src/libvirt-network.h
+@@ -45,7 +45,7 @@
+ PHP_FE(libvirt_list_all_networks, arginfo_libvirt_conn_optflags) \
+ PHP_FE(libvirt_list_networks, arginfo_libvirt_conn_optflags)
+
+-int le_libvirt_network;
++extern int le_libvirt_network;
+
+ typedef struct _php_libvirt_network {
+ virNetworkPtr network;
+diff --git a/src/libvirt-nodedev.c b/src/libvirt-nodedev.c
+index 5cfe428..e7a8535 100644
+--- a/src/libvirt-nodedev.c
++++ b/src/libvirt-nodedev.c
+@@ -11,6 +11,8 @@
+
+ DEBUG_INIT("nodedev");
+
++int le_libvirt_nodedev;
++
+ void
+ php_libvirt_nodedev_dtor(virt_resource *rsrc TSRMLS_DC)
+ {
+diff --git a/src/libvirt-nodedev.h b/src/libvirt-nodedev.h
+index 350b213..1357037 100644
+--- a/src/libvirt-nodedev.h
++++ b/src/libvirt-nodedev.h
+@@ -35,7 +35,7 @@
+ RETURN_FALSE; \
+ } while (0)
+
+-int le_libvirt_nodedev;
++extern int le_libvirt_nodedev;
+
+ typedef struct _php_libvirt_nodedev {
+ virNodeDevicePtr device;
+diff --git a/src/libvirt-nwfilter.c b/src/libvirt-nwfilter.c
+index d949052..fa824cb 100644
+--- a/src/libvirt-nwfilter.c
++++ b/src/libvirt-nwfilter.c
+@@ -11,6 +11,8 @@
+
+ DEBUG_INIT("nwfilter");
+
++int le_libvirt_nwfilter;
++
+ void
+ php_libvirt_nwfilter_dtor(virt_resource *rsrc TSRMLS_DC)
+ {
+diff --git a/src/libvirt-nwfilter.h b/src/libvirt-nwfilter.h
+index c0cebb3..b450419 100644
+--- a/src/libvirt-nwfilter.h
++++ b/src/libvirt-nwfilter.h
+@@ -42,7 +42,7 @@
+ RETURN_FALSE; \
+ } while (0) \
+
+-int le_libvirt_nwfilter;
++extern int le_libvirt_nwfilter;
+
+ typedef struct _php_libvirt_nwfilter {
+ virNWFilterPtr nwfilter;
+diff --git a/src/libvirt-php.c b/src/libvirt-php.c
+index 75cbf68..04f73d9 100644
+--- a/src/libvirt-php.c
++++ b/src/libvirt-php.c
+@@ -31,6 +31,8 @@
+
+ DEBUG_INIT("core");
+
++ZEND_DECLARE_MODULE_GLOBALS(libvirt)
++
+ #ifndef EXTWIN
+ /* Additional binaries */
+ const char *features[] = { "screenshot", "create-image", "screenshot-convert", NULL };
+diff --git a/src/libvirt-php.h b/src/libvirt-php.h
+index d6e61c5..f0c77ce 100644
+--- a/src/libvirt-php.h
++++ b/src/libvirt-php.h
+@@ -155,7 +155,7 @@ ZEND_BEGIN_MODULE_GLOBALS(libvirt)
+ int binding_resources_count;
+ ZEND_END_MODULE_GLOBALS(libvirt)
+
+-ZEND_DECLARE_MODULE_GLOBALS(libvirt)
++ZEND_EXTERN_MODULE_GLOBALS(libvirt)
+
+ /* Private definitions */
+ void set_error(char *msg TSRMLS_DC);
+diff --git a/src/libvirt-snapshot.c b/src/libvirt-snapshot.c
+index e1445a2..3b10c10 100644
+--- a/src/libvirt-snapshot.c
++++ b/src/libvirt-snapshot.c
+@@ -11,6 +11,8 @@
+
+ DEBUG_INIT("snapshot");
+
++int le_libvirt_snapshot;
++
+ void php_libvirt_snapshot_dtor(virt_resource *rsrc TSRMLS_DC)
+ {
+ php_libvirt_snapshot *snapshot = (php_libvirt_snapshot *)rsrc->ptr;
+diff --git a/src/libvirt-snapshot.h b/src/libvirt-snapshot.h
+index 32db210..f8339a6 100644
+--- a/src/libvirt-snapshot.h
++++ b/src/libvirt-snapshot.h
+@@ -39,7 +39,7 @@
+ RETURN_FALSE; \
+ } while (0) \
+
+-int le_libvirt_snapshot;
++extern int le_libvirt_snapshot;
+
+ typedef struct _php_libvirt_snapshot {
+ virDomainSnapshotPtr snapshot;
+diff --git a/src/libvirt-storage.c b/src/libvirt-storage.c
+index 0c0d943..593d4d2 100644
+--- a/src/libvirt-storage.c
++++ b/src/libvirt-storage.c
+@@ -12,6 +12,9 @@
+
+ DEBUG_INIT("storage");
+
++int le_libvirt_storagepool;
++int le_libvirt_volume;
++
+ void
+ php_libvirt_storagepool_dtor(virt_resource *rsrc TSRMLS_DC)
+ {
+diff --git a/src/libvirt-storage.h b/src/libvirt-storage.h
+index de972f7..7620c15 100644
+--- a/src/libvirt-storage.h
++++ b/src/libvirt-storage.h
+@@ -83,8 +83,8 @@
+ RETURN_FALSE; \
+ } while (0) \
+
+-int le_libvirt_storagepool;
+-int le_libvirt_volume;
++extern int le_libvirt_storagepool;
++extern int le_libvirt_volume;
+
+ typedef struct _php_libvirt_storagepool {
+ virStoragePoolPtr pool;
+diff --git a/src/libvirt-stream.c b/src/libvirt-stream.c
+index f1fc1ff..11d7752 100644
+--- a/src/libvirt-stream.c
++++ b/src/libvirt-stream.c
+@@ -11,6 +11,8 @@
+
+ DEBUG_INIT("stream");
+
++int le_libvirt_stream;
++
+ void
+ php_libvirt_stream_dtor(virt_resource *rsrc TSRMLS_DC)
+ {
+diff --git a/src/libvirt-stream.h b/src/libvirt-stream.h
+index 89b28a6..c041ccb 100644
+--- a/src/libvirt-stream.h
++++ b/src/libvirt-stream.h
+@@ -20,7 +20,7 @@
+ PHP_FE(libvirt_stream_send, arginfo_libvirt_stream_send) \
+ PHP_FE(libvirt_stream_recv, arginfo_libvirt_stream_recv)
+
+-int le_libvirt_stream;
++extern int le_libvirt_stream;
+
+ typedef struct _php_libvirt_stream {
+ virStreamPtr stream;
+
+From 6d2731fb449bf5b3eca3f77626e57576e545357d Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Wed, 27 Jan 2021 12:07:05 +0100
+Subject: [PATCH] add compat macros for PHP 8
+
+---
+ src/libvirt-php.h | 12 ++++++++++++
+ 1 file changed, 12 insertions(+)
+
+diff --git a/src/libvirt-php.h b/src/libvirt-php.h
+index f0c77ce..2735272 100644
+--- a/src/libvirt-php.h
++++ b/src/libvirt-php.h
+@@ -7,6 +7,18 @@
+ #ifndef PHP_LIBVIRT_H
+ #define PHP_LIBVIRT_H 1
+
++/* Use in PHP5, unneeded in PHP 7, droped in PHP 8*/
++#ifndef TSRMLS_CC
++#define TSRMLS_D void
++#define TSRMLS_DC
++#define TSRMLS_C
++#define TSRMLS_CC
++
++#define TSRMLS_FETCH()
++#define TSRMLS_FETCH_FROM_CTX(ctx)
++#define TSRMLS_SET_CTX(ctx)
++#endif
++
+ /* Network constants */
+ #define VIR_NETWORKS_ACTIVE 1
+ #define VIR_NETWORKS_INACTIVE 2
+
+From 05cdb0548dca50f32cbdaec559f2a1f5bd2ad5d3 Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Wed, 27 Jan 2021 12:09:37 +0100
+Subject: [PATCH 2/2] missing ;
+
+---
+ src/libvirt-domain.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
+index 29cb452..45deba6 100644
+--- a/src/libvirt-domain.c
++++ b/src/libvirt-domain.c
+@@ -2000,7 +2000,7 @@ PHP_FUNCTION(libvirt_domain_interface_addresses)
+ GET_DOMAIN_FROM_ARGS("rl", &zdomain, &source);
+
+ if ((count = virDomainInterfaceAddresses(domain->domain, &ifaces, source, 0)) < 0) {
+- RETURN_FALSE
++ RETURN_FALSE;
+ goto cleanup;
+ }
+
+
diff --git a/php-libvirt.spec b/php-libvirt.spec
index 49ec6f8..154132f 100644
--- a/php-libvirt.spec
+++ b/php-libvirt.spec
@@ -36,7 +36,7 @@
Name: %{?sub_prefix}php-libvirt
Version: 0.5.5
-Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
+Release: 4%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
Summary: PHP language binding for Libvirt
Group: Development/Libraries
@@ -45,6 +45,9 @@ License: LGPLv2+
URL: http://libvirt.org/php
Source0: http://libvirt.org/sources/php/libvirt-php-%{version}.tar.gz
+Patch0: libvirt-php8.patch
+
+BuildRequires: make
BuildRequires: %{?dtsprefix}gcc
BuildRequires: %{?scl_prefix}php-devel
BuildRequires: libvirt-devel >= %{req_libvirt_version}
@@ -64,7 +67,7 @@ Provides: %{?scl_prefix}php-libvirt = %{version}-%{release}
Provides: %{?scl_prefix}php-libvirt%{?_isa} = %{version}-%{release}
%endif
-%if "%{?vendor}" == "Remi Collet" && 0%{!?scl:1} && 0%{?rhel}
+%if "%{?packager}" == "Remi Collet" && 0%{!?scl:1} && 0%{?rhel}
%if "%{php_version}" > "7.2"
Obsoletes: php72u-libvirt <= %{version}
Obsoletes: php72w-libvirt <= %{version}
@@ -110,6 +113,7 @@ This package contain the document for php-libvirt.
%prep
%setup -q -n libvirt-php-%{version}
+%patch0 -p1 -b .php8
%build
@@ -147,7 +151,7 @@ rm %{buildroot}%{php_extdir}/%{extname}.la
: simple module load test
%{__php} --no-php-ini \
--define extension=%{buildroot}%{php_extdir}/%{extname}.so \
- --modules | grep libvirt
+ --modules | grep '^libvirt$'
%files
@@ -162,6 +166,9 @@ rm %{buildroot}%{php_extdir}/%{extname}.la
%changelog
+* Wed Jan 27 2021 Remi Collet <remi@remirepo.net> - 0.5.5-4
+- add patch for PHP 8
+
* Sun Feb 9 2020 Remi Collet <remi@remirepo.net> - 0.5.5-1
- Upgrade to 0.5.5