2021-06-26 09:46:46 +02:00
|
|
|
{ stdenv
|
2023-04-09 11:53:42 +02:00
|
|
|
, config
|
|
|
|
, callPackages
|
2021-06-26 09:46:46 +02:00
|
|
|
, lib
|
|
|
|
, pkgs
|
|
|
|
, phpPackage
|
|
|
|
, autoconf
|
|
|
|
, pkg-config
|
|
|
|
, aspell
|
|
|
|
, bzip2
|
|
|
|
, curl
|
|
|
|
, cyrus_sasl
|
2023-01-17 07:43:41 +01:00
|
|
|
, enchant2
|
2021-06-26 09:46:46 +02:00
|
|
|
, freetds
|
|
|
|
, gd
|
|
|
|
, gettext
|
|
|
|
, gmp
|
|
|
|
, html-tidy
|
|
|
|
, icu64
|
|
|
|
, libffi
|
|
|
|
, libiconv
|
2022-10-01 17:19:02 +02:00
|
|
|
, libkrb5
|
2021-06-26 09:46:46 +02:00
|
|
|
, libsodium
|
|
|
|
, libxml2
|
|
|
|
, libxslt
|
|
|
|
, libzip
|
|
|
|
, net-snmp
|
2022-12-29 14:07:39 +01:00
|
|
|
, nix-update-script
|
2021-06-26 09:46:46 +02:00
|
|
|
, oniguruma
|
|
|
|
, openldap
|
2022-06-17 13:28:48 +02:00
|
|
|
, openssl_1_1
|
2021-06-26 09:46:46 +02:00
|
|
|
, openssl
|
2023-10-26 07:11:24 +02:00
|
|
|
, overrideSDK
|
2021-06-26 09:46:46 +02:00
|
|
|
, pam
|
|
|
|
, pcre2
|
|
|
|
, postgresql
|
2023-09-08 12:37:24 +02:00
|
|
|
, bison
|
2021-06-26 09:46:46 +02:00
|
|
|
, re2c
|
|
|
|
, readline
|
|
|
|
, rsync
|
|
|
|
, sqlite
|
|
|
|
, unixODBC
|
|
|
|
, uwimap
|
|
|
|
, valgrind
|
|
|
|
, zlib
|
2023-06-26 20:51:23 +02:00
|
|
|
, fetchpatch
|
2020-03-24 19:30:18 +01:00
|
|
|
}:
|
2014-03-24 13:37:36 +01:00
|
|
|
|
2024-05-07 11:17:14 +02:00
|
|
|
lib.makeScope pkgs.newScope (self: let
|
|
|
|
inherit (self) buildPecl callPackage mkExtension php;
|
2024-05-07 11:18:34 +02:00
|
|
|
|
|
|
|
builders = import ../build-support/php/builders {
|
|
|
|
inherit callPackages callPackage buildPecl;
|
|
|
|
};
|
2024-05-07 11:17:14 +02:00
|
|
|
in {
|
2023-04-09 11:53:42 +02:00
|
|
|
buildPecl = callPackage ../build-support/php/build-pecl.nix {
|
2020-04-29 12:52:39 +02:00
|
|
|
php = php.unwrapped;
|
2020-03-28 22:37:22 +01:00
|
|
|
};
|
2014-03-24 13:37:36 +01:00
|
|
|
|
2024-05-07 11:18:34 +02:00
|
|
|
inherit (builders.v1) buildComposerProject composerHooks mkComposerRepository;
|
2023-04-09 11:53:42 +02:00
|
|
|
|
2020-03-28 22:37:22 +01:00
|
|
|
# Wrap mkDerivation to prepend pname with "php-" to make names consistent
|
|
|
|
# with how buildPecl does it and make the file easier to overview.
|
2023-02-08 18:34:41 +01:00
|
|
|
mkDerivation = origArgs:
|
|
|
|
let
|
|
|
|
args = lib.fix (lib.extends
|
|
|
|
(_: previousAttrs: {
|
|
|
|
pname = "php-${previousAttrs.pname}";
|
|
|
|
passthru = (previousAttrs.passthru or { }) // {
|
|
|
|
updateScript = nix-update-script { };
|
|
|
|
};
|
|
|
|
meta = (previousAttrs.meta or { }) // {
|
|
|
|
mainProgram = previousAttrs.meta.mainProgram or previousAttrs.pname;
|
|
|
|
};
|
|
|
|
})
|
|
|
|
(if lib.isFunction origArgs then origArgs else (_: origArgs))
|
|
|
|
);
|
|
|
|
in
|
|
|
|
pkgs.stdenv.mkDerivation args;
|
2019-04-24 13:04:28 +02:00
|
|
|
|
2021-06-28 17:43:53 +02:00
|
|
|
# Function to build an extension which is shipped as part of the php
|
|
|
|
# source, based on the php version.
|
|
|
|
#
|
|
|
|
# Name passed is the name of the extension and is automatically used
|
2022-12-18 01:39:44 +01:00
|
|
|
# to add the configureFlag "--enable-${name}", which can be overridden.
|
2021-06-28 17:43:53 +02:00
|
|
|
#
|
|
|
|
# Build inputs is used for extra deps that may be needed. And zendExtension
|
|
|
|
# will mark the extension as a zend extension or not.
|
2022-06-24 16:34:54 +02:00
|
|
|
mkExtension = lib.makeOverridable
|
|
|
|
({ name
|
2023-06-26 20:51:23 +02:00
|
|
|
, configureFlags ? [ "--enable-${extName}" ]
|
|
|
|
, internalDeps ? [ ]
|
|
|
|
, postPhpize ? ""
|
|
|
|
, buildInputs ? [ ]
|
|
|
|
, zendExtension ? false
|
|
|
|
, doCheck ? true
|
|
|
|
, extName ? name
|
|
|
|
, ...
|
|
|
|
}@args: stdenv.mkDerivation ((builtins.removeAttrs args [ "name" ]) // {
|
2021-06-28 17:43:53 +02:00
|
|
|
pname = "php-${name}";
|
2022-11-10 12:05:24 +01:00
|
|
|
extensionName = extName;
|
2021-06-28 17:43:53 +02:00
|
|
|
|
2022-04-30 02:24:55 +02:00
|
|
|
outputs = [ "out" "dev" ];
|
|
|
|
|
2021-06-28 17:43:53 +02:00
|
|
|
inherit (php.unwrapped) version src;
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2022-04-30 02:24:55 +02:00
|
|
|
nativeBuildInputs = [
|
|
|
|
php.unwrapped
|
|
|
|
autoconf
|
|
|
|
pkg-config
|
|
|
|
re2c
|
2023-09-08 12:37:24 +02:00
|
|
|
bison
|
2022-04-30 02:24:55 +02:00
|
|
|
];
|
|
|
|
|
|
|
|
inherit configureFlags internalDeps buildInputs zendExtension doCheck;
|
2021-06-28 17:43:53 +02:00
|
|
|
|
2022-04-30 02:15:56 +02:00
|
|
|
preConfigurePhases = [
|
2023-09-08 12:37:24 +02:00
|
|
|
"genfiles"
|
2022-04-30 02:15:56 +02:00
|
|
|
"cdToExtensionRootPhase"
|
|
|
|
];
|
|
|
|
|
2023-09-08 12:37:24 +02:00
|
|
|
genfiles = ''
|
|
|
|
if [ -f "scripts/dev/genfiles" ]; then
|
|
|
|
./scripts/dev/genfiles
|
|
|
|
fi
|
|
|
|
'';
|
|
|
|
|
2022-04-30 02:15:56 +02:00
|
|
|
cdToExtensionRootPhase = ''
|
|
|
|
# Go to extension source root.
|
2022-11-10 12:05:24 +01:00
|
|
|
cd "ext/${extName}"
|
2022-04-30 02:15:56 +02:00
|
|
|
'';
|
2021-06-28 17:43:53 +02:00
|
|
|
|
|
|
|
preConfigure = ''
|
|
|
|
nullglobRestore=$(shopt -p nullglob)
|
|
|
|
shopt -u nullglob # To make ?-globbing work
|
|
|
|
|
|
|
|
# Some extensions have a config0.m4 or config9.m4
|
|
|
|
if [ -f config?.m4 ]; then
|
|
|
|
mv config?.m4 config.m4
|
|
|
|
fi
|
|
|
|
|
|
|
|
$nullglobRestore
|
2022-04-30 02:24:55 +02:00
|
|
|
|
2021-06-28 17:43:53 +02:00
|
|
|
phpize
|
|
|
|
${postPhpize}
|
2022-04-30 02:24:55 +02:00
|
|
|
|
|
|
|
${lib.concatMapStringsSep
|
|
|
|
"\n"
|
2021-06-28 17:43:53 +02:00
|
|
|
(dep: "mkdir -p ext; ln -s ${dep.dev}/include ext/${dep.extensionName}")
|
2022-04-30 02:24:55 +02:00
|
|
|
internalDeps
|
|
|
|
}
|
2021-06-28 17:43:53 +02:00
|
|
|
'';
|
2022-04-30 02:24:55 +02:00
|
|
|
|
2021-12-15 20:55:31 +01:00
|
|
|
checkPhase = ''
|
|
|
|
runHook preCheck
|
2022-04-30 02:24:55 +02:00
|
|
|
|
2023-01-08 19:43:53 +01:00
|
|
|
NO_INTERACTION=yes SKIP_PERF_SENSITIVE=yes make test
|
2021-12-15 20:55:31 +01:00
|
|
|
runHook postCheck
|
|
|
|
'';
|
2022-04-30 02:24:55 +02:00
|
|
|
|
2021-06-28 17:43:53 +02:00
|
|
|
installPhase = ''
|
2022-04-30 02:25:22 +02:00
|
|
|
runHook preInstall
|
|
|
|
|
2021-06-28 17:43:53 +02:00
|
|
|
mkdir -p $out/lib/php/extensions
|
2022-11-10 12:05:24 +01:00
|
|
|
cp modules/${extName}.so $out/lib/php/extensions/${extName}.so
|
2021-06-28 17:43:53 +02:00
|
|
|
mkdir -p $dev/include
|
|
|
|
${rsync}/bin/rsync -r --filter="+ */" \
|
|
|
|
--filter="+ *.h" \
|
|
|
|
--filter="- *" \
|
|
|
|
--prune-empty-dirs \
|
|
|
|
. $dev/include/
|
2022-04-30 02:25:22 +02:00
|
|
|
|
|
|
|
runHook postInstall
|
2021-06-28 17:43:53 +02:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "PHP upstream extension: ${name}";
|
|
|
|
inherit (php.meta) maintainers homepage license;
|
|
|
|
};
|
2022-06-24 16:34:54 +02:00
|
|
|
}));
|
2021-06-28 17:43:53 +02:00
|
|
|
|
2020-12-15 17:42:21 +01:00
|
|
|
php = phpPackage;
|
2018-12-10 15:33:53 +01:00
|
|
|
|
2020-04-03 18:56:12 +02:00
|
|
|
# This is a set of interactive tools based on PHP.
|
2020-12-15 17:42:21 +01:00
|
|
|
tools = {
|
2020-10-11 16:33:54 +02:00
|
|
|
box = callPackage ../development/php-packages/box { };
|
2019-04-20 16:09:05 +02:00
|
|
|
|
2023-09-01 15:14:18 +02:00
|
|
|
castor = callPackage ../development/php-packages/castor { };
|
|
|
|
|
2020-10-11 16:37:09 +02:00
|
|
|
composer = callPackage ../development/php-packages/composer { };
|
2019-04-20 15:36:12 +02:00
|
|
|
|
2021-05-05 14:19:41 +02:00
|
|
|
deployer = callPackage ../development/php-packages/deployer { };
|
|
|
|
|
2022-02-12 22:39:48 +01:00
|
|
|
grumphp = callPackage ../development/php-packages/grumphp { };
|
|
|
|
|
2022-12-28 10:30:10 +01:00
|
|
|
phan = callPackage ../development/php-packages/phan { };
|
|
|
|
|
2022-02-24 21:08:05 +01:00
|
|
|
phing = callPackage ../development/php-packages/phing { };
|
|
|
|
|
2022-03-13 11:33:30 +01:00
|
|
|
phive = callPackage ../development/php-packages/phive { };
|
|
|
|
|
2024-02-20 08:12:49 +01:00
|
|
|
php-codesniffer = callPackage ../development/php-packages/php-codesniffer { };
|
|
|
|
|
2020-10-11 16:39:33 +02:00
|
|
|
php-cs-fixer = callPackage ../development/php-packages/php-cs-fixer { };
|
2019-04-20 15:36:12 +02:00
|
|
|
|
2020-10-11 16:41:30 +02:00
|
|
|
php-parallel-lint = callPackage ../development/php-packages/php-parallel-lint { };
|
2019-04-20 15:36:12 +02:00
|
|
|
|
2024-03-18 16:33:50 +01:00
|
|
|
phpinsights = callPackage ../development/php-packages/phpinsights { };
|
|
|
|
|
2020-10-11 16:44:31 +02:00
|
|
|
phpmd = callPackage ../development/php-packages/phpmd { };
|
2020-05-16 14:43:23 +02:00
|
|
|
|
2023-11-29 09:44:58 +01:00
|
|
|
phpspy = callPackage ../development/php-packages/phpspy { };
|
|
|
|
|
2020-10-11 16:45:34 +02:00
|
|
|
phpstan = callPackage ../development/php-packages/phpstan { };
|
2020-03-30 19:26:15 +02:00
|
|
|
|
2020-10-11 16:46:30 +02:00
|
|
|
psalm = callPackage ../development/php-packages/psalm { };
|
2019-11-17 20:27:45 +01:00
|
|
|
|
2020-10-11 16:46:49 +02:00
|
|
|
psysh = callPackage ../development/php-packages/psysh { };
|
2024-02-20 08:12:49 +01:00
|
|
|
} // lib.optionalAttrs config.allowAliases {
|
|
|
|
phpcbf = throw "`phpcbf` is now deprecated, use `php-codesniffer` instead which contains both `phpcs` and `phpcbf`.";
|
|
|
|
phpcs = throw "`phpcs` is now deprecated, use `php-codesniffer` instead which contains both `phpcs` and `phpcbf`.";
|
2016-01-08 13:30:27 +01:00
|
|
|
};
|
|
|
|
|
2020-04-03 18:56:12 +02:00
|
|
|
# This is a set of PHP extensions meant to be used in php.buildEnv
|
|
|
|
# or php.withExtensions to extend the functionality of the PHP
|
|
|
|
# interpreter.
|
2023-07-07 09:16:14 +02:00
|
|
|
# The extensions attributes is composed of three sections:
|
2023-07-07 23:02:55 +02:00
|
|
|
# 1. The contrib conditional extensions, which are only available on specific PHP versions
|
2023-07-07 09:16:14 +02:00
|
|
|
# 2. The contrib extensions available
|
|
|
|
# 3. The core extensions
|
|
|
|
extensions =
|
|
|
|
# Contrib extensions
|
|
|
|
{
|
2021-10-08 18:10:44 +02:00
|
|
|
amqp = callPackage ../development/php-packages/amqp { };
|
|
|
|
|
2020-10-11 17:32:19 +02:00
|
|
|
apcu = callPackage ../development/php-packages/apcu { };
|
2019-09-30 18:08:20 +02:00
|
|
|
|
2020-10-11 17:37:37 +02:00
|
|
|
ast = callPackage ../development/php-packages/ast { };
|
2020-02-19 20:28:05 +01:00
|
|
|
|
2024-02-25 13:07:48 +01:00
|
|
|
blackfire = callPackage ../development/tools/misc/blackfire/php-probe.nix { };
|
2023-12-10 17:38:09 +01:00
|
|
|
|
2020-10-11 17:44:38 +02:00
|
|
|
couchbase = callPackage ../development/php-packages/couchbase { };
|
2020-02-19 20:28:05 +01:00
|
|
|
|
2023-07-10 16:52:47 +02:00
|
|
|
datadog_trace = callPackage ../development/php-packages/datadog_trace {
|
2023-10-26 07:11:24 +02:00
|
|
|
buildPecl = buildPecl.override {
|
|
|
|
stdenv = if stdenv.isDarwin then overrideSDK stdenv "11.0" else stdenv;
|
|
|
|
};
|
2023-07-10 16:52:47 +02:00
|
|
|
inherit (pkgs) darwin;
|
2023-07-08 04:30:31 +02:00
|
|
|
};
|
2022-03-01 15:25:32 +01:00
|
|
|
|
2022-01-26 21:17:02 +01:00
|
|
|
ds = callPackage ../development/php-packages/ds { };
|
|
|
|
|
2020-10-11 17:51:35 +02:00
|
|
|
event = callPackage ../development/php-packages/event { };
|
2020-03-30 19:26:15 +02:00
|
|
|
|
2021-11-23 20:06:39 +01:00
|
|
|
gnupg = callPackage ../development/php-packages/gnupg { };
|
|
|
|
|
2022-05-18 19:18:25 +02:00
|
|
|
grpc = callPackage ../development/php-packages/grpc { };
|
|
|
|
|
2020-10-11 17:56:33 +02:00
|
|
|
igbinary = callPackage ../development/php-packages/igbinary { };
|
2017-12-06 16:11:28 +01:00
|
|
|
|
2020-10-11 18:00:01 +02:00
|
|
|
imagick = callPackage ../development/php-packages/imagick { };
|
2017-12-06 16:11:28 +01:00
|
|
|
|
2023-07-07 23:02:55 +02:00
|
|
|
inotify = callPackage ../development/php-packages/inotify { };
|
|
|
|
|
2024-02-10 01:02:21 +01:00
|
|
|
ioncube-loader = callPackage ../development/php-packages/ioncube-loader { };
|
|
|
|
|
2020-10-11 19:00:38 +02:00
|
|
|
mailparse = callPackage ../development/php-packages/mailparse { };
|
2017-12-06 16:49:07 +01:00
|
|
|
|
2020-10-11 19:05:50 +02:00
|
|
|
maxminddb = callPackage ../development/php-packages/maxminddb { };
|
2019-04-20 15:36:12 +02:00
|
|
|
|
2023-09-11 12:55:42 +02:00
|
|
|
memcache = callPackage ../development/php-packages/memcache { };
|
|
|
|
|
2020-10-11 19:10:24 +02:00
|
|
|
memcached = callPackage ../development/php-packages/memcached { };
|
2019-04-20 15:36:12 +02:00
|
|
|
|
2023-10-09 18:42:08 +02:00
|
|
|
meminfo = callPackage ../development/php-packages/meminfo { };
|
|
|
|
|
2023-11-08 09:08:45 +01:00
|
|
|
memprof = callPackage ../development/php-packages/memprof { };
|
|
|
|
|
2023-07-10 16:44:55 +02:00
|
|
|
mongodb = callPackage ../development/php-packages/mongodb {
|
|
|
|
inherit (pkgs) darwin;
|
2023-07-09 01:23:46 +02:00
|
|
|
};
|
2015-10-12 11:44:48 +02:00
|
|
|
|
2023-03-12 11:52:22 +01:00
|
|
|
msgpack = callPackage ../development/php-packages/msgpack { };
|
|
|
|
|
2022-05-25 18:56:23 +02:00
|
|
|
oci8 = callPackage ../development/php-packages/oci8 { };
|
2017-07-11 15:56:52 +02:00
|
|
|
|
2023-08-26 10:14:07 +02:00
|
|
|
opentelemetry = callPackage ../development/php-packages/opentelemetry { };
|
|
|
|
|
2022-04-10 16:46:21 +02:00
|
|
|
openswoole = callPackage ../development/php-packages/openswoole { };
|
|
|
|
|
2020-12-29 00:38:50 +01:00
|
|
|
pdlib = callPackage ../development/php-packages/pdlib { };
|
|
|
|
|
2020-10-11 19:19:01 +02:00
|
|
|
pcov = callPackage ../development/php-packages/pcov { };
|
2017-07-11 15:56:52 +02:00
|
|
|
|
2020-04-02 22:13:04 +02:00
|
|
|
pdo_oci = buildPecl rec {
|
2020-04-29 12:52:39 +02:00
|
|
|
inherit (php.unwrapped) src version;
|
2019-01-17 13:04:10 +01:00
|
|
|
|
2020-04-02 22:13:04 +02:00
|
|
|
pname = "pdo_oci";
|
|
|
|
sourceRoot = "php-${version}/ext/pdo_oci";
|
2019-01-17 13:04:10 +01:00
|
|
|
|
2020-04-02 22:13:04 +02:00
|
|
|
buildInputs = [ pkgs.oracle-instantclient ];
|
|
|
|
configureFlags = [ "--with-pdo-oci=instantclient,${pkgs.oracle-instantclient.lib}/lib" ];
|
2019-01-17 13:04:10 +01:00
|
|
|
|
2020-04-02 22:13:04 +02:00
|
|
|
internalDeps = [ php.extensions.pdo ];
|
2019-01-17 13:04:10 +01:00
|
|
|
|
2020-04-02 22:13:04 +02:00
|
|
|
postPatch = ''
|
2020-04-29 12:52:39 +02:00
|
|
|
sed -i -e 's|OCISDKMANINC=`.*$|OCISDKMANINC="${pkgs.oracle-instantclient.dev}/include"|' config.m4
|
|
|
|
'';
|
2020-04-19 20:51:34 +02:00
|
|
|
|
|
|
|
meta.maintainers = lib.teams.php.members;
|
2019-01-17 13:04:10 +01:00
|
|
|
};
|
|
|
|
|
2020-10-11 19:24:04 +02:00
|
|
|
pdo_sqlsrv = callPackage ../development/php-packages/pdo_sqlsrv { };
|
2019-05-13 21:55:49 +02:00
|
|
|
|
2023-09-08 14:36:40 +02:00
|
|
|
phalcon = callPackage ../development/php-packages/phalcon { };
|
|
|
|
|
2020-10-11 19:36:24 +02:00
|
|
|
pinba = callPackage ../development/php-packages/pinba { };
|
2020-04-05 14:57:33 +02:00
|
|
|
|
2020-10-11 19:39:34 +02:00
|
|
|
protobuf = callPackage ../development/php-packages/protobuf { };
|
2019-04-20 15:36:12 +02:00
|
|
|
|
2020-10-11 19:49:28 +02:00
|
|
|
rdkafka = callPackage ../development/php-packages/rdkafka { };
|
2020-05-01 21:32:25 +02:00
|
|
|
|
2020-10-11 19:53:07 +02:00
|
|
|
redis = callPackage ../development/php-packages/redis { };
|
2019-04-20 15:36:12 +02:00
|
|
|
|
2024-02-25 13:09:19 +01:00
|
|
|
relay = callPackage ../development/php-packages/relay { };
|
2023-04-23 10:40:51 +02:00
|
|
|
|
2023-09-25 13:03:43 +02:00
|
|
|
rrd = callPackage ../development/php-packages/rrd { };
|
|
|
|
|
2021-02-01 03:01:37 +01:00
|
|
|
smbclient = callPackage ../development/php-packages/smbclient { };
|
|
|
|
|
2023-07-11 22:12:41 +02:00
|
|
|
snuffleupagus = callPackage ../development/php-packages/snuffleupagus {
|
|
|
|
inherit (pkgs) darwin;
|
|
|
|
};
|
2021-04-26 09:59:30 +02:00
|
|
|
|
2023-11-24 16:57:56 +01:00
|
|
|
spx = callPackage ../development/php-packages/spx { };
|
|
|
|
|
2020-10-11 19:55:31 +02:00
|
|
|
sqlsrv = callPackage ../development/php-packages/sqlsrv { };
|
2019-04-20 15:36:12 +02:00
|
|
|
|
2023-03-12 11:51:11 +01:00
|
|
|
ssh2 = callPackage ../development/php-packages/ssh2 { };
|
|
|
|
|
2021-03-11 18:01:45 +01:00
|
|
|
swoole = callPackage ../development/php-packages/swoole { };
|
|
|
|
|
2023-06-19 23:34:30 +02:00
|
|
|
uv = callPackage ../development/php-packages/uv { };
|
|
|
|
|
2023-08-16 12:36:42 +02:00
|
|
|
vld = callPackage ../development/php-packages/vld { };
|
|
|
|
|
2020-10-11 19:58:03 +02:00
|
|
|
xdebug = callPackage ../development/php-packages/xdebug { };
|
2019-04-20 15:36:12 +02:00
|
|
|
|
2020-10-11 20:00:38 +02:00
|
|
|
yaml = callPackage ../development/php-packages/yaml { };
|
2024-02-04 19:37:31 +01:00
|
|
|
|
|
|
|
zstd = callPackage ../development/php-packages/zstd { };
|
2023-11-24 16:57:56 +01:00
|
|
|
} // lib.optionalAttrs config.allowAliases {
|
|
|
|
php-spx = throw "php-spx is deprecated, use spx instead";
|
2021-06-26 09:46:46 +02:00
|
|
|
} // (
|
2023-07-07 09:16:14 +02:00
|
|
|
# Core extensions
|
2021-06-26 09:46:46 +02:00
|
|
|
let
|
|
|
|
# This list contains build instructions for different modules that one may
|
|
|
|
# want to build.
|
|
|
|
#
|
|
|
|
# These will be passed as arguments to mkExtension above.
|
|
|
|
extensionData = [
|
|
|
|
{ name = "bcmath"; }
|
|
|
|
{ name = "bz2"; buildInputs = [ bzip2 ]; configureFlags = [ "--with-bz2=${bzip2.dev}" ]; }
|
|
|
|
{ name = "calendar"; }
|
|
|
|
{ name = "ctype"; }
|
|
|
|
{
|
|
|
|
name = "curl";
|
|
|
|
buildInputs = [ curl ];
|
|
|
|
configureFlags = [ "--with-curl=${curl.dev}" ];
|
|
|
|
doCheck = false;
|
|
|
|
}
|
|
|
|
{ name = "dba"; }
|
|
|
|
{
|
|
|
|
name = "dom";
|
|
|
|
buildInputs = [ libxml2 ];
|
2022-05-02 03:49:01 +02:00
|
|
|
configureFlags = [
|
|
|
|
"--enable-dom"
|
|
|
|
];
|
2024-02-01 10:36:17 +01:00
|
|
|
# Add a PHP lower version bound constraint to avoid applying the patch on older PHP versions.
|
2024-03-11 17:49:29 +01:00
|
|
|
patches = lib.optionals ((lib.versions.majorMinor php.version == "8.2" && lib.versionOlder php.version "8.2.14" && lib.versionAtLeast php.version "8.2.7") || (lib.versions.majorMinor php.version == "8.1" && lib.versionAtLeast php.version "8.1.27")) [
|
2023-12-02 22:16:03 +01:00
|
|
|
# Fix tests with libxml 2.12
|
|
|
|
# Part of 8.3.1RC1+, 8.2.14RC1+
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/php/php-src/commit/061058a9b1bbd90d27d97d79aebcf2b5029767b0.patch";
|
|
|
|
hash = "sha256-0hOlAG+pOYp/gUU0MUMZvzWpgr0ncJi5GB8IeNxxyEU=";
|
|
|
|
excludes = [
|
|
|
|
"NEWS"
|
|
|
|
];
|
|
|
|
})
|
|
|
|
];
|
2021-06-26 09:46:46 +02:00
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "enchant";
|
2023-01-17 07:43:41 +01:00
|
|
|
buildInputs = [ enchant2 ];
|
|
|
|
configureFlags = [ "--with-enchant" ];
|
2021-06-26 09:46:46 +02:00
|
|
|
doCheck = false;
|
|
|
|
}
|
|
|
|
{ name = "exif"; doCheck = false; }
|
2022-05-02 03:49:01 +02:00
|
|
|
{ name = "ffi"; buildInputs = [ libffi ]; }
|
2023-06-26 20:51:23 +02:00
|
|
|
{
|
|
|
|
name = "fileinfo";
|
|
|
|
buildInputs = [ pcre2 ];
|
|
|
|
}
|
2021-06-26 09:46:46 +02:00
|
|
|
{ name = "filter"; buildInputs = [ pcre2 ]; }
|
|
|
|
{ name = "ftp"; buildInputs = [ openssl ]; }
|
|
|
|
{
|
|
|
|
name = "gd";
|
|
|
|
buildInputs = [ zlib gd ];
|
|
|
|
configureFlags = [
|
|
|
|
"--enable-gd"
|
|
|
|
"--with-external-gd=${gd.dev}"
|
|
|
|
"--enable-gd-jis-conv"
|
|
|
|
];
|
|
|
|
doCheck = false;
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "gettext";
|
|
|
|
buildInputs = [ gettext ];
|
2024-03-14 08:55:17 +01:00
|
|
|
postPhpize = ''substituteInPlace configure --replace-fail 'as_fn_error $? "Cannot locate header file libintl.h" "$LINENO" 5' ':' '';
|
2021-06-26 09:46:46 +02:00
|
|
|
configureFlags = [ "--with-gettext=${gettext}" ];
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "gmp";
|
|
|
|
buildInputs = [ gmp ];
|
|
|
|
configureFlags = [ "--with-gmp=${gmp.dev}" ];
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "iconv";
|
|
|
|
configureFlags = [
|
|
|
|
"--with-iconv${lib.optionalString stdenv.isDarwin "=${libiconv}"}"
|
|
|
|
];
|
|
|
|
doCheck = false;
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "imap";
|
2022-10-01 17:19:02 +02:00
|
|
|
buildInputs = [ uwimap openssl pam pcre2 libkrb5 ];
|
|
|
|
configureFlags = [ "--with-imap=${uwimap}" "--with-imap-ssl" "--with-kerberos" ];
|
2021-06-26 09:46:46 +02:00
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "intl";
|
|
|
|
buildInputs = [ icu64 ];
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "ldap";
|
|
|
|
buildInputs = [ openldap cyrus_sasl ];
|
|
|
|
configureFlags = [
|
|
|
|
"--with-ldap"
|
|
|
|
"LDAP_DIR=${openldap.dev}"
|
|
|
|
"LDAP_INCDIR=${openldap.dev}/include"
|
|
|
|
"LDAP_LIBDIR=${openldap.out}/lib"
|
|
|
|
] ++ lib.optionals stdenv.isLinux [
|
|
|
|
"--with-ldap-sasl=${cyrus_sasl.dev}"
|
|
|
|
];
|
|
|
|
doCheck = false;
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "mbstring";
|
2022-05-25 19:05:55 +02:00
|
|
|
buildInputs = [ oniguruma pcre2 ];
|
2021-06-26 09:46:46 +02:00
|
|
|
doCheck = false;
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "mysqli";
|
|
|
|
internalDeps = [ php.extensions.mysqlnd ];
|
|
|
|
configureFlags = [ "--with-mysqli=mysqlnd" "--with-mysql-sock=/run/mysqld/mysqld.sock" ];
|
|
|
|
doCheck = false;
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "mysqlnd";
|
|
|
|
buildInputs = [ zlib openssl ];
|
|
|
|
# The configure script doesn't correctly add library link
|
|
|
|
# flags, so we add them to the variable used by the Makefile
|
|
|
|
# when linking.
|
|
|
|
MYSQLND_SHARED_LIBADD = "-lssl -lcrypto";
|
|
|
|
# The configure script builds a config.h which is never
|
|
|
|
# included. Let's include it in the main header file
|
|
|
|
# included by all .c-files.
|
|
|
|
patches = [
|
|
|
|
(pkgs.writeText "mysqlnd_config.patch" ''
|
|
|
|
--- a/ext/mysqlnd/mysqlnd.h
|
|
|
|
+++ b/ext/mysqlnd/mysqlnd.h
|
|
|
|
@@ -1,3 +1,6 @@
|
|
|
|
+#ifdef HAVE_CONFIG_H
|
|
|
|
+#include "config.h"
|
|
|
|
+#endif
|
|
|
|
/*
|
|
|
|
+----------------------------------------------------------------------+
|
|
|
|
| Copyright (c) The PHP Group |
|
|
|
|
'')
|
|
|
|
];
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "opcache";
|
2023-10-16 15:53:43 +02:00
|
|
|
buildInputs = [ pcre2 ] ++
|
|
|
|
lib.optional
|
|
|
|
(!stdenv.isDarwin && lib.meta.availableOn stdenv.hostPlatform valgrind)
|
|
|
|
valgrind.dev;
|
2023-12-10 17:16:53 +01:00
|
|
|
configureFlags = lib.optional php.ztsSupport "--disable-opcache-jit";
|
2021-06-26 09:46:46 +02:00
|
|
|
zendExtension = true;
|
2023-02-09 18:00:22 +01:00
|
|
|
postPatch = lib.optionalString stdenv.isDarwin ''
|
|
|
|
# Tests are flaky on darwin
|
|
|
|
rm ext/opcache/tests/blacklist.phpt
|
|
|
|
rm ext/opcache/tests/bug66338.phpt
|
|
|
|
rm ext/opcache/tests/bug78106.phpt
|
|
|
|
rm ext/opcache/tests/issue0115.phpt
|
|
|
|
rm ext/opcache/tests/issue0149.phpt
|
|
|
|
rm ext/opcache/tests/revalidate_path_01.phpt
|
|
|
|
'';
|
2021-06-26 09:46:46 +02:00
|
|
|
# Tests launch the builtin webserver.
|
2023-02-09 18:00:22 +01:00
|
|
|
__darwinAllowLocalNetworking = true;
|
2021-06-26 09:46:46 +02:00
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "openssl";
|
2023-06-22 18:52:56 +02:00
|
|
|
buildInputs = [ openssl ];
|
2021-06-26 09:46:46 +02:00
|
|
|
configureFlags = [ "--with-openssl" ];
|
|
|
|
doCheck = false;
|
|
|
|
}
|
2022-10-29 16:20:57 +02:00
|
|
|
# This provides a legacy OpenSSL PHP extension
|
|
|
|
# For situations where OpenSSL 3 do not support a set of features
|
|
|
|
# without a specific openssl.cnf file
|
|
|
|
{
|
|
|
|
name = "openssl-legacy";
|
2022-11-10 12:05:24 +01:00
|
|
|
extName = "openssl";
|
2022-10-29 16:20:57 +02:00
|
|
|
buildInputs = [ openssl_1_1 ];
|
|
|
|
configureFlags = [ "--with-openssl" ];
|
|
|
|
doCheck = false;
|
|
|
|
}
|
2021-06-26 09:46:46 +02:00
|
|
|
{ name = "pcntl"; }
|
|
|
|
{ name = "pdo"; doCheck = false; }
|
|
|
|
{
|
|
|
|
name = "pdo_dblib";
|
|
|
|
internalDeps = [ php.extensions.pdo ];
|
|
|
|
configureFlags = [ "--with-pdo-dblib=${freetds}" ];
|
|
|
|
# Doesn't seem to work on darwin.
|
|
|
|
enable = (!stdenv.isDarwin);
|
|
|
|
doCheck = false;
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "pdo_mysql";
|
|
|
|
internalDeps = with php.extensions; [ pdo mysqlnd ];
|
|
|
|
configureFlags = [ "--with-pdo-mysql=mysqlnd" "PHP_MYSQL_SOCK=/run/mysqld/mysqld.sock" ];
|
|
|
|
doCheck = false;
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "pdo_odbc";
|
|
|
|
internalDeps = [ php.extensions.pdo ];
|
|
|
|
configureFlags = [ "--with-pdo-odbc=unixODBC,${unixODBC}" ];
|
|
|
|
doCheck = false;
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "pdo_pgsql";
|
|
|
|
internalDeps = [ php.extensions.pdo ];
|
|
|
|
configureFlags = [ "--with-pdo-pgsql=${postgresql}" ];
|
|
|
|
doCheck = false;
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "pdo_sqlite";
|
|
|
|
internalDeps = [ php.extensions.pdo ];
|
|
|
|
buildInputs = [ sqlite ];
|
|
|
|
configureFlags = [ "--with-pdo-sqlite=${sqlite.dev}" ];
|
|
|
|
doCheck = false;
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "pgsql";
|
|
|
|
buildInputs = [ pcre2 ];
|
|
|
|
configureFlags = [ "--with-pgsql=${postgresql}" ];
|
|
|
|
doCheck = false;
|
|
|
|
}
|
|
|
|
{ name = "posix"; doCheck = false; }
|
|
|
|
{ name = "pspell"; configureFlags = [ "--with-pspell=${aspell}" ]; }
|
|
|
|
{
|
|
|
|
name = "readline";
|
php.extensions.readline: Actually use readline
Building readline extension would say:
checking for libedit readline replacement... yes, shared
even when configuring `--without-libedit`. This is because `PHP_ARG_WITH(libedit, …)`, internally calls `PHP_ALWAYS_SHARED`, which in `phpize`-generated `configure.ac` is defined as always forcing the value to shared. This will prevent `PHP_ARG_WITH(readline, …)` from being invoked so `READLINE_DIR` variable will never be defined.
This was not an issue before we split the extension out of php.unwrapped in https://github.com/NixOS/nixpkgs/commit/282337799b08844c145c295110f20025541f829a, as `PHP_ALWAYS_SHARED` is empty there.
-----
Additionally, because the build script passed `-L$READLINE_DIR/lib` as a flag to the compiler on PHP < 7.4 (built by the nix-phps repository), this ended up with a FHS-like path being passed to the linker. And once we bumped GCC to 11 in https://github.com/NixOS/nixpkgs/commit/52f8cf58a4504e5e219faebffa51033e400e3aec, the linker would fail:
gcc -shared .libs/readline.o .libs/readline_cli.o -Wl,--rpath -Wl,/lib -L/lib -ledit -lncurses -Wl,-soname -Wl,readline.so -o .libs/readline.so
impure path `/lib' used in link
collect2: error: ld returned 1 exit status
This no longer happens with PHP ≥ 7.4, since they switched to getting the linker flags from pkg-config in https://github.com/php/php-src/commit/b537203d20d7c1c425aee44d00f1d53758ac8747.
----
As a compromise, let’s make the `PHP_ALWAYS_SHARED` function force `shared` status but only for flags that are not disabled. That will allow us to remove the libedit dependency and also the nasty patch for configure script due to `--with-libedit` not being passed (which would be required for PHP < 7.4 to be able to find readline.h from libedit).
Thanks to Pol Dellaiera for both bisections.
2022-05-02 04:05:57 +02:00
|
|
|
buildInputs = [
|
|
|
|
readline
|
|
|
|
];
|
|
|
|
configureFlags = [
|
|
|
|
"--with-readline=${readline.dev}"
|
|
|
|
];
|
|
|
|
postPatch = ''
|
|
|
|
# Fix `--with-readline` option not being available.
|
|
|
|
# `PHP_ALWAYS_SHARED` generated by phpize enables all options
|
|
|
|
# without the possibility to override them. But when `--with-libedit`
|
|
|
|
# is enabled, `--with-readline` is not registered.
|
|
|
|
echo '
|
|
|
|
AC_DEFUN([PHP_ALWAYS_SHARED],[
|
|
|
|
test "[$]$1" != "no" && ext_shared=yes
|
|
|
|
])dnl
|
|
|
|
' | cat - ext/readline/config.m4 > ext/readline/config.m4.tmp
|
|
|
|
mv ext/readline/config.m4{.tmp,}
|
2021-06-26 09:46:46 +02:00
|
|
|
'';
|
|
|
|
doCheck = false;
|
|
|
|
}
|
2023-06-26 20:51:23 +02:00
|
|
|
{ name = "session";
|
|
|
|
doCheck = false;
|
|
|
|
}
|
2021-06-26 09:46:46 +02:00
|
|
|
{ name = "shmop"; }
|
|
|
|
{
|
|
|
|
name = "simplexml";
|
|
|
|
buildInputs = [ libxml2 pcre2 ];
|
2022-05-02 03:49:01 +02:00
|
|
|
configureFlags = [
|
|
|
|
"--enable-simplexml"
|
|
|
|
];
|
2021-06-26 09:46:46 +02:00
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "snmp";
|
|
|
|
buildInputs = [ net-snmp openssl ];
|
|
|
|
configureFlags = [ "--with-snmp" ];
|
|
|
|
# net-snmp doesn't build on darwin.
|
|
|
|
enable = (!stdenv.isDarwin);
|
|
|
|
doCheck = false;
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "soap";
|
|
|
|
buildInputs = [ libxml2 ];
|
2022-05-02 03:49:01 +02:00
|
|
|
configureFlags = [
|
|
|
|
"--enable-soap"
|
|
|
|
];
|
2021-06-26 09:46:46 +02:00
|
|
|
doCheck = false;
|
|
|
|
}
|
2022-01-22 18:12:21 +01:00
|
|
|
{
|
|
|
|
name = "sockets";
|
|
|
|
doCheck = false;
|
|
|
|
}
|
2021-06-26 09:46:46 +02:00
|
|
|
{ name = "sodium"; buildInputs = [ libsodium ]; }
|
2023-11-25 13:42:02 +01:00
|
|
|
{
|
|
|
|
name = "sqlite3";
|
|
|
|
buildInputs = [ sqlite ];
|
|
|
|
|
|
|
|
# The `sqlite3_bind_bug68849.phpt` test is currently broken for i686 Linux systems since sqlite 3.43, cf.:
|
|
|
|
# - https://github.com/php/php-src/issues/12076
|
|
|
|
# - https://www.sqlite.org/forum/forumpost/abbb95376ec6cd5f
|
2023-11-29 13:09:24 +01:00
|
|
|
patches = lib.optionals (stdenv.isi686 && stdenv.isLinux) [
|
|
|
|
../development/interpreters/php/skip-sqlite3_bind_bug68849.phpt.patch
|
|
|
|
];
|
2023-11-25 13:42:02 +01:00
|
|
|
}
|
2021-06-26 09:46:46 +02:00
|
|
|
{ name = "sysvmsg"; }
|
|
|
|
{ name = "sysvsem"; }
|
|
|
|
{ name = "sysvshm"; }
|
|
|
|
{ name = "tidy"; configureFlags = [ "--with-tidy=${html-tidy}" ]; doCheck = false; }
|
2021-12-20 14:09:56 +01:00
|
|
|
{
|
|
|
|
name = "tokenizer";
|
2023-06-22 18:52:56 +02:00
|
|
|
patches = [ ../development/interpreters/php/fix-tokenizer-php81.patch ];
|
2021-12-20 14:09:56 +01:00
|
|
|
}
|
2021-06-26 09:46:46 +02:00
|
|
|
{
|
|
|
|
name = "xml";
|
|
|
|
buildInputs = [ libxml2 ];
|
2022-05-02 03:49:01 +02:00
|
|
|
configureFlags = [
|
|
|
|
"--enable-xml"
|
|
|
|
];
|
2021-06-26 09:46:46 +02:00
|
|
|
doCheck = false;
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "xmlreader";
|
|
|
|
buildInputs = [ libxml2 ];
|
|
|
|
internalDeps = [ php.extensions.dom ];
|
2023-02-19 20:23:32 +01:00
|
|
|
env.NIX_CFLAGS_COMPILE = toString [ "-I../.." "-DHAVE_DOM" ];
|
2021-11-25 18:18:21 +01:00
|
|
|
doCheck = false;
|
2022-05-02 03:49:01 +02:00
|
|
|
configureFlags = [
|
|
|
|
"--enable-xmlreader"
|
|
|
|
];
|
2021-06-26 09:46:46 +02:00
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "xmlwriter";
|
|
|
|
buildInputs = [ libxml2 ];
|
2022-05-02 03:49:01 +02:00
|
|
|
configureFlags = [
|
|
|
|
"--enable-xmlwriter"
|
|
|
|
];
|
2021-06-26 09:46:46 +02:00
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "xsl";
|
|
|
|
buildInputs = [ libxslt libxml2 ];
|
2024-03-14 21:24:45 +01:00
|
|
|
internalDeps = [ php.extensions.dom ];
|
2022-05-25 19:05:55 +02:00
|
|
|
doCheck = false;
|
2024-03-14 21:24:45 +01:00
|
|
|
env.NIX_CFLAGS_COMPILE = toString [ "-I../.." "-DHAVE_DOM" ];
|
2021-06-26 09:46:46 +02:00
|
|
|
configureFlags = [ "--with-xsl=${libxslt.dev}" ];
|
|
|
|
}
|
|
|
|
{ name = "zend_test"; }
|
|
|
|
{
|
|
|
|
name = "zip";
|
|
|
|
buildInputs = [ libzip pcre2 ];
|
2022-05-02 03:49:01 +02:00
|
|
|
configureFlags = [
|
|
|
|
"--with-zip"
|
|
|
|
];
|
2021-06-26 09:46:46 +02:00
|
|
|
doCheck = false;
|
|
|
|
}
|
|
|
|
{
|
|
|
|
name = "zlib";
|
|
|
|
buildInputs = [ zlib ];
|
2022-05-02 03:49:01 +02:00
|
|
|
configureFlags = [
|
|
|
|
"--with-zlib"
|
2021-06-26 09:46:46 +02:00
|
|
|
];
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
|
|
|
# Convert the list of attrs:
|
|
|
|
# [ { name = <name>; ... } ... ]
|
|
|
|
# to a list of
|
|
|
|
# [ { name = <name>; value = <extension drv>; } ... ]
|
|
|
|
#
|
|
|
|
# which we later use listToAttrs to make all attrs available by name.
|
|
|
|
#
|
|
|
|
# Also filter out extensions based on the enable property.
|
|
|
|
namedExtensions = builtins.map
|
|
|
|
(drv: {
|
|
|
|
name = drv.name;
|
|
|
|
value = mkExtension drv;
|
|
|
|
})
|
|
|
|
(builtins.filter (i: i.enable or true) extensionData);
|
|
|
|
|
|
|
|
# Produce the final attribute set of all extensions defined.
|
|
|
|
in
|
|
|
|
builtins.listToAttrs namedExtensions
|
2023-07-07 09:16:14 +02:00
|
|
|
);
|
2020-12-15 17:42:21 +01:00
|
|
|
})
|