blob: f93e4f3f19a5a4a0eb2e7103f6803e313cec1896 (
plain)
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
|
# $NetBSD: termcap.builtin.mk,v 1.3 2008/03/05 07:10:26 jlam Exp $
BUILTIN_PKG:= termcap
# _TERMCAP_TYPES is an exhaustive list of all of the termcap implementations
# that may be found.
#
_TERMCAP_TYPES?= curses termcap termlib tinfo
BUILTIN_FIND_LIBS:= ${_TERMCAP_TYPES}
.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.termcap)
IS_BUILTIN.termcap= no
. if !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])
IS_BUILTIN.termcap= yes
. endif
.endif
MAKEVARS+= IS_BUILTIN.termcap
###
### 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.termcap)
. if ${PREFER.termcap} == "pkgsrc"
USE_BUILTIN.termcap= no
. else
USE_BUILTIN.termcap= ${IS_BUILTIN.termcap}
. endif # PREFER.termcap
.endif
MAKEVARS+= USE_BUILTIN.termcap
# Define BUILTIN_LIBNAME.termcap to be the base name of the built-in
# termcap library.
#
# XXX This needs to be more sophisticated. We will want to do what
# XXX most packages do: test for tgetent() in the following libraries
# XXX in order: c, curses, termcap, termlib. Since we can't test for
# XXX symbols in libraries, we'll need to be clever with looking at
# XXX headers.
#
.if !empty(BUILTIN_LIB_FOUND.termcap:M[yY][eE][sS])
BUILTIN_LIBNAME.termcap= termcap
.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
.elif !empty(BUILTIN_LIB_FOUND.termlib:M[yY][eE][sS])
BUILTIN_LIBNAME.termcap= termlib
.endif
.if !empty(USE_BUILTIN.termcap:M[yY][eE][sS])
. if defined(BUILTIN_LIBNAME.termcap)
TERMCAP_TYPE= ${BUILTIN_LIBNAME.termcap}
. else
TERMCAP_TYPE= none
. endif
.else
TERMCAP_TYPE= curses # pkgsrc termcap is curses
.endif
BUILD_DEFS+= TERMCAP_TYPE
###
### The section below only applies if we are not including this file
### solely to determine whether a built-in implementation exists.
###
CHECK_BUILTIN.termcap?= no
.if !empty(CHECK_BUILTIN.termcap:M[nN][oO])
. if !empty(USE_BUILTIN.termcap:M[yY][eE][sS])
BUILDLINK_LIBNAME.termcap= ${BUILTIN_LIBNAME.termcap}
. endif
# Most GNU configure scripts will try finding every termcap implementation,
# so prevent them from finding any except for the one we decide upon.
#
# There is special handling here for packages that can be provided by
# pkgsrc, e.g. curses. In case we need both that package as well as
# termcap, we must not remove the -l options for that package's libraries.
#
. for _tcap_ in ${_TERMCAP_TYPES:Ntermcap:Ncurses}
. if empty(TERMCAP_TYPE:M${_tcap_})
BUILDLINK_TRANSFORM+= rm:-l${_tcap_}
. endif
. endfor
. if empty(TERMCAP_TYPE:Mcurses) && \
empty(BUILDLINK_PACKAGES:Mcurses) && empty(BUILDLINK_PACKAGES:Mncurses)
BUILDLINK_TRANSFORM+= rm:-lcurses
BUILDLINK_TRANSFORM+= rm:-lncurses
. endif
BUILDLINK_TRANSFORM+= l:termcap:${BUILDLINK_LIBNAME.termcap}
.endif # CHECK_BUILTIN.termcap
|