Skip to content

Commit 9824075

Browse files
committed
Fix grpc installation scripts.
1 parent cf666b9 commit 9824075

File tree

4 files changed

+41
-12
lines changed

4 files changed

+41
-12
lines changed

compile.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ EXT_ARRAYDEBUG_VERSION="0.2.1"
4343
EXT_ENCODING_VERSION="1.0.0"
4444
EXT_RDKAFKA_VERSION="6.0.3"
4545
EXT_ZSTD_VERSION="0.15.2"
46-
EXT_GRPC_VERSION="1.57.3"
46+
EXT_GRPC_VERSION="1.76.0"
4747
EXT_VANILLAGENERATOR_VERSION="abd059fd2ca79888aab3b9c5070d83ceea55fada"
4848

4949
EXT_PMMPTHREAD_VERSION_PHP85="4aa34a27feaa43adba5f1e93939828d1d7afdefc"
@@ -1433,9 +1433,9 @@ write_out "PHP" "Downloading additional extensions..."
14331433

14341434
get_github_extension "pmmpthread" "$EXT_PMMPTHREAD_VERSION" "pmmp" "ext-pmmpthread"
14351435

1436-
14371436
get_github_extension "yaml" "$EXT_YAML_VERSION" "php" "pecl-file_formats-yaml"
1438-
#get_pecl_extension "yaml" "$EXT_YAML_VERSION"
1437+
1438+
get_pecl_extension "yaml" "$EXT_YAML_VERSION"
14391439

14401440
get_github_extension "igbinary" "$EXT_IGBINARY_VERSION" "igbinary" "igbinary"
14411441

@@ -1446,7 +1446,7 @@ git clone https://github.com/bukka/php-crypto.git "$BUILD_DIR/php/ext/crypto" >>
14461446
cd "$BUILD_DIR/php/ext/crypto"
14471447
git checkout "$EXT_CRYPTO_VERSION" >> "$DIR/install.log" 2>&1
14481448
git submodule update --init --recursive >> "$DIR/install.log" 2>&1
1449-
cd "$BUILD_DIR"
1449+
cd "$BUILD_DIR/php"
14501450
write_done
14511451

14521452
get_github_extension "snappy" "$EXT_SNAPPY_VERSION" "kjdev" "php-ext-snappy"
@@ -1566,13 +1566,13 @@ fi
15661566
write_library "PHP" "$PHP_VERSION"
15671567

15681568
write_configure
1569-
cd php
15701569
rm -f ./aclocal.m4 >> "$DIR/install.log" 2>&1
15711570
rm -rf ./autom4te.cache/ >> "$DIR/install.log" 2>&1
15721571
rm -f ./configure >> "$DIR/install.log" 2>&1
15731572

15741573
# Patch files for snappy, the effected lines causing the build to fail.
1575-
patch "$BUILD_DIR/php/ext/snappy/config.m4" "$DIR/patches/config.m4.patch" >> "$DIR/install.log" 2>&1
1574+
patch "$BUILD_DIR/php/ext/snappy/config.m4" "$DIR/patches/config-snappy.m4.patch" >> "$DIR/install.log" 2>&1
1575+
patch "$BUILD_DIR/php/ext/protobuf/config.m4" "$DIR/patches/config-protobuf.m4.patch" >> "$DIR/install.log" 2>&1
15761576

15771577
./buildconf --force >> "$DIR/install.log" 2>&1
15781578

patches/config-protobuf.m4.patch

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
--- config.m4.pre 2025-12-04 20:15:57.432656800 +0800
2+
+++ config.m4.new 2025-12-04 20:15:32.307286900 +0800
3+
@@ -1,11 +1,16 @@
4+
PHP_ARG_ENABLE(protobuf, whether to enable Protobuf extension, [ --enable-protobuf Enable Protobuf extension])
5+
6+
if test "$PHP_PROTOBUF" != "no"; then
7+
+ PHP_ADD_LIBRARY(upb_mini_table_lib,, PROTOBUF_SHARED_LIBADD)
8+
+ PHP_ADD_LIBRARY(upb_message_lib,, PROTOBUF_SHARED_LIBADD)
9+
+ PHP_ADD_LIBRARY(upb_base_lib,, PROTOBUF_SHARED_LIBADD)
10+
+ PHP_ADD_LIBRARY(upb_reflection_lib,, PROTOBUF_SHARED_LIBADD)
11+
+ PHP_ADD_LIBRARY(upb_wire_lib,, PROTOBUF_SHARED_LIBADD)
12+
13+
PHP_NEW_EXTENSION(
14+
protobuf,
15+
arena.c array.c convert.c def.c map.c message.c names.c print_options.c php-upb.c protobuf.c third_party/utf8_range/utf8_range.c,
16+
$ext_shared, , -std=gnu99 -I@ext_srcdir@/third_party/utf8_range)
17+
PHP_ADD_BUILD_DIR($ext_builddir/third_party/utf8_range)
18+
-
19+
+ PHP_SUBST(GRPC_SHARED_LIBADD)
20+
fi

windows-compile-vs.ps1

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ $PHP_ENCODING_VER="1.0.0"
3535
$PHP_VANILLAGENERATOR_VER="2.1.7"
3636
$PHP_LIBKAFKA_VER="6.0.3"
3737
$PHP_ZSTD_VER="0.15.2"
38-
$PHP_GRPC_VER="1.57.3"
38+
$PHP_GRPC_VER="1.76.0"
3939

4040
$PHP_PMMPTHREAD_VER_PHP85="4aa34a27feaa43adba5f1e93939828d1d7afdefc"
4141
$PHP_IGBINARY_VER_PHP85="8f8b7175c7859f1845bcdee6f7d0baeea7d07cb8"
@@ -405,11 +405,20 @@ function build-grpc {
405405
ARG_ENABLE("protobuf", "Enable Protobuf extension", "yes");
406406
407407
if (PHP_PROTOBUF != "no") {
408-
EXTENSION("protobuf", "arena.c array.c convert.c def.c map.c message.c names.c php-upb.c protobuf.c", PHP_PROTOBUF_SHARED, "");
409-
410-
ADD_SOURCES(configure_module_dirname + "/third_party/utf8_range", "naive.c range2-neon.c range2-sse.c", "protobuf");
411-
412-
AC_DEFINE('HAVE_PROTOBUF', 1, '');
408+
if (CHECK_LIB("upb_mini_table_lib.lib", "protobuf", PHP_PROTOBUF) &&
409+
CHECK_LIB("upb_message_lib.lib", "protobuf", PHP_PROTOBUF) &&
410+
CHECK_LIB("upb_base_lib.lib", "protobuf", PHP_PROTOBUF) &&
411+
CHECK_LIB("upb_reflection_lib.lib", "protobuf", PHP_PROTOBUF) &&
412+
CHECK_LIB("upb_wire_lib.lib", "protobuf", PHP_PROTOBUF)) {
413+
414+
ADD_SOURCES(configure_module_dirname + "/third_party/utf8_range", "utf8_range.c", "PROTOBUF");
415+
ADD_FLAG("CFLAGS_PROTOBUF", "/I" + configure_module_dirname + "/third_party/utf8_range");
416+
EXTENSION("protobuf", "arena.c array.c convert.c def.c map.c message.c names.c print_options.c php-upb.c protobuf.c");
417+
418+
AC_DEFINE('HAVE_PROTOBUF', 1, '');
419+
} else {
420+
WARNING("php-grpc not enabled; libraries and headers not found");
421+
}
413422
}
414423
"@ | Out-File -Encoding ascii -FilePath $SOURCES_PATH\ext\protobuf\config.w32
415424

0 commit comments

Comments
 (0)