Sun Mar 9 10:15:32 2014 UTC ()
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.


(roy)
diff -r1.17 -r1.18 pkgsrc/mk/curses.buildlink3.mk
diff -r1.7 -r1.8 pkgsrc/mk/curses.builtin.mk
diff -r1.4 -r1.5 pkgsrc/mk/terminfo.buildlink3.mk

cvs diff -r1.17 -r1.18 pkgsrc/mk/curses.buildlink3.mk (expand / switch to unified diff)

--- pkgsrc/mk/curses.buildlink3.mk 2010/02/07 10:28:13 1.17
+++ pkgsrc/mk/curses.buildlink3.mk 2014/03/09 10:15:32 1.18
@@ -1,93 +1,130 @@ @@ -1,93 +1,130 @@
1# $NetBSD: curses.buildlink3.mk,v 1.17 2010/02/07 10:28:13 roy Exp $ 1# $NetBSD: curses.buildlink3.mk,v 1.18 2014/03/09 10:15:32 roy Exp $
2# 2#
3# This Makefile fragment is meant to be included by packages that require 3# This Makefile fragment is meant to be included by packages that require
4# any curses implementation instead of one particular one. The available 4# any curses implementation instead of one particular one. The available
5# curses implementations are "curses" if built-in, "ncurses", and 5# curses implementations are "curses" if built-in, "ncurses", and
6# "pdcurses". 6# "pdcurses".
7# 7#
8# If a package genuinely requires ncurses or pdcurses, then it should 8# If a package genuinely requires ncurses or pdcurses, then it should
9# directly include the appropriate buildlink3.mk instead of this file in 9# directly include the appropriate buildlink3.mk instead of this file in
10# the package Makefile. 10# the package Makefile.
11# 11#
12# === User-settable variables === 12# === User-settable variables ===
13# 13#
14# CURSES_DEFAULT 14# CURSES_DEFAULT
15# This value represents the type of curses we wish to use on the 15# This value represents the type of curses we wish to use on the
16# system. Setting this to "curses" means that the system curses 16# system. Setting this to "curses" means that the system curses
17# implementation is fine. 17# implementation is fine.
18# 18#
19# Possible: curses, ncurses, pdcurses 19# Possible: curses, ncurses, ncursesw, pdcurses
20# Default: (depends) 20# Default: (depends)
21# 21#
22# === Variables set by this file === 22# === Variables set by this file ===
23# 23#
24# CURSES_TYPE 24# CURSES_TYPE
25# The name of the selected curses implementation. 25# The name of the selected curses implementation.
26 26
27CURSES_BUILDLINK3_MK:= ${CURSES_BUILDLINK3_MK}+ 27CURSES_BUILDLINK3_MK:= ${CURSES_BUILDLINK3_MK}+
28.include "bsd.fast.prefs.mk" 28.include "bsd.fast.prefs.mk"
29 29
30.if !empty(CURSES_BUILDLINK3_MK:M+) 30.if !empty(CURSES_BUILDLINK3_MK:M+)
31 31
 32.if !defined(USE_CURSES) && !empty(PKG_OPTIONS:Mwide-curses)
 33USE_CURSES?= wide
 34.endif
 35
32# _CURSES_PKGS is an exhaustive list of all of the curses implementations 36# _CURSES_PKGS is an exhaustive list of all of the curses implementations
33# that may be used with curses.buildlink3.mk. 37# that may be used with curses.buildlink3.mk.
34# 38#
35_CURSES_PKGS?= curses ncurses pdcurses 39_CURSES_PKGS?= curses ncurses ncursesw pdcurses
36 40
37CHECK_BUILTIN.curses:= yes 41CHECK_BUILTIN.curses:= yes
38. include "curses.builtin.mk" 42. include "curses.builtin.mk"
39CHECK_BUILTIN.curses:= no 43CHECK_BUILTIN.curses:= no
40 44
41# Set the value of CURSES_DEFAULT depending on the platform and what's 45# Set the value of CURSES_DEFAULT depending on the platform and what's
42# available in the base system. 46# available in the base system.
43# 47#
44.if defined(USE_BUILTIN.curses) && !empty(USE_BUILTIN.curses:M[yY][eE][sS]) 48.if defined(USE_BUILTIN.curses) && !empty(USE_BUILTIN.curses:M[yY][eE][sS])
45CURSES_DEFAULT?= curses 49CURSES_DEFAULT?= curses
 50.elif !empty(USE_CURSES:Mwide) || !empty(PKG_OPTIONS:Mwide-curses)
 51CURSES_DEFAULT?= ncursesw
46.else 52.else
47CURSES_DEFAULT?= ncurses 53CURSES_DEFAULT?= ncurses
48.endif 54.endif
49 55
50_CURSES_ACCEPTED= # empty 56_CURSES_ACCEPTED= # empty
51.if defined(USE_BUILTIN.curses) && !empty(USE_BUILTIN.curses:M[yY][eE][sS]) 57.if defined(USE_BUILTIN.curses) && !empty(USE_BUILTIN.curses:M[yY][eE][sS])
52_CURSES_ACCEPTED+= curses # system curses exists 58_CURSES_ACCEPTED+= curses # system curses exists
53.endif 59.endif
 60.if defined(USE_BUILTIN.cursesw) && !empty(USE_BUILTIN.cursesw:M[yY][eE][sS])
 61_CURSES_ACCEPTED+= curses # system curses exists
 62.endif
54_CURSES_ACCEPTED+= ncurses # pkgsrc ncurses 63_CURSES_ACCEPTED+= ncurses # pkgsrc ncurses
 64_CURSES_ACCEPTED+= ncursesw # pkgsrc ncursesw
55_CURSES_ACCEPTED+= pdcurses # pkgsrc pdcurses 65_CURSES_ACCEPTED+= pdcurses # pkgsrc pdcurses
56 66
57_CURSES_TYPE= ${CURSES_DEFAULT} 67_CURSES_TYPE= ${CURSES_DEFAULT}
58. if !empty(_CURSES_ACCEPTED:M${_CURSES_TYPE}) 68. if !empty(_CURSES_ACCEPTED:M${_CURSES_TYPE})
59CURSES_TYPE= ${_CURSES_TYPE} 69CURSES_TYPE= ${_CURSES_TYPE}
60. else 70. else
61CURSES_TYPE= none 71CURSES_TYPE= none
62. endif 72. endif
63 73
64BUILD_DEFS+= CURSES_DEFAULT 74BUILD_DEFS+= CURSES_DEFAULT
65BUILD_DEFS_EFFECTS+= CURSES_TYPE 75BUILD_DEFS_EFFECTS+= CURSES_TYPE
66 76
67# _PKG_USE_CURSES is a flag for use by the curses packages' buildlink3.mk 77# _PKG_USE_CURSES is a flag for use by the curses packages' buildlink3.mk
68# files to indicate that the headers and libraries should be usable as 78# files to indicate that the headers and libraries should be usable as
69# <curses.h> and -lcurses. 79# <curses.h> and -lcurses.
70# 80#
71_PKG_USE_CURSES= yes 81_PKG_USE_CURSES= yes
72 82
 83.PHONY: buildlink-curses-ncurses-h
 84buildlink-curses-ncurses-h:
 85 ${RUN} \
 86 src="${H_CURSES}"; \
 87 dest=${BUILDLINK_DIR}"/include/ncurses.h"; \
 88 if ${TEST} ! -f "$$dest" -a -f "$$src"; then \
 89 ${ECHO_BUILDLINK_MSG} "Linking ${H_CURSES} -> ncurses.h.";\
 90 ${MKDIR} `${DIRNAME} "$$dest"`; \
 91 ${LN} -s "$$src" "$$dest"; \
 92 fi
 93
 94
73.endif # CURSES_BUILDLINK3_MK 95.endif # CURSES_BUILDLINK3_MK
74 96
75.if ${CURSES_TYPE} == "none" 97.if ${CURSES_TYPE} == "none"
76PKG_FAIL_REASON= \ 98PKG_FAIL_REASON= \
77 "${_CURSES_TYPE} is not an acceptable curses type for ${PKGNAME}." 99 "${_CURSES_TYPE} is not an acceptable curses type for ${PKGNAME}."
78.elif ${CURSES_TYPE} == "curses" 100.elif ${CURSES_TYPE} == "curses"
 101. include "curses.builtin.mk"
79BUILDLINK_TREE+= curses -curses 102BUILDLINK_TREE+= curses -curses
80BUILDLINK_LDADD.curses?= ${BUILDLINK_LIBNAME.curses:S/^/-l/:S/^-l$//} 103BUILDLINK_LDADD.curses?= ${BUILDLINK_LIBNAME.curses:S/^/-l/:S/^-l$//}
81BUILDLINK_BUILTIN_MK.curses= ../../mk/curses.builtin.mk 104BUSILDLINK_BUILTIN_MK.curses= ../../mk/curses.builtin.mk
 105# Some packages only look for ncurses
 106# The correct action would be to write a patch and pass it upstream
 107# but by setting FAKE_NCURSES=yes in the package we can temporarily work
 108# around the short-coming.
 109. if !empty(FAKE_NCURSES:M[yY][eE][sS])
 110BUILDLINK_TARGETS+= buildlink-curses-ncurses-h
 111BUILDLINK_TRANSFORM+= l:ncurses:${BUILDLINK_LIBNAME.curses}
 112BUILDLINK_TRANSFORM+= l:ncursesw:${BUILDLINK_LIBNAME.curses}
 113. endif
82.elif ${CURSES_TYPE} == "ncurses" 114.elif ${CURSES_TYPE} == "ncurses"
83USE_NCURSES= yes 115USE_NCURSES= yes
84. include "../../devel/ncurses/buildlink3.mk" 116. include "../../devel/ncurses/buildlink3.mk"
85BUILDLINK_PREFIX.curses?= ${BUILDLINK_PREFIX.ncurses} 117BUILDLINK_PREFIX.curses?= ${BUILDLINK_PREFIX.ncurses}
86BUILDLINK_LIBNAME.curses?= ${BUILDLINK_LIBNAME.ncurses} 118BUILDLINK_LIBNAME.curses?= ${BUILDLINK_LIBNAME.ncurses}
87BUILDLINK_LDADD.curses?= ${BUILDLINK_LDADD.ncurses} 119BUILDLINK_LDADD.curses?= ${BUILDLINK_LDADD.ncurses}
 120.elif ${CURSES_TYPE} == "ncursesw"
 121. include "../../devel/ncursesw/buildlink3.mk"
 122BUILDLINK_PREFIX.curses?= ${BUILDLINK_PREFIX.ncursesw}
 123BUILDLINK_LIBNAME.curses?= ${BUILDLINK_LIBNAME.ncursesw}
 124BUILDLINK_LDADD.curses?= ${BUILDLINK_LDADD.ncursesw}
88.elif ${CURSES_TYPE} == "pdcurses" 125.elif ${CURSES_TYPE} == "pdcurses"
89. include "../../devel/pdcurses/buildlink3.mk" 126. include "../../devel/pdcurses/buildlink3.mk"
90BUILDLINK_PREFIX.curses?= ${BUILDLINK_PREFIX.pdcurses} 127BUILDLINK_PREFIX.curses?= ${BUILDLINK_PREFIX.pdcurses}
91BUILDLINK_LIBNAME.curses?= ${BUILDLINK_LIBNAME.pdcurses} 128BUILDLINK_LIBNAME.curses?= ${BUILDLINK_LIBNAME.pdcurses}
92BUILDLINK_LDADD.curses?= ${BUILDLINK_LDADD.pdcurses} 129BUILDLINK_LDADD.curses?= ${BUILDLINK_LDADD.pdcurses}
93.endif 130.endif

cvs diff -r1.7 -r1.8 pkgsrc/mk/curses.builtin.mk (expand / switch to unified diff)

--- pkgsrc/mk/curses.builtin.mk 2013/11/23 09:10:14 1.7
+++ pkgsrc/mk/curses.builtin.mk 2014/03/09 10:15:32 1.8
@@ -1,21 +1,49 @@ @@ -1,21 +1,49 @@
1# $NetBSD: curses.builtin.mk,v 1.7 2013/11/23 09:10:14 obache Exp $ 1# $NetBSD: curses.builtin.mk,v 1.8 2014/03/09 10:15:32 roy Exp $
2 2
3BUILTIN_PKG:= curses 3BUILTIN_PKG:= curses
4 4
5BUILTIN_FIND_LIBS:= curses 5BUILTIN_FIND_LIBS:= curses
6BUILTIN_FIND_HEADERS_VAR:= H_CURSES 6BUILTIN_FIND_HEADERS_VAR:= H_CURSES
7BUILTIN_FIND_HEADERS.H_CURSES= curses.h 7BUILTIN_FIND_HEADERS.H_CURSES= curses.h
8 8
 9BUILTIN_FIND_FILES_VAR+= H_CURSES_HALFDELAY
 10BUILTIN_FIND_FILES.H_CURSES_HALFDELAY= ${BUILTIN_FIND_FILES.H_CURSES}
 11BUILTIN_FIND_GREP.H_CURSES_HALFDELAY= halfdelay
 12
 13BUILTIN_FIND_FILES_VAR+= H_CURSES_RESIZETERM
 14BUILTIN_FIND_FILES.H_CURSES_RESIZETERM= ${BUILTIN_FIND_FILES.H_CURSES}
 15BUILTIN_FIND_GREP.H_CURSES_RESIZETERM= resizeterm
 16
 17BUILTIN_FIND_FILES_VAR+= H_CURSES_PUTWIN
 18BUILTIN_FIND_FILES.H_CURSES_PUTWIN= ${BUILTIN_FIND_FILES.H_CURSES}
 19BUILTIN_FIND_GREP.H_CURSES_PUTWIN= putwin
 20
 21BUILTIN_FIND_FILES_VAR+= H_CURSES_WA_NORMAL
 22BUILTIN_FIND_FILES.H_CURSES_WA_NORMAL= ${BUILTIN_FIND_FILES.H_CURSES}
 23BUILTIN_FIND_GREP.H_CURSES_WA_NORMAL= WA_NORMAL
 24
 25BUILTIN_FIND_FILES_VAR+= H_CURSES_WGETNSTR
 26BUILTIN_FIND_FILES.H_CURSES_WGETNSTR= ${BUILTIN_FIND_FILES.H_CURSES}
 27BUILTIN_FIND_GREP.H_CURSES_WGETNSTR= wgetnstr
 28
 29BUILTIN_FIND_FILES_VAR+= H_CURSES_WSYNCUP
 30BUILTIN_FIND_FILES.H_CURSES_WSYNCUP= ${BUILTIN_FIND_FILES.H_CURSES}
 31BUILTIN_FIND_GREP.H_CURSES_WSYNCUP= wsyncup
 32
 33BUILTIN_FIND_FILES_VAR+= H_CURSES_MVWCHGAT
 34BUILTIN_FIND_FILES.H_CURSES_MVWCHGAT= ${BUILTIN_FIND_FILES.H_CURSES}
 35BUILTIN_FIND_GREP.H_CURSES_MVWCHGAT= mvwchgat
 36
9.include "buildlink3/bsd.builtin.mk" 37.include "buildlink3/bsd.builtin.mk"
10 38
11### 39###
12### Determine if there is a built-in implementation of the package and 40### Determine if there is a built-in implementation of the package and
13### set IS_BUILTIN.<pkg> appropriately ("yes" or "no"). 41### set IS_BUILTIN.<pkg> appropriately ("yes" or "no").
14### 42###
15.if !defined(IS_BUILTIN.curses) 43.if !defined(IS_BUILTIN.curses)
16IS_BUILTIN.curses= no 44IS_BUILTIN.curses= no
17. if empty(H_CURSES:M${LOCALBASE}/*) && exists(${H_CURSES}) 45. if empty(H_CURSES:M${LOCALBASE}/*) && exists(${H_CURSES})
18IS_BUILTIN.curses= yes 46IS_BUILTIN.curses= yes
19. endif 47. endif
20.endif 48.endif
21MAKEVARS+= IS_BUILTIN.curses 49MAKEVARS+= IS_BUILTIN.curses
@@ -34,35 +62,99 @@ USE_BUILTIN.curses= yes @@ -34,35 +62,99 @@ USE_BUILTIN.curses= yes
34. for _dep_ in ${BUILDLINK_API_DEPENDS.curses} 62. for _dep_ in ${BUILDLINK_API_DEPENDS.curses}
35. if !empty(USE_BUILTIN.curses:M[yY][eE][sS]) 63. if !empty(USE_BUILTIN.curses:M[yY][eE][sS])
36USE_BUILTIN.curses!= \ 64USE_BUILTIN.curses!= \
37 if ${PKG_ADMIN} pmatch ${_dep_:Q} ${BUILTIN_PKG.curses:Q}; then \ 65 if ${PKG_ADMIN} pmatch ${_dep_:Q} ${BUILTIN_PKG.curses:Q}; then \
38 ${ECHO} yes; \ 66 ${ECHO} yes; \
39 else \ 67 else \
40 ${ECHO} no; \ 68 ${ECHO} no; \
41 fi 69 fi
42. endif 70. endif
43. endfor 71. endfor
44. endif 72. endif
45. endif # PREFER.curses 73. endif # PREFER.curses
46.endif 74.endif
 75
 76# If it is set to chgat, a curses implementation with chgat(3) support
 77# is considered good enough.
 78.if defined(USE_CURSES) && empty(USE_CURSES:M[yY][eE][sS])
 79. if !empty(USE_CURSES:Mchgat) && !empty(H_CURSES_MVWCHGAT:M__nonexistent__)
 80USE_BUILTIN.curses= no
 81. endif
 82# same for halfdelay(3)
 83. if !empty(USE_CURSES:Mhalfdelay)
 84. if !empty(H_CURSES_HALFDELAY:M__nonexistent__)
 85USE_BUILTIN.curses= no
 86. endif
 87. endif
 88## same for putwin(3)
 89. if !empty(USE_CURSES:Mputwin) && !empty(H_CURSES_PUTWIN:M__nonexistent__)
 90USE_BUILTIN.curses= no
 91. endif
 92# same for resizeterm(3)
 93. if !empty(USE_CURSES:Mresizeterm)
 94. if !empty(H_CURSES_RESIZETERM:M__nonexistent__)
 95USE_BUILTIN.curses= no
 96. endif
 97. endif
 98## same for WA_NORMAL
 99. if !empty(USE_CURSES:MWA_NORMAL)
 100. if !empty(H_CURSES_WA_NORMAL:M__nonexistent__)
 101USE_BUILTIN.curses= no
 102. endif
 103. endif
 104## same for wgetnstr(3)
 105. if !empty(USE_CURSES:Mwgetnstr) && !empty(H_CURSES_WGETNSTR:M__nonexistent__)
 106USE_BUILTIN.curses= no
 107. endif
 108# same for wsyncup(3)
 109. if !empty(USE_CURSES:Mwsyncup) && !empty(H_CURSES_WSYNCUP:M__nonexistent__)
 110USE_BUILTIN.curses= no
 111. endif
 112# AFAIK there is no way of working out if a system curses library has wide
 113# character support. So be safe and say no unless we know for sure.
 114. if !empty(USE_CURSES:Mwide)
 115. if ${OPSYS} == "NetBSD"
 116. if !empty(MACHINE_PLATFORM:MNetBSD-[0-4].*-*)
 117USE_BUILTIN.curses= no
 118. endif
 119. else
 120USE_BUILTIN.curses= no
 121. endif
 122. endif
 123.endif
 124
 125# Even if the package requested tests above pass,
 126# some system curses just are not good enough.
 127# If your system is one, add it here so a suitable
 128# curses from pkgsrc can be installed.
 129_INCOMPAT_CURSES?= NetBSD-0.*-* NetBSD-1.[0123]*-* \
 130 NetBSD-1.4.*-* NetBSD-1.4[A-X]-*
 131.for _pattern_ in ${_INCOMPAT_CURSES} ${INCOMPAT_CURSES}
 132. if !empty(MACHINE_PLATFORM:M${_pattern_})
 133USE_BUILTIN.curses= no
 134. endif
 135.endfor
 136
47MAKEVARS+= USE_BUILTIN.curses 137MAKEVARS+= USE_BUILTIN.curses
48 138
49# Define BUILTIN_LIBNAME.curses to be the base name of the built-in 139# Define BUILTIN_LIBNAME.curses to be the base name of the built-in
50# curses library. 140# curses library.
51# 141#
52.if !empty(BUILTIN_LIB_FOUND.curses:M[yY][eE][sS]) 142.if !empty(BUILTIN_LIB_FOUND.curses:M[yY][eE][sS])
53BUILTIN_LIBNAME.curses= curses 143BUILTIN_LIBNAME.curses= curses
54.endif 144.endif
55 145
 146BUILTIN_LIBNAME.curses= curses
 147
56### 148###
57### The section below only applies if we are not including this file 149### The section below only applies if we are not including this file
58### solely to determine whether a built-in implementation exists. 150### solely to determine whether a built-in implementation exists.
59### 151###
60CHECK_BUILTIN.curses?= no 152CHECK_BUILTIN.curses?= no
61.if !empty(CHECK_BUILTIN.curses:M[nN][oO]) 153.if !empty(CHECK_BUILTIN.curses:M[nN][oO])
62 154
63. if !empty(USE_BUILTIN.curses:M[yY][eE][sS]) 155. if !empty(USE_BUILTIN.curses:M[yY][eE][sS])
64. if exists(${H_CURSES}) 156. if exists(${H_CURSES})
65BUILDLINK_INCDIRS.curses?= ${H_CURSES:H:S/^${BUILDLINK_PREFIX.curses}\///} 157BUILDLINK_INCDIRS.curses?= ${H_CURSES:H:S/^${BUILDLINK_PREFIX.curses}\///}
66. endif 158. endif
67BUILDLINK_LIBNAME.curses= ${BUILTIN_LIBNAME.curses} 159BUILDLINK_LIBNAME.curses= ${BUILTIN_LIBNAME.curses}
68. endif 160. endif

cvs diff -r1.4 -r1.5 pkgsrc/mk/terminfo.buildlink3.mk (expand / switch to unified diff)

--- pkgsrc/mk/terminfo.buildlink3.mk 2013/11/19 11:43:19 1.4
+++ pkgsrc/mk/terminfo.buildlink3.mk 2014/03/09 10:15:32 1.5
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: terminfo.buildlink3.mk,v 1.4 2013/11/19 11:43:19 obache Exp $ 1# $NetBSD: terminfo.buildlink3.mk,v 1.5 2014/03/09 10:15:32 roy Exp $
2# 2#
3# This Makefile fragment is meant to be included by packages that require 3# This Makefile fragment is meant to be included by packages that require
4# any terminfo implementation instead of one particular one. The available 4# any terminfo implementation instead of one particular one. The available
5# terminfo implementations are "terminfo" if built-in, "ncurses", and 5# terminfo implementations are "terminfo" if built-in, "ncurses", and
6# "pdcurses". 6# "pdcurses".
7# 7#
8# If a package genuinely requires ncurses or pdcurses, then it should 8# If a package genuinely requires ncurses or pdcurses, then it should
9# directly include the appropriate buildlink3.mk instead of this file in 9# directly include the appropriate buildlink3.mk instead of this file in
10# the package Makefile. 10# the package Makefile.
11# 11#
12# === User-settable variables === 12# === User-settable variables ===
13# 13#
14# TERMINFO_DEFAULT 14# TERMINFO_DEFAULT
@@ -23,27 +23,27 @@ @@ -23,27 +23,27 @@
23# 23#
24# TERMINFO_TYPE 24# TERMINFO_TYPE
25# The name of the selected terminfo implementation. 25# The name of the selected terminfo implementation.
26 26
27TERMINFO_BUILDLINK3_MK:= ${TERMINFO_BUILDLINK3_MK}+ 27TERMINFO_BUILDLINK3_MK:= ${TERMINFO_BUILDLINK3_MK}+
28.include "bsd.fast.prefs.mk" 28.include "bsd.fast.prefs.mk"
29 29
30.if !empty(TERMINFO_BUILDLINK3_MK:M+) 30.if !empty(TERMINFO_BUILDLINK3_MK:M+)
31 31
32# _TERMINFO_PKGS is an exhaustive list of all of the terminfo implementations 32# _TERMINFO_PKGS is an exhaustive list of all of the terminfo implementations
33# that may be used with terminfo.buildlink3.mk. 33# that may be used with terminfo.buildlink3.mk.
34# 34#
35_TERMINFO_PKGS?= terminfo ncurses pdcurses 35_TERMINFO_PKGS?= terminfo ncurses pdcurses
36_TERMINFO_TYPES?= terminfo tinfo 36_TERMINFO_TYPES?= terminfo tinfo curses ncurses
37 37
38CHECK_BUILTIN.terminfo:= yes 38CHECK_BUILTIN.terminfo:= yes
39. include "terminfo.builtin.mk" 39. include "terminfo.builtin.mk"
40CHECK_BUILTIN.terminfo:= no 40CHECK_BUILTIN.terminfo:= no
41 41
42# Set the value of TERMINFO_DEFAULT depending on the platform and what's 42# Set the value of TERMINFO_DEFAULT depending on the platform and what's
43# available in the base system. 43# available in the base system.
44# 44#
45.if defined(USE_BUILTIN.terminfo) && !empty(USE_BUILTIN.terminfo:M[yY][eE][sS]) 45.if defined(USE_BUILTIN.terminfo) && !empty(USE_BUILTIN.terminfo:M[yY][eE][sS])
46TERMINFO_DEFAULT?= terminfo 46TERMINFO_DEFAULT?= terminfo
47.else 47.else
48TERMINFO_DEFAULT?= ncurses 48TERMINFO_DEFAULT?= ncurses
49.endif 49.endif
@@ -63,27 +63,28 @@ TERMINFO_TYPE= none @@ -63,27 +63,28 @@ TERMINFO_TYPE= none
63. endif 63. endif
64 64
65BUILD_DEFS+= TERMINFO_DEFAULT 65BUILD_DEFS+= TERMINFO_DEFAULT
66BUILD_DEFS_EFFECTS+= TERMINFO_TYPE 66BUILD_DEFS_EFFECTS+= TERMINFO_TYPE
67 67
68# Most GNU configure scripts will try finding every terminfo implementation, 68# Most GNU configure scripts will try finding every terminfo implementation,
69# so prevent them from finding any except for the one we decide upon. 69# so prevent them from finding any except for the one we decide upon.
70# 70#
71# There is special handling for packages that can be provided by pkgsrc, 71# There is special handling for packages that can be provided by pkgsrc,
72# e.g. curses -- see terminfo.builtin.mk for details. 72# e.g. curses -- see terminfo.builtin.mk for details.
73# 73#
74.if empty(TERMINFO_TYPE:Mnone) 74.if empty(TERMINFO_TYPE:Mnone)
75. for _tcap_ in ${_TERMINFO_TYPES} 75. for _tcap_ in ${_TERMINFO_TYPES}
76. if empty(TERMINFO_TYPE:M${_tcap_}) 76. if empty(TERMINFO_TYPE:M${_tcap_}) \
 77 && (!defined(CURSES_TYPE) || empty(CURSES_TYPE:M${_tcap_}))
77BUILDLINK_TRANSFORM+= l:${_tcap_}:${BUILDLINK_LIBNAME.terminfo} 78BUILDLINK_TRANSFORM+= l:${_tcap_}:${BUILDLINK_LIBNAME.terminfo}
78. endif 79. endif
79. endfor 80. endfor
80.endif 81.endif
81 82
82.endif # TERMINFO_BUILDLINK3_MK 83.endif # TERMINFO_BUILDLINK3_MK
83 84
84.if ${TERMINFO_TYPE} == "none" 85.if ${TERMINFO_TYPE} == "none"
85PKG_FAIL_REASON= \ 86PKG_FAIL_REASON= \
86 "${_TERMINFO_TYPE} is not an acceptable terminfo type for ${PKGNAME}." 87 "${_TERMINFO_TYPE} is not an acceptable terminfo type for ${PKGNAME}."
87.elif ${TERMINFO_TYPE} == "terminfo" 88.elif ${TERMINFO_TYPE} == "terminfo"
88BUILDLINK_TREE+= terminfo -terminfo 89BUILDLINK_TREE+= terminfo -terminfo
89BUILDLINK_LIBNAME.terminfo?= ${BUILTIN_LIBNAME.terminfo} 90BUILDLINK_LIBNAME.terminfo?= ${BUILTIN_LIBNAME.terminfo}