pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/devel/readline Deal with built-in readline actually be...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/c5638d8bee37
branches:  trunk
changeset: 468884:c5638d8bee37
user:      jlam <jlam%pkgsrc.org@localhost>
date:      Tue Feb 17 15:57:55 2004 +0000

description:
Deal with built-in readline actually being GNU readline.

diffstat:

 devel/readline/buildlink3.mk |  99 ++++++++++++++++++++++++++++++++++---------
 1 files changed, 77 insertions(+), 22 deletions(-)

diffs (133 lines):

diff -r f6775b5f1ce1 -r c5638d8bee37 devel/readline/buildlink3.mk
--- a/devel/readline/buildlink3.mk      Tue Feb 17 15:36:06 2004 +0000
+++ b/devel/readline/buildlink3.mk      Tue Feb 17 15:57:55 2004 +0000
@@ -1,9 +1,4 @@
-# $NetBSD: buildlink3.mk,v 1.13 2004/02/12 02:35:06 jlam Exp $
-#
-# Optionally define USE_GNU_READLINE to force use of GNU readline.
-#
-# NOTE:        You may need to do some more work to get libedit recognized over
-#      libreadline, especially by GNU configure scripts.
+# $NetBSD: buildlink3.mk,v 1.14 2004/02/17 15:57:55 jlam Exp $
 
 BUILDLINK_DEPTH:=              ${BUILDLINK_DEPTH}+
 READLINE_BUILDLINK3_MK:=       ${READLINE_BUILDLINK3_MK}+
@@ -18,17 +13,81 @@
 
 BUILDLINK_CHECK_BUILTIN.readline?=     NO
 
+.if !defined(_BLNK_LIBREADLINE_FOUND)
+_BLNK_LIBREADLINE_FOUND!=      \
+       if [ "`${ECHO} /usr/lib/libreadline.*`" = "/usr/lib/libreadline.*" ]; then \
+               ${ECHO} "NO";                                           \
+       else                                                            \
+               ${ECHO} "YES";                                          \
+       fi
+MAKEFLAGS+=    _BLNK_LIBREADLINE_FOUND=${_BLNK_LIBREADLINE_FOUND}
+.endif
+
+.if !defined(_BLNK_LIBEDIT_FOUND)
+_BLNK_LIBEDIT_FOUND!=  \
+       if [ "`${ECHO} /usr/lib/libedit.*`" = "/usr/lib/libedit.*" ]; then \
+               ${ECHO} "NO";                                           \
+       else                                                            \
+               ${ECHO} "YES";                                          \
+       fi
+MAKEFLAGS+=    _BLNK_LIBEDIT_FOUND=${_BLNK_LIBEDIT_FOUND}
+.endif
+
+_READLINE_H=           /usr/include/readline.h
+_READLINE_READLINE_H=  /usr/include/readline/readline.h
+
 .if !defined(BUILDLINK_IS_BUILTIN.readline)
 BUILDLINK_IS_BUILTIN.readline= NO
-.  if exists(/usr/include/readline.h) || \
-      exists(/usr/include/readline/readline.h)
+.  if !empty(_BLNK_LIBREADLINE_FOUND:M[yY][eE][sS])
 BUILDLINK_IS_BUILTIN.readline= YES
+.  elif exists(${_READLINE_H}) || exists(${_READLINE_READLINE_H})
+.    if exists(${_READLINE_H})
+_READLINE_HEADER=      ${_READLINE_H}
+.    else
+_READLINE_HEADER=      ${_READLINE_READLINE_H}
+.    endif
+_IS_BUILTIN.readline!=         \
+       if ${GREP} -q "\#define[        ]*RL_VERSION_MAJOR" ${_READLINE_HEADER}; then \
+               ${ECHO} "YES";                                          \
+       else                                                            \
+               ${ECHO} "NO";                                           \
+       fi
+BUILDLINK_IS_BUILTIN.readline= ${_IS_BUILTIN.readline}
+.    if !empty(BUILDLINK_CHECK_BUILTIN.readline:M[nN][oO]) && \
+        !empty(_IS_BUILTIN.readline: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.
+#
+_READLINE_MAJOR!=                                                      \
+       ${AWK} '/\#define[      ]*RL_VERSION_MAJOR/ { print $$3 }'      \
+               ${_READLINE_HEADER}
+_READLINE_MINOR!=                                                      \
+       ${AWK} '/\#define[      ]*RL_VERSION_MINOR/ { print $$3 }'      \
+               ${_READLINE_HEADER}
+_READLINE_VERSION=     ${_READLINE_MAJOR}.${_READLINE_MINOR}
+_READLINE_PKG=         readline-${_READLINE_VERSION}
+BUILDLINK_IS_BUILTIN.readline= YES
+.      for _depend_ in ${BUILDLINK_DEPENDS.readline}
+.        if !empty(BUILDLINK_IS_BUILTIN.readline:M[yY][eE][sS])
+BUILDLINK_IS_BUILTIN.readline!=                                                \
+       if ${PKG_ADMIN} pmatch '${_depend_}' ${_READLINE_PKG}; then     \
+               ${ECHO} "YES";                                          \
+       else                                                            \
+               ${ECHO} "NO";                                           \
+       fi
+.        endif
+.      endfor
+.    endif
 .  endif
-.  if !empty(BUILDLINK_CHECK_BUILTIN.readline:M[nN][oO])
+#
+# XXX By default, assume that the native editline library supports readline.
 #
-# These catch-alls are probably too broad, but better to err on the safe
-# side.  We can narrow down the match when we have better information.
-#
+.  if !empty(_BLNK_LIBREADLINE_FOUND:M[nN][oO]) && \
+      !empty(_BLNK_LIBEDIT_FOUND:M[yY][eE][sS])
+BUILDLINK_IS_BUILTIN.readline= YES
 _INCOMPAT_READLINE?=   SunOS-*-*
 .    for _pattern_ in ${_INCOMPAT_READLINE} ${INCOMPAT_READLINE}
 .      if !empty(MACHINE_PLATFORM:M${_pattern_})
@@ -61,7 +120,11 @@
 .endif
 
 .if defined(USE_GNU_READLINE)
+.  if !empty(BUILDLINK_IS_BUILTIN.readline:M[yY][eE][sS]) && \
+      !empty(_BLNK_LIBREADLINE_FOUND:M[nN][oO]) && \
+      !empty(_BLNK_LIBEDIT_FOUND:M[yY][eE][sS])
 BUILDLINK_USE_BUILTIN.readline=        NO
+.  endif
 .endif
 
 .if !empty(BUILDLINK_CHECK_BUILTIN.readline:M[yY][eE][sS])
@@ -76,16 +139,8 @@
 
 .if !empty(READLINE_BUILDLINK3_MK:M+)
 .  if !empty(BUILDLINK_USE_BUILTIN.readline:M[yY][eE][sS])
-.    if !defined(_BLNK_LIBEDIT_FOUND)
-_BLNK_LIBEDIT_FOUND!=  \
-       if [ "`${ECHO} /usr/lib/libedit.*`" = "/usr/lib/libedit.*" ]; then \
-               ${ECHO} "NO";                                           \
-       else                                                            \
-               ${ECHO} "YES";                                          \
-       fi
-MAKEFLAGS+=    _BLNK_LIBEDIT_FOUND=${_BLNK_LIBEDIT_FOUND}
-.    endif
-.    if ${_BLNK_LIBEDIT_FOUND} == "YES"
+.    if !empty(_BLNK_LIBREADLINE_FOUND:M[nN][oO]) && \
+        !empty(_BLNK_LIBEDIT_FOUND:M[yY][eE][sS])
 BUILDLINK_TRANSFORM+=          l:history:edit
 BUILDLINK_TRANSFORM+=          l:readline:edit:termcap
 .    endif



Home | Main Index | Thread Index | Old Index