summaryrefslogtreecommitdiff
path: root/devel/ncurses
diff options
context:
space:
mode:
authorjlam <jlam@pkgsrc.org>2008-02-25 04:19:34 +0000
committerjlam <jlam@pkgsrc.org>2008-02-25 04:19:34 +0000
commit6c632be06567f61a427880857cdfabb980db4dc7 (patch)
treeb1fc1d2628253083c17f00e031a6d5fd7f45b918 /devel/ncurses
parent09275ef5bd6a438e0d35932db2eda57ef2ca5dc9 (diff)
downloadpkgsrc-6c632be06567f61a427880857cdfabb980db4dc7.tar.gz
+ 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 (limited to 'devel/ncurses')
-rw-r--r--devel/ncurses/buildlink3.mk23
-rw-r--r--devel/ncurses/builtin.mk43
2 files changed, 49 insertions, 17 deletions
diff --git a/devel/ncurses/buildlink3.mk b/devel/ncurses/buildlink3.mk
index 739354a9169..b1a4814550b 100644
--- a/devel/ncurses/buildlink3.mk
+++ b/devel/ncurses/buildlink3.mk
@@ -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_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
+
+# _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 --git a/devel/ncurses/builtin.mk b/devel/ncurses/builtin.mk
index a3b9b68672f..31cf3f3b48c 100644
--- a/devel/ncurses/builtin.mk
+++ b/devel/ncurses/builtin.mk
@@ -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 @@ BUILTIN_FIND_GREP.H_NCURSES= \#define[ ]*NCURSES_VERSION
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 @@ CHECK_BUILTIN.ncurses?= no
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 @@ BUILDLINK_TARGETS+= buildlink-ncurses-curses-h
. 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 @@ buildlink-ncurses-extra-includes:
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