Skip to content
Closed
Show file tree
Hide file tree
Changes from 3 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
92 changes: 92 additions & 0 deletions ports/quictls/detect_platform.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
#
# References
# - ${VCPKG_ROOT}/scripts/cmake/vcpkg_common_definitions.cmake
# - ${SOURCE_PATH}/Configuration/README-design.md
# - ${SOURCE_PATH}/Configuration/10-main.conf
#
Comment thread
NancyLi1013 marked this conversation as resolved.
Outdated
if(VCPKG_TARGET_IS_ANDROID)
# ${SOURCE_PATH}/Configuration/15-android.conf
if(VCPKG_TARGET_ARCHITECTURE MATCHES "arm64")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In general, also, this should use STREQUAL

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I habitually used the expression. Replaced them to STREQUAL in e7e0901.

set(PLATFORM "android-arm64")
elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "arm")
set(PLATFORM "android-arm")
elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "x64")
set(PLATFORM "android-x86_64")
elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "x86")
set(PLATFORM "android-x86")
endif()

elseif(VCPKG_TARGET_IS_LINUX)
if(VCPKG_TARGET_ARCHITECTURE MATCHES "arm")
set(PLATFORM "linux-armv4")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is there a reason we're skipping arm64?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No. It's sad I can't check build works with the triplet :(
Added it in e7e0901

elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
set(PLATFORM "linux-x86_64")
else()
set(PLATFORM "linux-generic32")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this feels... wrong, what is linux-generic32? Shouldn't this check for STREQUAL "x86"?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in e7e0901. Changed the value to linux-x86 and checks VCPKG_TARGET_ARCHITECTURE.

endif()

elseif(VCPKG_TARGET_IS_IOS)
# ${SOURCE_PATH}/Configuration/15-ios.conf
if(VCPKG_TARGET_ARCHITECTURE MATCHES "arm64")
set(PLATFORM "ios64-xcrun")
elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "arm")
set(PLATFORM "ios-xcrun")
elseif(VCPKG_TARGET_ARCHITECTURE MATCHES "x86" OR
VCPKG_TARGET_ARCHITECTURE MATCHES "x64")
set(PLATFORM "iossimulator-xcrun")
else()
message(FATAL_ERROR "Unknown iOS target architecture: ${VCPKG_TARGET_ARCHITECTURE}")
Comment thread
luncliff marked this conversation as resolved.
Outdated
endif()

elseif(VCPKG_TARGET_IS_OSX)
if(VCPKG_TARGET_ARCHITECTURE MATCHES "arm64")
set(PLATFORM "darwin64-arm64-cc")
else()
set(PLATFORM "darwin64-x86_64-cc")
endif()

elseif(VCPKG_TARGET_IS_FREEBSD OR VCPKG_TARGET_IS_OPENBSD)
set(PLATFORM "BSD-generic64")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

please make sure that this only sets up x64 on x64.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added explicit check of VCPKG_TARGET_ARCHITECTURE like the other cases in e7e0901.


elseif(VCPKG_TARGET_IS_MINGW)
if(VCPKG_TARGET_ARCHITECTURE MATCHES "64")
set(PLATFORM "mingw64")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

probably wants to be x86_64 or x86, not doing this matching.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That was a mistype. Nice point 👍 Fixed in e7e0901.

else()
set(PLATFORM "mingw")
endif()

elseif(VCPKG_TARGET_IS_UWP)
# ${SOURCE_PATH}/Configuration/50-win-onecore.conf
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86")
set(PLATFORM VC-WIN32-UWP)
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
set(PLATFORM VC-WIN64A-UWP)
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm")
set(PLATFORM VC-WIN32-ARM-UWP)
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
set(PLATFORM VC-WIN64-ARM-UWP)
else()
message(FATAL_ERROR "Unknown UWP target architecture: ${VCPKG_TARGET_ARCHITECTURE}")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We already have fatal errors at the bottom of this file.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I wanted to give more hint that it's a issue for the platform.
Made fallthrough to the bottom check.

endif()

elseif(VCPKG_TARGET_IS_WINDOWS)
# ${SOURCE_PATH}/Configuration/50-win-onecore.conf
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86")
set(PLATFORM "VC-WIN32")
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
set(PLATFORM "VC-WIN64A")
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm")
set(PLATFORM "VC-WIN32-ARM")
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
set(PLATFORM "VC-WIN64-ARM")
else()
message(FATAL_ERROR "Unknown Windows target architecture: ${VCPKG_TARGET_ARCHITECTURE}")
Comment thread
luncliff marked this conversation as resolved.
Outdated
endif()

else()
message(FATAL_ERROR "Unknown platform")
endif()

if(NOT DEFINED PLATFORM)
message(FATAL_ERROR "Failed to detect target platform/architecture")
endif()
12 changes: 12 additions & 0 deletions ports/quictls/fix-http.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/crypto/http/http_lib.c b/crypto/http/http_lib.c
index f0fc770..a73ecf6 100644
--- a/crypto/http/http_lib.c
+++ b/crypto/http/http_lib.c
@@ -12,6 +12,7 @@
#include <openssl/bio.h> /* for BIO_snprintf() */
#include <openssl/err.h>
#include <string.h>
+#include <stdio.h>
#include "internal/cryptlib.h" /* for ossl_assert() */

#include "http_local.h"
193 changes: 193 additions & 0 deletions ports/quictls/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
if(EXISTS ${CURRENT_INSTALLED_DIR}/include/openssl/ssl.h)
message(FATAL_ERROR "Can't build '${PORT}' if another SSL library is installed. Please remove existing one and try install '${PORT}' again if you need it.")
endif()

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO quictls/openssl
REF 77248f1c1c8ea8dc57d624050b78eab0b3a10a04 # 2021-05-03
SHA512 881639f0bfd83858ce5d28aaf013dc34105cbc9c2fcc040c873c41ca45a0ea3dcb9dfd8e81821b21e92d4b9577f86d11ac010bb1f3746713892969c62d46fda6
HEAD_REF openssl-3.0.0-alpha15+quic
Comment thread
luncliff marked this conversation as resolved.
Outdated
PATCHES
fix-http.patch

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Why is this needed? We don't need then when we build via submodule in msquic.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

What I intended is supporting SSL selection as a feature of future ms-quic port. It will be like ms-quic[core](with schannel), ms-quic[quictls](with quictls/opnessl), etc.

)

# Option: shared/static
set(OPENSSL_SHARED no-shared)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
set(OPENSSL_SHARED shared)
endif()

# Option: feature / algorithms
list(APPEND CONFIGURE_OPTIONS
Comment thread
luncliff marked this conversation as resolved.
# from existing 'openssl' port
enable-static-engine enable-capieng
# from 'microsoft/msquic'
enable-tls1_3 no-makedepend no-dgram no-ssl3 no-psk no-srp
no-zlib no-egd no-idea no-rc5 no-rc4 no-afalgeng
no-comp no-cms no-ct no-srp no-srtp no-ts no-gost no-dso no-ec2m
no-tls1 no-tls1_1 no-tls1_2 no-dtls no-dtls1 no-dtls1_2 no-ssl
no-ssl3-method no-tls1-method no-tls1_1-method no-tls1_2-method no-dtls1-method no-dtls1_2-method
no-siphash no-whirlpool no-aria no-bf no-blake2 no-sm2 no-sm3 no-sm4 no-camellia no-cast no-md4 no-mdc2 no-ocb no-rc2 no-rmd160 no-scrypt
no-weak-ssl-ciphers no-tests
)
if(VCPKG_TARGET_IS_WINDOWS)
# jom will build in parallel mode, so we need /FS
list(APPEND CONFIGURE_OPTIONS -utf-8 -FS)

elseif(VCPKG_TARGET_IS_IOS)
# see https://github.com/microsoft/vcpkg PR 12527
# disable that makes linkage error (e.g. require stderr usage)
list(APPEND CONFIGURE_OPTIONS no-stdio no-ui no-asm)

endif()

# Option: platform/architecture
include(${CMAKE_CURRENT_LIST_DIR}/detect_platform.cmake)
message(STATUS "Targeting: ${PLATFORM}")

# Clean & copy source files for working directories
file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg
${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel
)
get_filename_component(SOURCE_DIR_NAME ${SOURCE_PATH} NAME)
file(COPY ${SOURCE_PATH}
DESTINATION ${CURRENT_BUILDTREES_DIR})
file(RENAME ${CURRENT_BUILDTREES_DIR}/${SOURCE_DIR_NAME}
${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg)
file(COPY ${SOURCE_PATH}
DESTINATION ${CURRENT_BUILDTREES_DIR})
file(RENAME ${CURRENT_BUILDTREES_DIR}/${SOURCE_DIR_NAME}
${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel)

# see ${SOURCE_PATH}/NOTES-PERL.md
vcpkg_find_acquire_program(PERL)
get_filename_component(PERL_EXE_PATH ${PERL} DIRECTORY)
vcpkg_add_to_path(${PERL_EXE_PATH})

if(NOT VCPKG_HOST_IS_WINDOWS)
# see ${SOURCE_PATH}/NOTES-UNIX.md
find_program(MAKE make)
get_filename_component(MAKE_EXE_PATH ${MAKE} DIRECTORY)
endif()

if(VCPKG_TARGET_IS_WINDOWS)
# see ${SOURCE_PATH}/NOTES-WINDOWS.md
vcpkg_find_acquire_program(NASM)
get_filename_component(NASM_EXE_PATH ${NASM} DIRECTORY)
vcpkg_add_to_path(PREPEND ${NASM_EXE_PATH})
# note: jom is not for `vcpkg_add_to_path`
vcpkg_find_acquire_program(JOM)

elseif(VCPKG_TARGET_IS_ANDROID)
# see ${SOURCE_PATH}/NOTES-ANDROID.md
if(NOT DEFINED ENV{ANDROID_NDK_ROOT} AND DEFINED ENV{ANDROID_NDK_HOME})
message(STATUS "ENV{ANDROID_NDK_ROOT} will be set to $ENV{ANDROID_NDK_HOME}")
set(ENV{ANDROID_NDK_ROOT} $ENV{ANDROID_NDK_HOME})
endif()
if(NOT DEFINED ENV{ANDROID_NDK_ROOT})
message(FATAL_ERROR "ENV{ANDROID_NDK_ROOT} is required by ${SOURCE_PATH}/Configurations/15-android.conf")
endif()
if(VCPKG_HOST_IS_LINUX)
set(NDK_HOST_TAG "linux-x86_64")
elseif(VCPKG_HOST_IS_OSX)
set(NDK_HOST_TAG "darwin-x86_64")
elseif(VCPKG_HOST_IS_WINDOWS)
set(NDK_HOST_TAG "windows-x86_64")
else()
message(FATAL_ERROR "Unknown NDK host platform")
endif()
get_filename_component(NDK_TOOL_PATH $ENV{ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${NDK_HOST_TAG}/bin ABSOLUTE)
message(STATUS "Using NDK: ${NDK_TOOL_PATH}")
vcpkg_add_to_path(PREPEND ${NDK_TOOL_PATH})

endif()

# Configure / Install
# We need a PERL so can't use `vcpkg_configure_make` directly...
message(STATUS "Configuring ${TARGET_TRIPLET}-dbg")
vcpkg_execute_required_process(
COMMAND ${PERL} Configure ${OPENSSL_SHARED} ${CONFIGURE_OPTIONS}
${PLATFORM}
"--prefix=${CURRENT_PACKAGES_DIR}/debug"
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg
LOGNAME configure-perl-${TARGET_TRIPLET}-dbg
)
message(STATUS "Configuring ${TARGET_TRIPLET}-rel")
vcpkg_execute_required_process(
COMMAND ${PERL} Configure ${OPENSSL_SHARED} ${CONFIGURE_OPTIONS}
${PLATFORM}
"--prefix=${CURRENT_PACKAGES_DIR}"
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel
LOGNAME configure-perl-${TARGET_TRIPLET}-rel
)

if(VCPKG_TARGET_IS_UWP OR VCPKG_TARGET_IS_WINDOWS)
message(STATUS "Building ${TARGET_TRIPLET}-dbg")
vcpkg_execute_required_process(
COMMAND ${JOM} /K /J ${VCPKG_CONCURRENCY} /F makefile install_dev
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg
LOGNAME install-${TARGET_TRIPLET}-dbg
)
message(STATUS "Building ${TARGET_TRIPLET}-rel")
vcpkg_execute_required_process(
COMMAND ${JOM} /K /J ${VCPKG_CONCURRENCY} /F makefile install_dev
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel
LOGNAME install-${TARGET_TRIPLET}-rel
)
vcpkg_copy_pdbs()

else()
message(STATUS "Building ${TARGET_TRIPLET}-dbg")
vcpkg_execute_required_process(
COMMAND ${MAKE} -j ${VCPKG_CONCURRENCY} install_dev
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg
LOGNAME install-${TARGET_TRIPLET}-dbg
)
message(STATUS "Building ${TARGET_TRIPLET}-rel")
vcpkg_execute_required_process(
COMMAND ${MAKE} -j ${VCPKG_CONCURRENCY} install_dev
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel
LOGNAME install-${TARGET_TRIPLET}-rel
)
if(VCPKG_TARGET_IS_ANDROID)
# install_dev copies symbolic link. overwrite them with the actual shared objects
file(INSTALL ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/libcrypto.so
${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/libssl.so
DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib
)
file(INSTALL ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/libcrypto.so
${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/libssl.so
DESTINATION ${CURRENT_PACKAGES_DIR}/lib
)
endif()
vcpkg_fixup_pkgconfig()

endif()

if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/libcrypto.a
${CURRENT_PACKAGES_DIR}/debug/lib/libssl.a
${CURRENT_PACKAGES_DIR}/lib/libcrypto.a
${CURRENT_PACKAGES_DIR}/lib/libssl.a
)
else()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/bin
${CURRENT_PACKAGES_DIR}/bin
)
if(VCPKG_TARGET_IS_WINDOWS)
file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/ossl_static.pdb
${CURRENT_PACKAGES_DIR}/lib/ossl_static.pdb
)
endif()
endif()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include
${CURRENT_PACKAGES_DIR}/debug/engines-81.3
${CURRENT_PACKAGES_DIR}/engines-81.3
${CURRENT_PACKAGES_DIR}/debug/ossl-modules
${CURRENT_PACKAGES_DIR}/ossl-modules
)

file(INSTALL ${SOURCE_PATH}/LICENSE.txt
DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright
)
7 changes: 7 additions & 0 deletions ports/quictls/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "quictls",
"version-date": "2021-05-03",
"description": "TLS/SSL and crypto library with QUIC APIs",
"homepage": "https://github.com/quictls/openssl",
"license": "Apache-2.0"
}
4 changes: 4 additions & 0 deletions versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -5208,6 +5208,10 @@
"baseline": "1.15.1-4",
"port-version": 0
},
"quictls": {
"baseline": "2021-05-03",
Comment thread
NancyLi1013 marked this conversation as resolved.
Outdated
"port-version": 0
},
"quill": {
"baseline": "1.6.2",
"port-version": 0
Expand Down
9 changes: 9 additions & 0 deletions versions/q-/quictls.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"versions": [
{
"git-tree": "48ee3bc3a3fa058a8c2ad179fa0c3a1ba0e00221",
"version-date": "2021-05-03",
"port-version": 0
}
]
}