pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/mk + Introduce a way for a user to set the default cur...
details: https://anonhg.NetBSD.org/pkgsrc/rev/a499a2b77bb2
branches: trunk
changeset: 539030:a499a2b77bb2
user: jlam <jlam%pkgsrc.org@localhost>
date: Mon Feb 25 04:19:34 2008 +0000
description:
+ Introduce a way for a user to set the default curses implementation
used by packages that need curses. From curses.buildlink3.mk:
CURSES_DEFAULT
This value represents the type of curses we wish to use on the
system. Setting this to "curses" means that the system curses
implementation is fine.
Possible: curses, ncurses, pdcurses
+ Move all code to detect a built-in version of curses into a
curses.builtin.mk file.
+ Add code to {n,pd}curses/buildlink3.mk so make the headers and
libraries usable as <curses.h> and -lcurses if _PKG_USE_CURSES is
defined. _PKG_USE_CURSES is only defined by curses.buildlink3.mk.
+ Improve the detection of native ncurses in ncurses/builtin.mk and
allow headers and libraries to be usable as <ncurses.h> and -lncurses.
diffstat:
devel/ncurses/buildlink3.mk | 23 ++++++++-
devel/ncurses/builtin.mk | 43 ++++++++++------
devel/pdcurses/buildlink3.mk | 12 ++++-
mk/curses.buildlink3.mk | 106 ++++++++++++++++++++++++++++++++++++------
mk/curses.builtin.mk | 71 ++++++++++++++++++++++++++++
5 files changed, 221 insertions(+), 34 deletions(-)
diffs (truncated from 342 to 300 lines):
diff -r a542a39e2014 -r a499a2b77bb2 devel/ncurses/buildlink3.mk
--- a/devel/ncurses/buildlink3.mk Sun Feb 24 22:24:34 2008 +0000
+++ b/devel/ncurses/buildlink3.mk Mon Feb 25 04:19:34 2008 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: buildlink3.mk,v 1.27 2006/07/08 23:10:46 jlam Exp $
+# $NetBSD: buildlink3.mk,v 1.28 2008/02/25 04:19:34 jlam Exp $
BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
NCURSES_BUILDLINK3_MK:= ${NCURSES_BUILDLINK3_MK}+
@@ -15,6 +15,27 @@
BUILDLINK_API_DEPENDS.ncurses+= ncurses>=5.3nb1
BUILDLINK_ABI_DEPENDS.ncurses+= ncurses>=5.4nb1
BUILDLINK_PKGSRCDIR.ncurses?= ../../devel/ncurses
+BUILDLINK_LDADD.ncurses?= -lncurses
+
+# _PKG_USE_CURSES is defined by curses.buildlink3.mk to indicate that
+# the headers and libraries should be usable as <curses.h> and -lcurses.
+#
+. if defined(_PKG_USE_CURSES)
+BUILDLINK_TARGETS+= buildlink-ncurses-curses-h
+BUILDLINK_TRANSFORM+= l:curses:ncurses
+. endif
+
+.PHONY: buildlink-ncurses-curses-h
+buildlink-ncurses-curses-h:
+ ${RUN} \
+ src=${BUILDLINK_PREFIX.ncurses:Q}"/include/ncurses.h"; \
+ dest=${BUILDLINK_DIR:Q}"/include/curses.h"; \
+ if ${TEST} ! -f "$$dest" -a -f "$$src"; then \
+ ${ECHO_BUILDLINK_MSG} "Linking curses.h -> ncurses.h."; \
+ ${MKDIR} `${DIRNAME} "$$dest"`; \
+ ${LN} -s "$$src" "$$dest"; \
+ fi
+
.endif # NCURSES_BUILDLINK3_MK
BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:S/+$//}
diff -r a542a39e2014 -r a499a2b77bb2 devel/ncurses/builtin.mk
--- a/devel/ncurses/builtin.mk Sun Feb 24 22:24:34 2008 +0000
+++ b/devel/ncurses/builtin.mk Mon Feb 25 04:19:34 2008 +0000
@@ -1,10 +1,10 @@
-# $NetBSD: builtin.mk,v 1.12 2007/01/17 03:11:18 rillig Exp $
+# $NetBSD: builtin.mk,v 1.13 2008/02/25 04:19:34 jlam Exp $
BUILTIN_PKG:= ncurses
-BUILTIN_FIND_LIBS:= ncurses
+BUILTIN_FIND_LIBS:= ncurses curses
BUILTIN_FIND_FILES_VAR:= H_NCURSES
-BUILTIN_FIND_FILES.H_NCURSES= /usr/include/curses.h
+BUILTIN_FIND_FILES.H_NCURSES= /usr/include/ncurses.h /usr/include/curses.h
BUILTIN_FIND_GREP.H_NCURSES= \#define[ ]*NCURSES_VERSION
.include "../../mk/buildlink3/bsd.builtin.mk"
@@ -17,7 +17,8 @@
IS_BUILTIN.ncurses= no
. if empty(H_NCURSES:M__nonexistent__) && \
empty(H_NCURSES:M${LOCALBASE}/*) && \
- !empty(BUILTIN_LIB_FOUND.ncurses:M[yY][eE][sS])
+ (!empty(BUILTIN_LIB_FOUND.ncurses:M[yY][eE][sS]) || \
+ !empty(BUILTIN_LIB_FOUND.curses:M[yY][eE][sS]))
IS_BUILTIN.ncurses= yes
. endif
.endif
@@ -107,12 +108,22 @@
BUILDLINK_LDADD.ncurses= -lncurses
. if !empty(USE_BUILTIN.ncurses:M[yY][eE][sS])
-. if !empty(BUILTIN_LIB_FOUND.ncurses:M[nN][oO]) || (${OPSYS} == "Interix")
+. if !empty(BUILTIN_LIB_FOUND.ncurses:M[nN][oO]) && \
+ !empty(BUILTIN_LIB_FOUND.curses:M[yY][eE][sS])
BUILDLINK_LDADD.ncurses= -lcurses
-BUILDLINK_FNAME_TRANSFORM.ncurses+= -e "s|/curses\.h|/ncurses.h|g"
BUILDLINK_TRANSFORM+= l:ncurses:curses
. endif
-BUILDLINK_FILES.ncurses+= include/curses.h
+#
+# On Interix, there is a libncurses.a and a libcurses.so but strangely,
+# no libncurses.so. We want to link against the shared library, so
+# turn "-lncurses" into "-lcurses".
+#
+. if (${OPSYS} == "Interix") && \
+ !empty(BUILTIN_LIB_FOUND.curses:M[yY][eE][sS])
+BUILDLINK_LDADD.ncurses= -lcurses
+BUILDLINK_TRANSFORM+= l:ncurses:curses
+. endif
+BUILDLINK_TARGETS+= buildlink-curses-ncurses-h
BUILDLINK_TARGETS+= buildlink-ncurses-extra-includes
. endif
BUILDLINK_TARGETS+= buildlink-ncurses-curses-h
@@ -124,7 +135,7 @@
. if !target(buildlink-ncurses-extra-includes)
.PHONY: buildlink-ncurses-extra-includes
buildlink-ncurses-extra-includes:
- ${_PKG_SILENT}${_PKG_DEBUG} \
+ ${RUN} \
extra_includes="include/term.h"; \
for f in $$extra_includes; do \
src=${BUILDLINK_PREFIX.ncurses:Q}"/$$f"; \
@@ -137,15 +148,15 @@
done
. endif
-# Some packages expect <curses.h> to provide declarations for ncurses.
-. if !target(buildlink-ncurses-curses-h)
-.PHONY: buildlink-ncurses-curses-h
-buildlink-ncurses-curses-h:
- ${_PKG_SILENT}${_PKG_DEBUG} \
- src=${BUILDLINK_PREFIX.ncurses:Q}"/include/ncurses.h"; \
- dest=${BUILDLINK_DIR:Q}"/include/curses.h"; \
+. if !target(buildlink-curses-ncurses-h)
+.PHONY: buildlink-curses-ncurses-h
+buildlink-curses-ncurses-h:
+ ${RUN} \
+ src=${H_NCURSES:Q}; \
+ dest=${BUILDLINK_DIR:Q}"/include/ncurses.h"; \
if ${TEST} ! -f "$$dest" -a -f "$$src"; then \
- ${ECHO_BUILDLINK_MSG} "Linking curses.h -> ncurses.h."; \
+ fname=`${BASENAME} $$src`; \
+ ${ECHO_BUILDLINK_MSG} "Linking $$fname -> ncurses.h."; \
${MKDIR} `${DIRNAME} "$$dest"`; \
${LN} -s "$$src" "$$dest"; \
fi
diff -r a542a39e2014 -r a499a2b77bb2 devel/pdcurses/buildlink3.mk
--- a/devel/pdcurses/buildlink3.mk Sun Feb 24 22:24:34 2008 +0000
+++ b/devel/pdcurses/buildlink3.mk Mon Feb 25 04:19:34 2008 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: buildlink3.mk,v 1.1.1.1 2008/02/24 04:57:07 jlam Exp $
+# $NetBSD: buildlink3.mk,v 1.2 2008/02/25 04:19:34 jlam Exp $
BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+
PDCURSES_BUILDLINK3_MK:= ${PDCURSES_BUILDLINK3_MK}+
@@ -14,6 +14,16 @@
.if !empty(PDCURSES_BUILDLINK3_MK:M+)
BUILDLINK_API_DEPENDS.pdcurses+= pdcurses>=3.3
BUILDLINK_PKGSRCDIR.pdcurses?= ../../devel/pdcurses
+BUILDLINK_LDADD.pdcurses?= -lXCurses
+
+# _PKG_USE_CURSES is defined by curses.buildlink3.mk to indicate that
+# the headers and libraries should be usable as <curses.h> and -lcurses.
+#
+. if defined(_PKG_USE_CURSES)
+BUILDLINK_INCDIRS.pdcurses+= include/xcurses
+BUILDLINK_TRANSFORM+= l:curses:XCurses
+. endif
+
.endif # PDCURSES_BUILDLINK3_MK
.include "../../mk/xaw.buildlink3.mk"
diff -r a542a39e2014 -r a499a2b77bb2 mk/curses.buildlink3.mk
--- a/mk/curses.buildlink3.mk Sun Feb 24 22:24:34 2008 +0000
+++ b/mk/curses.buildlink3.mk Mon Feb 25 04:19:34 2008 +0000
@@ -1,24 +1,98 @@
-# $NetBSD: curses.buildlink3.mk,v 1.5 2007/11/03 15:17:42 rillig Exp $
+# $NetBSD: curses.buildlink3.mk,v 1.6 2008/02/25 04:19:34 jlam Exp $
+#
+# This Makefile fragment is meant to be included by packages that require
+# any curses implementation instead of one particular one. The available
+# curses implementations are "curses" if built-in, "ncurses", and
+# "pdcurses".
+#
+# If a package genuinely requires ncurses or pdcurses, then it should
+# directly include the appropriate buildlink3.mk instead of this file in
+# the package Makefile.
+#
+# === User-settable variables ===
#
-# This file should be included by Makefiles for packages that use curses.
-# It checks whether a native curses implementation is available, or
-# otherwise adds a dependency on ncurses.
+# CURSES_DEFAULT
+# This value represents the type of curses we wish to use on the
+# system. Setting this to "curses" means that the system curses
+# implementation is fine.
+#
+# Possible: curses, ncurses, pdcurses
+# Default: (depends)
#
-# If a package genuinely requires ncurses, then it should directly include
-# ncurses/buildlink3.mk instead of this file in the package Makefile and
-# additionally set USE_NCURSES=yes.
+# === Variables set by this file ===
#
+# CURSES_TYPE
+# The name of the selected curses implementation.
+
+CURSES_BUILDLINK3_MK:= ${CURSES_BUILDLINK3_MK}+
+
+.include "bsd.fast.prefs.mk"
+
+.if !empty(CURSES_BUILDLINK3_MK:M+)
-.if !exists(/usr/include/curses.h) && \
- !exists(/usr/include/ncurses.h)
-. include "../../devel/ncurses/buildlink3.mk"
-.else
+# _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
+
+CHECK_BUILTIN.curses:= yes
+. include "curses.builtin.mk"
+CHECK_BUILTIN.curses:= no
-# XXX this is ugly, but needed to get the BUILDLINK_TRANSFORM from builtin.mk;
-# on Interix, libncurses is static yet libcurses (also ncurses) is shared
-. include "bsd.fast.prefs.mk"
-. if ${OPSYS} == "Interix"
-. include "../../devel/ncurses/buildlink3.mk"
+# Set the value of CURSES_DEFAULT depending on the platform and what's
+# available in the base system.
+#
+# - Interix has an unusual ncurses installation that is missing some
+# shared libraries, but the ncurses/builtin.mk will take care of things
+# for us.
+#
+.if ${OPSYS} == "Interix"
+CURSES_DEFAULT?= ncurses
+.endif
+.if defined(IS_BUILTIN.curses) && !empty(IS_BUILTIN.curses:M[yY][eE][sS])
+CURSES_DEFAULT?= curses
+.else
+CURSES_DEFAULT?= ncurses
+.endif
+
+_CURSES_ACCEPTED= # empty
+.if defined(IS_BUILTIN.curses) && !empty(IS_BUILTIN.curses:M[yY][eE][sS])
+_CURSES_ACCEPTED+= curses # system curses exists
+.endif
+_CURSES_ACCEPTED+= ncurses # pkgsrc ncurses
+_CURSES_ACCEPTED+= pdcurses # pkgsrc pdcurses
+
+_CURSES_TYPE= ${CURSES_DEFAULT}
+. if !empty(_CURSES_ACCEPTED:M${_CURSES_TYPE})
+CURSES_TYPE= ${_CURSES_TYPE}
+. else
+CURSES_TYPE= none
. endif
+BUILD_DEFS+= CURSES_DEFAULT
+BUILD_DEFS_EFFECTS+= CURSES_TYPE
+
+# _PKG_USE_CURSES is a flag for use by the curses packages' buildlink3.mk
+# files to indicate that the headers and libraries should be usable as
+# <curses.h> and -lcurses.
+#
+_PKG_USE_CURSES= yes
+
+.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"
+BUILDLINK_PACKAGES:= ${BUILDLINK_PACKAGES:Ncurses}
+BUILDLINK_PACKAGES+= curses
+BUILDLINK_ORDER:= ${BUILDLINK_ORDER} ${BUILDLINK_DEPTH}curses
+BUILDLINK_BUILTIN_MK.curses= ../../mk/curses.builtin.mk
+.elif ${CURSES_TYPE} == "ncurses"
+USE_NCURSES= yes
+. include "../../devel/ncurses/buildlink3.mk"
+BUILDLINK_LDADD.curses?= ${BUILDLINK_LDADD.ncurses}
+.elif ${CURSES_TYPE} == "pdcurses"
+. include "../../devel/pdcurses/buildlink3.mk"
+BUILDLINK_LDADD.curses?= ${BUILDLINK_LDADD.pdcurses}
.endif
diff -r a542a39e2014 -r a499a2b77bb2 mk/curses.builtin.mk
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mk/curses.builtin.mk Mon Feb 25 04:19:34 2008 +0000
@@ -0,0 +1,71 @@
+# $NetBSD: curses.builtin.mk,v 1.1 2008/02/25 04:19:34 jlam Exp $
+
+BUILTIN_PKG:= curses
+
+BUILTIN_FIND_LIBS:= curses
+BUILTIN_FIND_FILES_VAR:= H_CURSES
+BUILTIN_FIND_FILES.H_CURSES= /usr/include/curses.h
+
+.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.curses)
+IS_BUILTIN.curses= no
+. if empty(H_CURSES:M${LOCALBASE}/*) && exists(${H_CURSES})
+IS_BUILTIN.curses= yes
+. endif
+.endif
+MAKEVARS+= IS_BUILTIN.curses
+
+###
+### 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.curses)
+#
+# There will probably never be a devel/curses package because ncurses is
Home |
Main Index |
Thread Index |
Old Index