commit:     e38913efbae82f8888a6232162b775f744da2f72
Author:     Chris Mayo <aklhfex <AT> gmail <DOT> com>
AuthorDate: Tue Mar 24 19:49:57 2020 +0000
Commit:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
CommitDate: Wed Apr  1 10:34:10 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e38913ef

waf-utils.eclass: Support --docdir and --htmldir

waf can optionally set the standard GNU directories [1].
Based on the code for econf in Portage's phase-helpers.sh.

[1] https://waf.io/apidocs/tools/gnu_dirs.html

Closes: https://bugs.gentoo.org/711612
Signed-off-by: Chris Mayo <aklhfex <AT> gmail.com>
Signed-off-by: Mikle Kolyada <zlogene <AT> gentoo.org>

 eclass/waf-utils.eclass | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/eclass/waf-utils.eclass b/eclass/waf-utils.eclass
index 2cb26bc8dfd..a944195b162 100644
--- a/eclass/waf-utils.eclass
+++ b/eclass/waf-utils.eclass
@@ -69,7 +69,7 @@ waf-utils_src_configure() {
 
        [[ ${fail} ]] && die "Invalid use of waf-utils.eclass"
 
-       local libdir=()
+       local conf_args=()
 
        # @ECLASS-VARIABLE: WAF_BINARY
        # @DESCRIPTION:
@@ -81,7 +81,15 @@ waf-utils_src_configure() {
        # @DESCRIPTION:
        # Variable specifying that you don't want to set the libdir for waf 
script.
        # Some scripts does not allow setting it at all and die if they find it.
-       [[ -z ${NO_WAF_LIBDIR} ]] && 
libdir=(--libdir="${EPREFIX}/usr/$(get_libdir)")
+       [[ -z ${NO_WAF_LIBDIR} ]] && 
conf_args+=(--libdir="${EPREFIX}/usr/$(get_libdir)")
+
+       local waf_help=$("${WAF_BINARY}" --help 2>/dev/null)
+       if [[ ${waf_help} == *--docdir* ]]; then
+               conf_args+=( --docdir="${EPREFIX}"/usr/share/doc/${PF} )
+       fi
+       if [[ ${waf_help} == *--htmldir* ]]; then
+               conf_args+=( --htmldir="${EPREFIX}"/usr/share/doc/${PF}/html )
+       fi
 
        tc-export AR CC CPP CXX RANLIB
 
@@ -91,7 +99,7 @@ waf-utils_src_configure() {
                PKGCONFIG="$(tc-getPKG_CONFIG)"
                "${WAF_BINARY}"
                "--prefix=${EPREFIX}/usr"
-               "${libdir[@]}"
+               "${conf_args[@]}"
                "${@}"
                configure
        )

Reply via email to