Skip to content

Commit

Permalink
php: add phpSrc attribute
Browse files Browse the repository at this point in the history
This will allow building PHP from source, without using `.overrideAttrs()`.
  • Loading branch information
drupol committed Sep 11, 2023
1 parent 6559511 commit ea0735f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
18 changes: 13 additions & 5 deletions pkgs/development/interpreters/php/generic.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -278,6 +285,10 @@ let
substituteInPlace configure --replace "-lstdc++" "-lc++"
'';

preInstall = ''
cp -f ${pearInstallPhar} ./pear/install-pear-nozlib.phar
'';

postInstall = ''
test -d $out/etc || mkdir $out/etc
cp php.ini-production $out/etc/php.ini
Expand All @@ -291,10 +302,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;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
fetchurl
}:

fetchurl {
url = "https://pear.php.net/install-pear-nozlib.phar";
hash = "sha256-UblKVcsm030tNSA6mdeab+h7ZhANNz7MkFf4Z1iigjs=";
}

0 comments on commit ea0735f

Please sign in to comment.