Allow packages that use OpenSSL to specify that they need an OpenSSL

built with support for threads.  This is done by adding the following
line to the package Makefile before the inclusion of openssl/buildlink3.mk:

    USE_FEATURES.openssl=	threads

The openssl/builtin.mk file is also adjusted to detect whether or not
the built-in OpenSSL was built with support for threads and the result
is used accordingly to determine whether or not a pkgsrc OpenSSL is
needed.
This commit is contained in:
jlam 2007-09-07 17:26:23 +00:00
parent df0b5304b0
commit 06ab49ce09
2 changed files with 35 additions and 12 deletions

View file

@ -1,4 +1,4 @@
# $NetBSD: buildlink3.mk,v 1.36 2007/05/30 08:54:31 rillig Exp $ # $NetBSD: buildlink3.mk,v 1.37 2007/09/07 17:26:23 jlam Exp $
BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+ BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
OPENSSL_BUILDLINK3_MK:= ${OPENSSL_BUILDLINK3_MK}+ OPENSSL_BUILDLINK3_MK:= ${OPENSSL_BUILDLINK3_MK}+
@ -15,7 +15,11 @@ BUILDLINK_ORDER:= ${BUILDLINK_ORDER} ${BUILDLINK_DEPTH}openssl
.if !empty(OPENSSL_BUILDLINK3_MK:M+) .if !empty(OPENSSL_BUILDLINK3_MK:M+)
BUILDLINK_API_DEPENDS.openssl+= openssl>=0.9.6m BUILDLINK_API_DEPENDS.openssl+= openssl>=0.9.6m
. if defined(USE_FEATURES.openssl) && !empty(USE_FEATURES.openssl:Mthreads)
BUILDLINK_ABI_DEPENDS.openssl+= openssl>=0.9.7inb4
. else
BUILDLINK_ABI_DEPENDS.openssl+= openssl>=0.9.7inb1 BUILDLINK_ABI_DEPENDS.openssl+= openssl>=0.9.7inb1
. endif
BUILDLINK_PKGSRCDIR.openssl?= ../../security/openssl BUILDLINK_PKGSRCDIR.openssl?= ../../security/openssl
# Ensure that -lcrypt comes before -lcrypto when linking so that the # Ensure that -lcrypt comes before -lcrypto when linking so that the

View file

@ -1,10 +1,11 @@
# $NetBSD: builtin.mk,v 1.21 2007/02/22 19:27:08 wiz Exp $ # $NetBSD: builtin.mk,v 1.22 2007/09/07 17:26:23 jlam Exp $
BUILTIN_PKG:= openssl BUILTIN_PKG:= openssl
BUILTIN_FIND_LIBS:= des BUILTIN_FIND_LIBS:= des
BUILTIN_FIND_FILES_VAR:= H_OPENSSL BUILTIN_FIND_FILES_VAR:= H_OPENSSLCONF H_OPENSSLV
BUILTIN_FIND_FILES.H_OPENSSL= /usr/include/openssl/opensslv.h BUILTIN_FIND_FILES.H_OPENSSLCONF= /usr/include/openssl/opensslconf.h
BUILTIN_FIND_FILES.H_OPENSSLV= /usr/include/openssl/opensslv.h
.include "../../mk/buildlink3/bsd.builtin.mk" .include "../../mk/buildlink3/bsd.builtin.mk"
@ -14,7 +15,7 @@ BUILTIN_FIND_FILES.H_OPENSSL= /usr/include/openssl/opensslv.h
### ###
.if !defined(IS_BUILTIN.openssl) .if !defined(IS_BUILTIN.openssl)
IS_BUILTIN.openssl= no IS_BUILTIN.openssl= no
. if empty(H_OPENSSL:M__nonexistent__) && empty(H_OPENSSL:M${LOCALBASE}/*) . if empty(H_OPENSSLV:M__nonexistent__) && empty(H_OPENSSLV:M${LOCALBASE}/*)
IS_BUILTIN.openssl= yes IS_BUILTIN.openssl= yes
. endif . endif
.endif .endif
@ -26,7 +27,7 @@ MAKEVARS+= IS_BUILTIN.openssl
### ###
.if !defined(BUILTIN_PKG.openssl) && \ .if !defined(BUILTIN_PKG.openssl) && \
!empty(IS_BUILTIN.openssl:M[yY][eE][sS]) && \ !empty(IS_BUILTIN.openssl:M[yY][eE][sS]) && \
empty(H_OPENSSL:M__nonexistent__) empty(H_OPENSSLV:M__nonexistent__)
BUILTIN_VERSION.openssl!= \ BUILTIN_VERSION.openssl!= \
${AWK} 'BEGIN { hex="0123456789abcdef"; \ ${AWK} 'BEGIN { hex="0123456789abcdef"; \
split("abcdefghijklmnopqrstuvwxyz", alpha, ""); \ split("abcdefghijklmnopqrstuvwxyz", alpha, ""); \
@ -52,10 +53,10 @@ BUILTIN_VERSION.openssl!= \
major, minor, teeny, patchlevel; \ major, minor, teeny, patchlevel; \
exit 0; \ exit 0; \
} \ } \
' ${H_OPENSSL} ' ${H_OPENSSLV}
. if !empty(BUILTIN_VERSION.openssl:M0\.9\.6g) && \ . if !empty(BUILTIN_VERSION.openssl:M0\.9\.6g) && \
empty(H_OPENSSL:M__nonexistent__) empty(H_OPENSSLV:M__nonexistent__)
# #
# If the native OpenSSL contains the security fixes pulled up to the # If the native OpenSSL contains the security fixes pulled up to the
# netbsd-1-6 branch on 2003-11-07, then pretend it's openssl-0.9.6l. # netbsd-1-6 branch on 2003-11-07, then pretend it's openssl-0.9.6l.
@ -64,7 +65,7 @@ BUILTIN_OPENSSL_HAS_20031107_FIX!= \
${AWK} 'BEGIN { ans = "no" } \ ${AWK} 'BEGIN { ans = "no" } \
/OPENSSL_HAS_20031107_FIX/ { ans = "yes" } \ /OPENSSL_HAS_20031107_FIX/ { ans = "yes" } \
END { print ans; exit 0 } \ END { print ans; exit 0 } \
' ${H_OPENSSL} ' ${H_OPENSSLV}
. if !empty(BUILTIN_OPENSSL_HAS_20031107_FIX:M[yY][eE][sS]) . if !empty(BUILTIN_OPENSSL_HAS_20031107_FIX:M[yY][eE][sS])
BUILTIN_VERSION.openssl= 0.9.6l BUILTIN_VERSION.openssl= 0.9.6l
. endif . endif
@ -76,12 +77,12 @@ BUILTIN_OPENSSL_HAS_20040401_FIX!= \
${AWK} 'BEGIN { ans = "no" } \ ${AWK} 'BEGIN { ans = "no" } \
/OPENSSL_HAS_20040401_FIX/ { ans = "yes" } \ /OPENSSL_HAS_20040401_FIX/ { ans = "yes" } \
END { print ans; exit 0 } \ END { print ans; exit 0 } \
' ${H_OPENSSL} ' ${H_OPENSSLV}
. if !empty(BUILTIN_OPENSSL_HAS_20040401_FIX:M[yY][eE][sS]) . if !empty(BUILTIN_OPENSSL_HAS_20040401_FIX:M[yY][eE][sS])
BUILTIN_VERSION.openssl= 0.9.6m BUILTIN_VERSION.openssl= 0.9.6m
. endif . endif
. elif !empty(BUILTIN_VERSION.openssl:M0\.9\.7d) && \ . elif !empty(BUILTIN_VERSION.openssl:M0\.9\.7d) && \
empty(H_OPENSSL:M__nonexistent__) empty(H_OPENSSLV:M__nonexistent__)
# #
# If the native OpenSSL contains the security fixes pulled up to the # If the native OpenSSL contains the security fixes pulled up to the
# netbsd-2-0, netbsd-2, and netbsd-3-0 branches on 2005-10-11, then # netbsd-2-0, netbsd-2, and netbsd-3-0 branches on 2005-10-11, then
@ -91,7 +92,7 @@ BUILTIN_OPENSSL_HAS_20051011_FIX!= \
${AWK} 'BEGIN { ans = "no" } \ ${AWK} 'BEGIN { ans = "no" } \
/OPENSSL_HAS_20051011_FIX/ { ans = "yes" } \ /OPENSSL_HAS_20051011_FIX/ { ans = "yes" } \
END { print ans; exit 0 } \ END { print ans; exit 0 } \
' ${H_OPENSSL} ' ${H_OPENSSLV}
. if !empty(BUILTIN_OPENSSL_HAS_20051011_FIX:M[yY][eE][sS]) . if !empty(BUILTIN_OPENSSL_HAS_20051011_FIX:M[yY][eE][sS])
BUILTIN_VERSION.openssl= 0.9.7h BUILTIN_VERSION.openssl= 0.9.7h
. endif . endif
@ -100,6 +101,18 @@ BUILTIN_PKG.openssl= openssl-${BUILTIN_VERSION.openssl}
.endif .endif
MAKEVARS+= BUILTIN_PKG.openssl MAKEVARS+= BUILTIN_PKG.openssl
.if !defined(BUILTIN_OPENSSL_HAS_THREADS) && \
!empty(IS_BUILTIN.openssl:M[yY][eE][sS]) && \
empty(H_OPENSSLCONF:M__nonexistent__)
BUILTIN_OPENSSL_HAS_THREADS!= \
${AWK} 'BEGIN { ans = "no" } \
/\#[ ]*define[ ]*OPENSSL_THREADS/ { ans= "yes" } \
/\#[ ]*define[ ]*THREADS/ { ans = "yes" } \
END { print ans; exit 0 } \
' ${H_OPENSSLCONF:Q}
.endif
MAKEVARS+= BUILTIN_OPENSSL_HAS_THREADS
### ###
### Determine whether we should use the built-in implementation if it ### Determine whether we should use the built-in implementation if it
### exists, and set USE_BUILTIN.<pkg> appropriate ("yes" or "no"). ### exists, and set USE_BUILTIN.<pkg> appropriate ("yes" or "no").
@ -123,6 +136,12 @@ USE_BUILTIN.openssl!= \
. endif . endif
. endfor . endfor
. endif . endif
. if defined(USE_FEATURES.openssl)
. if !empty(USE_FEATURES.openssl:Mthreads) && \
!empty(BUILTIN_OPENSSL_HAS_THREADS:M[nN][oO])
USE_BUILTIN.openssl= no
. endif
. endif
. endif # PREFER.openssl . endif # PREFER.openssl
.endif .endif
MAKEVARS+= USE_BUILTIN.openssl MAKEVARS+= USE_BUILTIN.openssl