3 # Handle dependency on *ssl ports.
9 # The use can choose which ssl library he wants with:
11 # DEFAULT_VERSIONS+= ssl=<openssl variant>
13 # Variants being base, openssl, openssl-devel, libressl, and libressl-devel.
15 # The Makefile sets these variables:
16 # OPENSSLBASE - "/usr" or ${LOCALBASE}
17 # OPENSSLDIR - path to openssl
18 # OPENSSLLIB - path to the libs
19 # OPENSSLINC - path to the matching includes
20 # OPENSSLRPATH - rpath for dynamic linker
22 # MAKE_ENV - extended with the variables above
23 # BUILD_DEPENDS - are added if needed
24 # RUN_DEPENDS - are added if needed
26 # MAINTAINER: portmgr@FreeBSD.org
28 .if !defined(_INCLUDE_USES_SSL_MK)
29 _INCLUDE_USES_SSL_MK= yes
32 IGNORE= "USES=ssl does not take any argument."
35 .if ${SSL_DEFAULT} == base
39 . if !exists(${DESTDIR}/usr/lib/libcrypto.so)
41 @${ECHO_CMD} "Dependency error: This port requires the OpenSSL library, which is part of"
42 @${ECHO_CMD} "the FreeBSD crypto distribution, but not installed on your"
43 @${ECHO_CMD} "machine. Please see the \"OpenSSL\" section in the handbook"
44 @${ECHO_CMD} "(at \"http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/openssl.html\", for instance)"
45 @${ECHO_CMD} "for instructions on how to obtain and install the FreeBSD"
46 @${ECHO_CMD} "OpenSSL distribution."
49 . if exists(${LOCALBASE}/lib/libcrypto.so)
51 @${ECHO_CMD} "Dependency error: This port wants the OpenSSL library from the FreeBSD"
52 @${ECHO_CMD} "base system. You can't build against it, while a newer"
53 @${ECHO_CMD} "version is installed by a port."
54 @${ECHO_CMD} "Please deinstall the port, remove DEFAULT_VERSIONS=ssl=base or undefine WITH_OPENSSL_BASE."
58 # OpenSSL in the base system may not include IDEA for patent licensing reasons.
59 . if defined(MAKE_IDEA) && !defined(OPENSSL_IDEA)
60 OPENSSL_IDEA= ${MAKE_IDEA}
65 . if ${OPENSSL_IDEA} == "NO"
66 # XXX This is a hack to work around the fact that /etc/make.conf clobbers
67 # our CFLAGS. It might not be enough for all future ports.
68 . if defined(HAS_CONFIGURE)
71 OPENSSL_CFLAGS+= -DNO_IDEA
73 MAKE_ARGS+= OPENSSL_CFLAGS="${OPENSSL_CFLAGS}"
76 .else # ${SSL_DEFAULT} != base
78 OPENSSLBASE= ${LOCALBASE}
80 OPENSSL_PORT= security/${SSL_DEFAULT}
82 # Get OPENSSL_SHLIBVER from the port
83 .sinclude <${PORTSDIR}/${OPENSSL_PORT}/version.mk>
85 . if !defined(OPENSSL_SHLIBVER)
86 .error You are using an unsupported SSL provider ${SSL_DEFAULT}
89 OPENSSLDIR?= ${OPENSSLBASE}/openssl
90 BUILD_DEPENDS+= ${LOCALBASE}/lib/libcrypto.so.${OPENSSL_SHLIBVER}:${OPENSSL_PORT}
91 RUN_DEPENDS+= ${LOCALBASE}/lib/libcrypto.so.${OPENSSL_SHLIBVER}:${OPENSSL_PORT}
92 OPENSSLRPATH= ${LOCALBASE}/lib
96 OPENSSLLIB= ${OPENSSLBASE}/lib
97 OPENSSLINC= ${OPENSSLBASE}/include
99 MAKE_ENV+= OPENSSLBASE=${OPENSSLBASE}
100 MAKE_ENV+= OPENSSLDIR=${OPENSSLDIR}
101 MAKE_ENV+= OPENSSLINC=${OPENSSLINC}
102 MAKE_ENV+= OPENSSLLIB=${OPENSSLLIB}
104 .if defined(OPENSSLRPATH)
105 . if defined(USE_OPENSSL_RPATH)
106 CFLAGS+= -Wl,-rpath,${OPENSSLRPATH}
108 MAKE_ENV+= OPENSSLRPATH=${OPENSSLRPATH}
109 OPENSSL_LDFLAGS+= -Wl,-rpath,${OPENSSLRPATH}
112 LDFLAGS+= ${OPENSSL_LDFLAGS}