1 # $NetBSD: curses.buildlink3.mk,v 1.12 2008/02/29 16:29:04 jlam Exp $
3 # This Makefile fragment is meant to be included by packages that require
4 # any curses implementation instead of one particular one. The available
5 # curses implementations are "curses" if built-in, "ncurses", and
8 # If a package genuinely requires ncurses or pdcurses, then it should
9 # directly include the appropriate buildlink3.mk instead of this file in
10 # the package Makefile.
12 # === User-settable variables ===
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
17 # implementation is fine.
19 # Possible: curses, ncurses, pdcurses
22 # === Variables set by this file ===
25 # The name of the selected curses implementation.
27 CURSES_BUILDLINK3_MK:= ${CURSES_BUILDLINK3_MK}+
29 .include "bsd.fast.prefs.mk"
31 .if !empty(CURSES_BUILDLINK3_MK:M+)
33 # _CURSES_PKGS is an exhaustive list of all of the curses implementations
34 # that may be used with curses.buildlink3.mk.
36 _CURSES_PKGS?= curses ncurses pdcurses
38 CHECK_BUILTIN.curses:= yes
39 . include "curses.builtin.mk"
40 CHECK_BUILTIN.curses:= no
42 # Set the value of CURSES_DEFAULT depending on the platform and what's
43 # available in the base system.
45 .if defined(USE_BUILTIN.curses) && !empty(USE_BUILTIN.curses:M[yY][eE][sS])
46 CURSES_DEFAULT?= curses
48 CURSES_DEFAULT?= ncurses
51 _CURSES_ACCEPTED= # empty
52 .if defined(USE_BUILTIN.curses) && !empty(USE_BUILTIN.curses:M[yY][eE][sS])
53 _CURSES_ACCEPTED+= curses # system curses exists
55 _CURSES_ACCEPTED+= ncurses # pkgsrc ncurses
56 _CURSES_ACCEPTED+= pdcurses # pkgsrc pdcurses
58 _CURSES_TYPE= ${CURSES_DEFAULT}
59 . if !empty(_CURSES_ACCEPTED:M${_CURSES_TYPE})
60 CURSES_TYPE= ${_CURSES_TYPE}
65 BUILD_DEFS+= CURSES_DEFAULT
66 BUILD_DEFS_EFFECTS+= CURSES_TYPE
68 # _PKG_USE_CURSES is a flag for use by the curses packages' buildlink3.mk
69 # files to indicate that the headers and libraries should be usable as
70 # <curses.h> and -lcurses.
74 .endif # CURSES_BUILDLINK3_MK
76 .if ${CURSES_TYPE} == "none"
78 "${_CURSES_TYPE} is not an acceptable curses type for ${PKGNAME}."
79 .elif ${CURSES_TYPE} == "curses"
80 BUILDLINK_PACKAGES:= ${BUILDLINK_PACKAGES:Ncurses}
81 BUILDLINK_PACKAGES+= curses
82 BUILDLINK_ORDER:= ${BUILDLINK_ORDER} ${BUILDLINK_DEPTH}curses
83 BUILDLINK_LDADD.curses?= ${BUILDLINK_LIBNAME.curses:S/^/-l/:S/^-l$//}
84 BUILDLINK_BUILTIN_MK.curses= ../../mk/curses.builtin.mk
85 .elif ${CURSES_TYPE} == "ncurses"
87 . include "../../devel/ncurses/buildlink3.mk"
88 BUILDLINK_PREFIX.curses?= ${BUILDLINK_PREFIX.ncurses}
89 BUILDLINK_LIBNAME.curses?= ${BUILDLINK_LIBNAME.ncurses}
90 BUILDLINK_LDADD.curses?= ${BUILDLINK_LDADD.ncurses}
91 .elif ${CURSES_TYPE} == "pdcurses"
92 . include "../../devel/pdcurses/buildlink3.mk"
93 BUILDLINK_PREFIX.curses?= ${BUILDLINK_PREFIX.pdcurses}
94 BUILDLINK_LIBNAME.curses?= ${BUILDLINK_LIBNAME.pdcurses}
95 BUILDLINK_LDADD.curses?= ${BUILDLINK_LDADD.pdcurses}