diff options
author | jlam <jlam@pkgsrc.org> | 2004-03-10 17:57:14 +0000 |
---|---|---|
committer | jlam <jlam@pkgsrc.org> | 2004-03-10 17:57:14 +0000 |
commit | d68193d4743931877544a7e52ed44171707b858d (patch) | |
tree | 1226d07b8f66083168895189decc88848b70903f /devel/ncurses | |
parent | 55bd3391bd2b274e284613fb1e70cd0190dd4ed8 (diff) | |
download | pkgsrc-d68193d4743931877544a7e52ed44171707b858d.tar.gz |
Split out the code that deals with checking whether the software is
built-in or not into a separate builtin.mk file. The code to deal
checking for built-in software is much simpler to deal with in pkgsrc.
The buildlink3.mk file for a package will be of the usual format
regardless of the package, which makes it simpler for packagers to
update a package.
The builtin.mk file for a package must define a single yes/no variable
USE_BUILTIN.<pkg> that is used by bsd.buildlink3.mk to decide whether
to use the built-in software or to use the pkgsrc software.
Diffstat (limited to 'devel/ncurses')
-rw-r--r-- | devel/ncurses/buildlink3.mk | 168 | ||||
-rw-r--r-- | devel/ncurses/builtin.mk | 133 |
2 files changed, 140 insertions, 161 deletions
diff --git a/devel/ncurses/buildlink3.mk b/devel/ncurses/buildlink3.mk index 89c9f90fe2d..e9a45bf445f 100644 --- a/devel/ncurses/buildlink3.mk +++ b/devel/ncurses/buildlink3.mk @@ -1,172 +1,18 @@ -# $NetBSD: buildlink3.mk,v 1.22 2004/02/19 17:36:38 jlam Exp $ +# $NetBSD: buildlink3.mk,v 1.23 2004/03/10 17:57:14 jlam Exp $ BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH}+ NCURSES_BUILDLINK3_MK:= ${NCURSES_BUILDLINK3_MK}+ -.include "../../mk/bsd.prefs.mk" - -.if !empty(NCURSES_BUILDLINK3_MK:M+) -BUILDLINK_PACKAGES+= ncurses -BUILDLINK_DEPENDS.ncurses+= ncurses>=5.3nb1 -BUILDLINK_PKGSRCDIR.ncurses?= ../../devel/ncurses -.endif # NCURSES_BUILDLINK3_MK - -BUILDLINK_CHECK_BUILTIN.ncurses?= NO - -.if !defined(_BLNK_LIBNCURSES_FOUND) -_BLNK_LIBNCURSES_FOUND!= \ - if [ "`${ECHO} /usr/lib/libncurses.*`" = "/usr/lib/libncurses.*" ]; then \ - ${ECHO} "NO"; \ - else \ - ${ECHO} "YES"; \ - fi -MAKEFLAGS+= _BLNK_LIBNCURSES_FOUND=${_BLNK_LIBNCURSES_FOUND} -.endif - -_NCURSES_H= /usr/include/curses.h - -.if !defined(BUILDLINK_IS_BUILTIN.ncurses) -BUILDLINK_IS_BUILTIN.ncurses= NO -. if !empty(_BLNK_LIBNCURSES_FOUND:M[yY][eE][sS]) -BUILDLINK_IS_BUILTIN.ncurses= YES -. elif exists(${_NCURSES_H}) -_IS_BUILTIN.ncurses!= \ - if ${GREP} -q "\#define[ ]*NCURSES_VERSION" ${_NCURSES_H}; then \ - ${ECHO} "YES"; \ - else \ - ${ECHO} "NO"; \ - fi -BUILDLINK_IS_BUILTIN.ncurses= ${_IS_BUILTIN.ncurses} -. if !empty(BUILDLINK_CHECK_BUILTIN.ncurses:M[nN][oO]) && \ - !empty(_IS_BUILTIN.ncurses:M[yY][eE][sS]) -# -# Create an appropriate name for the built-in package distributed -# with the system. This package name can be used to check against -# BUILDLINK_DEPENDS.<pkg> to see if we need to install the pkgsrc -# version or if the built-in one is sufficient. -# -_NCURSES_VERSION!= \ - ${AWK} '/\#define[ ]*NCURSES_VERSION[ ]/ { \ - vers = $$3; \ - gsub("\"", "", vers); \ - print vers; \ - } \ - ' ${_NCURSES_H} -_NCURSES_PKG= ncurses-${_NCURSES_VERSION} -BUILDLINK_IS_BUILTIN.ncurses= YES -. for _depend_ in ${BUILDLINK_DEPENDS.ncurses} -. if !empty(BUILDLINK_IS_BUILTIN.ncurses:M[yY][eE][sS]) -BUILDLINK_IS_BUILTIN.ncurses!= \ - if ${PKG_ADMIN} pmatch '${_depend_}' ${_NCURSES_PKG}; then \ - ${ECHO} "YES"; \ - else \ - ${ECHO} "NO"; \ - fi -. endif -. endfor -. endif -. endif -# -# XXX By default, assume that the native curses on NetBSD systems -# XXX supports ncurses. -# -. if ${OPSYS} == "NetBSD" -BUILDLINK_IS_BUILTIN.ncurses= YES -# -# These versions of NetBSD didn't have a curses library that was -# capable of replacing ncurses. -# -# XXX In reality, no version of NetBSD has a curses library that can -# XXX completely replace ncurses; however, some versions implement -# XXX enough of ncurses that some packages are happy. -# -_INCOMPAT_CURSES= NetBSD-0.*-* NetBSD-1.[0123]*-* -_INCOMPAT_CURSES+= NetBSD-1.4.*-* NetBSD-1.4[A-X]-* -. for _pattern_ in ${_INCOMPAT_CURSES} ${INCOMPAT_CURSES} -. if !empty(MACHINE_PLATFORM:M${_pattern_}) -BUILDLINK_IS_BUILTIN.ncurses= NO -. endif -. endfor -. endif -MAKEFLAGS+= BUILDLINK_IS_BUILTIN.ncurses=${BUILDLINK_IS_BUILTIN.ncurses} -.endif - -.if !empty(BUILDLINK_CHECK_BUILTIN.ncurses:M[yY][eE][sS]) -BUILDLINK_USE_BUILTIN.ncurses= YES -.endif - -.if !defined(BUILDLINK_USE_BUILTIN.ncurses) -. if !empty(BUILDLINK_IS_BUILTIN.ncurses:M[yY][eE][sS]) -BUILDLINK_USE_BUILTIN.ncurses= YES -. else -BUILDLINK_USE_BUILTIN.ncurses= NO -. endif - -. if !empty(PREFER_NATIVE:M[yY][eE][sS]) && \ - !empty(BUILDLINK_IS_BUILTIN.ncurses:M[yY][eE][sS]) -BUILDLINK_USE_BUILTIN.ncurses= YES -. endif -. if !empty(PREFER_PKGSRC:M[yY][eE][sS]) -BUILDLINK_USE_BUILTIN.ncurses= NO -. endif -. if !empty(PREFER_NATIVE:Mncurses) && \ - !empty(BUILDLINK_IS_BUILTIN.ncurses:M[yY][eE][sS]) -BUILDLINK_USE_BUILTIN.ncurses= YES -. endif -. if !empty(PREFER_PKGSRC:Mncurses) -BUILDLINK_USE_BUILTIN.ncurses= NO -. endif - -. if defined(USE_NCURSES) -. if !empty(BUILDLINK_IS_BUILTIN.ncurses:M[yY][eE][sS]) && \ - !empty(_BLNK_LIBNCURSES_FOUND:M[yY][eE][sS]) -BUILDLINK_USE_BUILTIN.ncurses= YES -. else -BUILDLINK_USE_BUILTIN.ncurses= NO -. endif -. endif -.endif - -.if !empty(BUILDLINK_USE_BUILTIN.ncurses:M[nN][oO]) -. if !empty(BUILDLINK_DEPTH:M+) +.if !empty(BUILDLINK_DEPTH:M+) BUILDLINK_DEPENDS+= ncurses -. endif .endif -.if !empty(NCURSES_BUILDLINK3_MK:M+) -. if !empty(BUILDLINK_USE_BUILTIN.ncurses:M[yY][eE][sS]) -. if !empty(_BLNK_LIBNCURSES_FOUND:M[nN][oO]) -BUILDLINK_TRANSFORM.ncurses+= -e "s|/curses\.h|/ncurses.h|g" -BUILDLINK_TRANSFORM+= l:ncurses:curses -. endif -. endif - -BUILDLINK_FILES.ncurses= include/curses.h -BUILDLINK_FILES.ncurses+= include/term.h - -BUILDLINK_TARGETS+= buildlink-ncurses-curses-h -BUILDLINK_TARGETS+= buildlink-ncurses-extra-includes - -.PHONY: buildlink-ncurses-extra-includes -buildlink-ncurses-extra-includes: - ${_PKG_SILENT}${_PKG_DEBUG} \ - extra_includes="include/term.h"; \ - for f in $${extra_includes}; do \ - if [ ! -f ${BUILDLINK_DIR}/$${f} ]; then \ - ${ECHO_BUILDLINK_MSG} "Touching extra ncurses header ($${f}) in ${BUILDLINK_DIR}."; \ - ${TOUCH} ${TOUCH_FLAGS} ${BUILDLINK_DIR}/$${f}; \ - fi; \ - done +BUILDLINK_PACKAGES:= ${BUILDLINK_PACKAGES:Nncurses} +BUILDLINK_PACKAGES+= ncurses -.PHONY: buildlink-ncurses-curses-h -buildlink-ncurses-curses-h: - ${_PKG_SILENT}${_PKG_DEBUG} \ - if [ ! -f ${BUILDLINK_DIR}/include/curses.h -a \ - -f ${BUILDLINK_PREFIX.ncurses}/include/ncurses.h ]; then \ - ${ECHO_BUILDLINK_MSG} "Linking curses.h to ncurses.h."; \ - ${LN} -s ${BUILDLINK_PREFIX.ncurses}/include/ncurses.h \ - ${BUILDLINK_DIR}/include/curses.h; \ - fi +.if !empty(NCURSES_BUILDLINK3_MK:M+) +BUILDLINK_DEPENDS.ncurses+= ncurses>=5.3nb1 +BUILDLINK_PKGSRCDIR.ncurses?= ../../devel/ncurses .endif # NCURSES_BUILDLINK3_MK BUILDLINK_DEPTH:= ${BUILDLINK_DEPTH:S/+$//} diff --git a/devel/ncurses/builtin.mk b/devel/ncurses/builtin.mk new file mode 100644 index 00000000000..0303309a723 --- /dev/null +++ b/devel/ncurses/builtin.mk @@ -0,0 +1,133 @@ +# $NetBSD: builtin.mk,v 1.1 2004/03/10 17:57:14 jlam Exp $ + +.if !defined(_BLNK_LIBNCURSES_FOUND) +_BLNK_LIBNCURSES_FOUND!= \ + if [ "`${ECHO} /usr/lib/libncurses.*`" = "/usr/lib/libncurses.*" ]; then \ + ${ECHO} "no"; \ + else \ + ${ECHO} "yes"; \ + fi +MAKEFLAGS+= _BLNK_LIBNCURSES_FOUND=${_BLNK_LIBNCURSES_FOUND} +.endif + +_NCURSES_H= /usr/include/curses.h + +.if !defined(IS_BUILTIN.ncurses) +IS_BUILTIN.ncurses= no +. if !empty(_BLNK_LIBNCURSES_FOUND:M[yY][eE][sS]) +IS_BUILTIN.ncurses= yes +. elif exists(${_NCURSES_H}) +IS_BUILTIN.ncurses!= \ + if ${GREP} -q "\#define[ ]*NCURSES_VERSION" ${_NCURSES_H}; then \ + ${ECHO} "yes"; \ + else \ + ${ECHO} "no"; \ + fi +. if !empty(IS_BUILTIN.ncurses:M[yY][eE][sS]) +# +# Create an appropriate name for the built-in package distributed +# with the system. This package name can be used to check against +# BUILDLINK_DEPENDS.<pkg> to see if we need to install the pkgsrc +# version or if the built-in one is sufficient. +# +_NCURSES_VERSION!= \ + ${AWK} '/\#define[ ]*NCURSES_VERSION[ ]/ { \ + vers = $$3; \ + gsub("\"", "", vers); \ + print vers; \ + } \ + ' ${_NCURSES_H} +BUILTIN_PKG.ncurses= ncurses-${_NCURSES_VERSION} +MAKEFLAGS+= BUILTIN_PKG.ncurses=${BUILTIN_PKG.ncurses} +. endif +. endif +MAKEFLAGS+= IS_BUILTIN.ncurses=${IS_BUILTIN.ncurses} +.endif + +CHECK_BUILTIN.ncurses?= no +.if !empty(CHECK_BUILTIN.ncurses:M[yY][eE][sS]) +USE_BUILTIN.ncurses= yes +.endif + +.if !defined(USE_BUILTIN.ncurses) +USE_BUILTIN.ncurses?= ${IS_BUILTIN.ncurses} +PREFER.ncurses?= pkgsrc + +. if defined(BUILTIN_PKG.ncurses) +USE_BUILTIN.ncurses= yes +. for _depend_ in ${BUILDLINK_DEPENDS.ncurses} +. if !empty(IS_BUILTIN.ncurses:M[yY][eE][sS]) +USE_BUILTIN.ncurses!= \ + if ${PKG_ADMIN} pmatch '${_depend_}' ${BUILTIN_PKG.ncurses}; then \ + ${ECHO} "yes"; \ + else \ + ${ECHO} "no"; \ + fi +. endif +. endfor +. endif + +. if ${PREFER.ncurses} == "native" +# XXX +# XXX By default, assume that the native curses on NetBSD systems +# XXX supports ncurses. +# XXX +. if ${OPSYS} == "NetBSD" +USE_BUILTIN.ncurses= yes +# +# These versions of NetBSD didn't have a curses library that was +# capable of replacing ncurses. +# +# XXX In reality, no version of NetBSD has a curses library that can +# XXX completely replace ncurses; however, some versions implement +# XXX enough of ncurses that some packages are happy. +# +_INCOMPAT_CURSES= NetBSD-0.*-* NetBSD-1.[0123]*-* +_INCOMPAT_CURSES+= NetBSD-1.4.*-* NetBSD-1.4[A-X]-* +. for _pattern_ in ${_INCOMPAT_CURSES} ${INCOMPAT_CURSES} +. if !empty(MACHINE_PLATFORM:M${_pattern_}) +USE_BUILTIN.ncurses= no +. endif +. endfor +. endif +. endif + +. if defined(USE_NCURSES) +. if !empty(IS_BUILTIN.ncurses:M[nN][oO]) || \ + (${PREFER.ncurses} == "pkgsrc") +USE_BUILTIN.ncurses= no +. endif +. endif +.endif # USE_BUILTIN.ncurses + +.if !empty(USE_BUILTIN.ncurses:M[yY][eE][sS]) +. if !empty(_BLNK_LIBNCURSES_FOUND:M[nN][oO]) +BUILDLINK_TRANSFORM.ncurses+= -e "s|/curses\.h|/ncurses.h|g" +BUILDLINK_TRANSFORM+= l:ncurses:curses +. endif +BUILDLINK_FILES.ncurses+= include/curses.h + +BUILDLINK_TARGETS+= buildlink-ncurses-curses-h +BUILDLINK_TARGETS+= buildlink-ncurses-extra-includes + +.PHONY: buildlink-ncurses-extra-includes +buildlink-ncurses-extra-includes: + ${_PKG_SILENT}${_PKG_DEBUG} \ + extra_includes="include/term.h"; \ + for f in $${extra_includes}; do \ + if [ ! -f ${BUILDLINK_PREFIX.ncurses}/$$f ]; then \ + ${ECHO_BUILDLINK_MSG} "Touching extra ncurses header ($$f) in ${BUILDLINK_DIR}."; \ + ${TOUCH} ${TOUCH_FLAGS} ${BUILDLINK_DIR}/$$f; \ + fi; \ + done + +.PHONY: buildlink-ncurses-curses-h +buildlink-ncurses-curses-h: + ${_PKG_SILENT}${_PKG_DEBUG} \ + if [ ! -f ${BUILDLINK_DIR}/include/curses.h -a \ + -f ${BUILDLINK_PREFIX.ncurses}/include/ncurses.h ]; then \ + ${ECHO_BUILDLINK_MSG} "Linking curses.h -> ncurses.h."; \ + ${LN} -s ${BUILDLINK_PREFIX.ncurses}/include/ncurses.h \ + ${BUILDLINK_DIR}/include/curses.h; \ + fi +.endif |