Skip to content

PHPC-2300: Update build configs for renamed libbson substitutions #1474

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ if test "$PHP_MONGODB" != "no"; then
PHP_MONGODB_COMMON_SOURCES="common-b64.c common-md5.c common-thread.c"

dnl Generated with: find src/libmongoc/src/kms-message/src -maxdepth 1 -name '*.c' -print0 | cut -sz -d / -f 6- | sort -dz | tr '\000' ' '
PHP_MONGODB_KMS_MESSAGE_SOURCES="hexlify.c kms_b64.c kms_caller_identity_request.c kms_crypto_apple.c kms_crypto_libcrypto.c kms_crypto_none.c kms_crypto_windows.c kms_decrypt_request.c kms_encrypt_request.c kms_kv_list.c kms_message.c kms_port.c kms_request.c kms_request_opt.c kms_request_str.c kms_response.c kms_response_parser.c sort.c"
PHP_MONGODB_KMS_MESSAGE_SOURCES="hexlify.c kms_azure_request.c kms_b64.c kms_caller_identity_request.c kms_crypto_apple.c kms_crypto_libcrypto.c kms_crypto_none.c kms_crypto_windows.c kms_decrypt_request.c kms_encrypt_request.c kms_gcp_request.c kms_kmip_reader_writer.c kms_kmip_request.c kms_kmip_response.c kms_kmip_response_parser.c kms_kv_list.c kms_message.c kms_port.c kms_request.c kms_request_opt.c kms_request_str.c kms_response.c kms_response_parser.c sort.c"

dnl Generated with: find src/libmongoc/src/libbson/src/bson -name '*.c' -print0 | cut -sz -d / -f 7- | sort -dz | tr '\000' ' '
PHP_MONGODB_BSON_SOURCES="bcon.c bson-atomic.c bson.c bson-clock.c bson-context.c bson-decimal128.c bson-error.c bson-iso8601.c bson-iter.c bson-json.c bson-keys.c bson-md5.c bson-memory.c bson-oid.c bson-reader.c bson-string.c bson-timegm.c bson-utf8.c bson-value.c bson-version-functions.c bson-writer.c"
Expand Down
27 changes: 25 additions & 2 deletions config.w32
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,29 @@ function mongodb_generate_header(inpath, outpath, replacements)
outfile.Close();
}

/* TODO: Consolidate these parsing functions once the libbson and libmongoc
* substitutions become consistent again. */
function mongodb_parse_libbson_version_file(inpath)
{
var infile = FSO.OpenTextFile(inpath, 1);
var version = infile.ReadLine();
infile.Close();

var prefix = "libbson_";
var xyz_pre = version.split("-");
var xyz = xyz_pre[0].split(".");
var pre = xyz_pre.length > 1 ? xyz_pre[1] : "";

var replacements = {};
replacements[prefix + "VERSION_FULL"] = version;
replacements[prefix + "VERSION_MAJOR"] = xyz[0];
replacements[prefix + "VERSION_MINOR"] = xyz[1];
replacements[prefix + "VERSION_PATCH"] = xyz[2];
replacements[prefix + "VERSION_PRERELEASE"] = pre;

return replacements;
}

function mongodb_parse_version_file(inpath, prefix)
{
var infile = FSO.OpenTextFile(inpath, 1);
Expand Down Expand Up @@ -108,7 +131,7 @@ if (PHP_MONGODB != "no") {
var PHP_MONGODB_COMMON_SOURCES="common-b64.c common-md5.c common-thread.c"

// Generated with: find src/libmongoc/src/kms-message/src -maxdepth 1 -name '*.c' -print0 | cut -sz -d / -f 6- | sort -dz | tr '\000' ' '
var PHP_MONGODB_KMS_MESSAGE_SOURCES="hexlify.c kms_b64.c kms_caller_identity_request.c kms_crypto_apple.c kms_crypto_libcrypto.c kms_crypto_none.c kms_crypto_windows.c kms_decrypt_request.c kms_encrypt_request.c kms_kv_list.c kms_message.c kms_port.c kms_request.c kms_request_opt.c kms_request_str.c kms_response.c kms_response_parser.c sort.c";
var PHP_MONGODB_KMS_MESSAGE_SOURCES="hexlify.c kms_azure_request.c kms_b64.c kms_caller_identity_request.c kms_crypto_apple.c kms_crypto_libcrypto.c kms_crypto_none.c kms_crypto_windows.c kms_decrypt_request.c kms_encrypt_request.c kms_gcp_request.c kms_kmip_reader_writer.c kms_kmip_request.c kms_kmip_response.c kms_kmip_response_parser.c kms_kv_list.c kms_message.c kms_port.c kms_request.c kms_request_opt.c kms_request_str.c kms_response.c kms_response_parser.c sort.c";

// Generated with: find src/libmongoc/src/libbson/src/bson -name '*.c' -print0 | cut -sz -d / -f 7- | sort -dz | tr '\000' ' '
var PHP_MONGODB_BSON_SOURCES="bcon.c bson-atomic.c bson.c bson-clock.c bson-context.c bson-decimal128.c bson-error.c bson-iso8601.c bson-iter.c bson-json.c bson-keys.c bson-md5.c bson-memory.c bson-oid.c bson-reader.c bson-string.c bson-timegm.c bson-utf8.c bson-value.c bson-version-functions.c bson-writer.c";
Expand Down Expand Up @@ -170,7 +193,7 @@ if (PHP_MONGODB != "no") {
mongodb_generate_header(
configure_module_dirname + "/src/libmongoc/src/libbson/src/bson/bson-version.h.in",
configure_module_dirname + "/src/libmongoc/src/libbson/src/bson/bson-version.h",
mongodb_parse_version_file(configure_module_dirname + "/src/LIBMONGOC_VERSION_CURRENT", "BSON_")
mongodb_parse_libbson_version_file(configure_module_dirname + "/src/LIBMONGOC_VERSION_CURRENT")
);

var mongoc_opts = {
Expand Down
20 changes: 10 additions & 10 deletions scripts/autotools/libbson/Versions.m4
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
BSON_CURRENT_FILE=[]PHP_EXT_SRCDIR(mongodb)[/src/LIBMONGOC_VERSION_CURRENT]
BSON_VERSION=$(cat $BSON_CURRENT_FILE)
libbson_VERSION_FULL=$(cat $BSON_CURRENT_FILE)

dnl Ensure newline for "cut" implementations that need it, e.g. HP-UX.
BSON_MAJOR_VERSION=$( (cat $BSON_CURRENT_FILE; echo) | cut -d- -f1 | cut -d. -f1 )
BSON_MINOR_VERSION=$( (cat $BSON_CURRENT_FILE; echo) | cut -d- -f1 | cut -d. -f2 )
BSON_MICRO_VERSION=$( (cat $BSON_CURRENT_FILE; echo) | cut -d- -f1 | cut -d. -f3 )
BSON_PRERELEASE_VERSION=$(cut -s -d- -f2 $BSON_CURRENT_FILE)
libbson_VERSION_MAJOR=$( (cat $BSON_CURRENT_FILE; echo) | cut -d- -f1 | cut -d. -f1 )
libbson_VERSION_MINOR=$( (cat $BSON_CURRENT_FILE; echo) | cut -d- -f1 | cut -d. -f2 )
libbson_VERSION_PATCH=$( (cat $BSON_CURRENT_FILE; echo) | cut -d- -f1 | cut -d. -f3 )
libbson_VERSION_PRERELEASE=$(cut -s -d- -f2 $BSON_CURRENT_FILE)

AC_SUBST(BSON_VERSION)
AC_SUBST(BSON_MAJOR_VERSION)
AC_SUBST(BSON_MINOR_VERSION)
AC_SUBST(BSON_MICRO_VERSION)
AC_SUBST(BSON_PRERELEASE_VERSION)
AC_SUBST(libbson_VERSION_FULL)
AC_SUBST(libbson_VERSION_MAJOR)
AC_SUBST(libbson_VERSION_MINOR)
AC_SUBST(libbson_VERSION_PATCH)
AC_SUBST(libbson_VERSION_PRERELEASE)
2 changes: 1 addition & 1 deletion src/LIBMONGOC_VERSION_CURRENT
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.25.0-20230815+gitd933a8c996
1.25.0-20230922+git1c8da0ee19
2 changes: 1 addition & 1 deletion src/libmongoc
Submodule libmongoc updated 262 files