php: Unify the usage of the php package in php-packages.nix

Instead of using two different php packages in php-packages.nix, one
wrapper and one unwrapped, simply use the wrapper and use its
"unwrapped" attribute when necessary. Also, get rid of the packages
and extensions attributes from the base package, since they're no
longer needed.
This commit is contained in:
talyz 2020-04-29 12:52:39 +02:00
parent 5cad1b4aff
commit 2535cdfe91
No known key found for this signature in database
GPG key ID: 2DED2151F4671A2B
2 changed files with 14 additions and 26 deletions

View file

@ -14,8 +14,6 @@ let
, sha256
, extraPatches ? []
, defaultPhpExtensions
# Sapi flags
, cgiSupport ? true
, cliSupport ? true
@ -35,13 +33,6 @@ let
, ztsSupport ? apxs2Support
}@args:
let
self = generic args;
php-packages = (callPackage ../../../top-level/php-packages.nix {
php = self;
phpWithExtensions = self.withExtensions defaultPhpExtensions;
});
# buildEnv wraps php to provide additional extensions and
# configuration. Its usage is documented in
# doc/languages-frameworks/php.section.md.
@ -58,7 +49,7 @@ let
php = generic filteredArgs;
php-packages = (callPackage ../../../top-level/php-packages.nix {
inherit php phpWithExtensions;
php = phpWithExtensions;
});
allExtensionFunctions = prevExtensionFunctions ++ [ extensions ];
@ -249,7 +240,6 @@ let
passthru = {
buildEnv = mkBuildEnv {} [];
withExtensions = mkWithExtensions {} [];
inherit (php-packages) packages extensions;
};
meta = with stdenv.lib; {
@ -265,7 +255,6 @@ let
php72base = callPackage generic (_args // {
version = "7.2.29";
sha256 = "08xry2fgqgg8s0ym1hh11wkbr36av3zq1bn4krbciw1b7x8gb8ga";
defaultPhpExtensions = defaultPhpExtensionsWithHash;
# https://bugs.php.net/bug.php?id=76826
extraPatches = lib.optional stdenv.isDarwin ./php72-darwin-isfinite.patch;
@ -274,7 +263,6 @@ let
php73base = callPackage generic (_args // {
version = "7.3.16";
sha256 = "0bh499v9dfgh9k51w4rird1slb9rh9whp5h37fb84c98d992s1xq";
defaultPhpExtensions = defaultPhpExtensionsWithHash;
# https://bugs.php.net/bug.php?id=76826
extraPatches = lib.optional stdenv.isDarwin ./php73-darwin-isfinite.patch;
@ -283,7 +271,6 @@ let
php74base = callPackage generic (_args // {
version = "7.4.4";
sha256 = "17w2m4phhpj76x5fx67vgjrlkcczqvky3f5in1kjg2pch90qz3ih";
inherit defaultPhpExtensions;
});
defaultPhpExtensions = { all, ... }: with all; ([

View file

@ -1,4 +1,4 @@
{ stdenv, lib, pkgs, fetchgit, php, phpWithExtensions, autoconf, pkgconfig, re2c
{ stdenv, lib, pkgs, fetchgit, php, autoconf, pkgconfig, re2c
, gettext, bzip2, curl, libxml2, openssl, gmp, icu, oniguruma, libsodium
, html-tidy, libzip, zlib, pcre, pcre2, libxslt, aspell, openldap, cyrus_sasl
, uwimap, pam, libiconv, enchant1, libXpm, gd, libwebp, libjpeg, libpng
@ -8,7 +8,8 @@
let
buildPecl = import ../build-support/build-pecl.nix {
inherit php lib;
php = php.unwrapped;
inherit lib;
inherit (pkgs) stdenv autoreconfHook fetchurl re2c;
};
@ -43,7 +44,7 @@ in
installPhase = ''
mkdir -p $out/bin
install -D $src $out/libexec/box/box.phar
makeWrapper ${phpWithExtensions}/bin/php $out/bin/box \
makeWrapper ${php}/bin/php $out/bin/box \
--add-flags "-d phar.readonly=0 $out/libexec/box/box.phar"
'';
@ -71,7 +72,7 @@ in
installPhase = ''
mkdir -p $out/bin
install -D $src $out/libexec/composer/composer.phar
makeWrapper ${phpWithExtensions}/bin/php $out/bin/composer \
makeWrapper ${php}/bin/php $out/bin/composer \
--add-flags "$out/libexec/composer/composer.phar" \
--prefix PATH : ${pkgs.lib.makeBinPath [ pkgs.unzip ]}
'';
@ -163,7 +164,7 @@ in
installPhase = ''
mkdir -p $out/bin
install -D $src $out/libexec/phpcbf/phpcbf.phar
makeWrapper ${phpWithExtensions}/bin/php $out/bin/phpcbf \
makeWrapper ${php}/bin/php $out/bin/phpcbf \
--add-flags "$out/libexec/phpcbf/phpcbf.phar"
'';
@ -190,7 +191,7 @@ in
installPhase = ''
mkdir -p $out/bin
install -D $src $out/libexec/phpcs/phpcs.phar
makeWrapper ${phpWithExtensions}/bin/php $out/bin/phpcs \
makeWrapper ${php}/bin/php $out/bin/phpcs \
--add-flags "$out/libexec/phpcs/phpcs.phar"
'';
@ -217,7 +218,7 @@ in
installPhase = ''
mkdir -p $out/bin
install -D $src $out/libexec/phpstan/phpstan.phar
makeWrapper ${phpWithExtensions}/bin/php $out/bin/phpstan \
makeWrapper ${php}/bin/php $out/bin/phpstan \
--add-flags "$out/libexec/phpstan/phpstan.phar"
'';
@ -537,7 +538,7 @@ in
};
pdo_oci = buildPecl rec {
inherit (php) src version;
inherit (php.unwrapped) src version;
pname = "pdo_oci";
sourceRoot = "php-${version}/ext/pdo_oci";
@ -548,8 +549,8 @@ in
internalDeps = [ php.extensions.pdo ];
postPatch = ''
sed -i -e 's|OCISDKMANINC=`.*$|OCISDKMANINC="${pkgs.oracle-instantclient.dev}/include"|' config.m4
'';
sed -i -e 's|OCISDKMANINC=`.*$|OCISDKMANINC="${pkgs.oracle-instantclient.dev}/include"|' config.m4
'';
};
pdo_sqlsrv = buildPecl {
@ -746,11 +747,11 @@ in
pname = "php-${name}";
extensionName = name;
inherit (php) version src;
inherit (php.unwrapped) version src;
sourceRoot = "php-${php.version}/ext/${name}";
enableParallelBuilding = true;
nativeBuildInputs = [ php autoconf pkgconfig re2c ];
nativeBuildInputs = [ php.unwrapped autoconf pkgconfig re2c ];
inherit configureFlags internalDeps buildInputs
zendExtension doCheck;