diff options
author | roy <roy@pkgsrc.org> | 2014-03-09 10:15:32 +0000 |
---|---|---|
committer | roy <roy@pkgsrc.org> | 2014-03-09 10:15:32 +0000 |
commit | 38c96b5911e44f0f75b60cf78c2347be8bc8f260 (patch) | |
tree | 1f7e1db47953c8541d4e66b25932aae0a6c078ac /mk | |
parent | c9d6ceee46b7e2c5c9d10e9fce8a93dddc8b289f (diff) | |
download | pkgsrc-38c96b5911e44f0f75b60cf78c2347be8bc8f260.tar.gz |
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.
Diffstat (limited to 'mk')
-rw-r--r-- | mk/curses.buildlink3.mk | 45 | ||||
-rw-r--r-- | mk/curses.builtin.mk | 94 | ||||
-rw-r--r-- | mk/terminfo.buildlink3.mk | 7 |
3 files changed, 138 insertions, 8 deletions
diff --git a/mk/curses.buildlink3.mk b/mk/curses.buildlink3.mk index 0d268356869..f15ef1fec1e 100644 --- a/mk/curses.buildlink3.mk +++ b/mk/curses.buildlink3.mk @@ -1,4 +1,4 @@ -# $NetBSD: curses.buildlink3.mk,v 1.17 2010/02/07 10:28:13 roy Exp $ +# $NetBSD: curses.buildlink3.mk,v 1.18 2014/03/09 10:15:32 roy Exp $ # # This Makefile fragment is meant to be included by packages that require # any curses implementation instead of one particular one. The available @@ -16,7 +16,7 @@ # system. Setting this to "curses" means that the system curses # implementation is fine. # -# Possible: curses, ncurses, pdcurses +# Possible: curses, ncurses, ncursesw, pdcurses # Default: (depends) # # === Variables set by this file === @@ -29,10 +29,14 @@ CURSES_BUILDLINK3_MK:= ${CURSES_BUILDLINK3_MK}+ .if !empty(CURSES_BUILDLINK3_MK:M+) +.if !defined(USE_CURSES) && !empty(PKG_OPTIONS:Mwide-curses) +USE_CURSES?= wide +.endif + # _CURSES_PKGS is an exhaustive list of all of the curses implementations # that may be used with curses.buildlink3.mk. # -_CURSES_PKGS?= curses ncurses pdcurses +_CURSES_PKGS?= curses ncurses ncursesw pdcurses CHECK_BUILTIN.curses:= yes . include "curses.builtin.mk" @@ -43,6 +47,8 @@ CHECK_BUILTIN.curses:= no # .if defined(USE_BUILTIN.curses) && !empty(USE_BUILTIN.curses:M[yY][eE][sS]) CURSES_DEFAULT?= curses +.elif !empty(USE_CURSES:Mwide) || !empty(PKG_OPTIONS:Mwide-curses) +CURSES_DEFAULT?= ncursesw .else CURSES_DEFAULT?= ncurses .endif @@ -51,7 +57,11 @@ _CURSES_ACCEPTED= # empty .if defined(USE_BUILTIN.curses) && !empty(USE_BUILTIN.curses:M[yY][eE][sS]) _CURSES_ACCEPTED+= curses # system curses exists .endif +.if defined(USE_BUILTIN.cursesw) && !empty(USE_BUILTIN.cursesw:M[yY][eE][sS]) +_CURSES_ACCEPTED+= curses # system curses exists +.endif _CURSES_ACCEPTED+= ncurses # pkgsrc ncurses +_CURSES_ACCEPTED+= ncursesw # pkgsrc ncursesw _CURSES_ACCEPTED+= pdcurses # pkgsrc pdcurses _CURSES_TYPE= ${CURSES_DEFAULT} @@ -70,21 +80,48 @@ BUILD_DEFS_EFFECTS+= CURSES_TYPE # _PKG_USE_CURSES= yes +.PHONY: buildlink-curses-ncurses-h +buildlink-curses-ncurses-h: + ${RUN} \ + src="${H_CURSES}"; \ + dest=${BUILDLINK_DIR}"/include/ncurses.h"; \ + if ${TEST} ! -f "$$dest" -a -f "$$src"; then \ + ${ECHO_BUILDLINK_MSG} "Linking ${H_CURSES} -> ncurses.h.";\ + ${MKDIR} `${DIRNAME} "$$dest"`; \ + ${LN} -s "$$src" "$$dest"; \ + fi + + .endif # CURSES_BUILDLINK3_MK .if ${CURSES_TYPE} == "none" PKG_FAIL_REASON= \ "${_CURSES_TYPE} is not an acceptable curses type for ${PKGNAME}." .elif ${CURSES_TYPE} == "curses" +. include "curses.builtin.mk" BUILDLINK_TREE+= curses -curses BUILDLINK_LDADD.curses?= ${BUILDLINK_LIBNAME.curses:S/^/-l/:S/^-l$//} -BUILDLINK_BUILTIN_MK.curses= ../../mk/curses.builtin.mk +BUSILDLINK_BUILTIN_MK.curses= ../../mk/curses.builtin.mk +# Some packages only look for ncurses +# The correct action would be to write a patch and pass it upstream +# but by setting FAKE_NCURSES=yes in the package we can temporarily work +# around the short-coming. +. if !empty(FAKE_NCURSES:M[yY][eE][sS]) +BUILDLINK_TARGETS+= buildlink-curses-ncurses-h +BUILDLINK_TRANSFORM+= l:ncurses:${BUILDLINK_LIBNAME.curses} +BUILDLINK_TRANSFORM+= l:ncursesw:${BUILDLINK_LIBNAME.curses} +. endif .elif ${CURSES_TYPE} == "ncurses" USE_NCURSES= yes . include "../../devel/ncurses/buildlink3.mk" BUILDLINK_PREFIX.curses?= ${BUILDLINK_PREFIX.ncurses} BUILDLINK_LIBNAME.curses?= ${BUILDLINK_LIBNAME.ncurses} BUILDLINK_LDADD.curses?= ${BUILDLINK_LDADD.ncurses} +.elif ${CURSES_TYPE} == "ncursesw" +. include "../../devel/ncursesw/buildlink3.mk" +BUILDLINK_PREFIX.curses?= ${BUILDLINK_PREFIX.ncursesw} +BUILDLINK_LIBNAME.curses?= ${BUILDLINK_LIBNAME.ncursesw} +BUILDLINK_LDADD.curses?= ${BUILDLINK_LDADD.ncursesw} .elif ${CURSES_TYPE} == "pdcurses" . include "../../devel/pdcurses/buildlink3.mk" BUILDLINK_PREFIX.curses?= ${BUILDLINK_PREFIX.pdcurses} diff --git a/mk/curses.builtin.mk b/mk/curses.builtin.mk index b2bc27c09bc..8cb637af1b7 100644 --- a/mk/curses.builtin.mk +++ b/mk/curses.builtin.mk @@ -1,4 +1,4 @@ -# $NetBSD: curses.builtin.mk,v 1.7 2013/11/23 09:10:14 obache Exp $ +# $NetBSD: curses.builtin.mk,v 1.8 2014/03/09 10:15:32 roy Exp $ BUILTIN_PKG:= curses @@ -6,6 +6,34 @@ BUILTIN_FIND_LIBS:= curses BUILTIN_FIND_HEADERS_VAR:= H_CURSES BUILTIN_FIND_HEADERS.H_CURSES= curses.h +BUILTIN_FIND_FILES_VAR+= H_CURSES_HALFDELAY +BUILTIN_FIND_FILES.H_CURSES_HALFDELAY= ${BUILTIN_FIND_FILES.H_CURSES} +BUILTIN_FIND_GREP.H_CURSES_HALFDELAY= halfdelay + +BUILTIN_FIND_FILES_VAR+= H_CURSES_RESIZETERM +BUILTIN_FIND_FILES.H_CURSES_RESIZETERM= ${BUILTIN_FIND_FILES.H_CURSES} +BUILTIN_FIND_GREP.H_CURSES_RESIZETERM= resizeterm + +BUILTIN_FIND_FILES_VAR+= H_CURSES_PUTWIN +BUILTIN_FIND_FILES.H_CURSES_PUTWIN= ${BUILTIN_FIND_FILES.H_CURSES} +BUILTIN_FIND_GREP.H_CURSES_PUTWIN= putwin + +BUILTIN_FIND_FILES_VAR+= H_CURSES_WA_NORMAL +BUILTIN_FIND_FILES.H_CURSES_WA_NORMAL= ${BUILTIN_FIND_FILES.H_CURSES} +BUILTIN_FIND_GREP.H_CURSES_WA_NORMAL= WA_NORMAL + +BUILTIN_FIND_FILES_VAR+= H_CURSES_WGETNSTR +BUILTIN_FIND_FILES.H_CURSES_WGETNSTR= ${BUILTIN_FIND_FILES.H_CURSES} +BUILTIN_FIND_GREP.H_CURSES_WGETNSTR= wgetnstr + +BUILTIN_FIND_FILES_VAR+= H_CURSES_WSYNCUP +BUILTIN_FIND_FILES.H_CURSES_WSYNCUP= ${BUILTIN_FIND_FILES.H_CURSES} +BUILTIN_FIND_GREP.H_CURSES_WSYNCUP= wsyncup + +BUILTIN_FIND_FILES_VAR+= H_CURSES_MVWCHGAT +BUILTIN_FIND_FILES.H_CURSES_MVWCHGAT= ${BUILTIN_FIND_FILES.H_CURSES} +BUILTIN_FIND_GREP.H_CURSES_MVWCHGAT= mvwchgat + .include "buildlink3/bsd.builtin.mk" ### @@ -44,6 +72,68 @@ USE_BUILTIN.curses!= \ . endif . endif # PREFER.curses .endif + +# If it is set to chgat, a curses implementation with chgat(3) support +# is considered good enough. +.if defined(USE_CURSES) && empty(USE_CURSES:M[yY][eE][sS]) +. if !empty(USE_CURSES:Mchgat) && !empty(H_CURSES_MVWCHGAT:M__nonexistent__) +USE_BUILTIN.curses= no +. endif +# same for halfdelay(3) +. if !empty(USE_CURSES:Mhalfdelay) +. if !empty(H_CURSES_HALFDELAY:M__nonexistent__) +USE_BUILTIN.curses= no +. endif +. endif +## same for putwin(3) +. if !empty(USE_CURSES:Mputwin) && !empty(H_CURSES_PUTWIN:M__nonexistent__) +USE_BUILTIN.curses= no +. endif +# same for resizeterm(3) +. if !empty(USE_CURSES:Mresizeterm) +. if !empty(H_CURSES_RESIZETERM:M__nonexistent__) +USE_BUILTIN.curses= no +. endif +. endif +## same for WA_NORMAL +. if !empty(USE_CURSES:MWA_NORMAL) +. if !empty(H_CURSES_WA_NORMAL:M__nonexistent__) +USE_BUILTIN.curses= no +. endif +. endif +## same for wgetnstr(3) +. if !empty(USE_CURSES:Mwgetnstr) && !empty(H_CURSES_WGETNSTR:M__nonexistent__) +USE_BUILTIN.curses= no +. endif +# same for wsyncup(3) +. if !empty(USE_CURSES:Mwsyncup) && !empty(H_CURSES_WSYNCUP:M__nonexistent__) +USE_BUILTIN.curses= no +. endif +# AFAIK there is no way of working out if a system curses library has wide +# character support. So be safe and say no unless we know for sure. +. if !empty(USE_CURSES:Mwide) +. if ${OPSYS} == "NetBSD" +. if !empty(MACHINE_PLATFORM:MNetBSD-[0-4].*-*) +USE_BUILTIN.curses= no +. endif +. else +USE_BUILTIN.curses= no +. endif +. endif +.endif + +# Even if the package requested tests above pass, +# some system curses just are not good enough. +# If your system is one, add it here so a suitable +# curses from pkgsrc can be installed. +_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.curses= no +. endif +.endfor + MAKEVARS+= USE_BUILTIN.curses # Define BUILTIN_LIBNAME.curses to be the base name of the built-in @@ -53,6 +143,8 @@ MAKEVARS+= USE_BUILTIN.curses BUILTIN_LIBNAME.curses= curses .endif +BUILTIN_LIBNAME.curses= curses + ### ### The section below only applies if we are not including this file ### solely to determine whether a built-in implementation exists. diff --git a/mk/terminfo.buildlink3.mk b/mk/terminfo.buildlink3.mk index d12f86d9960..5b51aa4e910 100644 --- a/mk/terminfo.buildlink3.mk +++ b/mk/terminfo.buildlink3.mk @@ -1,4 +1,4 @@ -# $NetBSD: terminfo.buildlink3.mk,v 1.4 2013/11/19 11:43:19 obache Exp $ +# $NetBSD: terminfo.buildlink3.mk,v 1.5 2014/03/09 10:15:32 roy Exp $ # # This Makefile fragment is meant to be included by packages that require # any terminfo implementation instead of one particular one. The available @@ -33,7 +33,7 @@ TERMINFO_BUILDLINK3_MK:= ${TERMINFO_BUILDLINK3_MK}+ # that may be used with terminfo.buildlink3.mk. # _TERMINFO_PKGS?= terminfo ncurses pdcurses -_TERMINFO_TYPES?= terminfo tinfo +_TERMINFO_TYPES?= terminfo tinfo curses ncurses CHECK_BUILTIN.terminfo:= yes . include "terminfo.builtin.mk" @@ -73,7 +73,8 @@ BUILD_DEFS_EFFECTS+= TERMINFO_TYPE # .if empty(TERMINFO_TYPE:Mnone) . for _tcap_ in ${_TERMINFO_TYPES} -. if empty(TERMINFO_TYPE:M${_tcap_}) +. if empty(TERMINFO_TYPE:M${_tcap_}) \ + && (!defined(CURSES_TYPE) || empty(CURSES_TYPE:M${_tcap_})) BUILDLINK_TRANSFORM+= l:${_tcap_}:${BUILDLINK_LIBNAME.terminfo} . endif . endfor |