diff options
| author | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
|---|---|---|
| committer | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
| commit | 54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch) | |
| tree | d915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/scripts/test_ports/vcpkg-ci-libressl | |
Diffstat (limited to 'vcpkg/scripts/test_ports/vcpkg-ci-libressl')
5 files changed, 101 insertions, 0 deletions
diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libressl/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-libressl/portfile.cmake new file mode 100644 index 0000000..dd25706 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libressl/portfile.cmake @@ -0,0 +1,10 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_find_acquire_program(PKGCONFIG) + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" + OPTIONS + "-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}" +) +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libressl/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-libressl/project/CMakeLists.txt new file mode 100644 index 0000000..33f6bad --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libressl/project/CMakeLists.txt @@ -0,0 +1,63 @@ +cmake_minimum_required(VERSION 3.7) +project(libressl-test C) + +find_package(PkgConfig REQUIRED) + +# libressl provides cmake config +find_package(LibreSSL CONFIG REQUIRED) +message(STATUS "LibreSSL CONFIG: ${LibreSSL_DIR}") +string(FIND "${LibreSSL_DIR}" "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}" index) +if(NOT index STREQUAL "0") + message(SEND_ERROR "LibreSSL CONFIG is not from vcpkg.") +endif() + +pkg_check_modules(libtls IMPORTED_TARGET REQUIRED libtls) +if(NOT libtls_VERSION STREQUAL LibreSSL_VERSION) + message(SEND_ERROR "Unexpected libtls_VERSION '${libtls_VERSION}' (expected: '${LibreSSL_VERSION}')") +endif() + +# libressl promises openssl compatibility +# NB: The port doesn't provide a wrapper, so there is no support +# for multi-config and for transitive usage requirements. +find_package(OpenSSL MODULE REQUIRED) +foreach(target IN ITEMS OpenSSL::SSL OpenSSL::Crypto) + set(location_found FALSE) + foreach(property IN ITEMS IMPORTED_LOCATION IMPORTED_LOCATION_DEBUG IMPORTED_LOCATION_RELEASE) + get_target_property(location ${target} ${property}) + if(NOT location) + continue() + endif() + set(location_found TRUE) + message(STATUS "${target} ${property}: ${location}") + string(FIND "${location}" "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}" index) + if(NOT index STREQUAL "0") + message(SEND_ERROR "${target} ${property} is not from vcpkg.") + endif() + endforeach() + if(NOT location_found) + message(SEND_ERROR "No location for ${target} binary") + endif() +endforeach() +if(NOT OPENSSL_VERSION STREQUAL "2.0.0") + message(SEND_ERROR "Unexpected OPENSSL_VERSION '${OPENSSL_VERSION}' (expected: '2.0.0')") +endif() + +pkg_check_modules(openssl IMPORTED_TARGET REQUIRED openssl) +# NB: openssl.pc carries libressl version (3.x), but doesn't provide 3.x OpenSSL API. +if(NOT openssl_VERSION STREQUAL LibreSSL_VERSION) + message(SEND_ERROR "Unexpected openssl_VERSION '${openssl_VERSION}' (expected: '${LibreSSL_VERSION}')") +endif() + +# compile and link tests + +add_executable(openssl_cmake openssl.c) +target_link_libraries(openssl_cmake OpenSSL::SSL) + +add_executable(openssl_pkgconfig openssl.c) +target_link_libraries(openssl_pkgconfig PkgConfig::openssl) + +add_executable(libressl_cmake libressl.c) +target_link_libraries(libressl_cmake LibreSSL::TLS) + +add_executable(libressl_pkgconfig libressl.c) +target_link_libraries(libressl_pkgconfig PkgConfig::libtls) diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libressl/project/libressl.c b/vcpkg/scripts/test_ports/vcpkg-ci-libressl/project/libressl.c new file mode 100644 index 0000000..2814d3c --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libressl/project/libressl.c @@ -0,0 +1,6 @@ +#include <tls.h> + +int main() +{ + return tls_init(); +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libressl/project/openssl.c b/vcpkg/scripts/test_ports/vcpkg-ci-libressl/project/openssl.c new file mode 100644 index 0000000..880991a --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libressl/project/openssl.c @@ -0,0 +1,10 @@ +#include <openssl/ssl.h> + +#if OPENSSL_VERSION_NUMBER != 0x20000000L +# error Unexpected version +#endif + +int main() +{ + return SSL_library_init(); +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libressl/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-libressl/vcpkg.json new file mode 100644 index 0000000..3b04b3e --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libressl/vcpkg.json @@ -0,0 +1,12 @@ +{ + "name": "vcpkg-ci-libressl", + "version-string": "ci", + "description": "Validates libressl", + "dependencies": [ + "libressl", + { + "name": "vcpkg-cmake", + "host": true + } + ] +} |