Merge pull request #170962 from jtojnar/php-ext-fixes
php.extensions: improve correctness and usability
This commit is contained in:
commit
5dc982e272
1 changed files with 50 additions and 14 deletions
|
@ -19,7 +19,6 @@
|
|||
, html-tidy
|
||||
, icu64
|
||||
, libXpm
|
||||
, libedit
|
||||
, libffi
|
||||
, libiconv
|
||||
, libjpeg
|
||||
|
@ -80,16 +79,29 @@ lib.makeScope pkgs.newScope (self: with self; {
|
|||
pname = "php-${name}";
|
||||
extensionName = name;
|
||||
|
||||
outputs = [ "out" "dev" ];
|
||||
|
||||
inherit (php.unwrapped) version src;
|
||||
sourceRoot = "php-${php.version}/ext/${name}";
|
||||
|
||||
enableParallelBuilding = true;
|
||||
nativeBuildInputs = [ php.unwrapped autoconf pkg-config re2c ];
|
||||
inherit configureFlags internalDeps buildInputs
|
||||
zendExtension doCheck;
|
||||
|
||||
prePatch = "pushd ../..";
|
||||
postPatch = "popd";
|
||||
nativeBuildInputs = [
|
||||
php.unwrapped
|
||||
autoconf
|
||||
pkg-config
|
||||
re2c
|
||||
];
|
||||
|
||||
inherit configureFlags internalDeps buildInputs zendExtension doCheck;
|
||||
|
||||
preConfigurePhases = [
|
||||
"cdToExtensionRootPhase"
|
||||
];
|
||||
|
||||
cdToExtensionRootPhase = ''
|
||||
# Go to extension source root.
|
||||
cd "ext/${name}"
|
||||
'';
|
||||
|
||||
preConfigure = ''
|
||||
nullglobRestore=$(shopt -p nullglob)
|
||||
|
@ -101,19 +113,28 @@ lib.makeScope pkgs.newScope (self: with self; {
|
|||
fi
|
||||
|
||||
$nullglobRestore
|
||||
|
||||
phpize
|
||||
${postPhpize}
|
||||
${lib.concatMapStringsSep "\n"
|
||||
|
||||
${lib.concatMapStringsSep
|
||||
"\n"
|
||||
(dep: "mkdir -p ext; ln -s ${dep.dev}/include ext/${dep.extensionName}")
|
||||
internalDeps}
|
||||
internalDeps
|
||||
}
|
||||
'';
|
||||
|
||||
checkPhase = ''
|
||||
runHook preCheck
|
||||
|
||||
NO_INTERACTON=yes SKIP_PERF_SENSITIVE=yes make test
|
||||
|
||||
runHook postCheck
|
||||
'';
|
||||
outputs = [ "out" "dev" ];
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out/lib/php/extensions
|
||||
cp modules/${name}.so $out/lib/php/extensions/${name}.so
|
||||
mkdir -p $dev/include
|
||||
|
@ -122,6 +143,8 @@ lib.makeScope pkgs.newScope (self: with self; {
|
|||
--filter="- *" \
|
||||
--prune-empty-dirs \
|
||||
. $dev/include/
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
meta = {
|
||||
|
@ -520,10 +543,23 @@ lib.makeScope pkgs.newScope (self: with self; {
|
|||
{ name = "pspell"; configureFlags = [ "--with-pspell=${aspell}" ]; }
|
||||
{
|
||||
name = "readline";
|
||||
buildInputs = [ libedit readline ];
|
||||
configureFlags = [ "--with-readline=${readline.dev}" ];
|
||||
postPhpize = lib.optionalString (lib.versionOlder php.version "7.4") ''
|
||||
substituteInPlace configure --replace 'as_fn_error $? "Please reinstall libedit - I cannot find readline.h" "$LINENO" 5' ':'
|
||||
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,}
|
||||
'';
|
||||
doCheck = false;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue