summaryrefslogtreecommitdiff
path: root/mk/readline.buildlink3.mk
diff options
context:
space:
mode:
Diffstat (limited to 'mk/readline.buildlink3.mk')
-rw-r--r--mk/readline.buildlink3.mk84
1 files changed, 84 insertions, 0 deletions
diff --git a/mk/readline.buildlink3.mk b/mk/readline.buildlink3.mk
new file mode 100644
index 00000000000..584722c14f8
--- /dev/null
+++ b/mk/readline.buildlink3.mk
@@ -0,0 +1,84 @@
+# $NetBSD: readline.buildlink3.mk,v 1.1 2013/07/15 01:54:25 ryoon 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.
+#
+READLINE_DEFAULT?= editline
+
+_READLINE_ACCEPTED= # empty
+.if defined(USE_BUILTIN.editlinereadline) && \
+ !empty(USE_BUILTIN.editlinereadline:M[yY][eE][sS])
+_READLINE_ACCEPTED+= editline # system editline exists or pkgsrc editline
+.endif
+_READLINE_ACCEPTED+= readline # pkgsrc readline
+
+_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