diff options
| author | Pol Dellaiera <pol.dellaiera@protonmail.com> | 2023-09-11 15:09:39 +0200 |
|---|---|---|
| committer | Pol Dellaiera <pol.dellaiera@protonmail.com> | 2023-09-13 20:55:56 +0200 |
| commit | e0699b8e46ae4cc19d4a2fc43f1bacdabc0bf4df (patch) | |
| tree | 9b60c1f3519539dc995e189468e56ee67197d8b3 | |
| parent | Merge pull request #254531 from mibmo/module/pam-typo (diff) | |
| download | nixpkgs-origin/php/allow-passing-src-attr.tar.gz | |
php: add `phpSrc` attributeorigin/php/allow-passing-src-attr
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.
| -rw-r--r-- | pkgs/development/interpreters/php/generic.nix | 23 | ||||
| -rw-r--r-- | pkgs/development/interpreters/php/install-pear-nozlib-phar.nix | 8 |
2 files changed, 26 insertions, 5 deletions
diff --git a/pkgs/development/interpreters/php/generic.nix b/pkgs/development/interpreters/php/generic.nix index cee1e833f9a6..6b5ae52b9cec 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; diff --git a/pkgs/development/interpreters/php/install-pear-nozlib-phar.nix b/pkgs/development/interpreters/php/install-pear-nozlib-phar.nix new file mode 100644 index 000000000000..d359a7ed82ae --- /dev/null +++ b/pkgs/development/interpreters/php/install-pear-nozlib-phar.nix @@ -0,0 +1,8 @@ +{ + fetchurl +}: + +fetchurl { + url = "https://pear.php.net/install-pear-nozlib.phar"; + hash = "sha256-UblKVcsm030tNSA6mdeab+h7ZhANNz7MkFf4Z1iigjs="; +} |
