add initial CMake and Visual Studio build support

This moves the compatibility include files from include to
include/compat so we can use the awful MS C compiler
<../include/> trick to emulate the GNU #include_next extension.

This also removes a few old compat files we do not need anymore.
This commit is contained in:
Brent Cook
2014-07-10 22:06:10 -05:00
committed by Brent Cook
parent 7a4a37cf59
commit 5d8a1cf715
53 changed files with 2082 additions and 153 deletions

View File

@@ -0,0 +1,15 @@
--- crypto/compat/arc4random.c.orig 2015-07-20 07:41:17.000000000 -0600
+++ crypto/compat/arc4random.c 2015-07-20 07:41:58.000000000 -0600
@@ -36,8 +36,11 @@
#define KEYSTREAM_ONLY
#include "chacha_private.h"
+#ifndef min
#define min(a, b) ((a) < (b) ? (a) : (b))
-#ifdef __GNUC__
+#endif
+
+#if defined(__GNUC__) || defined(_MSC_VER)
#define inline __inline
#else /* !__GNUC__ */
#define inline

View File

@@ -1,10 +1,11 @@
--- apps/openssl.c.orig 2015-06-05 03:42:12.956112944 -0500
+++ apps/openssl.c 2015-06-05 03:41:54.215381908 -0500
@@ -130,6 +130,18 @@
--- apps/openssl.c.orig 2015-07-20 02:01:42.000000000 -0600
+++ apps/openssl.c 2015-07-20 02:02:00.000000000 -0600
@@ -130,6 +130,19 @@
#include <openssl/engine.h>
#endif
+#ifdef _WIN32
+#include <io.h>
+#include <fcntl.h>
+static void set_stdio_binary(void)
+{
@@ -18,12 +19,22 @@
+
#include "progs.h"
#include "s_apps.h"
@@ -216,6 +228,7 @@
@@ -204,7 +216,9 @@
static void
openssl_startup(void)
{
+#ifndef _WIN32
signal(SIGPIPE, SIG_IGN);
+#endif
CRYPTO_malloc_init();
OpenSSL_add_all_algorithms();
@@ -216,6 +230,7 @@
#endif
setup_ui_method();
+ set_stdio_binary();
}
static void

View File

@@ -0,0 +1,13 @@
--- include/openssl/opensslconf.h.orig 2015-07-19 23:21:47.000000000 -0600
+++ include/openssl/opensslconf.h 2015-07-19 23:21:17.000000000 -0600
@@ -1,6 +1,10 @@
#include <openssl/opensslfeatures.h>
/* crypto/opensslconf.h.in */
+#if defined(_MSC_VER) && !defined(__attribute__)
+#define __attribute__(a)
+#endif
+
/* Generate 80386 code? */
#undef I386_ONLY

View File

@@ -1,15 +1,17 @@
--- include/openssl/ossl_typ.h.orig 2015-07-06 13:21:18.788571423 -0700
+++ include/openssl/ossl_typ.h 2015-07-06 13:24:14.906468003 -0700
@@ -100,6 +100,20 @@
@@ -100,6 +100,22 @@
typedef struct ASN1_ITEM_st ASN1_ITEM;
typedef struct asn1_pctx_st ASN1_PCTX;
+#if defined(_WIN32) && defined(__WINCRYPT_H__)
+#ifndef LIBRESSL_INTERNAL
+#ifdef _MSC_VER
+#pragma message("Warning, overriding WinCrypt defines")
+#else
+#warning overriding WinCrypt defines
+#endif
+#endif
+#undef X509_NAME
+#undef X509_CERT_PAIR
+#undef X509_EXTENSIONS

View File

@@ -1,15 +1,17 @@
--- include/openssl/pkcs7.h.orig 2015-07-06 13:26:27.369203527 -0700
+++ include/openssl/pkcs7.h 2015-07-06 13:27:37.637051967 -0700
@@ -69,6 +69,16 @@
@@ -69,6 +69,18 @@
extern "C" {
#endif
+#if defined(_WIN32) && defined(__WINCRYPT_H__)
+#ifndef LIBRESSL_INTERNAL
+#ifdef _MSC_VER
+#pragma message("Warning, overriding WinCrypt defines")
+#else
+#warning overriding WinCrypt defines
+#endif
+#endif
+#undef PKCS7_ISSUER_AND_SERIAL
+#undef PKCS7_SIGNER_INFO
+#endif

View File

@@ -1,15 +1,17 @@
--- include/openssl/x509.h.orig 2015-07-06 13:15:15.059306046 -0700
+++ include/openssl/x509.h 2015-07-06 13:16:10.506118278 -0700
@@ -112,6 +112,17 @@
@@ -112,6 +112,19 @@
extern "C" {
#endif
+#if defined(_WIN32) && defined(__WINCRYPT_H__)
+#if defined(_WIN32)
+#ifndef LIBRESSL_INTERNAL
+#ifdef _MSC_VER
+#pragma message("Warning, overriding WinCrypt defines")
+#else
+#warning overriding WinCrypt defines
+#endif
+#endif
+#undef X509_NAME
+#undef X509_CERT_PAIR
+#undef X509_EXTENSIONS