php.mkExtension: make source name agnostic
PHP obtained from Git contains files directly in the top-level directory, which will be placed in Nix store. The generic builder will then copy it to the /build sandbox as its basename with hash stripped (e.g. source/). This breaks the assumption of `mkExtension`, which expects that PHP’s source will be extracted into `php-«version»/` directory, since that is what the release tarballs contain. Let’s unset the `sourceRoot`, leaving it to `unpackPhase` to find the source directory. Then, we will be able go to the extension directory from there. We use custom pre-configure phase so that both `postPatch` and `preConfigure` is available to consumers.
This commit is contained in:
parent
b2ae4d5a0e
commit
03e31c533c
@ -83,7 +83,6 @@ lib.makeScope pkgs.newScope (self: with self; {
|
||||
outputs = [ "out" "dev" ];
|
||||
|
||||
inherit (php.unwrapped) version src;
|
||||
sourceRoot = "php-${php.version}/ext/${name}";
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
@ -96,8 +95,14 @@ lib.makeScope pkgs.newScope (self: with self; {
|
||||
|
||||
inherit configureFlags internalDeps buildInputs zendExtension doCheck;
|
||||
|
||||
prePatch = "pushd ../..";
|
||||
postPatch = "popd";
|
||||
preConfigurePhases = [
|
||||
"cdToExtensionRootPhase"
|
||||
];
|
||||
|
||||
cdToExtensionRootPhase = ''
|
||||
# Go to extension source root.
|
||||
cd "ext/${name}"
|
||||
'';
|
||||
|
||||
preConfigure = ''
|
||||
nullglobRestore=$(shopt -p nullglob)
|
||||
|
Loading…
Reference in New Issue
Block a user