From ce6f8df79f78f6c533f99c44b86850c4f76a84e2 Mon Sep 17 00:00:00 2001
From: Alexander von Gluck IV <kallisti5@unixzen.com>
Date: Wed, 18 Jun 2014 02:37:21 +0000
Subject: [PATCH 1/2] Haiku: build fixes

---
 Configure       |  4 ++++
 Makefile.shared |  8 ++++----
 config          | 11 +++++++++++
 3 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/Configure b/Configure
index de78469..047ce37 100755
--- a/Configure
+++ b/Configure
@@ -440,6 +440,10 @@ my %table=(
 "beos-x86-r5",   "gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -mcpu=pentium -Wall::-D_REENTRANT:BEOS:-lbe -lnet:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:beos:beos-shared:-fPIC -DPIC:-shared:.so",
 "beos-x86-bone", "gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -mcpu=pentium -Wall::-D_REENTRANT:BEOS:-lbe -lbind -lsocket:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:beos:beos-shared:-fPIC:-shared:.so",
 
+##### Haiku
+"haiku-x86",   "gcc:-DL_ENDIAN -O2 -fomit-frame-pointer -Wall::-D_REENTRANT::-lnetwork:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:haiku-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"haiku-x86_64",        "gcc:-m64 -DL_ENDIAN -O2 -Wall -DMD32_REG_T=int::-D_REENTRANT::-lnetwork:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:haiku-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
+
 #### SCO/Caldera targets.
 #
 # Originally we had like unixware-*, unixware-*-pentium, unixware-*-p6, etc.
diff --git a/Makefile.shared b/Makefile.shared
index e753f44..cce510f 100644
--- a/Makefile.shared
+++ b/Makefile.shared
@@ -594,10 +594,10 @@ symlink.hpux:
 symlink.cygwin symlink.alpha-osf1 symlink.tru64 symlink.tru64-rpath symlink.beos:
 
 # Compatibility targets
-link_o.bsd-gcc-shared link_o.linux-shared link_o.gnu-shared: link_o.gnu
-link_a.bsd-gcc-shared link_a.linux-shared link_a.gnu-shared: link_a.gnu
-link_app.bsd-gcc-shared link_app.linux-shared link_app.gnu-shared: link_app.gnu
-symlink.bsd-gcc-shared symlink.bsd-shared symlink.linux-shared symlink.gnu-shared: symlink.gnu
+link_o.bsd-gcc-shared link_o.linux-shared link_o.gnu-shared link_o.haiku-shared: link_o.gnu
+link_a.bsd-gcc-shared link_a.linux-shared link_a.gnu-shared link_a.haiku-shared: link_a.gnu
+link_app.bsd-gcc-shared link_app.linux-shared link_app.gnu-shared link_app.haiku-shared: link_app.gnu
+symlink.bsd-gcc-shared symlink.bsd-shared symlink.linux-shared symlink.gnu-shared symlink.haiku-shared: symlink.gnu
 link_o.bsd-shared: link_o.bsd
 link_a.bsd-shared: link_a.bsd
 link_app.bsd-shared: link_app.bsd
diff --git a/config b/config
index 41fa2a6..f390fc2 100755
--- a/config
+++ b/config
@@ -134,6 +134,14 @@ case "${SYSTEM}:${RELEASE}:${VERSION}:${MACHINE}" in
 	echo "${MACHINE}-dg-dgux"; exit 0
 	;;
 
+    Haiku:*:BePC)
+        echo "i586-pc-haiku"; exit 0
+        ;;
+
+    Haiku:*:*)
+        echo "${MACHINE}-unknown-haiku"; exit 0
+        ;;
+
     HI-UX:*)
 	echo "${MACHINE}-hi-hiux"; exit 0
 	;;
@@ -829,6 +837,9 @@ case "$GUESSOS" in
 	    options="$options no-asm"
 	fi
 	;;
+  i586-*-haiku) OUT="haiku-x86" ;;
+  x86_64-*-haiku) OUT="haiku-x86_64" ;;
+
   # these are all covered by the catchall below
   # *-dgux) OUT="dgux" ;;
   mips-sony-newsos4) OUT="newsos4-gcc" ;;
-- 
1.8.3.4

From df9dd1aa2bf9d40613e95c5ae8fe9e5dc3e8c68f Mon Sep 17 00:00:00 2001
From: Alexander von Gluck IV <kallisti5@unixzen.com>
Date: Wed, 18 Jun 2014 02:39:12 +0000
Subject: [PATCH 2/2] Haiku: Modify default Root CA filename

---
 crypto/cryptlib.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/crypto/cryptlib.h b/crypto/cryptlib.h
index d26f963..96dfd07 100644
--- a/crypto/cryptlib.h
+++ b/crypto/cryptlib.h
@@ -82,7 +82,7 @@ extern "C" {
 #ifndef OPENSSL_SYS_VMS
 #define X509_CERT_AREA		OPENSSLDIR
 #define X509_CERT_DIR		OPENSSLDIR "/certs"
-#define X509_CERT_FILE		OPENSSLDIR "/cert.pem"
+#define X509_CERT_FILE		OPENSSLDIR "/CARootCertificates.pem"
 #define X509_PRIVATE_DIR	OPENSSLDIR "/private"
 #else
 #define X509_CERT_AREA		"SSLROOT:[000000]"
-- 
1.8.3.4

