diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index d2548cd6..90f89842 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -9,27 +9,19 @@ on: jobs: build: - name: 'PHP ${{ matrix.php.major }}.${{ matrix.php.minor }}' + name: 'PHP ${{ matrix.php.branch }}' runs-on: ubuntu-20.04 strategy: matrix: php: - - major: 8 - minor: 1 - - major: 8 - minor: 0 - - major: 7 - minor: 4 - - major: 7 - minor: 3 - - major: 7 - minor: 2 - - major: 7 - minor: 1 - - major: 7 - minor: 0 - - major: 5 - minor: 6 + - branch: '8.1' + - branch: '8.0' + - branch: '7.4' + - branch: '7.3' + - branch: '7.2' + - branch: '7.1' + - branch: '7.0' + - branch: '5.6' # We want to fix failures individually. fail-fast: false steps: @@ -44,34 +36,44 @@ jobs: name: fossar authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' + - name: Set job parameters + id: params + run: | + branch=${{ matrix.php.branch }} + major=${branch%%.*} + minor=${branch#*.} + attr=php$major$minor + echo "::set-output name=major::$major" + echo "::set-output name=attr::$attr" + - name: Build PHP - run: nix-build -A outputs.checks.x86_64-linux.php${{ matrix.php.major }}${{ matrix.php.minor }}-php + run: nix-build -A outputs.checks.x86_64-linux.${{ steps.params.outputs.attr }}-php - name: Build Imagick extension - run: nix-build -A outputs.checks.x86_64-linux.php${{ matrix.php.major }}${{ matrix.php.minor }}-imagick + run: nix-build -A outputs.checks.x86_64-linux.${{ steps.params.outputs.attr }}-imagick - name: Build Redis extension - run: nix-build -A outputs.checks.x86_64-linux.php${{ matrix.php.major }}${{ matrix.php.minor }}-redis + run: nix-build -A outputs.checks.x86_64-linux.${{ steps.params.outputs.attr }}-redis - name: Build Redis 3 extension - if: ${{ matrix.php.major < 8 }} - run: nix-build -A outputs.checks.x86_64-linux.php${{ matrix.php.major }}${{ matrix.php.minor }}-redis3 + if: ${{ steps.params.outputs.major < 8 }} + run: nix-build -A outputs.checks.x86_64-linux.${{ steps.params.outputs.attr }}-redis3 - name: Build MySQL extension - if: ${{ matrix.php.major < 7 }} - run: nix-build -A outputs.checks.x86_64-linux.php${{ matrix.php.major }}${{ matrix.php.minor }}-mysql + if: ${{ steps.params.outputs.major < 7 }} + run: nix-build -A outputs.checks.x86_64-linux.${{ steps.params.outputs.attr }}-mysql - name: Build Xdebug extension - run: nix-build -A outputs.checks.x86_64-linux.php${{ matrix.php.major }}${{ matrix.php.minor }}-xdebug + run: nix-build -A outputs.checks.x86_64-linux.${{ steps.params.outputs.attr }}-xdebug - name: Build Tidy extension - run: nix-build -A outputs.checks.x86_64-linux.php${{ matrix.php.major }}${{ matrix.php.minor }}-tidy + run: nix-build -A outputs.checks.x86_64-linux.${{ steps.params.outputs.attr }}-tidy - name: Check that composer PHAR works - run: nix-build -A outputs.checks.x86_64-linux.php${{ matrix.php.major }}${{ matrix.php.minor }}-composer-phar + run: nix-build -A outputs.checks.x86_64-linux.${{ steps.params.outputs.attr }}-composer-phar - name: Validate php.extensions.mysqli default unix socket path - run: nix-build -A outputs.checks.x86_64-linux.php${{ matrix.php.major }}${{ matrix.php.minor }}-mysqli-socket-path + run: nix-build -A outputs.checks.x86_64-linux.${{ steps.params.outputs.attr }}-mysqli-socket-path - name: Validate php.extensions.pdo_mysql default unix socket path - run: nix-build -A outputs.checks.x86_64-linux.php${{ matrix.php.major }}${{ matrix.php.minor }}-pdo_mysql-socket-path + run: nix-build -A outputs.checks.x86_64-linux.${{ steps.params.outputs.attr }}-pdo_mysql-socket-path diff --git a/pkgs/phps.nix b/pkgs/phps.nix index 59856f03..b08e35c8 100644 --- a/pkgs/phps.nix +++ b/pkgs/phps.nix @@ -2,58 +2,85 @@ nixpkgs: # These are older versions of PHP removed from Nixpkgs. -final: prev: +final: +prev: let packageOverrides = import ./package-overrides.nix prev; _mkArgs = args: + { inherit packageOverrides; # For passing pcre2 to generic.nix. - pcre2 = if (prev.lib.versionAtLeast args.version "7.3") then prev.pcre2 else prev.pcre; - - phpAttrsOverrides = attrs: { - patches = - let - upstreamPatches = - attrs.patches or []; - - ourPatches = - prev.lib.optionals (prev.lib.versions.majorMinor args.version == "7.2") [ - # Building the bundled intl extension fails on Mac OS. - # See https://bugs.php.net/bug.php?id=76826 for more information. - (prev.pkgs.fetchpatch { - url = "https://bugs.php.net/patch-display.php?bug_id=76826&patch=bug76826.poc.0.patch&revision=1538723399&download=1"; - sha256 = "aW+MW9Kb8N/yBO7MdqZMZzgMSF7b+IMLulJKgKPWrUA="; - }) - ]; - in - ourPatches ++ upstreamPatches; - - configureFlags = - attrs.configureFlags - ++ prev.lib.optionalString (prev.lib.versionOlder args.version "7.4") [ - # phar extension’s build system expects hash or it will degrade. - "--enable-hash" - ]; - }; + pcre2 = + if prev.lib.versionAtLeast args.version "7.3" + then prev.pcre2 + else prev.pcre; + + phpAttrsOverrides = + attrs: + + { + patches = + let + upstreamPatches = + attrs.patches or []; + + ourPatches = + prev.lib.optionals (prev.lib.versions.majorMinor args.version == "7.2") [ + # Building the bundled intl extension fails on Mac OS. + # See https://bugs.php.net/bug.php?id=76826 for more information. + (prev.pkgs.fetchpatch { + url = "https://bugs.php.net/patch-display.php?bug_id=76826&patch=bug76826.poc.0.patch&revision=1538723399&download=1"; + sha256 = "aW+MW9Kb8N/yBO7MdqZMZzgMSF7b+IMLulJKgKPWrUA="; + }) + ]; + in + ourPatches ++ upstreamPatches; + + configureFlags = + attrs.configureFlags + ++ prev.lib.optionals (prev.lib.versionOlder args.version "7.4") [ + # phar extension’s build system expects hash or it will degrade. + "--enable-hash" + ]; + }; # For passing pcre2 to php-packages.nix. callPackage = - cpFn: cpArgs: - prev.callPackage cpFn (cpArgs // { - pcre2 = if (prev.lib.versionAtLeast args.version "7.3") then prev.pcre2 else prev.pcre; - - # For passing pcre2 to stuff called with callPackage in php-packages.nix. - pkgs = - prev // prev.lib.makeScope prev.newScope (self: { - pcre2 = if (prev.lib.versionAtLeast args.version "7.3") then prev.pcre2 else prev.pcre; - }); - }); - } // args; + cpFn: + cpArgs: + + prev.callPackage + cpFn + ( + cpArgs + // { + pcre2 = + if prev.lib.versionAtLeast args.version "7.3" + then prev.pcre2 + else prev.pcre; + + # For passing pcre2 to stuff called with callPackage in php-packages.nix. + pkgs = + prev + // ( + prev.lib.makeScope + prev.newScope + (self: { + pcre2 = + if prev.lib.versionAtLeast args.version "7.3" + then prev.pcre2 + else prev.pcre; + }) + ); + } + ); + } + // args; generic = "${nixpkgs}/pkgs/development/interpreters/php/generic.nix"; @@ -81,55 +108,283 @@ let version = "7.3.28"; sha256 = "0r4r8famg3a8x6ch24y1370nsphkxg4k9zq5x8v88f4l8mj6wqwg"; - extraPatches = prev.lib.optionals prev.stdenv.isDarwin [ - # Fix build on Darwin - # https://bugs.php.net/bug.php?id=76826 - (prev.fetchurl { - url = "https://github.com/NixOS/nixpkgs/raw/42e9a2ccfab2a96d28c3c164a6cf41fb6f769de5/pkgs/development/interpreters/php/php73-darwin-isfinite.patch"; - sha256 = "V0mLLmXa2qJyxIVW/7nEml6cXZTBbr42kkJiij9KPyk="; - }) - ]; + extraPatches = + prev.lib.optionals prev.stdenv.isDarwin [ + # Fix build on Darwin + # https://bugs.php.net/bug.php?id=76826 + (prev.fetchurl { + url = "https://github.com/NixOS/nixpkgs/raw/42e9a2ccfab2a96d28c3c164a6cf41fb6f769de5/pkgs/development/interpreters/php/php73-darwin-isfinite.patch"; + sha256 = "V0mLLmXa2qJyxIVW/7nEml6cXZTBbr42kkJiij9KPyk="; + }) + ]; }); in { - php56 = base56.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 sqlite3 - tokenizer xmlreader xmlwriter zip zlib - ] ++ prev.lib.optionals (!prev.stdenv.isDarwin) [ imap ])); - - php70 = base70.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 sqlite3 - tokenizer xmlreader xmlwriter zip zlib - ] ++ prev.lib.optionals (!prev.stdenv.isDarwin) [ imap ])); - - php71 = base71.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 sqlite3 - tokenizer xmlreader xmlwriter zip zlib - ] ++ prev.lib.optionals (!prev.stdenv.isDarwin) [ imap ])); - - php72 = base72.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 - ] ++ prev.lib.optionals (!prev.stdenv.isDarwin) [ imap ])); - - php73 = base73.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 - ] ++ prev.lib.optionals (!prev.stdenv.isDarwin) [ imap ])); + php56 = + base56.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 + sqlite3 + tokenizer + xmlreader + xmlwriter + zip + zlib + ] + ++ prev.lib.optionals (!prev.stdenv.isDarwin) [ + imap + ] + ) + ); + + php70 = + base70.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 + sqlite3 + tokenizer + xmlreader + xmlwriter + zip + zlib + ] + ++ prev.lib.optionals (!prev.stdenv.isDarwin) [ + imap + ] + ) + ); + + php71 = + base71.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 + sqlite3 + tokenizer + xmlreader + xmlwriter + zip + zlib + ] + ++ prev.lib.optionals (!prev.stdenv.isDarwin) [ + imap + ] + ) + ); + + php72 = + base72.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 + ] + ++ prev.lib.optionals (!prev.stdenv.isDarwin) [ + imap + ] + ) + ); + + php73 = + base73.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 + ] + ++ prev.lib.optionals (!prev.stdenv.isDarwin) [ + imap + ] + ) + ); php74 = prev.php74.override { inherit packageOverrides;