summaryrefslogtreecommitdiff
path: root/databases/gdbm_compat/builtin.mk
blob: b5e7e864accee439cdd50a18df14413a1cd861ea (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
# $NetBSD: builtin.mk,v 1.5 2017/03/20 06:02:27 adam Exp $

BUILTIN_PKG:=			gdbm_compat
BUILTIN_FIND_HEADERS_VAR=	NDBM_H
BUILTIN_FIND_HEADERS.NDBM_H=	ndbm.h
BUILTIN_FIND_GREP.NDBM_H=	This file is part of GDBM

.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.gdbm_compat)
IS_BUILTIN.gdbm_compat=	no
.  if empty(NDBM_H:M__nonexistent__)
IS_BUILTIN.gdbm_compat=	yes
.  endif
.endif
MAKEVARS+=	IS_BUILTIN.gdbm_compat

##
## Include databases/gdbm/builtin.mk so that BUILTIN_PKG.gdbm and
## USE_BUILTIN.gdbm are set.
.if !defined(BUILTIN_PKG.gdbm) || !defined(USE_BUILTIN.gdbm)
.  include "../../databases/gdbm/builtin.mk"
.endif

###
### 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.gdbm_compat) && \
    !empty(IS_BUILTIN.gdbm_compat:M[yY][eE][sS])
BUILTIN_PKG.gdbm_compat:= ${BUILTIN_PKG.gdbm:S/gdbm-/gdbm_compat-/}
.endif
MAKEVARS+=	BUILTIN_PKG.gdbm_compat

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