aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Schumacher <roschuma@microsoft.com>2017-04-05 17:57:55 -0700
committerRobert Schumacher <roschuma@microsoft.com>2017-04-05 17:57:55 -0700
commit4765c5853c45d7b0a8dde3f868b4d52fec984af4 (patch)
tree3a9462273f399ca606d1727523db53317e25704d
parentd03171d12212b6cc8c41b45b4b1443f7123d8bc9 (diff)
downloadvcpkg-4765c5853c45d7b0a8dde3f868b4d52fec984af4.tar.gz
vcpkg-4765c5853c45d7b0a8dde3f868b4d52fec984af4.zip
[libbson] Fix UWP builds. Suppress building static in DLL mode and vice-versa.
-rw-r--r--ports/libbson/CONTROL2
-rw-r--r--ports/libbson/fix-uwp.patch58
-rw-r--r--ports/libbson/portfile.cmake21
3 files changed, 72 insertions, 9 deletions
diff --git a/ports/libbson/CONTROL b/ports/libbson/CONTROL
index 371dfcf0c..1bf86bf74 100644
--- a/ports/libbson/CONTROL
+++ b/ports/libbson/CONTROL
@@ -1,3 +1,3 @@
Source: libbson
-Version: 1.5.1
+Version: 1.5.1-1
Description: libbson is a library providing useful routines related to building, parsing, and iterating BSON documents. \ No newline at end of file
diff --git a/ports/libbson/fix-uwp.patch b/ports/libbson/fix-uwp.patch
new file mode 100644
index 000000000..abe11f8a4
--- /dev/null
+++ b/ports/libbson/fix-uwp.patch
@@ -0,0 +1,58 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 553f13b..03dc546 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -194,6 +194,8 @@ set (HEADERS
+ ${SOURCE_DIR}/src/bson/bson-writer.h
+ )
+
++add_definitions(-D_CRT_SECURE_NO_WARNINGS)
++
+ add_library(bson_shared SHARED ${SOURCES} ${HEADERS})
+ add_library(bson_static STATIC ${SOURCES} ${HEADERS})
+
+@@ -272,8 +274,10 @@ if (ENABLE_TESTS)
+ DESTINATION ${PROJECT_BINARY_DIR}/tests)
+ endif () # ENABLE_TESTS
+
++set(INSTALL_TARGETS bson_shared bson_static CACHE INTERNAL "List of library targets to install")
++
+ install(
+- TARGETS bson_shared bson_static
++ TARGETS ${INSTALL_TARGETS}
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib
+ RUNTIME DESTINATION bin
+diff --git a/src/bson/bson-compat.h b/src/bson/bson-compat.h
+index 05fc614..e8e2214 100644
+--- a/src/bson/bson-compat.h
++++ b/src/bson/bson-compat.h
+@@ -39,11 +39,11 @@
+
+
+ #ifdef BSON_OS_WIN32
+-# if defined(_WIN32_WINNT) && (_WIN32_WINNT < 0x0600)
++# if defined(_WIN32_WINNT) && (_WIN32_WINNT < 0x0602)
+ # undef _WIN32_WINNT
+ # endif
+ # ifndef _WIN32_WINNT
+-# define _WIN32_WINNT 0x0600
++# define _WIN32_WINNT 0x0602
+ # endif
+ # ifndef NOMINMAX
+ # define NOMINMAX
+diff --git a/src/bson/bson-iso8601.c b/src/bson/bson-iso8601.c
+index 8beea90..cb4b531 100644
+--- a/src/bson/bson-iso8601.c
++++ b/src/bson/bson-iso8601.c
+@@ -117,8 +117,8 @@ _bson_iso8601_date_parse (const char *str,
+ const char *day_ptr;
+ const char *hour_ptr;
+ const char *min_ptr;
+- const char *sec_ptr;
+- const char *millis_ptr;
++ const char *sec_ptr = NULL;
++ const char *millis_ptr = NULL;
+ const char *tz_ptr;
+
+ int32_t year_len = 0;
diff --git a/ports/libbson/portfile.cmake b/ports/libbson/portfile.cmake
index 6116f1f8c..bcf66872d 100644
--- a/ports/libbson/portfile.cmake
+++ b/ports/libbson/portfile.cmake
@@ -8,10 +8,23 @@ vcpkg_download_distfile(ARCHIVE
)
vcpkg_extract_source_archive(${ARCHIVE})
+vcpkg_apply_patches(
+ SOURCE_PATH ${SOURCE_PATH}
+ PATCHES ${CMAKE_CURRENT_LIST_DIR}/fix-uwp.patch
+)
+
+if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
+ set(TARGET_TO_INSTALL bson_static)
+else()
+ set(TARGET_TO_INSTALL bson_shared)
+endif()
+
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
+ PREFER_NINJA
OPTIONS
-DENABLE_TESTS=OFF
+ -DINSTALL_TARGETS=${TARGET_TO_INSTALL}
)
vcpkg_install_cmake()
@@ -25,11 +38,6 @@ file(RENAME ${CURRENT_PACKAGES_DIR}/temp ${CURRENT_PACKAGES_DIR}/include)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
- file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/bin)
- file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin)
- file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/bson-1.0.lib)
- file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/bson-1.0.lib)
-
file(RENAME
${CURRENT_PACKAGES_DIR}/lib/bson-static-1.0.lib
${CURRENT_PACKAGES_DIR}/lib/bson-1.0.lib)
@@ -43,9 +51,6 @@ if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
PATCHES
${CMAKE_CURRENT_LIST_DIR}/static.patch
)
-else()
- file(REMOVE ${CURRENT_PACKAGES_DIR}/lib/bson-static-1.0.lib)
- file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/bson-static-1.0.lib)
endif()
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/libbson RENAME copyright) \ No newline at end of file