Enable building PHP extension on Windows (#13097)

This PR adds a config.w32 for the PHP extension and includes it in the tgz for PECL.
I used this to build php_protobuf.dll for PHP 8.2.7.
See https://github.com/phalcon/cphalcon/issues/16318#issuecomment-1592534432 for the request to build the extension and the result.

Please review and merge.

Closes #13097

COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/13097 from Jan-E:php-windows 4259af1668
PiperOrigin-RevId: 542050878
pull/13080/head
Jan Ehrhardt 1 year ago committed by Copybara-Service
parent 33b8c451a6
commit 4d9bbac167
  1. 1
      php/BUILD.bazel
  2. 14
      php/ext/google/protobuf/config.w32

@ -148,6 +148,7 @@ pkg_files(
]) + [
"//:LICENSE",
"ext/google/protobuf/config.m4",
"ext/google/protobuf/config.w32",
"ext/google/protobuf/wkt.inc",
],
)

@ -0,0 +1,14 @@
ARG_ENABLE("protobuf", "whether to enable Protobuf extension", "no");
if (PHP_PROTOBUF != "no") {
var PHP_PROTOBUF_SRC_ARRAY = glob(configure_module_dirname + "/third_party/utf8_range/*.c");
var PHP_PROTOBUF_SOURCES=" ";
for (var i=0; i<PHP_PROTOBUF_SRC_ARRAY.length; ++i) {
var basename = FSO.GetFileName(PHP_PROTOBUF_SRC_ARRAY[i]);
PHP_PROTOBUF_SOURCES = PHP_PROTOBUF_SOURCES + " " + basename;
}
ADD_SOURCES(configure_module_dirname + "/third_party/utf8_range", PHP_PROTOBUF_SOURCES, "PROTOBUF");
ADD_FLAG("CFLAGS_PROTOBUF", "/I" + configure_module_dirname + "/third_party/utf8_range");
EXTENSION("protobuf", "arena.c array.c convert.c def.c map.c message.c names.c php-upb.c protobuf.c");
}
Loading…
Cancel
Save