From 88bc5f8431eac15c9c3a03730126061cf556bd04 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Wed, 30 Sep 2020 16:02:13 +0200 Subject: add patch for PHP 8 from https://github.com/php-geospatial/geospatial/pull/27 --- geospatial-php8.patch | 442 +++++++++++++++++++++++++++++++++++++++++++++++ php-pecl-geospatial.spec | 38 ++-- 2 files changed, 459 insertions(+), 21 deletions(-) create mode 100644 geospatial-php8.patch diff --git a/geospatial-php8.patch b/geospatial-php8.patch new file mode 100644 index 0000000..149da98 --- /dev/null +++ b/geospatial-php8.patch @@ -0,0 +1,442 @@ +diff -up ./geospatial.c.pr ./geospatial.c +--- ./geospatial.c.pr 2019-01-08 12:37:40.000000000 +0100 ++++ ./geospatial.c 2020-09-30 15:55:40.091268935 +0200 +@@ -1,8 +1,8 @@ + /* + +----------------------------------------------------------------------+ +- | PHP Version 5/7 | ++ | PHP Version 5/7/8 | + +----------------------------------------------------------------------+ +- | Copyright (c) 1997-2016 The PHP Group | ++ | Copyright (c) 1997-2020 The PHP Group | + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | +@@ -34,6 +34,11 @@ + #include "Zend/zend_exceptions.h" + #include "ext/spl/spl_exceptions.h" + ++#ifndef TSRMLS_CC ++#define TSRMLS_CC ++#define TSRMLS_DC ++#endif ++ + ZEND_BEGIN_ARG_INFO_EX(haversine_args, 0, 0, 2) + ZEND_ARG_INFO(0, geoJsonPointFrom) + ZEND_ARG_INFO(0, geoJsonPointTo) +@@ -450,7 +455,7 @@ geo_cartesian polar_to_cartesian(double + geo_lat_long cartesian_to_polar(double x, double y, double z, geo_ellipsoid eli) + { + +- double nu, lambda, h; ++ double nu = 0, lambda, h; + geo_lat_long polar; + + /* aiming for 1m accuracy */ +diff -up ./.gitignore.pr ./.gitignore +--- ./.gitignore.pr 2019-01-08 12:37:40.000000000 +0100 ++++ ./.gitignore 2020-09-30 15:54:31.215548030 +0200 +@@ -15,6 +15,7 @@ + /config.sub + /configure + /configure.in ++/configure.ac + /config.status + /config.cache + /conftest +diff -up ./tests/decimal_to_dms.phpt.pr ./tests/decimal_to_dms.phpt +--- ./tests/decimal_to_dms.phpt.pr 2019-01-08 12:37:40.000000000 +0100 ++++ ./tests/decimal_to_dms.phpt 2020-09-30 15:54:31.215548030 +0200 +@@ -9,14 +9,14 @@ var_dump($dms); + $dms = decimal_to_dms(-1.034291666667, 'latitude'); + var_dump($dms); + ?> +---EXPECT-- ++--EXPECTF-- + array(4) { + ["degrees"]=> + int(1) + ["minutes"]=> + int(2) + ["seconds"]=> +- float(3.4500000011994) ++ float(3.450000001199%s) + ["direction"]=> + string(1) "W" + } +@@ -26,7 +26,7 @@ array(4) { + ["minutes"]=> + int(2) + ["seconds"]=> +- float(3.4500000011994) ++ float(3.450000001199%s) + ["direction"]=> + string(1) "S" + } +diff -up ./tests/dms_to_decimal.phpt.pr ./tests/dms_to_decimal.phpt +--- ./tests/dms_to_decimal.phpt.pr 2019-01-08 12:37:40.000000000 +0100 ++++ ./tests/dms_to_decimal.phpt 2020-09-30 15:54:31.215548030 +0200 +@@ -16,10 +16,10 @@ var_dump($decimal); + $decimal = dms_to_decimal(74, 34, 31, 'W'); + var_dump($decimal); + ?> +---EXPECT-- +-float(-1.0342916666667) +-float(-2.3071388888889) +-float(-2.3071388888889) +-float(-2.3071388888889) +-float(-0.1025) +-float(-74.575277777778) ++--EXPECTF-- ++float(-1.034291666666%s) ++float(-2.307138888888%s) ++float(-2.307138888888%s) ++float(-2.307138888888%s) ++float(-0.102%s) ++float(-74.57527777777%s) +diff -up ./tests/fraction_along-001.phpt.pr ./tests/fraction_along-001.phpt +--- ./tests/fraction_along-001.phpt.pr 2019-01-08 12:37:40.000000000 +0100 ++++ ./tests/fraction_along-001.phpt 2020-09-30 15:54:31.215548030 +0200 +@@ -12,7 +12,7 @@ var_dump(fraction_along_gc_line($point1, + var_dump(fraction_along_gc_line($point1, $point2, 0.8)); + var_dump(fraction_along_gc_line($point1, $point2, 1)); + ?> +---EXPECT-- ++--EXPECTF-- + array(2) { + ["type"]=> + string(5) "Point" +@@ -30,9 +30,9 @@ array(2) { + ["coordinates"]=> + array(2) { + [0]=> +- float(6.9998522347268) ++ float(6.999852234726%s) + [1]=> +- float(10.023944943799) ++ float(10.02394494379%s) + } + } + array(2) { +@@ -41,9 +41,9 @@ array(2) { + ["coordinates"]=> + array(2) { + [0]=> +- float(8.9999260791276) ++ float(8.999926079127%s) + [1]=> +- float(10.035925156339) ++ float(10.03592515633%s) + } + } + array(2) { +@@ -52,9 +52,9 @@ array(2) { + ["coordinates"]=> + array(2) { + [0]=> +- float(11.000073920872) ++ float(11.00007392087%s) + [1]=> +- float(10.035925156339) ++ float(10.03592515633%s) + } + } + array(2) { +@@ -63,9 +63,9 @@ array(2) { + ["coordinates"]=> + array(2) { + [0]=> +- float(13.000147765273) ++ float(13.00014776527%s) + [1]=> +- float(10.023944943799) ++ float(10.02394494379%s) + } + } + array(2) { +@@ -74,7 +74,7 @@ array(2) { + ["coordinates"]=> + array(2) { + [0]=> +- float(15) ++ float(1%s) + [1]=> + float(10) + } +diff -up ./tests/fraction_along-002.phpt.pr ./tests/fraction_along-002.phpt +--- ./tests/fraction_along-002.phpt.pr 2019-01-08 12:37:40.000000000 +0100 ++++ ./tests/fraction_along-002.phpt 2020-09-30 15:54:31.215548030 +0200 +@@ -7,15 +7,15 @@ $point2 = [ 'type' => 'Point', 'coordina + + var_dump(fraction_along_gc_line($point1, $point2, 0.5)); + ?> +---EXPECT-- ++--EXPECTF-- + array(2) { + ["type"]=> + string(5) "Point" + ["coordinates"]=> + array(2) { + [0]=> +- float(1.5809481271999) ++ float(1.580948127199%s) + [1]=> +- float(53.743611334154) ++ float(53.74361133415%s) + } + } +diff -up ./tests/geohash_decode.phpt.pr ./tests/geohash_decode.phpt +--- ./tests/geohash_decode.phpt.pr 2019-01-08 12:37:40.000000000 +0100 ++++ ./tests/geohash_decode.phpt 2020-09-30 15:54:31.215548030 +0200 +@@ -25,7 +25,7 @@ var_dump(geohash_decode('u2edjnw17enr')) + + var_dump(geohash_decode('zzzzzzzzzzzz')); + ?> +---EXPECT-- ++--EXPECTF-- + array(2) { + ["type"]=> + string(5) "Point" +@@ -87,9 +87,9 @@ array(2) { + ["coordinates"]=> + array(2) { + [0]=> +- float(171.02966308594) ++ float(171.029663085%s) + [1]=> +- float(49.671936035156) ++ float(49.6719360351%s) + } + } + array(2) { +@@ -98,9 +98,9 @@ array(2) { + ["coordinates"]=> + array(2) { + [0]=> +- float(171.02897644043) ++ float(171.028976440%s) + [1]=> +- float(49.67399597168) ++ float(49.6739959716%s) + } + } + array(2) { +@@ -109,9 +109,9 @@ array(2) { + ["coordinates"]=> + array(2) { + [0]=> +- float(171.0284614563) ++ float(171.028461456%s) + [1]=> +- float(49.674081802368) ++ float(49.6740818023%s) + } + } + array(2) { +@@ -120,9 +120,9 @@ array(2) { + ["coordinates"]=> + array(2) { + [0]=> +- float(171.02861166) ++ float(171.0286116%s) + [1]=> +- float(49.674146175385) ++ float(49.67414617%s) + } + } + array(2) { +@@ -131,9 +131,9 @@ array(2) { + ["coordinates"]=> + array(2) { + [0]=> +- float(171.02859556675) ++ float(171.0285955667%s) + [1]=> +- float(49.674154222012) ++ float(49.67415422201%s) + } + } + array(2) { +@@ -142,9 +142,9 @@ array(2) { + ["coordinates"]=> + array(2) { + [0]=> +- float(171.0285962373) ++ float(171.028596237%s) + [1]=> +- float(49.674153551459) ++ float(49.67415355145%s) + } + } + array(2) { +@@ -153,9 +153,9 @@ array(2) { + ["coordinates"]=> + array(2) { + [0]=> +- float(171.02859674022) ++ float(171.0285967402%s) + [1]=> +- float(49.674154138193) ++ float(49.67415413819%s) + } + } + array(2) { +@@ -186,9 +186,9 @@ array(2) { + ["coordinates"]=> + array(2) { + [0]=> +- float(16.40000006184) ++ float(16.4000000618%s) + [1]=> +- float(48.199999993667) ++ float(48.19999999366%s) + } + } + array(2) { +@@ -197,8 +197,8 @@ array(2) { + ["coordinates"]=> + array(2) { + [0]=> +- float(179.99999983236) ++ float(179.9999998323%s) + [1]=> +- float(89.999999916181) ++ float(89.99999991618%s) + } + } +diff -up ./tests/Greenwich.phpt.pr ./tests/Greenwich.phpt +--- ./tests/Greenwich.phpt.pr 2019-01-08 12:37:40.000000000 +0100 ++++ ./tests/Greenwich.phpt 2020-09-30 15:54:31.215548030 +0200 +@@ -25,16 +25,16 @@ var_dump($polar); + echo round($diferenceWGS84, 8),PHP_EOL; + echo round($diferenceAiry, 8),PHP_EOL; + ?> +---EXPECT-- ++--EXPECTF-- + array(2) { + ["type"]=> + string(5) "Point" + ["coordinates"]=> + array(2) { + [0]=> +- float(0.00013627354767069) ++ float(0.0001362735476706%s) + [1]=> +- float(51.477400823311) ++ float(51.47740082331%s) + } + } + 102.84185171 +diff -up ./tests/helmert.phpt.pr ./tests/helmert.phpt +--- ./tests/helmert.phpt.pr 2019-01-08 12:37:40.000000000 +0100 ++++ ./tests/helmert.phpt 2020-09-30 15:54:31.215548030 +0200 +@@ -8,12 +8,12 @@ $z = 5020322.478; + + var_dump(helmert($x, $y, $z)); + ?> +---EXPECT-- ++--EXPECTF-- + array(3) { + ["x"]=> +- float(3909460.0676711) ++ float(3909460.067671%s) + ["y"]=> +- float(-146987.30138174) ++ float(-146987.301381%s) + ["z"]=> +- float(5019888.0705933) ++ float(5019888.070593%s) + } +diff -up ./tests/initial_bearing1.phpt.pr ./tests/initial_bearing1.phpt +--- ./tests/initial_bearing1.phpt.pr 2019-01-08 12:37:40.000000000 +0100 ++++ ./tests/initial_bearing1.phpt 2020-09-30 15:54:31.216548027 +0200 +@@ -14,5 +14,5 @@ $to = array( + ); + var_dump(initial_bearing($from, $to)); + ?> +---EXPECT-- +-float(148.270892801715) ++--EXPECTF-- ++float(148.27089280171%s) +diff -up ./tests/initial_bearing2.phpt.pr ./tests/initial_bearing2.phpt +--- ./tests/initial_bearing2.phpt.pr 2019-01-08 12:37:40.000000000 +0100 ++++ ./tests/initial_bearing2.phpt 2020-09-30 15:54:31.216548027 +0200 +@@ -14,5 +14,5 @@ $to = array( + ); + var_dump(initial_bearing($from, $to)); + ?> +---EXPECT-- +-float(337.890440190492) ++--EXPECTF-- ++float(337.89044019049%s) +diff -up ./tests/JodrellBank.phpt.pr ./tests/JodrellBank.phpt +--- ./tests/JodrellBank.phpt.pr 2019-01-08 12:37:40.000000000 +0100 ++++ ./tests/JodrellBank.phpt 2020-09-30 15:54:31.216548027 +0200 +@@ -12,15 +12,15 @@ $polar = transform_datum($from, GEO_WGS8 + + var_dump($polar); + ?> +---EXPECT-- ++--EXPECTF-- + array(2) { + ["type"]=> + string(5) "Point" + ["coordinates"]=> + array(2) { + [0]=> +- float(-2.3057171628534) ++ float(-2.305717162853%s) + [1]=> +- float(53.235974015543) ++ float(53.23597401554%s) + } + } +diff -up ./tests/OSGB36_to_WGS84.phpt.pr ./tests/OSGB36_to_WGS84.phpt +--- ./tests/OSGB36_to_WGS84.phpt.pr 2019-01-08 12:37:40.000000000 +0100 ++++ ./tests/OSGB36_to_WGS84.phpt 2020-09-30 15:54:31.216548027 +0200 +@@ -13,14 +13,14 @@ $polar = transform_datum($from, GEO_AIRY + var_dump(decimal_to_dms($polar['coordinates'][1], 'latitude')); + var_dump(decimal_to_dms($polar['coordinates'][0] ,'longitude')); + ?> +---EXPECT-- ++--EXPECTF-- + array(4) { + ["degrees"]=> + int(53) + ["minutes"]=> + int(14) + ["seconds"]=> +- float(11.493372672732) ++ float(11.49337267273%s) + ["direction"]=> + string(1) "N" + } +@@ -30,7 +30,7 @@ array(4) { + ["minutes"]=> + int(18) + ["seconds"]=> +- float(30.817794659248) ++ float(30.81779465924%s) + ["direction"]=> + string(1) "W" + } +diff -up ./tests/polar_to_cartesian.phpt.pr ./tests/polar_to_cartesian.phpt +--- ./tests/polar_to_cartesian.phpt.pr 2019-01-08 12:37:40.000000000 +0100 ++++ ./tests/polar_to_cartesian.phpt 2020-09-30 15:54:31.216548027 +0200 +@@ -7,12 +7,12 @@ $long = 1.4669444444; + + var_dump(polar_to_cartesian($lat, $long, GEO_AIRY_1830)); + ?> +---EXPECT-- ++--EXPECTF-- + array(3) { + ["x"]=> +- float(3810891.6734396) ++ float(3810891.673439%s) + ["y"]=> +- float(97591.624686311) ++ float(97591.62468631%s) + ["z"]=> +- float(5095766.3939034) ++ float(5095766.393903%s) + } diff --git a/php-pecl-geospatial.spec b/php-pecl-geospatial.spec index 7b14c21..c9e0513 100644 --- a/php-pecl-geospatial.spec +++ b/php-pecl-geospatial.spec @@ -1,6 +1,6 @@ # remirepo spec file for php-pecl-geospatial # -# Copyright (c) 2015-2019 Remi Collet +# Copyright (c) 2015-2020 Remi Collet # License: CC-BY-SA # http://creativecommons.org/licenses/by-sa/4.0/ # @@ -32,13 +32,15 @@ Version: 0.2.1 %if 0%{?gh_date:1} Release: 0.11.%{gh_date}git%{gh_short}%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} %else -Release: 2%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +Release: 3%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} %endif License: PHP -URL: http://pecl.php.net/package/%{pecl_name} +URL: https://pecl.php.net/package/%{pecl_name} Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{pecl_name}-%{version}-%{gh_short}.tar.gz +Patch0: %{pecl_name}-php8.patch + BuildRequires: %{?dtsprefix}gcc BuildRequires: %{?scl_prefix}php-devel BuildRequires: %{?scl_prefix}php-pear @@ -59,31 +61,19 @@ Provides: %{?scl_prefix}php-pecl-%{pecl_name} = %{version}-%{rele Provides: %{?scl_prefix}php-pecl-%{pecl_name}%{?_isa} = %{version}-%{release} %endif -%if "%{?vendor}" == "Remi Collet" && 0%{!?scl:1} && 0%{?rhel} +%if "%{?packager}" == "Remi Collet" && 0%{!?scl:1} && 0%{?rhel} # Other third party repo stuff -%if "%{php_version}" > "5.6" -Obsoletes: php56u-pecl-%{pecl_name} <= %{version} -Obsoletes: php56w-pecl-%{pecl_name} <= %{version} -%endif -%if "%{php_version}" > "7.0" -Obsoletes: php70u-pecl-%{pecl_name} <= %{version} -Obsoletes: php70w-pecl-%{pecl_name} <= %{version} -%endif -%if "%{php_version}" > "7.1" -Obsoletes: php71u-pecl-%{pecl_name} <= %{version} -Obsoletes: php71w-pecl-%{pecl_name} <= %{version} -%endif %if "%{php_version}" > "7.2" Obsoletes: php72u-pecl-%{pecl_name} <= %{version} -Obsoletes: php72w-pecl-%{pecl_name} <= %{version} %endif %if "%{php_version}" > "7.3" -Obsoletes: php73-pecl-%{pecl_name} <= %{version} -Obsoletes: php73w-pecl-%{pecl_name} <= %{version} +Obsoletes: php73-pecl-%{pecl_name} <= %{version} %endif %if "%{php_version}" > "7.4" -Obsoletes: php74-pecl-%{pecl_name} <= %{version} -Obsoletes: php74w-pecl-%{pecl_name} <= %{version} +Obsoletes: php74-pecl-%{pecl_name} <= %{version} +%endif +%if "%{php_version}" > "8.0" +Obsoletes: php80-pecl-%{pecl_name} <= %{version} %endif %endif @@ -114,6 +104,8 @@ mv NTS/package.xml . %{?_licensedir:sed -e '/LICENSE/s/role="doc"/role="src"/' -i package.xml} cd NTS +%patch0 -p1 -b .pr + # Check version as upstream often forget to update this extver=$(sed -n '/#define PHP_GEOSPATIAL_VERSION/{s/.* "//;s/".*$//;p}' php_geospatial.h) if test "x${extver}" != "x%{version}%{?prever}%{?gh_date:-dev}"; then @@ -257,6 +249,10 @@ fi %changelog +* Wed Sep 30 2020 Remi Collet - 0.2.1-3 +- add patch for PHP 8 from + https://github.com/php-geospatial/geospatial/pull/27 + * Tue Sep 03 2019 Remi Collet - 0.2.1-2 - rebuild for 7.4.0RC1 -- cgit