summaryrefslogtreecommitdiffstats
path: root/external/openssl
diff options
context:
space:
mode:
authorKhaled Hosny <khaledhosny@eglug.org>2013-11-03 20:19:22 +0200
committerDavid Tardon <dtardon@redhat.com>2013-11-04 02:29:08 -0600
commitfde2065b0f3266fc7ee9e1b85733e3ddcf1c9e03 (patch)
tree6755c82c8ed9e337e64dfb6b8df2ab434aae7193 /external/openssl
parentfdo#70393: move openldap to a subdir of external (diff)
downloadcore-fde2065b0f3266fc7ee9e1b85733e3ddcf1c9e03.tar.gz
core-fde2065b0f3266fc7ee9e1b85733e3ddcf1c9e03.zip
fdo#70393: move openssl to a subdir of external
Change-Id: I10bf92b18ee5ad56f1b4fbee3e4008b35b822be4 Reviewed-on: https://gerrit.libreoffice.org/6547 Reviewed-by: David Tardon <dtardon@redhat.com> Tested-by: David Tardon <dtardon@redhat.com>
Diffstat (limited to 'external/openssl')
-rw-r--r--external/openssl/ExternalPackage_openssl.mk21
-rw-r--r--external/openssl/ExternalProject_openssl.mk93
-rw-r--r--external/openssl/Makefile7
-rw-r--r--external/openssl/Module_openssl.mk20
-rw-r--r--external/openssl/README7
-rw-r--r--external/openssl/UnpackedTarball_openssl.mk101
-rw-r--r--external/openssl/opensslios.patch12
-rw-r--r--external/openssl/openssllnx.patch23
-rw-r--r--external/openssl/opensslmingw.patch109
-rw-r--r--external/openssl/opensslsol.patch81
-rw-r--r--external/openssl/opensslwnt.patch154
11 files changed, 628 insertions, 0 deletions
diff --git a/external/openssl/ExternalPackage_openssl.mk b/external/openssl/ExternalPackage_openssl.mk
new file mode 100644
index 000000000000..695c7b7119b6
--- /dev/null
+++ b/external/openssl/ExternalPackage_openssl.mk
@@ -0,0 +1,21 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_ExternalPackage_ExternalPackage,openssl,openssl))
+
+$(eval $(call gb_ExternalPackage_use_external_project,openssl,openssl))
+
+ifeq ($(COM),MSC)
+$(eval $(call gb_ExternalPackage_add_files,openssl,$(LIBO_LIB_FOLDER),\
+ out32dll/ssleay32.dll \
+ out32dll/libeay32.dll \
+))
+endif
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/openssl/ExternalProject_openssl.mk b/external/openssl/ExternalProject_openssl.mk
new file mode 100644
index 000000000000..e41adb868e5a
--- /dev/null
+++ b/external/openssl/ExternalProject_openssl.mk
@@ -0,0 +1,93 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_ExternalProject_ExternalProject,openssl))
+
+$(eval $(call gb_ExternalProject_register_targets,openssl,\
+ build \
+))
+
+# For multi-line conditionals, align the $(if and the corresponding ),
+# putting the latter on a line of its own. Also put the "else" comma
+# on a line of its own. Hopefully should make the logic more clear.
+
+OPENSSL_PLATFORM := \
+ $(if $(filter LINUX FREEBSD ANDROID,$(OS)),\
+ $(if $(filter I,$(CPU)),\
+ $(if $(filter GNU/kFreeBSD,$(shell uname)),debian-kfreebsd-i386,linux-elf)\
+ ,\
+ $(if $(filter X,$(CPU)),\
+ $(if $(filter GNU/kFreeBSD,$(shell uname)),\
+ debian-kfreebsd-amd64\
+ ,\
+ $(if $(filter TRUE, $(ENABLE_DBGUTIL)), debug-linux-generic64, linux-generic64) no-asm\
+ )\
+ ,\
+ $(if $(filter TRUE, $(ENABLE_DBGUTIL)), debug-linux-generic32, linux-generic32)\
+ )\
+ )\
+ ,\
+ $(if $(filter SOLARIS,$(OS)),\
+ $(if $(filter INTEL,$(CPUNAME)),\
+ $(if $(filter X,$(CPU)),solaris64-x86_64-cc,solaris-x86-cc)\
+ ,\
+ solaris-sparcv9-cc\
+ )\
+ ,\
+ $(if $(filter IOS,$(OS)),\
+ ios-armv7\
+ ,\
+ $(if $(filter WNT,$(OS)),\
+ $(if $(filter GCC,$(COM)),\
+ mingw\
+ ,\
+ $(if $(filter I,$(CPU)),VC-WIN32,VC-WIN64A)\
+ )\
+ ,\
+ $(if $(filter MACOSX,$(OS)),\
+ $(if $(filter I,$(CPU)),darwin-i386-cc,darwin64-x86_64-cc)\
+ )\
+ )\
+ )\
+ )\
+ )
+
+ifeq ($(COM),MSC)
+$(call gb_ExternalProject_get_state_target,openssl,build):
+ $(call gb_ExternalProject_run,build,\
+ export CC="$(shell cygpath -w $(CC))" \
+ && export PERL="$(shell cygpath -w $(PERL))" \
+ && export LIB="$(ILIB)" \
+ && $(PERL) Configure $(OPENSSL_PLATFORM) no-idea \
+ && cmd /c "ms\do_ms.bat $(PERL) $(OPENSSL_PLATFORM)" \
+ && unset MAKEFLAGS \
+ && nmake -f "ms\ntdll.mak" \
+ )
+
+else
+$(call gb_ExternalProject_get_state_target,openssl,build):
+ $(call gb_ExternalProject_run,build,\
+ unset MAKEFLAGS && \
+ $(if $(filter LINUX MACOSX FREEBSD ANDROID SOLARIS IOS,$(OS)), \
+ ./Configure, \
+ $(if $(filter WNT,$(OS)), \
+ $(PERL) Configure, \
+ ./config)) \
+ $(OPENSSL_PLATFORM) no-dso no-shared \
+ $(if $(filter-out WNT,$(OS)),no-idea) \
+ $(if $(filter-out ANDROID IOS WNT,$(OS)), \
+ $(if $(SYSBASE),-I$(SYSBASE)/usr/include -L$(SYSBASE)/usr/lib)) \
+ $(if $(filter MACOSX,$(OS)),--prefix=/@.__________________________________________________OOO) \
+ && $(MAKE) build_libs \
+ CC="$(CC) -fPIC $(if $(filter-out WNT,$(OS)),\
+ $(if $(filter TRUE,$(HAVE_GCC_VISIBILITY_FEATURE)),\
+ -fvisibility=hidden))" \
+ )
+endif
+# vim: set noet sw=4 ts=4:
diff --git a/external/openssl/Makefile b/external/openssl/Makefile
new file mode 100644
index 000000000000..e4968cf85fb6
--- /dev/null
+++ b/external/openssl/Makefile
@@ -0,0 +1,7 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+
+module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))
+
+include $(module_directory)/../../solenv/gbuild/partial_build.mk
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/openssl/Module_openssl.mk b/external/openssl/Module_openssl.mk
new file mode 100644
index 000000000000..698aa071021f
--- /dev/null
+++ b/external/openssl/Module_openssl.mk
@@ -0,0 +1,20 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_Module_Module,openssl))
+
+ifeq ($(SYSTEM_OPENSSL),NO)
+$(eval $(call gb_Module_add_targets,openssl,\
+ UnpackedTarball_openssl \
+ ExternalPackage_openssl \
+ ExternalProject_openssl \
+))
+endif
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/openssl/README b/external/openssl/README
new file mode 100644
index 000000000000..399bdd56fded
--- /dev/null
+++ b/external/openssl/README
@@ -0,0 +1,7 @@
+Open Source toolkit implementing SSL and TLS.
+
+From [http://www.openssl.org/].
+
+SSL = Secure Sockets Layer (SSL v2/v3) protocol.
+TLS = Transport Layer Security (TLS v1) protocol.
+
diff --git a/external/openssl/UnpackedTarball_openssl.mk b/external/openssl/UnpackedTarball_openssl.mk
new file mode 100644
index 000000000000..cec09d28f5e9
--- /dev/null
+++ b/external/openssl/UnpackedTarball_openssl.mk
@@ -0,0 +1,101 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_UnpackedTarball_UnpackedTarball,openssl))
+
+$(eval $(call gb_UnpackedTarball_set_tarball,openssl,$(OPENSSL_TARBALL),,openssl))
+
+# hack to fix symlinks with MSVC
+$(eval $(call gb_UnpackedTarball_fix_end_of_line,openssl,\
+ include/openssl/aes.h \
+ include/openssl/asn1.h \
+ include/openssl/asn1_mac.h \
+ include/openssl/asn1t.h \
+ include/openssl/bio.h \
+ include/openssl/blowfish.h \
+ include/openssl/bn.h \
+ include/openssl/buffer.h \
+ include/openssl/camellia.h \
+ include/openssl/cast.h \
+ include/openssl/cmac.h \
+ include/openssl/cms.h \
+ include/openssl/comp.h \
+ include/openssl/conf.h \
+ include/openssl/conf_api.h \
+ include/openssl/crypto.h \
+ include/openssl/des.h \
+ include/openssl/des_old.h \
+ include/openssl/dh.h \
+ include/openssl/dsa.h \
+ include/openssl/dso.h \
+ include/openssl/dtls1.h \
+ include/openssl/e_os2.h \
+ include/openssl/ebcdic.h \
+ include/openssl/ec.h \
+ include/openssl/ecdh.h \
+ include/openssl/ecdsa.h \
+ include/openssl/engine.h \
+ include/openssl/err.h \
+ include/openssl/evp.h \
+ include/openssl/hmac.h \
+ include/openssl/idea.h \
+ include/openssl/krb5_asn.h \
+ include/openssl/kssl.h \
+ include/openssl/lhash.h \
+ include/openssl/md4.h \
+ include/openssl/md5.h \
+ include/openssl/mdc2.h \
+ include/openssl/modes.h \
+ include/openssl/obj_mac.h \
+ include/openssl/objects.h \
+ include/openssl/ocsp.h \
+ include/openssl/opensslconf.h \
+ include/openssl/opensslv.h \
+ include/openssl/ossl_typ.h \
+ include/openssl/pem.h \
+ include/openssl/pem2.h \
+ include/openssl/pkcs12.h \
+ include/openssl/pkcs7.h \
+ include/openssl/pqueue.h \
+ include/openssl/rand.h \
+ include/openssl/rc2.h \
+ include/openssl/rc4.h \
+ include/openssl/ripemd.h \
+ include/openssl/rsa.h \
+ include/openssl/safestack.h \
+ include/openssl/seed.h \
+ include/openssl/sha.h \
+ include/openssl/srp.h \
+ include/openssl/srtp.h \
+ include/openssl/ssl.h \
+ include/openssl/ssl2.h \
+ include/openssl/ssl23.h \
+ include/openssl/ssl3.h \
+ include/openssl/stack.h \
+ include/openssl/symhacks.h \
+ include/openssl/tls1.h \
+ include/openssl/ts.h \
+ include/openssl/txt_db.h \
+ include/openssl/ui.h \
+ include/openssl/ui_compat.h \
+ include/openssl/whrlpool.h \
+ include/openssl/x509.h \
+ include/openssl/x509_vfy.h \
+ include/openssl/x509v3.h \
+))
+
+$(eval $(call gb_UnpackedTarball_add_patches,openssl,\
+ $(if $(filter LINUX FREEBSD ANDROID,$(OS)),external/openssl/openssllnx.patch) \
+ $(if $(filter WNTGCC,$(OS)$(COM)),external/openssl/opensslmingw.patch) \
+ $(if $(filter MSC,$(COM)),external/openssl/opensslwnt.patch) \
+ $(if $(filter SOLARIS,$(OS)),external/openssl/opensslsol.patch) \
+ $(if $(filter IOS,$(OS)),external/openssl/opensslios.patch) \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/openssl/opensslios.patch b/external/openssl/opensslios.patch
new file mode 100644
index 000000000000..e3e1c218432f
--- /dev/null
+++ b/external/openssl/opensslios.patch
@@ -0,0 +1,12 @@
+--- misc/openssl-0.9.8v/Configure
++++ build/openssl-0.9.8v/Configure
+@@ -530,6 +530,9 @@
+ # iPhoneOS/iOS
+ "iphoneos-cross","llvm-gcc:-O3 -isysroot \$(CROSS_TOP)/SDKs/\$(CROSS_SDK) -fomit-frame-pointer -fno-common::-D_REENTRANT:iOS:-Wl,-search_paths_first%:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}:dlfcn:darwin-shared:-fPIC -fno-common:-dynamiclib:.\$(SHLIB_MAJOR).\$(SHLIB_MINOR).dylib",
+
++##### iOS in the LibreOffice case
++"ios-armv7","gcc:-O3 -fomit-frame-pointer -DL_ENDIAN:::IOS::BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}:::::",
++
+ ##### A/UX
+ "aux3-gcc","gcc:-O2 -DTERMIO::(unknown):AUX:-lbsd:RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:::",
+
diff --git a/external/openssl/openssllnx.patch b/external/openssl/openssllnx.patch
new file mode 100644
index 000000000000..23a7d9e4c228
--- /dev/null
+++ b/external/openssl/openssllnx.patch
@@ -0,0 +1,23 @@
+--- build/openssl-0.9.8v/Configure-old 2010-04-17 13:51:42.000000000 +0200
++++ build/openssl-0.9.8v/Configure 2010-04-17 13:52:03.000000000 +0200
+@@ -388,6 +388,9 @@
+
+ "bsdi-elf-gcc", "gcc:-DPERL5 -DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -Wall::(unknown)::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+
++"debian-kfreebsd-amd64","gcc:-m64 -DL_ENDIAN -DTERMIOS -O3 -Wa,--noexecstack -Wall -DMD32_REG_T=int::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK BF_PTR2 DES_INT DES_UNROLL:${x86_64_asm}:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
++"debian-kfreebsd-i386","gcc:-DL_ENDIAN -DTERMIOS -O3 -Wa,--noexecstack -g -march=i486 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
++
+ "nextstep", "cc:-O -Wall:<libc.h>:(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:::",
+ "nextstep3.3", "cc:-O3 -Wall:<libc.h>:(unknown):::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:::",
+
+--- build/openssl-0.9.8v/Makefile.org 2010-01-27 17:06:36.000000000 +0100
++++ build/openssl-0.9.8v/Makefile.org 2010-09-20 09:24:00.000000000 +0100
+@@ -199,7 +199,7 @@
+
+ BUILDENV= PLATFORM='$(PLATFORM)' PROCESSOR='$(PROCESSOR)' \
+ CC='$(CC)' CFLAG='$(CFLAG)' \
+- AS='$(CC)' ASFLAG='$(CFLAG) -c' \
++ AS='$(CC)' ASFLAG='$(CFLAG) -c -Wa,--noexecstack' \
+ AR='$(AR)' NM='$(NM)' RANLIB='$(RANLIB)' \
+ CROSS_COMPILE='$(CROSS_COMPILE)' \
+ PERL='$(PERL)' ENGDIRS='$(ENGDIRS)' \
diff --git a/external/openssl/opensslmingw.patch b/external/openssl/opensslmingw.patch
new file mode 100644
index 000000000000..e0dc96029d6b
--- /dev/null
+++ b/external/openssl/opensslmingw.patch
@@ -0,0 +1,109 @@
+--- misc/openssl-0.9.8v/Makefile.shared 2008-09-17 17:56:40.000000000 +0200
++++ misc/build/openssl-0.9.8v/Makefile.shared 2009-03-30 11:52:53.684538000 +0200
+@@ -254,13 +254,17 @@
+ base=-Wl,--enable-auto-image-base; \
+ if expr $(PLATFORM) : 'mingw' > /dev/null; then \
+ SHLIB=$(LIBNAME)eay32; \
+- base=; [ $(LIBNAME) = "crypto" ] && base=-Wl,--image-base,0x63000000; \
++ base=; \
++ if test $(LIBNAME) = "crypto"; then \
++ SHLIB=libeay32; \
++ base=-Wl,--image-base,0x63000000; \
++ fi; \
+ fi; \
+ SHLIB_SUFFIX=.dll; \
+- SHLIB_SOVER=-$(LIBVERSION); \
++ SHLIB_SOVER=; \
+ ALLSYMSFLAGS='-Wl,--whole-archive'; \
+ NOALLSYMSFLAGS='-Wl,--no-whole-archive'; \
+- SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared $$base -Wl,-Bsymbolic -Wl,--out-implib,lib$(LIBNAME).dll.a"; \
++ SHAREDFLAGS="$(CFLAGS) $(SHARED_LDFLAGS) -shared $$base -Wl,-Bsymbolic -Wl,--export-all-symbols -Wl,--out-implib,lib$(LIBNAME).dll.a"; \
+ [ -f apps/$$SHLIB$$SHLIB_SUFFIX ] && rm apps/$$SHLIB$$SHLIB_SUFFIX; \
+ [ -f test/$$SHLIB$$SHLIB_SUFFIX ] && rm test/$$SHLIB$$SHLIB_SUFFIX; \
+ $(LINK_SO_A) || exit 1; \
+--- misc/openssl-0.9.8v/e_os2.h 2005-12-19 03:57:07.000000000 +0900
++++ misc/build/openssl-0.9.8v/e_os2.h 2009-04-04 23:07:15.324250000 +0900
+@@ -264,7 +264,7 @@
+ # define OPENSSL_IMPLEMENT_GLOBAL(type,name) \
+ extern type _hide_##name; \
+ type *_shadow_##name(void) { return &_hide_##name; } \
+- static type _hide_##name
++ type _hide_##name
+ # define OPENSSL_DECLARE_GLOBAL(type,name) type *_shadow_##name(void)
+ # define OPENSSL_GLOBAL_REF(name) (*(_shadow_##name()))
+ #else
+--- misc/openssl-0.9.8v/ms/mingw32.bat 2006-05-05 15:19:32.000000000 +0200
++++ misc/build/openssl-0.9.8v/ms/mingw32.bat 2009-03-30 11:54:10.000000000 +0200
+@@ -79,15 +79,41 @@
+ rem copy ms\tlhelp32.h outinc
+
+ echo Building the libraries
+-mingw32-make -f ms/mingw32a.mak
++make -f ms/mingw32a.mak
+ if errorlevel 1 goto end
+
+ echo Generating the DLLs and input libraries
+-dllwrap --dllname libeay32.dll --output-lib out/libeay32.a --def ms/libeay32.def out/libcrypto.a -lwsock32 -lgdi32
++mv out/libcrypto.a out/libcrypto_static.a
++mv out/libssl.a out/libssl_static.a
++dlltool --dllname libeay32.dll --output-lib out/libcrypto.a --input-def ms/libeay32.def
+ if errorlevel 1 goto end
+-dllwrap --dllname libssl32.dll --output-lib out/libssl32.a --def ms/ssleay32.def out/libssl.a out/libeay32.a
++gcc --shared --enable-pseudo-reloc -Wl,-Map,out/libeay32.map ms/libeay32.def -o out/libeay32.dll out/libcrypto_static.a -lwsock32 -lgdi32
+ if errorlevel 1 goto end
++dlltool --dllname ssleay32.dll --output-lib out/libssl.a --input-def ms/ssleay32.def
++if errorlevel 1 goto end
++if "%MINGW_SHARED_GXXLIB%"=="YES" goto shared_gxxlib
++if "%MINGW_SHARED_GCCLIB%"=="YES" goto shared_gcclib
++gcc --shared --enable-pseudo-reloc -Wl,-Map,out/libeay32.map ms/libeay32.def -o out/libeay32.dll out/libcrypto_static.a -lwsock32 -lgdi32
++if errorlevel 1 goto end
++gcc --shared --enable-pseudo-reloc -Wl,-Map,out/ssleay32.map -Lout ms/ssleay32.def -o out/ssleay32.dll out/libssl_static.a -lcrypto
++if errorlevel 1 goto end
++goto finished
++
++:shared_gcclib
++gcc --shared -shared-libgcc --enable-pseudo-reloc -Wl,-Map,out/libeay32.map ms/libeay32.def -o out/libeay32.dll out/libcrypto_static.a -lwsock32 -lgdi32
++if errorlevel 1 goto end
++gcc --shared -shared-libgcc --enable-pseudo-reloc -Wl,-Map,out/ssleay32.map -Lout ms/ssleay32.def -o out/ssleay32.dll out/libssl_static.a -lcrypto
++if errorlevel 1 goto end
++goto finished
++
++:shared_gxxlib
++gcc --shared -shared-libgcc --enable-pseudo-reloc -Wl,-Map,out/libeay32.map ms/libeay32.def -o out/libeay32.dll out/libcrypto_static.a -lwsock32 -lgdi32 %MINGW_SHARED_LIBSTDSPP%
++if errorlevel 1 goto end
++gcc --shared -shared-libgcc --enable-pseudo-reloc -Wl,-Map,out/ssleay32.map -Lout ms/ssleay32.def -o out/ssleay32.dll out/libssl_static.a -lcrypto %MINGW_SHARED_LIBSTDSPP%
++if errorlevel 1 goto end
++goto finished
+
++:finished
+ echo Done compiling OpenSSL
+
+ :end
+--- misc/openssl-0.9.8v/util/pl/Mingw32.pl 2006-05-05 15:19:34.000000000 +0200
++++ misc/build/openssl-0.9.8v/util/pl/Mingw32.pl 2009-03-30 11:55:04.000000000 +0200
+@@ -6,11 +6,11 @@
+ $o='/';
+ $cp='cp';
+ $rm='rm -f';
+-$mkdir='gmkdir';
++#$mkdir='gmkdir';
+
+-$o='\\';
+-$cp='copy';
+-$rm='del';
++#$o='\\';
++#$cp='copy';
++#$rm='del';
+ $mkdir='mkdir';
+
+ # C compiler stuff
+@@ -87,7 +87,8 @@
+ ($Name=$name) =~ tr/a-z/A-Z/;
+
+ $ret.="$target: \$(${Name}OBJ)\n";
+- $ret.="\tif exist $target \$(RM) $target\n";
++ $ret.="\t\$(RM) $target\n";
++# $ret.="\tif exist $target \$(RM) $target\n";
+ $ret.="\t\$(MKLIB) $target \$(${Name}OBJ)\n";
+ $ret.="\t\$(RANLIB) $target\n\n";
+ }
diff --git a/external/openssl/opensslsol.patch b/external/openssl/opensslsol.patch
new file mode 100644
index 000000000000..a22dc05cee39
--- /dev/null
+++ b/external/openssl/opensslsol.patch
@@ -0,0 +1,81 @@
+--- misc/openssl-0.9.8v/Configure Mon Nov 9 15:14:26 2009
++++ build/openssl-0.9.8v/Configure Fri Mar 26 16:01:32 2010
+@@ -212,8 +212,8 @@
+ "solaris64-x86_64-gcc","gcc:-m64 -O3 -Wall -DL_ENDIAN -DMD32_REG_T=int::-D_REENTRANT::-lsocket -lnsl -ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:dlfcn:solaris-shared:-fPIC:-m64 -shared -static-libgcc:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+
+ #### Solaris x86 with Sun C setups
+-"solaris-x86-cc","cc:-fast -O -Xa::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_UNROLL BF_PTR:${no_asm}:dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+-"solaris64-x86_64-cc","cc:-fast -xarch=amd64 -xstrconst -Xa -DL_ENDIAN::-D_REENTRANT::-lsocket -lnsl -ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:dlfcn:solaris-shared:-KPIC:-xarch=amd64 -G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
++"solaris-x86-cc","cc:-O -Xa::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_PTR DES_UNROLL BF_PTR:${no_asm}:dlfcn:solaris-shared:-KPIC:-G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
++"solaris64-x86_64-cc","cc:-xarch=amd64 -xstrconst -Xa -DL_ENDIAN::-D_REENTRANT::-lsocket -lnsl -ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK BF_PTR2 DES_INT DES_UNROLL:${x86_64_asm}:dlfcn:solaris-shared:-KPIC:-xarch=amd64 -G -dy -z text:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+
+ #### SPARC Solaris with GNU C setups
+ "solaris-sparcv7-gcc","gcc:-O3 -fomit-frame-pointer -Wall -DB_ENDIAN -DBN_DIV2W::-D_REENTRANT::-lsocket -lnsl -ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL BF_PTR:${no_asm}:dlfcn:solaris-shared:-fPIC:-shared:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+--- misc/openssl-0.9.8v/Makefile.shared Wed Sep 17 17:56:40 2008
++++ build/openssl-0.9.8v/Makefile.shared Fri Mar 26 16:04:41 2010
+@@ -93,7 +93,7 @@
+ LDCMD="$${LDCMD:-$(CC)}"; LDFLAGS="$${LDFLAGS:-$(CFLAGS)}"; \
+ LIBPATH=`for x in $$LIBDEPS; do if echo $$x | grep '^ *-L' > /dev/null 2>&1; then echo $$x | sed -e 's/^ *-L//'; fi; done | uniq`; \
+ LIBPATH=`echo $$LIBPATH | sed -e 's/ /:/g'`; \
+- LD_LIBRARY_PATH=$$LIBPATH:$$LD_LIBRARY_PATH \
++ LD_LIBRARY_PATH=$$LD_LIBRARY_PATH \
+ $${LDCMD} $${LDFLAGS} -o $${APPNAME:=$(APPNAME)} $(OBJECTS) $${LIBDEPS} )
+
+ LINK_SO= \
+@@ -103,7 +103,7 @@
+ SHAREDFLAGS="$${SHAREDFLAGS:-$(CFLAGS) $(SHARED_LDFLAGS)}"; \
+ LIBPATH=`for x in $$LIBDEPS; do if echo $$x | grep '^ *-L' > /dev/null 2>&1; then echo $$x | sed -e 's/^ *-L//'; fi; done | uniq`; \
+ LIBPATH=`echo $$LIBPATH | sed -e 's/ /:/g'`; \
+- LD_LIBRARY_PATH=$$LIBPATH:$$LD_LIBRARY_PATH \
++ LD_LIBRARY_PATH=$$LD_LIBRARY_PATH \
+ $${SHAREDCMD} $${SHAREDFLAGS} \
+ -o $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX \
+ $$ALLSYMSFLAGS $$SHOBJECTS $$NOALLSYMSFLAGS $$LIBDEPS \
+--- misc/openssl-0.9.8v/config Tue Mar 9 18:08:24 2010
++++ build/openssl-0.9.8v/config Fri Mar 26 16:07:55 2010
+@@ -399,28 +399,25 @@
+ # this is where the translation occurs into SSLeay terms
+ # ---------------------------------------------------------------------------
+
+-GCCVER=`(gcc -dumpversion) 2>/dev/null`
+-if [ "$GCCVER" != "" ]; then
+- # then strip off whatever prefix egcs prepends the number with...
+- # Hopefully, this will work for any future prefixes as well.
+- GCCVER=`echo $GCCVER | LC_ALL=C sed 's/^[a-zA-Z]*\-//'`
+- # Since gcc 3.1 gcc --version behaviour has changed. gcc -dumpversion
+- # does give us what we want though, so we use that. We just just the
+- # major and minor version numbers.
+- # peak single digit before and after first dot, e.g. 2.95.1 gives 29
+- GCCVER=`echo $GCCVER | sed 's/\([0-9]\)\.\([0-9]\).*/\1\2/'`
++if [ -z "$CC" ];then
++ GCCVER=`(gcc -dumpversion) 2>/dev/null`
++ if [ "$GCCVER" != "" ]; then
++ CC=gcc
++ # then strip off whatever prefix egcs prepends the number with...
++ # Hopefully, this will work for any future prefixes as well.
++ GCCVER=`echo $GCCVER | LC_ALL=C sed 's/^[a-zA-Z]*\-//'`
++ # Since gcc 3.1 gcc --version behaviour has changed. gcc -dumpversion
++ # does give us what we want though, so we use that. We just just the
++ # major and minor version numbers.
++ # peak single digit before and after first dot, e.g. 2.95.1 gives 29
++ GCCVER=`echo $GCCVER | sed 's/\([0-9]\)\.\([0-9]\).*/\1\2/'`
++ else
++ CC=cc
++ fi
++else
++ CC=`echo $CC | sed 's/^[^ ]*\/\(..\).*/\1/'`
+ fi
+
+-# Only set CC if not supplied already
+-if [ -z "$CC" ]; then
+-# figure out if gcc is available and if so we use it otherwise
+-# we fallback to whatever cc does on the system
+- if [ "$GCCVER" != "" ]; then
+- CC=gcc
+- else
+- CC=cc
+- fi
+-fi
+ GCCVER=${GCCVER:-0}
+ if [ "$SYSTEM" = "HP-UX" ];then
+ # By default gcc is a ILP32 compiler (with long long == 64).
diff --git a/external/openssl/opensslwnt.patch b/external/openssl/opensslwnt.patch
new file mode 100644
index 000000000000..b68e03715f2a
--- /dev/null
+++ b/external/openssl/opensslwnt.patch
@@ -0,0 +1,154 @@
+--- misc/openssl-0.9.8v/crypto/x509v3/v3_pci.c 2007-03-05 01:06:47.000000000 +0100
++++ build/openssl-0.9.8v/crypto/x509v3/v3_pci.c 2010-03-26 12:04:20.961547300 +0100
+@@ -2,7 +2,7 @@
+ /* Contributed to the OpenSSL Project 2004
+ * by Richard Levitte (richard@levitte.org)
+ */
+-/* Copyright (c) 2004 Kungliga Tekniska Högskolan
++/* Copyright (c) 2004 Kungliga Tekniska Hoegskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+--- misc/openssl-0.9.8v/crypto/x509v3/v3_pcia.c 2004-12-28 01:21:33.000000000 +0100
++++ build/openssl-0.9.8v/crypto/x509v3/v3_pcia.c 2010-03-26 12:04:20.961547300 +0100
+@@ -2,7 +2,7 @@
+ /* Contributed to the OpenSSL Project 2004
+ * by Richard Levitte (richard@levitte.org)
+ */
+-/* Copyright (c) 2004 Kungliga Tekniska Högskolan
++/* Copyright (c) 2004 Kungliga Tekniska Hoegskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+--- misc/openssl-0.9.8v/ms/do_ms.bat 2009-07-28 14:51:19.000000000 +0200
++++ build/openssl-0.9.8v/ms/do_ms.bat 2010-03-26 12:19:19.399047300 +0100
+@@ -1,11 +1,11 @@
+
+-perl util\mkfiles.pl >MINFO
+-perl util\mk1mf.pl no-asm VC-WIN32 >ms\nt.mak
+-perl util\mk1mf.pl dll no-asm VC-WIN32 >ms\ntdll.mak
++%1 util\mkfiles.pl >MINFO
++if %2 == VC-WIN32 goto not64a
++perl ms\uplink.pl win64a > ms\uptable.asm
++ml64 -c -Foms\uptable.obj ms\uptable.asm
++:not64a
++%1 util\mk1mf.pl no-asm %2 >ms\nt.mak
++%1 util\mk1mf.pl dll no-asm %2 >ms\ntdll.mak
+-if x%OSVERSION% == x goto skipce
+-perl util\mk1mf.pl no-asm VC-CE >ms\ce.mak
+-perl util\mk1mf.pl dll no-asm VC-CE >ms\cedll.mak
+-:skipce
+
+-perl util\mkdef.pl 32 libeay > ms\libeay32.def
+-perl util\mkdef.pl 32 ssleay > ms\ssleay32.def
++%1 util\mkdef.pl 32 libeay > ms\libeay32.def
++%1 util\mkdef.pl 32 ssleay > ms\ssleay32.def
+--- misc/openssl-0.9.8v/util/mk1mf.pl 2009-09-20 14:46:42.000000000 +0200
++++ build/openssl-0.9.8v/util/mk1mf.pl 2010-03-26 12:04:20.977172300 +0100
+@@ -128,7 +128,7 @@
+ $inc_def="outinc";
+ $tmp_def="tmp";
+
+-$perl="perl" unless defined $perl;
++$perl="$ENV{PERL}" unless defined $perl;
+ $mkdir="-mkdir" unless defined $mkdir;
+
+ ($ssl,$crypto)=("ssl","crypto");
+@@ -290,6 +290,11 @@
+ chop;
+
+ ($key,$val)=/^([^=]+)=(.*)/;
++
++ # On some Windows machines, $val has linefeeds at the end, which confuses
++ # subsequent code in this file. So we strip all whitespace at the end.
++ $val =~ s/\s+$//;
++
+ if ($key eq "RELATIVE_DIRECTORY")
+ {
+ if ($lib ne "")
+@@ -529,7 +529,7 @@
+ # Set your compiler options
+ PLATFORM=$platform
+ CC=$bin_dir${cc}
+-CFLAG=$cflags
++CFLAG=$cflags \$(SOLARINC)
+ APP_CFLAG=$app_cflag
+ LIB_CFLAG=$lib_cflag
+ SHLIB_CFLAG=$shl_cflag
+@@ -544,7 +544,7 @@
+
+ LINK=$link
+ LFLAGS=$lflags
+-RSC=$rsc
++RSC=$rsc \$(SOLARINC)
+
+ # The output directory for everything intersting
+ OUT_D=$out_dir
+@@ -730,7 +735,7 @@
+ printf OUT <<EOF;
+ #ifdef $platform_cpp_symbol
+ /* auto-generated/updated by util/mk1mf.pl for crypto/cversion.c */
+- #define CFLAGS "$cc $cflags"
++ #define CFLAGS "$cflags"
+ #define PLATFORM "$platform"
+ EOF
+ printf OUT " #define DATE \"%s\"\n", scalar gmtime();
+--- misc/openssl-0.9.8v/util/pl/VC-32.pl 2010-02-04 02:10:24.000000000 +0100
++++ build/openssl-0.9.8v/util/pl/VC-32.pl 2010-03-26 12:04:20.977172300 +0100
+@@ -32,7 +32,7 @@
+ $l_flags =~ s/-L(\S+)/\/libpath:$1/g;
+
+ # C compiler stuff
+-$cc='cl';
++$cc=$ENV{'CC'};
+ if ($FLAVOR =~ /WIN64/)
+ {
+ # Note that we currently don't have /WX on Win64! There is a lot of
+@@ -103,21 +103,21 @@
+ }
+
+ $cc='$(CC)';
+- $base_cflags=' /W3 /WX /GF /Gy /nologo -DUNICODE -D_UNICODE -DOPENSSL_SYSNAME_WINCE -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DDSO_WIN32 -DNO_CHMOD -DOPENSSL_SMALL_FOOTPRINT';
++ $base_cflags=' -W3 -GF -Gy -nologo -DUNICODE -D_UNICODE -DOPENSSL_SYSNAME_WINCE -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DDSO_WIN32 -DNO_CHMOD -DOPENSSL_SMALL_FOOTPRINT';
+ $base_cflags.=" $wcecdefs";
+ $base_cflags.=' -I$(WCECOMPAT)/include' if (defined($ENV{'WCECOMPAT'}));
+ $base_cflags.=' -I$(PORTSDK_LIBPATH)/../../include' if (defined($ENV{'PORTSDK_LIBPATH'}));
+- $opt_cflags=' /MC /O1i'; # optimize for space, but with intrinsics...
+- $dbg_cflags=' /MC /Od -DDEBUG -D_DEBUG';
++ $opt_cflags=' -MC -O1i'; # optimize for space, but with intrinsics...
++ $dbg_cflags=' -MC -Od -DDEBUG -D_DEBUG';
+ $lflags="/nologo /opt:ref $wcelflag";
+ }
+ else # Win32
+ {
+- $base_cflags= " $mf_cflag";
++ $base_cflags= " $mf_cflag";
+- my $f = $shlib || $fips ?' /MD':' /MT';
+- $lib_cflag='/Zl' if (!$shlib); # remove /DEFAULTLIBs from static lib
+- $opt_cflags=$f.' /Ox /O2 /Ob2';
+- $dbg_cflags=$f.'d /Od -DDEBUG -D_DEBUG';
++ my $f = $shlib || $fips ? (($ENV{MSVC_USE_DEBUG_RUNTIME} eq "TRUE") ? ' -MDd' : ' -MD' ):' -MT';
++ $lib_cflag='-Zl' if (!$shlib); # remove /DEFAULTLIBs from static lib
++ $opt_cflags=$f.' -Ox -O2 -Ob2';
++ $dbg_cflags=$f.'d -Od -DDEBUG -D_DEBUG';
+ $lflags="/nologo /subsystem:console /opt:ref";
+ }
+ $mlflags='';
+@@ -138,7 +138,7 @@
+
+ $obj='.obj';
+ $asm_suffix='.asm';
+-$ofile="/Fo";
++$ofile="-Fo.\\";
+
+ # EXE linking stuff
+ $link="link";
+--- build/openssl-0.9.8v/ms/uplink.c
++++ build/openssl-0.9.8v/ms/uplink.c
+@@ -1,5 +1,6 @@
+ #if (defined(_WIN64) || defined(_WIN32_WCE)) && !defined(UNICODE)
+ #define UNICODE
++#define _CRT_NON_CONFORMING_SWPRINTFS
+ #endif
+ #if defined(UNICODE) && !defined(_UNICODE)
+ #define _UNICODE