From c1b9f86cdd2789d213f149944173dd4afac37c71 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Sat, 13 Jun 2020 19:05:15 +0000 Subject: [PATCH] php < 7.4: Fix validation of PKG_CONFIG var They were assuming it is an absolute path, but it (conventionally) can be something to look up on the PATH too. Fixes #90202 --- pkgs/development/interpreters/php/default.nix | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/pkgs/development/interpreters/php/default.nix b/pkgs/development/interpreters/php/default.nix index 6ab682d97e6cf6..b56824c77238ad 100644 --- a/pkgs/development/interpreters/php/default.nix +++ b/pkgs/development/interpreters/php/default.nix @@ -195,9 +195,10 @@ let hardeningDisable = [ "bindnow" ]; - preConfigure = '' - # Don't record the configure flags since this causes unnecessary - # runtime dependencies + preConfigure = + # Don't record the configure flags since this causes unnecessary + # runtime dependencies + '' for i in main/build-defs.h.in scripts/php-config.in; do substituteInPlace $i \ --replace '@CONFIGURE_COMMAND@' '(omitted)' \ @@ -206,7 +207,14 @@ let done export EXTENSION_DIR=$out/lib/php/extensions - + '' + # PKG_CONFIG need not be a relative path + + lib.optionalString (! lib.versionAtLeast 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