From 5db5b25c63f920d49a8934107a8ddf97892684e9 Mon Sep 17 00:00:00 2001 From: talyz Date: Tue, 2 Jun 2020 15:34:58 +0200 Subject: [PATCH 1/2] php.extensions: Apply patches from the php source root by default --- pkgs/top-level/php-packages.nix | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pkgs/top-level/php-packages.nix b/pkgs/top-level/php-packages.nix index 82c68c2127d..9ba2e21305a 100644 --- a/pkgs/top-level/php-packages.nix +++ b/pkgs/top-level/php-packages.nix @@ -854,6 +854,9 @@ in inherit configureFlags internalDeps buildInputs zendExtension doCheck; + prePatch = "pushd ../.."; + postPatch = "popd"; + preConfigure = '' nullglobRestore=$(shopt -p nullglob) shopt -u nullglob # To make ?-globbing work @@ -989,8 +992,8 @@ in # included by all .c-files. patches = [ (pkgs.writeText "mysqlnd_config.patch" '' - --- a/mysqlnd.h - +++ b/mysqlnd.h + --- a/ext/mysqlnd/mysqlnd.h + +++ b/ext/mysqlnd/mysqlnd.h @@ -1,3 +1,6 @@ +#ifdef HAVE_CONFIG_H +#include "config.h" @@ -1013,8 +1016,8 @@ in # included after the ifdef... patches = lib.optional (lib.versionOlder php.version "7.4") [ (pkgs.writeText "zend_file_cache_config.patch" '' - --- a/zend_file_cache.c - +++ b/zend_file_cache.c + --- a/ext/opcache/zend_file_cache.c + +++ b/ext/opcache/zend_file_cache.c @@ -27,9 +27,9 @@ #include "ext/standard/md5.h" #endif From 2e0d4a8b39a03a0db0c6c3622473d333a44d1ec1 Mon Sep 17 00:00:00 2001 From: talyz Date: Sun, 31 May 2020 19:25:07 +0200 Subject: [PATCH 2/2] php.extensions.mysqlnd: Fix compression support HAVE_ZLIB has to be defined in mysqlnd.h for compression support to be turned on, but the configure script doesn't actually define it even when zlib is available. --- pkgs/top-level/php-packages.nix | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/pkgs/top-level/php-packages.nix b/pkgs/top-level/php-packages.nix index 9ba2e21305a..6394add9483 100644 --- a/pkgs/top-level/php-packages.nix +++ b/pkgs/top-level/php-packages.nix @@ -986,7 +986,7 @@ in # The configure script doesn't correctly add library link # flags, so we add them to the variable used by the Makefile # when linking. - MYSQLND_SHARED_LIBADD = "-lssl -lcrypto -lz"; + MYSQLND_SHARED_LIBADD = "-lssl -lcrypto"; # The configure script builds a config.h which is never # included. Let's include it in the main header file # included by all .c-files. @@ -1002,6 +1002,18 @@ in +----------------------------------------------------------------------+ | Copyright (c) The PHP Group | '') + (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' \