From 6af35363b8c9c768fe6c298605b1647a522229b2 Mon Sep 17 00:00:00 2001 From: Christopher Warrington Date: Wed, 8 Feb 2017 19:34:55 -0800 Subject: [PATCH] Upgrade Bond to 5.2.0 * Make Bond always build as a static lib. * Bond's CMake currently isn't written to be able to produce DLLs. There's a special dllimport/dllexport dance that would need to be done. * Apply patch so that Bond doesn't force Boost static libs. * Apply patch to omit installing Bond's copy of rapidjson. * Clean up empty bin/ directories, now that vcpkg is more strict. --- ports/bond/0001_boost_static_libs.patch | 23 +++++++++++++++ ports/bond/0002_omit_rapidjson.patch | 12 ++++++++ ports/bond/CONTROL | 2 +- ports/bond/portfile.cmake | 37 +++++++++++++++++-------- 4 files changed, 61 insertions(+), 13 deletions(-) create mode 100644 ports/bond/0001_boost_static_libs.patch create mode 100644 ports/bond/0002_omit_rapidjson.patch diff --git a/ports/bond/0001_boost_static_libs.patch b/ports/bond/0001_boost_static_libs.patch new file mode 100644 index 000000000..cc712b6c7 --- /dev/null +++ b/ports/bond/0001_boost_static_libs.patch @@ -0,0 +1,23 @@ +diff --git a/cmake/Config.cmake b/cmake/Config.cmake +index ed225d14..1573c915 100644 +--- a/cmake/Config.cmake ++++ b/cmake/Config.cmake +@@ -19,7 +19,7 @@ if (MSVC) + # disable MSVC warnings + add_compile_options (/bigobj /FIbond/core/warning.h /W4 /WX) + add_definitions (-D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS) +- set (Boost_USE_STATIC_LIBS ON) ++ set (Boost_USE_STATIC_LIBS OFF) + endif (MSVC) + + if (WIN32) +@@ -90,9 +90,6 @@ if (DEFINED ENV{APPVEYOR} AND ("$ENV{BOND_BUILD}" STREQUAL "C++")) + endif() + endif() + +-# disable Boost auto-linking +-add_definitions (-DBOOST_ALL_NO_LIB) +- + # VS2015U2 fixed a bug with atomics and emits a warning without this definition. + add_definitions (-D_ENABLE_ATOMIC_ALIGNMENT_FIX) + diff --git a/ports/bond/0002_omit_rapidjson.patch b/ports/bond/0002_omit_rapidjson.patch new file mode 100644 index 000000000..3e4a0571b --- /dev/null +++ b/ports/bond/0002_omit_rapidjson.patch @@ -0,0 +1,12 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 0d743da4..92f91103 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -39,7 +39,6 @@ install (DIRECTORY + cpp/inc/bond + cpp/generated/bond + python/inc/bond +- thirdparty/rapidjson/include/rapidjson + DESTINATION include + PATTERN *.cpp EXCLUDE) + diff --git a/ports/bond/CONTROL b/ports/bond/CONTROL index 70384f020..0e804025a 100644 --- a/ports/bond/CONTROL +++ b/ports/bond/CONTROL @@ -1,5 +1,5 @@ Source: bond Maintainer: bond@microsoft.com -Version: 5.0.0-4-g53ea136 +Version: 5.2.0 Description: Bond is a cross-platform framework for working with schematized data. It supports cross-language de/serialization and powerful generic mechanisms for efficiently manipulating data. Bond is broadly used at Microsoft in high scale services. Build-Depends: boost, rapidjson diff --git a/ports/bond/portfile.cmake b/ports/bond/portfile.cmake index 8dbf7cf53..0225a263f 100644 --- a/ports/bond/portfile.cmake +++ b/ports/bond/portfile.cmake @@ -1,16 +1,29 @@ -if (VCPKG_LIBRARY_LINKAGE STREQUAL static) - message(STATUS "Warning: Static building not supported yet. Building dynamic.") - set(VCPKG_LIBRARY_LINKAGE dynamic) +if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic) + message(STATUS "Warning: Dynamic building not supported yet. Building static.") + set(VCPKG_LIBRARY_LINKAGE static) endif() + include(vcpkg_common_functions) -set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/bond-53ea13692925bee4ba494ee9de3614f15c09d85d) +set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/bond-5.2.0) vcpkg_download_distfile(ARCHIVE - URLS "https://github.com/Microsoft/bond/archive/53ea13692925bee4ba494ee9de3614f15c09d85d.zip" - FILENAME "bond-5.0.0-4-g53ea136.zip" - SHA512 fe39dc211f6b99cba3f2284d78a524305dfb8dcd1f597639c45625df369f96c3321cb6782fef9eb34d34fab69c8da9015024eee34be6d0a76d730729517183da -) + URLS "https://github.com/Microsoft/bond/archive/5.2.0.zip" + FILENAME "bond-5.2.0.zip" + SHA512 bc533d9e7431d0690b555aa4a42ca947f8025fc388f698c40cfeacf4286892ac5fd86d93df187009d4791e3eae240eb60886947cfe600838c6058274eb4d625c + ) + vcpkg_extract_source_archive(${ARCHIVE}) +vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH} + PATCHES + # Change Boost_USE_STATIC_LIBS to be compatible with vcpkg's treatment + # of Boost + ${CMAKE_CURRENT_LIST_DIR}/0001_boost_static_libs.patch + # Don't install rapidjson from the (empty) submodule. With vcpkg, we get + # rapidjson from vcpkg + ${CMAKE_CURRENT_LIST_DIR}/0002_omit_rapidjson.patch +) + # To build Bond, you'll either need to have the Haskell toolchain installed # or set the environment variable BOND_GBC_PATH to point to a directory that # contains a pre-compiled version of gbc.exe. @@ -35,10 +48,10 @@ file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/bond) file(RENAME ${CURRENT_PACKAGES_DIR}/share/bond/LICENSE ${CURRENT_PACKAGES_DIR}/share/bond/copyright) # vcpkg doesn't--as of version 0.0.30--like executables such as gbc.exe in -# the output. Just delete it for now. -file(REMOVE - ${CURRENT_PACKAGES_DIR}/bin/gbc.exe - ${CURRENT_PACKAGES_DIR}/debug/bin/gbc.exe) +# the output. Just delete the bin/ directories for now. +file(REMOVE_RECURSE + ${CURRENT_PACKAGES_DIR}/bin/ + ${CURRENT_PACKAGES_DIR}/debug/bin/) # There's no way to supress installation of the headers in the debug build, # so we just delete them.