From 60b25188efaf2ae2b8d240b94148c52985b6ec27 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Fri, 17 Apr 2020 09:22:18 +0200 Subject: fix build with PHP 8 using patches from https://github.com/nginx/unit/pull/425 --- 0001-fix-lib-name-for-PHP-8.patch | 29 +++++++++++++++++++++++ 0002-define-TSRMLS_-macro-dropped-in-PHP-8.patch | 30 ++++++++++++++++++++++++ unit-php.spec | 11 ++++++++- 3 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 0001-fix-lib-name-for-PHP-8.patch create mode 100644 0002-define-TSRMLS_-macro-dropped-in-PHP-8.patch diff --git a/0001-fix-lib-name-for-PHP-8.patch b/0001-fix-lib-name-for-PHP-8.patch new file mode 100644 index 0000000..45c6479 --- /dev/null +++ b/0001-fix-lib-name-for-PHP-8.patch @@ -0,0 +1,29 @@ +From 9d99f33602237f7ee189efc7056ba4c6205699b3 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Fri, 17 Apr 2020 09:14:43 +0200 +Subject: [PATCH 1/2] fix lib name for PHP 8 + +--- + auto/modules/php | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/auto/modules/php b/auto/modules/php +index e2e5498..dd31a52 100644 +--- a/auto/modules/php ++++ b/auto/modules/php +@@ -100,7 +100,11 @@ if /bin/sh -c "${NXT_PHP_CONFIG} --version" >> $NXT_AUTOCONF_ERR 2>&1; then + `${NXT_PHP_CONFIG} --libs`" + + else +- NXT_PHP_LIB="-lphp${NXT_PHP_VERSION%%.*}" ++ if [ ${NXT_PHP_MAJOR_VERSION} -ge 8 ]; then ++ NXT_PHP_LIB="-lphp" ++ else ++ NXT_PHP_LIB="-lphp${NXT_PHP_VERSION%%.*}" ++ fi + + if [ "$NXT_PHP_LIB_PATH" != "" ]; then + # "php-config --ldflags" does not contain path to libphp, but +-- +2.25.2 + diff --git a/0002-define-TSRMLS_-macro-dropped-in-PHP-8.patch b/0002-define-TSRMLS_-macro-dropped-in-PHP-8.patch new file mode 100644 index 0000000..430ad21 --- /dev/null +++ b/0002-define-TSRMLS_-macro-dropped-in-PHP-8.patch @@ -0,0 +1,30 @@ +From 3ef107ac8bea3043e493786e2f8ad20366b0ad7d Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Fri, 17 Apr 2020 09:16:03 +0200 +Subject: [PATCH 2/2] define TSRMLS_* macro dropped in PHP 8 + +--- + src/nxt_php_sapi.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/src/nxt_php_sapi.c b/src/nxt_php_sapi.c +index f505365..b059146 100644 +--- a/src/nxt_php_sapi.c ++++ b/src/nxt_php_sapi.c +@@ -29,6 +29,13 @@ + #define NXT_PHP7 1 + #endif + ++#ifndef TSRMLS_CC ++#define TSRMLS_CC ++#define TSRMLS_DC ++#define TSRMLS_D void ++#define TSRMLS_C ++#endif ++ + typedef struct { + char *cookie; + nxt_str_t path_info; +-- +2.25.2 + diff --git a/unit-php.spec b/unit-php.spec index 0d60ba0..647766c 100644 --- a/unit-php.spec +++ b/unit-php.spec @@ -35,13 +35,16 @@ Requires: %{scl_prefix}php-embedded Name: %{?scl_prefix}%{project}-php Version: 1.17.0 -Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +Release: 2%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} Summary: PHP module for NGINX Unit License: ASL 2.0 URL: https://unit.nginx.org/ Source0: https://github.com/%{gh_owner}/%{project}/archive/%{gh_commit}/%{project}-%{version}-%{gh_short}.tar.gz +Patch0: 0001-fix-lib-name-for-PHP-8.patch +Patch1: 0002-define-TSRMLS_-macro-dropped-in-PHP-8.patch + BuildRequires: %{?dtsprefix}gcc BuildRequires: %{?scl_prefix}php-devel BuildRequires: %{?scl_prefix}php-embedded @@ -60,6 +63,8 @@ and NGINX unit %{version}. %prep %setup -qn %{project}-%{gh_commit} +%patch0 -p1 +%patch1 -p1 %build @@ -118,6 +123,10 @@ make %{modname}-install DESTDIR=%{buildroot} %changelog +* Fri Apr 17 2020 Remi Collet - 1.17.0-2 +- fix build with PHP 8 using patches from + https://github.com/nginx/unit/pull/425 + * Fri Apr 17 2020 Remi Collet - 1.17.0-1 - update to 1.17.0 -- cgit