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.
This commit is contained in:
ryoon 2013-07-19 14:35:37 +00:00
parent 0ced55d9f7
commit acd20b1327
4 changed files with 62 additions and 24 deletions

View file

@ -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_PKG:= editline
BUILTIN_FIND_LIBS:= edit BUILTIN_FIND_LIBS:= edit
BUILTIN_FIND_FILES_VAR:= H_EDITLINE 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" .include "../../mk/buildlink3/bsd.builtin.mk"
@ -45,8 +46,41 @@ USE_BUILTIN.editline= yes
. endif . endif
MAKEVARS+= USE_BUILTIN.readline 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:history:edit:${BUILTIN_LIBNAME.termcap}
BUILDLINK_TRANSFORM+= l:readline:edit:${BUILTIN_LIBNAME.termcap} BUILDLINK_TRANSFORM+= l:readline:edit:${BUILTIN_LIBNAME.termcap}
.endif .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 .endif # CHECK_BUILTIN.readline

View file

@ -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 BUILTIN_PKG:= readline
@ -6,9 +6,6 @@ BUILTIN_FIND_LIBS:= readline history
BUILTIN_FIND_FILES_VAR:= H_READLINE _BLTN_H_READLINE BUILTIN_FIND_FILES_VAR:= H_READLINE _BLTN_H_READLINE
BUILTIN_FIND_FILES.H_READLINE= /usr/include/readline/readline.h \ BUILTIN_FIND_FILES.H_READLINE= /usr/include/readline/readline.h \
/usr/include/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 BUILTIN_FIND_GREP.H_READLINE= \#define[ ]*RL_VERSION_MAJOR
.include "../../mk/buildlink3/bsd.builtin.mk" .include "../../mk/buildlink3/bsd.builtin.mk"
@ -70,7 +67,10 @@ USE_BUILTIN.readline!= \
# Some platforms don't have a readline/editline implementation that can # Some platforms don't have a readline/editline implementation that can
# replace GNU readline. # 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} . for _pattern_ in ${_INCOMPAT_READLINE} ${INCOMPAT_READLINE}
. if !empty(MACHINE_PLATFORM:M${_pattern_}) . if !empty(MACHINE_PLATFORM:M${_pattern_})
USE_BUILTIN.readline= no USE_BUILTIN.readline= no

View file

@ -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 # This Makefile fragment is meant to be included by packages that require
# any readline implementation instead of one particular one. The available # any readline implementation instead of one particular one. The available
@ -43,10 +43,12 @@ CHECK_BUILTIN.editlinereadline:= no
# #
.if defined(IS_BUILTIN.editline) && \ .if defined(IS_BUILTIN.editline) && \
!empty(IS_BUILTIN.editline:M[Yy][Ee][Ss]) !empty(IS_BUILTIN.editline:M[Yy][Ee][Ss])
READLINE_DEFAULT= editline READLINE_DEFAULT?= editline
.else if defined(IS_BUILTIN.readline) && \ .elif defined(IS_BUILTIN.readline) && \
!empty(IS_BUILTIN.readline:M[Yy][Ee][Ss]) !empty(IS_BUILTIN.readline:M[Yy][Ee][Ss])
READLINE_DEFAULT= readline READLINE_DEFAULT?= readline
.else
READLINE_DEFAULT?= editline
.endif .endif

View file

@ -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_PKG:= editlinereadline
BUILTIN_FIND_LIBS:= edit readline history 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 \ BUILTIN_FIND_FILES.H_READLINE= /usr/include/readline/readline.h \
/usr/include/readline.h /usr/include/readline.h
BUILTIN_FIND_FILES._BLTN_H_READLINE= \ BUILTIN_FIND_FILES.H_EDITLINE= /usr/include/editline/readline.h \
/usr/include/readline/readline.h \ /usr/include/readline/readline.h
/usr/include/readline.h BUILTIN_FIND_GREP.H_EDITLINE= NetBSD
BUILTIN_FIND_GREP.H_READLINE= \#define[ ]*RL_VERSION_MAJOR BUILTIN_FIND_GREP.H_READLINE= \#define[ ]*RL_VERSION_MAJOR
.include "../../mk/buildlink3/bsd.builtin.mk" .include "../../mk/buildlink3/bsd.builtin.mk"
.if !defined(IS_BUILTIN.editlinereadline) .if !defined(IS_BUILTIN.editlinereadline)
IS_BUILTIN.editlinereadline= no IS_BUILTIN.editlinereadline= no
. if empty(H_READLINE:M__nonexistent__) && \ . if empty(H_EDITLINE: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]) !empty(BUILTIN_LIB_FOUND.edit:M[yY][eE][sS])
IS_BUILTIN.editline= yes IS_BUILTIN.editline= yes
IS_BUILTIN.editlinereadline= 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
.endif .endif