diff options
author | Elis Hirwing <elis@hirwing.se> | 2021-06-26 09:46:46 +0200 |
---|---|---|
committer | Elis Hirwing <elis@hirwing.se> | 2021-06-26 20:07:56 +0200 |
commit | 94d07b7492416e2f6b8c18f229d1c13f4f48349c (patch) | |
tree | 4cd91c4a0673273f0131e6a0a1b5d0dd8240a736 /pkgs/development/interpreters | |
parent | 42cadf5a768c81d912adba037d30c39d09f326c7 (diff) |
php: Run nixpkgs-fmt on all php related files
Diffstat (limited to 'pkgs/development/interpreters')
-rw-r--r-- | pkgs/development/interpreters/php/7.4.nix | 49 | ||||
-rw-r--r-- | pkgs/development/interpreters/php/8.0.nix | 48 | ||||
-rw-r--r-- | pkgs/development/interpreters/php/generic.nix | 280 |
3 files changed, 236 insertions, 141 deletions
diff --git a/pkgs/development/interpreters/php/7.4.nix b/pkgs/development/interpreters/php/7.4.nix index c4e566ee27ceb..7640e6bc64638 100644 --- a/pkgs/development/interpreters/php/7.4.nix +++ b/pkgs/development/interpreters/php/7.4.nix @@ -6,10 +6,47 @@ let sha256 = "0d5ncz97y0271dsmz269wl4721vhq2fn6pmm9rxglc756p36pnha"; }); -in base.withExtensions ({ all, ... }: with all; ([ - bcmath calendar curl ctype dom exif fileinfo filter ftp gd - gettext gmp iconv intl json ldap mbstring mysqli mysqlnd opcache - openssl pcntl pdo pdo_mysql pdo_odbc pdo_pgsql pdo_sqlite pgsql - posix readline session simplexml sockets soap sodium sqlite3 - tokenizer xmlreader xmlwriter zip zlib +in +base.withExtensions ({ all, ... }: with all; ([ + bcmath + calendar + curl + ctype + dom + exif + fileinfo + filter + ftp + gd + gettext + gmp + iconv + intl + json + ldap + mbstring + mysqli + mysqlnd + opcache + openssl + pcntl + pdo + pdo_mysql + pdo_odbc + pdo_pgsql + pdo_sqlite + pgsql + posix + readline + session + simplexml + sockets + soap + sodium + sqlite3 + tokenizer + xmlreader + xmlwriter + zip + zlib ] ++ lib.optionals (!stdenv.isDarwin) [ imap ])) diff --git a/pkgs/development/interpreters/php/8.0.nix b/pkgs/development/interpreters/php/8.0.nix index 90f7c3b796c00..294f100dedd3f 100644 --- a/pkgs/development/interpreters/php/8.0.nix +++ b/pkgs/development/interpreters/php/8.0.nix @@ -6,10 +6,46 @@ let sha256 = "0yazcc9x66xg1gmi3rpgk891g6s3mm7aywcadqfqnx1mdz4z5ckj"; }); -in base.withExtensions ({ all, ... }: with all; ([ - bcmath calendar curl ctype dom exif fileinfo filter ftp gd - gettext gmp iconv intl ldap mbstring mysqli mysqlnd opcache - openssl pcntl pdo pdo_mysql pdo_odbc pdo_pgsql pdo_sqlite pgsql - posix readline session simplexml sockets soap sodium sqlite3 - tokenizer xmlreader xmlwriter zip zlib +in +base.withExtensions ({ all, ... }: with all; ([ + bcmath + calendar + curl + ctype + dom + exif + fileinfo + filter + ftp + gd + gettext + gmp + iconv + intl + ldap + mbstring + mysqli + mysqlnd + opcache + openssl + pcntl + pdo + pdo_mysql + pdo_odbc + pdo_pgsql + pdo_sqlite + pgsql + posix + readline + session + simplexml + sockets + soap + sodium + sqlite3 + tokenizer + xmlreader + xmlwriter + zip + zlib ] ++ lib.optionals (!stdenv.isDarwin) [ imap ])) diff --git a/pkgs/development/interpreters/php/generic.nix b/pkgs/development/interpreters/php/generic.nix index d64349eaa9373..5344be9c5c7ec 100644 --- a/pkgs/development/interpreters/php/generic.nix +++ b/pkgs/development/interpreters/php/generic.nix @@ -3,17 +3,36 @@ let generic = - { callPackage, lib, stdenv, nixosTests, fetchurl, makeWrapper - , symlinkJoin, writeText, autoconf, automake, bison, flex, libtool - , pkg-config, re2c, apacheHttpd, libargon2, libxml2, pcre2 - , systemd, system-sendmail, valgrind, xcbuild + { callPackage + , lib + , stdenv + , nixosTests + , fetchurl + , makeWrapper + , symlinkJoin + , writeText + , autoconf + , automake + , bison + , flex + , libtool + , pkg-config + , re2c + , apacheHttpd + , libargon2 + , libxml2 + , pcre2 + , systemd + , system-sendmail + , valgrind + , xcbuild , version , sha256 - , extraPatches ? [] - , packageOverrides ? (final: prev: {}) + , extraPatches ? [ ] + , packageOverrides ? (final: prev: { }) - # Sapi flags + # Sapi flags , cgiSupport ? true , cliSupport ? true , fpmSupport ? true @@ -21,7 +40,7 @@ let , pharSupport ? true , phpdbgSupport ? true - # Misc flags + # Misc flags , apxs2Support ? !stdenv.isDarwin , argon2Support ? true , cgotoSupport ? false @@ -43,101 +62,103 @@ let # expected. mkBuildEnv = prevArgs: prevExtensionFunctions: lib.makeOverridable ( { extensions ? ({ enabled, ... }: enabled), extraConfig ? "", ... }@innerArgs: - let - allArgs = args // prevArgs // innerArgs; - filteredArgs = builtins.removeAttrs allArgs [ "extensions" "extraConfig" ]; - php = generic filteredArgs; - - php-packages = (callPackage ../../../top-level/php-packages.nix { - phpPackage = phpWithExtensions; - }).overrideScope' packageOverrides; - - allExtensionFunctions = prevExtensionFunctions ++ [ extensions ]; - enabledExtensions = - builtins.foldl' - (enabled: f: - f { inherit enabled; all = php-packages.extensions; }) - [] - allExtensionFunctions; - - getExtName = ext: lib.removePrefix "php-" (builtins.parseDrvName ext.name).name; - - # Recursively get a list of all internal dependencies - # for a list of extensions. - getDepsRecursively = extensions: - let - deps = lib.concatMap - (ext: (ext.internalDeps or []) ++ (ext.peclDeps or [])) - extensions; - in - if ! (deps == []) then - deps ++ (getDepsRecursively deps) - else - deps; - - # Generate extension load configuration snippets from the - # extension parameter. This is an attrset suitable for use - # with textClosureList, which is used to put the strings in - # the right order - if a plugin which is dependent on - # another plugin is placed before its dependency, it will - # fail to load. - extensionTexts = - lib.listToAttrs - (map (ext: + let + allArgs = args // prevArgs // innerArgs; + filteredArgs = builtins.removeAttrs allArgs [ "extensions" "extraConfig" ]; + php = generic filteredArgs; + + php-packages = (callPackage ../../../top-level/php-packages.nix { + phpPackage = phpWithExtensions; + }).overrideScope' packageOverrides; + + allExtensionFunctions = prevExtensionFunctions ++ [ extensions ]; + enabledExtensions = + builtins.foldl' + (enabled: f: + f { inherit enabled; all = php-packages.extensions; }) + [ ] + allExtensionFunctions; + + getExtName = ext: lib.removePrefix "php-" (builtins.parseDrvName ext.name).name; + + # Recursively get a list of all internal dependencies + # for a list of extensions. + getDepsRecursively = extensions: + let + deps = lib.concatMap + (ext: (ext.internalDeps or [ ]) ++ (ext.peclDeps or [ ])) + extensions; + in + if ! (deps == [ ]) then + deps ++ (getDepsRecursively deps) + else + deps; + + # Generate extension load configuration snippets from the + # extension parameter. This is an attrset suitable for use + # with textClosureList, which is used to put the strings in + # the right order - if a plugin which is dependent on + # another plugin is placed before its dependency, it will + # fail to load. + extensionTexts = + lib.listToAttrs + (map + (ext: let extName = getExtName ext; - phpDeps = (ext.internalDeps or []) ++ (ext.peclDeps or []); + phpDeps = (ext.internalDeps or [ ]) ++ (ext.peclDeps or [ ]); type = "${lib.optionalString (ext.zendExtension or false) "zend_"}extension"; in - lib.nameValuePair extName { - text = "${type}=${ext}/lib/php/extensions/${extName}.so"; - deps = map getExtName phpDeps; - }) - (enabledExtensions ++ (getDepsRecursively enabledExtensions))); - - extNames = map getExtName enabledExtensions; - extraInit = writeText "php-extra-init-${version}.ini" '' - ${lib.concatStringsSep "\n" - (lib.textClosureList extensionTexts extNames)} - ${extraConfig} - ''; - - phpWithExtensions = symlinkJoin { - name = "php-with-extensions-${version}"; - inherit (php) version; - nativeBuildInputs = [ makeWrapper ]; - passthru = php.passthru // { - buildEnv = mkBuildEnv allArgs allExtensionFunctions; - withExtensions = mkWithExtensions allArgs allExtensionFunctions; - phpIni = "${phpWithExtensions}/lib/php.ini"; - 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; - packages = php-packages.tools; - meta = php.meta // { - outputsToInstall = [ "out" ]; - }; + lib.nameValuePair extName { + text = "${type}=${ext}/lib/php/extensions/${extName}.so"; + deps = map getExtName phpDeps; + }) + (enabledExtensions ++ (getDepsRecursively enabledExtensions))); + + extNames = map getExtName enabledExtensions; + extraInit = writeText "php-extra-init-${version}.ini" '' + ${lib.concatStringsSep "\n" + (lib.textClosureList extensionTexts extNames)} + ${extraConfig} + ''; + + phpWithExtensions = symlinkJoin { + name = "php-with-extensions-${version}"; + inherit (php) version; + nativeBuildInputs = [ makeWrapper ]; + passthru = php.passthru // { + buildEnv = mkBuildEnv allArgs allExtensionFunctions; + withExtensions = mkWithExtensions allArgs allExtensionFunctions; + phpIni = "${phpWithExtensions}/lib/php.ini"; + 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; + packages = php-packages.tools; + meta = php.meta // { + outputsToInstall = [ "out" ]; }; - paths = [ php ]; - postBuild = '' - ln -s ${extraInit} $out/lib/php.ini - - if test -e $out/bin/php; then - wrapProgram $out/bin/php --set PHP_INI_SCAN_DIR $out/lib - fi - - if test -e $out/bin/php-fpm; then - wrapProgram $out/bin/php-fpm --set PHP_INI_SCAN_DIR $out/lib - fi - - if test -e $out/bin/phpdbg; then - wrapProgram $out/bin/phpdbg --set PHP_INI_SCAN_DIR $out/lib - fi - ''; }; - in - phpWithExtensions); + paths = [ php ]; + postBuild = '' + ln -s ${extraInit} $out/lib/php.ini + + if test -e $out/bin/php; then + wrapProgram $out/bin/php --set PHP_INI_SCAN_DIR $out/lib + fi + + if test -e $out/bin/php-fpm; then + wrapProgram $out/bin/php-fpm --set PHP_INI_SCAN_DIR $out/lib + fi + + if test -e $out/bin/phpdbg; then + wrapProgram $out/bin/phpdbg --set PHP_INI_SCAN_DIR $out/lib + fi + ''; + }; + in + phpWithExtensions + ); mkWithExtensions = prevArgs: prevExtensionFunctions: extensions: mkBuildEnv prevArgs prevExtensionFunctions { inherit extensions; }; @@ -182,13 +203,13 @@ let # Enable sapis ++ lib.optional (!cgiSupport) "--disable-cgi" ++ lib.optional (!cliSupport) "--disable-cli" - ++ lib.optional fpmSupport "--enable-fpm" + ++ lib.optional fpmSupport "--enable-fpm" ++ lib.optional pearSupport [ "--with-pear" "--enable-xml" "--with-libxml" ] ++ lib.optionals (pearSupport && (lib.versionOlder version "7.4")) [ "--enable-libxml" "--with-libxml-dir=${libxml2.dev}" ] - ++ lib.optional pharSupport "--enable-phar" + ++ lib.optional pharSupport "--enable-phar" ++ lib.optional (!phpdbgSupport) "--disable-phpdbg" @@ -211,33 +232,33 @@ let hardeningDisable = [ "bindnow" ]; preConfigure = - # Don't record the configure flags since this causes unnecessary - # runtime dependencies - '' - for i in main/build-defs.h.in scripts/php-config.in; do - substituteInPlace $i \ - --replace '@CONFIGURE_COMMAND@' '(omitted)' \ - --replace '@CONFIGURE_OPTIONS@' "" \ - --replace '@PHP_LDFLAGS@' "" - done - - export EXTENSION_DIR=$out/lib/php/extensions - '' - # PKG_CONFIG need not be a relative path - + lib.optionalString (! lib.versionAtLeast version "7.4") '' - for i in $(find . -type f -name "*.m4"); do - substituteInPlace $i \ - --replace 'test -x "$PKG_CONFIG"' 'type -P "$PKG_CONFIG" >/dev/null' - done - '' + '' - ./buildconf --copy --force - - if test -f $src/genfiles; then - ./genfiles - fi - '' + lib.optionalString stdenv.isDarwin '' - substituteInPlace configure --replace "-lstdc++" "-lc++" - ''; + # Don't record the configure flags since this causes unnecessary + # runtime dependencies + '' + for i in main/build-defs.h.in scripts/php-config.in; do + substituteInPlace $i \ + --replace '@CONFIGURE_COMMAND@' '(omitted)' \ + --replace '@CONFIGURE_OPTIONS@' "" \ + --replace '@PHP_LDFLAGS@' "" + done + + export EXTENSION_DIR=$out/lib/php/extensions + '' + # PKG_CONFIG need not be a relative path + + lib.optionalString (!lib.versionAtLeast version "7.4") '' + for i in $(find . -type f -name "*.m4"); do + substituteInPlace $i \ + --replace 'test -x "$PKG_CONFIG"' 'type -P "$PKG_CONFIG" >/dev/null' + done + '' + '' + ./buildconf --copy --force + + if test -f $src/genfiles; then + ./genfiles + fi + '' + lib.optionalString stdenv.isDarwin '' + substituteInPlace configure --replace "-lstdc++" "-lc++" + ''; postInstall = '' test -d $out/etc || mkdir $out/etc @@ -264,8 +285,8 @@ let outputs = [ "out" "dev" ]; passthru = { - buildEnv = mkBuildEnv {} []; - withExtensions = mkWithExtensions {} []; + buildEnv = mkBuildEnv { } [ ]; + withExtensions = mkWithExtensions { } [ ]; inherit ztsSupport; }; @@ -278,4 +299,5 @@ let outputsToInstall = [ "out" "dev" ]; }; }; -in generic +in +generic |