Browse Source

libfolly: Update to version 2019.05.27.00

Removed upstreamed patches. Also fixes a redefinition error on some
platforms.

Cleaned up the DEPENDS to be simpler and more concise.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
lilik-openwrt-22.03
Rosen Penev 6 years ago
parent
commit
e243f40fd4
3 changed files with 5 additions and 267 deletions
  1. +5
    -6
      libs/libfolly/Makefile
  2. +0
    -114
      libs/libfolly/patches/102-uclibc-patches.patch
  3. +0
    -147
      libs/libfolly/patches/103-openssl-compatibility.patch

+ 5
- 6
libs/libfolly/Makefile View File

@ -1,12 +1,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=libfolly
PKG_VERSION:=2019.05.06.00
PKG_VERSION:=2019.05.27.00
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/facebook/folly/tar.gz/v$(PKG_VERSION)?
PKG_HASH:=59e88d792e4c917e2f37ac22c230af0056bce8aa7bacf2d9e94ceb177a7c1079
PKG_HASH:=7535937e4b4bde14e6c854dc55a5fe9f290ccf1918621f20678ebecd0c1239e1
PKG_BUILD_DIR:=$(BUILD_DIR)/folly-$(PKG_VERSION)
PKG_LICENSE:=Apache-2.0
@ -32,10 +32,9 @@ define Package/libfolly
CATEGORY:=Libraries
TITLE:=An open-source C++ library developed and used at Facebook.
URL:=https://github.com/facebook/folly
DEPENDS:=+libstdcpp +boost +boost-context +boost-system +boost-thread \
+boost-date_time +boost-filesystem +boost-program_options +boost-regex \
+libbz2 +libopenssl +libdouble-conversion +libevent2 +glog +zlib +libzstd \
+gflags +libsodium +liblzma +libaio +liblz4 +libunwind +libatomic
DEPENDS:=+boost +boost-context +boost-date_time +boost-filesystem +boost-program_options +boost-regex \
+libopenssl +libdouble-conversion +libevent2 +glog +libsodium +libaio +libunwind +libatomic \
+libbz2 +zlib +libzstd +liblzma +liblz4
endef
define Package/libfolly/description


+ 0
- 114
libs/libfolly/patches/102-uclibc-patches.patch View File

@ -1,114 +0,0 @@
diff --git a/folly/CachelinePadded.h b/folly/CachelinePadded.h
--- a/folly/CachelinePadded.h
+++ b/folly/CachelinePadded.h
@@ -35,10 +35,6 @@
*/
template <typename T>
class CachelinePadded {
- static_assert(
- alignof(T) <= max_align_v,
- "CachelinePadded does not support over-aligned types.");
-
public:
template <typename... Args>
explicit CachelinePadded(Args&&... args)
diff --git a/folly/experimental/JSONSchema.cpp b/folly/experimental/JSONSchema.cpp
--- a/folly/experimental/JSONSchema.cpp
+++ b/folly/experimental/JSONSchema.cpp
@@ -25,6 +25,7 @@
#include <folly/Singleton.h>
#include <folly/String.h>
#include <folly/json.h>
+#include <folly/portability/Math.h>
namespace folly {
namespace jsonschema {
@@ -141,7 +142,7 @@
return none;
}
if (schema_.isDouble() || value.isDouble()) {
- const auto rem = std::remainder(value.asDouble(), schema_.asDouble());
+ const auto rem = folly::remainder(value.asDouble(), schema_.asDouble());
if (std::abs(rem) > std::numeric_limits<double>::epsilon()) {
return makeError("a multiple of ", schema_, value);
}
diff --git a/folly/external/farmhash/farmhash.cpp b/folly/external/farmhash/farmhash.cpp
--- a/folly/external/farmhash/farmhash.cpp
+++ b/folly/external/farmhash/farmhash.cpp
@@ -181,6 +181,7 @@
#undef bswap_32
#undef bswap_64
+#undef _BYTESWAP_H
#include <byteswap.h>
#endif
diff --git a/folly/portability/Math.h b/folly/portability/Math.h
--- a/folly/portability/Math.h
+++ b/folly/portability/Math.h
@@ -20,21 +20,24 @@
namespace folly {
-#ifndef __ANDROID__
+#if !defined(__ANDROID__) && !defined(__UCLIBC__)
/**
- * Most platforms hopefully provide std::nextafter.
+ * Most platforms hopefully provide std::{nextafter,remainder}.
*/
/* using override */ using std::nextafter;
+/* using override */ using std::remainder;
-#else // !__ANDROID__
+#else // !__ANDROID__ && !__UCLIBC__
/**
* On Android, std::nextafter isn't implemented. However, the C functions and
* compiler builtins are still provided. Using the GCC builtin is actually
* slightly faster, as they're constexpr and the use cases within folly are in
* constexpr context.
+ *
+ * UCLIBC doesn't implement std::remainder. Use the builtin versions.
*/
#if defined(__GNUC__) && !defined(__clang__)
@@ -51,6 +54,18 @@
return __builtin_nextafterl(x, y);
}
+constexpr float remainder(float x, float y) {
+ return __builtin_remainderf(x, y);
+}
+
+constexpr double remainder(double x, double y) {
+ return __builtin_remainder(x, y);
+}
+
+constexpr long double remainder(long double x, long double y) {
+ return __builtin_remainderl(x, y);
+}
+
#else // __GNUC__
inline float nextafter(float x, float y) {
@@ -65,6 +80,18 @@
return ::nextafterl(x, y);
}
+inline float remainder(float x, float y) {
+ return ::remainderf(x, y);
+}
+
+inline double remainder(double x, double y) {
+ return ::remainder(x, y);
+}
+
+inline long double remainder(long double x, long double y) {
+ return ::remainderl(x, y);
+}
+
#endif // __GNUC__
#endif // __ANDROID__

+ 0
- 147
libs/libfolly/patches/103-openssl-compatibility.patch View File

@ -1,147 +0,0 @@
diff --git a/folly/io/async/ssl/OpenSSLUtils.cpp b/folly/io/async/ssl/OpenSSLUtils.cpp
index 0504cf8..a9c2775 100644
--- a/folly/io/async/ssl/OpenSSLUtils.cpp
+++ b/folly/io/async/ssl/OpenSSLUtils.cpp
@@ -155,8 +155,12 @@ static std::unordered_map<uint16_t, std::string> getOpenSSLCipherNames() {
SSL_CTX* ctx = nullptr;
SSL* ssl = nullptr;
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
const SSL_METHOD* meth = SSLv23_server_method();
OpenSSL_add_ssl_algorithms();
+#else
+ const SSL_METHOD* meth = TLS_server_method();
+#endif
if ((ctx = SSL_CTX_new(meth)) == nullptr) {
return ret;
diff --git a/folly/portability/OpenSSL.h b/folly/portability/OpenSSL.h
index a4f4b04..427bf95 100644
--- a/folly/portability/OpenSSL.h
+++ b/folly/portability/OpenSSL.h
@@ -27,6 +27,7 @@
#include <openssl/asn1.h>
#include <openssl/bio.h>
+#include <openssl/bn.h>
#include <openssl/crypto.h>
#include <openssl/dh.h>
#include <openssl/err.h>
diff --git a/folly/ssl/OpenSSLCertUtils.cpp b/folly/ssl/OpenSSLCertUtils.cpp
index 544bb4f..423dd2c 100644
--- a/folly/ssl/OpenSSLCertUtils.cpp
+++ b/folly/ssl/OpenSSLCertUtils.cpp
@@ -155,12 +155,17 @@ folly::Optional<std::string> OpenSSLCertUtils::toString(X509& x509) {
}
}
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#define X509_get0_notAfter X509_get_notAfter
+#define X509_get0_notBefore X509_get_notBefore
+#endif
+
std::string OpenSSLCertUtils::getNotAfterTime(X509& x509) {
- return getDateTimeStr(X509_get_notAfter(&x509));
+ return getDateTimeStr(X509_get0_notAfter(&x509));
}
std::string OpenSSLCertUtils::getNotBeforeTime(X509& x509) {
- return getDateTimeStr(X509_get_notBefore(&x509));
+ return getDateTimeStr(X509_get0_notBefore(&x509));
}
std::string OpenSSLCertUtils::getDateTimeStr(const ASN1_TIME* time) {
diff --git a/folly/ssl/OpenSSLVersionFinder.h b/folly/ssl/OpenSSLVersionFinder.h
index d0110d7..9d65580 100644
--- a/folly/ssl/OpenSSLVersionFinder.h
+++ b/folly/ssl/OpenSSLVersionFinder.h
@@ -18,6 +18,12 @@
#include <folly/Conv.h>
#include <folly/portability/OpenSSL.h>
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
+#define OPENSSL_VERSION SSLEAY_VERSION
+#define OpenSSL_version SSLeay_version
+#define OpenSSL_version_num SSLeay
+#endif
+
// This is used to find the OpenSSL version at runtime. Just returning
// OPENSSL_VERSION_NUMBER is insufficient as runtime version may be different
// from the compile-time version
@@ -25,7 +31,7 @@ namespace folly {
namespace ssl {
inline std::string getOpenSSLLongVersion() {
#ifdef OPENSSL_VERSION_TEXT
- return SSLeay_version(SSLEAY_VERSION);
+ return OpenSSL_version(OPENSSL_VERSION);
#elif defined(OPENSSL_VERSION_NUMBER)
return folly::format("0x{:x}", OPENSSL_VERSION_NUMBER).str();
#else
@@ -35,7 +41,7 @@ inline std::string getOpenSSLLongVersion() {
inline uint64_t getOpenSSLNumericVersion() {
#ifdef OPENSSL_VERSION_NUMBER
- return SSLeay();
+ return OpenSSL_version_num();
#else
return 0;
#endif
diff --git a/folly/ssl/detail/OpenSSLThreading.cpp b/folly/ssl/detail/OpenSSLThreading.cpp
index 3414fbd..ce345ab 100644
--- a/folly/ssl/detail/OpenSSLThreading.cpp
+++ b/folly/ssl/detail/OpenSSLThreading.cpp
@@ -115,6 +115,7 @@ struct SSLLock {
// SSLContext runs in such environments.
// Instead of declaring a static member we "new" the static
// member so that it won't be destructed on exit().
+#if !FOLLY_SSL_DETAIL_OPENSSL_IS_110
static std::unique_ptr<SSLLock[]>& locks() {
static auto locksInst = new std::unique_ptr<SSLLock[]>();
return *locksInst;
@@ -128,8 +129,8 @@ static void callbackLocking(int mode, int n, const char*, int) {
}
}
-static unsigned long callbackThreadID() {
- return static_cast<unsigned long>(folly::getCurrentThreadID());
+static void callbackThreadID(CRYPTO_THREADID *id) {
+ return CRYPTO_THREADID_set_numeric(id, folly::getCurrentThreadID());
}
static CRYPTO_dynlock_value* dyn_create(const char*, int) {
@@ -150,28 +151,33 @@ dyn_lock(int mode, struct CRYPTO_dynlock_value* lock, const char*, int) {
static void dyn_destroy(struct CRYPTO_dynlock_value* lock, const char*, int) {
delete lock;
}
+#endif
void installThreadingLocks() {
+#if !FOLLY_SSL_DETAIL_OPENSSL_IS_110
// static locking
locks() = std::make_unique<SSLLock[]>(size_t(CRYPTO_num_locks()));
for (auto it : lockTypes()) {
locks()[size_t(it.first)].lockType = it.second;
}
- CRYPTO_set_id_callback(callbackThreadID);
+ CRYPTO_THREADID_set_callback(callbackThreadID);
CRYPTO_set_locking_callback(callbackLocking);
// dynamic locking
CRYPTO_set_dynlock_create_callback(dyn_create);
CRYPTO_set_dynlock_lock_callback(dyn_lock);
CRYPTO_set_dynlock_destroy_callback(dyn_destroy);
+#endif
}
void cleanupThreadingLocks() {
- CRYPTO_set_id_callback(nullptr);
+#if !FOLLY_SSL_DETAIL_OPENSSL_IS_110
+ CRYPTO_THREADID_set_callback(nullptr);
CRYPTO_set_locking_callback(nullptr);
CRYPTO_set_dynlock_create_callback(nullptr);
CRYPTO_set_dynlock_lock_callback(nullptr);
CRYPTO_set_dynlock_destroy_callback(nullptr);
locks().reset();
+#endif
}
} // namespace detail

Loading…
Cancel
Save