Skip to content

Commit

Permalink
Enable building PHP extension on Windows (#13097)
Browse files Browse the repository at this point in the history
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 phalcon/cphalcon#16318 (comment) for the request to build the extension and the result.

Please review and merge.

Closes #13097

COPYBARA_INTEGRATE_REVIEW=#13097 from Jan-E:php-windows 4259af1
PiperOrigin-RevId: 542050878
  • Loading branch information
Jan-E authored and Copybara-Service committed Jun 20, 2023
1 parent 33b8c45 commit 4d9bbac
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions php/BUILD.bazel
Expand Up @@ -148,6 +148,7 @@ pkg_files(
]) + [
"//:LICENSE",
"ext/google/protobuf/config.m4",
"ext/google/protobuf/config.w32",
"ext/google/protobuf/wkt.inc",
],
)
Expand Down
14 changes: 14 additions & 0 deletions php/ext/google/protobuf/config.w32
@@ -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");
}

0 comments on commit 4d9bbac

Please sign in to comment.