forked from HaxeFoundation/neko
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[cmake] Update to mbedtls 3.6 for static builds
Use MBEDTLS_USER_CONFIG_FILE instead of patching the sources.
- Loading branch information
Showing
3 changed files
with
13 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,5 @@ | ||
# Apply config adjustments similer to Debian's | ||
# https://anonscm.debian.org/cgit/collab-maint/mbedtls.git/tree/debian/patches/01_config.patch | ||
|
||
set(config ${MbedTLS_source}/include/mbedtls/config.h) | ||
|
||
file(READ ${config} content) | ||
|
||
if (WIN32) | ||
# allow alternate threading implementation | ||
string(REPLACE | ||
"//#define MBEDTLS_THREADING_ALT" | ||
"#define MBEDTLS_THREADING_ALT" | ||
content "${content}" | ||
) | ||
# disable the TCP/IP networking routines | ||
# such that it wouldn't interfere with the #include <windows.h> in our threading_alt.h | ||
string(REPLACE | ||
"#define MBEDTLS_NET_C" | ||
"//#define MBEDTLS_NET_C" | ||
content "${content}" | ||
) | ||
|
||
file(COPY ${source}/libs/ssl/threading_alt.h | ||
DESTINATION ${MbedTLS_source}/include/mbedtls/ | ||
) | ||
else() | ||
# enable pthread mutexes | ||
string(REPLACE | ||
"//#define MBEDTLS_THREADING_PTHREAD" | ||
"#define MBEDTLS_THREADING_PTHREAD" | ||
content "${content}" | ||
) | ||
endif() | ||
|
||
# enable the HAVEGE random generator | ||
string(REPLACE | ||
"//#define MBEDTLS_HAVEGE_C" | ||
"#define MBEDTLS_HAVEGE_C" | ||
content "${content}" | ||
) | ||
# enable support for (rare) MD2-signed X.509 certs | ||
string(REPLACE | ||
"//#define MBEDTLS_MD2_C" | ||
"#define MBEDTLS_MD2_C" | ||
content "${content}" | ||
) | ||
# enable support for (rare) MD4-signed X.509 certs | ||
string(REPLACE | ||
"//#define MBEDTLS_MD4_C" | ||
"#define MBEDTLS_MD4_C" | ||
content "${content}" | ||
) | ||
# allow use of mutexes within mbed TLS | ||
string(REPLACE | ||
"//#define MBEDTLS_THREADING_C" | ||
"#define MBEDTLS_THREADING_C" | ||
content "${content}" | ||
) | ||
|
||
file(WRITE ${config} "${content}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#ifdef _WIN32 | ||
#define MBEDTLS_THREADING_ALT | ||
#endif | ||
#ifndef _WIN32 | ||
#define MBEDTLS_THREADING_PTHREAD | ||
#endif | ||
|
||
#undef MBEDTLS_NET_C | ||
|
||
#define MBEDTLS_THREADING_C |