Changeset View
Changeset View
Standalone View
Standalone View
Mk/Uses/ssl.mk
Show All 20 Lines | |||||
# BUILD_DEPENDS - are added if needed | # BUILD_DEPENDS - are added if needed | ||||
# RUN_DEPENDS - are added if needed | # RUN_DEPENDS - are added if needed | ||||
# | # | ||||
# MAINTAINER: ports@FreeBSD.org | # MAINTAINER: ports@FreeBSD.org | ||||
# | # | ||||
.if !defined(_INCLUDE_USES_SSL_MK) | .if !defined(_INCLUDE_USES_SSL_MK) | ||||
_INCLUDE_USES_SSL_MK= yes | _INCLUDE_USES_SSL_MK= yes | ||||
.if !empty(ssl_ARGS:Nbuild:Nrun) | . if !empty(ssl_ARGS:Nbuild:Nrun) | ||||
IGNORE= "USES=ssl invalid arguments ${ssl_ARGS}." | IGNORE= "USES=ssl invalid arguments ${ssl_ARGS}." | ||||
.endif | . endif | ||||
.if empty(ssl_ARGS) || (!empty(ssl_ARGS:Mbuild) && !empty(ssl_ARGS:Mrun)) | . if empty(ssl_ARGS) || (!empty(ssl_ARGS:Mbuild) && !empty(ssl_ARGS:Mrun)) | ||||
_SSL_BUILD_DEP= 1 | _SSL_BUILD_DEP= 1 | ||||
_SSL_RUN_DEP= 1 | _SSL_RUN_DEP= 1 | ||||
.elif !empty(ssl_ARGS:Mbuild) | . elif !empty(ssl_ARGS:Mbuild) | ||||
_SSL_BUILD_DEP= 1 | _SSL_BUILD_DEP= 1 | ||||
.elif !empty(ssl_ARGS:Mrun) | . elif !empty(ssl_ARGS:Mrun) | ||||
_SSL_RUN_DEP= 1 | _SSL_RUN_DEP= 1 | ||||
.endif | . endif | ||||
.if defined(BROKEN_SSL) && ${BROKEN_SSL:M${SSL_DEFAULT}} | . if defined(BROKEN_SSL) && ${BROKEN_SSL:M${SSL_DEFAULT}} | ||||
. if defined(BROKEN_SSL_REASON_${SSL_DEFAULT}) | . if defined(BROKEN_SSL_REASON_${SSL_DEFAULT}) | ||||
BROKEN= does not build with DEFAULT_VERSIONS+=ssl=${SSL_DEFAULT}: ${BROKEN_SSL_REASON_${SSL_DEFAULT}} | BROKEN= does not build with DEFAULT_VERSIONS+=ssl=${SSL_DEFAULT}: ${BROKEN_SSL_REASON_${SSL_DEFAULT}} | ||||
. elif defined(BROKEN_SSL_REASON) | . elif defined(BROKEN_SSL_REASON) | ||||
BROKEN= does not build with DEFAULT_VERSIONS+=ssl=${SSL_DEFAULT}: ${BROKEN_SSL_REASON} | BROKEN= does not build with DEFAULT_VERSIONS+=ssl=${SSL_DEFAULT}: ${BROKEN_SSL_REASON} | ||||
. else | . else | ||||
BROKEN= does not build with DEFAULT_VERSIONS+=ssl=${SSL_DEFAULT} | BROKEN= does not build with DEFAULT_VERSIONS+=ssl=${SSL_DEFAULT} | ||||
. endif | . endif | ||||
.endif | . endif | ||||
.if defined(IGNORE_SSL) && ${IGNORE_SSL:M${SSL_DEFAULT}} | . if defined(IGNORE_SSL) && ${IGNORE_SSL:M${SSL_DEFAULT}} | ||||
. if defined(IGNORE_SSL_REASON_${SSL_DEFAULT}) | . if defined(IGNORE_SSL_REASON_${SSL_DEFAULT}) | ||||
IGNORE= not compatible DEFAULT_VERSIONS+=ssl=${SSL_DEFAULT}: ${IGNORE_SSL_REASON_${SSL_DEFAULT}} | IGNORE= not compatible DEFAULT_VERSIONS+=ssl=${SSL_DEFAULT}: ${IGNORE_SSL_REASON_${SSL_DEFAULT}} | ||||
. elif defined(IGNORE_SSL_REASON) | . elif defined(IGNORE_SSL_REASON) | ||||
IGNORE= not compatible DEFAULT_VERSIONS+=ssl=${SSL_DEFAULT}: ${IGNORE_SSL_REASON} | IGNORE= not compatible DEFAULT_VERSIONS+=ssl=${SSL_DEFAULT}: ${IGNORE_SSL_REASON} | ||||
. else | . else | ||||
IGNORE= not compatible DEFAULT_VERSIONS+=ssl=${SSL_DEFAULT} | IGNORE= not compatible DEFAULT_VERSIONS+=ssl=${SSL_DEFAULT} | ||||
. endif | . endif | ||||
.endif | . endif | ||||
.if ${SSL_DEFAULT} == base | . if ${SSL_DEFAULT} == base | ||||
OPENSSLBASE= /usr | OPENSSLBASE= /usr | ||||
OPENSSLDIR?= /etc/ssl | OPENSSLDIR?= /etc/ssl | ||||
. if !exists(${DESTDIR}/usr/lib/libcrypto.so) | . if !exists(${DESTDIR}/usr/lib/libcrypto.so) | ||||
check-depends:: | check-depends:: | ||||
@${ECHO_CMD} "Dependency error: This port requires the OpenSSL library, which is part of" | @${ECHO_CMD} "Dependency error: This port requires the OpenSSL library, which is part of" | ||||
@${ECHO_CMD} "the FreeBSD crypto distribution, but not installed on your" | @${ECHO_CMD} "the FreeBSD crypto distribution, but not installed on your" | ||||
@${ECHO_CMD} "machine. Please see the \"OpenSSL\" section in the handbook" | @${ECHO_CMD} "machine. Please see the \"OpenSSL\" section in the handbook" | ||||
@${ECHO_CMD} "(at \"https://docs.FreeBSD.org/en/books/handbook/security/#openssl\", for instance)" | @${ECHO_CMD} "(at \"https://docs.FreeBSD.org/en/books/handbook/security/#openssl\", for instance)" | ||||
@${ECHO_CMD} "for instructions on how to obtain and install the FreeBSD" | @${ECHO_CMD} "for instructions on how to obtain and install the FreeBSD" | ||||
@${ECHO_CMD} "OpenSSL distribution." | @${ECHO_CMD} "OpenSSL distribution." | ||||
@${FALSE} | @${FALSE} | ||||
. endif | . endif | ||||
. if exists(${LOCALBASE}/lib/libcrypto.so) | . if exists(${LOCALBASE}/lib/libcrypto.so) | ||||
check-depends:: | check-depends:: | ||||
@${ECHO_CMD} "Dependency error: This port wants the OpenSSL library from the FreeBSD" | @${ECHO_CMD} "Dependency error: This port wants the OpenSSL library from the FreeBSD" | ||||
@${ECHO_CMD} "base system. You can't build against it, while a newer" | @${ECHO_CMD} "base system. You can't build against it, while a newer" | ||||
@${ECHO_CMD} "version is installed by a port." | @${ECHO_CMD} "version is installed by a port." | ||||
@${ECHO_CMD} "Please deinstall the port, remove DEFAULT_VERSIONS=ssl=base or undefine WITH_OPENSSL_BASE." | @${ECHO_CMD} "Please deinstall the port, remove DEFAULT_VERSIONS=ssl=base or undefine WITH_OPENSSL_BASE." | ||||
@${FALSE} | @${FALSE} | ||||
. endif | . endif | ||||
.else # ${SSL_DEFAULT} != base | . else # ${SSL_DEFAULT} != base | ||||
OPENSSLBASE= ${LOCALBASE} | OPENSSLBASE= ${LOCALBASE} | ||||
OPENSSL_PORT= security/${SSL_DEFAULT} | OPENSSL_PORT= security/${SSL_DEFAULT} | ||||
# Get OPENSSL_SHLIBVER from the port | # Get OPENSSL_SHLIBVER from the port | ||||
.sinclude <${PORTSDIR}/${OPENSSL_PORT}/version.mk> | .sinclude <${PORTSDIR}/${OPENSSL_PORT}/version.mk> | ||||
. if !defined(OPENSSL_SHLIBVER) | . if !defined(OPENSSL_SHLIBVER) | ||||
.error You are using an unsupported SSL provider ${SSL_DEFAULT} | .error You are using an unsupported SSL provider ${SSL_DEFAULT} | ||||
. endif | . endif | ||||
OPENSSLDIR?= ${OPENSSLBASE}/openssl | OPENSSLDIR?= ${OPENSSLBASE}/openssl | ||||
. if defined(_SSL_BUILD_DEP) | . if defined(_SSL_BUILD_DEP) | ||||
BUILD_DEPENDS+= ${LOCALBASE}/lib/libcrypto.so.${OPENSSL_SHLIBVER}:${OPENSSL_PORT} | BUILD_DEPENDS+= ${LOCALBASE}/lib/libcrypto.so.${OPENSSL_SHLIBVER}:${OPENSSL_PORT} | ||||
. endif | . endif | ||||
. if defined(_SSL_RUN_DEP) | . if defined(_SSL_RUN_DEP) | ||||
RUN_DEPENDS+= ${LOCALBASE}/lib/libcrypto.so.${OPENSSL_SHLIBVER}:${OPENSSL_PORT} | RUN_DEPENDS+= ${LOCALBASE}/lib/libcrypto.so.${OPENSSL_SHLIBVER}:${OPENSSL_PORT} | ||||
. endif | . endif | ||||
OPENSSLRPATH= ${LOCALBASE}/lib | OPENSSLRPATH= ${LOCALBASE}/lib | ||||
.endif | . endif | ||||
OPENSSLLIB= ${OPENSSLBASE}/lib | OPENSSLLIB= ${OPENSSLBASE}/lib | ||||
OPENSSLINC= ${OPENSSLBASE}/include | OPENSSLINC= ${OPENSSLBASE}/include | ||||
MAKE_ENV+= OPENSSLBASE=${OPENSSLBASE} | MAKE_ENV+= OPENSSLBASE=${OPENSSLBASE} | ||||
MAKE_ENV+= OPENSSLDIR=${OPENSSLDIR} | MAKE_ENV+= OPENSSLDIR=${OPENSSLDIR} | ||||
MAKE_ENV+= OPENSSLINC=${OPENSSLINC} | MAKE_ENV+= OPENSSLINC=${OPENSSLINC} | ||||
MAKE_ENV+= OPENSSLLIB=${OPENSSLLIB} | MAKE_ENV+= OPENSSLLIB=${OPENSSLLIB} | ||||
.if defined(OPENSSLRPATH) | . if defined(OPENSSLRPATH) | ||||
. if defined(USE_OPENSSL_RPATH) | . if defined(USE_OPENSSL_RPATH) | ||||
CFLAGS+= -Wl,-rpath,${OPENSSLRPATH} | CFLAGS+= -Wl,-rpath,${OPENSSLRPATH} | ||||
. endif | . endif | ||||
MAKE_ENV+= OPENSSLRPATH=${OPENSSLRPATH} | MAKE_ENV+= OPENSSLRPATH=${OPENSSLRPATH} | ||||
OPENSSL_LDFLAGS+= -Wl,-rpath,${OPENSSLRPATH} | OPENSSL_LDFLAGS+= -Wl,-rpath,${OPENSSLRPATH} | ||||
.endif | . endif | ||||
LDFLAGS+= ${OPENSSL_LDFLAGS} | LDFLAGS+= ${OPENSSL_LDFLAGS} | ||||
.endif | .endif |