void-packages/srcpkgs/cbang/patches/0002-OpenSSL-version-check.patch
Đoàn Trần Công Danh d0dc8de5c9 cbang: correct patch prefix
Fix my own problems :(
2020-06-03 08:11:49 +07:00

40 lines
1.4 KiB
Diff

From a25113c30d6ce2e04bb5bab517d109047947647b Mon Sep 17 00:00:00 2001
From: Joseph Coffland <joseph@cauldrondevelopment.com>
Date: Sun, 31 May 2020 15:04:16 -0700
Subject: [PATCH 2/7] OpenSSL version check.
---
config/openssl/__init__.py | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git config/openssl/__init__.py config/openssl/__init__.py
index 421271cd..3b66738d 100644
--- config/openssl/__init__.py
+++ config/openssl/__init__.py
@@ -6,15 +6,14 @@ def check_version(context, version):
context.Message("Checking for openssl version >= %s..." % version)
version = version.split('.')
- src = '#include <openssl/opensslv.h>\nint main() {\nreturn ('
- src += version[0] + '<= (OPENSSL_VERSION_NUMBER >> 28)'
- if 1 < len(version):
- src += ' && ' + version[1] + \
- '<= ((OPENSSL_VERSION_NUMBER >> 20) & 0xf)'
- if 2 < len(version):
- src += ' && ' + version[2] + \
- '<= ((OPENSSL_VERSION_NUMBER >> 12) & 0xf)'
- src += ') ? 0 : 1;}\n'
+ src = '''
+ #include <openssl/opensslv.h>
+ int main() {
+ int v = (%s << 28) + (%s << 20) + (%s << 12);
+ return OPENSSL_VERSION_NUMBER < v;
+ }
+ ''' % (version[0], version[1] if 1 < len(version) else 0,
+ version[2] if 2 < len(version) else 0)
ret = context.TryRun(src, '.cpp')[0]
--
2.27.0.rc1.5.gae92ac8ae3