Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ngie-eign/b4b34ff3739c6a7c3ec2e2322737266c to your computer and use it in GitHub Desktop.
Save ngie-eign/b4b34ff3739c6a7c3ec2e2322737266c to your computer and use it in GitHub Desktop.
From 47c62090512c1bc848f3fc682fd2d69d41bb306c Mon Sep 17 00:00:00 2001
From: Enji Cooper <ngie@FreeBSD.org>
Date: Tue, 2 May 2023 17:37:54 -0700
Subject: [PATCH] Mk/Uses/ssl.mk: support non-standard --prefix
The code prior to this change made a number of assumptions around how
OpenSSL was installed from ports -- in particular, it assumed that
${PREFIX} was always ${LOCALBASE}. This particular change permits the
maintainer/end-user to specify a non-standard --prefix, making it
possible for projects that require security/openssl* to customize where
the library is installed to.
Sponsored-by: Dell, Inc
---
Mk/Uses/ssl.mk | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/Mk/Uses/ssl.mk b/Mk/Uses/ssl.mk
index bec40d7bc99a..1f6215516c28 100644
--- a/Mk/Uses/ssl.mk
+++ b/Mk/Uses/ssl.mk
@@ -96,17 +96,23 @@ OPENSSL_PORT= security/${SSL_DEFAULT}
. endif
OPENSSLDIR?= ${OPENSSLBASE}/openssl
+OPENSSLLIB= ${LOCALBASE}/lib
+OPENSSLRPATH?= ${OPENSSLLIB}
+
. if defined(_SSL_BUILD_DEP)
-BUILD_DEPENDS+= ${LOCALBASE}/lib/libcrypto.so.${OPENSSL_SHLIBVER}:${OPENSSL_PORT}
+BUILD_DEPENDS+= ${OPENSSLLIB}/libcrypto.so.${OPENSSL_SHLIBVER}:${OPENSSL_PORT}
. endif
. if defined(_SSL_RUN_DEP)
-RUN_DEPENDS+= ${LOCALBASE}/lib/libcrypto.so.${OPENSSL_SHLIBVER}:${OPENSSL_PORT}
+RUN_DEPENDS+= ${OPENSSLLIB}/libcrypto.so.${OPENSSL_SHLIBVER}:${OPENSSL_PORT}
+. endif
+
+. if ${OPENSSLBASE} != ${LOCALBASE}
+CPPFLAGS+= -I${OPENSSLINC}
+OPENSSL_LDFLAGS+= -L${OPENSSLLIB}
. endif
-OPENSSLRPATH= ${LOCALBASE}/lib
. endif
-OPENSSLLIB= ${OPENSSLBASE}/lib
OPENSSLINC= ${OPENSSLBASE}/include
MAKE_ENV+= OPENSSLBASE=${OPENSSLBASE}
--
2.40.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment