aboutsummaryrefslogtreecommitdiff
path: root/ports/libbson
diff options
context:
space:
mode:
authorBilly O'Neal <bion@microsoft.com>2021-09-08 11:56:06 -0700
committerGitHub <noreply@github.com>2021-09-08 11:56:06 -0700
commitcd54580d1fe7c60cdf6e086a7d61c013648f1eff (patch)
treeb63ac4c9725ae877e49dd8f2c1a03cbee48e9a21 /ports/libbson
parentbcf551b980380fe7f84fa302ad7ef3c184f9bf4f (diff)
downloadvcpkg-cd54580d1fe7c60cdf6e086a7d61c013648f1eff.tar.gz
vcpkg-cd54580d1fe7c60cdf6e086a7d61c013648f1eff.zip
[libbson, mongo-c-driver] Convert to vcpkg.json. (#20039)
* Fixes source writes rather than using DISABLE_PARALLEL_CONFIGURE * Fixes to use modern vcpkg helpers. * Fixes to install to the correct include path rather than moving the resulting includes after the fact. * Remove do-nothign renames. * Fixes to make static cmake configs find the correct bits.
Diffstat (limited to 'ports/libbson')
-rw-r--r--ports/libbson/CONTROL5
-rw-r--r--ports/libbson/disable-source-write.patch15
-rw-r--r--ports/libbson/fix-include-directory.patch13
-rw-r--r--ports/libbson/fix-static-cmake-2.patch13
-rw-r--r--ports/libbson/portfile.cmake78
-rw-r--r--ports/libbson/vcpkg.json17
6 files changed, 87 insertions, 54 deletions
diff --git a/ports/libbson/CONTROL b/ports/libbson/CONTROL
deleted file mode 100644
index c74336ee5..000000000
--- a/ports/libbson/CONTROL
+++ /dev/null
@@ -1,5 +0,0 @@
-Source: libbson
-Version: 1.16.1
-Port-Version: 2
-Description: libbson is a library providing useful routines related to building, parsing, and iterating BSON documents.
-Homepage: https://github.com/mongodb/libbson
diff --git a/ports/libbson/disable-source-write.patch b/ports/libbson/disable-source-write.patch
new file mode 100644
index 000000000..ff2f9cab5
--- /dev/null
+++ b/ports/libbson/disable-source-write.patch
@@ -0,0 +1,15 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 7ff8bbf..32c2e00 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -114,8 +114,8 @@ if (BUILD_VERSION STREQUAL "0.0.0")
+ file (WRITE ${PROJECT_SOURCE_DIR}/VERSION_CURRENT ${BUILD_VERSION})
+ endif ()
+ else ()
+- message ("storing BUILD_VERSION ${BUILD_VERSION} in file VERSION_CURRENT for later use")
+- file (WRITE ${PROJECT_SOURCE_DIR}/VERSION_CURRENT ${BUILD_VERSION})
++ #message ("storing BUILD_VERSION ${BUILD_VERSION} in file VERSION_CURRENT for later use")
++ #file (WRITE ${PROJECT_SOURCE_DIR}/VERSION_CURRENT ${BUILD_VERSION})
+ endif ()
+
+ include (LoadVersion)
diff --git a/ports/libbson/fix-include-directory.patch b/ports/libbson/fix-include-directory.patch
new file mode 100644
index 000000000..beead37bd
--- /dev/null
+++ b/ports/libbson/fix-include-directory.patch
@@ -0,0 +1,13 @@
+diff --git a/src/libbson/CMakeLists.txt b/src/libbson/CMakeLists.txt
+index d383424..cc633f6 100644
+--- a/src/libbson/CMakeLists.txt
++++ b/src/libbson/CMakeLists.txt
+@@ -326,7 +326,7 @@ if (ENABLE_EXAMPLES)
+ endif () # ENABLE_EXAMPLES
+
+ set (BSON_HEADER_INSTALL_DIR
+- "${CMAKE_INSTALL_INCLUDEDIR}/libbson-${BSON_API_VERSION}"
++ "${CMAKE_INSTALL_INCLUDEDIR}"
+ )
+
+ if (ENABLE_STATIC MATCHES "ON|AUTO")
diff --git a/ports/libbson/fix-static-cmake-2.patch b/ports/libbson/fix-static-cmake-2.patch
new file mode 100644
index 000000000..1a694a1bf
--- /dev/null
+++ b/ports/libbson/fix-static-cmake-2.patch
@@ -0,0 +1,13 @@
+diff --git a/src/libbson/build/cmake/libbson-static-1.0-config.cmake.in b/src/libbson/build/cmake/libbson-static-1.0-config.cmake.in
+index 92933fe..90eb16f 100644
+--- a/src/libbson/build/cmake/libbson-static-1.0-config.cmake.in
++++ b/src/libbson/build/cmake/libbson-static-1.0-config.cmake.in
+@@ -27,7 +27,7 @@ set_and_check (BSON_STATIC_INCLUDE_DIRS "@PACKAGE_INCLUDE_INSTALL_DIRS@")
+ # directory and the base name, but not the suffix, so we use CMake's
+ # find_library () to pick that up. Users can override this by configuring
+ # BSON_STATIC_LIBRARY themselves.
+-find_library (BSON_STATIC_LIBRARY bson-static-1.0 PATHS "@PACKAGE_LIBRARY_INSTALL_DIRS@" NO_DEFAULT_PATH)
++find_library (BSON_STATIC_LIBRARY bson-1.0 PATHS "@PACKAGE_LIBRARY_INSTALL_DIRS@" NO_DEFAULT_PATH)
+
+ set (BSON_STATIC_LIBRARIES ${BSON_STATIC_LIBRARY})
+
diff --git a/ports/libbson/portfile.cmake b/ports/libbson/portfile.cmake
index 7bd0bf8f7..eb534a260 100644
--- a/ports/libbson/portfile.cmake
+++ b/ports/libbson/portfile.cmake
@@ -8,24 +8,19 @@ vcpkg_from_github(
PATCHES
fix-uwp.patch
fix-static-cmake.patch
+ disable-source-write.patch
+ fix-include-directory.patch
+ fix-static-cmake-2.patch
)
-if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
- set(ENABLE_STATIC ON)
-else()
- set(ENABLE_STATIC OFF)
-endif()
-
-file(READ ${CMAKE_CURRENT_LIST_DIR}/CONTROL _contents)
-string(REGEX MATCH "\nVersion:[ ]*[^ \n]+" _contents "${_contents}")
-string(REGEX REPLACE ".+Version:[ ]*([\\.0-9]+).*" "\\1" BUILD_VERSION "${_contents}")
+string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" ENABLE_STATIC)
-file(WRITE "${BUILD_VERSION}" ${SOURCE_PATH}/VERSION_CURRENT)
+file(READ "${CMAKE_CURRENT_LIST_DIR}/vcpkg.json" _contents)
+string(JSON BUILD_VERSION GET "${_contents}" version)
+file(WRITE "${SOURCE_PATH}/VERSION_CURRENT" "${BUILD_VERSION}")
-vcpkg_configure_cmake(
- SOURCE_PATH ${SOURCE_PATH}
- PREFER_NINJA
- DISABLE_PARALLEL_CONFIGURE
+vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DENABLE_MONGOC=OFF
-DENABLE_BSON=ON
@@ -34,55 +29,40 @@ vcpkg_configure_cmake(
-DENABLE_STATIC=${ENABLE_STATIC}
-DBUILD_VERSION=${BUILD_VERSION}
-DCMAKE_DISABLE_FIND_PACKAGE_PythonInterp=ON
+ MAYBE_UNUSED_VARIABLES
+ CMAKE_DISABLE_FIND_PACKAGE_PythonInterp
)
-vcpkg_install_cmake()
+vcpkg_cmake_install()
vcpkg_copy_pdbs()
-set(PORT_POSTFIX "1.0")
-
if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
- vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/libbson-static-${PORT_POSTFIX} TARGET_PATH share/libbson-${PORT_POSTFIX})
+ vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/libbson-static-1.0" PACKAGE_NAME "libbson-1.0")
else()
- vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/libbson-${PORT_POSTFIX} TARGET_PATH share/libbson-${PORT_POSTFIX})
+ vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/libbson-1.0" PACKAGE_NAME "libbson-1.0")
endif()
-file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
-file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/share/mongo-c-driver)
-
-# This rename is needed because the official examples expect to use #include <bson.h>
-# See Microsoft/vcpkg#904
-file(RENAME
- ${CURRENT_PACKAGES_DIR}/include/libbson-${PORT_POSTFIX}
- ${CURRENT_PACKAGES_DIR}/temp)
-file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/include)
-file(RENAME ${CURRENT_PACKAGES_DIR}/temp ${CURRENT_PACKAGES_DIR}/include)
-
-file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/share/mongo-c-driver")
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
# drop the __declspec(dllimport) when building static
- vcpkg_replace_string(${CURRENT_PACKAGES_DIR}/include/bson/bson-macros.h
+ vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/bson/bson-macros.h"
"define BSON_API __declspec(dllimport)" "define BSON_API")
-
- file(RENAME ${CURRENT_PACKAGES_DIR}/share/libbson-${PORT_POSTFIX}/libbson-static-${PORT_POSTFIX}-config.cmake
- ${CURRENT_PACKAGES_DIR}/share/libbson-${PORT_POSTFIX}/libbson-${PORT_POSTFIX}-config.cmake)
- file(RENAME ${CURRENT_PACKAGES_DIR}/share/libbson-${PORT_POSTFIX}/libbson-static-${PORT_POSTFIX}-config-version.cmake
- ${CURRENT_PACKAGES_DIR}/share/libbson-${PORT_POSTFIX}/libbson-${PORT_POSTFIX}-config-version.cmake)
- file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin ${CURRENT_PACKAGES_DIR}/bin)
-else()
- file(RENAME ${CURRENT_PACKAGES_DIR}/share/libbson-${PORT_POSTFIX}/libbson-${PORT_POSTFIX}-config.cmake
- ${CURRENT_PACKAGES_DIR}/share/libbson-${PORT_POSTFIX}/libbson-${PORT_POSTFIX}-config.cmake)
- file(RENAME ${CURRENT_PACKAGES_DIR}/share/libbson-${PORT_POSTFIX}/libbson-${PORT_POSTFIX}-config-version.cmake
- ${CURRENT_PACKAGES_DIR}/share/libbson-${PORT_POSTFIX}/libbson-${PORT_POSTFIX}-config-version.cmake)
-endif()
+ file(RENAME
+ "${CURRENT_PACKAGES_DIR}/share/libbson-1.0/libbson-static-1.0-config.cmake"
+ "${CURRENT_PACKAGES_DIR}/share/libbson-1.0/libbson-1.0-config.cmake")
+ file(RENAME
+ "${CURRENT_PACKAGES_DIR}/share/libbson-1.0/libbson-static-1.0-config-version.cmake"
+ "${CURRENT_PACKAGES_DIR}/share/libbson-1.0/libbson-1.0-config-version.cmake")
-vcpkg_replace_string(${CURRENT_PACKAGES_DIR}/share/libbson-1.0/libbson-1.0-config.cmake
- "include/libbson-1.0" "include/")
+ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/bin" "${CURRENT_PACKAGES_DIR}/bin")
+endif()
-file(COPY ${SOURCE_PATH}/THIRD_PARTY_NOTICES DESTINATION ${CURRENT_PACKAGES_DIR}/share/libbson)
+file(COPY "${SOURCE_PATH}/THIRD_PARTY_NOTICES" DESTINATION "${CURRENT_PACKAGES_DIR}/share/libbson")
-file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
-file(INSTALL ${CURRENT_PORT_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
+file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
+file(INSTALL "${CURRENT_PORT_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
diff --git a/ports/libbson/vcpkg.json b/ports/libbson/vcpkg.json
new file mode 100644
index 000000000..c9ab96124
--- /dev/null
+++ b/ports/libbson/vcpkg.json
@@ -0,0 +1,17 @@
+{
+ "name": "libbson",
+ "version": "1.16.1",
+ "port-version": 3,
+ "description": "libbson is a library providing useful routines related to building, parsing, and iterating BSON documents.",
+ "homepage": "https://github.com/mongodb/libbson",
+ "dependencies": [
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ },
+ {
+ "name": "vcpkg-cmake-config",
+ "host": true
+ }
+ ]
+}