Skip to content

Commit

Permalink
[openssl3] Support .pc file generation (#169)
Browse files Browse the repository at this point in the history
* [openssl3] support pkg-config file in Windows

* Copy required files from vcpkg upstream

* [openssl3] update baseline

* ci: install openssl3[tools] in CircleCI
  • Loading branch information
luncliff authored Feb 11, 2024
1 parent db17a2f commit 0235449
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 3 deletions.
1 change: 1 addition & 0 deletions .circleci/port-windows.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
onnxruntime[training,directml,xnnpack]:x64-windows
openssl3[tools]:x64-windows
33 changes: 33 additions & 0 deletions ports/openssl3/install-pc-files.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Copied from https://github.com/microsoft/vcpkg/blob/master/ports/openssl/install-pc-files.cmake
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()
6 changes: 6 additions & 0 deletions ports/openssl3/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@
6 changes: 5 additions & 1 deletion ports/openssl3/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,14 @@ else()
if(EXISTS "${CURRENT_PACKAGES_DIR}/lib64")
file(RENAME "${CURRENT_PACKAGES_DIR}/lib64" "${CURRENT_PACKAGES_DIR}/lib")
endif()
vcpkg_fixup_pkgconfig()

endif()

if(VCPKG_TARGET_IS_WINDOWS)
include("${CMAKE_CURRENT_LIST_DIR}/install-pc-files.cmake")
endif()
vcpkg_fixup_pkgconfig()

if("tools" IN_LIST FEATURES)
vcpkg_copy_tools(TOOL_NAMES openssl AUTO_CLEAN)
endif()
Expand Down
4 changes: 3 additions & 1 deletion ports/openssl3/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
{
"name": "openssl3",
"version-semver": "3.2.0",
"port-version": 1,
"description": "TLS/SSL and crypto library",
"homepage": "https://www.openssl.org/",
"license": "Apache-2.0",
"features": {
"tools": {
"description": "Buind/Install OpenSSL CLI tools"
"description": "Buind/Install OpenSSL CLI tools",
"supports": "windows"
}
}
}
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
},
"openssl3": {
"baseline": "3.2.0",
"port-version": 0
"port-version": 1
},
"pthreadpool": {
"baseline": "2023-09-12",
Expand Down
5 changes: 5 additions & 0 deletions versions/o-/openssl3.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "c66760e99d9c408e878d7855c7e3b106a0f83d06",
"version-semver": "3.2.0",
"port-version": 1
},
{
"git-tree": "7e5b418e7879956f2a2ca203a2b0b34f050f155b",
"version-semver": "3.2.0",
Expand Down

0 comments on commit 0235449

Please sign in to comment.