aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/openssl
diff options
context:
space:
mode:
authorEthan Morgan <ethan@gweithio.com>2026-02-14 16:44:06 +0000
committerEthan Morgan <ethan@gweithio.com>2026-02-14 16:44:06 +0000
commit54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch)
treed915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/ports/openssl
move to own git serverHEADmaster
Diffstat (limited to 'vcpkg/ports/openssl')
-rw-r--r--vcpkg/ports/openssl/aes_cfb128_vaes_encdec_wrapper.diff20
-rw-r--r--vcpkg/ports/openssl/cmake-config.patch62
-rw-r--r--vcpkg/ports/openssl/command-line-length.patch13
-rw-r--r--vcpkg/ports/openssl/install-pc-files.cmake32
-rw-r--r--vcpkg/ports/openssl/openssl.pc.in6
-rw-r--r--vcpkg/ports/openssl/portfile.cmake94
-rw-r--r--vcpkg/ports/openssl/script-prefix.patch22
-rw-r--r--vcpkg/ports/openssl/unix/android-cc.patch20
-rwxr-xr-xvcpkg/ports/openssl/unix/configure31
-rw-r--r--vcpkg/ports/openssl/unix/move-openssldir.patch16
-rw-r--r--vcpkg/ports/openssl/unix/no-empty-dirs.patch22
-rw-r--r--vcpkg/ports/openssl/unix/no-static-libs-for-shared.patch12
-rw-r--r--vcpkg/ports/openssl/unix/portfile.cmake172
-rw-r--r--vcpkg/ports/openssl/unix/remove-deps.cmake7
-rw-r--r--vcpkg/ports/openssl/usage5
-rw-r--r--vcpkg/ports/openssl/vcpkg-cmake-wrapper.cmake.in82
-rw-r--r--vcpkg/ports/openssl/vcpkg.json38
-rw-r--r--vcpkg/ports/openssl/windows/install-layout.patch13
-rw-r--r--vcpkg/ports/openssl/windows/install-pdbs.patch46
-rw-r--r--vcpkg/ports/openssl/windows/install-programs.diff13
-rw-r--r--vcpkg/ports/openssl/windows/portfile.cmake158
21 files changed, 884 insertions, 0 deletions
diff --git a/vcpkg/ports/openssl/aes_cfb128_vaes_encdec_wrapper.diff b/vcpkg/ports/openssl/aes_cfb128_vaes_encdec_wrapper.diff
new file mode 100644
index 0000000..1585314
--- /dev/null
+++ b/vcpkg/ports/openssl/aes_cfb128_vaes_encdec_wrapper.diff
@@ -0,0 +1,20 @@
+diff --git a/providers/implementations/ciphers/cipher_aes_cfb_hw_aesni.inc b/providers/implementations/ciphers/cipher_aes_cfb_hw_aesni.inc
+index d5577d0..eb8e016 100644
+--- a/providers/implementations/ciphers/cipher_aes_cfb_hw_aesni.inc
++++ b/providers/implementations/ciphers/cipher_aes_cfb_hw_aesni.inc
+@@ -30,6 +30,7 @@
+ static int ossl_aes_cfb8_vaes_eligible(void) { return 0; }
+ static int ossl_aes_cfb1_vaes_eligible(void) { return 0; }
+
++#if (defined(__x86_64) || defined(__x86_64__) || defined(_M_AMD64) || defined(_M_X64))
+ /* active in 64-bit builds when AES-NI, AVX512F, and VAES are detected */
+ static int aes_cfb128_vaes_encdec_wrapper(
+ PROV_CIPHER_CTX* dat,
+@@ -56,6 +57,7 @@ static int aes_cfb128_vaes_encdec_wrapper(
+
+ return 1;
+ }
++#endif
+
+ /* generates AES round keys for AES-NI and VAES implementations */
+ static int cipher_hw_aesni_initkey(PROV_CIPHER_CTX *dat,
diff --git a/vcpkg/ports/openssl/cmake-config.patch b/vcpkg/ports/openssl/cmake-config.patch
new file mode 100644
index 0000000..74251ab
--- /dev/null
+++ b/vcpkg/ports/openssl/cmake-config.patch
@@ -0,0 +1,62 @@
+diff --git a/Configurations/unix-Makefile.tmpl b/Configurations/unix-Makefile.tmpl
+index 09303c4..487ff68 100644
+--- a/Configurations/unix-Makefile.tmpl
++++ b/Configurations/unix-Makefile.tmpl
+@@ -338,7 +338,7 @@ bindir={- file_name_is_absolute($bindir)
+ ? $bindir : '$(INSTALLTOP)/$(BINDIR)' -}
+
+ PKGCONFIGDIR=$(libdir)/pkgconfig
+-CMAKECONFIGDIR=$(libdir)/cmake/OpenSSL
++CMAKECONFIGDIR=$(INSTALLTOP)/share/openssl
+
+ MANDIR=$(INSTALLTOP)/share/man
+ DOCDIR=$(INSTALLTOP)/share/doc/$(BASENAME)
+diff --git a/Configurations/windows-makefile.tmpl b/Configurations/windows-makefile.tmpl
+index 894834c..d6d3c41 100644
+--- a/Configurations/windows-makefile.tmpl
++++ b/Configurations/windows-makefile.tmpl
+@@ -254,7 +254,7 @@ MODULESDIR=$(MODULESDIR_dev)$(MODULESDIR_dir)
+ libdir={- file_name_is_absolute($libdir)
+ ? $libdir : '$(INSTALLTOP)\$(LIBDIR)' -}
+
+-CMAKECONFIGDIR=$(libdir)\cmake\OpenSSL
++CMAKECONFIGDIR=$(INSTALLTOP)\share\openssl
+
+ ##### User defined commands and flags ################################
+
+diff --git a/exporters/cmake/OpenSSLConfig.cmake.in b/exporters/cmake/OpenSSLConfig.cmake.in
+index 766aebe..026680a 100644
+--- a/exporters/cmake/OpenSSLConfig.cmake.in
++++ b/exporters/cmake/OpenSSLConfig.cmake.in
+@@ -91,8 +91,7 @@ get_filename_component(_ossl_prefix "${CMAKE_CURRENT_LIST_FILE}" PATH)
+ {-
+ # For each component in $OpenSSL::safe::installdata::CMAKECONFIGDIR[0] relative to
+ # $OpenSSL::safe::installdata::PREFIX[0], have CMake figure out the parent directory.
+- my $d = join('/', unixify(catdir($OpenSSL::safe::installdata::LIBDIR_REL_PREFIX[0],
+- $OpenSSL::safe::installdata::CMAKECONFIGDIR_REL_LIBDIR[0]), 1));
++ my $d = 'share/openssl';
+ $OUT = '';
+ if ($d ne '.') {
+ $OUT .= 'get_filename_component(_ossl_prefix "${_ossl_prefix}" PATH)' . "\n"
+@@ -141,6 +140,14 @@ set(OPENSSL_APPLINK_SOURCE "${_ossl_prefix}/{- unixify($OpenSSL::safe::installda
+ {- output_on() if $disabled{uplink}; "" -}
+ set(OPENSSL_PROGRAM "${OPENSSL_RUNTIME_DIR}/{- platform->bin('openssl') -}")
+
++if(NOT Z_VCPKG_OPENSSL_USE_SINGLE_CONFIG)
++ # Prevent loop
++ set(Z_VCPKG_OPENSSL_USE_SINGLE_CONFIG "prevent-loop")
++ # Chainload vcpkg's module-based multi-config target setup
++ find_package(OpenSSL MODULE)
++ set(Z_VCPKG_OPENSSL_USE_SINGLE_CONFIG 0)
++else()
++ # Use official single-config target setup
+ # Set up the imported targets
+ if(_ossl_use_static_libs)
+ {- output_off() unless $no_static; "" -}
+@@ -240,5 +247,6 @@ set_property(TARGET OpenSSL::applink PROPERTY
+ INTERFACE_SOURCES "${OPENSSL_APPLINK_SOURCE}")
+ {- output_on() if $disabled{uplink}; "" -}
+
++endif()
+ unset(_ossl_prefix)
+ unset(_ossl_use_static_libs)
diff --git a/vcpkg/ports/openssl/command-line-length.patch b/vcpkg/ports/openssl/command-line-length.patch
new file mode 100644
index 0000000..f379d2d
--- /dev/null
+++ b/vcpkg/ports/openssl/command-line-length.patch
@@ -0,0 +1,13 @@
+diff --git a/Configurations/unix-Makefile.tmpl b/Configurations/unix-Makefile.tmpl
+index 8ddb128..52b9ad6 100644
+--- a/Configurations/unix-Makefile.tmpl
++++ b/Configurations/unix-Makefile.tmpl
+@@ -1961,7 +1961,7 @@ EOF
+ my @objs = map { platform->obj($_) } @{$args{objs}};
+ my $deps = join(" \\\n" . ' ' x (length($lib) + 2),
+ fill_lines(' ', $COLUMNS - length($lib) - 2, @objs));
+- my $max_per_call = 500;
++ my $max_per_call = ($^O eq 'msys' || $^O eq 'cygwin') ? 80 : 500;
+ my @objs_grouped;
+ push @objs_grouped, join(" ", splice @objs, 0, $max_per_call) while @objs;
+ my $fill_lib =
diff --git a/vcpkg/ports/openssl/install-pc-files.cmake b/vcpkg/ports/openssl/install-pc-files.cmake
new file mode 100644
index 0000000..04897fa
--- /dev/null
+++ b/vcpkg/ports/openssl/install-pc-files.cmake
@@ -0,0 +1,32 @@
+function(install_pc_file name pc_data)
+ if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
+ configure_file("${CMAKE_CURRENT_LIST_DIR}/openssl.pc.in" "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/${name}.pc" @ONLY)
+ endif()
+ if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
+ configure_file("${CMAKE_CURRENT_LIST_DIR}/openssl.pc.in" "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/${name}.pc" @ONLY)
+ endif()
+endfunction()
+
+install_pc_file(openssl [[
+Name: OpenSSL
+Description: Secure Sockets Layer and cryptography libraries and tools
+Requires: libssl libcrypto
+]])
+
+install_pc_file(libssl [[
+Name: OpenSSL-libssl
+Description: Secure Sockets Layer and cryptography libraries
+Libs: -L"${libdir}" -llibssl
+Requires: libcrypto
+Cflags: -I"${includedir}"
+]])
+
+install_pc_file(libcrypto [[
+Name: OpenSSL-libcrypto
+Description: OpenSSL cryptography library
+Libs: -L"${libdir}" -llibcrypto
+Libs.private: -lcrypt32 -lws2_32 -ladvapi32 -luser32
+Cflags: -I"${includedir}"
+]])
+
+vcpkg_fixup_pkgconfig()
diff --git a/vcpkg/ports/openssl/openssl.pc.in b/vcpkg/ports/openssl/openssl.pc.in
new file mode 100644
index 0000000..f7fa9d1
--- /dev/null
+++ b/vcpkg/ports/openssl/openssl.pc.in
@@ -0,0 +1,6 @@
+prefix=${pcfiledir}/../..
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+Version: @VERSION@
+@pc_data@
diff --git a/vcpkg/ports/openssl/portfile.cmake b/vcpkg/ports/openssl/portfile.cmake
new file mode 100644
index 0000000..6aa8d60
--- /dev/null
+++ b/vcpkg/ports/openssl/portfile.cmake
@@ -0,0 +1,94 @@
+if(EXISTS "${CURRENT_INSTALLED_DIR}/share/libressl/copyright"
+ OR EXISTS "${CURRENT_INSTALLED_DIR}/share/boringssl/copyright")
+ message(FATAL_ERROR "Can't build openssl if libressl/boringssl is installed. Please remove libressl/boringssl, and try install openssl again if you need it.")
+endif()
+
+if(VCPKG_TARGET_IS_EMSCRIPTEN)
+ vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
+endif()
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO openssl/openssl
+ REF "openssl-${VERSION}"
+ SHA512 3e1796708155454c118550ba0964b42c0c1055b651fec00cfb55038e8a8abbf5f85df02449e62b50b99d2a4a2f7b47862067f8a965e9c8a72f71dee0153672d9
+ PATCHES
+ cmake-config.patch
+ command-line-length.patch
+ script-prefix.patch
+ aes_cfb128_vaes_encdec_wrapper.diff # https://github.com/openssl/openssl/issues/28745
+ windows/install-layout.patch
+ windows/install-pdbs.patch
+ windows/install-programs.diff # https://github.com/openssl/openssl/issues/28744
+ unix/android-cc.patch
+ unix/move-openssldir.patch
+ unix/no-empty-dirs.patch
+ unix/no-static-libs-for-shared.patch
+)
+
+vcpkg_list(SET CONFIGURE_OPTIONS
+ enable-static-engine
+ enable-capieng
+ no-tests
+ no-docs
+)
+
+# https://github.com/openssl/openssl/blob/master/INSTALL.md#enable-ec_nistp_64_gcc_128
+vcpkg_cmake_get_vars(cmake_vars_file)
+include("${cmake_vars_file}")
+if(VCPKG_DETECTED_CMAKE_C_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$"
+ AND VCPKG_TARGET_ARCHITECTURE MATCHES "^(x64|arm64|riscv64|ppc64le)$")
+ vcpkg_list(APPEND CONFIGURE_OPTIONS enable-ec_nistp_64_gcc_128)
+endif()
+
+set(INSTALL_FIPS "")
+if("fips" IN_LIST FEATURES)
+ vcpkg_list(APPEND INSTALL_FIPS install_fips)
+ vcpkg_list(APPEND CONFIGURE_OPTIONS enable-fips)
+endif()
+
+if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
+ vcpkg_list(APPEND CONFIGURE_OPTIONS shared)
+else()
+ vcpkg_list(APPEND CONFIGURE_OPTIONS no-shared no-module)
+endif()
+
+if(NOT "tools" IN_LIST FEATURES)
+ vcpkg_list(APPEND CONFIGURE_OPTIONS no-apps)
+endif()
+
+if("weak-ssl-ciphers" IN_LIST FEATURES)
+ vcpkg_list(APPEND CONFIGURE_OPTIONS enable-weak-ssl-ciphers)
+endif()
+
+if("ssl3" IN_LIST FEATURES)
+ vcpkg_list(APPEND CONFIGURE_OPTIONS enable-ssl3)
+ vcpkg_list(APPEND CONFIGURE_OPTIONS enable-ssl3-method)
+endif()
+
+if(DEFINED OPENSSL_USE_NOPINSHARED)
+ vcpkg_list(APPEND CONFIGURE_OPTIONS no-pinshared)
+endif()
+
+if(OPENSSL_NO_AUTOLOAD_CONFIG)
+ vcpkg_list(APPEND CONFIGURE_OPTIONS no-autoload-config)
+endif()
+
+if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
+ include("${CMAKE_CURRENT_LIST_DIR}/windows/portfile.cmake")
+ include("${CMAKE_CURRENT_LIST_DIR}/install-pc-files.cmake")
+else()
+ include("${CMAKE_CURRENT_LIST_DIR}/unix/portfile.cmake")
+endif()
+
+file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
+
+if (NOT "${VERSION}" MATCHES [[^([0-9]+)\.([0-9]+)\.([0-9]+)$]])
+ message(FATAL_ERROR "Version regex did not match.")
+endif()
+set(OPENSSL_VERSION_MAJOR "${CMAKE_MATCH_1}")
+set(OPENSSL_VERSION_MINOR "${CMAKE_MATCH_2}")
+set(OPENSSL_VERSION_FIX "${CMAKE_MATCH_3}")
+configure_file("${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake.in" "${CURRENT_PACKAGES_DIR}/share/${PORT}/vcpkg-cmake-wrapper.cmake" @ONLY)
+
+vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.txt")
diff --git a/vcpkg/ports/openssl/script-prefix.patch b/vcpkg/ports/openssl/script-prefix.patch
new file mode 100644
index 0000000..fd3316b
--- /dev/null
+++ b/vcpkg/ports/openssl/script-prefix.patch
@@ -0,0 +1,22 @@
+diff --git a/tools/c_rehash.in b/tools/c_rehash.in
+index 343cdc1..e48038e 100644
+--- a/tools/c_rehash.in
++++ b/tools/c_rehash.in
+@@ -12,7 +12,7 @@
+ # and add symbolic links to their hash values.
+
+ my $dir = {- quotify1($config{openssldir}) -};
+-my $prefix = {- quotify1($config{prefix}) -};
++use FindBin;
+
+ my $errorcount = 0;
+ my $openssl = $ENV{OPENSSL} || "openssl";
+@@ -61,7 +61,7 @@ if (defined(&Cwd::getcwd)) {
+
+ # DOS/Win32 or Unix delimiter? Prefix our installdir, then search.
+ my $path_delim = ($pwd =~ /^[a-z]\:/i) ? ';' : ':';
+-$ENV{PATH} = "$prefix/bin" . ($ENV{PATH} ? $path_delim . $ENV{PATH} : "");
++$ENV{PATH} = "$FindBin::Bin" . ($ENV{PATH} ? $path_delim . $ENV{PATH} : "");
+
+ if (!(-f $openssl && -x $openssl)) {
+ my $found = 0;
diff --git a/vcpkg/ports/openssl/unix/android-cc.patch b/vcpkg/ports/openssl/unix/android-cc.patch
new file mode 100644
index 0000000..f4c3d68
--- /dev/null
+++ b/vcpkg/ports/openssl/unix/android-cc.patch
@@ -0,0 +1,20 @@
+diff --git a/Configurations/15-android.conf b/Configurations/15-android.conf
+index 41ad922..d15e34c 100644
+--- a/Configurations/15-android.conf
++++ b/Configurations/15-android.conf
+@@ -102,6 +102,7 @@
+ my $cflags;
+ my $cppflags;
+
++if (0) {
+ # see if there is NDK clang on $PATH, "universal" or "standalone"
+ if (which("clang") =~ m|^$ndk/.*/prebuilt/([^/]+)/|) {
+ my $host=$1;
+@@ -158,6 +159,7 @@
+ $sysroot =~ s|^$ndk/||;
+ $sysroot = " --sysroot=\$($ndk_var)/$sysroot";
+ }
++}
+ $android_ndk = {
+ cflags => $cflags . $sysroot,
+ cppflags => $cppflags,
diff --git a/vcpkg/ports/openssl/unix/configure b/vcpkg/ports/openssl/unix/configure
new file mode 100755
index 0000000..2d49b3d
--- /dev/null
+++ b/vcpkg/ports/openssl/unix/configure
@@ -0,0 +1,31 @@
+#!/usr/bin/env bash
+
+set -e
+
+declare -a OUT_OPTIONS
+
+INTERPRETER=perl
+
+LAST_SEEN=
+COPY_OPTIONS=no
+for OPTION; do
+ case "${OPTION},${COPY_OPTIONS}" in
+ */Configure,no)
+ OUT_OPTIONS+=("${OPTION}")
+ INTERPRETER="${LAST_SEEN}"
+ COPY_OPTIONS=yes
+ ;;
+ --prefix=*|--openssldir=*|--libdir=*|--cross-compile-prefix=*|--debug,*)
+ OUT_OPTIONS+=("${OPTION}")
+ ;;
+ -*|*=*)
+ ;;
+ *,yes)
+ OUT_OPTIONS+=("${OPTION}")
+ ;;
+ esac
+ LAST_SEEN="${OPTION}"
+done
+
+set -x
+"${INTERPRETER}" ${OUT_OPTIONS[@]}
diff --git a/vcpkg/ports/openssl/unix/move-openssldir.patch b/vcpkg/ports/openssl/unix/move-openssldir.patch
new file mode 100644
index 0000000..2a39bdb
--- /dev/null
+++ b/vcpkg/ports/openssl/unix/move-openssldir.patch
@@ -0,0 +1,16 @@
+diff --git a/Configurations/unix-Makefile.tmpl b/Configurations/unix-Makefile.tmpl
+index c82c086..6c5402d 100644
+--- a/Configurations/unix-Makefile.tmpl
++++ b/Configurations/unix-Makefile.tmpl
+@@ -690,6 +690,11 @@ install_ssldirs:
+ chmod 644 "$(DESTDIR)$(OPENSSLDIR)/ct_log_list.cnf"; \
+ fi
+
++ $(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(INSTALLTOP)$(OPENSSLDIR)
++ for I in $(DESTDIR)$(OPENSSLDIR)/*; do \
++ mv $$I $(DESTDIR)$(INSTALLTOP)$(OPENSSLDIR)/; \
++ done
++
+ install_dev: install_runtime_libs
+ @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
+ @$(ECHO) "*** Installing development files"
diff --git a/vcpkg/ports/openssl/unix/no-empty-dirs.patch b/vcpkg/ports/openssl/unix/no-empty-dirs.patch
new file mode 100644
index 0000000..7cf0cf0
--- /dev/null
+++ b/vcpkg/ports/openssl/unix/no-empty-dirs.patch
@@ -0,0 +1,22 @@
+diff --git a/Configurations/unix-Makefile.tmpl b/Configurations/unix-Makefile.tmpl
+index 6c5402d..fc982df 100644
+--- a/Configurations/unix-Makefile.tmpl
++++ b/Configurations/unix-Makefile.tmpl
+@@ -823,7 +823,7 @@ _install_modules_deps: install_runtime_libs build_modules
+
+ install_engines: _install_modules_deps
+ @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
+- @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(ENGINESDIR)/"
++ @[ -z "$(INSTALL_ENGINES)" ] || $(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(ENGINESDIR)/
+ @$(ECHO) "*** Installing engines"
+ @set -e; for e in dummy $(INSTALL_ENGINES); do \
+ if [ "$$e" = "dummy" ]; then continue; fi; \
+@@ -847,7 +847,7 @@ uninstall_engines:
+
+ install_modules: _install_modules_deps
+ @[ -n "$(INSTALLTOP)" ] || (echo INSTALLTOP should not be empty; exit 1)
+- @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(MODULESDIR)/"
++ @[ -z "$(INSTALL_MODULES)" ] || $(PERL) $(SRCDIR)/util/mkdir-p.pl $(DESTDIR)$(MODULESDIR)/
+ @$(ECHO) "*** Installing modules"
+ @set -e; for e in dummy $(INSTALL_MODULES); do \
+ if [ "$$e" = "dummy" ]; then continue; fi; \
diff --git a/vcpkg/ports/openssl/unix/no-static-libs-for-shared.patch b/vcpkg/ports/openssl/unix/no-static-libs-for-shared.patch
new file mode 100644
index 0000000..d6aa34c
--- /dev/null
+++ b/vcpkg/ports/openssl/unix/no-static-libs-for-shared.patch
@@ -0,0 +1,12 @@
+diff --git a/Configurations/unix-Makefile.tmpl b/Configurations/unix-Makefile.tmpl
+index fc982df..10f1c54 100644
+--- a/Configurations/unix-Makefile.tmpl
++++ b/Configurations/unix-Makefile.tmpl
+@@ -713,6 +713,7 @@ install_dev: install_runtime_libs
+ done
+ @$(PERL) $(SRCDIR)/util/mkdir-p.pl "$(DESTDIR)$(libdir)"
+ @set -e; for l in $(INSTALL_LIBS); do \
++ if [ -n "$(INSTALL_SHLIBS)" ] ; then continue ; fi ; \
+ fn=`basename $$l`; \
+ $(ECHO) "install $$l -> $(DESTDIR)$(libdir)/$$fn"; \
+ cp $$l "$(DESTDIR)$(libdir)/$$fn.new"; \
diff --git a/vcpkg/ports/openssl/unix/portfile.cmake b/vcpkg/ports/openssl/unix/portfile.cmake
new file mode 100644
index 0000000..9127824
--- /dev/null
+++ b/vcpkg/ports/openssl/unix/portfile.cmake
@@ -0,0 +1,172 @@
+if (VCPKG_TARGET_IS_LINUX)
+ message(NOTICE [[
+openssl requires Linux kernel headers from the system package manager.
+ They can be installed on Alpine systems via `apk add linux-headers`.
+ They can be installed on Ubuntu systems via `apt install linux-libc-dev`.
+]])
+endif()
+
+if(VCPKG_HOST_IS_WINDOWS)
+ vcpkg_acquire_msys(MSYS_ROOT PACKAGES make perl)
+ set(MAKE "${MSYS_ROOT}/usr/bin/make.exe")
+ set(PERL "${MSYS_ROOT}/usr/bin/perl.exe")
+else()
+ find_program(MAKE make)
+ if(NOT MAKE)
+ message(FATAL_ERROR "Could not find make. Please install it through your package manager.")
+ endif()
+ vcpkg_find_acquire_program(PERL)
+endif()
+set(INTERPRETER "${PERL}")
+
+execute_process(
+ COMMAND "${PERL}" -e "use IPC::Cmd;"
+ RESULT_VARIABLE perl_ipc_cmd_result
+)
+if(NOT perl_ipc_cmd_result STREQUAL "0")
+ message(FATAL_ERROR "\nPerl cannot find IPC::Cmd. Please install it through your system package manager.\n")
+endif()
+
+# Ideally, OpenSSL should use `CC` from vcpkg as is (absolute path).
+# But in reality, OpenSSL expects to locate the compiler via `PATH`,
+# and it makes its own choices e.g. for Android.
+vcpkg_cmake_get_vars(cmake_vars_file)
+include("${cmake_vars_file}")
+cmake_path(GET VCPKG_DETECTED_CMAKE_C_COMPILER PARENT_PATH compiler_path)
+cmake_path(GET VCPKG_DETECTED_CMAKE_C_COMPILER FILENAME compiler_name)
+find_program(compiler_in_path NAMES "${compiler_name}" PATHS ENV PATH NO_DEFAULT_PATH)
+if(NOT compiler_in_path)
+ vcpkg_host_path_list(APPEND ENV{PATH} "${compiler_path}")
+elseif(NOT compiler_in_path STREQUAL VCPKG_DETECTED_CMAKE_C_COMPILER)
+ vcpkg_host_path_list(PREPEND ENV{PATH} "${compiler_path}")
+endif()
+
+vcpkg_list(SET MAKEFILE_OPTIONS)
+if(VCPKG_TARGET_IS_ANDROID)
+ set(ENV{ANDROID_NDK_ROOT} "${VCPKG_DETECTED_CMAKE_ANDROID_NDK}")
+ set(OPENSSL_ARCH "android-${VCPKG_DETECTED_CMAKE_ANDROID_ARCH}")
+ if(VCPKG_DETECTED_CMAKE_ANDROID_ARCH STREQUAL "arm" AND NOT VCPKG_DETECTED_CMAKE_ANDROID_ARM_NEON)
+ vcpkg_list(APPEND CONFIGURE_OPTIONS no-asm)
+ endif()
+elseif(VCPKG_TARGET_IS_LINUX)
+ if(VCPKG_TARGET_ARCHITECTURE MATCHES "arm64")
+ set(OPENSSL_ARCH linux-aarch64)
+ elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "arm")
+ set(OPENSSL_ARCH linux-armv4)
+ elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "x64")
+ set(OPENSSL_ARCH linux-x86_64)
+ elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "x86")
+ set(OPENSSL_ARCH linux-x86)
+ else()
+ set(OPENSSL_ARCH linux-generic32)
+ endif()
+elseif(VCPKG_TARGET_IS_IOS)
+ if(VCPKG_TARGET_ARCHITECTURE MATCHES "arm64")
+ set(OPENSSL_ARCH ios64-xcrun)
+ elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "arm")
+ set(OPENSSL_ARCH ios-xcrun)
+ elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "x86" OR VCPKG_TARGET_ARCHITECTURE MATCHES "x64")
+ set(OPENSSL_ARCH iossimulator-xcrun)
+ else()
+ message(FATAL_ERROR "Unknown iOS target architecture: ${VCPKG_TARGET_ARCHITECTURE}")
+ endif()
+ # disable that makes linkage error (e.g. require stderr usage)
+ list(APPEND CONFIGURE_OPTIONS no-ui no-asm)
+elseif(VCPKG_TARGET_IS_TVOS OR VCPKG_TARGET_IS_WATCHOS)
+ set(OPENSSL_ARCH iphoneos-cross)
+ # disable that makes linkage error (e.g. require stderr usage)
+ list(APPEND CONFIGURE_OPTIONS no-ui no-asm)
+elseif(VCPKG_TARGET_IS_OSX)
+ if(VCPKG_TARGET_ARCHITECTURE MATCHES "arm64")
+ set(OPENSSL_ARCH darwin64-arm64)
+ else()
+ set(OPENSSL_ARCH darwin64-x86_64)
+ endif()
+elseif(VCPKG_TARGET_IS_BSD)
+ set(OPENSSL_ARCH BSD-nodef-generic64)
+elseif(VCPKG_TARGET_IS_SOLARIS)
+ if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
+ set(OPENSSL_ARCH solaris64-x86_64-gcc)
+ else()
+ set(OPENSSL_ARCH solaris-x86-gcc)
+ endif()
+elseif(VCPKG_TARGET_IS_MINGW)
+ if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
+ set(OPENSSL_ARCH mingw64)
+ elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
+ set(OPENSSL_ARCH mingwarm64)
+ else()
+ set(OPENSSL_ARCH mingw)
+ endif()
+elseif(VCPKG_TARGET_IS_EMSCRIPTEN)
+ set(OPENSSL_ARCH linux-x32)
+ vcpkg_list(APPEND CONFIGURE_OPTIONS
+ no-engine
+ no-asm
+ no-sse2
+ no-srtp
+ --cross-compile-prefix=
+ )
+ # Cf. https://emscripten.org/docs/porting/pthreads.html:
+ # For Pthreads support, not just openssl but everything
+ # must be compiled and linked with `-pthread`.
+ # This makes it a triplet/toolchain-wide setting.
+ if(NOT " ${VCPKG_DETECTED_CMAKE_C_FLAGS} " MATCHES " -pthread ")
+ vcpkg_list(APPEND CONFIGURE_OPTIONS no-threads)
+ endif()
+else()
+ message(FATAL_ERROR "Unknown platform")
+endif()
+
+file(MAKE_DIRECTORY "${SOURCE_PATH}/vcpkg")
+file(COPY "${CMAKE_CURRENT_LIST_DIR}/configure" DESTINATION "${SOURCE_PATH}/vcpkg")
+vcpkg_configure_make(
+ SOURCE_PATH "${SOURCE_PATH}"
+ PROJECT_SUBPATH "vcpkg"
+ NO_ADDITIONAL_PATHS
+ OPTIONS
+ "${INTERPRETER}"
+ "${SOURCE_PATH}/Configure"
+ ${OPENSSL_ARCH}
+ ${CONFIGURE_OPTIONS}
+ "--openssldir=/etc/ssl"
+ "--libdir=lib"
+ OPTIONS_DEBUG
+ --debug
+)
+vcpkg_install_make(
+ ${MAKEFILE_OPTIONS}
+ BUILD_TARGET build_inst_sw
+)
+vcpkg_fixup_pkgconfig()
+
+if("tools" IN_LIST FEATURES)
+ file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools/${PORT}")
+ file(RENAME "${CURRENT_PACKAGES_DIR}/bin/c_rehash" "${CURRENT_PACKAGES_DIR}/tools/${PORT}/c_rehash")
+ file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/bin/c_rehash")
+ vcpkg_copy_tools(TOOL_NAMES openssl AUTO_CLEAN)
+elseif(VCPKG_LIBRARY_LINKAGE STREQUAL "static" OR NOT VCPKG_TARGET_IS_WINDOWS)
+ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
+ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/etc/ssl/misc")
+endif()
+
+file(TOUCH "${CURRENT_PACKAGES_DIR}/etc/ssl/certs/.keep")
+file(TOUCH "${CURRENT_PACKAGES_DIR}/etc/ssl/private/.keep")
+
+file(REMOVE_RECURSE
+ "${CURRENT_PACKAGES_DIR}/debug/etc"
+ "${CURRENT_PACKAGES_DIR}/debug/include"
+ "${CURRENT_PACKAGES_DIR}/debug/share"
+)
+
+# For consistency of mingw build with nmake build
+file(GLOB engines "${CURRENT_PACKAGES_DIR}/lib/ossl-modules/*.dll")
+if(NOT engines STREQUAL "")
+ file(COPY ${engines} DESTINATION "${CURRENT_PACKAGES_DIR}/bin")
+ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/lib/ossl-modules")
+endif()
+file(GLOB engines "${CURRENT_PACKAGES_DIR}/debug/lib/ossl-modules/*.dll")
+if(NOT engines STREQUAL "")
+ file(COPY ${engines} DESTINATION "${CURRENT_PACKAGES_DIR}/debug/bin")
+ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/lib/ossl-modules")
+endif()
diff --git a/vcpkg/ports/openssl/unix/remove-deps.cmake b/vcpkg/ports/openssl/unix/remove-deps.cmake
new file mode 100644
index 0000000..a57c70f
--- /dev/null
+++ b/vcpkg/ports/openssl/unix/remove-deps.cmake
@@ -0,0 +1,7 @@
+file(GLOB_RECURSE MAKEFILES ${DIR}/*/Makefile)
+foreach(MAKEFILE ${MAKEFILES})
+ message("removing deps from ${MAKEFILE}")
+ file(READ "${MAKEFILE}" _contents)
+ string(REGEX REPLACE "\n# DO NOT DELETE THIS LINE.*" "" _contents "${_contents}")
+ file(WRITE "${MAKEFILE}" "${_contents}")
+endforeach()
diff --git a/vcpkg/ports/openssl/usage b/vcpkg/ports/openssl/usage
new file mode 100644
index 0000000..14e12e9
--- /dev/null
+++ b/vcpkg/ports/openssl/usage
@@ -0,0 +1,5 @@
+openssl is compatible with built-in CMake targets:
+
+ find_package(OpenSSL REQUIRED)
+ target_link_libraries(main PRIVATE OpenSSL::SSL)
+ target_link_libraries(main PRIVATE OpenSSL::Crypto)
diff --git a/vcpkg/ports/openssl/vcpkg-cmake-wrapper.cmake.in b/vcpkg/ports/openssl/vcpkg-cmake-wrapper.cmake.in
new file mode 100644
index 0000000..5008112
--- /dev/null
+++ b/vcpkg/ports/openssl/vcpkg-cmake-wrapper.cmake.in
@@ -0,0 +1,82 @@
+cmake_policy(PUSH)
+cmake_policy(SET CMP0012 NEW)
+cmake_policy(SET CMP0054 NEW)
+cmake_policy(SET CMP0057 NEW)
+
+set(OPENSSL_VERSION_MAJOR @OPENSSL_VERSION_MAJOR@)
+set(OPENSSL_VERSION_MINOR @OPENSSL_VERSION_MINOR@)
+set(OPENSSL_VERSION_FIX @OPENSSL_VERSION_FIX@)
+
+if(OPENSSL_USE_STATIC_LIBS)
+ if("@VCPKG_LIBRARY_LINKAGE@" STREQUAL "dynamic")
+ message(WARNING "OPENSSL_USE_STATIC_LIBS is set, but vcpkg port openssl was built with dynamic linkage")
+ endif()
+ set(OPENSSL_USE_STATIC_LIBS_BAK "${OPENSSL_USE_STATIC_LIBS}")
+ set(OPENSSL_USE_STATIC_LIBS FALSE)
+endif()
+
+if(DEFINED OPENSSL_ROOT_DIR)
+ set(OPENSSL_ROOT_DIR_BAK "${OPENSSL_ROOT_DIR}")
+endif()
+get_filename_component(OPENSSL_ROOT_DIR "${CMAKE_CURRENT_LIST_DIR}" DIRECTORY)
+get_filename_component(OPENSSL_ROOT_DIR "${OPENSSL_ROOT_DIR}" DIRECTORY)
+find_path(OPENSSL_INCLUDE_DIR NAMES openssl/ssl.h PATH "${OPENSSL_ROOT_DIR}/include" NO_DEFAULT_PATH)
+if(MSVC)
+ find_library(LIB_EAY_DEBUG NAMES libcrypto PATHS "${OPENSSL_ROOT_DIR}/debug/lib" NO_DEFAULT_PATH)
+ find_library(LIB_EAY_RELEASE NAMES libcrypto PATHS "${OPENSSL_ROOT_DIR}/lib" NO_DEFAULT_PATH)
+ find_library(SSL_EAY_DEBUG NAMES libssl PATHS "${OPENSSL_ROOT_DIR}/debug/lib" NO_DEFAULT_PATH)
+ find_library(SSL_EAY_RELEASE NAMES libssl PATHS "${OPENSSL_ROOT_DIR}/lib" NO_DEFAULT_PATH)
+elseif(WIN32)
+ find_library(LIB_EAY NAMES libcrypto crypto NAMES_PER_DIR)
+ find_library(SSL_EAY NAMES libssl ssl NAMES_PER_DIR)
+else()
+ find_library(OPENSSL_CRYPTO_LIBRARY NAMES crypto)
+ find_library(OPENSSL_SSL_LIBRARY NAMES ssl)
+endif()
+
+_find_package(${ARGS})
+
+unset(OPENSSL_ROOT_DIR)
+if(DEFINED OPENSSL_ROOT_DIR_BAK)
+ set(OPENSSL_ROOT_DIR "${OPENSSL_ROOT_DIR_BAK}")
+ unset(OPENSSL_ROOT_DIR_BAK)
+endif()
+
+if(DEFINED OPENSSL_USE_STATIC_LIBS_BAK)
+ set(OPENSSL_USE_STATIC_LIBS "${OPENSSL_USE_STATIC_LIBS_BAK}")
+ unset(OPENSSL_USE_STATIC_LIBS_BAK)
+endif()
+
+if(OPENSSL_FOUND AND "@VCPKG_LIBRARY_LINKAGE@" STREQUAL "static")
+ if(WIN32)
+ list(APPEND OPENSSL_LIBRARIES crypt32 ws2_32)
+ if(TARGET OpenSSL::Crypto)
+ set_property(TARGET OpenSSL::Crypto APPEND PROPERTY INTERFACE_LINK_LIBRARIES "crypt32;ws2_32")
+ endif()
+ if(TARGET OpenSSL::SSL)
+ set_property(TARGET OpenSSL::SSL APPEND PROPERTY INTERFACE_LINK_LIBRARIES "crypt32;ws2_32")
+ endif()
+ else()
+ find_library(OPENSSL_DL_LIBRARY NAMES dl)
+ if(OPENSSL_DL_LIBRARY)
+ list(APPEND OPENSSL_LIBRARIES "dl")
+ if(TARGET OpenSSL::Crypto)
+ set_property(TARGET OpenSSL::Crypto APPEND PROPERTY INTERFACE_LINK_LIBRARIES "dl")
+ endif()
+ endif()
+
+ if("REQUIRED" IN_LIST ARGS)
+ find_package(Threads REQUIRED)
+ else()
+ find_package(Threads)
+ endif()
+ list(APPEND OPENSSL_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
+ if(TARGET OpenSSL::Crypto)
+ set_property(TARGET OpenSSL::Crypto APPEND PROPERTY INTERFACE_LINK_LIBRARIES "Threads::Threads")
+ endif()
+ if(TARGET OpenSSL::SSL)
+ set_property(TARGET OpenSSL::SSL APPEND PROPERTY INTERFACE_LINK_LIBRARIES "Threads::Threads")
+ endif()
+ endif()
+endif()
+cmake_policy(POP)
diff --git a/vcpkg/ports/openssl/vcpkg.json b/vcpkg/ports/openssl/vcpkg.json
new file mode 100644
index 0000000..755578a
--- /dev/null
+++ b/vcpkg/ports/openssl/vcpkg.json
@@ -0,0 +1,38 @@
+{
+ "name": "openssl",
+ "version": "3.6.0",
+ "port-version": 3,
+ "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.",
+ "homepage": "https://www.openssl.org",
+ "license": "Apache-2.0",
+ "dependencies": [
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ },
+ {
+ "name": "vcpkg-cmake-config",
+ "host": true
+ },
+ {
+ "name": "vcpkg-cmake-get-vars",
+ "host": true
+ }
+ ],
+ "features": {
+ "fips": {
+ "description": "Enable fips",
+ "supports": "!static"
+ },
+ "ssl3": {
+ "description": "Enable SSL3"
+ },
+ "tools": {
+ "description": "Install openssl executable and scripts",
+ "supports": "!uwp"
+ },
+ "weak-ssl-ciphers": {
+ "description": "Enable weak-ssl-ciphers"
+ }
+ }
+}
diff --git a/vcpkg/ports/openssl/windows/install-layout.patch b/vcpkg/ports/openssl/windows/install-layout.patch
new file mode 100644
index 0000000..be9df76
--- /dev/null
+++ b/vcpkg/ports/openssl/windows/install-layout.patch
@@ -0,0 +1,13 @@
+diff --git a/Configurations/windows-makefile.tmpl b/Configurations/windows-makefile.tmpl
+index f71f3bf..116954f 100644
+--- a/Configurations/windows-makefile.tmpl
++++ b/Configurations/windows-makefile.tmpl
+@@ -223,7 +223,7 @@ MODULESDIR_dev={- use File::Spec::Functions qw(:DEFAULT splitpath catpath);
+ splitpath($modulesprefix, 1);
+ our $modulesdir_dev = $modulesprefix_dev;
+ our $modulesdir_dir =
+- catdir($modulesprefix_dir, "ossl-modules");
++ catdir($modulesprefix_dir, "../bin");
+ our $modulesdir = catpath($modulesdir_dev, $modulesdir_dir);
+ our $enginesdir_dev = $modulesprefix_dev;
+ our $enginesdir_dir =
diff --git a/vcpkg/ports/openssl/windows/install-pdbs.patch b/vcpkg/ports/openssl/windows/install-pdbs.patch
new file mode 100644
index 0000000..5525454
--- /dev/null
+++ b/vcpkg/ports/openssl/windows/install-pdbs.patch
@@ -0,0 +1,46 @@
+diff --git a/Configurations/windows-makefile.tmpl b/Configurations/windows-makefile.tmpl
+index 5946c89..f71f3bf 100644
+--- a/Configurations/windows-makefile.tmpl
++++ b/Configurations/windows-makefile.tmpl
+@@ -564,8 +564,9 @@
+ "$(INSTALLTOP)\include\openssl"
+ @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(libdir)"
+ @"$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_LIBS) "$(libdir)"
+ @if "$(SHLIBS)"=="" \
++ @if "$(INSTALL_PDBS)"=="ON" \
+ "$(PERL)" "$(SRCDIR)\util\copy.pl" ossl_static.pdb "$(libdir)"
+ @"$(PERL)" "$(SRCDIR)\util\mkdir-p.pl" "$(CMAKECONFIGDIR)"
+ @"$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_EXPORTERS_CMAKE) "$(CMAKECONFIGDIR)"
+
+@@ -569,6 +570,7 @@ install_engines: _install_modules_deps
+ @if not "$(INSTALL_ENGINES)"=="" \
+ "$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_ENGINES) "$(ENGINESDIR)"
+ @if not "$(INSTALL_ENGINES)"=="" \
++ @if "$(INSTALL_PDBS)"=="ON" \
+ "$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_ENGINEPDBS) "$(ENGINESDIR)"
+
+ uninstall_engines:
+@@ -580,6 +582,7 @@ install_modules: _install_modules_deps
+ @if not "$(INSTALL_MODULES)"=="" \
+ "$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_MODULES) "$(MODULESDIR)"
+ @if not "$(INSTALL_MODULES)"=="" \
++ @if "$(INSTALL_PDBS)"=="ON" \
+ "$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_MODULEPDBS) "$(MODULESDIR)"
+
+ uninstall_modules:
+@@ -593,6 +596,7 @@ install_runtime_libs: build_libs
+ @if not "$(SHLIBS)"=="" \
+ "$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_SHLIBS) "$(INSTALLTOP)\bin"
+ @if not "$(SHLIBS)"=="" \
++ @if "$(INSTALL_PDBS)"=="ON" \
+ "$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_SHLIBPDBS) \
+ "$(INSTALLTOP)\bin"
+
+@@ -605,6 +609,7 @@ install_programs: install_runtime_libs build_programs
+ "$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_PROGRAMS) \
+ "$(INSTALLTOP)\bin"
+ @if not "$(INSTALL_PROGRAMS)"=="" \
++ @if "$(INSTALL_PDBS)"=="ON" \
+ "$(PERL)" "$(SRCDIR)\util\copy.pl" $(INSTALL_PROGRAMPDBS) \
+ "$(INSTALLTOP)\bin"
+ @if not "$(INSTALL_PROGRAMS)"=="" \
diff --git a/vcpkg/ports/openssl/windows/install-programs.diff b/vcpkg/ports/openssl/windows/install-programs.diff
new file mode 100644
index 0000000..257ad7d
--- /dev/null
+++ b/vcpkg/ports/openssl/windows/install-programs.diff
@@ -0,0 +1,13 @@
+diff --git a/Configurations/windows-makefile.tmpl b/Configurations/windows-makefile.tmpl
+index b587212..c031cfb 100644
+--- a/Configurations/windows-makefile.tmpl
++++ b/Configurations/windows-makefile.tmpl
+@@ -134,7 +134,7 @@ INSTALL_FIPSMODULE={-
+ -}
+ INSTALL_FIPSMODULECONF=providers\fipsmodule.cnf
+ INSTALL_PROGRAMS={-
+- join(" ", map { quotify1(platform->bin($_)) }
++ join(" ", map { platform->bin($_) }
+ grep { !$unified_info{attributes}->{programs}->{$_}->{noinst} }
+ @{$unified_info{programs}})
+ -}
diff --git a/vcpkg/ports/openssl/windows/portfile.cmake b/vcpkg/ports/openssl/windows/portfile.cmake
new file mode 100644
index 0000000..d35f309
--- /dev/null
+++ b/vcpkg/ports/openssl/windows/portfile.cmake
@@ -0,0 +1,158 @@
+# Need cmd to pass quoted CC from nmake to mkbuildinf.pl, GH-37134
+find_program(CMD_EXECUTABLE cmd HINTS ENV PATH NO_DEFAULT_PATH REQUIRED)
+cmake_path(NATIVE_PATH CMD_EXECUTABLE cmd)
+set(ENV{COMSPEC} "${cmd}")
+
+vcpkg_find_acquire_program(PERL)
+get_filename_component(PERL_EXE_PATH "${PERL}" DIRECTORY)
+vcpkg_add_to_path("${PERL_EXE_PATH}")
+
+vcpkg_cmake_get_vars(cmake_vars_file)
+include("${cmake_vars_file}")
+
+if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86")
+ set(OPENSSL_ARCH VC-WIN32)
+elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
+ set(OPENSSL_ARCH VC-WIN64A)
+elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm")
+ set(OPENSSL_ARCH VC-WIN32-ARM)
+elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
+ if(VCPKG_TARGET_IS_UWP)
+ set(OPENSSL_ARCH VC-WIN64-ARM)
+ elseif(VCPKG_DETECTED_CMAKE_C_COMPILER_ID MATCHES "Clang")
+ set(OPENSSL_ARCH VC-CLANG-WIN64-CLANGASM-ARM)
+ else()
+ set(OPENSSL_ARCH VC-WIN64-CLANGASM-ARM)
+ endif()
+else()
+ message(FATAL_ERROR "Unsupported target architecture: ${VCPKG_TARGET_ARCHITECTURE}")
+endif()
+
+if(VCPKG_TARGET_IS_UWP)
+ vcpkg_list(APPEND CONFIGURE_OPTIONS
+ no-unit-test
+ no-asm
+ no-uplink
+ )
+ string(APPEND OPENSSL_ARCH "-UWP")
+endif()
+
+if(VCPKG_CONCURRENCY GREATER "1")
+ vcpkg_list(APPEND CONFIGURE_OPTIONS no-makedepend)
+endif()
+
+cmake_path(NATIVE_PATH CURRENT_PACKAGES_DIR NORMALIZE install_dir_native)
+
+# Clang always uses /Z7; Patching /Zi /Fd<Name> out of openssl requires more work.
+set(OPENSSL_BUILD_MAKES_PDBS ON)
+if (VCPKG_DETECTED_CMAKE_C_COMPILER_ID MATCHES "Clang" OR VCPKG_LIBRARY_LINKAGE STREQUAL "static")
+ set(OPENSSL_BUILD_MAKES_PDBS OFF)
+endif()
+
+cmake_path(NATIVE_PATH VCPKG_DETECTED_CMAKE_C_COMPILER NORMALIZE cc)
+if(OPENSSL_ARCH MATCHES "CLANG")
+ vcpkg_find_acquire_program(CLANG)
+ cmake_path(GET CLANG PARENT_PATH clang_path)
+ vcpkg_add_to_path("${clang_path}")
+ if(VCPKG_DETECTED_CMAKE_C_COMPILER_ID MATCHES "Clang")
+ string(APPEND VCPKG_COMBINED_C_FLAGS_DEBUG " --target=aarch64-win32-msvc")
+ string(APPEND VCPKG_COMBINED_C_FLAGS_RELEASE " --target=aarch64-win32-msvc")
+ endif()
+endif()
+if(OPENSSL_ARCH MATCHES "CLANGASM")
+ vcpkg_list(APPEND CONFIGURE_OPTIONS "ASFLAGS=--target=aarch64-win32-msvc")
+else()
+ vcpkg_find_acquire_program(NASM)
+ cmake_path(NATIVE_PATH NASM NORMALIZE as)
+ cmake_path(GET NASM PARENT_PATH nasm_path)
+ vcpkg_add_to_path("${nasm_path}") # Needed by Configure
+endif()
+
+cmake_path(NATIVE_PATH VCPKG_DETECTED_CMAKE_AR NORMALIZE ar)
+cmake_path(NATIVE_PATH VCPKG_DETECTED_CMAKE_LINKER NORMALIZE ld)
+
+vcpkg_build_nmake(
+ SOURCE_PATH "${SOURCE_PATH}"
+ PREFER_JOM
+ CL_LANGUAGE NONE
+ PRERUN_SHELL_RELEASE "${PERL}" Configure
+ ${CONFIGURE_OPTIONS}
+ ${OPENSSL_ARCH}
+ "--prefix=${install_dir_native}"
+ "--openssldir=${install_dir_native}"
+ "AS=${as}"
+ "CC=${cc}"
+ "CFLAGS=${VCPKG_COMBINED_C_FLAGS_RELEASE}"
+ "AR=${ar}"
+ "ARFLAGS=${VCPKG_COMBINED_STATIC_LINKER_FLAGS_RELEASE}"
+ "LD=${ld}"
+ "LDFLAGS=${VCPKG_COMBINED_SHARED_LINKER_FLAGS_RELEASE}"
+ PRERUN_SHELL_DEBUG "${PERL}" Configure
+ ${CONFIGURE_OPTIONS}
+ ${OPENSSL_ARCH}
+ --debug
+ "--prefix=${install_dir_native}\\debug"
+ "--openssldir=${install_dir_native}\\debug"
+ "AS=${as}"
+ "CC=${cc}"
+ "CFLAGS=${VCPKG_COMBINED_C_FLAGS_DEBUG}"
+ "AR=${ar}"
+ "ARFLAGS=${VCPKG_COMBINED_STATIC_LINKER_FLAGS_DEBUG}"
+ "LD=${ld}"
+ "LDFLAGS=${VCPKG_COMBINED_SHARED_LINKER_FLAGS_DEBUG}"
+ PROJECT_NAME "makefile"
+ TARGET install_dev install_modules ${INSTALL_FIPS}
+ LOGFILE_ROOT install
+ OPTIONS
+ "INSTALL_PDBS=${OPENSSL_BUILD_MAKES_PDBS}" # install-pdbs.patch
+ OPTIONS_RELEASE
+ install_runtime install_ssldirs # extra targets
+)
+
+set(scripts "bin/c_rehash.pl" "misc/CA.pl" "misc/tsget.pl")
+if("tools" IN_LIST FEATURES)
+ file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools/${PORT}")
+ file(RENAME "${CURRENT_PACKAGES_DIR}/openssl.cnf" "${CURRENT_PACKAGES_DIR}/tools/${PORT}/openssl.cnf")
+ if("fips" IN_LIST FEATURES)
+ file(RENAME "${CURRENT_PACKAGES_DIR}/fipsmodule.cnf" "${CURRENT_PACKAGES_DIR}/tools/${PORT}/fipsmodule.cnf")
+ endif()
+ foreach(script IN LISTS scripts)
+ file(COPY "${CURRENT_PACKAGES_DIR}/${script}" DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}")
+ file(REMOVE "${CURRENT_PACKAGES_DIR}/${script}" "${CURRENT_PACKAGES_DIR}/debug/${script}")
+ endforeach()
+ vcpkg_copy_tools(TOOL_NAMES openssl AUTO_CLEAN)
+else()
+ file(REMOVE "${CURRENT_PACKAGES_DIR}/openssl.cnf")
+ file(REMOVE "${CURRENT_PACKAGES_DIR}/fipsmodule.cnf")
+ foreach(script IN LISTS scripts)
+ file(REMOVE "${CURRENT_PACKAGES_DIR}/${script}" "${CURRENT_PACKAGES_DIR}/debug/${script}")
+ endforeach()
+ if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
+ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
+ endif()
+endif()
+
+vcpkg_copy_pdbs()
+
+file(REMOVE_RECURSE
+ "${CURRENT_PACKAGES_DIR}/certs"
+ "${CURRENT_PACKAGES_DIR}/misc"
+ "${CURRENT_PACKAGES_DIR}/private"
+ "${CURRENT_PACKAGES_DIR}/lib/engines-3"
+ "${CURRENT_PACKAGES_DIR}/debug/certs"
+ "${CURRENT_PACKAGES_DIR}/debug/misc"
+ "${CURRENT_PACKAGES_DIR}/debug/lib/engines-3"
+ "${CURRENT_PACKAGES_DIR}/debug/private"
+ "${CURRENT_PACKAGES_DIR}/debug/include"
+ "${CURRENT_PACKAGES_DIR}/debug/share"
+)
+file(REMOVE
+ "${CURRENT_PACKAGES_DIR}/ct_log_list.cnf"
+ "${CURRENT_PACKAGES_DIR}/ct_log_list.cnf.dist"
+ "${CURRENT_PACKAGES_DIR}/openssl.cnf.dist"
+ "${CURRENT_PACKAGES_DIR}/debug/ct_log_list.cnf"
+ "${CURRENT_PACKAGES_DIR}/debug/ct_log_list.cnf.dist"
+ "${CURRENT_PACKAGES_DIR}/debug/openssl.cnf"
+ "${CURRENT_PACKAGES_DIR}/debug/openssl.cnf.dist"
+ "${CURRENT_PACKAGES_DIR}/debug/fipsmodule.cnf"
+)