Use this builtin.mk from pkgsrc-wip, which works for all platforms

and detects a lot of more versions, thanks to Peter Postma.
This commit is contained in:
xtraeme 2005-01-11 21:19:24 +00:00
parent e106bbd12b
commit 5ec25f23e8

View file

@ -1,45 +1,52 @@
# $NetBSD: builtin.mk,v 1.8 2005/01/11 20:35:48 xtraeme Exp $
# $NetBSD: builtin.mk,v 1.9 2005/01/11 21:19:24 xtraeme Exp $
_LIBPCAP_H= /usr/include/pcap.h
_LIBPCAP_PKGSRC_PKGNAME= libpcap-0.8.3
_LIBPCAP_PCAP_H= /usr/include/pcap.h
.if !defined(IS_BUILTIN.libpcap)
IS_BUILTIN.libpcap= no
. if exists(${_LIBPCAP_H})
IS_BUILTIN.libpcap!= \
if ${GREP} -q PCAP_VERSION_MAJOR ${_LIBPCAP_H}; then \
${ECHO} "yes"; \
else \
${ECHO} "no"; \
fi
. if !empty(IS_BUILTIN.libpcap:M[yY][eE][sS])
#
# Create an appropriate name for the built-in package distributed
# with the system. This package name can be used to check against
# BUILDLINK_DEPENDS.<pkg> to see if we need to install the pkgsrc
# version or if the built-in one is sufficient.
#
. if !defined(_LIBPCAP_VERSION)
_LIBPCAP_VERSIONS= 0.8.3 0.7.2
_LIBPCAP_0.8.3= NetBSD-2.99.9* NetBSD-2.99.1[0-9]* NetBSD-[3-9]* \
FreeBSD-5.[3-9]* FreeBSD-6*
_LIBPCAP_0.7.2= NetBSD-1.[56]* NetBSD-2.0* NetBSD-2.99.[1-8] \
FreeBSD-4* FreeBSD-5.[12]*
. for _libpcap_version_ in ${_LIBPCAP_VERSIONS}
. for _pattern_ in ${_LIBPCAP_${_libpcap_version_}}
. if !empty(MACHINE_PLATFORM:M${_pattern_})
_LIBPCAP_VERSION?= ${_libpcap_version_}
. endif
. endfor
. endfor
_LIBPCAP_VERSION?= 0.7.2
. endif
BUILTIN_PKG.libpcap= libpcap-${_LIBPCAP_VERSION}
MAKEFLAGS+= BUILTIN_PKG.libpcap=${BUILTIN_PKG.libpcap}
. endif
. endif
MAKEFLAGS+= IS_BUILTIN.libpcap=${IS_BUILTIN.libpcap}
. if exists(${_LIBPCAP_PCAP_H})
IS_BUILTIN.libpcap= yes
# libpcap>=0.8.3: MODE_MON added
_PCAP_083!= \
${GREP} -c MODE_MON ${_LIBPCAP_PCAP_H} || ${TRUE}
# libpcap>=0.8.1: pcap_get_selectable_fd added
_PCAP_081!= \
${GREP} -c pcap_get_selectable_fd ${_LIBPCAP_PCAP_H} || ${TRUE}
# libpcap>=0.8.0: pcap_datalink_val_to_description added
_PCAP_080!= \
${GREP} -c pcap_datalink_val_to_description \
${_LIBPCAP_PCAP_H} || ${TRUE}
# libpcap>=0.7.0: pcap_setnonblock added
_PCAP_070!= \
${GREP} -c pcap_setnonblock ${_LIBPCAP_PCAP_H} || ${TRUE}
# libpcap>=0.6.0: prototype change for pcap_freecode
_PCAP_060!= \
${GREP} -c pcap_freecode.struct.bpf_program \
${_LIBPCAP_PCAP_H} || ${TRUE}
# libpcap>=0.5.0: pcap_compile_nopcap added
_PCAP_050!= \
${GREP} -c pcap_compile_nopcap ${_LIBPCAP_PCAP_H} || ${TRUE}
.if ${_PCAP_083} == "1"
BUILTIN_PKG.libpcap= libpcap-0.8.3
.elif ${_PCAP_081} == "1"
BUILTIN_PKG.libpcap= libpcap-0.8.1
.elif ${_PCAP_080} == "1"
BUILTIN_PKG.libpcap= libpcap-0.8.0
.elif ${_PCAP_070} == "1"
BUILTIN_PKG.libpcap= libpcap-0.7.0
.elif ${_PCAP_060} == "1"
BUILTIN_PKG.libpcap= libpcap-0.6.0
.elif ${_PCAP_050} == "1"
BUILTIN_PKG.libpcap= libpcap-0.5.0
.else
BUILTIN_PKG.libpcap= libpcap-0.4.0
.endif
.endif # exists({_LIBPCAP_PCAP_H})
.if !defined(USE_BUILTIN.libpcap)
USE_BUILTIN.libpcap?= ${IS_BUILTIN.libpcap}
@ -57,12 +64,4 @@ USE_BUILTIN.libpcap!= \
. endfor
. endif
.endif # USE_BUILTIN.libpcap
CHECK_BUILTIN.libpcap?= no
.if !empty(CHECK_BUILTIN.libpcap:M[nN][oO])
.if !empty(USE_BUILTIN.libpcap:M[nN][oO])
BUILDLINK_DEPENDS.libpcap+= libpcap>=0.8.3
.endif
.endif # CHECK_BUILTIN.libpcap
.endif # IS_BUILTIN.libpcap