diff options
author | Elis Hirwing <elis@hirwing.se> | 2021-06-30 13:16:43 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-30 13:16:43 +0200 |
commit | f091739337022031ebeb14a8f1bc2ecfc76d14fc (patch) | |
tree | 30063678e9b1fd7fde0c4003f3e34a479967a6fd | |
parent | b5460f9ce2410a731efa8bb9311691b6fe651239 (diff) | |
parent | 485d0fc9730a9e1d460e00af1d1becc541e2ad4f (diff) | |
download | nixpkgs-f091739337022031ebeb14a8f1bc2ecfc76d14fc.tar nixpkgs-f091739337022031ebeb14a8f1bc2ecfc76d14fc.tar.gz nixpkgs-f091739337022031ebeb14a8f1bc2ecfc76d14fc.tar.bz2 nixpkgs-f091739337022031ebeb14a8f1bc2ecfc76d14fc.tar.lz nixpkgs-f091739337022031ebeb14a8f1bc2ecfc76d14fc.tar.xz nixpkgs-f091739337022031ebeb14a8f1bc2ecfc76d14fc.tar.zst nixpkgs-f091739337022031ebeb14a8f1bc2ecfc76d14fc.zip |
Merge pull request #128521 from aanderse/php-mkExtension
php: expose mkExtension
-rw-r--r-- | pkgs/development/interpreters/php/generic.nix | 2 | ||||
-rw-r--r-- | pkgs/top-level/php-packages.nix | 133 |
2 files changed, 68 insertions, 67 deletions
diff --git a/pkgs/development/interpreters/php/generic.nix b/pkgs/development/interpreters/php/generic.nix index 5344be9c5c7..f181db108a4 100644 --- a/pkgs/development/interpreters/php/generic.nix +++ b/pkgs/development/interpreters/php/generic.nix @@ -133,7 +133,7 @@ let unwrapped = php; # Select the right php tests for the php version tests = nixosTests."php${lib.strings.replaceStrings [ "." ] [ "" ] (lib.versions.majorMinor php.version)}"; - inherit (php-packages) extensions buildPecl; + inherit (php-packages) extensions buildPecl mkExtension; packages = php-packages.tools; meta = php.meta // { outputsToInstall = [ "out" ]; diff --git a/pkgs/top-level/php-packages.nix b/pkgs/top-level/php-packages.nix index e518ee68f7b..16d3c71d524 100644 --- a/pkgs/top-level/php-packages.nix +++ b/pkgs/top-level/php-packages.nix @@ -59,6 +59,73 @@ lib.makeScope pkgs.newScope (self: with self; { pname = "php-${pname}"; }); + # 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 + # to add the configureFlag "--enable-${name}", which can be overriden. + # + # Build inputs is used for extra deps that may be needed. And zendExtension + # will mark the extension as a zend extension or not. + mkExtension = + { name + , configureFlags ? [ "--enable-${name}" ] + , internalDeps ? [ ] + , postPhpize ? "" + , buildInputs ? [ ] + , zendExtension ? false + , doCheck ? true + , ... + }@args: stdenv.mkDerivation ((builtins.removeAttrs args [ "name" ]) // { + pname = "php-${name}"; + extensionName = name; + + 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"; + + 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 + phpize + ${postPhpize} + ${lib.concatMapStringsSep "\n" + (dep: "mkdir -p ext; ln -s ${dep.dev}/include ext/${dep.extensionName}") + internalDeps} + ''; + checkPhase = "runHook preCheck; NO_INTERACTON=yes make test; runHook postCheck"; + outputs = [ "out" "dev" ]; + installPhase = '' + mkdir -p $out/lib/php/extensions + cp modules/${name}.so $out/lib/php/extensions/${name}.so + mkdir -p $dev/include + ${rsync}/bin/rsync -r --filter="+ */" \ + --filter="+ *.h" \ + --filter="- *" \ + --prune-empty-dirs \ + . $dev/include/ + ''; + + meta = { + description = "PHP upstream extension: ${name}"; + inherit (php.meta) maintainers homepage license; + }; + }); + php = phpPackage; # This is a set of interactive tools based on PHP. @@ -171,72 +238,6 @@ lib.makeScope pkgs.newScope (self: with self; { yaml = callPackage ../development/php-packages/yaml { }; } // ( let - # Function to build a single php extension based on the php version. - # - # Name passed is the name of the extension and is automatically used - # to add the configureFlag "--enable-${name}", which can be overriden. - # - # Build inputs is used for extra deps that may be needed. And zendExtension - # will mark the extension as a zend extension or not. - mkExtension = - { name - , configureFlags ? [ "--enable-${name}" ] - , internalDeps ? [ ] - , postPhpize ? "" - , buildInputs ? [ ] - , zendExtension ? false - , doCheck ? true - , ... - }@args: stdenv.mkDerivation ((builtins.removeAttrs args [ "name" ]) // { - pname = "php-${name}"; - extensionName = name; - - 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"; - - 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 - phpize - ${postPhpize} - ${lib.concatMapStringsSep "\n" - (dep: "mkdir -p ext; ln -s ${dep.dev}/include ext/${dep.extensionName}") - internalDeps} - ''; - checkPhase = "runHook preCheck; NO_INTERACTON=yes make test; runHook postCheck"; - outputs = [ "out" "dev" ]; - installPhase = '' - mkdir -p $out/lib/php/extensions - cp modules/${name}.so $out/lib/php/extensions/${name}.so - mkdir -p $dev/include - ${rsync}/bin/rsync -r --filter="+ */" \ - --filter="+ *.h" \ - --filter="- *" \ - --prune-empty-dirs \ - . $dev/include/ - ''; - - meta = { - description = "PHP upstream extension: ${name}"; - inherit (php.meta) maintainers homepage license; - }; - }); - # This list contains build instructions for different modules that one may # want to build. # |