summaryrefslogtreecommitdiff
path: root/mk/curses.builtin.mk
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 /mk/curses.builtin.mk
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 'mk/curses.builtin.mk')
-rw-r--r--mk/curses.builtin.mk71
1 files changed, 71 insertions, 0 deletions
diff --git a/mk/curses.builtin.mk b/mk/curses.builtin.mk
new file mode 100644
index 00000000000..4b4fc2ff9c1
--- /dev/null
+++ b/mk/curses.builtin.mk
@@ -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
+# the recommended curses on many platforms, so we should always prefer the
+# native curses package.
+#
+PREFER.curses= native
+. if ${PREFER.curses} == "pkgsrc"
+USE_BUILTIN.curses= no
+. else
+USE_BUILTIN.curses= ${IS_BUILTIN.curses}
+. if defined(BUILTIN_PKG.curses) && !empty(IS_BUILTIN.curses:M[yY][eE][sS])
+USE_BUILTIN.curses= yes
+. for _dep_ in ${BUILDLINK_API_DEPENDS.curses}
+. if !empty(USE_BUILTIN.curses:M[yY][eE][sS])
+USE_BUILTIN.curses!= \
+ if ${PKG_ADMIN} pmatch ${_dep_:Q} ${BUILTIN_PKG.curses:Q}; then \
+ ${ECHO} yes; \
+ else \
+ ${ECHO} no; \
+ fi
+. endif
+. endfor
+. endif
+. endif # PREFER.curses
+.endif
+MAKEVARS+= USE_BUILTIN.curses
+
+###
+### The section below only applies if we are not including this file
+### solely to determine whether a built-in implementation exists.
+###
+CHECK_BUILTIN.curses?= no
+.if !empty(CHECK_BUILTIN.curses:M[nN][oO])
+
+. if !empty(USE_BUILTIN.curses:M[yY][eE][sS])
+. if exists(${H_CURSES})
+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
+. endif
+. endif
+
+.endif # CHECK_BUILTIN.curses