@@ -13,20 +13,29 @@ $LIBYAML_VER="0.2.5"
1313$PTHREAD_W32_VER = " 3.0.0"
1414$LEVELDB_MCPE_VER = " 1c7564468b41610da4f498430e795ca4de0931ff" # release not tagged
1515$LIBDEFLATE_VER = " 2335c047e91cac6fd04cb0fd2769380395149f15" # 1.22 - see above note about "v" prefixes
16+ $LIBRDKAFKA_VER = " 2.1.1"
17+ $LIBZSTD_VER = " 1.5.6"
18+ $LIBGRPC_VER = " 1.56.2"
19+ $LIBSNAPPY_VER = " 1.2.1"
1620
1721$PHP_PMMPTHREAD_VER = " 6.1.0"
1822$PHP_YAML_VER = " 2.2.4"
1923$PHP_CHUNKUTILS2_VER = " 0.3.5"
2024$PHP_IGBINARY_VER = " 3.2.16"
2125$PHP_LEVELDB_VER = " 317fdcd8415e1566fc2835ce2bdb8e19b890f9f3" # release not tagged
2226$PHP_CRYPTO_VER = " abbe7cbf869f96e69f2ce897271a61d32f43c7c0" # release not tagged
27+ $PHP_SNAPPY_VER = " ab8b2b7375641f47deb21d8e8ba1a00ea5364cf6"
2328$PHP_RECURSIONGUARD_VER = " 0.1.0"
2429$PHP_MORTON_VER = " 0.1.2"
2530$PHP_LIBDEFLATE_VER = " 0.2.1"
2631$PHP_XXHASH_VER = " 0.2.0"
2732$PHP_XDEBUG_VER = " 3.3.2"
2833$PHP_ARRAYDEBUG_VER = " 0.2.0"
2934$PHP_ENCODING_VER = " 0.3.0"
35+ $PHP_VANILLAGENERATOR_VER = " 2.1.7"
36+ $PHP_LIBKAFKA_VER = " 6.0.3"
37+ $PHP_ZSTD_VER = " 0.13.0"
38+ $PHP_GRPC_VER = " 1.57.3"
3039
3140function pm-echo {
3241 param ([string ] $message )
@@ -294,6 +303,130 @@ function download-php-deps {
294303 write-done
295304}
296305
306+ function build-snappy {
307+ write-library " snappy" $LIBSNAPPY_VER
308+ write-download
309+ (& cmd.exe / c " git clone -b $LIBSNAPPY_VER https://github.com/google/snappy $pwd 2>&1" ) >> $log_file
310+ Push-Location snappy
311+
312+ (& cmd.exe / c " git submodule update --depth=1 --init 2>&1" ) >> $log_file
313+
314+ write-configure
315+ sdk- command " cmake -GNinja^`
316+ -DCMAKE_PREFIX_PATH=`" $DEPS_DIR `" ^`
317+ -DCMAKE_INSTALL_PREFIX=`" $DEPS_DIR `" ^`
318+ -DCMAKE_BUILD_TYPE=`" $MSBUILD_CONFIGURATION `" ^`
319+ `" $pwd `" || exit 1"
320+
321+ write-compile
322+ sdk- command " cmake --build . || exit 1"
323+ write-install
324+ sdk- command " cmake -P cmake_install.cmake || exit 1"
325+ write-done
326+ Pop-Location
327+ }
328+
329+ function build-grpc {
330+ write-library " grpc" $LIBGRPC_VER
331+ write-download
332+ (& cmd.exe / c " git clone -b v$LIBGRPC_VER --depth=1 https://github.com/grpc/grpc $pwd 2>&1" ) >> $log_file
333+ Push-Location grpc
334+
335+ (& cmd.exe / c " git submodule update --depth=1 --init 2>&1" ) >> $log_file
336+
337+ write-configure
338+ sdk- command " cmake -GNinja^
339+ -DCMAKE_PREFIX_PATH=`" $DEPS_DIR `" ^`
340+ -DCMAKE_INSTALL_PREFIX=`" $DEPS_DIR `" ^`
341+ -DCMAKE_BUILD_TYPE=`" $MSBUILD_CONFIGURATION `" ^`
342+ -DZLIB_LIBRARY=`" $DEPS_DIR \lib\zlib_a.lib`" ^`
343+ -DgRPC_BUILD_CSHARP_EXT=OFF^`
344+ -DgRPC_BUILD_GRPC_CSHARP_PLUGIN=OFF^`
345+ -DgRPC_BUILD_GRPC_NODE_PLUGIN=OFF^`
346+ -DgRPC_BUILD_GRPC_OBJECTIVE_C_PLUGIN=OFF^`
347+ -DgRPC_BUILD_GRPC_PYTHON_PLUGIN=OFF^`
348+ -DgRPC_BUILD_GRPC_RUBY_PLUGIN=OFF^`
349+ -DgRPC_SSL_PROVIDER=`" package`" ^`
350+ -DgRPC_ZLIB_PROVIDER=`" package`"
351+ `" $pwd `" || exit 1"
352+
353+ write-compile
354+ sdk- command " cmake --build . || exit 1"
355+ write-install
356+ sdk- command " cmake -P cmake_install.cmake || exit 1"
357+
358+ Move-Item " .\third_party\protobuf\php\ext\google\protobuf" " $SOURCES_PATH \php-src\ext\protobuf" >> $log_file 2>&1
359+ Move-Item " .\third_party\protobuf\third_party" " $SOURCES_PATH \php-src\\ext\protobuf\third_party" >> $log_file 2>&1
360+
361+ @"
362+ ARG_ENABLE("protobuf", "Enable Protobuf extension", "yes");
363+
364+ if (PHP_PROTOBUF != "no") {
365+ EXTENSION("protobuf", "arena.c array.c convert.c def.c map.c message.c names.c php-upb.c protobuf.c", PHP_PROTOBUF_SHARED, "");
366+
367+ ADD_SOURCES(configure_module_dirname + "/third_party/utf8_range", "naive.c range2-neon.c range2-sse.c", "protobuf");
368+
369+ AC_DEFINE('HAVE_PROTOBUF', 1, '');
370+ }
371+ "@ | Out-File - Encoding UTF8 - FilePath $SOURCES_PATH \php- src\ext\protobuf\config.w32
372+
373+ write-done
374+ Pop-Location
375+ }
376+
377+ function build-zstd {
378+ write-library " zstd" $LIBZSTD_VER
379+ write-download
380+ $file = download- file " https://github.com/facebook/zstd/archive/v$LIBZSTD_VER .zip" " zstd"
381+ write-extracting
382+ unzip- file $file $pwd
383+ Move-Item " zstd-$LIBYAML_VER " libyaml >> $log_file 2>&1
384+ Push-Location libyaml
385+
386+ write-configure
387+ sdk- command " cmake -G `" $CMAKE_TARGET `" -A `" $ARCH `" ^`
388+ -DCMAKE_PREFIX_PATH=`" $DEPS_DIR `" ^`
389+ -DCMAKE_INSTALL_PREFIX=`" $DEPS_DIR `" ^`
390+ -DBUILD_SHARED_LIBS=ON^`
391+ `" $pwd `" || exit 1"
392+ write-compile
393+ sdk- command " msbuild ALL_BUILD.vcxproj /p:Configuration=$MSBUILD_CONFIGURATION /m || exit 1"
394+ write-install
395+ sdk- command " msbuild INSTALL.vcxproj /p:Configuration=$MSBUILD_CONFIGURATION /m || exit 1"
396+ write-done
397+ Pop-Location
398+ }
399+
400+ function build_rdkafka {
401+ write-library " librdkafka" $LIBRDKAFKA_VER
402+ write-download
403+ $file = download- file " https://github.com/confluentinc/librdkafka/archive/v$LIBRDKAFKA_VER .zip" " librdkafka"
404+ write-extracting
405+ unzip- file $file $pwd
406+ Move-Item " librdkafka-$LIBRDKAFKA_VER " librdkafka >> $log_file 2>&1
407+ Push-Location librdkafka
408+
409+ write-configure
410+ sdk- command " cmake -G `" $CMAKE_TARGET `" -A `" $ARCH `" ^`
411+ -DCMAKE_PREFIX_PATH=`" $DEPS_DIR `" ^`
412+ -DCMAKE_INSTALL_PREFIX=`" $DEPS_DIR `" ^`
413+ -DBUILD_SHARED_LIBS=ON^`
414+ `" $pwd `" || exit 1"
415+
416+ write-compile
417+ sdk- command " msbuild ALL_BUILD.vcxproj /p:Configuration=$MSBUILD_CONFIGURATION /m || exit 1"
418+ write-install
419+ sdk- command " msbuild INSTALL.vcxproj /p:Configuration=$MSBUILD_CONFIGURATION /m || exit 1"
420+
421+ # for no reason, php-rdkafka check for librdkafka and not rdkafka
422+ # move them to the appropriate location for php-rdkafka compatibility.
423+ Move-Item " $DEPS_DIR \lib\rdkafka.lib" " $DEPS_DIR \lib\librdkafka.lib" >> $log_file 2>&1
424+ Move-Item " $DEPS_DIR \lib\rdkafka++.lib" " $DEPS_DIR \lib\librdkafka++.lib" >> $log_file 2>&1
425+
426+ write-done
427+ Pop-Location
428+ }
429+
297430function build-yaml {
298431 write-library " yaml" $LIBYAML_VER
299432 write-download
@@ -427,6 +560,7 @@ function get-github-extension {
427560function download-php-extensions {
428561 Push-Location " $SOURCES_PATH \php-src\ext" >> $log_file 2>&1
429562 get-github - extension " pmmpthread" $PHP_PMMPTHREAD_VER " pmmp" " ext-pmmpthread"
563+ get-github - extension " vanillagenerator" $PHP_VANILLAGENERATOR_VER " NetherGamesMC" " ext-vanillagenerator"
430564 get-github - extension " yaml" $PHP_YAML_VER " php" " pecl-file_formats-yaml"
431565 get-github - extension " chunkutils2" $PHP_CHUNKUTILS2_VER " pmmp" " ext-chunkutils2"
432566 get-github - extension " igbinary" $PHP_IGBINARY_VER " igbinary" " igbinary"
@@ -438,6 +572,9 @@ function download-php-extensions {
438572 get-github - extension " xdebug" $PHP_XDEBUG_VER " xdebug" " xdebug"
439573 get-github - extension " arraydebug" $PHP_ARRAYDEBUG_VER " pmmp" " ext-arraydebug"
440574 get-github - extension " encoding" $PHP_ENCODING_VER " pmmp" " ext-encoding"
575+ get-github - extension " rdkafka" $PHP_LIBKAFKA_VER " arnaud-lb" " php-rdkafka"
576+ get-github - extension " zstd" $PHP_ZSTD_VER " kjdev" " php-ext-zstd"
577+ get-github - extension " grpc" $PHP_GRPC_VER " larryTheCoder" " php-grpc"
441578
442579 write-library " php-ext crypto" $PHP_CRYPTO_VER
443580 write-download
@@ -449,6 +586,19 @@ function download-php-extensions {
449586 write-done
450587 Pop-Location
451588
589+ write-library " php-ext snappy" $PHP_SNAPPY_VER
590+ write-download
591+ (& cmd.exe / c " git clone https://github.com/kjdev/php-ext-snappy.git snappy 2>&1" ) >> $log_file
592+ Push-Location snappy
593+ write-status " preparing"
594+ (& cmd.exe / c " git checkout $PHP_SNAPPY_VER 2>&1" ) >> $log_file
595+ (& cmd.exe / c " git submodule update --init --recursive 2>&1" ) >> $log_file
596+ Push-Location snappy
597+ (& cmd.exe / c " git checkout $LIBSNAPPY_VER 2>&1" ) >> $log_file
598+ Pop-Location
599+ write-done
600+ Pop-Location
601+
452602 Pop-Location
453603}
454604
@@ -470,6 +620,10 @@ mkdir $LIB_BUILD_DIR >> $log_file 2>&1
470620
471621cd $LIB_BUILD_DIR >> $log_file 2>&1
472622
623+ build-snappy
624+ build-grpc
625+ build-zstd
626+ build_rdkafka
473627build-pthreads4w
474628build-yaml
475629# these two both need zlib from the standard deps
@@ -512,6 +666,11 @@ sdk-command "configure^`
512666 --enable-opcache^`
513667 --enable-opcache-jit=$PHP_JIT_ENABLE_ARG ^`
514668 --enable-phar^`
669+ --enable-vanillagenerator=shared^
670+ --enable-zstd^
671+ --enable-snappy^
672+ --enable-grpc=shared^
673+ --enable-protobuf=shared^
515674 --enable-recursionguard=shared^`
516675 --enable-sockets^`
517676 --enable-tokenizer^`
@@ -524,6 +683,7 @@ sdk-command "configure^`
524683 --with-crypto=shared^`
525684 --with-curl^`
526685 --with-dom^`
686+ --with-ffi^`
527687 --with-gd=shared^`
528688 --with-gmp^`
529689 --with-iconv^`
@@ -543,6 +703,7 @@ sdk-command "configure^`
543703 --with-xdebug-compression^`
544704 --with-xml^`
545705 --with-yaml^`
706+ --with-rdkafka=shared^`
546707 --with-pdo-mysql^`
547708 --with-pdo-sqlite^`
548709 --without-readline"
@@ -560,6 +721,9 @@ Remove-Item "$SOURCES_PATH\php-src\$ARCH\Release_TS\php-$PHP_DISPLAY_VER\glib-*.
560721Remove-Item " $SOURCES_PATH \php-src\$ARCH \Release_TS\php-$PHP_DISPLAY_VER \gmodule-*.dll" >> $log_file 2>&1
561722Remove-Item - Recurse " $SOURCES_PATH \php-src\$ARCH \Release_TS\php-$PHP_DISPLAY_VER \lib\enchant\" >> $log_file 2>&1
562723
724+ Move-Item " $DEPS_DIR \grpc\cmake\build\grpc_php_plugin.exe" " $outpath \grpc\grpc_php_plugin.exe" >> $log_file 2>&1
725+ Move-Item " $DEPS_DIR \grpc\cmake\build\third_party\protobuf\protoc.exe" " $outpath \grpc\protoc.exe" >> $log_file 2>&1
726+
563727cd $outpath >> $log_file 2>&1
564728Move-Item - Force " $SOURCES_PATH \php-src\$ARCH \$ ( $OUT_PATH_REL ) _TS\php-debug-pack-*.zip" $outpath
565729Remove-Item - Recurse bin - ErrorAction Continue >> $log_file 2>&1
@@ -603,6 +767,10 @@ append-file-utf8 "opcache.cache_id=PHP_BINARY ;prevent sharing SHM between diffe
603767append- file- utf8 " ;Optional extensions, supplied for plugin use" $php_ini
604768append- file- utf8 " extension=php_fileinfo.dll" $php_ini
605769append- file- utf8 " extension=php_gd.dll" $php_ini
770+ append- file- utf8 " extension=php_grpc.dll" $php_ini
771+ append- file- utf8 " extension=php_protobuf.dll" $php_ini
772+ append- file- utf8 " extension=php_vanillagenerator.dll" $php_ini
773+ append- file- utf8 " extension=php_rdkafka.dll" $php_ini
606774append- file- utf8 " extension=php_mysqli.dll" $php_ini
607775append- file- utf8 " extension=php_sqlite3.dll" $php_ini
608776append- file- utf8 " ;Optional extensions, supplied for debugging" $php_ini
0 commit comments