pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/devel/ncursesw Add a ncursesw/builtin.mk file to that ...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/0dcdfb795d86
branches:  trunk
changeset: 538901:0dcdfb795d86
user:      jlam <jlam%pkgsrc.org@localhost>
date:      Wed Feb 20 17:17:46 2008 +0000

description:
Add a ncursesw/builtin.mk file to that allows NetBSD with native wide
curses to be used instead.  Packages that really need ncursesw should
define USE_NCURSESW=yes in the package Makefile.

diffstat:

 devel/ncursesw/buildlink3.mk |    4 +-
 devel/ncursesw/builtin.mk    |  136 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 137 insertions(+), 3 deletions(-)

diffs (158 lines):

diff -r ff25e6e7c295 -r 0dcdfb795d86 devel/ncursesw/buildlink3.mk
--- a/devel/ncursesw/buildlink3.mk      Wed Feb 20 15:46:53 2008 +0000
+++ b/devel/ncursesw/buildlink3.mk      Wed Feb 20 17:17:46 2008 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: buildlink3.mk,v 1.1 2006/10/13 18:07:49 tron Exp $
+# $NetBSD: buildlink3.mk,v 1.2 2008/02/20 17:17:46 jlam Exp $
 
 BUILDLINK_DEPTH:=      ${BUILDLINK_DEPTH}+
 NCURSESW_BUILDLINK3_MK:=${NCURSESW_BUILDLINK3_MK}+
@@ -17,8 +17,6 @@
 BUILDLINK_PKGSRCDIR.ncursesw?=         ../../devel/ncursesw
 .endif # NCURSESW_BUILDLINK3_MK
 
-USE_NCURSES=           YES
-
 .include "../../devel/ncurses/buildlink3.mk"
 
 BUILDLINK_DEPTH:=      ${BUILDLINK_DEPTH:S/+$//}
diff -r ff25e6e7c295 -r 0dcdfb795d86 devel/ncursesw/builtin.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/devel/ncursesw/builtin.mk Wed Feb 20 17:17:46 2008 +0000
@@ -0,0 +1,136 @@
+# $NetBSD: builtin.mk,v 1.1 2008/02/20 17:17:46 jlam Exp $
+
+BUILTIN_PKG:=  ncursesw
+
+# H_NB_CURSESW searches for NetBSD's <curses.h> that uses HAVE_WCHAR to
+#      build with wide curses support.
+#
+# XXX Need to deal with Solaris <curses.h>
+#
+BUILTIN_FIND_LIBS:=                    ncursesw
+BUILTIN_FIND_FILES_VAR:=               H_NB_CURSESW H_NCURSESW_CURSES
+BUILTIN_FIND_FILES.H_NB_CURSESW=               /usr/include/curses.h
+BUILTIN_FIND_GREP.H_NB_CURSESW=                \#ifdef[        ]*HAVE_WCHAR
+BUILTIN_FIND_FILES.H_NCURSESW_CURSES=  /usr/include/ncursesw/curses.h
+BUILTIN_FIND_GREP.H_NCURSESW_CURSES=   \#define[       ]*NCURSES_VERSION
+
+.include "../../mk/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.ncursesw)
+IS_BUILTIN.ncursesw=   no
+.  if empty(H_NCURSESW_CURSES:M__nonexistent__) && \
+      empty(H_NCURSESW_CURSES:M${LOCALBASE}/*) && \
+      !empty(BUILTIN_LIB_FOUND.ncursesw:M[yY][eE][sS])
+IS_BUILTIN.ncursesw=   yes
+.  endif
+.endif
+MAKEVARS+=     IS_BUILTIN.ncursesw
+
+###
+### If there is a built-in implementation, then set BUILTIN_PKG.<pkg> to
+### a package name to represent the built-in package.
+###
+.if !defined(BUILTIN_PKG.ncursesw) && \
+    !empty(IS_BUILTIN.ncursesw:M[yY][eE][sS]) && \
+    empty(H_NCURSES:M__nonexistent__)
+BUILTIN_VERSION.ncursesw!=                                             \
+       ${AWK} '/\#define[      ]*NCURSES_VERSION[      ]/ {            \
+                       vers = $$3;                                     \
+                       gsub("\"", "", vers);                           \
+                       print vers;                                     \
+               }                                                       \
+       ' ${H_NCURSES:Q}
+BUILTIN_PKG.ncursesw=  ncursesw-${BUILTIN_VERSION.ncursesw}
+.endif
+MAKEVARS+=     BUILTIN_PKG.ncursesw
+
+###
+### 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.ncursesw)
+.  if ${PREFER.ncursesw} == "pkgsrc"
+USE_BUILTIN.ncursesw=  no
+.  else
+USE_BUILTIN.ncursesw=  ${IS_BUILTIN.ncursesw}
+.    if defined(BUILTIN_PKG.ncursesw) && \
+        !empty(IS_BUILTIN.ncursesw:M[yY][eE][sS])
+USE_BUILTIN.ncursesw=  yes
+.      for _dep_ in ${BUILDLINK_API_DEPENDS.ncursesw}
+.        if !empty(USE_BUILTIN.ncursesw:M[yY][eE][sS])
+USE_BUILTIN.ncursesw!=                                                 \
+       if ${PKG_ADMIN} pmatch ${_dep_:Q} ${BUILTIN_PKG.ncursesw:Q}; then \
+               ${ECHO} yes;                                            \
+       else                                                            \
+               ${ECHO} no;                                             \
+       fi
+.        endif
+.      endfor
+.    endif
+# XXX
+# XXX By default, assume that the native curses on NetBSD systems is
+# XXX good enough to replace ncursesw.  In reality, no version of NetBSD
+# XXX has a curses library that can completely replace ncursesw; however,
+# XXX some versions implement enough of ncursesw that some packages are
+# XXX happy.
+# XXX
+.    if empty(H_NB_CURSESW:M__nonexistent__) && \
+       empty(H_NB_CURSESW:M${LOCALBASE}/*)
+USE_BUILTIN.ncursesw=  yes
+.    endif
+.  endif  # PREFER.ncursesw
+.endif
+MAKEVARS+=     USE_BUILTIN.ncursesw
+
+# If USE_NCURSESW is defined, then force the use of an ncurses/ncursesw
+# implementation.
+#
+.if defined(USE_NCURSESW)
+USE_NCURSES=           yes
+.  if !empty(IS_BUILTIN.ncursesw:M[nN][oO])
+USE_BUILTIN.ncursesw=  no
+.  endif
+.endif
+
+###
+### The section below only applies if we are not including this file
+### solely to determine whether a built-in implementation exists.
+###
+CHECK_BUILTIN.ncursesw?=       no
+.if !empty(CHECK_BUILTIN.ncursesw:M[nN][oO])
+
+.  if !empty(USE_BUILTIN.ncursesw:M[yY][eE][sS])
+.    if !empty(BUILTIN_LIB_FOUND.ncursesw:M[nN][oO])
+BUILDLINK_TRANSFORM+=          l:ncursesw:curses
+.    endif
+.    if empty(H_NB_CURSESW:M__nonexistent__) && \
+       empty(H_NB_CURSESW:M${LOCALBASE}/*)
+BUILDLINK_CPPFLAGS.ncursesw+=  -DHAVE_WCHAR=1
+.    endif
+.  endif
+BUILDLINK_TARGETS+=            buildlink-ncursesw-curses-h
+
+# Most packages expect <ncursesw/curses.h> to provide declarations for
+# ncursesw.
+#
+.  if !target(buildlink-ncursesw-curses-h)
+.PHONY: buildlink-ncursesw-curses-h
+buildlink-ncursesw-curses-h:
+       ${RUN}                                                          \
+       curses_h="ncursesw/ncurses.h curses.h";                         \
+       for f in $$curses_h; do                                         \
+               src=${BUILDLINK_PREFIX.ncursesw:Q}"/include/$$f";       \
+               dest=${BUILDLINK_DIR:Q}"/include/ncursesw/curses.h";    \
+               if ${TEST} ! -f "$$dest" -a -f "$$src"; then            \
+                       ${ECHO_BUILDLINK_MSG} "Linking ncursesw/curses.h -> $$f."; \
+                       ${MKDIR} `${DIRNAME} "$$dest"`;                 \
+                       ${LN} -s "$$src" "$$dest";                      \
+               fi;                                                     \
+       done
+.  endif
+
+.endif # CHECK_BUILTIN.ncursesw



Home | Main Index | Thread Index | Old Index