Skip to content

Commit 6f23fe6

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

File tree

7 files changed

+163
-50
lines changed

7 files changed

+163
-50
lines changed

.github/workflows/build.yaml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ jobs:
1414
strategy:
1515
matrix:
1616
php:
17+
- branch: 'master'
1718
- branch: '8.1'
1819
- branch: '8.0'
1920
- branch: '7.4'
@@ -40,9 +41,17 @@ jobs:
4041
id: params
4142
run: |
4243
branch=${{ matrix.php.branch }}
43-
major=${branch%%.*}
44-
minor=${branch#*.}
45-
attr=php$major$minor
44+
if [[ "$branch" = "master" ]]; then
45+
attr=php-master
46+
version=$(nix-instantiate --eval --json -A "outputs.packages.x86_64-linux.${attr}.version")
47+
# Strip quotes
48+
version=${version//\"/}
49+
major=${branch%%.*}
50+
else
51+
major=${branch%%.*}
52+
minor=${branch#*.}
53+
attr=php$major$minor
54+
fi
4655
echo "::set-output name=major::$major"
4756
echo "::set-output name=attr::$attr"
4857

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` (updated weekly)
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.

flake.nix

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,15 @@
1010

1111
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
1212

13+
php-src = {
14+
url = "github:php/php-src";
15+
flake = false;
16+
};
17+
1318
utils.url = "github:numtide/flake-utils";
1419
};
1520

16-
outputs = { self, flake-compat, nixpkgs, utils }:
21+
outputs = { self, flake-compat, nixpkgs, php-src, utils }:
1722
# For each supported platform,
1823
utils.lib.eachDefaultSystem (system:
1924
let
@@ -29,14 +34,16 @@
2934
};
3035
in rec {
3136
packages = {
32-
inherit (pkgs) php php56 php70 php71 php72 php73 php74 php80 php81;
37+
inherit (pkgs) php php56 php70 php71 php72 php73 php74 php80 php81 php-master;
3338
};
3439

3540
checks = import ./checks.nix {
3641
inherit packages pkgs system;
3742
};
3843
}
3944
) // {
40-
overlays.default = import ./pkgs/phps.nix nixpkgs.outPath;
45+
overlays.default = import ./pkgs/phps.nix {
46+
inherit nixpkgs php-src;
47+
};
4148
};
4249
}

pkgs/package-overrides.nix

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ let
1818
'';
1919

2020
inherit (pkgs) lib;
21+
22+
isBuiltFromGit = lib.hasInfix "+date=" prev.php.version;
2123
in
2224

2325
{
@@ -452,6 +454,15 @@ in
452454
ourPatches ++ upstreamPatches;
453455
});
454456

457+
tokenizer =
458+
prev.extensions.tokenizer.overrideAttrs (attrs: {
459+
nativeBuildInputs = attrs.nativeBuildInputs or [ ] ++ lib.optionals isBuiltFromGit [
460+
# Tarballs ship pre-generated parser files.
461+
pkgs.bison
462+
pkgs.flex
463+
];
464+
});
465+
455466
wddx =
456467
if lib.versionOlder prev.php.version "7.4" then
457468
prev.mkExtension {

pkgs/phps.nix

Lines changed: 110 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
nixpkgs:
1+
{
2+
nixpkgs,
3+
php-src,
4+
}:
25

36
# These are older versions of PHP removed from Nixpkgs.
47

@@ -8,10 +11,14 @@ prev:
811
let
912
packageOverrides = import ./package-overrides.nix prev;
1013

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

14-
{
20+
args
21+
// {
1522
inherit packageOverrides;
1623

1724
# For passing pcre2 to generic.nix.
@@ -20,45 +27,55 @@ let
2027
then prev.pcre2
2128
else prev.pcre;
2229

30+
# Overrides attributes passed to the stdenv.mkDerivation for the unwrapped PHP
31+
# in <nixpkgs/pkgs/development/interpreters/php/generic.nix>.
32+
# This will essentially end up creating a derivation equivalent to the following:
33+
# stdenv.mkDerivation (versionSpecificOverrides (commonOverrides { /* stuff passed to mkDerivation in generic.nix */ }))
2334
phpAttrsOverrides =
24-
attrs:
25-
26-
{
27-
patches =
28-
attrs.patches or []
29-
++ prev.lib.optionals (prev.lib.versions.majorMinor args.version == "7.2") [
30-
# Building the bundled intl extension fails on Mac OS.
31-
# See https://bugs.php.net/bug.php?id=76826 for more information.
32-
(prev.pkgs.fetchpatch {
33-
url = "https://bugs.php.net/patch-display.php?bug_id=76826&patch=bug76826.poc.0.patch&revision=1538723399&download=1";
34-
sha256 = "aW+MW9Kb8N/yBO7MdqZMZzgMSF7b+IMLulJKgKPWrUA=";
35-
})
36-
];
37-
38-
configureFlags =
39-
attrs.configureFlags
40-
++ prev.lib.optionals (prev.lib.versionOlder args.version "7.4") [
41-
# phar extension’s build system expects hash or it will degrade.
42-
"--enable-hash"
43-
44-
"--enable-libxml"
45-
"--with-libxml-dir=${prev.libxml2.dev}"
46-
];
47-
48-
preConfigure =
49-
prev.lib.optionalString (prev.lib.versionOlder args.version "7.4") ''
50-
# Workaround “configure: error: Your system does not support systemd.”
51-
# caused by PHP build system expecting PKG_CONFIG variable to contain
52-
# an absolute path on PHP ≤ 7.4.
53-
# Also patches acinclude.m4, which ends up being used by extensions.
54-
# https://github.com/NixOS/nixpkgs/pull/90249
55-
for i in $(find . -type f -name "*.m4"); do
56-
substituteInPlace $i \
57-
--replace 'test -x "$PKG_CONFIG"' 'type -P "$PKG_CONFIG" >/dev/null'
58-
done
59-
''
60-
+ attrs.preConfigure;
61-
};
35+
let
36+
commonOverrides =
37+
attrs:
38+
39+
{
40+
patches =
41+
attrs.patches or []
42+
++ prev.lib.optionals (prev.lib.versions.majorMinor args.version == "7.2") [
43+
# Building the bundled intl extension fails on Mac OS.
44+
# See https://bugs.php.net/bug.php?id=76826 for more information.
45+
(prev.pkgs.fetchpatch {
46+
url = "https://bugs.php.net/patch-display.php?bug_id=76826&patch=bug76826.poc.0.patch&revision=1538723399&download=1";
47+
sha256 = "aW+MW9Kb8N/yBO7MdqZMZzgMSF7b+IMLulJKgKPWrUA=";
48+
})
49+
];
50+
51+
configureFlags =
52+
attrs.configureFlags
53+
++ prev.lib.optionals (prev.lib.versionOlder args.version "7.4") [
54+
# phar extension’s build system expects hash or it will degrade.
55+
"--enable-hash"
56+
57+
"--enable-libxml"
58+
"--with-libxml-dir=${prev.libxml2.dev}"
59+
];
60+
61+
preConfigure =
62+
prev.lib.optionalString (prev.lib.versionOlder args.version "7.4") ''
63+
# Workaround “configure: error: Your system does not support systemd.”
64+
# caused by PHP build system expecting PKG_CONFIG variable to contain
65+
# an absolute path on PHP ≤ 7.4.
66+
# Also patches acinclude.m4, which ends up being used by extensions.
67+
# https://github.com/NixOS/nixpkgs/pull/90249
68+
for i in $(find . -type f -name "*.m4"); do
69+
substituteInPlace $i \
70+
--replace 'test -x "$PKG_CONFIG"' 'type -P "$PKG_CONFIG" >/dev/null'
71+
done
72+
''
73+
+ attrs.preConfigure;
74+
};
75+
76+
versionSpecificOverrides = args.phpAttrsOverrides or (attrs: { });
77+
in
78+
composeOverrides commonOverrides versionSpecificOverrides;
6279

6380
# For passing pcre2 to php-packages.nix.
6481
callPackage =
@@ -90,8 +107,7 @@ let
90107
);
91108
}
92109
);
93-
}
94-
// args;
110+
};
95111

96112
generic = "${nixpkgs}/pkgs/development/interpreters/php/generic.nix";
97113
mkPhp = args: prev.callPackage generic (_mkArgs args);
@@ -116,4 +132,56 @@ in
116132
php81 = prev.php81.override {
117133
inherit packageOverrides;
118134
};
135+
136+
php-master = base-master.withExtensions (
137+
{ all, ... }:
138+
139+
with all; (
140+
[
141+
bcmath
142+
calendar
143+
curl
144+
ctype
145+
dom
146+
exif
147+
fileinfo
148+
filter
149+
ftp
150+
gd
151+
gettext
152+
gmp
153+
iconv
154+
intl
155+
ldap
156+
mbstring
157+
mysqli
158+
mysqlnd
159+
opcache
160+
openssl
161+
pcntl
162+
pdo
163+
pdo_mysql
164+
pdo_odbc
165+
pdo_pgsql
166+
pdo_sqlite
167+
pgsql
168+
posix
169+
readline
170+
session
171+
simplexml
172+
sockets
173+
soap
174+
sodium
175+
sqlite3
176+
tokenizer
177+
xmlreader
178+
xmlwriter
179+
zip
180+
zlib
181+
]
182+
++ prev.lib.optionals (!prev.stdenv.isDarwin) [
183+
imap
184+
]
185+
)
186+
);
119187
}

0 commit comments

Comments
 (0)