1 # $NetBSD: buildlink.mk,v 1.18 2002/08/15 01:14:32 fredb Exp $
3 # This Makefile fragment is included by packages that use OpenSSL.
5 # To use this Makefile fragment, simply:
7 # (1) Optionally define USE_OPENSSL_VERSION to the mininum OpenSSL version
8 # number in <openssl/opensslv.h>, i.e. 0x0090600fL, etc.
9 # (2) Include this Makefile fragment in the package Makefile,
10 # (3) Add ${BUILDLINK_DIR}/include to the front of the C preprocessor's header
12 # (4) Add ${BUILDLINK_DIR}/lib to the front of the linker's library search
15 .if !defined(OPENSSL_BUILDLINK_MK)
16 OPENSSL_BUILDLINK_MK= # defined
18 .include "../../mk/bsd.buildlink.mk"
20 # OpenSSL version numbers from <openssl/opensslv.h>
21 OPENSSL_VERSION_095A= 0x0090581fL
22 OPENSSL_VERSION_096= 0x0090600fL
23 OPENSSL_VERSION_096A= 0x0090601fL
24 OPENSSL_VERSION_096B= 0x0090602fL
25 OPENSSL_VERSION_096D= 0x0090604fL
26 OPENSSL_VERSION_096E= 0x0090605fL
27 OPENSSL_VERSION_096F= 0x0090606fL
28 OPENSSL_VERSION_096G= 0x0090607fL
29 # Check for a usable installed version of OpenSSL. Version must be greater
30 # than 0.9.6f, or else contain a fix for the 2002-07-30 security advisory.
31 # If a usable version isn't present, then use the pkgsrc OpenSSL package.
33 .include "../../mk/bsd.prefs.mk"
34 .if ${OPSYS} == "Darwin"
35 _OPENSSLV_H= /usr/local/include/openssl/opensslv.h
36 _SSL_H= /usr/local/include/openssl/ssl.h
38 _OPENSSLV_H= /usr/include/openssl/opensslv.h
39 _SSL_H= /usr/include/openssl/ssl.h
43 .if exists(${_OPENSSLV_H}) && exists(${_SSL_H})
44 _IN_TREE_OPENSSL_HAS_FIX!= \
45 ${AWK} 'BEGIN { ans = "NO" } \
46 /SSL_R_SSL2_CONNECTION_ID_TOO_LONG/ { ans = "YES" } \
47 END { print ans; exit 0 }' ${_SSL_H}
49 . if ${_IN_TREE_OPENSSL_HAS_FIX} == "YES"
50 USE_OPENSSL_VERSION?= ${OPENSSL_VERSION_096F}
52 USE_OPENSSL_VERSION?= ${OPENSSL_VERSION_096G}
55 _OPENSSL_VERSION!= ${AWK} '/.*OPENSSL_VERSION_NUMBER.*/ { print $$3 }' \
58 _VALID_SSL_VERSIONS= ${OPENSSL_VERSION_096F} # OpenSSL 0.9.6f
59 # There never was a package for this; only the in-tree openssl had it.
60 #BUILDLINK_DEPENDS.openssl= openssl>=0.9.6f
62 . if ${USE_OPENSSL_VERSION} == ${OPENSSL_VERSION_096G} # OpenSSL 0.9.6g
63 _VALID_SSL_VERSIONS= ${OPENSSL_VERSION_096G}
64 BUILDLINK_DEPENDS.openssl= openssl>=0.9.6g
66 _VALID_SSL_VERSIONS+= ${OPENSSL_VERSION_096G}
69 . for PATTERN in ${_VALID_SSL_VERSIONS}
70 . if ${_OPENSSL_VERSION:M${PATTERN}} != ""
77 # Last case to consider.... there is no in-tree openssl!
78 BUILDLINK_DEPENDS.openssl= openssl>=0.9.6g
80 .endif # exists(${_OPENSSLV_H}) && exists(${_SSL_H})
82 .if ${_NEED_OPENSSL} == "YES"
83 BUILDLINK_DEPENDS.openssl?= openssl>=0.9.6g
84 DEPENDS+= ${BUILDLINK_DEPENDS.openssl}:../../security/openssl
85 EVAL_PREFIX+= BUILDLINK_PREFIX.openssl=openssl
86 BUILDLINK_PREFIX.openssl_DEFAULT= ${LOCALBASE}
87 SSLBASE= ${BUILDLINK_PREFIX.openssl}
89 . if ${OPSYS} == "Darwin"
90 BUILDLINK_PREFIX.openssl= /usr/local
93 BUILDLINK_PREFIX.openssl= /usr
98 .if defined(PKG_SYSCONFDIR.openssl)
99 SSLCERTS= ${PKG_SYSCONFDIR.openssl}/certs
100 .elif ${OPSYS} == "NetBSD"
101 SSLCERTS= /etc/openssl/certs
103 SSLCERTS= ${PKG_SYSCONFBASE}/openssl/certs
105 BUILD_DEFS+= SSLBASE SSLCERTS
107 BUILDLINK_FILES.openssl= bin/openssl
108 BUILDLINK_FILES.openssl+= include/openssl/*
109 BUILDLINK_FILES.openssl+= lib/libRSAglue.*
110 BUILDLINK_FILES.openssl+= lib/libcrypto.*
111 BUILDLINK_FILES.openssl+= lib/libssl.*
113 .if defined(USE_RSAREF2) && ${USE_RSAREF2} == YES
114 .include "../../security/rsaref/buildlink.mk"
117 BUILDLINK_TARGETS.openssl= openssl-buildlink
118 BUILDLINK_TARGETS+= ${BUILDLINK_TARGETS.openssl}
120 pre-configure: ${BUILDLINK_TARGETS.openssl}
121 openssl-buildlink: _BUILDLINK_USE
123 .endif # OPENSSL_BUILDLINK_MK