From acd20b1327c386a41d33acaf2a4057777a52f65c Mon Sep 17 00:00:00 2001 From: ryoon Date: Fri, 19 Jul 2013 14:35:37 +0000 Subject: [PATCH] Fix builtin detection conditionals. * Correct detection of following cases. non-editline/readline, editline/non-readline, and editline/readline. * If builtin editline has header files in include/editline, create include/readline/* symlinks. * Fix PR pkg/48062 with above fixes. Confirmed on Ubuntu Linux/amd64 13.04. --- devel/editline/builtin.mk | 38 ++++++++++++++++++++++++++++++++++++-- devel/readline/builtin.mk | 10 +++++----- mk/readline.buildlink3.mk | 10 ++++++---- mk/readline.builtin.mk | 28 +++++++++++++++------------- 4 files changed, 62 insertions(+), 24 deletions(-) diff --git a/devel/editline/builtin.mk b/devel/editline/builtin.mk index 14144e01059e..2bfd9783475f 100644 --- a/devel/editline/builtin.mk +++ b/devel/editline/builtin.mk @@ -1,10 +1,11 @@ -# $NetBSD: builtin.mk,v 1.1 2013/07/15 01:42:47 ryoon Exp $ +# $NetBSD: builtin.mk,v 1.2 2013/07/19 14:35:37 ryoon Exp $ BUILTIN_PKG:= editline BUILTIN_FIND_LIBS:= edit BUILTIN_FIND_FILES_VAR:= H_EDITLINE -BUILTIN_FIND_FILES.H_EDITLINE= /usr/include/readline/readline.h +BUILTIN_FIND_FILES.H_EDITLINE= /usr/include/editline/readline.h \ + /usr/include/readline/readline.h .include "../../mk/buildlink3/bsd.builtin.mk" @@ -45,8 +46,41 @@ USE_BUILTIN.editline= yes . endif MAKEVARS+= USE_BUILTIN.readline +.if !empty(H_EDITLINE:M/usr/include/editline/readline.h) +BUILDLINK_TARGETS+= buildlink-readline-readline-h +BUILDLINK_TARGETS+= buildlink-readline-history-h +.endif + BUILDLINK_TRANSFORM+= l:history:edit:${BUILTIN_LIBNAME.termcap} BUILDLINK_TRANSFORM+= l:readline:edit:${BUILTIN_LIBNAME.termcap} .endif +. if !target(buildlink-readline-readline-h) +.PHONY: buildlink-readline-readline-h +buildlink-readline-readline-h: + ${RUN} \ + src=${H_EDITLINE:Q}; \ + dest=${BUILDLINK_DIR}"/include/readline/readline.h"; \ + if ${TEST} ! -f "$$dest" -a -f "$$src"; then \ + fname=`${BASENAME} $$src`; \ + ${ECHO_BUILDLINK_MSG} "Linking $$fname -> readline.h."; \ + ${MKDIR} `${DIRNAME} "$$dest"`; \ + ${LN} -s "$$src" "$$dest"; \ + fi +. endif + +. if !target(buildlink-readline-history-h) +.PHONY: buildlink-readline-history-h +buildlink-readline-history-h: + ${RUN} \ + src=${H_EDITLINE:Q}; \ + dest=${BUILDLINK_DIR}"/include/readline/history.h"; \ + if ${TEST} ! -f "$$dest" -a -f "$$src"; then \ + fname=`${BASENAME} $$src`; \ + ${ECHO_BUILDLINK_MSG} "Linking $$fname -> history.h."; \ + ${MKDIR} `${DIRNAME} "$$dest"`; \ + ${LN} -s "$$src" "$$dest"; \ + fi +. endif + .endif # CHECK_BUILTIN.readline diff --git a/devel/readline/builtin.mk b/devel/readline/builtin.mk index 14ed357152d7..e9baced43a7d 100644 --- a/devel/readline/builtin.mk +++ b/devel/readline/builtin.mk @@ -1,4 +1,4 @@ -# $NetBSD: builtin.mk,v 1.18 2013/07/15 01:54:25 ryoon Exp $ +# $NetBSD: builtin.mk,v 1.19 2013/07/19 14:35:37 ryoon Exp $ BUILTIN_PKG:= readline @@ -6,9 +6,6 @@ BUILTIN_FIND_LIBS:= readline history BUILTIN_FIND_FILES_VAR:= H_READLINE _BLTN_H_READLINE BUILTIN_FIND_FILES.H_READLINE= /usr/include/readline/readline.h \ /usr/include/readline.h -BUILTIN_FIND_FILES._BLTN_H_READLINE= \ - /usr/include/readline/readline.h \ - /usr/include/readline.h BUILTIN_FIND_GREP.H_READLINE= \#define[ ]*RL_VERSION_MAJOR .include "../../mk/buildlink3/bsd.builtin.mk" @@ -70,7 +67,10 @@ USE_BUILTIN.readline!= \ # Some platforms don't have a readline/editline implementation that can # replace GNU readline. # -_INCOMPAT_READLINE?= SunOS-*-* Darwin-[567].*-* Interix-*-* +_INCOMPAT_READLINE?= Darwin-[567].*-* Interix-*-* +. if defined(OS_VARIANT) && empty(OS_VARIANT:MOmniOS) +_INCOMPAT_READLINE+= SunOS-*-* +. endif . for _pattern_ in ${_INCOMPAT_READLINE} ${INCOMPAT_READLINE} . if !empty(MACHINE_PLATFORM:M${_pattern_}) USE_BUILTIN.readline= no diff --git a/mk/readline.buildlink3.mk b/mk/readline.buildlink3.mk index a687f80c2bc7..9d794ef1c13c 100644 --- a/mk/readline.buildlink3.mk +++ b/mk/readline.buildlink3.mk @@ -1,4 +1,4 @@ -# $NetBSD: readline.buildlink3.mk,v 1.2 2013/07/18 14:59:04 ryoon Exp $ +# $NetBSD: readline.buildlink3.mk,v 1.3 2013/07/19 14:35:37 ryoon Exp $ # # This Makefile fragment is meant to be included by packages that require # any readline implementation instead of one particular one. The available @@ -43,10 +43,12 @@ CHECK_BUILTIN.editlinereadline:= no # .if defined(IS_BUILTIN.editline) && \ !empty(IS_BUILTIN.editline:M[Yy][Ee][Ss]) -READLINE_DEFAULT= editline -.else if defined(IS_BUILTIN.readline) && \ +READLINE_DEFAULT?= editline +.elif defined(IS_BUILTIN.readline) && \ !empty(IS_BUILTIN.readline:M[Yy][Ee][Ss]) -READLINE_DEFAULT= readline +READLINE_DEFAULT?= readline +.else +READLINE_DEFAULT?= editline .endif diff --git a/mk/readline.builtin.mk b/mk/readline.builtin.mk index 226eb80e70fd..9f43e5cfe025 100644 --- a/mk/readline.builtin.mk +++ b/mk/readline.builtin.mk @@ -1,31 +1,33 @@ -# $NetBSD: readline.builtin.mk,v 1.2 2013/07/18 14:59:04 ryoon Exp $ +# $NetBSD: readline.builtin.mk,v 1.3 2013/07/19 14:35:37 ryoon Exp $ # BUILTIN_PKG:= editlinereadline BUILTIN_FIND_LIBS:= edit readline history -BUILTIN_FIND_FILES_VAR:= H_READLINE _BLTN_H_READLINE +BUILTIN_FIND_FILES_VAR:= H_EDITLINE H_READLINE BUILTIN_FIND_FILES.H_READLINE= /usr/include/readline/readline.h \ /usr/include/readline.h -BUILTIN_FIND_FILES._BLTN_H_READLINE= \ - /usr/include/readline/readline.h \ - /usr/include/readline.h +BUILTIN_FIND_FILES.H_EDITLINE= /usr/include/editline/readline.h \ + /usr/include/readline/readline.h +BUILTIN_FIND_GREP.H_EDITLINE= NetBSD BUILTIN_FIND_GREP.H_READLINE= \#define[ ]*RL_VERSION_MAJOR .include "../../mk/buildlink3/bsd.builtin.mk" .if !defined(IS_BUILTIN.editlinereadline) IS_BUILTIN.editlinereadline= no -. if empty(H_READLINE:M__nonexistent__) && \ - empty(H_READLINE:M${LOCALBASE}/*) && \ - !empty(BUILTIN_LIB_FOUND.readline:M[yY][eE][sS]) -IS_BUILTIN.readline= yes -IS_BUILTIN.editlinereadline= yes -. else if empty(_BLTN_H_READLINE:M__nonexistent__) && \ - !empty(BUILTIN_LIB_FOUND.readline:M[nN][oO]) && \ - !empty(BUILTIN_LIB_FOUND.edit:M[yY][eE][sS]) +. if empty(H_EDITLINE:M__nonexistent__) && \ + !empty(BUILTIN_LIB_FOUND.edit:M[yY][eE][sS]) IS_BUILTIN.editline= yes IS_BUILTIN.editlinereadline= yes +. elif empty(H_READLINE:M__nonexistent__) && \ + !empty(BUILTIN_LIB_FOUND.readline:M[yY][eE][sS]) +IS_BUILTIN.readline= yes +IS_BUILTIN.editlinereadline= yes +. else +IS_BUILTIN.editline= no +IS_BUILTIN.readline= no +IS_BUILTIN.editlinereadline= no . endif .endif