diff options
author | Pol Dellaiera <pol.dellaiera@protonmail.com> | 2023-11-08 22:57:01 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-08 22:57:01 +0100 |
commit | c038b79502f379b1fe988520fc0d5f01c5799156 (patch) | |
tree | 9cd17bea9e87b83a2046167afd50da4cb164bb69 /pkgs/development/interpreters/php/generic.nix | |
parent | dbc3aaedc04c90748688a825eef6b70ac9a23b19 (diff) |
php: add `phpSrc` attribute (#254556)
This will allow building PHP from source, without using `.overrideAttrs()`. When the new attribute `phpSrc` is not set, the default behavior (with `fetchurl`) is used.
Diffstat (limited to 'pkgs/development/interpreters/php/generic.nix')
-rw-r--r-- | pkgs/development/interpreters/php/generic.nix | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/pkgs/development/interpreters/php/generic.nix b/pkgs/development/interpreters/php/generic.nix index 38ac50081423a..ba5ce5537bbbc 100644 --- a/pkgs/development/interpreters/php/generic.nix +++ b/pkgs/development/interpreters/php/generic.nix @@ -33,10 +33,12 @@ let , jq , version - , hash + , phpSrc ? null + , hash ? null , extraPatches ? [ ] , packageOverrides ? (final: prev: { }) , phpAttrsOverrides ? (attrs: { }) + , pearInstallPhar ? (callPackage ./install-pear-nozlib-phar.nix { }) # Sapi flags , cgiSupport ? true @@ -192,6 +194,11 @@ let mkWithExtensions = prevArgs: prevExtensionFunctions: extensions: mkBuildEnv prevArgs prevExtensionFunctions { inherit extensions; }; + + defaultPhpSrc = fetchurl { + url = "https://www.php.net/distributions/php-${version}.tar.bz2"; + inherit hash; + }; in stdenv.mkDerivation ( let @@ -278,6 +285,15 @@ let substituteInPlace configure --replace "-lstdc++" "-lc++" ''; + # When compiling PHP sources from Github, this file is missing and we + # need to install it ourselves. + # On the other hand, a distribution includes this file by default. + preInstall = '' + if [[ ! -f ./pear/install-pear-nozlib.phar ]]; then + cp ${pearInstallPhar} ./pear/install-pear-nozlib.phar + fi + ''; + postInstall = '' test -d $out/etc || mkdir $out/etc cp php.ini-production $out/etc/php.ini @@ -291,10 +307,7 @@ let $dev/share/man/man1/ ''; - src = fetchurl { - url = "https://www.php.net/distributions/php-${version}.tar.bz2"; - inherit hash; - }; + src = if phpSrc == null then defaultPhpSrc else phpSrc; patches = [ ./fix-paths-php7.patch ] ++ extraPatches; |