Wed Mar 5 16:23:52 2008 UTC ()
+ Fix error in previous commit -- too much of the termcap buildlink
  code was moved to the builtin.mk file.  The buildlink3.mk file should
  contain the bits that always apply to all packages that include it.
  The builtin.mk file should include the bits that only apply if
  "termcap" is listed in ${BUILDLINK_PACKAGES} (this isn't the case
  if we use curses to replace termcap).  As such, redistribute the
  code as follows:

    + Move the parts that remove -l options for terminal libraries we
      don't support, as well as for transforming "-ltermcap" into the
      appropriate libraries, from the builtin.mk back into the
      buildlink3.mk.

    + Leave the parts the remove -lcurses and -lncurses in the
      builtin.mk.  We can remove the ${TERMCAP_TYPE} == "curses" check
      since that part of the file is protected by CHECK_BUILTIN.termcap,
      so it should only be triggered if "termcap" is in BUILDLINK_PACKAGES,
      which only happens if ${TERMCAP_TYPE} isn't "curses".


(jlam)
diff -r1.4 -r1.5 pkgsrc/mk/termcap.buildlink3.mk
diff -r1.3 -r1.4 pkgsrc/mk/termcap.builtin.mk

cvs diff -r1.4 -r1.5 pkgsrc/mk/termcap.buildlink3.mk (expand / switch to unified diff)

--- pkgsrc/mk/termcap.buildlink3.mk 2008/03/05 07:10:26 1.4
+++ pkgsrc/mk/termcap.buildlink3.mk 2008/03/05 16:23:52 1.5
@@ -1,36 +1,64 @@ @@ -1,36 +1,64 @@
1# $NetBSD: termcap.buildlink3.mk,v 1.4 2008/03/05 07:10:26 jlam Exp $ 1# $NetBSD: termcap.buildlink3.mk,v 1.5 2008/03/05 16:23:52 jlam Exp $
2# 2#
3# This Makefile fragment is meant to be included by packages that require 3# This Makefile fragment is meant to be included by packages that require
4# a termcap implementation that supports the basic termcap functions: 4# a termcap implementation that supports the basic termcap functions:
5# 5#
6# tgetent, tgetstr, tgetflag, tgetnum, tgoto, tputs 6# tgetent, tgetstr, tgetflag, tgetnum, tgoto, tputs
7# 7#
8# === Variables set by this file === 8# === Variables set by this file ===
9# 9#
10# TERMCAP_TYPE 10# TERMCAP_TYPE
11# The name of the selected termcap implementation. This is actually 11# The name of the selected termcap implementation.
12# indirectly set by termcap.builtin.mk but is exported by this file. 
13 12
14TERMCAP_BUILDLINK3_MK:= ${TERMCAP_BUILDLINK3_MK}+ 13TERMCAP_BUILDLINK3_MK:= ${TERMCAP_BUILDLINK3_MK}+
15 14
16.include "bsd.fast.prefs.mk" 15.include "bsd.fast.prefs.mk"
17 16
18.if !empty(TERMCAP_BUILDLINK3_MK:M+) 17.if !empty(TERMCAP_BUILDLINK3_MK:M+)
19 18
 19# _TERMCAP_TYPES is an exhaustive list of all of the termcap
 20# implementations that may be found.
 21#
 22_TERMCAP_TYPES?= curses termcap termlib tinfo
 23
20CHECK_BUILTIN.termcap:= yes 24CHECK_BUILTIN.termcap:= yes
21. include "termcap.builtin.mk" 25. include "termcap.builtin.mk"
22CHECK_BUILTIN.termcap:= no 26CHECK_BUILTIN.termcap:= no
23 27
 28.if !empty(USE_BUILTIN.termcap:M[yY][eE][sS])
 29. if defined(BUILTIN_LIBNAME.termcap)
 30TERMCAP_TYPE= ${BUILTIN_LIBNAME.termcap}
 31. else
 32TERMCAP_TYPE= none
 33. endif
 34.else
 35TERMCAP_TYPE= curses # pkgsrc termcap is curses
 36.endif
 37BUILD_DEFS+= TERMCAP_TYPE
 38
 39# Most GNU configure scripts will try finding every termcap implementation,
 40# so prevent them from finding any except for the one we decide upon.
 41#
 42# There is special handling for packages that can be provided by pkgsrc,
 43# e.g. curses -- see termcap.builtin.mk for details.
 44#
 45. for _tcap_ in ${_TERMCAP_TYPES:Ntermcap:Ncurses}
 46. if empty(TERMCAP_TYPE:M${_tcap_})
 47BUILDLINK_TRANSFORM+= rm:-l${_tcap_}
 48. endif
 49. endfor
 50BUILDLINK_TRANSFORM+= l:termcap:${BUILDLINK_LIBNAME.termcap}
 51
24.endif # TERMCAP_BUILDLINK3_MK 52.endif # TERMCAP_BUILDLINK3_MK
25 53
26.if ${TERMCAP_TYPE} == "none" 54.if ${TERMCAP_TYPE} == "none"
27PKG_FAIL_REASON= "No usable termcap library found on the system." 55PKG_FAIL_REASON= "No usable termcap library found on the system."
28.elif (${TERMCAP_TYPE} == "termlib") || \ 56.elif (${TERMCAP_TYPE} == "termlib") || \
29 (${TERMCAP_TYPE} == "termcap") || \ 57 (${TERMCAP_TYPE} == "termcap") || \
30 (${TERMCAP_TYPE} == "tinfo") 58 (${TERMCAP_TYPE} == "tinfo")
31BUILDLINK_PACKAGES:= ${BUILDLINK_PACKAGES:Ntermcap} 59BUILDLINK_PACKAGES:= ${BUILDLINK_PACKAGES:Ntermcap}
32BUILDLINK_PACKAGES+= termcap 60BUILDLINK_PACKAGES+= termcap
33BUILDLINK_ORDER:= ${BUILDLINK_ORDER} ${BUILDLINK_DEPTH}termcap 61BUILDLINK_ORDER:= ${BUILDLINK_ORDER} ${BUILDLINK_DEPTH}termcap
34BUILDLINK_LIBNAME.termcap?= ${BUILTIN_LIBNAME.termcap} 62BUILDLINK_LIBNAME.termcap?= ${BUILTIN_LIBNAME.termcap}
35BUILDLINK_LDADD.termcap?= ${BUILDLINK_LIBNAME.termcap:S/^/-l/:S/^-l$//} 63BUILDLINK_LDADD.termcap?= ${BUILDLINK_LIBNAME.termcap:S/^/-l/:S/^-l$//}
36BUILDLINK_BUILTIN_MK.termcap= ../../mk/termcap.builtin.mk 64BUILDLINK_BUILTIN_MK.termcap= ../../mk/termcap.builtin.mk

cvs diff -r1.3 -r1.4 pkgsrc/mk/termcap.builtin.mk (expand / switch to unified diff)

--- pkgsrc/mk/termcap.builtin.mk 2008/03/05 07:10:26 1.3
+++ pkgsrc/mk/termcap.builtin.mk 2008/03/05 16:23:52 1.4
@@ -1,23 +1,18 @@ @@ -1,23 +1,18 @@
1# $NetBSD: termcap.builtin.mk,v 1.3 2008/03/05 07:10:26 jlam Exp $ 1# $NetBSD: termcap.builtin.mk,v 1.4 2008/03/05 16:23:52 jlam Exp $
2 2
3BUILTIN_PKG:= termcap 3BUILTIN_PKG:= termcap
4 4
5# _TERMCAP_TYPES is an exhaustive list of all of the termcap implementations 5BUILTIN_FIND_LIBS:= curses termcap termlib tinfo
6# that may be found. 
7# 
8_TERMCAP_TYPES?= curses termcap termlib tinfo 
9 
10BUILTIN_FIND_LIBS:= ${_TERMCAP_TYPES} 
11 6
12.include "buildlink3/bsd.builtin.mk" 7.include "buildlink3/bsd.builtin.mk"
13 8
14### 9###
15### Determine if there is a built-in implementation of the package and 10### Determine if there is a built-in implementation of the package and
16### set IS_BUILTIN.<pkg> appropriately ("yes" or "no"). 11### set IS_BUILTIN.<pkg> appropriately ("yes" or "no").
17### 12###
18.if !defined(IS_BUILTIN.termcap) 13.if !defined(IS_BUILTIN.termcap)
19IS_BUILTIN.termcap= no 14IS_BUILTIN.termcap= no
20. if !empty(BUILTIN_LIB_FOUND.curses:M[yY][eE][sS]) || \ 15. if !empty(BUILTIN_LIB_FOUND.curses:M[yY][eE][sS]) || \
21 !empty(BUILTIN_LIB_FOUND.termcap:M[yY][eE][sS]) || \ 16 !empty(BUILTIN_LIB_FOUND.termcap:M[yY][eE][sS]) || \
22 !empty(BUILTIN_LIB_FOUND.termlib:M[yY][eE][sS]) || \ 17 !empty(BUILTIN_LIB_FOUND.termlib:M[yY][eE][sS]) || \
23 !empty(BUILTIN_LIB_FOUND.tinfo:M[yY][eE][sS]) 18 !empty(BUILTIN_LIB_FOUND.tinfo:M[yY][eE][sS])
@@ -48,55 +43,35 @@ MAKEVARS+= USE_BUILTIN.termcap @@ -48,55 +43,35 @@ MAKEVARS+= USE_BUILTIN.termcap
48# XXX symbols in libraries, we'll need to be clever with looking at 43# XXX symbols in libraries, we'll need to be clever with looking at
49# XXX headers. 44# XXX headers.
50# 45#
51.if !empty(BUILTIN_LIB_FOUND.termcap:M[yY][eE][sS]) 46.if !empty(BUILTIN_LIB_FOUND.termcap:M[yY][eE][sS])
52BUILTIN_LIBNAME.termcap= termcap 47BUILTIN_LIBNAME.termcap= termcap
53.elif !empty(BUILTIN_LIB_FOUND.tinfo:M[yY][eE][sS]) 48.elif !empty(BUILTIN_LIB_FOUND.tinfo:M[yY][eE][sS])
54BUILTIN_LIBNAME.termcap= tinfo 49BUILTIN_LIBNAME.termcap= tinfo
55.elif !empty(BUILTIN_LIB_FOUND.curses:M[yY][eE][sS]) 50.elif !empty(BUILTIN_LIB_FOUND.curses:M[yY][eE][sS])
56BUILTIN_LIBNAME.termcap= curses 51BUILTIN_LIBNAME.termcap= curses
57.elif !empty(BUILTIN_LIB_FOUND.termlib:M[yY][eE][sS]) 52.elif !empty(BUILTIN_LIB_FOUND.termlib:M[yY][eE][sS])
58BUILTIN_LIBNAME.termcap= termlib 53BUILTIN_LIBNAME.termcap= termlib
59.endif 54.endif
60 55
61.if !empty(USE_BUILTIN.termcap:M[yY][eE][sS]) 
62. if defined(BUILTIN_LIBNAME.termcap) 
63TERMCAP_TYPE= ${BUILTIN_LIBNAME.termcap} 
64. else 
65TERMCAP_TYPE= none 
66. endif 
67.else 
68TERMCAP_TYPE= curses # pkgsrc termcap is curses 
69.endif 
70BUILD_DEFS+= TERMCAP_TYPE 
71 
72### 56###
73### The section below only applies if we are not including this file 57### The section below only applies if we are not including this file
74### solely to determine whether a built-in implementation exists. 58### solely to determine whether a built-in implementation exists.
75### 59###
76CHECK_BUILTIN.termcap?= no 60CHECK_BUILTIN.termcap?= no
77.if !empty(CHECK_BUILTIN.termcap:M[nN][oO]) 61.if !empty(CHECK_BUILTIN.termcap:M[nN][oO])
78 62
79. if !empty(USE_BUILTIN.termcap:M[yY][eE][sS]) 63. if !empty(USE_BUILTIN.termcap:M[yY][eE][sS])
80BUILDLINK_LIBNAME.termcap= ${BUILTIN_LIBNAME.termcap} 64BUILDLINK_LIBNAME.termcap= ${BUILTIN_LIBNAME.termcap}
81. endif 65. endif
82 66
83# Most GNU configure scripts will try finding every termcap implementation, 67# If the package wants both "termcap" and "curses", then we must not
84# so prevent them from finding any except for the one we decide upon. 68# remove the -l options for the curses libraries; otherwise, we should
85# 69# remove them as GNU configure scripts commonly check for one or both
86# There is special handling here for packages that can be provided by 70# of those library options.
87# pkgsrc, e.g. curses. In case we need both that package as well as 
88# termcap, we must not remove the -l options for that package's libraries. 
89# 71#
90. for _tcap_ in ${_TERMCAP_TYPES:Ntermcap:Ncurses} 72. if empty(BUILDLINK_PACKAGES:Mcurses) && empty(BUILDLINK_PACKAGES:Mncurses)
91. if empty(TERMCAP_TYPE:M${_tcap_}) 
92BUILDLINK_TRANSFORM+= rm:-l${_tcap_} 
93. endif 
94. endfor 
95. if empty(TERMCAP_TYPE:Mcurses) && \ 
96 empty(BUILDLINK_PACKAGES:Mcurses) && empty(BUILDLINK_PACKAGES:Mncurses) 
97BUILDLINK_TRANSFORM+= rm:-lcurses 73BUILDLINK_TRANSFORM+= rm:-lcurses
98BUILDLINK_TRANSFORM+= rm:-lncurses 74BUILDLINK_TRANSFORM+= rm:-lncurses
99. endif 75. endif
100BUILDLINK_TRANSFORM+= l:termcap:${BUILDLINK_LIBNAME.termcap} 
101 76
102.endif # CHECK_BUILTIN.termcap 77.endif # CHECK_BUILTIN.termcap