1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
|
# $NetBSD: builtin.mk,v 1.16 2008/02/26 17:21:13 jlam Exp $
BUILTIN_PKG:= ncurses
BUILTIN_FIND_LIBS:= ncurses curses
BUILTIN_FIND_FILES_VAR:= H_NCURSES
BUILTIN_FIND_FILES.H_NCURSES= /usr/include/ncurses.h /usr/include/curses.h
BUILTIN_FIND_GREP.H_NCURSES= \#define[ ]*NCURSES_VERSION
.include "../../mk/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.ncurses)
IS_BUILTIN.ncurses= no
. if empty(H_NCURSES:M__nonexistent__) && \
empty(H_NCURSES:M${LOCALBASE}/*) && \
(!empty(BUILTIN_LIB_FOUND.ncurses:M[yY][eE][sS]) || \
!empty(BUILTIN_LIB_FOUND.curses:M[yY][eE][sS]))
IS_BUILTIN.ncurses= yes
. endif
.endif
MAKEVARS+= IS_BUILTIN.ncurses
###
### If there is a built-in implementation, then set BUILTIN_PKG.<pkg> to
### a package name to represent the built-in package.
###
.if !defined(BUILTIN_PKG.ncurses) && \
!empty(IS_BUILTIN.ncurses:M[yY][eE][sS]) && \
empty(H_NCURSES:M__nonexistent__)
BUILTIN_VERSION.ncurses!= \
${AWK} '/\#define[ ]*NCURSES_VERSION[ ]/ { \
vers = $$3; \
gsub("\"", "", vers); \
print vers; \
} \
' ${H_NCURSES:Q}
BUILTIN_PKG.ncurses= ncurses-${BUILTIN_VERSION.ncurses}
.endif
MAKEVARS+= BUILTIN_PKG.ncurses
###
### 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.ncurses)
. if ${PREFER.ncurses} == "pkgsrc"
USE_BUILTIN.ncurses= no
. else
USE_BUILTIN.ncurses= ${IS_BUILTIN.ncurses}
. if defined(BUILTIN_PKG.ncurses) && \
!empty(IS_BUILTIN.ncurses:M[yY][eE][sS])
USE_BUILTIN.ncurses= yes
. for _dep_ in ${BUILDLINK_API_DEPENDS.ncurses}
. if !empty(USE_BUILTIN.ncurses:M[yY][eE][sS])
USE_BUILTIN.ncurses!= \
if ${PKG_ADMIN} pmatch ${_dep_:Q} ${BUILTIN_PKG.ncurses:Q}; then \
${ECHO} yes; \
else \
${ECHO} no; \
fi
. endif
. endfor
. endif
# XXX
# XXX By default, assume that the native curses on NetBSD systems is
# XXX good enough to replace ncurses. In reality, no version of NetBSD
# XXX has a curses library that can completely replace ncurses; however,
# XXX some versions implement enough of ncurses that some packages are
# XXX happy.
# XXX
. if ${OPSYS} == "NetBSD"
USE_BUILTIN.ncurses= yes
H_NCURSES= /usr/include/curses.h
. endif
#
# Some platforms don't have a curses implementation that can replace
# ncurses.
#
_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.ncurses= no
. endif
. endfor
. endif # PREFER.ncurses
.endif
MAKEVARS+= USE_BUILTIN.ncurses
# If USE_NCURSES is defined, then force the use of an ncurses
# implementation.
#
.if defined(USE_NCURSES)
. if !empty(IS_BUILTIN.ncurses:M[nN][oO])
USE_BUILTIN.ncurses= no
. 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.ncurses?= no
.if !empty(CHECK_BUILTIN.ncurses:M[nN][oO])
BUILDLINK_LDADD.ncurses= -lncurses
. if !empty(USE_BUILTIN.ncurses:M[yY][eE][sS])
. if !empty(BUILTIN_LIB_FOUND.ncurses:M[nN][oO]) && \
!empty(BUILTIN_LIB_FOUND.curses:M[yY][eE][sS])
BUILDLINK_LDADD.ncurses= -lcurses
BUILDLINK_TRANSFORM+= l:ncurses:curses
. endif
#
# On Interix, there is a libncurses.a and a libcurses.so but strangely,
# no libncurses.so. We want to link against the shared library, so
# turn "-lncurses" into "-lcurses".
#
. if (${OPSYS} == "Interix") && \
!empty(BUILTIN_LIB_FOUND.curses:M[yY][eE][sS])
BUILDLINK_LDADD.ncurses= -lcurses
BUILDLINK_TRANSFORM+= l:ncurses:curses
. endif
BUILDLINK_TARGETS+= buildlink-curses-ncurses-h
BUILDLINK_TARGETS+= buildlink-ncurses-extra-includes
. endif
# A full ncurses implementation provides more headers than some curses
# implementations. Touch empty replacements for those headers so that
# packages can continue to use the familiar ncurses header names.
#
. if !target(buildlink-ncurses-extra-includes)
.PHONY: buildlink-ncurses-extra-includes
buildlink-ncurses-extra-includes:
${RUN} \
extra_includes="include/term.h"; \
for f in $$extra_includes; do \
src=${BUILDLINK_PREFIX.ncurses:Q}"/$$f"; \
dest=${BUILDLINK_DIR:Q}"/$$f"; \
if ${TEST} ! -f "$$src"; then \
${ECHO_BUILDLINK_MSG} "Touching extra ncurses header ($$f)"; \
${MKDIR} `${DIRNAME} "$$dest"`; \
${TOUCH} ${TOUCH_FLAGS} "$$dest"; \
fi; \
done
. endif
. if !target(buildlink-curses-ncurses-h)
.PHONY: buildlink-curses-ncurses-h
buildlink-curses-ncurses-h:
${RUN} \
src=${H_NCURSES:Q}; \
dest=${BUILDLINK_DIR:Q}"/include/ncurses.h"; \
if ${TEST} ! -f "$$dest" -a -f "$$src"; then \
fname=`${BASENAME} $$src`; \
${ECHO_BUILDLINK_MSG} "Linking $$fname -> ncurses.h."; \
${MKDIR} `${DIRNAME} "$$dest"`; \
${LN} -s "$$src" "$$dest"; \
fi
. endif
.endif # CHECK_BUILTIN.ncurses
|