diff options
author | Andreas K. Hüttel <dilfridge@gentoo.org> | 2017-09-20 15:42:09 +0200 |
---|---|---|
committer | Andreas K. Hüttel <dilfridge@gentoo.org> | 2017-09-20 15:43:13 +0200 |
commit | 736fb51ac990beb4c86c888c2b2b77014610e17c (patch) | |
tree | b2a6cef4626750ce571f6328fc2bbe591079845a | |
parent | Add use.desc (diff) | |
download | dilfridge-736fb51ac990beb4c86c888c2b2b77014610e17c.tar.gz dilfridge-736fb51ac990beb4c86c888c2b2b77014610e17c.tar.bz2 dilfridge-736fb51ac990beb4c86c888c2b2b77014610e17c.zip |
rpc.eclass: first complete version
-rw-r--r-- | eclass/rpc.eclass | 47 |
1 files changed, 32 insertions, 15 deletions
diff --git a/eclass/rpc.eclass b/eclass/rpc.eclass index 4a1473f..ca13033 100644 --- a/eclass/rpc.eclass +++ b/eclass/rpc.eclass @@ -20,16 +20,18 @@ case ${EAPI:-0} in *) die "${ECLASS}.eclass API in EAPI ${EAPI} not yet established." esac +RPC_ALL_IMPL=( sunrpc libtirpc ntirpc ) + # @ECLASS-VARIABLE: RPC_COMPAT # @DESCRIPTION: # This variable contains a list of RPC implementations the package # supports. It must be set before the `inherit' call; if not, the # package is assumed to be compatible with all known implementations. -# Example (the default): +# Example: # @CODE # RPC_COMPAT=( sunrpc libtirpc ntirpc ) # @CODE -: ${RPC_COMPAT:=( sunrpc libtirpc ntirpc )} +RPC_COMPAT=( "${RPC_COMPAT[@]:-${RPC_ALL_IMPL[@]}}" ) # @ECLASS-VARIABLE: RPC_REQUIRED # @DESCRIPTION: @@ -38,40 +40,31 @@ esac # If set to 'optional', a useflag 'rpc' is created. RPC_REQUIRED="${RPC_REQUIRED:-always}" -# @ECLASS-VARIABLE: RPC_CONFIGURE -# @DESCRIPTION: -# Contains a string to supply to a configure call as argument; suitable if the -# reference autoconf snippet is used for patching. In detail, the content is -# '--with-rpc=x', where x is one of sunrpc, libtirpc, ntirpc, depending on the -# use-flag settings. - local _rpc_rdepend="" local _rpc_depend="" -for i in "${RPC_COMPAT[@]}"; do +for i in ${RPC_COMPAT[@]}; do case "${i}" in sunrpc) _rpc_depend+="sunrpc? ( elibc_glibc? ( <sys-libs/glibc-2.26[rpc] ) ) " _rpc_rdepend+="sunrpc? ( elibc_glibc? ( <sys-libs/glibc-2.26[rpc] ) ) " IUSE+="sunrpc " - use sunrpc && RPC_CONFIGURE="--with-rpc=sunrpc" ;; libtirpc) _rpc_depend+="libtirpc? ( net-libs/libtirpc virtual/pkgconfig ) " _rpc_rdepend+="libtirpc? ( net-libs/libtirpc ) " IUSE+="libtirpc " - use libtirpc && RPC_CONFIGURE="--with-rpc=libtirpc" + ;; ntirpc) _rpc_depend+="ntirpc? ( net-libs/ntirpc virtual/pkgconfig ) " _rpc_rdepend+="ntirpc? ( net-libs/ntirpc ) " IUSE+="ntirpc " - use ntirpc && RPC_CONFIGURE="--with-rpc=ntirpc" ;; *) die "Unsupported RPC implementation ${i}" ;; - done + esac done case "${RPC_REQUIRED}" in @@ -87,9 +80,33 @@ case "${RPC_REQUIRED}" in *) die "Unsupported value for RPC_REQUIRED." ;; +esac + +declare -A _rpc_seen +local _rpc_required="(" +for word in ${RPC_COMPAT[@]}; do + if [ ! "${_rpc_seen[$word]}" ] + then + _rpc_required+=" $word" + seen[$word]=1 + fi done +if [[ ${_rpc_required} != "(" ]]; then + REQUIRED_USE="^^ ${_rpc_required} )" +fi -#REQUIRED_USE="^^ ( sunrpc libtirpc ntirpc )" +# @FUNCTION: rpc_configure +# @DESCRIPTION: +# Outputs a string useful for passing to a configure invocation. +# In detail, "--with-rpc=x", where x is either sunrpc, libtirpc, or +# ntirpc. +rpc_configure() { + local _rpc_configure + use sunrpc && _rpc_configure="--with-rpc=sunrpc" + use libtirpc && _rpc_configure="--with-rpc=libtirpc" + use ntirpc && _rpc_configure="--with-rpc=ntirpc" + echo ${_rpc_configure} +} unset _rpc_rdepend unset _rpc_depend |