Fix alpine edge build with PHP 7.4 and 8.0

This commit is contained in:
crazywhalecc 2024-08-18 15:28:43 +08:00 committed by Jerry Ma
parent 47ba881870
commit fdb5c6aa1d
2 changed files with 32 additions and 1 deletions

View File

@ -414,14 +414,17 @@ class SourcePatcher
if (preg_match('/PHP_VERSION_ID (\d+)/', $file, $match) !== 0) { if (preg_match('/PHP_VERSION_ID (\d+)/', $file, $match) !== 0) {
$ver_id = intval($match[1]); $ver_id = intval($match[1]);
if ($ver_id < 80000) { if ($ver_id < 80000) {
return false; self::patchFile('spc_fix_alpine_build_php80.patch', SOURCE_PATH . '/php-src');
return true;
} }
if ($ver_id < 80100) { if ($ver_id < 80100) {
self::patchFile('spc_fix_libxml2_12_php80.patch', SOURCE_PATH . '/php-src'); self::patchFile('spc_fix_libxml2_12_php80.patch', SOURCE_PATH . '/php-src');
self::patchFile('spc_fix_alpine_build_php80.patch', SOURCE_PATH . '/php-src');
return true; return true;
} }
if ($ver_id < 80200) { if ($ver_id < 80200) {
self::patchFile('spc_fix_libxml2_12_php81.patch', SOURCE_PATH . '/php-src'); self::patchFile('spc_fix_libxml2_12_php81.patch', SOURCE_PATH . '/php-src');
self::patchFile('spc_fix_alpine_build_php80.patch', SOURCE_PATH . '/php-src');
return true; return true;
} }
return false; return false;

View File

@ -0,0 +1,28 @@
diff --git a/main/streams/cast.c b/main/streams/cast.c
index 0978ca4d..677fc6dc 100644
--- a/main/streams/cast.c
+++ b/main/streams/cast.c
@@ -102,6 +102,9 @@ static ssize_t stream_cookie_writer(void *cookie, const char *buffer, size_t siz
# ifdef COOKIE_SEEKER_USES_OFF64_T
static int stream_cookie_seeker(void *cookie, off64_t *position, int whence)
+# else
+static int stream_cookie_seeker(void *cookie, off_t *position, int whence)
+# endif
{
*position = php_stream_seek((php_stream *)cookie, (zend_off_t)*position, whence);
@@ -111,13 +114,6 @@ static int stream_cookie_seeker(void *cookie, off64_t *position, int whence)
}
return 0;
}
-# else
-static int stream_cookie_seeker(void *cookie, zend_off_t position, int whence)
-{
-
- return php_stream_seek((php_stream *)cookie, position, whence);
-}
-# endif
static int stream_cookie_closer(void *cookie)
{