summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorroy <roy@pkgsrc.org>2010-02-07 09:46:13 +0000
committerroy <roy@pkgsrc.org>2010-02-07 09:46:13 +0000
commit9580789fabdd6afed911ccfa418e511a89accaaa (patch)
treee127d13b38ec1ea7da4df3eef026d073e9e916cf
parentbb48ab4c5e5934af148256391c46af9813cd1cb4 (diff)
downloadpkgsrc-9580789fabdd6afed911ccfa418e511a89accaaa.tar.gz
Add builtin for working out if we have terminfo installed natively.
-rw-r--r--mk/curses.buildlink3.mk6
-rw-r--r--mk/termcap.buildlink3.mk7
-rw-r--r--mk/termcap.builtin.mk11
-rw-r--r--mk/terminfo.builtin.mk82
4 files changed, 96 insertions, 10 deletions
diff --git a/mk/curses.buildlink3.mk b/mk/curses.buildlink3.mk
index 349b948ebb0..2ed45c513e4 100644
--- a/mk/curses.buildlink3.mk
+++ b/mk/curses.buildlink3.mk
@@ -1,4 +1,4 @@
-# $NetBSD: curses.buildlink3.mk,v 1.14 2009/03/20 19:25:01 joerg Exp $
+# $NetBSD: curses.buildlink3.mk,v 1.15 2010/02/07 09:46:13 roy Exp $
#
# This Makefile fragment is meant to be included by packages that require
# any curses implementation instead of one particular one. The available
@@ -25,7 +25,6 @@
# The name of the selected curses implementation.
CURSES_BUILDLINK3_MK:= ${CURSES_BUILDLINK3_MK}+
-
.include "bsd.fast.prefs.mk"
.if !empty(CURSES_BUILDLINK3_MK:M+)
@@ -81,8 +80,9 @@ BUILDLINK_TREE+= curses -curses
BUILDLINK_LDADD.curses?= ${BUILDLINK_LIBNAME.curses:S/^/-l/:S/^-l$//}
BUILDLINK_BUILTIN_MK.curses= ../../mk/curses.builtin.mk
.elif ${CURSES_TYPE} == "ncurses"
+daaaaa
USE_NCURSES= yes
-. include "../../devel/ncurses/buildlink3.mk"
+. include "../../devel/ncurses/buildlink3.mkxx"
BUILDLINK_PREFIX.curses?= ${BUILDLINK_PREFIX.ncurses}
BUILDLINK_LIBNAME.curses?= ${BUILDLINK_LIBNAME.ncurses}
BUILDLINK_LDADD.curses?= ${BUILDLINK_LDADD.ncurses}
diff --git a/mk/termcap.buildlink3.mk b/mk/termcap.buildlink3.mk
index e601704a0cd..3a719293ff0 100644
--- a/mk/termcap.buildlink3.mk
+++ b/mk/termcap.buildlink3.mk
@@ -1,4 +1,4 @@
-# $NetBSD: termcap.buildlink3.mk,v 1.7 2009/03/20 19:25:01 joerg Exp $
+# $NetBSD: termcap.buildlink3.mk,v 1.8 2010/02/07 09:46:14 roy Exp $
#
# This Makefile fragment is meant to be included by packages that require
# a termcap implementation that supports the basic termcap functions:
@@ -19,7 +19,7 @@ TERMCAP_BUILDLINK3_MK:= ${TERMCAP_BUILDLINK3_MK}+
# _TERMCAP_TYPES is an exhaustive list of all of the termcap
# implementations that may be found.
#
-_TERMCAP_TYPES?= curses termcap termlib tinfo
+_TERMCAP_TYPES?= terminfo curses termcap termlib tinfo
CHECK_BUILTIN.termcap:= yes
. include "termcap.builtin.mk"
@@ -53,7 +53,8 @@ BUILDLINK_TRANSFORM+= l:termcap:${BUILDLINK_LIBNAME.termcap}
.if ${TERMCAP_TYPE} == "none"
PKG_FAIL_REASON= "No usable termcap library found on the system."
-.elif (${TERMCAP_TYPE} == "termlib") || \
+.elif (${TERMCAP_TYPE} == "terminfo") || \
+ (${TERMCAP_TYPE} == "termlib") || \
(${TERMCAP_TYPE} == "termcap") || \
(${TERMCAP_TYPE} == "tinfo")
BUILDLINK_TREE+= termcap -termcap
diff --git a/mk/termcap.builtin.mk b/mk/termcap.builtin.mk
index 42c99c8bfaf..a9d966a1205 100644
--- a/mk/termcap.builtin.mk
+++ b/mk/termcap.builtin.mk
@@ -1,8 +1,8 @@
-# $NetBSD: termcap.builtin.mk,v 1.6 2009/03/20 19:25:01 joerg Exp $
+# $NetBSD: termcap.builtin.mk,v 1.7 2010/02/07 09:46:14 roy Exp $
BUILTIN_PKG:= termcap
-BUILTIN_FIND_LIBS:= curses termcap termlib tinfo
+BUILTIN_FIND_LIBS:= terminfo curses termcap termlib tinfo
BUILTIN_FIND_FILES_VAR:= H_TERM H_TERMCAP H_TERMLIB
BUILTIN_FIND_FILES.H_TERM:= /usr/include/term.h
BUILTIN_FIND_GREP.H_TERM:= tgetent
@@ -19,7 +19,8 @@ BUILTIN_FIND_GREP.H_TERMLIB:= tgetent
###
.if !defined(IS_BUILTIN.termcap)
IS_BUILTIN.termcap= no
-. if !empty(BUILTIN_LIB_FOUND.curses:M[yY][eE][sS]) || \
+. if !empty(BUILTIN_LIB_FOUND.terminfo:M[yY[eE][sS]) || \
+ !empty(BUILTIN_LIB_FOUND.curses:M[yY][eE][sS]) || \
!empty(BUILTIN_LIB_FOUND.termcap:M[yY][eE][sS]) || \
!empty(BUILTIN_LIB_FOUND.termlib:M[yY][eE][sS]) || \
!empty(BUILTIN_LIB_FOUND.tinfo:M[yY][eE][sS])
@@ -56,7 +57,9 @@ MAKEVARS+= USE_BUILTIN.termcap
# (8) If libtermlib exists by itself, then it's "termlib".
#
.if empty(H_TERM:M__nonexistent__) && empty(H_TERM:M${LOCALBASE}/*)
-. if !empty(BUILTIN_LIB_FOUND.tinfo:M[yY][eE][sS])
+. if !empty(BUILTIN_LIB_FOUND.terminfo:M[yY][eE][sS])
+BUILTIN_LIBNAME.termcap= terminfo
+. elif !empty(BUILTIN_LIB_FOUND.tinfo:M[yY][eE][sS])
BUILTIN_LIBNAME.termcap= tinfo
. elif !empty(BUILTIN_LIB_FOUND.curses:M[yY][eE][sS])
BUILTIN_LIBNAME.termcap= curses
diff --git a/mk/terminfo.builtin.mk b/mk/terminfo.builtin.mk
new file mode 100644
index 00000000000..713672b0214
--- /dev/null
+++ b/mk/terminfo.builtin.mk
@@ -0,0 +1,82 @@
+# $NetBSD: terminfo.builtin.mk,v 1.1 2010/02/07 09:46:14 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
+
+.include "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.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])
+IS_BUILTIN.terminfo= yes
+. endif
+.endif
+MAKEVARS+= IS_BUILTIN.terminfo
+
+###
+### 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.terminfo)
+. if ${PREFER.terminfo} == "pkgsrc"
+USE_BUILTIN.terminfo= no
+. else
+USE_BUILTIN.terminfo= ${IS_BUILTIN.terminfo}
+. endif # PREFER.terminfo
+.endif
+MAKEVARS+= USE_BUILTIN.terminfo
+
+# Define BUILTIN_LIBNAME.termcap to be the base name of the built-in
+# termcap library.
+#
+# The way this is determined is:
+#
+# (1) If <term.h> exists and libterminfo exists, then it's "terminfo".
+# (1) If <term.h> exists and libtinfo exists, then it's "tinfo".
+# (2) If <term.h> exists and libcurses exists, then it's "curses".
+# (3) If <term.h> exists and lib{curses,terminfo,tinfo} don't, then it's "c".
+#
+.if empty(H_TERM:M__nonexistent__) && empty(H_TERM:M${LOCALBASE}/*)
+. if !empty(BUILTIN_LIB_FOUND.terminfo:M[yY][eE][sS])
+BUILTIN_LIBNAME.terminfo= terminfo
+. elif !empty(BUILTIN_LIB_FOUND.tinfo:M[yY][eE][sS])
+BUILTIN_LIBNAME.terminfo= tinfo
+. elif !empty(BUILTIN_LIB_FOUND.curses:M[yY][eE][sS])
+BUILTIN_LIBNAME.terminfo= curses
+. else
+BUILTIN_LIBNAME.terminfo= c
+. endif
+.endif
+
+###
+### The section below only applies if we are not including this file
+### solely to determine whether a built-in implementation exists.
+###
+CHECK_BUILTIN.terminfo?= no
+.if !empty(CHECK_BUILTIN.terminfo:M[nN][oO])
+
+. if !empty(USE_BUILTIN.terminfo:M[yY][eE][sS])
+BUILDLINK_LIBNAME.terminfo= ${BUILTIN_LIBNAME.terminfo}
+. endif
+
+# If the package wants both "terminfo" and "curses", then we must not
+# remove the -l options for the curses libraries; otherwise, we should
+# remove them as GNU configure scripts commonly check for one or both
+# of those library options.
+#
+. if empty(BUILDLINK_TREE:Mcurses) && empty(BUILDLINK_TREE:Mncurses)
+BUILDLINK_TRANSFORM+= rm:-lcurses
+BUILDLINK_TRANSFORM+= rm:-lncurses
+. endif
+
+.endif # CHECK_BUILTIN.terminfo