From 2f3701e825ead270d613bbc28697d90f3f5274da Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Wed, 21 Aug 2024 08:03:38 +0200 Subject: test build for PR 65 --- config.m4 | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ php-pecl-phpy.spec | 21 ++++++++----------- 2 files changed, 69 insertions(+), 12 deletions(-) create mode 100644 config.m4 diff --git a/config.m4 b/config.m4 new file mode 100644 index 0000000..f10fc79 --- /dev/null +++ b/config.m4 @@ -0,0 +1,60 @@ +dnl $Id$ +dnl config.m4 for extension phpy + +PHP_ARG_WITH([python_version], + [version of python], + [AS_HELP_STRING([[--with-python-version[=VERSION]]], + [Specify version of python, or use default (ex: 3.12)])], [no], [no]) + +PHP_ARG_ENABLE([phpy], + [whether to enable phpy support], + [AS_HELP_STRING([--enable-phpy], + [Enable phpy support])], + [no]) + +if test "$PHP_PHPY" != "no"; then + dnl modern version use python3-embed, old (<= 3.6) use python3 + if test "$PHP_PYTHON_VERSION" = "no"; then + PKG_CHECK_MODULES([PYTHON], [python3-embed],, + [PKG_CHECK_MODULES([PYTHON], [python3])] + ) + else + PKG_CHECK_MODULES([PYTHON], [python-${PHP_PYTHON_VERSION}-embed],, + [PKG_CHECK_MODULES([PYTHON], [python-${PHP_PYTHON_VERSION}])] + ) + fi + PHP_EVAL_LIBLINE($PYTHON_LIBS, PHPY_SHARED_LIBADD) + PHP_EVAL_INCLINE($PYTHON_CFLAGS) + + PHP_REQUIRE_CXX() + + PHP_SUBST(PHPY_SHARED_LIBADD) + + AC_DEFINE(HAVE_PHPY, 1, [ Have phpy support ]) + + EXTRAS_CXXFLAGS="-Wall -Wno-unused-function -Wno-deprecated -Wno-deprecated-declarations -z now" + EXTRAS_CXXFLAGS="$EXTRAS_CXXFLAGS -std=c++14" + + if test -f "$abs_srcdir/phpy.cc"; then + phpy_source_dir=$abs_srcdir + elif test -f "phpy.cc"; then + phpy_source_dir=$(pwd) + else + phpy_source_dir="ext/phpy" + fi + + dnl AC_MSG_RESULT([$phpy_source_dir]) + + phpy_source_files=$(cd $phpy_source_dir && find src -type f -name "*.cc") + phpy_source_files="phpy.cc $phpy_source_files" + + PHP_NEW_EXTENSION(phpy, $phpy_source_files , $ext_shared,, $EXTRAS_CXXFLAGS, cxx) + + dnl AC_MSG_RESULT([$ext_builddir]) + + PHP_ADD_INCLUDE([$ext_srcdir/include]) + PHP_ADD_BUILD_DIR($ext_builddir/src) + PHP_ADD_BUILD_DIR($ext_builddir/src/bridge) + PHP_ADD_BUILD_DIR($ext_builddir/src/php) + PHP_ADD_BUILD_DIR($ext_builddir/src/python) +fi diff --git a/php-pecl-phpy.spec b/php-pecl-phpy.spec index 9be4941..f5d13c2 100644 --- a/php-pecl-phpy.spec +++ b/php-pecl-phpy.spec @@ -22,12 +22,13 @@ Summary: An extension for inter-calling Python and PHP Name: %{?scl_prefix}php-pecl-%{pecl_name} Version: 1.0.6 -Release: 2%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')} +Release: 3%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')} License: Apache-2.0 URL: https://pecl.php.net/package/%{pecl_name} Source0: https://pecl.php.net/get/%{sources}.tgz Source1: https://github.com/swoole/phpy/blob/%{version}/LICENSE +Source2: config.m4 Patch0: 61.patch Patch1: 64.patch @@ -35,15 +36,7 @@ BuildRequires: make BuildRequires: %{?dtsprefix}gcc BuildRequires: %{?scl_prefix}php-devel >= 8.1 BuildRequires: %{?scl_prefix}php-pear -# See https://github.com/swoole/phpy/issues/63 -%if 0%{?rhel} == 8 -# Retirement date: May 2029 (Full Life) -BuildRequires: python3.12-devel >= 3.8 -%global __usepyconf python3.12-config -%else -BuildRequires: python3-devel >= 3.8 -%global __usepyconf python3-config -%endif +BuildRequires: python3-devel Requires: %{?scl_prefix}php(zend-abi) = %{php_zend_api} Requires: %{?scl_prefix}php(api) = %{php_core_api} @@ -81,6 +74,9 @@ sed -s '/-Wall/d' -i config.m4 # See https://github.com/swoole/phpy/pull/64 %patch -P1 -p1 -b .pr64 +# See https://github.com/swoole/phpy/pull/65 +cp %{SOURCE2} . + # See https://github.com/swoole/phpy/pull/62 cp %{SOURCE1} . @@ -113,7 +109,6 @@ cd %{sources} cd ../NTS %configure \ --enable-phpy \ - --with-python-config=%{_root_bindir}/%{__usepyconf} \ --with-libdir=%{_lib} \ --with-php-config=%{__phpconfig} make %{?_smp_mflags} @@ -122,7 +117,6 @@ make %{?_smp_mflags} cd ../ZTS %configure \ --enable-phpy \ - --with-python-config=%{_root_bindir}/%{__usepyconf} \ --with-libdir=%{_lib} \ --with-php-config=%{__ztsphpconfig} make %{?_smp_mflags} @@ -185,6 +179,9 @@ cd %{sources} %changelog +* Wed Aug 21 2024 Remi Collet - 1.0.6-3 +- test build for PR 65 + * Tue Aug 20 2024 Remi Collet - 1.0.6-2 - use python3.12 on EL-8 - open https://github.com/swoole/phpy/pull/65 use PKG_CHECK_MODULES -- cgit