summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjlam <jlam@pkgsrc.org>2008-03-05 07:10:26 +0000
committerjlam <jlam@pkgsrc.org>2008-03-05 07:10:26 +0000
commit5d2fb1d62cc6a141595c5838f88c67d4135ec606 (patch)
tree6aa8e96b2d28027267d21faa66cdeabde9946ea6
parent81f4e12abcee526def93cd3833237d6bf2e38dcf (diff)
downloadpkgsrc-5d2fb1d62cc6a141595c5838f88c67d4135ec606.tar.gz
+ Only remove -lcurses and -lncurses in BUILDLINK_TRANSFORM if the
package does not use either curses or ncurses. We determine this by inspecting BUILDLINK_PACKAGES and looking for "curses" and "ncurses". + Because the above logic uses BUILDLINK_PACKAGES, the code must be moved from termcap.buildlink3.mk into termcap.builtin.mk where it is safe to inspect BUILDLINK_PACKAGES.
-rw-r--r--mk/termcap.buildlink3.mk34
-rw-r--r--mk/termcap.builtin.mk39
2 files changed, 40 insertions, 33 deletions
diff --git a/mk/termcap.buildlink3.mk b/mk/termcap.buildlink3.mk
index 50c9e4851cd..68ef7da2c82 100644
--- a/mk/termcap.buildlink3.mk
+++ b/mk/termcap.buildlink3.mk
@@ -1,4 +1,4 @@
-# $NetBSD: termcap.buildlink3.mk,v 1.3 2008/03/05 03:58:20 jlam Exp $
+# $NetBSD: termcap.buildlink3.mk,v 1.4 2008/03/05 07:10:26 jlam Exp $
#
# This Makefile fragment is meant to be included by packages that require
# a termcap implementation that supports the basic termcap functions:
@@ -8,7 +8,8 @@
# === Variables set by this file ===
#
# TERMCAP_TYPE
-# The name of the selected termcap implementation.
+# The name of the selected termcap implementation. This is actually
+# indirectly set by termcap.builtin.mk but is exported by this file.
TERMCAP_BUILDLINK3_MK:= ${TERMCAP_BUILDLINK3_MK}+
@@ -16,39 +17,10 @@ TERMCAP_BUILDLINK3_MK:= ${TERMCAP_BUILDLINK3_MK}+
.if !empty(TERMCAP_BUILDLINK3_MK:M+)
-# _TERMCAP_TYPES is an exhaustive list of all of the termcap implementations
-# that may be found.
-#
-_TERMCAP_TYPES?= curses termcap termlib tinfo
-
CHECK_BUILTIN.termcap:= yes
. include "termcap.builtin.mk"
CHECK_BUILTIN.termcap:= no
-. if !empty(USE_BUILTIN.termcap:M[yY][eE][sS])
-. if defined(BUILTIN_LIBNAME.termcap)
-TERMCAP_TYPE= ${BUILTIN_LIBNAME.termcap}
-. else
-TERMCAP_TYPE= none
-. endif
-. else
-TERMCAP_TYPE= curses
-. endif
-BUILD_DEFS+= TERMCAP_TYPE
-
-# Most GNU configure scripts will try finding every termcap implementation,
-# so prevent them from finding any except for the one we decide upon.
-#
-.for _tcap_ in ${_TERMCAP_TYPES:Ntermcap}
-. if empty(TERMCAP_TYPE:M${_tcap_})
-BUILDLINK_TRANSFORM+= rm:-l${_tcap_}
-. endif
-.endfor
-.if empty(TERMCAP_TYPE:Mcurses)
-BUILDLINK_TRANSFORM+= rm:-lncurses
-.endif
-BUILDLINK_TRANSFORM+= l:termcap:${BUILDLINK_LIBNAME.termcap}
-
.endif # TERMCAP_BUILDLINK3_MK
.if ${TERMCAP_TYPE} == "none"
diff --git a/mk/termcap.builtin.mk b/mk/termcap.builtin.mk
index 52417f64ead..f93e4f3f19a 100644
--- a/mk/termcap.builtin.mk
+++ b/mk/termcap.builtin.mk
@@ -1,8 +1,13 @@
-# $NetBSD: termcap.builtin.mk,v 1.2 2008/03/02 07:05:28 jlam Exp $
+# $NetBSD: termcap.builtin.mk,v 1.3 2008/03/05 07:10:26 jlam Exp $
BUILTIN_PKG:= termcap
-BUILTIN_FIND_LIBS:= curses termcap termlib tinfo
+# _TERMCAP_TYPES is an exhaustive list of all of the termcap implementations
+# that may be found.
+#
+_TERMCAP_TYPES?= curses termcap termlib tinfo
+
+BUILTIN_FIND_LIBS:= ${_TERMCAP_TYPES}
.include "buildlink3/bsd.builtin.mk"
@@ -53,6 +58,17 @@ BUILTIN_LIBNAME.termcap= curses
BUILTIN_LIBNAME.termcap= termlib
.endif
+.if !empty(USE_BUILTIN.termcap:M[yY][eE][sS])
+. if defined(BUILTIN_LIBNAME.termcap)
+TERMCAP_TYPE= ${BUILTIN_LIBNAME.termcap}
+. else
+TERMCAP_TYPE= none
+. endif
+.else
+TERMCAP_TYPE= curses # pkgsrc termcap is curses
+.endif
+BUILD_DEFS+= TERMCAP_TYPE
+
###
### The section below only applies if we are not including this file
### solely to determine whether a built-in implementation exists.
@@ -64,4 +80,23 @@ CHECK_BUILTIN.termcap?= no
BUILDLINK_LIBNAME.termcap= ${BUILTIN_LIBNAME.termcap}
. endif
+# Most GNU configure scripts will try finding every termcap implementation,
+# so prevent them from finding any except for the one we decide upon.
+#
+# There is special handling here for packages that can be provided by
+# pkgsrc, e.g. curses. In case we need both that package as well as
+# termcap, we must not remove the -l options for that package's libraries.
+#
+. for _tcap_ in ${_TERMCAP_TYPES:Ntermcap:Ncurses}
+. if empty(TERMCAP_TYPE:M${_tcap_})
+BUILDLINK_TRANSFORM+= rm:-l${_tcap_}
+. endif
+. endfor
+. if empty(TERMCAP_TYPE:Mcurses) && \
+ empty(BUILDLINK_PACKAGES:Mcurses) && empty(BUILDLINK_PACKAGES:Mncurses)
+BUILDLINK_TRANSFORM+= rm:-lcurses
+BUILDLINK_TRANSFORM+= rm:-lncurses
+. endif
+BUILDLINK_TRANSFORM+= l:termcap:${BUILDLINK_LIBNAME.termcap}
+
.endif # CHECK_BUILTIN.termcap