summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
authorroy <roy@pkgsrc.org>2010-02-08 22:11:43 +0000
committerroy <roy@pkgsrc.org>2010-02-08 22:11:43 +0000
commitbac05b30eff8418318a77dd66085a67b251832d1 (patch)
treee4fb7aba3ce5761c1aabb42c82d3e70932f2f92f /mk
parentc132073d65d338afe11178fb78c077ad5a358a9d (diff)
downloadpkgsrc-bac05b30eff8418318a77dd66085a67b251832d1.tar.gz
Detect a working terminfo a little better.
Diffstat (limited to 'mk')
-rw-r--r--mk/terminfo.buildlink3.mk84
-rw-r--r--mk/terminfo.builtin.mk12
2 files changed, 91 insertions, 5 deletions
diff --git a/mk/terminfo.buildlink3.mk b/mk/terminfo.buildlink3.mk
new file mode 100644
index 00000000000..701292fb26e
--- /dev/null
+++ b/mk/terminfo.buildlink3.mk
@@ -0,0 +1,84 @@
+# $NetBSD: terminfo.buildlink3.mk,v 1.1 2010/02/08 22:11:43 roy Exp $
+#
+# This Makefile fragment is meant to be included by packages that require
+# any terminfo implementation instead of one particular one. The available
+# terminfo implementations are "terminfo" if built-in, "ncurses", and
+# "pdcurses".
+#
+# If a package genuinely requires ncurses or pdcurses, then it should
+# directly include the appropriate buildlink3.mk instead of this file in
+# the package Makefile.
+#
+# === User-settable variables ===
+#
+# TERMINFO_DEFAULT
+# This value represents the type of curses we wish to use on the
+# system. Setting this to "curses" means that the system curses
+# implementation is fine.
+#
+# Possible: terminfo, ncurses, pdcurses
+# Default: (depends)
+#
+# === Variables set by this file ===
+#
+# TERMINFO_TYPE
+# The name of the selected curses implementation.
+
+TERMINFO_BUILDLINK3_MK:= ${TERMINFO_BUILDLINK3_MK}+
+.include "bsd.fast.prefs.mk"
+
+.if !empty(TERMINFO_BUILDLINK3_MK:M+)
+
+# _TERMINFO_PKGS is an exhaustive list of all of the curses implementations
+# that may be used with curses.buildlink3.mk.
+#
+_TERMINFO_PKGS?= terminfo ncurses pdcurses
+
+CHECK_BUILTIN.terminfo:= yes
+. include "terminfo.builtin.mk"
+CHECK_BUILTIN.terminfo:= no
+
+# Set the value of TERMINFO_DEFAULT depending on the platform and what's
+# available in the base system.
+#
+.if defined(USE_BUILTIN.terminfo) && !empty(USE_BUILTIN.terminfo:M[yY][eE][sS])
+TERMINFO_DEFAULT?= terminfo
+.else
+TERMINFO_DEFAULT?= ncurses
+.endif
+
+_TERMINFO_ACCEPTED= # empty
+.if defined(USE_BUILTIN.terminfo) && !empty(USE_BUILTIN.terminfo:M[yY][eE][sS])
+_TERMINFO_ACCEPTED+= terminfo # system curses exists
+.endif
+_TERMINFO_ACCEPTED+= ncurses # pkgsrc ncurses
+_TERMINFO_ACCEPTED+= pdcurses # pkgsrc pdcurses
+
+_TERMINFO_TYPE= ${TERMINFO_DEFAULT}
+. if !empty(_TERMINFO_ACCEPTED:M${_TERMINFO_TYPE})
+TERMINFO_TYPE= ${_TERMINFO_TYPE}
+. else
+TERMINFO_TYPE= none
+. endif
+
+BUILD_DEFS+= TERMINFO_DEFAULT
+BUILD_DEFS_EFFECTS+= TERMINFO_TYPE
+
+.endif # TERMINFO_BUILDLINK3_MK
+
+.if ${TERMINFO_TYPE} == "none"
+PKG_FAIL_REASON= \
+ "${_TERMINFO_TYPE} is not an acceptable terminfo type for ${PKGNAME}."
+.elif ${TERMINFO_TYPE} == "terminfo"
+.elif ${TERMINFO_TYPE} == "ncurses"
+USE_NCURSES= yes
+. include "../../devel/ncurses/buildlink3.mk"
+BUILDLINK_PREFIX.curses?= ${BUILDLINK_PREFIX.ncurses}
+BUILDLINK_LIBNAME.curses?= ${BUILDLINK_LIBNAME.ncurses}
+BUILDLINK_LDADD.curses?= ${BUILDLINK_LDADD.ncurses}
+.elif ${TERMINFO_TYPE} == "pdcurses"
+. include "../../devel/pdcurses/buildlink3.mk"
+BUILDLINK_PREFIX.curses?= ${BUILDLINK_PREFIX.pdcurses}
+BUILDLINK_LIBNAME.curses?= ${BUILDLINK_LIBNAME.pdcurses}
+BUILDLINK_LDADD.curses?= ${BUILDLINK_LDADD.pdcurses}
+.endif
diff --git a/mk/terminfo.builtin.mk b/mk/terminfo.builtin.mk
index 713672b0214..014f23a82d3 100644
--- a/mk/terminfo.builtin.mk
+++ b/mk/terminfo.builtin.mk
@@ -1,11 +1,11 @@
-# $NetBSD: terminfo.builtin.mk,v 1.1 2010/02/07 09:46:14 roy Exp $
+# $NetBSD: terminfo.builtin.mk,v 1.2 2010/02/08 22:11:43 roy Exp $
BUILTIN_PKG:= terminfo
BUILTIN_FIND_LIBS:= terminfo curses tinfo
BUILTIN_FIND_FILES_VAR:= H_TERM
BUILTIN_FIND_FILES.H_TERM:= /usr/include/term.h
-BUILTIN_FIND_GREP.H_TERM:= tigetent
+BUILTIN_FIND_GREP.H_TERM:= tigetstr
.include "buildlink3/bsd.builtin.mk"
@@ -15,10 +15,12 @@ BUILTIN_FIND_GREP.H_TERM:= tigetent
###
.if !defined(IS_BUILTIN.terminfo)
IS_BUILTIN.terminfo= no
-. if !empty(BUILTIN_LIB_FOUND.terminfo:M[yY[eE][sS]) || \
- !empty(BUILTIN_LIB_FOUND.curses:M[yY][eE][sS]) || \
- !empty(BUILTIN_LIB_FOUND.tinfo:M[yY][eE][sS])
+. if empty(H_TERM:M__nonexistent__) && empty(H_TERM:M${LOCALBASE}/*)
+. if !empty(BUILTIN_LIB_FOUND.terminfo:M[yY[eE][sS]) || \
+ !empty(BUILTIN_LIB_FOUND.curses:M[yY][eE][sS]) || \
+ !empty(BUILTIN_LIB_FOUND.tinfo:M[yY][eE][sS])
IS_BUILTIN.terminfo= yes
+. endif
. endif
.endif
MAKEVARS+= IS_BUILTIN.terminfo