Skip to content

Commit

Permalink
php-master: init at 8.2.pre+date=20220426165801
Browse files Browse the repository at this point in the history
  • Loading branch information
jtojnar committed Apr 26, 2022
1 parent 6a926ec commit 71efd99
Show file tree
Hide file tree
Showing 4 changed files with 131 additions and 29 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ We use [Cachix](https://app.cachix.org/cache/fossar) to store `x86_64-linux` bin

This package is regularly updated to match latest Nixpkgs and the PHP packages use the [same API as those in Nixpkgs](https://nixos.org/manual/nixpkgs/unstable/#sec-php).

The following versions are currently supported:
The following versions are currently available:

- `php56`
- `php70`
Expand All @@ -24,6 +24,7 @@ The following versions are currently supported:
- `php74`
- `php80`
- `php81`
- `php-master`

There is also a `php` package which is the alias of the default PHP version in Nixpkgs.

Expand Down
2 changes: 1 addition & 1 deletion checks.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
}:

let
phpPackages = builtins.filter (name: builtins.match "php[0-9]+" name != null) (builtins.attrNames packages);
phpPackages = builtins.filter (name: builtins.match "php([0-9]+|-master)" name != null) (builtins.attrNames packages);

checks = {
php = {
Expand Down
17 changes: 17 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

138 changes: 111 additions & 27 deletions pkgs/phps.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@ prev:
let
packageOverrides = import ./package-overrides.nix prev;

/* Composes package overrides (i.e. overlays that only take prev). */
composeOverrides = a: b: prev.lib.composeExtensions (_: a) (_: b) { };

_mkArgs =
args:

{
args // {
inherit packageOverrides;

# For passing pcre2 to generic.nix.
Expand All @@ -23,34 +26,44 @@ let
then prev.pcre2
else prev.pcre;

# Overrides attributes passed to the stdenv.mkDerivation for the unwrapped PHP
# in <nixpkgs/pkgs/development/interpreters/php/generic.nix>.
# This will essentially end up creating a derivation equivalent to the following:
# stdenv.mkDerivation (versionSpecificOverrides (commonOverrides { /* stuff passed to mkDerivation in generic.nix */ }))
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=";
})
let
commonOverrides =
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"
];
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"
];
};
versionSpecificOverrides = args.phpAttrsOverrides or (attrs: { });
in
composeOverrides commonOverrides versionSpecificOverrides;

# For passing pcre2 to php-packages.nix.
callPackage =
Expand All @@ -72,7 +85,7 @@ let
else prev.pcre;
});
});
} // args;
};

generic = "${nixpkgs}/pkgs/development/interpreters/php/generic.nix";

Expand Down Expand Up @@ -115,6 +128,25 @@ let
})
];
});

base-master =
prev.callPackage generic (_mkArgs {
version =
let
configureFile = "${php-src}/configure.ac";
versionMatch = builtins.match ".*AC_INIT\\(\\[PHP],\\[(.+)-dev].*" (builtins.readFile configureFile);
version =
if builtins.pathExists configureFile && builtins.length versionMatch == 1
then builtins.head versionMatch
else "0.0.0+unknown";
in
"${version}.pre+date=${php-src.lastModifiedDate}";
sha256 = null;

phpAttrsOverrides = attrs: {
src = php-src;
};
});
in
{
php56 =
Expand Down Expand Up @@ -393,4 +425,56 @@ in
prev.php81.override {
inherit packageOverrides;
};

php-master =
base-master.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
] ++ prev.lib.optionals (!prev.stdenv.isDarwin) [
imap
])
);
}

0 comments on commit 71efd99

Please sign in to comment.