void-packages/srcpkgs/cbang/patches/0004-config-openssl-check-OPENSSL_VERSION-in-compile-time.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

37 lines
1.3 KiB
Diff

From 0e24962ff868340636be7a67d7c7e03d2c4dcf15 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
<congdanhqx@gmail.com>
Date: Sun, 17 May 2020 22:26:09 +0700
Subject: [PATCH 4/7] config/openssl: check OPENSSL_VERSION in compile time
All of required information are available at compile time, use compile
time check to support cross compiling.
---
config/openssl/__init__.py | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git config/openssl/__init__.py config/openssl/__init__.py
index 3b66738d..8ab89d9f 100644
--- config/openssl/__init__.py
+++ config/openssl/__init__.py
@@ -9,13 +9,14 @@ def check_version(context, version):
src = '''
#include <openssl/opensslv.h>
int main() {
- int v = (%s << 28) + (%s << 20) + (%s << 12);
- return OPENSSL_VERSION_NUMBER < v;
+ int array[1 - 2 * (OPENSSL_VERSION_NUMBER < (%s << 28) + (%s << 20) + (%s << 12))];
+ array[0] = 0;
+ return *array;
}
''' % (version[0], version[1] if 1 < len(version) else 0,
version[2] if 2 < len(version) else 0)
- ret = context.TryRun(src, '.cpp')[0]
+ ret = context.TryCompile(src, '.cpp')
context.Result(ret)
return ret
--
2.27.0.rc1.5.gae92ac8ae3