Skip to content

Commit 84b0878

Browse files
jtojnardrupol
andcommitted
php-master: init at 8.2.pre+date=20220426165801
Co-Authored-By: Pol Dellaiera <pol.dellaiera@protonmail.com>
1 parent 6a926ec commit 84b0878

File tree

4 files changed

+135
-29
lines changed

4 files changed

+135
-29
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ We use [Cachix](https://app.cachix.org/cache/fossar) to store `x86_64-linux` bin
1414

1515
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).
1616

17-
The following versions are currently supported:
17+
The following versions are currently available:
1818

1919
- `php56`
2020
- `php70`
@@ -24,6 +24,7 @@ The following versions are currently supported:
2424
- `php74`
2525
- `php80`
2626
- `php81`
27+
- `php-master`
2728

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

checks.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
}:
66

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

1010
checks = {
1111
php = {

flake.lock

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkgs/phps.nix

Lines changed: 115 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,13 @@ prev:
1111
let
1212
packageOverrides = import ./package-overrides.nix prev;
1313

14+
/* Composes package overrides (i.e. overlays that only take prev). */
15+
composeOverrides = a: b: prev.lib.composeExtensions (_: a) (_: b) { };
16+
1417
_mkArgs =
1518
args:
1619

17-
{
20+
args // {
1821
inherit packageOverrides;
1922

2023
# For passing pcre2 to generic.nix.
@@ -23,34 +26,44 @@ let
2326
then prev.pcre2
2427
else prev.pcre;
2528

29+
# Overrides attributes passed to the stdenv.mkDerivation for the unwrapped PHP
30+
# in <nixpkgs/pkgs/development/interpreters/php/generic.nix>.
31+
# This will essentially end up creating a derivation equivalent to the following:
32+
# stdenv.mkDerivation (versionSpecificOverrides (commonOverrides { /* stuff passed to mkDerivation in generic.nix */ }))
2633
phpAttrsOverrides =
27-
attrs:
28-
29-
{
30-
patches =
31-
let
32-
upstreamPatches =
33-
attrs.patches or [ ];
34-
35-
ourPatches =
36-
prev.lib.optionals (prev.lib.versions.majorMinor args.version == "7.2") [
37-
# Building the bundled intl extension fails on Mac OS.
38-
# See https://bugs.php.net/bug.php?id=76826 for more information.
39-
(prev.pkgs.fetchpatch {
40-
url = "https://bugs.php.net/patch-display.php?bug_id=76826&patch=bug76826.poc.0.patch&revision=1538723399&download=1";
41-
sha256 = "aW+MW9Kb8N/yBO7MdqZMZzgMSF7b+IMLulJKgKPWrUA=";
42-
})
34+
let
35+
commonOverrides =
36+
attrs:
37+
38+
{
39+
patches =
40+
let
41+
upstreamPatches =
42+
attrs.patches or [ ];
43+
44+
ourPatches =
45+
prev.lib.optionals (prev.lib.versions.majorMinor args.version == "7.2") [
46+
# Building the bundled intl extension fails on Mac OS.
47+
# See https://bugs.php.net/bug.php?id=76826 for more information.
48+
(prev.pkgs.fetchpatch {
49+
url = "https://bugs.php.net/patch-display.php?bug_id=76826&patch=bug76826.poc.0.patch&revision=1538723399&download=1";
50+
sha256 = "aW+MW9Kb8N/yBO7MdqZMZzgMSF7b+IMLulJKgKPWrUA=";
51+
})
52+
];
53+
in
54+
ourPatches ++ upstreamPatches;
55+
56+
configureFlags =
57+
attrs.configureFlags
58+
++ prev.lib.optionals (prev.lib.versionOlder args.version "7.4") [
59+
# phar extension’s build system expects hash or it will degrade.
60+
"--enable-hash"
4361
];
44-
in
45-
ourPatches ++ upstreamPatches;
62+
};
4663

47-
configureFlags =
48-
attrs.configureFlags
49-
++ prev.lib.optionals (prev.lib.versionOlder args.version "7.4") [
50-
# phar extension’s build system expects hash or it will degrade.
51-
"--enable-hash"
52-
];
53-
};
64+
versionSpecificOverrides = args.phpAttrsOverrides or (attrs: { });
65+
in
66+
composeOverrides commonOverrides versionSpecificOverrides;
5467

5568
# For passing pcre2 to php-packages.nix.
5669
callPackage =
@@ -72,7 +85,7 @@ let
7285
else prev.pcre;
7386
});
7487
});
75-
} // args;
88+
};
7689

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

@@ -115,6 +128,29 @@ let
115128
})
116129
];
117130
});
131+
132+
base-master =
133+
prev.callPackage generic (_mkArgs {
134+
version =
135+
let
136+
configureFile = "${php-src}/configure.ac";
137+
versionMatch = builtins.match ".*AC_INIT\\(\\[PHP],\\[(.+)-dev].*" (builtins.readFile configureFile);
138+
version =
139+
if builtins.pathExists configureFile && builtins.length versionMatch == 1
140+
then builtins.head versionMatch
141+
else "0.0.0+unknown";
142+
in
143+
"${version}.pre+date=${php-src.lastModifiedDate}";
144+
sha256 = null;
145+
146+
phpAttrsOverrides = attrs: {
147+
src = php-src;
148+
configureFlags = attrs.configureFlags ++ [
149+
# install-pear-nozlib.phar (normally shipped in tarball) would need to be downloaded.
150+
"--without-pear"
151+
];
152+
};
153+
});
118154
in
119155
{
120156
php56 =
@@ -393,4 +429,56 @@ in
393429
prev.php81.override {
394430
inherit packageOverrides;
395431
};
432+
433+
php-master =
434+
base-master.withExtensions
435+
(
436+
{ all, ... }:
437+
438+
with all;
439+
([
440+
bcmath
441+
calendar
442+
curl
443+
ctype
444+
dom
445+
exif
446+
fileinfo
447+
filter
448+
ftp
449+
gd
450+
gettext
451+
gmp
452+
iconv
453+
intl
454+
ldap
455+
mbstring
456+
mysqli
457+
mysqlnd
458+
opcache
459+
openssl
460+
pcntl
461+
pdo
462+
pdo_mysql
463+
pdo_odbc
464+
pdo_pgsql
465+
pdo_sqlite
466+
pgsql
467+
posix
468+
readline
469+
session
470+
simplexml
471+
sockets
472+
soap
473+
sodium
474+
sqlite3
475+
tokenizer
476+
xmlreader
477+
xmlwriter
478+
zip
479+
zlib
480+
] ++ prev.lib.optionals (!prev.stdenv.isDarwin) [
481+
imap
482+
])
483+
);
396484
}

0 commit comments

Comments
 (0)