Skip to content

Commit 6be07e2

Browse files
tianontobias-schaefer
authored andcommitted
Backport patches for Alpine 3.22 + ZTS
1 parent c975071 commit 6be07e2

File tree

5 files changed

+74
-7
lines changed

5 files changed

+74
-7
lines changed

8.1/alpine3.22/zts/Dockerfile

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

8.2/alpine3.22/zts/Dockerfile

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

8.3/alpine3.22/zts/Dockerfile

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

8.4/alpine3.22/zts/Dockerfile

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

Dockerfile-linux.template

Lines changed: 44 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,26 @@
1212
;
1313
def is_alpine:
1414
env.from | contains("alpine")
15+
;
16+
def rcVersion:
17+
env.version | rtrimstr("-rc")
18+
;
19+
def need_patch_11678:
20+
# https://github.com/docker-library/php/pull/1552
21+
# https://github.com/php/php-src/issues/11678 "Build fails on musl 1.2.4 - lfs64" stream_cookie_seeker
22+
# https://github.com/php/php-src/issues/14834 "Error installing PHP when --with-pear is used" xml errors
23+
is_alpine and rcVersion == "8.1"
24+
;
25+
def need_patch_18743:
26+
# https://github.com/docker-library/php/pull/1580
27+
# https://github.com/php/php-src/issues/18743 "Incompatibility in Inline TLS Assembly on Alpine 3.22 with zend_jit_ir.c"
28+
env.variant == "zts" # only needed for ZTS builds
29+
and is_alpine
30+
and (env.from != "alpine:3.21") # only needed for Alpine 3.22+
31+
and (
32+
IN(rcVersion; "8.1", "8.2")
33+
or IN(.version; "8.3.22", "8.4.8") # https://github.com/docker-library/php/pull/1580#issuecomment-2955259172
34+
)
1535
-}}
1636
FROM {{ env.from }}
1737

@@ -205,7 +225,7 @@ ENV GPG_KEYS="{{
205225
"2C16 C765 DBE5 4A08 8130 F1BC 4B9B 5F60 0B55 F3B4", # carusogabriel
206226
"39B6 4134 3D8C 104B 2B14 6DC3 F9C3 9DC0 B969 8544" # ramsey
207227
],
208-
}[env.version | rtrimstr("-rc")] // error("missing GPG keys for " + env.version)
228+
}[rcVersion] // error("missing GPG keys for " + rcVersion)
209229
| map(gsub(" "; ""))
210230
| join(" ")
211231
}}"
@@ -278,8 +298,8 @@ RUN set -eux; \
278298
"libxml2-dev",
279299
if env.version == "8.0" then "libzip-dev" else empty end,
280300
if env.version == "8.0" then "openssl1.1-compat-dev" else "openssl-dev" end,
281-
# https://github.com/docker-library/php/pull/1552
282-
if env.version | rtrimstr("-rc") == "8.1" then "patch", "patchutils" else empty end,
301+
# https://github.com/docker-library/php/pull/1552 (11678) & https://github.com/docker-library/php/pull/1580 (14834)
302+
if need_patch_11678 or need_patch_18743 then "patch", "patchutils" else empty end,
283303
"readline-dev",
284304
"sqlite-dev",
285305
# https://github.com/docker-library/php/issues/888
@@ -323,7 +343,7 @@ RUN set -eux; \
323343
; \
324344
docker-php-source extract; \
325345
cd /usr/src/php; \
326-
{{ if is_alpine and (env.version | rtrimstr("-rc") == "8.1") then ( -}}
346+
{{ if need_patch_11678 then ( -}}
327347
# Apply patches; see https://github.com/docker-library/php/pull/1552
328348
# https://github.com/php/php-src/issues/11678
329349
curl -fL 'https://github.com/php/php-src/commit/577b8ae4226368e66fee7a9b5c58f9e2428372fc.patch?full_index=1' -o 11678.patch; \
@@ -335,6 +355,23 @@ RUN set -eux; \
335355
echo 'ed10a1b254091ad676ed204e55628ecbd6c8962004d6185a1821cedecd526c0f *14834.patch' | sha256sum -c -; \
336356
filterdiff -x '*/NEWS' 14834.patch | patch -p1; \
337357
rm 14834.patch; \
358+
{{ ) else "" end -}}
359+
{{
360+
if need_patch_18743 then
361+
# https://github.com/docker-library/php/pull/1580#issuecomment-2957191901
362+
{
363+
"8.1": { url: "https://github.com/php/php-src/commit/6b105d4bc57e20a2472c9a6ff11fba32768556d4.patch?full_index=1", sha256: "037e1610ae5d444e9a8c3ecd9d5f0cd215fd0aac90bdd7b9f0b259bffdf3566b" },
364+
"8.4": { url: "https://github.com/php/php-src/commit/4c7220322bc74b0fc8416e1958cadd7bc51fe1b7.diff?full_index=1", sha256: "a19e795b24c52d4d1aa3d45b67339e1b62a5365b37cf4418b83e2709fc98bcb5" },
365+
}[rcVersion]
366+
// { url: "https://github.com/php/php-src/commit/b3c8afe272a6919248986c703c2e1defc73ff707.patch?full_index=1", sha256: "b334f73434c9732a4b27a42eb5d417e10df842e854c02a3e753b2479f8978bf5" }
367+
| (
368+
-}}
369+
# https://github.com/php/php-src/issues/18743 "Incompatibility in Inline TLS Assembly on Alpine 3.22 with zend_jit_ir.c"
370+
# https://github.com/docker-library/php/pull/1580
371+
curl -fL {{ .url | @sh }} -o 18743.patch; \
372+
echo {{ "\(.sha256) *18743.patch" | @sh }} | sha256sum -c -; \
373+
filterdiff -x '*/NEWS' 18743.patch | patch -p1; \
374+
rm 18743.patch; \
338375
{{ ) else "" end -}}
339376
gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)"; \
340377
{{ if is_alpine then "" else ( -}}
@@ -358,7 +395,7 @@ RUN set -eux; \
358395
# https://github.com/docker-library/php/issues/822
359396
--with-pic \
360397
\
361-
{{ if env.version | rtrimstr("-rc") == "8.0" then ( -}}
398+
{{ if rcVersion == "8.0" then ( -}}
362399
# --enable-ftp is included here for compatibility with existing versions. ftp_ssl_connect() needed ftp to be compiled statically before PHP 7.0 (see https://github.com/docker-library/php/issues/236).
363400
--enable-ftp \
364401
{{ ) else "" end -}}
@@ -395,7 +432,7 @@ RUN set -eux; \
395432
# in PHP 7.4+, the pecl/pear installers are officially deprecated (requiring an explicit "--with-pear")
396433
--with-pear \
397434
\
398-
{{ if env.version | rtrimstr("-rc") | IN("8.1", "8.2") then ( -}}
435+
{{ if rcVersion | IN("8.1", "8.2") then ( -}}
399436
# bundled pcre does not support JIT on riscv64 until 10.41 (php 8.3+)
400437
# https://github.com/PCRE2Project/pcre2/commits/pcre2-10.41/src/sljit/sljitNativeRISCV_64.c
401438
# https://github.com/php/php-src/tree/php-8.3.0/ext/pcre/pcre2lib
@@ -433,7 +470,7 @@ RUN set -eux; \
433470
--enable-zts \
434471
# https://externals.io/message/118859
435472
--disable-zend-signals \
436-
{{ if env.version | rtrimstr("-rc") | IN("8.1", "8.2") then ( -}}
473+
{{ if rcVersion | IN("8.1", "8.2") then ( -}}
437474
--enable-zend-max-execution-timers \
438475
{{ ) else "" end -}}
439476
{{ ) else "" end -}}

0 commit comments

Comments
 (0)