aboutsummaryrefslogtreecommitdiff
path: root/ports/openssl-uwp
diff options
context:
space:
mode:
authorRobert Schumacher <roschuma@microsoft.com>2018-07-17 16:07:52 -0700
committerRobert Schumacher <roschuma@microsoft.com>2018-07-17 16:09:12 -0700
commitb4422a1b7ec3c0728108972c07f4daeaa2c9b2a8 (patch)
treee65ae338893770d97bf6fb2c8230cd47c3cf2cd1 /ports/openssl-uwp
parentc2f96eb79ac11be000b7b26134ff89946bfa6458 (diff)
downloadvcpkg-b4422a1b7ec3c0728108972c07f4daeaa2c9b2a8.tar.gz
vcpkg-b4422a1b7ec3c0728108972c07f4daeaa2c9b2a8.zip
[openssl] Split openssl into multiple ports per platform
Diffstat (limited to 'ports/openssl-uwp')
-rw-r--r--ports/openssl-uwp/CONTROL3
-rw-r--r--ports/openssl-uwp/fix-uwp-rs4.patch26
-rw-r--r--ports/openssl-uwp/make-openssl.bat16
-rw-r--r--ports/openssl-uwp/portfile.cmake90
-rw-r--r--ports/openssl-uwp/usage4
5 files changed, 139 insertions, 0 deletions
diff --git a/ports/openssl-uwp/CONTROL b/ports/openssl-uwp/CONTROL
new file mode 100644
index 000000000..4b4871f3c
--- /dev/null
+++ b/ports/openssl-uwp/CONTROL
@@ -0,0 +1,3 @@
+Source: openssl-uwp
+Version: 1.0.2l-winrt
+Description: OpenSSL is an open source project that provides a robust, commercial-grade, and full-featured toolkit for the Transport Layer Security (TLS) and Secure Sockets Layer (SSL) protocols. It is also a general-purpose cryptography library.
diff --git a/ports/openssl-uwp/fix-uwp-rs4.patch b/ports/openssl-uwp/fix-uwp-rs4.patch
new file mode 100644
index 000000000..d5a33909e
--- /dev/null
+++ b/ports/openssl-uwp/fix-uwp-rs4.patch
@@ -0,0 +1,26 @@
+diff --git a/ms/winrtdef.h b/ms/winrtdef.h
+index b1a7598..6ba2e1d 100644
+--- a/ms/winrtdef.h
++++ b/ms/winrtdef.h
+@@ -6,9 +6,11 @@
+ #if defined(OPENSSL_WINAPP)
+ //Include stdio.h to replace fprintf
+ # include<stdio.h>
++#if !defined(NTDDI_VERSION) || (NTDDI_VERSION < NTDDI_WIN10_RS4)
+ # ifdef getenv
+ # undef getenv
+ # endif
++#endif
+ # ifdef setenv
+ # undef setenv
+ # endif
+@@ -32,7 +34,9 @@
+ # undef GetModuleHandle
+ # define GetModuleHandle winrt_GetModuleHandle
+ # endif
++#if !defined(NTDDI_WIN10_RS4) || (NTDDI_VERSION < NTDDI_WIN10_RS4)
+ # define getenv winrt_getenv
++#endif
+ # define setenv winrt_getenv
+
+ int winrt_GetTickCount(void);
diff --git a/ports/openssl-uwp/make-openssl.bat b/ports/openssl-uwp/make-openssl.bat
new file mode 100644
index 000000000..6f6166a24
--- /dev/null
+++ b/ports/openssl-uwp/make-openssl.bat
@@ -0,0 +1,16 @@
+set build=%1
+
+perl Configure no-asm no-hw no-dso VC-WINUNIVERSAL -FS -FIWindows.h
+
+for /D %%f in ("%WindowsSdkDir%References\%WindowsSDKLibVersion%Windows.Foundation.FoundationContract\*") do set LibPath=%LibPath%;%%f\
+for /D %%f in ("%WindowsSdkDir%References\%WindowsSDKLibVersion%Windows.Foundation.UniversalApiContract\*") do set LibPath=%LibPath%;%%f\
+for /D %%f in ("%WindowsSdkDir%References\Windows.Foundation.FoundationContract\*") do set LibPath=%LibPath%;%%f\
+for /D %%f in ("%WindowsSdkDir%References\Windows.Foundation.UniversalApiContract\*") do set LibPath=%LibPath%;%%f\
+
+call ms\do_winuniversal.bat
+
+mkdir inc32\openssl
+
+jom -j %NUMBER_OF_PROCESSORS% -k -f ms\ntdll.mak
+REM due to a race condition in the build, we need to have a second single-threaded pass.
+nmake -f ms\ntdll.mak
diff --git a/ports/openssl-uwp/portfile.cmake b/ports/openssl-uwp/portfile.cmake
new file mode 100644
index 000000000..167d98658
--- /dev/null
+++ b/ports/openssl-uwp/portfile.cmake
@@ -0,0 +1,90 @@
+if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
+ set(VCPKG_LIBRARY_LINKAGE dynamic)
+ message("Static building not supported yet")
+endif()
+
+if (NOT VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
+ message(FATAL_ERROR "This portfile only supports UWP")
+endif()
+
+if (VCPKG_TARGET_ARCHITECTURE STREQUAL "arm")
+ set(UWP_PLATFORM "arm")
+elseif (VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
+ set(UWP_PLATFORM "x64")
+elseif (VCPKG_TARGET_ARCHITECTURE STREQUAL "x86")
+ set(UWP_PLATFORM "Win32")
+else ()
+ message(FATAL_ERROR "Unsupported architecture")
+endif()
+
+include(vcpkg_common_functions)
+
+set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/openssl-OpenSSL_1_0_2l_WinRT)
+
+vcpkg_find_acquire_program(PERL)
+vcpkg_find_acquire_program(JOM)
+get_filename_component(JOM_EXE_PATH ${JOM} DIRECTORY)
+get_filename_component(PERL_EXE_PATH ${PERL} DIRECTORY)
+set(ENV{PATH} "$ENV{PATH};${PERL_EXE_PATH};${JOM_EXE_PATH}")
+
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://github.com/Microsoft/openssl/archive/OpenSSL_1_0_2l_WinRT.zip"
+ FILENAME "openssl-microsoft-1.0.2l_WinRT.zip"
+ SHA512 238b3daad7f1a2486e09d47e6d1bd4b0aa8e8a896358c6dfe11a77c2654da1b29d3c7612f9d200d5be5a020f33d96fe39cd75b99aa35aa4129feb756f7f98ee8
+)
+
+vcpkg_extract_source_archive(${ARCHIVE})
+
+vcpkg_apply_patches(
+ SOURCE_PATH ${SOURCE_PATH}
+ PATCHES ${CMAKE_CURRENT_LIST_DIR}/fix-uwp-rs4.patch
+)
+
+file(REMOVE_RECURSE ${SOURCE_PATH}/tmp32dll)
+file(REMOVE_RECURSE ${SOURCE_PATH}/out32dll)
+file(REMOVE_RECURSE ${SOURCE_PATH}/inc32dll)
+
+file(
+ COPY ${CMAKE_CURRENT_LIST_DIR}/make-openssl.bat
+ DESTINATION ${SOURCE_PATH}
+)
+
+message(STATUS "Build ${TARGET_TRIPLET}")
+vcpkg_execute_required_process(
+ COMMAND ${SOURCE_PATH}/make-openssl.bat ${UWP_PLATFORM}
+ WORKING_DIRECTORY ${SOURCE_PATH}
+ LOGNAME make-openssl-${TARGET_TRIPLET}
+)
+message(STATUS "Build ${TARGET_TRIPLET} done")
+
+file(
+ COPY ${SOURCE_PATH}/inc32/openssl
+ DESTINATION ${CURRENT_PACKAGES_DIR}/include
+)
+
+file(INSTALL
+ ${SOURCE_PATH}/out32dll/libeay32.dll
+ ${SOURCE_PATH}/out32dll/libeay32.pdb
+ ${SOURCE_PATH}/out32dll/ssleay32.dll
+ ${SOURCE_PATH}/out32dll/ssleay32.pdb
+ DESTINATION ${CURRENT_PACKAGES_DIR}/bin)
+
+file(INSTALL
+ ${SOURCE_PATH}/out32dll/libeay32.lib
+ ${SOURCE_PATH}/out32dll/ssleay32.lib
+ DESTINATION ${CURRENT_PACKAGES_DIR}/lib)
+
+file(INSTALL
+ ${SOURCE_PATH}/out32dll/libeay32.dll
+ ${SOURCE_PATH}/out32dll/libeay32.pdb
+ ${SOURCE_PATH}/out32dll/ssleay32.dll
+ ${SOURCE_PATH}/out32dll/ssleay32.pdb
+ DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin)
+
+file(INSTALL
+ ${SOURCE_PATH}/out32dll/libeay32.lib
+ ${SOURCE_PATH}/out32dll/ssleay32.lib
+ DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
+
+file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
+file(COPY ${CMAKE_CURRENT_LIST_DIR}/usage DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT})
diff --git a/ports/openssl-uwp/usage b/ports/openssl-uwp/usage
new file mode 100644
index 000000000..f535cb6a4
--- /dev/null
+++ b/ports/openssl-uwp/usage
@@ -0,0 +1,4 @@
+The package openssl is compatible with built-in CMake targets:
+
+ find_package(OpenSSL REQUIRED)
+ target_link_libraries(main PRIVATE OpenSSL::SSL OpenSSL::Crypto)