diff options
author | Aaron Andersen <aaron@fosslib.net> | 2021-06-28 11:43:53 -0400 |
---|---|---|
committer | Aaron Andersen <aaron@fosslib.net> | 2021-06-29 07:38:12 -0400 |
commit | 485d0fc9730a9e1d460e00af1d1becc541e2ad4f (patch) | |
tree | 460343dd545ca431f7dd2292fd1b0c627730040e /pkgs/top-level/php-packages.nix | |
parent | 2db14a9cb5a9477b80db549b302b15cbebc77b3d (diff) | |
download | nixpkgs-485d0fc9730a9e1d460e00af1d1becc541e2ad4f.tar nixpkgs-485d0fc9730a9e1d460e00af1d1becc541e2ad4f.tar.gz nixpkgs-485d0fc9730a9e1d460e00af1d1becc541e2ad4f.tar.bz2 nixpkgs-485d0fc9730a9e1d460e00af1d1becc541e2ad4f.tar.lz nixpkgs-485d0fc9730a9e1d460e00af1d1becc541e2ad4f.tar.xz nixpkgs-485d0fc9730a9e1d460e00af1d1becc541e2ad4f.tar.zst nixpkgs-485d0fc9730a9e1d460e00af1d1becc541e2ad4f.zip |
php: expose mkExtension
Diffstat (limited to 'pkgs/top-level/php-packages.nix')
-rw-r--r-- | pkgs/top-level/php-packages.nix | 133 |
1 files changed, 67 insertions, 66 deletions
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. # |