Skip to contentSkip to conversation

vcpkg-ports: add openssl 1.1.1n

PATCH In review Lev Stipakov 3 participants 4 messages Mar 16, 2022 – Mar 17, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vcpkg-ports: add openssl 1.1.1n

From: Lev Stipakov <[email protected]...>

Since vcpkg official repo doesn't have openssl 1.1.1n yet, add own port - just copy files from vcpkg\ports\openssl (excluding unix and uwp directories) and replace 1.1.1m with 1.1.1n, not forgetting about SHA512.

---
 .../openssl/install-pc-files.cmake            |  32 ++++
 contrib/vcpkg-ports/openssl/openssl.pc.in     |   6 +
 contrib/vcpkg-ports/openssl/portfile.cmake    |  28 +++
 contrib/vcpkg-ports/openssl/usage             |   4 +
 .../openssl/vcpkg-cmake-wrapper.cmake.in      |  78 ++++++++
 contrib/vcpkg-ports/openssl/vcpkg.json        |  18 ++
 .../openssl/windows/portfile.cmake            | 172 ++++++++++++++++++
 7 files changed, 338 insertions(+)
 create mode 100644 contrib/vcpkg-ports/openssl/install-pc-files.cmake
 create mode 100644 contrib/vcpkg-ports/openssl/openssl.pc.in
 create mode 100644 contrib/vcpkg-ports/openssl/portfile.cmake
 create mode 100644 contrib/vcpkg-ports/openssl/usage
 create mode 100644 contrib/vcpkg-ports/openssl/vcpkg-cmake-wrapper.cmake.in
 create mode 100644 contrib/vcpkg-ports/openssl/vcpkg.json
 create mode 100644 contrib/vcpkg-ports/openssl/windows/portfile.cmake
contrib/vcpkg-ports/openssl/install-pc-files.cmake new file +32 -0
new file mode 100644
index 00000000..eb8d2b8c
@@ -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
+Cflags: -I"${includedir}"
+]])
+
+vcpkg_fixup_pkgconfig()
contrib/vcpkg-ports/openssl/openssl.pc.in new file +6 -0
new file mode 100644
index 00000000..3033e180
@@ -0,0 +1,6 @@
+prefix=${pcfiledir}/../..
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+Version: @OPENSSL_VERSION@
+@pc_data@
contrib/vcpkg-ports/openssl/portfile.cmake new file +28 -0
new file mode 100644
index 00000000..e94e7a83
@@ -0,0 +1,28 @@
+if(EXISTS "${CURRENT_INSTALLED_DIR}/include/openssl/ssl.h")
+    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()
+
+set(OPENSSL_VERSION 1.1.1n)
+vcpkg_download_distfile(
+    ARCHIVE
+    URLS "https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz" "https://www.openssl.org/source/old/1.1.1/openssl-${OPENSSL_VERSION}.tar.gz"
+    FILENAME "openssl-${OPENSSL_VERSION}.tar.gz"
+    SHA512 1937796736613dcf4105a54e42ecb61f95a1cea74677156f9459aea0f2c95159359e766089632bf364ee6b0d28d661eb9957bce8fecc9d2436378d8d79e8d0a4
+)
+
+vcpkg_find_acquire_program(PERL)
+get_filename_component(PERL_EXE_PATH ${PERL} DIRECTORY)
+vcpkg_add_to_path("${PERL_EXE_PATH}")
+
+if(VCPKG_TARGET_IS_UWP)
+    include("${CMAKE_CURRENT_LIST_DIR}/uwp/portfile.cmake")
+    include("${CMAKE_CURRENT_LIST_DIR}/install-pc-files.cmake")
+elseif(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()
+
+configure_file("${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake.in" "${CURRENT_PACKAGES_DIR}/share/${PORT}/vcpkg-cmake-wrapper.cmake" @ONLY)
+file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
contrib/vcpkg-ports/openssl/usage new file +4 -0
new file mode 100644
index 00000000..cf83f339
@@ -0,0 +1,4 @@
+The package openssl is compatible with built-in CMake targets:
+
+    find_package(OpenSSL REQUIRED)
+    target_link_libraries(main PRIVATE OpenSSL::SSL OpenSSL::Crypto)
contrib/vcpkg-ports/openssl/vcpkg-cmake-wrapper.cmake.in new file +78 -0

78 lines not on this page · raw message

contrib/vcpkg-ports/openssl/vcpkg.json new file +18 -0
new file mode 100644
index 00000000..18e6dde6
@@ -0,0 +1,18 @@
+{
+  "name": "openssl",
+  "version-string": "1.1.1n",
+  "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": "OpenSSL",
+  "dependencies": [
+    {
+      "name": "vcpkg-cmake",
+      "host": true
+    },
+    {
+      "name": "vcpkg-cmake-config",
+      "host": true
+    }
+  ]
+}
contrib/vcpkg-ports/openssl/windows/portfile.cmake new file +172 -0

172 lines not on this page · raw message

Signature · 1 line
2.23.0.windows.1
Acked-by on v1 1/1
#1 lore raw

As discussed on IRC, we need to build with the new security-fixed 1.1.1n release, and vcpkg port is not there yet. Somewhat annoying, we should find a better way to decouple "build" and "openvpn main repo" commits...

Your patch has been applied to the release/2.5 branch.

commit a560bfddc561dd3f27fe7b4ce07075942dea811e (release/2.5)

Author: Lev Stipakov
Date:   Wed Mar 16 10:09:12 2022 +0200
     vcpkg-ports: add openssl 1.1.1n

     Signed-off-by: Lev Stipakov <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg23972.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#2 lore raw
Quoted 10 lines

Gert Doering <[email protected]...> hat am 16.03.2022 09:39 geschrieben:

As discussed on IRC, we need to build with the new security-fixed 1.1.1n release, and vcpkg port is not there yet. Somewhat annoying, we should find a better way to decouple "build" and "openvpn main repo" commits...

We could always move the whole contrib/vcpkg-ports directory to a separate repository, right? Or is there a strong technical reason why this should be in the main repository?

Regards,
--
Frank Lichtenheld

#3 lore raw

Hi,

Quoted 7 lines · Frank Lichtenheld
Quoted 3 lines

As discussed on IRC, we need to build with the new security-fixed 1.1.1n release, and vcpkg port is not there yet. Somewhat annoying, we should find a better way to decouple "build" and "openvpn main repo" commits...

We could always move the whole contrib/vcpkg-ports directory to a separate repository, right? Or is there a strong technical reason why this should be in the main repository?

Just for the sake of the archives - this is what we discussed in the meeting yesterday, and the plan is

- "building openvpn should be possible from the openvpn repo, without any extra submodules either way" - but will give the person building the vcpkg default packages (like, 1.1.1m yesterday)

- "for release building", we add whatever is needed to the openvpn-build repo, to do "take openvpn repo, add vcpkg port overlays for newer versions etc." and build from there

so this patch will go away again, in the not so distant future.

(Thanks, Lev, for all the work on this)

gert

Signature · 6 lines
"If was one thing all people took for granted, was conviction that if you 
 feed honest figures into a computer, honest figures come out. Never doubted 
 it myself till I met a computer with a sense of humor."
                             Robert A. Heinlein, The Moon is a Harsh Mistress

Gert Doering - Munich, Germany                             [email protected]...