Merge pull request #172256 from jtojnar/php-cleanups

php: Remove fixes for abandoned PHP versions
This commit is contained in:
Elis Hirwing 2022-05-11 08:44:53 +02:00 committed by GitHub
commit b376c2d2af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 161 deletions

View File

@ -223,8 +223,7 @@ let
[ "--disable-all" ]
# PCRE
++ lib.optionals (lib.versionAtLeast version "7.4") [ "--with-external-pcre=${pcre2.dev}" ]
++ [ "PCRE_LIBDIR=${pcre2}" ]
++ [ "--with-external-pcre=${pcre2.dev}" ]
# Enable sapis
@ -232,10 +231,6 @@ let
++ lib.optional (!cliSupport) "--disable-cli"
++ lib.optional fpmSupport "--enable-fpm"
++ lib.optional pearSupport [ "--with-pear" "--enable-xml" "--with-libxml" ]
++ lib.optionals (pearSupport && (lib.versionOlder version "7.4")) [
"--enable-libxml"
"--with-libxml-dir=${libxml2.dev}"
]
++ lib.optional pharSupport "--enable-phar"
++ lib.optional (!phpdbgSupport) "--disable-phpdbg"
@ -270,14 +265,7 @@ let
done
export EXTENSION_DIR=$out/lib/php/extensions
''
# PKG_CONFIG need not be a relative path
+ lib.optionalString (lib.versionOlder version "7.4") ''
for i in $(find . -type f -name "*.m4"); do
substituteInPlace $i \
--replace 'test -x "$PKG_CONFIG"' 'type -P "$PKG_CONFIG" >/dev/null'
done
'' + ''
./buildconf --copy --force
if test -f $src/genfiles; then

View File

@ -1,44 +0,0 @@
diff --git a/ext/zlib/tests/bug55544.phpt b/ext/zlib/tests/bug55544.phpt
index a0d22f4fcebf4846da6781f424f87821626de5ea..e650fe6909f555d04834f4c08f7fd0d354b783e2 100644
--- a/ext/zlib/tests/bug55544.phpt
+++ b/ext/zlib/tests/bug55544.phpt
@@ -6,6 +6,9 @@ extension_loaded("zlib") or die("skip");
if (substr(PHP_OS, 0, 3) == 'WIN') {
die("skip not for windows");
}
+if (PHP_OS == "Darwin") {
+ die("skip not for darwin");
+}
?>
--INI--
output_handler=ob_gzhandler
diff --git a/ext/zlib/tests/gzencode_variation1.phpt b/ext/zlib/tests/gzencode_variation1.phpt
index c966b2cbc5b7..2f953168fa22 100644
--- a/ext/zlib/tests/gzencode_variation1.phpt
+++ b/ext/zlib/tests/gzencode_variation1.phpt
@@ -10,6 +10,10 @@ if( substr(PHP_OS, 0, 3) == "WIN" ) {
if (!extension_loaded("zlib")) {
print "skip - ZLIB extension not loaded";
}
+
+if (PHP_OS == "Darwin") {
+ print "skip - OS is encoded in headers, tested header is non Darwin";
+}
?>
--FILE--
<?php
diff --git a/ext/zlib/tests/gzencode_variation2.phpt b/ext/zlib/tests/gzencode_variation2.phpt
index 94ac42a5f1cd..9160cf519751 100644
--- a/ext/zlib/tests/gzencode_variation2.phpt
+++ b/ext/zlib/tests/gzencode_variation2.phpt
@@ -10,6 +10,10 @@ if( substr(PHP_OS, 0, 3) == "WIN" ) {
if (!extension_loaded("zlib")) {
print "skip - ZLIB extension not loaded";
}
+
+if (PHP_OS == "Darwin") {
+ print "skip - OS is encoded in headers, tested header is non Darwin";
+}
?>
--FILE--
<?php

View File

@ -300,9 +300,9 @@ lib.makeScope pkgs.newScope (self: with self; {
{
name = "dom";
buildInputs = [ libxml2 ];
configureFlags = [ "--enable-dom" ]
# Required to build on darwin.
++ lib.optionals (lib.versionOlder php.version "7.4") [ "--with-libxml-dir=${libxml2.dev}" ];
configureFlags = [
"--enable-dom"
];
}
{
name = "enchant";
@ -313,7 +313,7 @@ lib.makeScope pkgs.newScope (self: with self; {
doCheck = false;
}
{ name = "exif"; doCheck = false; }
{ name = "ffi"; buildInputs = [ libffi ]; enable = lib.versionAtLeast php.version "7.4"; }
{ name = "ffi"; buildInputs = [ libffi ]; }
{ name = "fileinfo"; buildInputs = [ pcre2 ]; }
{ name = "filter"; buildInputs = [ pcre2 ]; }
{ name = "ftp"; buildInputs = [ openssl ]; }
@ -326,33 +326,10 @@ lib.makeScope pkgs.newScope (self: with self; {
"--enable-gd-jis-conv"
];
doCheck = false;
enable = lib.versionAtLeast php.version "7.4";
}
{
name = "gd";
buildInputs = [ zlib gd libXpm ];
configureFlags = [
"--with-gd=${gd.dev}"
"--with-freetype-dir=${freetype.dev}"
"--with-jpeg-dir=${libjpeg.dev}"
"--with-png-dir=${libpng.dev}"
"--with-webp-dir=${libwebp}"
"--with-xpm-dir=${libXpm.dev}"
"--with-zlib-dir=${zlib.dev}"
"--enable-gd-jis-conv"
];
doCheck = false;
enable = lib.versionOlder php.version "7.4";
}
{
name = "gettext";
buildInputs = [ gettext ];
patches = lib.optionals (lib.versionOlder php.version "7.4") [
(fetchpatch {
url = "https://github.com/php/php-src/commit/632b6e7aac207194adc3d0b41615bfb610757f41.patch";
sha256 = "0xn3ivhc4p070vbk5yx0mzj2n7p04drz3f98i77amr51w0vzv046";
})
];
postPhpize = ''substituteInPlace configure --replace 'as_fn_error $? "Cannot locate header file libintl.h" "$LINENO" 5' ':' '';
configureFlags = [ "--with-gettext=${gettext}" ];
}
@ -361,7 +338,6 @@ lib.makeScope pkgs.newScope (self: with self; {
buildInputs = [ gmp ];
configureFlags = [ "--with-gmp=${gmp.dev}" ];
}
{ name = "hash"; enable = lib.versionOlder php.version "7.4"; }
{
name = "iconv";
configureFlags = [
@ -386,12 +362,6 @@ lib.makeScope pkgs.newScope (self: with self; {
{
name = "intl";
buildInputs = [ icu64 ];
patches = lib.optionals (lib.versionOlder php.version "7.4") [
(fetchpatch {
url = "https://github.com/php/php-src/commit/93a9b56c90c334896e977721bfb3f38b1721cec6.patch";
sha256 = "055l40lpyhb0rbjn6y23qkzdhvpp7inbnn6x13cpn4inmhjqfpg4";
})
];
}
{ name = "json"; enable = lib.versionOlder php.version "8.0"; }
{
@ -442,24 +412,7 @@ lib.makeScope pkgs.newScope (self: with self; {
+----------------------------------------------------------------------+
| Copyright (c) The PHP Group |
'')
] ++ lib.optionals (lib.versionOlder php.version "7.4.8") [
(pkgs.writeText "mysqlnd_fix_compression.patch" ''
--- a/ext/mysqlnd/mysqlnd.h
+++ b/ext/mysqlnd/mysqlnd.h
@@ -48,7 +48,7 @@
#define MYSQLND_DBG_ENABLED 0
#endif
-#if defined(MYSQLND_COMPRESSION_WANTED) && defined(HAVE_ZLIB)
+#if defined(MYSQLND_COMPRESSION_WANTED)
#define MYSQLND_COMPRESSION_ENABLED 1
#endif
'')
];
postPhpize = lib.optionalString (lib.versionOlder php.version "7.4") ''
substituteInPlace configure --replace '$OPENSSL_LIBDIR' '${openssl}/lib' \
--replace '$OPENSSL_INCDIR' '${openssl.dev}/include'
'';
}
# oci8 (7.4, 7.3, 7.2)
# odbc (7.4, 7.3, 7.2)
@ -468,25 +421,7 @@ lib.makeScope pkgs.newScope (self: with self; {
buildInputs = [ pcre2 ] ++ lib.optionals (!stdenv.isDarwin && lib.versionAtLeast php.version "8.0") [
valgrind.dev
];
patches = lib.optionals (lib.versionOlder php.version "7.4") [
(pkgs.writeText "zend_file_cache_config.patch" ''
--- a/ext/opcache/zend_file_cache.c
+++ b/ext/opcache/zend_file_cache.c
@@ -27,9 +27,9 @@
#include "ext/standard/md5.h"
#endif
+#include "ZendAccelerator.h"
#ifdef HAVE_OPCACHE_FILE_CACHE
-#include "ZendAccelerator.h"
#include "zend_file_cache.h"
#include "zend_shared_alloc.h"
#include "zend_accelerator_util_funcs.h"
'')
];
zendExtension = true;
doCheck = lib.versionAtLeast php.version "7.4";
# Tests launch the builtin webserver.
__darwinAllowLocalNetworking = true;
}
@ -568,9 +503,9 @@ lib.makeScope pkgs.newScope (self: with self; {
{
name = "simplexml";
buildInputs = [ libxml2 pcre2 ];
configureFlags = [ "--enable-simplexml" ]
# Required to build on darwin.
++ lib.optionals (lib.versionOlder php.version "7.4") [ "--with-libxml-dir=${libxml2.dev}" ];
configureFlags = [
"--enable-simplexml"
];
}
{
name = "snmp";
@ -583,9 +518,9 @@ lib.makeScope pkgs.newScope (self: with self; {
{
name = "soap";
buildInputs = [ libxml2 ];
configureFlags = [ "--enable-soap" ]
# Required to build on darwin.
++ lib.optionals (lib.versionOlder php.version "7.4") [ "--with-libxml-dir=${libxml2.dev}" ];
configureFlags = [
"--enable-soap"
];
doCheck = false;
}
{
@ -603,20 +538,12 @@ lib.makeScope pkgs.newScope (self: with self; {
patches = lib.optional (lib.versionAtLeast php.version "8.1")
../development/interpreters/php/fix-tokenizer-php81.patch;
}
{
name = "wddx";
buildInputs = [ libxml2 ];
internalDeps = [ php.extensions.session ];
configureFlags = [ "--enable-wddx" "--with-libxml-dir=${libxml2.dev}" ];
# Removed in php 7.4.
enable = lib.versionOlder php.version "7.4";
}
{
name = "xml";
buildInputs = [ libxml2 ];
configureFlags = [ "--enable-xml" ]
# Required to build on darwin.
++ lib.optionals (lib.versionOlder php.version "7.4") [ "--with-libxml-dir=${libxml2.dev}" ];
configureFlags = [
"--enable-xml"
];
doCheck = false;
}
{
@ -625,25 +552,25 @@ lib.makeScope pkgs.newScope (self: with self; {
internalDeps = [ php.extensions.dom ];
NIX_CFLAGS_COMPILE = [ "-I../.." "-DHAVE_DOM" ];
doCheck = false;
configureFlags = [ "--enable-xmlreader" ]
# Required to build on darwin.
++ lib.optionals (lib.versionOlder php.version "7.4") [ "--with-libxml-dir=${libxml2.dev}" ];
configureFlags = [
"--enable-xmlreader"
];
}
{
name = "xmlrpc";
buildInputs = [ libxml2 libiconv ];
# xmlrpc was unbundled in 8.0 https://php.watch/versions/8.0/xmlrpc
enable = lib.versionOlder php.version "8.0";
configureFlags = [ "--with-xmlrpc" ]
# Required to build on darwin.
++ lib.optionals (lib.versionOlder php.version "7.4") [ "--with-libxml-dir=${libxml2.dev}" ];
configureFlags = [
"--with-xmlrpc"
];
}
{
name = "xmlwriter";
buildInputs = [ libxml2 ];
configureFlags = [ "--enable-xmlwriter" ]
# Required to build on darwin.
++ lib.optionals (lib.versionOlder php.version "7.4") [ "--with-libxml-dir=${libxml2.dev}" ];
configureFlags = [
"--enable-xmlwriter"
];
}
{
name = "xsl";
@ -655,20 +582,17 @@ lib.makeScope pkgs.newScope (self: with self; {
{
name = "zip";
buildInputs = [ libzip pcre2 ];
configureFlags = [ "--with-zip" ]
++ lib.optionals (lib.versionOlder php.version "7.4") [ "--with-zlib-dir=${zlib.dev}" ]
++ lib.optionals (lib.versionOlder php.version "7.3") [ "--with-libzip" ];
configureFlags = [
"--with-zip"
];
doCheck = false;
}
{
name = "zlib";
buildInputs = [ zlib ];
patches = lib.optionals (lib.versionOlder php.version "7.4") [
# Derived from https://github.com/php/php-src/commit/f16b012116d6c015632741a3caada5b30ef8a699
../development/interpreters/php/zlib-darwin-tests.patch
configureFlags = [
"--with-zlib"
];
configureFlags = [ "--with-zlib" ]
++ lib.optionals (lib.versionOlder php.version "7.4") [ "--with-zlib-dir=${zlib.dev}" ];
}
];