Annotation of pkgsrc/devel/zlib/builtin.mk, Revision 1.3
1.3 ! jlam 1: # $NetBSD: builtin.mk,v 1.2 2004/03/29 05:43:30 jlam Exp $
1.1 jlam 2:
1.3 ! jlam 3: BUILTIN_PKG:= zlib
1.1 jlam 4:
1.3 ! jlam 5: BUILTIN_FIND_FILES_VAR:= H_ZLIB
! 6: BUILTIN_FIND_FILES.H_ZLIB= /usr/include/zlib.h
! 7:
! 8: .include "../../mk/buildlink3/bsd.builtin.mk"
! 9:
! 10: ###
! 11: ### Determine if there is a built-in implementation of the package and
! 12: ### set IS_BUILTIN.<pkg> appropriately ("yes" or "no").
! 13: ###
1.1 jlam 14: .if !defined(IS_BUILTIN.zlib)
15: IS_BUILTIN.zlib= no
1.3 ! jlam 16: . if empty(H_ZLIB:M${LOCALBASE}/*) && exists(${H_ZLIB})
1.1 jlam 17: IS_BUILTIN.zlib= yes
1.3 ! jlam 18: . endif
! 19: .endif
! 20: MAKEVARS+= IS_BUILTIN.zlib
! 21:
! 22: ###
! 23: ### If there is a built-in implementation, then set BUILTIN_PKG.<pkg> to
! 24: ### a package name to represent the built-in package.
! 25: ###
! 26: .if !defined(BUILTIN_PKG.zlib) && \
! 27: !empty(IS_BUILTIN.zlib:M[yY][eE][sS]) && \
! 28: exists(${H_ZLIB})
! 29: BUILTIN_VERSION.zlib!= \
1.1 jlam 30: ${AWK} '/\#define[ ]*ZLIB_VERSION/ { \
31: vers = $$3; \
32: gsub("\"", "", vers); \
33: print vers; \
34: } \
1.3 ! jlam 35: ' ${H_ZLIB:Q}
1.1 jlam 36: #
37: # If the built-in zlib is 1.1.4, then check whether it has the security
38: # fix for CAN-2003-0107, which was a buffer overflow in the gzprintf
39: # function. If it does, then treat it as the equivalent of zlib-1.1.4nb1.
40: #
1.3 ! jlam 41: BUILTIN_CAN_2003_0107_FIX= NetBSD-1.3[I-Z]*-* NetBSD-1.[456]*-* \
! 42: NetBSD-[2-9]*-* NetBSD-1[0-9]*-*
1.1 jlam 43: #
44: # XXX These patterns for {Free,Open}BSD are too permissive, but I'm not
45: # XXX sure which versions of those OSes provide secure versions of
46: # XXX zlib-1.1.4.
47: #
1.3 ! jlam 48: BUILTIN_CAN_2003_0107_FIX+= FreeBSD-*-* OpenBSD-*-*
! 49: . if ${BUILTIN_VERSION.zlib} == "1.1.4"
! 50: . for _pattern_ in ${BUILTIN_CAN_2003_0107_FIX}
! 51: . if !empty(MACHINE_PLATFORM:M${_pattern_})
! 52: BUILTIN_VERSION.zlib= 1.1.4nb1
! 53: . endif
! 54: . endfor
1.1 jlam 55: . endif
1.3 ! jlam 56: BUILTIN_PKG.zlib= zlib-${BUILTIN_VERSION.zlib}
! 57: .endif
! 58: MAKEVARS+= BUILTIN_PKG.zlib
1.1 jlam 59:
1.3 ! jlam 60: ###
! 61: ### Determine whether we should use the built-in implementation if it
! 62: ### exists, and set USE_BUILTIN.<pkg> appropriate ("yes" or "no").
! 63: ###
1.1 jlam 64: .if !defined(USE_BUILTIN.zlib)
1.3 ! jlam 65: . if ${PREFER.zlib} == "pkgsrc"
! 66: USE_BUILTIN.zlib= no
! 67: . else
! 68: USE_BUILTIN.zlib= ${IS_BUILTIN.zlib}
! 69: . if defined(BUILTIN_PKG.zlib) && \
! 70: !empty(IS_BUILTIN.zlib:M[yY][eE][sS])
1.1 jlam 71: USE_BUILTIN.zlib= yes
1.3 ! jlam 72: . for _dep_ in ${BUILDLINK_DEPENDS.zlib}
! 73: . if !empty(USE_BUILTIN.zlib:M[yY][eE][sS])
1.1 jlam 74: USE_BUILTIN.zlib!= \
1.3 ! jlam 75: if ${PKG_ADMIN} pmatch ${_dep_:Q} ${BUILTIN_PKG.zlib:Q}; then \
! 76: ${ECHO} yes; \
1.1 jlam 77: else \
1.3 ! jlam 78: ${ECHO} no; \
1.1 jlam 79: fi
1.3 ! jlam 80: . endif
! 81: . endfor
! 82: . endif
! 83: . endif # PREFER.zlib
! 84: .endif
! 85: MAKEVARS+= USE_BUILTIN.zlib
1.1 jlam 86:
1.3 ! jlam 87: # If USE_ZLIB is defined, then force the use of a true zlib
! 88: # implementation.
! 89: #
! 90: .if defined(USE_ZLIB)
! 91: . if !empty(IS_BUILTIN.zlib:M[nN][oO])
1.1 jlam 92: USE_BUILTIN.zlib= no
93: . endif
94: .endif
CVSweb <webmaster@jp.NetBSD.org>