diff --git a/devel/ncurses/buildlink3.mk b/devel/ncurses/buildlink3.mk index 0dce2a298a37..0b79c893f24d 100644 --- a/devel/ncurses/buildlink3.mk +++ b/devel/ncurses/buildlink3.mk @@ -1,4 +1,4 @@ -# $NetBSD: buildlink3.mk,v 1.29 2008/02/26 17:21:13 jlam Exp $ +# $NetBSD: buildlink3.mk,v 1.30 2008/02/27 04:47:02 jlam Exp $ BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+ NCURSES_BUILDLINK3_MK:= ${NCURSES_BUILDLINK3_MK}+ @@ -15,13 +15,14 @@ BUILDLINK_ORDER:= ${BUILDLINK_ORDER} ${BUILDLINK_DEPTH}ncurses BUILDLINK_API_DEPENDS.ncurses+= ncurses>=5.3nb1 BUILDLINK_ABI_DEPENDS.ncurses+= ncurses>=5.4nb1 BUILDLINK_PKGSRCDIR.ncurses?= ../../devel/ncurses -BUILDLINK_LDADD.ncurses?= -lncurses +BUILDLINK_LIBNAME.ncurses= ncurses +BUILDLINK_LDADD.ncurses?= -l${BUILDLINK_LIBNAME.ncurses} # Many packages expect the ncurses headers and libraries to be usable as # and -lcurses. # -BUILDLINK_TARGETS+= buildlink-ncurses-curses-h -BUILDLINK_TRANSFORM+= l:curses:ncurses +BUILDLINK_TARGETS+= buildlink-ncurses-curses-h +BUILDLINK_TRANSFORM+= l:curses:${BUILDLINK_LIBNAME.ncurses} .PHONY: buildlink-ncurses-curses-h buildlink-ncurses-curses-h: diff --git a/devel/ncurses/builtin.mk b/devel/ncurses/builtin.mk index e7e6dce54d79..63d23ec0924c 100644 --- a/devel/ncurses/builtin.mk +++ b/devel/ncurses/builtin.mk @@ -1,4 +1,4 @@ -# $NetBSD: builtin.mk,v 1.16 2008/02/26 17:21:13 jlam Exp $ +# $NetBSD: builtin.mk,v 1.17 2008/02/27 04:47:02 jlam Exp $ BUILTIN_PKG:= ncurses @@ -107,12 +107,11 @@ USE_BUILTIN.ncurses= no CHECK_BUILTIN.ncurses?= no .if !empty(CHECK_BUILTIN.ncurses:M[nN][oO]) -BUILDLINK_LDADD.ncurses= -lncurses +BUILDLINK_TRANSFORM+= l:ncurses:${BUILDLINK_LIBNAME.ncurses} . 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 +BUILDLINK_LIBNAME.ncurses= curses . endif # # On Interix, there is a libncurses.a and a libcurses.so but strangely, @@ -121,8 +120,7 @@ BUILDLINK_TRANSFORM+= l:ncurses:curses # . if (${OPSYS} == "Interix") && \ !empty(BUILTIN_LIB_FOUND.curses:M[yY][eE][sS]) -BUILDLINK_LDADD.ncurses= -lcurses -BUILDLINK_TRANSFORM+= l:ncurses:curses +BUILDLINK_LIBNAME.ncurses= curses . endif BUILDLINK_TARGETS+= buildlink-curses-ncurses-h BUILDLINK_TARGETS+= buildlink-ncurses-extra-includes diff --git a/devel/pdcurses/buildlink3.mk b/devel/pdcurses/buildlink3.mk index 84246da4fd62..c5ee527cc76b 100644 --- a/devel/pdcurses/buildlink3.mk +++ b/devel/pdcurses/buildlink3.mk @@ -1,4 +1,4 @@ -# $NetBSD: buildlink3.mk,v 1.2 2008/02/25 04:19:34 jlam Exp $ +# $NetBSD: buildlink3.mk,v 1.3 2008/02/27 04:47:02 jlam Exp $ BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+ PDCURSES_BUILDLINK3_MK:= ${PDCURSES_BUILDLINK3_MK}+ @@ -14,7 +14,8 @@ BUILDLINK_ORDER:= ${BUILDLINK_ORDER} ${BUILDLINK_DEPTH}pdcurses .if !empty(PDCURSES_BUILDLINK3_MK:M+) BUILDLINK_API_DEPENDS.pdcurses+= pdcurses>=3.3 BUILDLINK_PKGSRCDIR.pdcurses?= ../../devel/pdcurses -BUILDLINK_LDADD.pdcurses?= -lXCurses +BUILDLINK_LIBNAME.pdcurses= XCurses +BUILDLINK_LDADD.pdcurses?= -l${BUILDLINK_LIBNAME.pdcurses} # _PKG_USE_CURSES is defined by curses.buildlink3.mk to indicate that # the headers and libraries should be usable as and -lcurses. diff --git a/mk/curses.buildlink3.mk b/mk/curses.buildlink3.mk index 673dc05305a8..84a4c8116ddc 100644 --- a/mk/curses.buildlink3.mk +++ b/mk/curses.buildlink3.mk @@ -1,4 +1,4 @@ -# $NetBSD: curses.buildlink3.mk,v 1.7 2008/02/27 02:26:07 jlam Exp $ +# $NetBSD: curses.buildlink3.mk,v 1.8 2008/02/27 04:47:02 jlam Exp $ # # This Makefile fragment is meant to be included by packages that require # any curses implementation instead of one particular one. The available @@ -91,8 +91,10 @@ BUILDLINK_BUILTIN_MK.curses= ../../mk/curses.builtin.mk .elif ${CURSES_TYPE} == "ncurses" USE_NCURSES= yes . include "../../devel/ncurses/buildlink3.mk" +BUILDLINK_LIBNAME.curses?= ${BUILDLINK_LIBNAME.ncurses} BUILDLINK_LDADD.curses?= ${BUILDLINK_LDADD.ncurses} .elif ${CURSES_TYPE} == "pdcurses" . include "../../devel/pdcurses/buildlink3.mk" +BUILDLINK_LIBNAME.curses?= ${BUILDLINK_LIBNAME.pdcurses} BUILDLINK_LDADD.curses?= ${BUILDLINK_LDADD.pdcurses} .endif diff --git a/mk/curses.builtin.mk b/mk/curses.builtin.mk index 8e4a67a94db8..e35b4ee4da39 100644 --- a/mk/curses.builtin.mk +++ b/mk/curses.builtin.mk @@ -1,4 +1,4 @@ -# $NetBSD: curses.builtin.mk,v 1.2 2008/02/27 02:26:07 jlam Exp $ +# $NetBSD: curses.builtin.mk,v 1.3 2008/02/27 04:47:02 jlam Exp $ BUILTIN_PKG:= curses @@ -58,7 +58,8 @@ CHECK_BUILTIN.curses?= no BUILDLINK_INCDIRS.curses?= ${H_CURSES:H:S/^${BUILDLINK_PREFIX.curses}\///} . endif . if !empty(BUILTIN_LIB_FOUND.curses:M[yY][eE][sS]) -BUILDLINK_LDADD.curses?= -lcurses +BUILDLINK_LIBNAME.curses= curses +BUILDLINK_LDADD.curses?= -l${BUILDLINK_LIBNAME.curses} . endif . endif diff --git a/mk/termlib.buildlink3.mk b/mk/termlib.buildlink3.mk new file mode 100644 index 000000000000..352e1512c48b --- /dev/null +++ b/mk/termlib.buildlink3.mk @@ -0,0 +1,48 @@ +# $NetBSD: termlib.buildlink3.mk,v 1.1 2008/02/27 04:47:02 jlam Exp $ +# +# This Makefile fragment is meant to be included by packages that require +# a basic termlib implementation. +# +# === Variables set by this file === +# +# TERMLIB_TYPE +# The name of the selected termlib implementation. + +TERMLIB_BUILDLINK3_MK:= ${TERMLIB_BUILDLINK3_MK}+ + +.include "bsd.fast.prefs.mk" + +.if !empty(TERMLIB_BUILDLINK3_MK:M+) + +CHECK_BUILTIN.termlib:= yes +. include "termlib.builtin.mk" +CHECK_BUILTIN.termlib:= no + +. if !empty(USE_BUILTIN.termlib:M[yY][eE][sS]) +. if defined(BUILTIN_LIBNAME.termlib) +TERMLIB_TYPE= ${BUILTIN_LIBNAME.termlib} +. else +TERMLIB_TYPE= none +. endif +. else +TERMLIB_TYPE= curses +. endif + +BUILD_DEFS+= TERMLIB_TYPE + +.endif # TERMLIB_BUILDLINK3_MK + +.if ${TERMLIB_TYPE} == "none" +PKG_FAIL_REASON= "No usable terminal library found on the system." +.elif (${TERMLIB_TYPE} == "termcap") +BUILDLINK_PACKAGES:= ${BUILDLINK_PACKAGES:Ntermlib} +BUILDLINK_PACKAGES+= termlib +BUILDLINK_ORDER:= ${BUILDLINK_ORDER} ${BUILDLINK_DEPTH}termlib +BUILDLINK_LIBNAME.termlib?= termcap +BUILDLINK_LDADD.termlib?= -l${BUILDLINK_LIBNAME.termlib} +BUILDLINK_BUILTIN_MK.termlib= ../../mk/termlib.builtin.mk +.elif ${TERMLIB_TYPE} == "curses" +. include "../../mk/curses.buildlink3.mk" +BUILDLINK_LIBNAME.termlib?= ${BUILDLINK_LIBNAME.curses} +BUILDLINK_LDADD.termlib?= ${BUILDLINK_LDADD.curses} +.endif diff --git a/mk/termlib.builtin.mk b/mk/termlib.builtin.mk new file mode 100644 index 000000000000..5af985bd75d3 --- /dev/null +++ b/mk/termlib.builtin.mk @@ -0,0 +1,44 @@ +# $NetBSD: termlib.builtin.mk,v 1.1 2008/02/27 04:47:02 jlam Exp $ + +BUILTIN_PKG:= termlib + +BUILTIN_FIND_LIBS:= termcap curses + +.include "buildlink3/bsd.builtin.mk" + +### +### Determine if there is a built-in implementation of the package and +### set IS_BUILTIN. appropriately ("yes" or "no"). +### +.if !defined(IS_BUILTIN.termlib) +IS_BUILTIN.termlib= no +. if !empty(BUILTIN_LIB_FOUND.termcap:M[yY][eE][sS]) || \ + !empty(BUILTIN_LIB_FOUND.curses:M[yY][eE][sS]) +IS_BUILTIN.termlib= yes +. endif +.endif +MAKEVARS+= IS_BUILTIN.termlib + +### +### Determine whether we should use the built-in implementation if it +### exists, and set USE_BUILTIN. appropriate ("yes" or "no"). +### +.if !defined(USE_BUILTIN.termlib) +. if ${PREFER.termlib} == "pkgsrc" +USE_BUILTIN.termlib= no +. else +USE_BUILTIN.termlib= ${IS_BUILTIN.termlib} +. endif # PREFER.termlib +.endif +MAKEVARS+= USE_BUILTIN.termlib + +# Define BUILTIN_LIBNAME.termlib to be the built-in terminal library +# only if we're using the built-in termlib. +# +.if !empty(USE_BUILTIN.termlib:M[yY][eE][sS]) +. if !empty(BUILTIN_LIB_FOUND.termcap:M[yY][eE][sS]) +BUILTIN_LIBNAME.termlib= termcap +. elif !empty(BUILTIN_LIB_FOUND.curses:M[yY][eE][sS]) +BUILTIN_LIBNAME.termlib= curses +. endif +.endif