diff options
| author | Robert Schumacher <roschuma@microsoft.com> | 2017-04-06 16:42:22 -0700 |
|---|---|---|
| committer | Robert Schumacher <roschuma@microsoft.com> | 2017-04-06 16:42:22 -0700 |
| commit | 0163b19e32f07ec8964fa89f9ceb522c3a45b4ec (patch) | |
| tree | 3a02e9c7e8664075a827d74fe3f583bdfb0f70ce | |
| parent | 3839b44d18ed56bbc44ae89d61c7ce159bf2b6d5 (diff) | |
| download | vcpkg-0163b19e32f07ec8964fa89f9ceb522c3a45b4ec.tar.gz vcpkg-0163b19e32f07ec8964fa89f9ceb522c3a45b4ec.zip | |
[mongo-c-driver] Fix UWP builds. Deploy THIRD_PARTY_NOTICES.
| -rw-r--r-- | ports/mongo-c-driver/CONTROL | 4 | ||||
| -rw-r--r-- | ports/mongo-c-driver/fix-uwp.patch | 44 | ||||
| -rw-r--r-- | ports/mongo-c-driver/portfile.cmake | 14 |
3 files changed, 59 insertions, 3 deletions
diff --git a/ports/mongo-c-driver/CONTROL b/ports/mongo-c-driver/CONTROL index c77352848..f509493ee 100644 --- a/ports/mongo-c-driver/CONTROL +++ b/ports/mongo-c-driver/CONTROL @@ -1,4 +1,4 @@ Source: mongo-c-driver -Version: 1.5.1 -Build-Depends: libbson +Version: 1.5.1-1 +Build-Depends: libbson, openssl [uwp] Description: Client library written in C for MongoDB.
\ No newline at end of file diff --git a/ports/mongo-c-driver/fix-uwp.patch b/ports/mongo-c-driver/fix-uwp.patch new file mode 100644 index 000000000..13c0a2299 --- /dev/null +++ b/ports/mongo-c-driver/fix-uwp.patch @@ -0,0 +1,44 @@ +diff --git a/src/mongoc/mongoc-gridfs-file.c b/src/mongoc/mongoc-gridfs-file.c +index 5beb610..7e74ff7 100644 +--- a/src/mongoc/mongoc-gridfs-file.c ++++ b/src/mongoc/mongoc-gridfs-file.c +@@ -734,7 +734,7 @@ _mongoc_gridfs_file_refresh_page (mongoc_gridfs_file_t *file) + bson_t query; + bson_t child; + bson_t opts; +- const bson_t *chunk; ++ const bson_t *chunk = 0; + const char *key; + bson_iter_t iter; + int64_t existing_chunks; +diff --git a/src/mongoc/mongoc-handshake.c b/src/mongoc/mongoc-handshake.c +index 4e181bd..b274fc1 100644 +--- a/src/mongoc/mongoc-handshake.c ++++ b/src/mongoc/mongoc-handshake.c +@@ -195,7 +195,8 @@ _get_os_version (void) + char *ret = bson_malloc (HANDSHAKE_OS_VERSION_MAX); + bool found = false; + +-#ifdef _WIN32 ++#if defined (WINAPI_FAMILY_PARTITION) && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM) ++#elif defined (_WIN32) + OSVERSIONINFO osvi; + ZeroMemory (&osvi, sizeof (OSVERSIONINFO)); + osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFO); +diff --git a/src/mongoc/mongoc-util.c b/src/mongoc/mongoc-util.c +index 6dbb26d..7f33780 100644 +--- a/src/mongoc/mongoc-util.c ++++ b/src/mongoc/mongoc-util.c +@@ -46,7 +46,11 @@ _mongoc_hex_md5 (const char *input) + void + _mongoc_usleep (int64_t usec) + { +-#ifdef _WIN32 ++#if defined (WINAPI_FAMILY_PARTITION) && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM) ++ if (usec / 1000 > MAXDWORD || usec < 0) ++ __fastfail(-1); ++ Sleep((DWORD)(usec / 1000)); ++#elif defined(_WIN32) + LARGE_INTEGER ft; + HANDLE timer; + diff --git a/ports/mongo-c-driver/portfile.cmake b/ports/mongo-c-driver/portfile.cmake index 0db81f8d3..0cdb9611b 100644 --- a/ports/mongo-c-driver/portfile.cmake +++ b/ports/mongo-c-driver/portfile.cmake @@ -12,18 +12,27 @@ vcpkg_apply_patches( SOURCE_PATH ${SOURCE_PATH}
PATCHES
${CMAKE_CURRENT_LIST_DIR}/bson.patch
+ ${CMAKE_CURRENT_LIST_DIR}/fix-uwp.patch
)
+set(ENABLE_SSL "WINDOWS")
+if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
+ set(ENABLE_SSL "OPENSSL")
+endif()
+
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS
-DBSON_ROOT_DIR=${CURRENT_INSTALLED_DIR}
-DENABLE_TESTS=OFF
-DENABLE_EXAMPLES=OFF
+ -DENABLE_SSL=${ENABLE_SSL}
)
vcpkg_install_cmake()
+# This rename is needed because the official examples expect to use #include <mongoc.h>
+# See Microsoft/vcpkg#904
file(RENAME
${CURRENT_PACKAGES_DIR}/include/libmongoc-1.0
${CURRENT_PACKAGES_DIR}/temp)
@@ -49,4 +58,7 @@ else() file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/mongoc-static-1.0.lib)
endif()
-file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/mongo-c-driver RENAME copyright)
\ No newline at end of file +file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/mongo-c-driver RENAME copyright)
+file(COPY ${SOURCE_PATH}/THIRD_PARTY_NOTICES DESTINATION ${CURRENT_PACKAGES_DIR}/share/mongo-c-driver)
+
+vcpkg_copy_pdbs()
|
