[openssl] Patches to allow building when path includes spaces

This commit is contained in:
Alexander Karatarakis 2016-10-18 21:20:16 -07:00
parent 7dea245b9c
commit 2dede88deb
5 changed files with 92 additions and 7 deletions

View File

@ -2,6 +2,8 @@ cmake_minimum_required(VERSION 3.0)
project(openssl NONE)
include(vcpkg_execute_required_process)
include(vcpkg_apply_patches)
set(SOURCE_PATH ${CMAKE_CURRENT_BINARY_DIR}/openssl-1.0.2h)
find_package(ZLIB REQUIRED)
find_program(PERL perl)
@ -9,18 +11,25 @@ find_program(NMAKE nmake)
message(STATUS "Extracting source ${OPENSSL_SOURCE_ARCHIVE}")
vcpkg_execute_required_process(
COMMAND ${CMAKE_COMMAND} -E tar xjf ${OPENSSL_SOURCE_ARCHIVE}
COMMAND ${CMAKE_COMMAND} -E tar xjf "${OPENSSL_SOURCE_ARCHIVE}"
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
LOGNAME extract-${TARGET_TRIPLET}-rel
)
vcpkg_apply_patches(
SOURCE_PATH ${SOURCE_PATH}
PATCHES ${CMAKE_CURRENT_LIST_DIR}/PerlScriptSpaceInPathFixes.patch
${CMAKE_CURRENT_LIST_DIR}/ConfigureIncludeQuotesFix.patch
${CMAKE_CURRENT_LIST_DIR}/STRINGIFYPatch.patch
)
set(CONFIGURE_COMMAND ${PERL} Configure
no-idea
no-mdc2
no-rc5
no-asm
zlib-dynamic
--with-zlib-include=${ZLIB_INCLUDE_DIRS}
"--with-zlib-include=${ZLIB_INCLUDE_DIRS}"
)
if(TARGET_TRIPLET MATCHES "x86-windows")
@ -38,15 +47,15 @@ if(CMAKE_BUILD_TYPE MATCHES "Debug")
list(GET ZLIB_LIBRARIES -1 ZLIB_DEBUG_LIBRARY)
list(APPEND CONFIGURE_COMMAND
debug-${OPENSSL_ARCH}
--openssldir=${OPENSSLDIR}
--with-zlib-lib=${ZLIB_DEBUG_LIBRARY}
"--openssldir=${OPENSSLDIR}"
"--with-zlib-lib=${ZLIB_DEBUG_LIBRARY}"
)
else()
set(OPENSSLDIR ${CURRENT_PACKAGES_DIR})
list(APPEND CONFIGURE_COMMAND
${OPENSSL_ARCH}
--openssldir=${OPENSSLDIR}
--with-zlib-lib=${ZLIB_LIBRARIES}
"--openssldir=${OPENSSLDIR}"
"--with-zlib-lib=${ZLIB_LIBRARIES}"
)
endif()

View File

@ -0,0 +1,13 @@
diff --git a/Configure b/Configure
index c98107a..77ad9d3 100644
--- a/Configure
+++ b/Configure
@@ -970,7 +970,7 @@ PROCESS_ARGS:
}
elsif (/^--with-zlib-include=(.*)$/)
{
- $withargs{"zlib-include"}="-I$1";
+ $withargs{"zlib-include"}="-I\"$1\"";
}
elsif (/^--with-fipsdir=(.*)$/)
{

View File

@ -0,0 +1,35 @@
diff --git a/util/copy.pl b/util/copy.pl
index eba6d58..5d971a2 100644
--- a/util/copy.pl
+++ b/util/copy.pl
@@ -19,7 +19,7 @@ foreach $arg (@ARGV) {
next;
}
$arg =~ s|\\|/|g; # compensate for bug/feature in cygwin glob...
- foreach (glob $arg)
+ foreach (glob "\"$arg\"")
{
push @filelist, $_;
}
diff --git a/util/mk1mf.pl b/util/mk1mf.pl
index 128a405..fd853da 100644
--- a/util/mk1mf.pl
+++ b/util/mk1mf.pl
@@ -427,7 +427,7 @@ EOF
{
$extra_install .= <<"EOF"
\$(MKDIR) \"\$(INSTALLTOP)${o}lib${o}engines\"
- \$(CP) \"\$(E_SHLIB)\" \"\$(INSTALLTOP)${o}lib${o}engines\"
+ \$(CP) \$(E_SHLIB) \"\$(INSTALLTOP)${o}lib${o}engines\"
EOF
}
}
@@ -607,7 +607,7 @@ install: all
\$(MKDIR) \"\$(INSTALLTOP)${o}include${o}openssl\"
\$(MKDIR) \"\$(INSTALLTOP)${o}lib\"
\$(CP) \"\$(INCO_D)${o}*.\[ch\]\" \"\$(INSTALLTOP)${o}include${o}openssl\"
- \$(CP) \"\$(BIN_D)$o\$(E_EXE)$exep \$(INSTALLTOP)${o}bin\"
+ \$(CP) \"\$(BIN_D)$o\$(E_EXE)$exep\" \"\$(INSTALLTOP)${o}bin\"
\$(MKDIR) \"\$(OPENSSLDIR)\"
\$(CP) apps${o}openssl.cnf \"\$(OPENSSLDIR)\"
$extra_install

View File

@ -0,0 +1,23 @@
diff --git a/crypto/cversion.c b/crypto/cversion.c
index bfff699..17b7912 100644
--- a/crypto/cversion.c
+++ b/crypto/cversion.c
@@ -56,6 +56,9 @@
* [including the GNU Public Licence.]
*/
+#define STRINGIFY2(x) #x
+#define STRINGIFY(x) STRINGIFY2(x)
+
#include "cryptlib.h"
#ifndef NO_WINDOWS_BRAINDEATH
@@ -79,7 +82,7 @@ const char *SSLeay_version(int t)
}
if (t == SSLEAY_CFLAGS) {
#ifdef CFLAGS
- return (CFLAGS);
+ return STRINGIFY(CFLAGS);
#else
return ("compiler: information not available");
#endif

View File

@ -12,7 +12,12 @@ vcpkg_download_distfile(OPENSSL_SOURCE_ARCHIVE
SHA512 780601f6f3f32f42b6d7bbc4c593db39a3575f9db80294a10a68b2b0bb79448d9bd529ca700b9977354cbdfc65887c76af0aa7b90d3ee421f74ab53e6f15c303
)
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
file(COPY
${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt
${CMAKE_CURRENT_LIST_DIR}/PerlScriptSpaceInPathFixes.patch
${CMAKE_CURRENT_LIST_DIR}/ConfigureIncludeQuotesFix.patch
${CMAKE_CURRENT_LIST_DIR}/STRINGIFYPatch.patch
DESTINATION ${SOURCE_PATH})
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}