diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2017-01-05 09:46:38 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2017-01-05 10:14:14 +0000 |
commit | 0e69fa24491a260c5066ed67f0e5773bc2113aea (patch) | |
tree | 1ea0c0d2604649431a7e93ecbc246fe093fc4a51 | |
parent | 76d8addbe590a7991b3b08d0c94b9906dbf75670 (diff) | |
download | aports-0e69fa24491a260c5066ed67f0e5773bc2113aea.tar.bz2 aports-0e69fa24491a260c5066ed67f0e5773bc2113aea.tar.xz |
testing/rethinkdb: fix build with libressl
-rw-r--r-- | testing/rethinkdb/APKBUILD | 18 | ||||
-rw-r--r-- | testing/rethinkdb/libressl.patch | 158 |
2 files changed, 169 insertions, 7 deletions
diff --git a/testing/rethinkdb/APKBUILD b/testing/rethinkdb/APKBUILD index 389dd91cfb..f11db589e5 100644 --- a/testing/rethinkdb/APKBUILD +++ b/testing/rethinkdb/APKBUILD @@ -2,19 +2,20 @@ # Maintainer: Daniel Treadwell <daniel@djt.id.au> pkgname=rethinkdb pkgver=2.3.5 -pkgrel=2 +pkgrel=3 pkgdesc="Distributed powerful and scalable NoSQL database" url="http://www.rethinkdb.com" -arch="" +arch="x86_64" license="AGPL" depends="" -depends_dev="protobuf-dev icu-dev openssl-dev curl-dev boost-dev libexecinfo-dev" -makedepends="$depends_dev bash python2 linux-headers bsd-compat-headers m4 paxmark" +makedepends="bash python2 linux-headers bsd-compat-headers m4 paxmark + protobuf-dev icu-dev libressl-dev curl-dev boost-dev libexecinfo-dev" install="" pkgusers=rethinkdb pkggroups=rethinkdb subpackages="$pkgname-doc" source="http://download.rethinkdb.com/dist/rethinkdb-$pkgver.tgz + libressl.patch rethinkdb.initd" _builddir="$srcdir"/rethinkdb-$pkgver @@ -34,7 +35,6 @@ build() { --prefix=/usr \ --sysconfdir=/etc \ --localstatedir=/var \ - --fetch v8 \ --dynamic all \ --with-system-malloc \ || return 1 @@ -46,9 +46,10 @@ build() { esac export LDFLAGS="$LDFLAGS -lexecinfo" - make || paxmark -m \ + make CXXFLAGS="$CXXFLAGS -fno-delete-null-pointer-checks" \ + || paxmark -m \ build/external/v8_3.30.33.16/build/out/${_arch}.release/mksnapshot - make || return 1 + make CXXFLAGS="$CXXFLAGS -fno-delete-null-pointer-checks" || return 1 } package() { @@ -68,8 +69,11 @@ package() { } md5sums="89614869d931f8c6e7473e66887089ca rethinkdb-2.3.5.tgz +cc978791a4e4545190d0063b46aa3dd0 libressl.patch bb1cde2ba1d6a71ed79c31161b1bf64b rethinkdb.initd" sha256sums="dd8aeee169b177179bfe080725f0560443e0f26dae875b32ae25d90cf2f8ee10 rethinkdb-2.3.5.tgz +22b8a69f7b02b9f8127a635c18ea76979313520c79f2461f09dfc8299e49604a libressl.patch d7294473f30cd2fa7837de6ed4816efd2c8663a15c7396d8c37a0a9f2fc1a787 rethinkdb.initd" sha512sums="ac71656fd2451fd36432fa0f7d2c16c2be53888f748d88f0bfc2fb9ad7cd3c704b56551bc35eda72eb08fffdd799727a3cbe83830337cf71e17c159588d33c94 rethinkdb-2.3.5.tgz +9ff727feedc7a9f58e7bf8554dc26e32ebca259b2d5d75ff0d064f5aea7a54c9c94fab16b83a3bc4039d4ae6d6d805d7b129ab9d5f762186d0388adeeff6e67c libressl.patch d9997f453623e4a85e19052464d97738be70277fd14b985e9123414792b85cf5e5b30e8ecb94b48cdab43c4fb39898ca35e7fbc8943e13f95db2a992ba2289a1 rethinkdb.initd" diff --git a/testing/rethinkdb/libressl.patch b/testing/rethinkdb/libressl.patch new file mode 100644 index 0000000000..6f273a0258 --- /dev/null +++ b/testing/rethinkdb/libressl.patch @@ -0,0 +1,158 @@ +From d52a694a806c1a8b6dd4d7d17d0671a96240449a Mon Sep 17 00:00:00 2001 +From: Natanael Copa <ncopa@alpinelinux.org> +Date: Wed, 4 Jan 2017 15:31:40 +0100 +Subject: [PATCH] Improve OpenSSL compatibility + +Refactor the conditionals for openssl 1.1 support so we avoid multiple +if/else and add a check for LibreSSL as well. +--- + src/crypto/hash.cc | 13 +++++-------- + src/crypto/hmac.cc | 34 ++++++++++++++++++---------------- + src/crypto/initialization_guard.cc | 15 ++++++--------- + 3 files changed, 29 insertions(+), 33 deletions(-) + +diff --git a/src/crypto/hash.cc b/src/crypto/hash.cc +index 4427dfddeb..e035f695fc 100644 +--- a/src/crypto/hash.cc ++++ b/src/crypto/hash.cc +@@ -8,27 +8,24 @@ + + #include "crypto/error.hpp" + ++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) ++#define EVP_MD_CTX_new EVP_MD_CTX_create ++#define EVP_MD_CTX_free EVP_MD_CTX_destroy ++#endif ++ + namespace crypto { + + class evp_md_ctx_wrapper_t { + public: + evp_md_ctx_wrapper_t() { +-#if OPENSSL_VERSION_NUMBER < 0x10100000L +- m_evp_md_ctx = EVP_MD_CTX_create(); +-#else + m_evp_md_ctx = EVP_MD_CTX_new(); +-#endif + if (m_evp_md_ctx == nullptr) { + throw openssl_error_t(ERR_get_error()); + } + } + + ~evp_md_ctx_wrapper_t() { +-#if OPENSSL_VERSION_NUMBER < 0x10100000L +- EVP_MD_CTX_destroy(m_evp_md_ctx); +-#else + EVP_MD_CTX_free(m_evp_md_ctx); +-#endif + } + + EVP_MD_CTX *get() { +diff --git a/src/crypto/hmac.cc b/src/crypto/hmac.cc +index 2ac4314e24..0e3f91a0c1 100644 +--- a/src/crypto/hmac.cc ++++ b/src/crypto/hmac.cc +@@ -7,43 +7,45 @@ + + #include "crypto/error.hpp" + ++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) ++ ++inline HMAC_CTX *HMAC_CTX_new() { ++ HMAC_CTX *tmp = (HMAC_CTX *)OPENSSL_malloc(sizeof(HMAC_CTX)); ++ if (tmp) ++ HMAC_CTX_init(tmp); ++ return tmp; ++} ++ ++inline void HMAC_CTX_free(HMAC_CTX *ctx) { ++ if (ctx) { ++ HMAC_CTX_cleanup(ctx); ++ OPENSSL_free(ctx); ++ } ++} ++ ++#endif ++ + namespace crypto { + + class hmac_ctx_wrapper_t { + public: + hmac_ctx_wrapper_t() { +-#if OPENSSL_VERSION_NUMBER < 0x10100000L +- HMAC_CTX_init(&m_hmac_ctx); +-#else + m_hmac_ctx = HMAC_CTX_new(); + if (m_hmac_ctx == nullptr) { + throw openssl_error_t(ERR_get_error()); + } +-#endif + } + + ~hmac_ctx_wrapper_t() { +-#if OPENSSL_VERSION_NUMBER < 0x10100000L +- HMAC_CTX_cleanup(&m_hmac_ctx); +-#else + HMAC_CTX_free(m_hmac_ctx); +-#endif + } + + HMAC_CTX *get() { +-#if OPENSSL_VERSION_NUMBER < 0x10100000L +- return &m_hmac_ctx; +-#else + return m_hmac_ctx; +-#endif + } + + private: +-#if OPENSSL_VERSION_NUMBER < 0x10100000L +- HMAC_CTX m_hmac_ctx; +-#else + HMAC_CTX *m_hmac_ctx; +-#endif + }; + + std::array<unsigned char, SHA256_DIGEST_LENGTH> detail::hmac_sha256( +diff --git a/src/crypto/initialization_guard.cc b/src/crypto/initialization_guard.cc +index ba0503efc6..f76ffd96da 100644 +--- a/src/crypto/initialization_guard.cc ++++ b/src/crypto/initialization_guard.cc +@@ -14,16 +14,17 @@ + #include "arch/io/concurrency.hpp" + #include "arch/runtime/runtime.hpp" + ++#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) ++#define OPENSSL_init_ssl(x, y) SSL_library_init() ++#define OPENSSL_init_crypto(x, y) SSL_load_error_strings() ++#define OPENSSL_cleanup ERR_free_strings ++#endif ++ + namespace crypto { + + initialization_guard_t::initialization_guard_t() { +-#if OPENSSL_VERSION_NUMBER < 0x10100000L +- SSL_library_init(); +- SSL_load_error_strings(); +-#else + OPENSSL_init_ssl(0, nullptr); + OPENSSL_init_crypto(0, nullptr); +-#endif + + // Make OpenSSL thread-safe by registering the required callbacks + CRYPTO_THREADID_set_callback([](CRYPTO_THREADID *thread_out) { +@@ -49,11 +50,7 @@ initialization_guard_t::initialization_guard_t() { + } + + initialization_guard_t::~initialization_guard_t() { +-#if OPENSSL_VERSION_NUMBER < 0x10100000L +- ERR_free_strings(); +-#else + OPENSSL_cleanup(); +-#endif + } + + } // namespace crypto +-- +2.11.0 + |