summaryrefslogtreecommitdiffstats
path: root/php-pecl-ip2proxy.spec
diff options
context:
space:
mode:
Diffstat (limited to 'php-pecl-ip2proxy.spec')
-rw-r--r--php-pecl-ip2proxy.spec78
1 files changed, 45 insertions, 33 deletions
diff --git a/php-pecl-ip2proxy.spec b/php-pecl-ip2proxy.spec
index 2983acc..6064acd 100644
--- a/php-pecl-ip2proxy.spec
+++ b/php-pecl-ip2proxy.spec
@@ -1,43 +1,49 @@
# remirepo spec file for php-pecl-ip2proxy
#
-# Copyright (c) 2020-2022 Remi Collet
-# License: CC-BY-SA
+# Copyright (c) 2020-2023 Remi Collet
+# License: CC-BY-SA-4.0
# http://creativecommons.org/licenses/by-sa/4.0/
#
# Please, preserve the changelog entries
#
-%if 0%{?scl:1}
-%scl_package php-pecl-ip2proxy
-%endif
-%bcond_without tests
+%{?scl:%scl_package php-pecl-ip2proxy}
+
+%bcond_without tests
+
+# For PHP < 5.6 and EPEL-9
+%{!?__phpize: %global __phpize %{_bindir}/phpize}
+%{!?__ztsphpize: %global __ztsphpize %{_bindir}/zts-phpize}
+%{!?__phpconfig: %global __phpconfig %{_bindir}/php-config}
+%{!?__ztsphpconfig:%global __ztsphpconfig %{_bindir}/zts-php-config}
-%global pecl_name ip2proxy
-%global with_zts 0%{!?_without_zts:%{?__ztsphp:1}}
+%global pecl_name ip2proxy
+%global with_zts 0%{!?_without_zts:%{?__ztsphp:1}}
%if "%{php_version}" < "5.6"
-%global ini_name %{pecl_name}.ini
+%global ini_name %{pecl_name}.ini
%else
-%global ini_name 40-%{pecl_name}.ini
+%global ini_name 40-%{pecl_name}.ini
%endif
-
%global upstream_version 3.0.3
#global upstream_prever RC1
+%global sources %{pecl_name}-%{upstream_version}%{?upstream_prever}
+%global _configure ../%{sources}/configure
# see https://github.com/ip2location/ip2proxy-c/commits/master
%global gh_owner ip2location
%global gh_project ip2proxy-c
-%global gh_commit 83f9d64dec2dedad68048c4ef033e221d36b3b08
-%global gh_version 4.1.1
+%global gh_commit 15a7cb4d856d3c1016ad0494124a8822d6a33d42
+%global gh_version 4.1.2
%global gh_short %(c=%{gh_commit}; echo ${c:0:7})
Summary: Get proxy information of an IP address
Name: %{?scl_prefix}php-pecl-%{pecl_name}
# library is MIT, extension is PHP
-License: MIT and PHP
+License: MIT and PHP-3.01
Version: %{upstream_version}%{?upstream_prever:~%{upstream_prever}}
-Release: 1%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}
+Release: 3%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}
URL: https://pecl.php.net/package/igbinary
-Source0: https://pecl.php.net/get/%{pecl_name}-%{upstream_version}%{?upstream_prever}.tgz
+Source0: https://pecl.php.net/get/%{sources}.tgz
# library with no API nor ABI management
Source1: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{gh_project}-%{gh_version}-%{gh_short}.tar.gz
@@ -51,7 +57,6 @@ BuildRequires: %{?scl_prefix}php-devel
Requires: %{?scl_prefix}php(zend-abi) = %{php_zend_api}
Requires: %{?scl_prefix}php(api) = %{php_core_api}
-%{?_sclreq:Requires: %{?scl_prefix}runtime%{?_sclreq}%{?_isa}}
Provides: %{?scl_prefix}php-%{pecl_name} = %{version}
Provides: %{?scl_prefix}php-%{pecl_name}%{?_isa} = %{version}
@@ -71,7 +76,6 @@ Package built for PHP %(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSIO
%setup -q -c -a 1
mv %{gh_project}-%{gh_commit}/libIP2Proxy libIP2Proxy
mv %{gh_project}-%{gh_commit}/LICENSE.TXT LICENSE-%{gh_project}
-mv %{pecl_name}-%{upstream_version}%{?upstream_prever} NTS
# Don't install tests
sed -e 's/role="test"/role="src"/' \
@@ -79,8 +83,8 @@ sed -e 's/role="test"/role="src"/' \
-e '/README.TXT/s/role="doc"/role="src"/' \
-i package.xml
-cd NTS
-%patch0 -p1 -b .rpm
+cd %{sources}
+%patch -P0 -p1 -b .rpm
# Check version
extver=$(sed -n '/#define PHP_IP2PROXY_VERSION/{s/.* "//;s/".*$//;p}' php_ip2proxy.h)
@@ -90,8 +94,9 @@ if test "x${extver}" != "x%{upstream_version}%{?upstream_prever}"; then
fi
cd ..
+mkdir NTS
%if %{with_zts}
-cp -r NTS ZTS
+mkdir ZTS
%endif
cat <<EOF | tee %{ini_name}
@@ -103,19 +108,20 @@ EOF
%build
%{?dtsenable}
-cd NTS
-%{_bindir}/phpize
+cd %{sources}
+%{__phpize}
+
+cd ../NTS
%configure \
--with-ip2proxy=../libIP2Proxy \
- --with-php-config=%{_bindir}/php-config
+ --with-php-config=%{__phpconfig}
make %{?_smp_mflags}
%if %{with_zts}
cd ../ZTS
-%{_bindir}/zts-phpize
%configure \
--with-ip2proxy=../libIP2Proxy \
- --with-php-config=%{_bindir}/zts-php-config
+ --with-php-config=%{__ztsphpconfig}
make %{?_smp_mflags}
%endif
@@ -137,23 +143,24 @@ install -D -m 644 %{ini_name} %{buildroot}%{php_ztsinidir}/%{ini_name}
# Documentation
for i in $(grep 'role="doc"' package.xml | sed -e 's/^.*name="//;s/".*$//')
-do install -Dpm 644 NTS/$i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i
+do install -Dpm 644 %{sources}/$i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i
done
%check
+cd %{sources}
+
: simple NTS module load test
-%{_bindir}/php --no-php-ini \
+%{__php} --no-php-ini \
--define extension=%{buildroot}%{php_extdir}/%{pecl_name}.so \
--modules | grep %{pecl_name}
%if %{with tests}
: upstream test suite
-cd NTS
-TEST_PHP_EXECUTABLE=%{_bindir}/php \
+TEST_PHP_EXECUTABLE=%{__php} \
TEST_PHP_ARGS="-n -d extension=%{buildroot}%{php_extdir}/%{pecl_name}.so" \
REPORT_EXIT_STATUS=1 \
-%{_bindir}/php -n run-tests.php -q --show-diff
+%{__php} -n run-tests.php -q --show-diff
%endif
%if %{with_zts}
@@ -164,7 +171,6 @@ REPORT_EXIT_STATUS=1 \
%if %{with tests}
: upstream test suite
-cd ../ZTS
TEST_PHP_EXECUTABLE=%{__ztsphp} \
TEST_PHP_ARGS="-n -d extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so" \
REPORT_EXIT_STATUS=1 \
@@ -196,7 +202,7 @@ fi
%files
%{!?_licensedir:%global license %%doc}
%license LICENSE-%{gh_project}
-%{?_licensedir:%license NTS/LICENSE}
+%{?_licensedir:%license %{sources}/LICENSE}
%doc %{pecl_docdir}/%{pecl_name}
%config(noreplace) %{php_inidir}/%{ini_name}
@@ -210,6 +216,12 @@ fi
%changelog
+* Fri Sep 1 2023 Remi Collet <remi@remirepo.net> - 3.0.3-3
+- update bundled libip2proxy to 4.1.2
+
+* Fri Sep 1 2023 Remi Collet <remi@remirepo.net> - 3.0.3-2
+- build out of sources tree
+
* Tue Aug 2 2022 Remi Collet <remi@remirepo.net> - 3.0.3-1
- update to 3.0.3