summaryrefslogtreecommitdiff
path: root/mk/readline.buildlink3.mk
blob: f8ec5c282a8f11f0b0d731955ae01e6cf9c904e6 (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
75
76
77
78
79
80
81
82
83
84
85
86
87
# $NetBSD: readline.buildlink3.mk,v 1.5 2016/04/11 04:22:34 dbj Exp $
#
# This Makefile fragment is meant to be included by packages that require
# any readline implementation instead of one particular one.  The available
# readline/editline implementations are "editline" and "readline".
#
# If a package genuinely requires editline or readline, then it should
# directly include the appropriate buildlink3.mk instead of this file in
# the package Makefile.
#
# === User-settable variables ===
#
# READLINE_DEFAULT
#	This value represents the type of readline we wish to use on the
#	system.  Setting this to "editline" means that the system libedit
#	implementation is fine or pkgsrc "editline" should be used.
#
#	Possible: editline readline
#	Default: (depends)
#
# === Variables set by this file ===
#
# READLINE_TYPE
#	The name of the selected readline implementation, editline or
#	readline.

EDITLINEREADLINE_BUILDLINK3_MK:=	${EDITLINEREADLINE_BUILDLINK3_MK}+
.include "bsd.fast.prefs.mk"

.if !empty(EDITLINEREADLINE_BUILDLINK3_MK:M+)

# _READLINE_PKGS is an exhaustive list of all of the readline implementations
# that may be used with readline.buildlink3.mk.
#
_READLINE_PKGS?=	editline readline

CHECK_BUILTIN.editlinereadline:=	yes
.include "readline.builtin.mk"
CHECK_BUILTIN.editlinereadline:=	no

# Set the value of READLINE_DEFAULT depending on the platform and what's
# available in the base system.
#
.if defined(IS_BUILTIN.editline) && \
	!empty(IS_BUILTIN.editline:M[Yy][Ee][Ss])
READLINE_DEFAULT?=	editline
.elif defined(IS_BUILTIN.readline) && \
	!empty(IS_BUILTIN.readline:M[Yy][Ee][Ss])
READLINE_DEFAULT?=	readline
.else
READLINE_DEFAULT?=	readline
.endif

_READLINE_ACCEPTED=	${_READLINE_PKGS} # both are provided by pkgsrc.

_READLINE_TYPE=		${READLINE_DEFAULT}
.  if !empty(_READLINE_ACCEPTED:M${_READLINE_TYPE})
READLINE_TYPE=		${_READLINE_TYPE}
.  else
READLINE_TYPE=		none
.  endif

BUILD_DEFS+=		READLINE_DEFAULT
BUILD_DEFS_EFFECTS+=	READLINE_TYPE

# _PKG_USE_READLINE is a flag for use by the readline packages' buildlink3.mk
# files to indicate that the headers and libraries should be usable as
# <readline.h> etc. and -lreadline etc.
#
_PKG_USE_READLINE=	yes

.endif	# EDITLINEREADLINE_BUILDLINK3_MK

.if ${READLINE_TYPE} == "none"
PKG_FAIL_REASON+=	\
	"${_READLINE_TYPE} is not an acceptable readline type for ${PKGNAME}."
.elif ${READLINE_TYPE} == "editline"
.  include "../../devel/editline/buildlink3.mk"
BUILDLINK_PREFIX.editlinereadline?=	${BUILDLINK_PREFIX.editline}
BUILDLINK_LIBNAME.editlinereadline?=	${BUILDLINK_LIBNAME.editline}
BUILDLINK_LDADD.editlinereadline?=	${BUILDLINK_LDADD.editline}
.elif ${READLINE_TYPE} == "readline"
.  include "../../devel/readline/buildlink3.mk"
BUILDLINK_PREFIX.editlinereadline?=	${BUILDLINK_PREFIX.readline}
BUILDLINK_LIBNAME.editlinereadline?=	${BUILDLINK_LIBNAME.readline}
BUILDLINK_LDADD.editlinereadline?=	${BUILDLINK_LDADD.readline}
.endif