Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 0 additions & 38 deletions ports/libpq/patches/windows/host_skip_openssl.patch

This file was deleted.

14 changes: 14 additions & 0 deletions ports/libpq/patches/windows/openssl-version.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
diff --git a/src/tools/msvc/Solution.pm b/src/tools/msvc/Solution.pm
index 72c5b98..0d153c0 100644
--- a/src/tools/msvc/Solution.pm
+++ b/src/tools/msvc/Solution.pm
@@ -128,6 +128,9 @@ sub copyFile
sub GetOpenSSLVersion
{
my $self = shift;
+ if (($ENV{'VCPKG_OPENSSL_VERSION'} // '') =~ /(\d+)\.(\d+)\.(\d+)/m) {
+ return ($1, $2, $3);
+ }

# Attempt to get OpenSSL version and location. This assumes that
# openssl.exe is in the specified directory.
13 changes: 0 additions & 13 deletions ports/libpq/patches/windows/openssl_exe_path.patch

This file was deleted.

10 changes: 6 additions & 4 deletions ports/libpq/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ vcpkg_download_distfile(ARCHIVE
set(PATCHES
patches/windows/install.patch
patches/windows/win_bison_flex.patch
patches/windows/openssl_exe_path.patch
patches/windows/openssl-version.patch
patches/windows/Solution.patch
patches/windows/MSBuildProject_fix_gendef_perl.patch
patches/windows/msgfmt.patch
Expand All @@ -31,7 +31,6 @@ if(VCPKG_CRT_LINKAGE STREQUAL "static")
endif()
if(VCPKG_TARGET_ARCHITECTURE MATCHES "arm")
list(APPEND PATCHES patches/windows/arm.patch)
list(APPEND PATCHES patches/windows/host_skip_openssl.patch) # Skip openssl.exe version check since it cannot be executed by the host
endif()
if(NOT "${FEATURES}" MATCHES "client")
list(APPEND PATCHES patches/windows/minimize_install.patch)
Expand Down Expand Up @@ -88,6 +87,11 @@ if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
vcpkg_cmake_get_vars(vars_file)
include("${vars_file}")

file(STRINGS "${CURRENT_INSTALLED_DIR}/lib/pkgconfig/openssl.pc" OPENSSL_VERSION REGEX "Version:")
if(OPENSSL_VERSION)
set(ENV{VCPKG_OPENSSL_VERSION} "${OPENSSL_VERSION}")
endif()

file(GLOB SOURCE_FILES ${SOURCE_PATH}/*)
foreach(_buildtype ${port_config_list})
# Copy libpq sources.
Expand Down Expand Up @@ -140,8 +144,6 @@ if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
vcpkg_add_to_path("${MSYS_ROOT}/usr/bin")
endif()
if("${FEATURES}" MATCHES "openssl")
set(buildenv_contents "${buildenv_contents}\n\$ENV{'PATH'}=\$ENV{'PATH'} . ';${CURRENT_INSTALLED_DIR}/tools/openssl';")
#set(_contents "${_contents}\n\$ENV{PATH}=\$ENV{PATH} . ';${CURRENT_INSTALLED_DIR}/tools/openssl';")
string(REPLACE "openssl => undef" "openssl => \"${CURRENT_INSTALLED_DIR}\"" _contents "${_contents}")
endif()
if("${FEATURES}" MATCHES "python")
Expand Down
1 change: 1 addition & 0 deletions ports/libpq/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "libpq",
"version": "15.2",
"port-version": 1,
"description": "The official database access API of postgresql",
"homepage": "https://www.postgresql.org/",
"license": "PostgreSQL",
Expand Down
12 changes: 12 additions & 0 deletions ports/openssl/disable-apps.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/Configure b/Configure
index 5ac4b52..ad638e8 100755
--- a/Configure
+++ b/Configure
@@ -401,6 +401,7 @@ my @dtls = qw(dtls1 dtls1_2);
my @disablables = (
"acvp-tests",
"afalgeng",
+ "apps",
"aria",
"asan",
"asm",
6 changes: 6 additions & 0 deletions ports/openssl/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@ vcpkg_from_github(
REF "openssl-${VERSION}"
SHA512 5a821aaaaa89027ce08a347e5fc216757c2971e29f7d24792609378c54f657839b3775bf639e7330b28b4f96ef0d32869f0a96afcb25c8a2e1c2fe51a6eb4aa3
PATCHES
disable-apps.patch
disable-install-docs.patch
script-prefix.patch
windows/install-layout.patch
windows/install-pdbs.patch
windows/umul128-arm64.patch # Fixed upstream in https://github.com/openssl/openssl/pull/20244, but not released as of 3.0.8
unix/android-cc.patch
unix/move-openssldir.patch
unix/no-empty-dirs.patch
unix/no-static-libs-for-shared.patch
Expand All @@ -45,6 +47,10 @@ 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(DEFINED OPENSSL_USE_NOPINSHARED)
vcpkg_list(APPEND CONFIGURE_OPTIONS no-pinshared)
endif()
Expand Down
4 changes: 4 additions & 0 deletions ports/openssl/unix/Makefile.emscripten
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
build_sw:
$(EMSDK)/upstream/emscripten/emmake $(MAKE) -f Makefile build_sw ${VCPKG_JOBS} $(MAKEFLAGS)
install:
$(EMSDK)/upstream/emscripten/emmake $(MAKE) -f Makefile install ${VCPKG_JOBS} $(MAKEFLAGS)
20 changes: 20 additions & 0 deletions ports/openssl/unix/android-cc.patch
Original file line number Diff line number Diff line change
@@ -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,
2 changes: 1 addition & 1 deletion ports/openssl/unix/configure
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ for OPTION; do
INTERPRETER="${LAST_SEEN}"
COPY_OPTIONS=yes
;;
--prefix=*|--openssldir=*|--libdir=*|--debug,*)
--prefix=*|--openssldir=*|--libdir=*|--cross-compile-prefix=*|--debug,*)
OUT_OPTIONS+=("${OPTION}")
;;
-*|*=*)
Expand Down
55 changes: 38 additions & 17 deletions ports/openssl/unix/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,26 @@ 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.
Comment on lines +30 to +32
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For Android, the port now uses vcpkg settings, including absolute paths for CC.
We may eventually patch it for other triplets, too - but in another PR.

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)
if(VCPKG_TARGET_ARCHITECTURE MATCHES "arm64")
set(OPENSSL_ARCH android-arm64)
elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "arm")
set(OPENSSL_ARCH android-arm)
elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "x64")
set(OPENSSL_ARCH android-x86_64)
elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "x86")
set(OPENSSL_ARCH android-x86)
else()
message(FATAL_ERROR "Unknown iOS target architecture: ${VCPKG_TARGET_ARCHITECTURE}")
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")
Expand Down Expand Up @@ -79,8 +88,12 @@ elseif(VCPKG_TARGET_IS_MINGW)
endif()
elseif(VCPKG_TARGET_IS_EMSCRIPTEN)
set(INTERPRETER "$ENV{EMSDK}/upstream/emscripten/emconfigure")
set(MAKE "$ENV{EMSDK}/upstream/emscripten/emmake")
set(ENV{MAKE} "${MAKE}")
# We must wrap the build in emmake which does not pass jobserver fds.
vcpkg_list(SET MAKEFILE_OPTIONS
MAKEFILE "${CMAKE_CURRENT_LIST_DIR}/Makefile.emscripten"
DISABLE_PARALLEL
)
set(ENV{VCPKG_JOBS} "-j${VCPKG_CONCURRENCY}")
vcpkg_list(APPEND CONFIGURE_OPTIONS
threads
no-engine
Expand Down Expand Up @@ -109,13 +122,21 @@ vcpkg_configure_make(
OPTIONS_DEBUG
--debug
)
vcpkg_install_make(BUILD_TARGET build_sw)
vcpkg_install_make(
${MAKEFILE_OPTIONS}
BUILD_TARGET build_sw
)
vcpkg_fixup_pkgconfig()

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)
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")
Expand Down
13 changes: 9 additions & 4 deletions ports/openssl/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "openssl",
"version": "3.0.8",
"port-version": 1,
"port-version": 2,
"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",
Expand All @@ -16,8 +16,13 @@
},
{
"name": "vcpkg-cmake-get-vars",
"host": true,
"platform": "windows & !mingw"
"host": true
}
],
"features": {
"tools": {
"description": "Install openssl executable and scripts",
"supports": "!uwp"
}
]
}
}
17 changes: 13 additions & 4 deletions ports/openssl/windows/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,23 @@ vcpkg_build_nmake(
install_runtime install_ssldirs # extra targets
)

file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools/${PORT}")
file(RENAME "${CURRENT_PACKAGES_DIR}/openssl.cnf" "${CURRENT_PACKAGES_DIR}/tools/${PORT}/openssl.cnf")
if(NOT VCPKG_TARGET_IS_UWP)
foreach(script IN ITEMS "bin/c_rehash.pl" "misc/CA.pl" "misc/tsget.pl")
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")
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")
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()
Expand Down
Loading