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