Skip to content

Commit

Permalink
Use openssl3
Browse files Browse the repository at this point in the history
  • Loading branch information
KjellMorgenstern committed Dec 12, 2023
1 parent 71a9d9e commit 66270a1
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
1 change: 1 addition & 0 deletions phoenix.pro
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ RESOURCES += phoenixresources.qrc

# Disable this if you have (and want) libgit2 dynamically
LIBGIT_STATIC = true
include(pri/openssl3.pri)
include(pri/libgit2detect.pri)
include(pri/boostdetect.pri)
include(pri/spicedetect.pri)
Expand Down
50 changes: 50 additions & 0 deletions pri/openssl3.pri
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Qt 6.5.3 is linked against openssl3
# If you want to use older versions of openssl,
# you'll have to build a Qt 6.5 version with support for that version.

unix { !macx {
OPENSSL_REQUIRED_MAJOR_VERSION = 3
OPENSSL_ACTUAL_VERSION = $$system(pkg-config --modversion openssl 2>/dev/null)

isEmpty(OPENSSL_ACTUAL_VERSION) {
message("pkg-config could not find OpenSSL.")
} else {
message("pkg-config found OpenSSL version: " $${OPENSSL_ACTUAL_VERSION})
greaterThan(OPENSSL_ACTUAL_VERSION, 2.99) {
message("OpenSSL version is adequate: " $${OPENSSL_ACTUAL_VERSION})
CONFIG += link_pkgconfig
PKGCONFIG += openssl
OPENSSL_LIBDIRS = $$system(pkg-config --libs-only-L openssl 2>/dev/null | sed 's/-L//g')
for(DIR, OPENSSL_LIBDIRS) {
QMAKE_RPATHDIR += $$DIR
}
return() # No need for fallback if version is adequate
} else {
message("OpenSSL version found by pkg-config is too old: " $${OPENSSL_ACTUAL_VERSION})
}
}

# Use hardcoded fallback path if pkg-config didn't find OpenSSL or the version was too old
# Define the directory where OpenSSL 3 is installed (all dependencies go to Fritzing siblings directories)
OPENSSL_PREFERRED_VERSION=3.0.12
OPENSSL_DIR = $$absolute_path(../../openssl-$${OPENSSL_PREFERRED_VERSION})
OPENSSL_BIN = $$absolute_path($${OPENSSL_DIR}/bin/openssl)
OPENSSL_VERSION_STR = $$system("$${OPENSSL_BIN} version")
OPENSSL_VERSION = $$system("echo '$${OPENSSL_VERSION_STR}' | awk '{print $2}'")
message("OpenSSL version from sibling directory:" $${OPENSSL_VERSION})
isEmpty(OPENSSL_VERSION) {
error("Cannot determine fallback OpenSSL version. Please verify the installation of OpenSSL.")
} else {
OPENSSL_LIB_DIR = $${OPENSSL_DIR}/lib64
OPENSSL_INCLUDE_DIR = $${OPENSSL_DIR}/include
versionAtLeast(OPENSSL_VERSION, $${OPENSSL_REQUIRED_MAJOR_VERSION}) {
message("Fallback OpenSSL version is adequate: " $${OPENSSL_VERSION})

INCLUDEPATH += $${OPENSSL_INCLUDE_DIR}
LIBS += -L$${OPENSSL_LIB_DIR} -lssl -lcrypto
QMAKE_RPATHDIR += $${OPENSSL_LIB_DIR}
} else {
error("Fallback OpenSSL version " $${OPENSSL_REQUIRED_MAJOR_VERSION} "or higher is required. Found: " $${OPENSSL_VERSION_STR})
}
}
}}

0 comments on commit 66270a1

Please sign in to comment.