summaryrefslogtreecommitdiff
path: root/net/hesiod/builtin.mk
blob: 2b0f377eb576e44afcef892fd3f297ea6e2700e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# $NetBSD: builtin.mk,v 1.1 2011/10/06 08:48:00 dholland Exp $

BUILTIN_PKG:=	hesiod

.include "../../mk/bsd.fast.prefs.mk"

BUILTIN_FIND_FILES_VAR:=	H_HESIOD
BUILTIN_FIND_FILES.H_HESIOD=	/usr/include/hesiod.h

.include "../../mk/buildlink3/bsd.builtin.mk"

###
### Determine if there is a built-in implementation of the package and
### set IS_BUILTIN.<pkg> appropriately ("yes" or "no").
###
.if !defined(IS_BUILTIN.hesiod)
IS_BUILTIN.hesiod=	no
.  if empty(H_HESIOD:M__nonexistent__) && empty(H_HESIOD:M${LOCALBASE}/*)
IS_BUILTIN.hesiod=	yes
.  endif
.endif
MAKEVARS+=	IS_BUILTIN.hesiod

###
### If there is a built-in implementation, then set BUILTIN_PKG.<pkg> to
### a package name to represent the built-in package.
###
.if !defined(BUILTIN_PKG.hesiod) && \
    !empty(IS_BUILTIN.hesiod:M[yY][eE][sS]) && \
    empty(H_HESIOD:M__nonexistent__)
# 3.0.2: bug fixes. 3.0.1: added HESIOD_INTERFACES symbol
_BLTN_HESIOD_302!=	\
	${GREP} -c HESIOD_INTERFACES ${H_HESIOD} || ${TRUE}
# 3.0.0: added hesiod_* functions
_BLTN_HESIOD_300!=	\
	${GREP} -c hesiod_init ${H_HESIOD} || ${TRUE}

.  if ${_BLTN_HESIOD_302} == "1"
BUILTIN_VERSION.hesiod=		3.0.2
.  elif ${_BLTN_HESIOD_300} == "1"
BUILTIN_VERSION.hesiod=		3.0.0
.  else
BUILTIN_VERSION.hesiod=		2.0.0
.  endif
BUILTIN_PKG.hesiod=	hesiod-${BUILTIN_VERSION.hesiod}
.endif
MAKEVARS+=	BUILTIN_PKG.hesiod

###
### Determine whether we should use the built-in implementation if it
### exists, and set USE_BUILTIN.<pkg> appropriate ("yes" or "no").
###
.if !defined(USE_BUILTIN.hesiod)
.  if ${PREFER.hesiod} == "pkgsrc"
USE_BUILTIN.hesiod=	no
.  else
USE_BUILTIN.hesiod=	${IS_BUILTIN.hesiod}
.    if defined(BUILTIN_PKG.hesiod) && \
        !empty(IS_BUILTIN.hesiod:M[yY][eE][sS])
USE_BUILTIN.hesiod=	yes
.      for _dep_ in ${BUILDLINK_API_DEPENDS.hesiod}
.        if !empty(USE_BUILTIN.hesiod:M[yY][eE][sS])
USE_BUILTIN.hesiod!=							\
	if ${PKG_ADMIN} pmatch ${_dep_:Q} ${BUILTIN_PKG.hesiod:Q}; then \
		${ECHO} yes;						\
	else								\
		${ECHO} no;						\
	fi
.        endif
.      endfor
.    endif
.  endif  # PREFER.hesiod
.endif
MAKEVARS+=	USE_BUILTIN.hesiod