apfree-wifidog: add support for OpenSSL 3.0
authorEneas U de Queiroz <cotequeiroz@gmail.com>
Thu, 9 Feb 2023 14:33:24 +0000 (11:33 -0300)
committerEneas U de Queiroz <cotequeiroz@gmail.com>
Thu, 16 Feb 2023 13:28:52 +0000 (10:28 -0300)
This adds an upstream commit to allow building with OpenSSL 3.0.

Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
net/apfree-wifidog/Makefile
net/apfree-wifidog/patches/010-support-openssl-3.0.patch [new file with mode: 0644]

index 876f6107f6101927157e3659a9120cf06d437184..d15d8493d75ecc0e6def85381a2114b69cde8e9c 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=apfree-wifidog
 PKG_VERSION:=4.08.1771
-PKG_RELEASE:=6
+PKG_RELEASE:=7
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL:=https://github.com/liudf0716/apfree_wifidog.git
diff --git a/net/apfree-wifidog/patches/010-support-openssl-3.0.patch b/net/apfree-wifidog/patches/010-support-openssl-3.0.patch
new file mode 100644 (file)
index 0000000..4c8147e
--- /dev/null
@@ -0,0 +1,53 @@
+From 53a042836063e965f8df9fc85bb32e8e46da8a05 Mon Sep 17 00:00:00 2001
+From: staylightblow8 <liudf0716@gmail.com>
+Date: Thu, 20 Oct 2022 10:47:59 +0800
+Subject: [PATCH] support openssl > 3.0
+
+---
+ cmake/Modules/FindOpenSSL.cmake | 27 +++++++++++++++++++++++----
+ 1 file changed, 23 insertions(+), 4 deletions(-)
+
+--- a/cmake/Modules/FindOpenSSL.cmake
++++ b/cmake/Modules/FindOpenSSL.cmake
+@@ -282,11 +282,11 @@ function(from_hex HEX DEC)
+   set(${DEC} ${_res} PARENT_SCOPE)
+ endfunction()
+-if (OPENSSL_INCLUDE_DIR)
+-  if(OPENSSL_INCLUDE_DIR AND EXISTS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h")
+-    file(STRINGS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h" openssl_version_str
+-         REGEX "^# *define[\t ]+OPENSSL_VERSION_NUMBER[\t ]+0x([0-9a-fA-F])+.*")
++if(OPENSSL_INCLUDE_DIR AND EXISTS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h")
++  file(STRINGS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h" openssl_version_str
++       REGEX "^#[\t ]*define[\t ]+OPENSSL_VERSION_NUMBER[\t ]+0x([0-9a-fA-F])+.*")
++  if(openssl_version_str)
+     # The version number is encoded as 0xMNNFFPPS: major minor fix patch status
+     # The status gives if this is a developer or prerelease and is ignored here.
+     # Major, minor, and fix directly translate into the version numbers shown in
+@@ -315,6 +315,25 @@ if (OPENSSL_INCLUDE_DIR)
+     endif ()
+     set(OPENSSL_VERSION "${OPENSSL_VERSION_MAJOR}.${OPENSSL_VERSION_MINOR}.${OPENSSL_VERSION_FIX}${OPENSSL_VERSION_PATCH_STRING}")
++  else ()
++    # Since OpenSSL 3.0.0, the new version format is MAJOR.MINOR.PATCH and
++    # a new OPENSSL_VERSION_STR macro contains exactly that
++    file(STRINGS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h" OPENSSL_VERSION_STR
++         REGEX "^#[\t ]*define[\t ]+OPENSSL_VERSION_STR[\t ]+\"([0-9])+\\.([0-9])+\\.([0-9])+\".*")
++    string(REGEX REPLACE "^.*OPENSSL_VERSION_STR[\t ]+\"([0-9]+\\.[0-9]+\\.[0-9]+)\".*$"
++           "\\1" OPENSSL_VERSION_STR "${OPENSSL_VERSION_STR}")
++
++    set(OPENSSL_VERSION "${OPENSSL_VERSION_STR}")
++
++    # Setting OPENSSL_VERSION_MAJOR OPENSSL_VERSION_MINOR and OPENSSL_VERSION_FIX
++    string(REGEX MATCHALL "([0-9])+" OPENSSL_VERSION_NUMBER "${OPENSSL_VERSION}")
++    list(POP_FRONT OPENSSL_VERSION_NUMBER
++      OPENSSL_VERSION_MAJOR
++      OPENSSL_VERSION_MINOR
++      OPENSSL_VERSION_FIX)
++
++    unset(OPENSSL_VERSION_NUMBER)
++    unset(OPENSSL_VERSION_STR)
+   endif ()
+ endif ()