Skip to content
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

[bond]Upgrade version to 8.1.0 and add Linux support. #6954

Merged
merged 1 commit into from
Jun 20, 2019
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
12 changes: 0 additions & 12 deletions ports/bond/0002_omit_rapidjson.patch

This file was deleted.

2 changes: 1 addition & 1 deletion ports/bond/CONTROL
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Source: bond
Maintainer: bond@microsoft.com
Version: 7.0.2-2
Version: 8.1.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.
Homepage: https://github.com/Microsoft/bond
Build-Depends: rapidjson, boost-config, boost-utility, boost-assign
56 changes: 56 additions & 0 deletions ports/bond/fix-install-path.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f2f8eaa..1b0c01c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -18,7 +18,7 @@ set (BOND_FIND_RAPIDJSON
# settings so that we don't apply our settings to third-party code.
add_subdirectory (thirdparty)

-enable_testing()
+#enable_testing()

set (BOND_IDL ${CMAKE_CURRENT_SOURCE_DIR}/idl)
set (BOND_INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/cpp/inc)
@@ -80,6 +80,6 @@ if (BOND_GBC_PATH)

install (
FILES ${BOND_GBC_PATH}
- DESTINATION bin
+ DESTINATION tools
RENAME ${INSTALLED_GBC_NAME})
endif()
diff --git a/compiler/CMakeLists.txt b/compiler/CMakeLists.txt
index 1dff9d0..9a11575 100644
--- a/compiler/CMakeLists.txt
+++ b/compiler/CMakeLists.txt
@@ -108,7 +108,7 @@ set (test_sources
tests/TestMain.hs
${tests})

-set (completion_dir etc/bash_completion.d)
+set (completion_dir tools/bond)
set (completion ${CMAKE_CURRENT_BINARY_DIR}/gbc.comp)
set (output ${CMAKE_CURRENT_BINARY_DIR}/build/gbc/gbc${CMAKE_EXECUTABLE_SUFFIX})
set (GBC_EXECUTABLE ${output} PARENT_SCOPE)
@@ -130,7 +130,7 @@ endif()

install (FILES ${output}
PERMISSIONS OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE
- DESTINATION bin)
+ DESTINATION ${completion_dir})

install (FILES ${completion}
RENAME gbc
diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt
index b45078e..1eebe9c 100644
--- a/cpp/CMakeLists.txt
+++ b/cpp/CMakeLists.txt
@@ -110,7 +110,7 @@ target_include_directories (bond_apply BEFORE PRIVATE

install (TARGETS bond bond_apply
EXPORT bond
- ARCHIVE DESTINATION lib/bond
+ ARCHIVE DESTINATION lib
INCLUDES DESTINATION include)

install (DIRECTORY ${BOND_IDL}/bond/core DESTINATION include/bond)
91 changes: 43 additions & 48 deletions ports/bond/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,77 +4,72 @@ vcpkg_check_linkage(ONLY_STATIC_LIBRARY)

set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/bond-7.0.2)

vcpkg_download_distfile(ARCHIVE
URLS "https://github.com/Microsoft/bond/archive/7.0.2.zip"
FILENAME "bond-7.0.2.zip"
SHA512 4ae3b88fafbede6c1433d171713bdbfcbed61a3d2a983d7df4e33af893a50f233be0e95c1ea8e5f30dafb017b2a8100a23721292b04184159e5fd796b1a43398
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO microsoft/bond
REF 8.1.0
SHA512 287a2d299036b57e0576903b1f5372bf8071243ada57153c4bf231cdc660faab1e70c60ddde57ac759d941b74af4ba25d81a5d58e8dbf391032b7b226c4cd18c
HEAD_REF master
PATCHES fix-install-path.patch
)
vcpkg_download_distfile(GBC_ARCHIVE
URLS "https://github.com/Microsoft/bond/releases/download/7.0.2/gbc-7.0.2-amd64.exe.zip"
FILENAME "gbc-7.0.2-amd64.exe.zip"
SHA512 069eafd7641ebd719425037cb8249d2d214eb09c6ce38fbf1d1811c01d1839b0a0987c55217075b6ae9f477f750d582250134387a530edb2aee407b21d973915
)

vcpkg_extract_source_archive(${ARCHIVE})

# Extract the precompiled gbc
vcpkg_extract_source_archive(${GBC_ARCHIVE} ${CURRENT_BUILDTREES_DIR}/tools/)
set(FETCHED_GBC_PATH ${CURRENT_BUILDTREES_DIR}/tools/gbc-7.0.2-amd64.exe)
if (NOT VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "windows" OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
vcpkg_download_distfile(GBC_ARCHIVE
URLS "https://github.com/microsoft/bond/releases/download/8.1.0/gbc-8.1.0-amd64.zip"
FILENAME "gbc-8.1.0-amd64.zip"
SHA512 896c9a78fc714e0ea44c37ed36400ec8e5f52d495a8d81aa80834ff6cd6303c7c94e06129f7b2269416a9e0ffb61423e87406db798fb5be7ff00f14981530089
)

# Extract the precompiled gbc
vcpkg_extract_source_archive(${GBC_ARCHIVE} ${CURRENT_BUILDTREES_DIR}/tools/)
set(FETCHED_GBC_PATH ${CURRENT_BUILDTREES_DIR}/tools/gbc.exe)

if (NOT EXISTS "${FETCHED_GBC_PATH}")
message(FATAL_ERROR "Fetching GBC failed. Expected '${FETCHED_GBC_PATH}' to exists, but it doesn't.")
if (NOT EXISTS "${FETCHED_GBC_PATH}")
message(FATAL_ERROR "Fetching GBC failed. Expected '${FETCHED_GBC_PATH}' to exists, but it doesn't.")
endif()

else()
message(STATUS "Installing stack...")
vcpkg_download_distfile(
ARCHIVE
URLS "https://get.haskellstack.org/"
FILENAME "stack-install.sh"
SHA512 6db2008297416ad856aa498908bf695737cf3cc466440397720a458358e9661d07abdba762662080ee8bbd8171cdcb05eec6d3696382575c099adfb8427e05fd
)

set(BASH /bin/bash)

vcpkg_execute_required_process(
COMMAND ${BASH} --noprofile --norc "${ARCHIVE}" -f
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}
LOGNAME install-stack
)

endif()

vcpkg_apply_patches(
SOURCE_PATH ${SOURCE_PATH}
PATCHES
# Don't install rapidjson from the (empty) submodule. With vcpkg, we get
# rapidjson from vcpkg
${CMAKE_CURRENT_LIST_DIR}/0002_omit_rapidjson.patch
)

vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
-DBOND_LIBRARIES_ONLY=TRUE
-DBOND_GBC_PATH=${FETCHED_GBC_PATH}
-DBOND_SKIP_GBC_TESTS=TRUE
-DBOND_ENABLE_COMM=FALSE
-DBOND_ENABLE_GRPC=FALSE
-DBOND_FIND_RAPIDJSON=TRUE
)

vcpkg_install_cmake()

vcpkg_fixup_cmake_targets(CONFIG_PATH lib/bond TARGET_PATH share/bond)

# Put the license file where vcpkg expects it
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)

# Drop a copy of gbc in tools/ so that it can be used
file(COPY ${CURRENT_PACKAGES_DIR}/bin/gbc.exe DESTINATION ${CURRENT_PACKAGES_DIR}/tools/)

# vcpkg doesn't--as of version 0.0.30--like executables such as gbc.exe in
# 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.
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)

# Bond's install target installs to lib/bond, but vcpkg expects the lib
# files to end up in lib/, so move them up a directory.
file(RENAME
${CURRENT_PACKAGES_DIR}/lib/bond/bond.lib
${CURRENT_PACKAGES_DIR}/lib/bond.lib)
file(RENAME
${CURRENT_PACKAGES_DIR}/lib/bond/bond_apply.lib
${CURRENT_PACKAGES_DIR}/lib/bond_apply.lib)
file(RENAME
${CURRENT_PACKAGES_DIR}/debug/lib/bond/bond.lib
${CURRENT_PACKAGES_DIR}/debug/lib/bond.lib)
file(RENAME
${CURRENT_PACKAGES_DIR}/debug/lib/bond/bond_apply.lib
${CURRENT_PACKAGES_DIR}/debug/lib/bond_apply.lib)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)

vcpkg_copy_pdbs()