diff options
author | ryoon <ryoon> | 2013-07-15 01:54:25 +0000 |
---|---|---|
committer | ryoon <ryoon> | 2013-07-15 01:54:25 +0000 |
commit | 8a8d6d9e95d41e26b524080201869b2e41096b15 (patch) | |
tree | 77d0d0ba408f9a0d3dd698a5a21a5490841c5ae3 | |
parent | c9d29ec6c680d50f665716d8106269796a6a2ad5 (diff) | |
download | pkgsrc-8a8d6d9e95d41e26b524080201869b2e41096b15.tar.gz |
Add buildlink/builtin mechanism for devel/editline and devel/readline.
With this change, .include "../../devel/readline/buildlink3.mk" with
USE_GNU_READLINE=yes should be replaced with
.include "../../devel/readline/buildlink3.mk",
and .include "../../devel/readline/buildlink3.mk" without USE_GNU_READLINE
should be replaced .include "../../mk/readline.buildlink3.mk".
USE_GNU_READLINE is removed.
-rw-r--r-- | devel/readline/builtin.mk | 34 | ||||
-rw-r--r-- | mk/readline.buildlink3.mk | 84 | ||||
-rw-r--r-- | mk/readline.builtin.mk | 49 |
3 files changed, 135 insertions, 32 deletions
diff --git a/devel/readline/builtin.mk b/devel/readline/builtin.mk index 81935844662..14ed357152d 100644 --- a/devel/readline/builtin.mk +++ b/devel/readline/builtin.mk @@ -1,8 +1,8 @@ -# $NetBSD: builtin.mk,v 1.17 2008/02/29 22:41:13 jlam Exp $ +# $NetBSD: builtin.mk,v 1.18 2013/07/15 01:54:25 ryoon Exp $ BUILTIN_PKG:= readline -BUILTIN_FIND_LIBS:= edit readline history +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 @@ -66,16 +66,6 @@ USE_BUILTIN.readline!= \ . endif . endfor . endif -# XXX -# XXX By default, assume that the native editline library is good enough -# XXX to replace GNU readline if it provides the readline-compatibility -# XXX headers. -# XXX -. if !empty(BUILTIN_LIB_FOUND.readline:M[nN][oO]) && \ - !empty(BUILTIN_LIB_FOUND.edit:M[yY][eE][sS]) && \ - empty(_BLTN_H_READLINE:M__nonexistent__) -USE_BUILTIN.readline= yes -. endif # # Some platforms don't have a readline/editline implementation that can # replace GNU readline. @@ -90,15 +80,6 @@ USE_BUILTIN.readline= no .endif MAKEVARS+= USE_BUILTIN.readline -# If USE_GNU_READLINE is defined, then force the use of a GNU readline -# implementation. -# -.if defined(USE_GNU_READLINE) -. if !empty(IS_BUILTIN.readline:M[nN][oO]) -USE_BUILTIN.readline= no -. endif -.endif - ### ### The section below only applies if we are not including this file ### solely to determine whether a built-in implementation exists. @@ -107,18 +88,7 @@ CHECK_BUILTIN.readline?= no .if !empty(CHECK_BUILTIN.readline:M[nN][oO]) . if !empty(USE_BUILTIN.readline:M[yY][eE][sS]) -. if !empty(BUILTIN_LIB_FOUND.history:M[Nn][Oo]) && \ - !empty(BUILTIN_LIB_FOUND.readline:M[Yy][Ee][Ss]) BUILDLINK_TRANSFORM+= l:history:readline:${BUILTIN_LIBNAME.termcap} -. endif -. if !empty(BUILTIN_LIB_FOUND.history:M[nN][oO]) && \ - !empty(BUILTIN_LIB_FOUND.edit:M[yY][eE][sS]) -BUILDLINK_TRANSFORM+= l:history:edit:${BUILTIN_LIBNAME.termcap} -. endif -. if !empty(BUILTIN_LIB_FOUND.readline:M[nN][oO]) && \ - !empty(BUILTIN_LIB_FOUND.edit:M[yY][eE][sS]) -BUILDLINK_TRANSFORM+= l:readline:edit:${BUILTIN_LIBNAME.termcap} -. endif . endif .endif # CHECK_BUILTIN.readline diff --git a/mk/readline.buildlink3.mk b/mk/readline.buildlink3.mk new file mode 100644 index 00000000000..584722c14f8 --- /dev/null +++ b/mk/readline.buildlink3.mk @@ -0,0 +1,84 @@ +# $NetBSD: readline.buildlink3.mk,v 1.1 2013/07/15 01:54:25 ryoon Exp $ +# +# This Makefile fragment is meant to be included by packages that require +# any readline implementation instead of one particular one. The available +# readline/editline implementations are "editline" and "readline". +# +# If a package genuinely requires editline or readline, then it should +# directly include the appropriate buildlink3.mk instead of this file in +# the package Makefile. +# +# === User-settable variables === +# +# READLINE_DEFAULT +# This value represents the type of readline we wish to use on the +# system. Setting this to "editline" means that the system libedit +# implementation is fine or pkgsrc "editline" should be used. +# +# Possible: editline readline +# Default: (depends) +# +# === Variables set by this file === +# +# READLINE_TYPE +# The name of the selected readline implementation, editline or +# readline. + +EDITLINEREADLINE_BUILDLINK3_MK:= ${EDITLINEREADLINE_BUILDLINK3_MK}+ +.include "bsd.fast.prefs.mk" + +.if !empty(EDITLINEREADLINE_BUILDLINK3_MK:M+) + +# _READLINE_PKGS is an exhaustive list of all of the readline implementations +# that may be used with readline.buildlink3.mk. +# +_READLINE_PKGS?= editline readline + +CHECK_BUILTIN.editlinereadline:= yes +.include "readline.builtin.mk" +CHECK_BUILTIN.editlinereadline:= no + +# Set the value of READLINE_DEFAULT depending on the platform and what's +# available in the base system. +# +READLINE_DEFAULT?= editline + +_READLINE_ACCEPTED= # empty +.if defined(USE_BUILTIN.editlinereadline) && \ + !empty(USE_BUILTIN.editlinereadline:M[yY][eE][sS]) +_READLINE_ACCEPTED+= editline # system editline exists or pkgsrc editline +.endif +_READLINE_ACCEPTED+= readline # pkgsrc readline + +_READLINE_TYPE= ${READLINE_DEFAULT} +. if !empty(_READLINE_ACCEPTED:M${_READLINE_TYPE}) +READLINE_TYPE= ${_READLINE_TYPE} +. else +READLINE_TYPE= none +. endif + +BUILD_DEFS+= READLINE_DEFAULT +BUILD_DEFS_EFFECTS+= READLINE_TYPE + +# _PKG_USE_READLINE is a flag for use by the readline packages' buildlink3.mk +# files to indicate that the headers and libraries should be usable as +# <readline.h> etc. and -lreadline etc. +# +_PKG_USE_READLINE= yes + +.endif # EDITLINEREADLINE_BUILDLINK3_MK + +.if ${READLINE_TYPE} == "none" +PKG_FAIL_REASON= \ + "${_READLINE_TYPE} is not an acceptable readline type for ${PKGNAME}." +.elif ${READLINE_TYPE} == "editline" +. include "../../devel/editline/buildlink3.mk" +BUILDLINK_PREFIX.editlinereadline?= ${BUILDLINK_PREFIX.editline} +BUILDLINK_LIBNAME.editlinereadline?= ${BUILDLINK_LIBNAME.editline} +BUILDLINK_LDADD.editlinereadline?= ${BUILDLINK_LDADD.editline} +.elif ${READLINE_TYPE} == "readline" +. include "../../devel/readline/buildlink3.mk" +BUILDLINK_PREFIX.editlinereadline?= ${BUILDLINK_PREFIX.readline} +BUILDLINK_LIBNAME.editlinereadline?= ${BUILDLINK_LIBNAME.readline} +BUILDLINK_LDADD.editlinereadline?= ${BUILDLINK_LDADD.readline} +.endif diff --git a/mk/readline.builtin.mk b/mk/readline.builtin.mk new file mode 100644 index 00000000000..e9093aae90e --- /dev/null +++ b/mk/readline.builtin.mk @@ -0,0 +1,49 @@ +# $NetBSD: readline.builtin.mk,v 1.1 2013/07/15 01:54:25 ryoon Exp $ +# + +BUILTIN_PKG:= editlinereadline + +BUILTIN_FIND_LIBS:= edit 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" + +.if !defined(IS_BUILTIN.editlinereadline) +IS_BUILTIN.readline= no +. if empty(H_READLINE:M__nonexistent__) && \ + empty(H_READLINE:M${LOCALBASE}/*) && \ + !empty(BUILTIN_LIB_FOUND.readline:M[yY][eE][sS]) +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]) +IS_BUILTIN.editlinereadline= yes +. endif +.endif + +.if !defined(USE_BUILTIN.editlinereadline) +. if ${PREFER.editlinereadline} == "pkgsrc" +USE_BUILTIN.editlinereadline= no +. else +USE_BUILTIN.editlinereadline= ${IS_BUILTIN.editlinereadline} +. endif +.endif + +CHECK_BUILTIN.editlinereadline= no +.if empty(CHECK_BUILTIN.editlinereadline:M[Nn][Oo]) +. if !empty(USE_BUILTIN.editlinereadline:M[Yy][Ee][Ss]) +. if !empty(_READLINE_TYPE:Meditline) +. include "../../devel/editline/builtin.mk" +IS_BUILTIN.editlinereadline= ${USE_BUILTIN.editline} +. else if !empty(_READLINE_TYPE:Mreadline) +. include "../../devel/readline/builtin.mk" +IS_BUILTIN.editlinereadline= ${USE_BUILTIN.readline} +. endif +. endif +.endif |