summaryrefslogtreecommitdiff
path: root/mk/curses.builtin.mk
diff options
context:
space:
mode:
authorroy <roy>2014-03-09 10:15:32 +0000
committerroy <roy>2014-03-09 10:15:32 +0000
commitf6a1fa1d03acb95ea7975a833378c4c009171d65 (patch)
tree1f7e1db47953c8541d4e66b25932aae0a6c078ac /mk/curses.builtin.mk
parent7c9a89287943bc6ddf755a0fe6faf3f4dedd4ca9 (diff)
downloadpkgsrc-f6a1fa1d03acb95ea7975a833378c4c009171d65.tar.gz
Move the logic for testing if system curses supports the needed functions
from devel/ncurses to the mk infrastructure. FAKE_NCURSES=yes Provides the system curses as ncurses.h and libncurses. USE_CURSES=wide Links to system curses if they provide wide support, otherwise ncursesw. wide-curses in the package options also triggers this.
Diffstat (limited to 'mk/curses.builtin.mk')
-rw-r--r--mk/curses.builtin.mk94
1 files changed, 93 insertions, 1 deletions
diff --git a/mk/curses.builtin.mk b/mk/curses.builtin.mk
index b2bc27c09bc..8cb637af1b7 100644
--- a/mk/curses.builtin.mk
+++ b/mk/curses.builtin.mk
@@ -1,4 +1,4 @@
-# $NetBSD: curses.builtin.mk,v 1.7 2013/11/23 09:10:14 obache Exp $
+# $NetBSD: curses.builtin.mk,v 1.8 2014/03/09 10:15:32 roy Exp $
BUILTIN_PKG:= curses
@@ -6,6 +6,34 @@ BUILTIN_FIND_LIBS:= curses
BUILTIN_FIND_HEADERS_VAR:= H_CURSES
BUILTIN_FIND_HEADERS.H_CURSES= curses.h
+BUILTIN_FIND_FILES_VAR+= H_CURSES_HALFDELAY
+BUILTIN_FIND_FILES.H_CURSES_HALFDELAY= ${BUILTIN_FIND_FILES.H_CURSES}
+BUILTIN_FIND_GREP.H_CURSES_HALFDELAY= halfdelay
+
+BUILTIN_FIND_FILES_VAR+= H_CURSES_RESIZETERM
+BUILTIN_FIND_FILES.H_CURSES_RESIZETERM= ${BUILTIN_FIND_FILES.H_CURSES}
+BUILTIN_FIND_GREP.H_CURSES_RESIZETERM= resizeterm
+
+BUILTIN_FIND_FILES_VAR+= H_CURSES_PUTWIN
+BUILTIN_FIND_FILES.H_CURSES_PUTWIN= ${BUILTIN_FIND_FILES.H_CURSES}
+BUILTIN_FIND_GREP.H_CURSES_PUTWIN= putwin
+
+BUILTIN_FIND_FILES_VAR+= H_CURSES_WA_NORMAL
+BUILTIN_FIND_FILES.H_CURSES_WA_NORMAL= ${BUILTIN_FIND_FILES.H_CURSES}
+BUILTIN_FIND_GREP.H_CURSES_WA_NORMAL= WA_NORMAL
+
+BUILTIN_FIND_FILES_VAR+= H_CURSES_WGETNSTR
+BUILTIN_FIND_FILES.H_CURSES_WGETNSTR= ${BUILTIN_FIND_FILES.H_CURSES}
+BUILTIN_FIND_GREP.H_CURSES_WGETNSTR= wgetnstr
+
+BUILTIN_FIND_FILES_VAR+= H_CURSES_WSYNCUP
+BUILTIN_FIND_FILES.H_CURSES_WSYNCUP= ${BUILTIN_FIND_FILES.H_CURSES}
+BUILTIN_FIND_GREP.H_CURSES_WSYNCUP= wsyncup
+
+BUILTIN_FIND_FILES_VAR+= H_CURSES_MVWCHGAT
+BUILTIN_FIND_FILES.H_CURSES_MVWCHGAT= ${BUILTIN_FIND_FILES.H_CURSES}
+BUILTIN_FIND_GREP.H_CURSES_MVWCHGAT= mvwchgat
+
.include "buildlink3/bsd.builtin.mk"
###
@@ -44,6 +72,68 @@ USE_BUILTIN.curses!= \
. endif
. endif # PREFER.curses
.endif
+
+# If it is set to chgat, a curses implementation with chgat(3) support
+# is considered good enough.
+.if defined(USE_CURSES) && empty(USE_CURSES:M[yY][eE][sS])
+. if !empty(USE_CURSES:Mchgat) && !empty(H_CURSES_MVWCHGAT:M__nonexistent__)
+USE_BUILTIN.curses= no
+. endif
+# same for halfdelay(3)
+. if !empty(USE_CURSES:Mhalfdelay)
+. if !empty(H_CURSES_HALFDELAY:M__nonexistent__)
+USE_BUILTIN.curses= no
+. endif
+. endif
+## same for putwin(3)
+. if !empty(USE_CURSES:Mputwin) && !empty(H_CURSES_PUTWIN:M__nonexistent__)
+USE_BUILTIN.curses= no
+. endif
+# same for resizeterm(3)
+. if !empty(USE_CURSES:Mresizeterm)
+. if !empty(H_CURSES_RESIZETERM:M__nonexistent__)
+USE_BUILTIN.curses= no
+. endif
+. endif
+## same for WA_NORMAL
+. if !empty(USE_CURSES:MWA_NORMAL)
+. if !empty(H_CURSES_WA_NORMAL:M__nonexistent__)
+USE_BUILTIN.curses= no
+. endif
+. endif
+## same for wgetnstr(3)
+. if !empty(USE_CURSES:Mwgetnstr) && !empty(H_CURSES_WGETNSTR:M__nonexistent__)
+USE_BUILTIN.curses= no
+. endif
+# same for wsyncup(3)
+. if !empty(USE_CURSES:Mwsyncup) && !empty(H_CURSES_WSYNCUP:M__nonexistent__)
+USE_BUILTIN.curses= no
+. endif
+# AFAIK there is no way of working out if a system curses library has wide
+# character support. So be safe and say no unless we know for sure.
+. if !empty(USE_CURSES:Mwide)
+. if ${OPSYS} == "NetBSD"
+. if !empty(MACHINE_PLATFORM:MNetBSD-[0-4].*-*)
+USE_BUILTIN.curses= no
+. endif
+. else
+USE_BUILTIN.curses= no
+. endif
+. endif
+.endif
+
+# Even if the package requested tests above pass,
+# some system curses just are not good enough.
+# If your system is one, add it here so a suitable
+# curses from pkgsrc can be installed.
+_INCOMPAT_CURSES?= NetBSD-0.*-* NetBSD-1.[0123]*-* \
+ NetBSD-1.4.*-* NetBSD-1.4[A-X]-*
+.for _pattern_ in ${_INCOMPAT_CURSES} ${INCOMPAT_CURSES}
+. if !empty(MACHINE_PLATFORM:M${_pattern_})
+USE_BUILTIN.curses= no
+. endif
+.endfor
+
MAKEVARS+= USE_BUILTIN.curses
# Define BUILTIN_LIBNAME.curses to be the base name of the built-in
@@ -53,6 +143,8 @@ MAKEVARS+= USE_BUILTIN.curses
BUILTIN_LIBNAME.curses= curses
.endif
+BUILTIN_LIBNAME.curses= curses
+
###
### The section below only applies if we are not including this file
### solely to determine whether a built-in implementation exists.