From 3421320c83f58d8314c422f67f0b3ce17657c688 Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Mon, 12 Mar 2018 00:37:53 -0700 Subject: [evpp] Fix build and use external rapidjson --- ports/evpp/CONTROL | 4 +- ports/evpp/fix-rapidjson-1-1.patch | 159 +++++++++++++++++++++++++++++++++++++ ports/evpp/portfile.cmake | 7 ++ 3 files changed, 168 insertions(+), 2 deletions(-) create mode 100644 ports/evpp/fix-rapidjson-1-1.patch diff --git a/ports/evpp/CONTROL b/ports/evpp/CONTROL index 163052ae0..0c4f238f9 100644 --- a/ports/evpp/CONTROL +++ b/ports/evpp/CONTROL @@ -1,4 +1,4 @@ Source: evpp -Version: 0.6.1-1 +Version: 0.6.1-2 Description: A modern C++ network library based on libevent for developing high performance network services in TCP/UDP/HTTP protocols. -Build-Depends: glog, libevent +Build-Depends: glog, libevent, rapidjson diff --git a/ports/evpp/fix-rapidjson-1-1.patch b/ports/evpp/fix-rapidjson-1-1.patch new file mode 100644 index 000000000..1dda0b895 --- /dev/null +++ b/ports/evpp/fix-rapidjson-1-1.patch @@ -0,0 +1,159 @@ +diff --git a/3rdparty/libhashkit/crc32.c b/3rdparty/libhashkit/crc32.c +index 6db0478..ff34194 100644 +--- a/3rdparty/libhashkit/crc32.c ++++ b/3rdparty/libhashkit/crc32.c +@@ -73,7 +73,7 @@ static const uint32_t crc32tab[256] = { + 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d, + }; + +-uint32_t hashkit_crc32(const char *key, size_t key_length, void *context __attribute__((unused))) ++uint32_t hashkit_crc32(const char *key, size_t key_length, void * context) + { + uint64_t x; + uint32_t crc= UINT32_MAX; +diff --git a/3rdparty/libhashkit/fnv.c b/3rdparty/libhashkit/fnv.c +index ee3754d..d79fe39 100644 +--- a/3rdparty/libhashkit/fnv.c ++++ b/3rdparty/libhashkit/fnv.c +@@ -14,7 +14,7 @@ static uint64_t FNV_64_PRIME= UINT64_C(0x100000001b3); + static uint32_t FNV_32_INIT= 2166136261UL; + static uint32_t FNV_32_PRIME= 16777619; + +-uint32_t hashkit_fnv1_64(const char *key, size_t key_length, void *context __attribute__((unused))) ++uint32_t hashkit_fnv1_64(const char *key, size_t key_length, void * context) + { + /* Thanks to pierre@demartines.com for the pointer */ + uint64_t hash= FNV_64_INIT; +@@ -28,7 +28,7 @@ uint32_t hashkit_fnv1_64(const char *key, size_t key_length, void *context __att + return (uint32_t)hash; + } + +-uint32_t hashkit_fnv1a_64(const char *key, size_t key_length, void *context __attribute__((unused))) ++uint32_t hashkit_fnv1a_64(const char *key, size_t key_length, void * context) + { + uint32_t hash= (uint32_t) FNV_64_INIT; + +@@ -42,7 +42,7 @@ uint32_t hashkit_fnv1a_64(const char *key, size_t key_length, void *context __at + return hash; + } + +-uint32_t hashkit_fnv1_32(const char *key, size_t key_length, void *context __attribute__((unused))) ++uint32_t hashkit_fnv1_32(const char *key, size_t key_length, void * context) + { + uint32_t hash= FNV_32_INIT; + +@@ -56,7 +56,7 @@ uint32_t hashkit_fnv1_32(const char *key, size_t key_length, void *context __att + return hash; + } + +-uint32_t hashkit_fnv1a_32(const char *key, size_t key_length, void *context __attribute__((unused))) ++uint32_t hashkit_fnv1a_32(const char *key, size_t key_length, void * context) + { + uint32_t hash= FNV_32_INIT; + +diff --git a/3rdparty/libhashkit/hsieh.c b/3rdparty/libhashkit/hsieh.c +index ba46ed2..c3e9a38 100644 +--- a/3rdparty/libhashkit/hsieh.c ++++ b/3rdparty/libhashkit/hsieh.c +@@ -17,7 +17,7 @@ + +(uint32_t)(((const uint8_t *)(d))[0]) ) + #endif + +-uint32_t hashkit_hsieh(const char *key, size_t key_length, void *context __attribute__((unused))) ++uint32_t hashkit_hsieh(const char *key, size_t key_length, void * context) + { + uint32_t hash = 0, tmp; + int rem; +diff --git a/3rdparty/libhashkit/jenkins.c b/3rdparty/libhashkit/jenkins.c +index b684d7a..2b59714 100644 +--- a/3rdparty/libhashkit/jenkins.c ++++ b/3rdparty/libhashkit/jenkins.c +@@ -56,7 +56,7 @@ use a bitmask. For example, if you need only 10 bits, do + In which case, the hash table should have hashsize(10) elements. + */ + +-uint32_t hashkit_jenkins(const char *key, size_t length, void *context __attribute__((unused))) ++uint32_t hashkit_jenkins(const char *key, size_t length, void * context) + { + uint32_t a,b,c; /* internal state */ + union { const void *ptr; size_t i; } u; /* needed for Mac Powerbook G4 */ +diff --git a/3rdparty/libhashkit/md5.c b/3rdparty/libhashkit/md5.c +index 7371c6d..0e3181b 100644 +--- a/3rdparty/libhashkit/md5.c ++++ b/3rdparty/libhashkit/md5.c +@@ -352,7 +352,7 @@ unsigned int len) + (((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24); + } + +-uint32_t hashkit_md5(const char *key, size_t key_length, void *context __attribute__((unused))) ++uint32_t hashkit_md5(const char *key, size_t key_length, void * context) + { + unsigned char results[16]; + +diff --git a/3rdparty/libhashkit/murmur.c b/3rdparty/libhashkit/murmur.c +index a18ac40..9e55eec 100644 +--- a/3rdparty/libhashkit/murmur.c ++++ b/3rdparty/libhashkit/murmur.c +@@ -17,7 +17,7 @@ + + #include "common.h" + +-uint32_t hashkit_murmur(const char *key, size_t length, void *context __attribute__((unused))) ++uint32_t hashkit_murmur(const char *key, size_t length, void * context) + { + /* + 'm' and 'r' are mixing constants generated offline. They're not +diff --git a/3rdparty/libhashkit/one_at_a_time.c b/3rdparty/libhashkit/one_at_a_time.c +index 579d044..539861c 100644 +--- a/3rdparty/libhashkit/one_at_a_time.c ++++ b/3rdparty/libhashkit/one_at_a_time.c +@@ -13,7 +13,7 @@ http://en.wikipedia.org/wiki/Jenkins_hash_function + + #include "common.h" + +-uint32_t hashkit_one_at_a_time(const char *key, size_t key_length, void *context __attribute__((unused))) ++uint32_t hashkit_one_at_a_time(const char *key, size_t key_length, void * context) + { + const char *ptr= key; + uint32_t value= 0; +diff --git a/3rdparty/libhashkit/strerror.c b/3rdparty/libhashkit/strerror.c +index 270fa21..7446782 100644 +--- a/3rdparty/libhashkit/strerror.c ++++ b/3rdparty/libhashkit/strerror.c +@@ -8,7 +8,7 @@ + + #include "common.h" + +-const char *hashkit_strerror(hashkit_st *ptr __attribute__((unused)), hashkit_return_t rc) ++const char *hashkit_strerror(hashkit_st *ptr, hashkit_return_t rc) + { + switch (rc) + { +diff --git a/apps/evnsq/option.cc b/apps/evnsq/option.cc +index e2128f5..0248ace 100644 +--- a/apps/evnsq/option.cc ++++ b/apps/evnsq/option.cc +@@ -21,14 +21,14 @@ std::string Option::ToJSON() const { + doc.AddMember("write_timeout", rapidjson::Value(int64_t(write_timeout.Milliseconds())), doc.GetAllocator()); + doc.AddMember("msg_timeout", rapidjson::Value(int64_t(msg_timeout.Milliseconds())), doc.GetAllocator()); + +- doc.AddMember("client_id", rapidjson::Value(client_id, doc.GetAllocator()), doc.GetAllocator()); +- doc.AddMember("hostname", rapidjson::Value(hostname, doc.GetAllocator()), doc.GetAllocator()); +- doc.AddMember("user_agent", rapidjson::Value(user_agent, doc.GetAllocator()), doc.GetAllocator()); ++ doc.AddMember("client_id", rapidjson::Value(client_id.data(), client_id.size(), doc.GetAllocator()), doc.GetAllocator()); ++ doc.AddMember("hostname", rapidjson::Value(hostname.data(), hostname.size(), doc.GetAllocator()), doc.GetAllocator()); ++ doc.AddMember("user_agent", rapidjson::Value(user_agent.data(), user_agent.size(), doc.GetAllocator()), doc.GetAllocator()); + + doc.AddMember("heartbeat_interval", rapidjson::Value(int64_t(heartbeat_interval.Milliseconds())), doc.GetAllocator()); + + doc.AddMember("deflate", rapidjson::Value(false), doc.GetAllocator()); +- doc.AddMember("long_id", rapidjson::Value(hostname, doc.GetAllocator()), doc.GetAllocator()); ++ doc.AddMember("long_id", rapidjson::Value(hostname.data(), hostname.size(), doc.GetAllocator()), doc.GetAllocator()); + doc.AddMember("output_buffer_size", rapidjson::Value(int64_t(16384)), doc.GetAllocator()); + doc.AddMember("output_buffer_timeout", rapidjson::Value(int64_t(250)), doc.GetAllocator()); + doc.AddMember("feature_negotiation", rapidjson::Value(feature_negotiation), doc.GetAllocator()); +@@ -40,3 +40,4 @@ std::string Option::ToJSON() const { + return std::string(buffer.GetString(), buffer.GetSize()); + } + } ++ diff --git a/ports/evpp/portfile.cmake b/ports/evpp/portfile.cmake index db27b4d63..91831e083 100644 --- a/ports/evpp/portfile.cmake +++ b/ports/evpp/portfile.cmake @@ -20,10 +20,17 @@ else () SHA512 08226fe9853c1984f6554ede8f79a5767eec1d12ff2ff7172eef6f715ac7ea3f495b2336876823842408bd92b0ad99c9a3d506c07fc0add369f5cfa777f0406a HEAD_REF master ) + file(REMOVE_RECURSE ${SOURCE_PATH}/3rdparty/rapidjson ${SOURCE_PATH}/3rdparty/concurrentqueue) + + vcpkg_apply_patches( + SOURCE_PATH ${SOURCE_PATH} + PATCHES ${CMAKE_CURRENT_LIST_DIR}/fix-rapidjson-1-1.patch + ) endif () vcpkg_configure_cmake( SOURCE_PATH ${SOURCE_PATH} + PREFER_NINJA OPTIONS -DEVPP_VCPKG_BUILD=ON ) -- cgit v1.2.3