diff --git a/src/openssl-1-fixes.patch b/src/openssl-1-fixes.patch index 6f6a51b7..a1ad345d 100644 --- a/src/openssl-1-fixes.patch +++ b/src/openssl-1-fixes.patch @@ -4,7 +4,7 @@ See index.html for further information. From 1ac04c802cf192e09bcfad270a39030fb23bcdb1 Mon Sep 17 00:00:00 2001 From: Mark Brand Date: Wed, 8 Jan 2014 02:19:10 +0100 -Subject: [PATCH 1/2] winsock2 +Subject: [PATCH 1/4] winsock2 -This patch has been taken from: -http://rt.openssl.org/Ticket/Display.html?id=2285&user=guest&pass=guest @@ -36,13 +36,13 @@ index 0113b65..53114fd 100644 # include OPENSSL_UNISTD #endif -- -2.1.2 +2.1.4 From 564e3c9850584b3dd57b9ffba85574dbfcf6910b Mon Sep 17 00:00:00 2001 From: Tom Molesworth Date: Wed, 8 Jan 2014 02:20:21 +0100 -Subject: [PATCH 2/2] Patch OpenSSL POD docs for perl-5.16+ +Subject: [PATCH 2/4] Patch OpenSSL POD docs for perl-5.16+ Stricter validation in recent Perl versions means the install stage fails without these applied. @@ -607,5 +607,380 @@ index a57617f..70c1630 100644 The write operation was not successful, because either an error occurred or action must be taken by the calling process. Call SSL_get_error() with the -- -2.1.2 +2.1.4 + + +From 16571202bd510cd4f01a1b9cc28215124f489de2 Mon Sep 17 00:00:00 2001 +From: Mark Brand +Date: Fri, 30 Jan 2015 13:55:40 +0100 +Subject: [PATCH 3/4] add FindOpenSSL.cmake + + +diff --git a/FindOpenSSL.cmake b/FindOpenSSL.cmake +new file mode 100644 +index 0000000..340b417 +--- /dev/null ++++ b/FindOpenSSL.cmake +@@ -0,0 +1,334 @@ ++#.rst: ++# FindOpenSSL ++# ----------- ++# ++# Try to find the OpenSSL encryption library ++# ++# Once done this will define ++# ++# :: ++# ++# OPENSSL_ROOT_DIR - Set this variable to the root installation of OpenSSL ++# ++# ++# ++# Read-Only variables: ++# ++# :: ++# ++# OPENSSL_FOUND - system has the OpenSSL library ++# OPENSSL_INCLUDE_DIR - the OpenSSL include directory ++# OPENSSL_LIBRARIES - The libraries needed to use OpenSSL ++# OPENSSL_VERSION - This is set to $major.$minor.$revision$path (eg. 0.9.8s) ++ ++#============================================================================= ++# Copyright 2006-2009 Kitware, Inc. ++# Copyright 2006 Alexander Neundorf ++# Copyright 2009-2011 Mathieu Malaterre ++# ++# Distributed under the OSI-approved BSD License (the "License"); ++# see accompanying file Copyright.txt for details. ++# ++# This software is distributed WITHOUT ANY WARRANTY; without even the ++# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ++# See the License for more information. ++#============================================================================= ++# (To distribute this file outside of CMake, substitute the full ++# License text for the above reference.) ++ ++if (UNIX) ++ find_package(PkgConfig QUIET) ++ pkg_check_modules(_OPENSSL QUIET openssl) ++endif () ++ ++if (WIN32) ++ # http://www.slproweb.com/products/Win32OpenSSL.html ++ set(_OPENSSL_ROOT_HINTS ++ ${OPENSSL_ROOT_DIR} ++ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;Inno Setup: App Path]" ++ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (64-bit)_is1;Inno Setup: App Path]" ++ ENV OPENSSL_ROOT_DIR ++ ) ++ file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _programfiles) ++ set(_OPENSSL_ROOT_PATHS ++ "${_programfiles}/OpenSSL" ++ "${_programfiles}/OpenSSL-Win32" ++ "${_programfiles}/OpenSSL-Win64" ++ "C:/OpenSSL/" ++ "C:/OpenSSL-Win32/" ++ "C:/OpenSSL-Win64/" ++ ) ++ unset(_programfiles) ++else () ++ set(_OPENSSL_ROOT_HINTS ++ ${OPENSSL_ROOT_DIR} ++ ENV OPENSSL_ROOT_DIR ++ ) ++endif () ++ ++set(_OPENSSL_ROOT_HINTS_AND_PATHS ++ HINTS ${_OPENSSL_ROOT_HINTS} ++ PATHS ${_OPENSSL_ROOT_PATHS} ++ ) ++ ++find_path(OPENSSL_INCLUDE_DIR ++ NAMES ++ openssl/ssl.h ++ ${_OPENSSL_ROOT_HINTS_AND_PATHS} ++ HINTS ++ ${_OPENSSL_INCLUDEDIR} ++ PATH_SUFFIXES ++ include ++) ++ ++if(WIN32 AND NOT CYGWIN) ++ if(MSVC) ++ # /MD and /MDd are the standard values - if someone wants to use ++ # others, the libnames have to change here too ++ # use also ssl and ssleay32 in debug as fallback for openssl < 0.9.8b ++ # TODO: handle /MT and static lib ++ # In Visual C++ naming convention each of these four kinds of Windows libraries has it's standard suffix: ++ # * MD for dynamic-release ++ # * MDd for dynamic-debug ++ # * MT for static-release ++ # * MTd for static-debug ++ ++ # Implementation details: ++ # We are using the libraries located in the VC subdir instead of the parent directory eventhough : ++ # libeay32MD.lib is identical to ../libeay32.lib, and ++ # ssleay32MD.lib is identical to ../ssleay32.lib ++ find_library(LIB_EAY_DEBUG ++ NAMES ++ libeay32MDd ++ libeay32d ++ ${_OPENSSL_ROOT_HINTS_AND_PATHS} ++ PATH_SUFFIXES ++ "lib" ++ "VC" ++ "lib/VC" ++ ) ++ ++ find_library(LIB_EAY_RELEASE ++ NAMES ++ libeay32MD ++ libeay32 ++ ${_OPENSSL_ROOT_HINTS_AND_PATHS} ++ PATH_SUFFIXES ++ "lib" ++ "VC" ++ "lib/VC" ++ ) ++ ++ find_library(SSL_EAY_DEBUG ++ NAMES ++ ssleay32MDd ++ ssleay32d ++ ${_OPENSSL_ROOT_HINTS_AND_PATHS} ++ PATH_SUFFIXES ++ "lib" ++ "VC" ++ "lib/VC" ++ ) ++ ++ find_library(SSL_EAY_RELEASE ++ NAMES ++ ssleay32MD ++ ssleay32 ++ ssl ++ ${_OPENSSL_ROOT_HINTS_AND_PATHS} ++ PATH_SUFFIXES ++ "lib" ++ "VC" ++ "lib/VC" ++ ) ++ ++ set(LIB_EAY_LIBRARY_DEBUG "${LIB_EAY_DEBUG}") ++ set(LIB_EAY_LIBRARY_RELEASE "${LIB_EAY_RELEASE}") ++ set(SSL_EAY_LIBRARY_DEBUG "${SSL_EAY_DEBUG}") ++ set(SSL_EAY_LIBRARY_RELEASE "${SSL_EAY_RELEASE}") ++ ++ include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) ++ select_library_configurations(LIB_EAY) ++ select_library_configurations(SSL_EAY) ++ ++ mark_as_advanced(LIB_EAY_LIBRARY_DEBUG LIB_EAY_LIBRARY_RELEASE ++ SSL_EAY_LIBRARY_DEBUG SSL_EAY_LIBRARY_RELEASE) ++ set( OPENSSL_LIBRARIES ${SSL_EAY_LIBRARY} ${LIB_EAY_LIBRARY} ) ++ elseif(MINGW) ++ # same player, for MinGW ++ set(LIB_EAY_NAMES libeay32) ++ set(SSL_EAY_NAMES ssleay32) ++ if(CMAKE_CROSSCOMPILING) ++ list(APPEND LIB_EAY_NAMES crypto) ++ list(APPEND SSL_EAY_NAMES ssl) ++ endif() ++ find_library(LIB_EAY ++ NAMES ++ ${LIB_EAY_NAMES} ++ ${_OPENSSL_ROOT_HINTS_AND_PATHS} ++ PATH_SUFFIXES ++ "lib" ++ "lib/MinGW" ++ ) ++ ++ find_library(SSL_EAY ++ NAMES ++ ${SSL_EAY_NAMES} ++ ${_OPENSSL_ROOT_HINTS_AND_PATHS} ++ PATH_SUFFIXES ++ "lib" ++ "lib/MinGW" ++ ) ++ ++ mark_as_advanced(SSL_EAY LIB_EAY) ++ set( OPENSSL_LIBRARIES ${SSL_EAY} ${LIB_EAY} ) ++ unset(LIB_EAY_NAMES) ++ unset(SSL_EAY_NAMES) ++ else() ++ # Not sure what to pick for -say- intel, let's use the toplevel ones and hope someone report issues: ++ find_library(LIB_EAY ++ NAMES ++ libeay32 ++ ${_OPENSSL_ROOT_HINTS_AND_PATHS} ++ HINTS ++ ${_OPENSSL_LIBDIR} ++ PATH_SUFFIXES ++ lib ++ ) ++ ++ find_library(SSL_EAY ++ NAMES ++ ssleay32 ++ ${_OPENSSL_ROOT_HINTS_AND_PATHS} ++ HINTS ++ ${_OPENSSL_LIBDIR} ++ PATH_SUFFIXES ++ lib ++ ) ++ ++ mark_as_advanced(SSL_EAY LIB_EAY) ++ set( OPENSSL_LIBRARIES ${SSL_EAY} ${LIB_EAY} ) ++ endif() ++else() ++ ++ find_library(OPENSSL_SSL_LIBRARY ++ NAMES ++ ssl ++ ssleay32 ++ ssleay32MD ++ ${_OPENSSL_ROOT_HINTS_AND_PATHS} ++ HINTS ++ ${_OPENSSL_LIBDIR} ++ PATH_SUFFIXES ++ lib ++ ) ++ ++ find_library(OPENSSL_CRYPTO_LIBRARY ++ NAMES ++ crypto ++ ${_OPENSSL_ROOT_HINTS_AND_PATHS} ++ HINTS ++ ${_OPENSSL_LIBDIR} ++ PATH_SUFFIXES ++ lib ++ ) ++ ++ mark_as_advanced(OPENSSL_CRYPTO_LIBRARY OPENSSL_SSL_LIBRARY) ++ ++ # compat defines ++ set(OPENSSL_SSL_LIBRARIES ${OPENSSL_SSL_LIBRARY}) ++ set(OPENSSL_CRYPTO_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY}) ++ ++ set(OPENSSL_LIBRARIES ${OPENSSL_SSL_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY}) ++ ++endif() ++ ++function(from_hex HEX DEC) ++ string(TOUPPER "${HEX}" HEX) ++ set(_res 0) ++ string(LENGTH "${HEX}" _strlen) ++ ++ while (_strlen GREATER 0) ++ math(EXPR _res "${_res} * 16") ++ string(SUBSTRING "${HEX}" 0 1 NIBBLE) ++ string(SUBSTRING "${HEX}" 1 -1 HEX) ++ if (NIBBLE STREQUAL "A") ++ math(EXPR _res "${_res} + 10") ++ elseif (NIBBLE STREQUAL "B") ++ math(EXPR _res "${_res} + 11") ++ elseif (NIBBLE STREQUAL "C") ++ math(EXPR _res "${_res} + 12") ++ elseif (NIBBLE STREQUAL "D") ++ math(EXPR _res "${_res} + 13") ++ elseif (NIBBLE STREQUAL "E") ++ math(EXPR _res "${_res} + 14") ++ elseif (NIBBLE STREQUAL "F") ++ math(EXPR _res "${_res} + 15") ++ else() ++ math(EXPR _res "${_res} + ${NIBBLE}") ++ endif() ++ ++ string(LENGTH "${HEX}" _strlen) ++ endwhile() ++ ++ set(${DEC} ${_res} PARENT_SCOPE) ++endfunction() ++ ++if (OPENSSL_INCLUDE_DIR) ++ if (_OPENSSL_VERSION) ++ set(OPENSSL_VERSION "${_OPENSSL_VERSION}") ++ elseif(OPENSSL_INCLUDE_DIR AND EXISTS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h") ++ file(STRINGS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h" openssl_version_str ++ REGEX "^#define[\t ]+OPENSSL_VERSION_NUMBER[\t ]+0x([0-9a-fA-F])+.*") ++ ++ # The version number is encoded as 0xMNNFFPPS: major minor fix patch status ++ # The status gives if this is a developer or prerelease and is ignored here. ++ # Major, minor, and fix directly translate into the version numbers shown in ++ # the string. The patch field translates to the single character suffix that ++ # indicates the bug fix state, which 00 -> nothing, 01 -> a, 02 -> b and so ++ # on. ++ ++ string(REGEX REPLACE "^.*OPENSSL_VERSION_NUMBER[\t ]+0x([0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F]).*$" ++ "\\1;\\2;\\3;\\4;\\5" OPENSSL_VERSION_LIST "${openssl_version_str}") ++ list(GET OPENSSL_VERSION_LIST 0 OPENSSL_VERSION_MAJOR) ++ list(GET OPENSSL_VERSION_LIST 1 OPENSSL_VERSION_MINOR) ++ from_hex("${OPENSSL_VERSION_MINOR}" OPENSSL_VERSION_MINOR) ++ list(GET OPENSSL_VERSION_LIST 2 OPENSSL_VERSION_FIX) ++ from_hex("${OPENSSL_VERSION_FIX}" OPENSSL_VERSION_FIX) ++ list(GET OPENSSL_VERSION_LIST 3 OPENSSL_VERSION_PATCH) ++ ++ if (NOT OPENSSL_VERSION_PATCH STREQUAL "00") ++ from_hex("${OPENSSL_VERSION_PATCH}" _tmp) ++ # 96 is the ASCII code of 'a' minus 1 ++ math(EXPR OPENSSL_VERSION_PATCH_ASCII "${_tmp} + 96") ++ unset(_tmp) ++ # Once anyone knows how OpenSSL would call the patch versions beyond 'z' ++ # this should be updated to handle that, too. This has not happened yet ++ # so it is simply ignored here for now. ++ string(ASCII "${OPENSSL_VERSION_PATCH_ASCII}" OPENSSL_VERSION_PATCH_STRING) ++ endif () ++ ++ set(OPENSSL_VERSION "${OPENSSL_VERSION_MAJOR}.${OPENSSL_VERSION_MINOR}.${OPENSSL_VERSION_FIX}${OPENSSL_VERSION_PATCH_STRING}") ++ endif () ++endif () ++ ++include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) ++ ++if (OPENSSL_VERSION) ++ find_package_handle_standard_args(OpenSSL ++ REQUIRED_VARS ++ OPENSSL_LIBRARIES ++ OPENSSL_INCLUDE_DIR ++ VERSION_VAR ++ OPENSSL_VERSION ++ FAIL_MESSAGE ++ "Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR" ++ ) ++else () ++ find_package_handle_standard_args(OpenSSL "Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR" ++ OPENSSL_LIBRARIES ++ OPENSSL_INCLUDE_DIR ++ ) ++endif () ++ ++mark_as_advanced(OPENSSL_INCLUDE_DIR OPENSSL_LIBRARIES) +-- +2.1.4 + + +From 9659a120f5abe063d06ed9f7661a5c96dd4cb6b2 Mon Sep 17 00:00:00 2001 +From: Mark Brand +Date: Fri, 30 Jan 2015 13:56:09 +0100 +Subject: [PATCH 4/4] Fix FindOpenSSL for openssl 1.0.2 + +taken from +https://github.com/Homebrew/homebrew/pull/36361/files + +diff --git a/FindOpenSSL.cmake b/FindOpenSSL.cmake +index 340b417..6b4f985 100644 +--- a/FindOpenSSL.cmake ++++ b/FindOpenSSL.cmake +@@ -279,7 +279,7 @@ if (OPENSSL_INCLUDE_DIR) + set(OPENSSL_VERSION "${_OPENSSL_VERSION}") + elseif(OPENSSL_INCLUDE_DIR AND EXISTS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h") + file(STRINGS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h" openssl_version_str +- REGEX "^#define[\t ]+OPENSSL_VERSION_NUMBER[\t ]+0x([0-9a-fA-F])+.*") ++ REGEX "^# *define[\t ]+OPENSSL_VERSION_NUMBER[\t ]+0x([0-9a-fA-F])+.*") + + # The version number is encoded as 0xMNNFFPPS: major minor fix patch status + # The status gives if this is a developer or prerelease and is ignored here. +-- +2.1.4 diff --git a/src/openssl.mk b/src/openssl.mk index cafa6937..3043b34f 100644 --- a/src/openssl.mk +++ b/src/openssl.mk @@ -30,6 +30,7 @@ define $(PKG)_BUILD RANLIB='$(TARGET)-ranlib' \ AR='$(TARGET)-ar rcu' \ CROSS_COMPILE='$(TARGET)-' + $(INSTALL) -m644 '$(1)/FindOpenSSL.cmake' '$(PWD)/src/cmake/' endef $(PKG)_BUILD_i686-w64-mingw32 = $(subst @openssl-target@,mingw,$($(PKG)_BUILD))