Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build after vcpkg update #6061

Draft
wants to merge 14 commits into
base: master
Choose a base branch
from
Draft
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
96 changes: 96 additions & 0 deletions 3rdParty/vcpkg_ports/ports/openssl/asm-armcap.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
diff --git a/crypto/armv4cpuid.pl b/crypto/armv4cpuid.pl
index 04b342551c..9b933c70c4 100644
--- a/crypto/armv4cpuid.pl
+++ b/crypto/armv4cpuid.pl
@@ -293,6 +293,7 @@ atomic_add_spinlock:
#endif

.extern OPENSSL_armcap_P
+.hidden OPENSSL_armcap_P
___

print $code;
diff --git a/crypto/bn/asm/armv4-gf2m.pl b/crypto/bn/asm/armv4-gf2m.pl
index 17af0e0774..5733a01746 100644
--- a/crypto/bn/asm/armv4-gf2m.pl
+++ b/crypto/bn/asm/armv4-gf2m.pl
@@ -326,6 +326,7 @@ $code.=<<___;

#if __ARM_MAX_ARCH__>=7
.extern OPENSSL_armcap_P
+.hidden OPENSSL_armcap_P
#endif
___

diff --git a/crypto/bn/asm/armv4-mont.pl b/crypto/bn/asm/armv4-mont.pl
index d85da92406..6e839d845c 100644
--- a/crypto/bn/asm/armv4-mont.pl
+++ b/crypto/bn/asm/armv4-mont.pl
@@ -750,6 +750,7 @@ $code.=<<___;
.align 2
#if __ARM_MAX_ARCH__>=7
.extern OPENSSL_armcap_P
+.hidden OPENSSL_armcap_P
#endif
___

diff --git a/crypto/chacha/asm/chacha-armv4.pl b/crypto/chacha/asm/chacha-armv4.pl
index ac32d5bda7..bb48b6eeb9 100755
--- a/crypto/chacha/asm/chacha-armv4.pl
+++ b/crypto/chacha/asm/chacha-armv4.pl
@@ -1155,6 +1155,7 @@ $code.=<<___;
ldmia sp!,{r4-r11,pc}
.size ChaCha20_neon,.-ChaCha20_neon
.extern OPENSSL_armcap_P
+.hidden OPENSSL_armcap_P
#endif
___
}}}
diff --git a/crypto/poly1305/asm/poly1305-armv4.pl b/crypto/poly1305/asm/poly1305-armv4.pl
index b98beefa18..673ea62ec3 100755
--- a/crypto/poly1305/asm/poly1305-armv4.pl
+++ b/crypto/poly1305/asm/poly1305-armv4.pl
@@ -1240,6 +1240,7 @@ $code.=<<___;
.align 2
#if __ARM_MAX_ARCH__>=7
.extern OPENSSL_armcap_P
+.hidden OPENSSL_armcap_P
#endif
___

diff --git a/crypto/sha/asm/sha1-armv4-large.pl b/crypto/sha/asm/sha1-armv4-large.pl
index 2832c5b530..b3a8ec6941 100644
--- a/crypto/sha/asm/sha1-armv4-large.pl
+++ b/crypto/sha/asm/sha1-armv4-large.pl
@@ -708,6 +708,7 @@ ___
$code.=<<___;
#if __ARM_MAX_ARCH__>=7
.extern OPENSSL_armcap_P
+.hidden OPENSSL_armcap_P
#endif
___

diff --git a/crypto/sha/asm/sha256-armv4.pl b/crypto/sha/asm/sha256-armv4.pl
index 8bac84b1a8..feb1f26109 100644
--- a/crypto/sha/asm/sha256-armv4.pl
+++ b/crypto/sha/asm/sha256-armv4.pl
@@ -694,6 +694,7 @@ $code.=<<___;
.align 2
#if __ARM_MAX_ARCH__>=7 && !defined(__KERNEL__)
.extern OPENSSL_armcap_P
+.hidden OPENSSL_armcap_P
#endif
___

diff --git a/crypto/sha/asm/sha512-armv4.pl b/crypto/sha/asm/sha512-armv4.pl
index c8b8110671..9aa310ffd0 100644
--- a/crypto/sha/asm/sha512-armv4.pl
+++ b/crypto/sha/asm/sha512-armv4.pl
@@ -661,6 +661,7 @@ $code.=<<___;
.align 2
#if __ARM_MAX_ARCH__>=7 && !defined(__KERNEL__)
.extern OPENSSL_armcap_P
+.hidden OPENSSL_armcap_P
#endif
___

62 changes: 62 additions & 0 deletions 3rdParty/vcpkg_ports/ports/openssl/cmake-config.patch
Original file line number Diff line number Diff line change
@@ -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)
13 changes: 13 additions & 0 deletions 3rdParty/vcpkg_ports/ports/openssl/command-line-length.patch
Original file line number Diff line number Diff line change
@@ -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') ? 80 : 500;
my @objs_grouped;
push @objs_grouped, join(" ", splice @objs, 0, $max_per_call) while @objs;
my $fill_lib =
32 changes: 32 additions & 0 deletions 3rdParty/vcpkg_ports/ports/openssl/install-pc-files.cmake
Original file line number Diff line number Diff line change
@@ -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()
15 changes: 15 additions & 0 deletions 3rdParty/vcpkg_ports/ports/openssl/mkbuildinf.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
diff --git a/util/mkbuildinf.pl b/util/mkbuildinf.pl
index a57c80a..5cecf83 100755
--- a/util/mkbuildinf.pl
+++ b/util/mkbuildinf.pl
@@ -9,7 +9,9 @@
use strict;
use warnings;

-my ($cflags, $platform) = @ARGV;
+my $platform = pop @ARGV;
+my $cflags = join(' ', @ARGV);
+$cflags =~ s(\\)(\\\\)g;
$cflags = "compiler: $cflags";

# Use the value of the envvar SOURCE_DATE_EPOCH, even if it's
6 changes: 6 additions & 0 deletions 3rdParty/vcpkg_ports/ports/openssl/openssl.pc.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
prefix=${pcfiledir}/../..
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Version: @VERSION@
@pc_data@
86 changes: 86 additions & 0 deletions 3rdParty/vcpkg_ports/ports/openssl/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
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 d5f78b2e9d7b7b4787c976c4f832b1448bbadf5f9d398a50ef98053f92501768d000aa73673af200568aef4c8a491442ebbee8c43556838f465d4f91dfc2b5ad
PATCHES
cmake-config.patch
command-line-length.patch
mkbuildinf.diff
script-prefix.patch
asm-armcap.patch
windows/install-layout.patch
windows/install-pdbs.patch
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
)

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")
22 changes: 22 additions & 0 deletions 3rdParty/vcpkg_ports/ports/openssl/script-prefix.patch
Original file line number Diff line number Diff line change
@@ -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 (! -x $openssl) {
my $found = 0;
20 changes: 20 additions & 0 deletions 3rdParty/vcpkg_ports/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,
31 changes: 31 additions & 0 deletions 3rdParty/vcpkg_ports/ports/openssl/unix/configure
Original file line number Diff line number Diff line change
@@ -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[@]}
Loading