From f533327462074bb386244227d5cc57902ddb4b7d Mon Sep 17 00:00:00 2001 From: curoky Date: Sat, 1 Aug 2020 02:10:00 +0800 Subject: [PATCH] [brpc] Add new port (#11524) * [brpc] add new port * [brpc] ci ignore build error on windows * [brpc] update version and delete deprecated function * [brpc] fail install on windows Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com> * [brpc] not support windows Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com> * Update portfile.cmake Update the format and remove unused comments * [brpc] rebase master * [brpc] reset ci.baseline.txt Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com> --- ports/brpc/CONTROL | 6 ++++++ ports/brpc/fix_boost_ptr.patch | 14 ++++++++++++++ ports/brpc/fix_thrift.patch | 28 ++++++++++++++++++++++++++++ ports/brpc/portfile.cmake | 31 +++++++++++++++++++++++++++++++ 4 files changed, 79 insertions(+) create mode 100644 ports/brpc/CONTROL create mode 100644 ports/brpc/fix_boost_ptr.patch create mode 100644 ports/brpc/fix_thrift.patch create mode 100644 ports/brpc/portfile.cmake diff --git a/ports/brpc/CONTROL b/ports/brpc/CONTROL new file mode 100644 index 0000000000..3986069813 --- /dev/null +++ b/ports/brpc/CONTROL @@ -0,0 +1,6 @@ +Source: brpc +Version: 0.9.7 +Homepage: https://github.com/apache/incubator-brpc +Description: Industrial-grade RPC framework used throughout Baidu, with 1,000,000+ instances and thousands kinds of services, called "baidu-rpc" inside Baidu. +Build-Depends: leveldb, gflags, glog, protobuf[zlib], openssl, thrift +Supports: !windows diff --git a/ports/brpc/fix_boost_ptr.patch b/ports/brpc/fix_boost_ptr.patch new file mode 100644 index 0000000000..4ced79422b --- /dev/null +++ b/ports/brpc/fix_boost_ptr.patch @@ -0,0 +1,14 @@ +diff --git a/src/brpc/policy/thrift_protocol.cpp b/src/brpc/policy/thrift_protocol.cpp +index eae081a0..39c92338 100755 +--- a/src/brpc/policy/thrift_protocol.cpp ++++ b/src/brpc/policy/thrift_protocol.cpp +@@ -45,8 +45,7 @@ + #if defined(_THRIFT_STDCXX_H_) + # define THRIFT_STDCXX apache::thrift::stdcxx + #else +- # define THRIFT_STDCXX boost +- # include ++ # define THRIFT_STDCXX std + #endif + #endif + diff --git a/ports/brpc/fix_thrift.patch b/ports/brpc/fix_thrift.patch new file mode 100644 index 0000000000..699f42fb0a --- /dev/null +++ b/ports/brpc/fix_thrift.patch @@ -0,0 +1,28 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 3deb7342..737f6a70 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -62,8 +62,10 @@ if(WITH_DEBUG_SYMBOLS) + endif() + + if(WITH_THRIFT) ++ find_package(Thrift CONFIG REQUIRED) ++ # target_link_libraries(main PRIVATE thrift::thrift thriftz::thriftz thriftnb::thriftnb) + set(THRIFT_CPP_FLAG "-DENABLE_THRIFT_FRAMED_PROTOCOL") +- set(THRIFT_LIB "thrift") ++ set(THRIFT_LIB "thrift::thrift") + endif() + + include(GNUInstallDirs) +@@ -196,9 +198,10 @@ set(DYNAMIC_LIB + ${LEVELDB_LIB} + ${PROTOC_LIB} + ${CMAKE_THREAD_LIBS_INIT} ++ ${OPENSSL_CRYPTO_LIBRARY} ++ ${OPENSSL_SSL_LIBRARY} + ${THRIFT_LIB} + ${THRIFTNB_LIB} +- ${OPENSSL_CRYPTO_LIBRARY} + dl + z) + diff --git a/ports/brpc/portfile.cmake b/ports/brpc/portfile.cmake new file mode 100644 index 0000000000..3a1c1dce73 --- /dev/null +++ b/ports/brpc/portfile.cmake @@ -0,0 +1,31 @@ +vcpkg_fail_port_install(ON_TARGET "windows") + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO apache/incubator-brpc + REF 1d6510aa50075cade5ed539ee09a11a1b8d7f990 # 0.9.7 + SHA512 9c9dbe2a202e58586010c56634bd371f6a9e3ff0d8c5341abbabd1f1dd204a3aec5e89061fa326b4fc8ae7202f9fc33f93a5acd845d18dab3915a3e2b81cbaf3 + HEAD_REF master + PATCHES + fix_boost_ptr.patch + fix_thrift.patch +) + +vcpkg_configure_cmake( + SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA + OPTIONS + -DWITH_THRIFT=ON + -DWITH_MESALINK=OFF + -DWITH_GLOG=ON +) + +vcpkg_install_cmake() + +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) +file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share) +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/include/butil/third_party/superfasthash") + +vcpkg_copy_pdbs() + +file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)