commit:     00f988e1a48d08c5758de35771776104471ee97f
Author:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Tue Apr 16 15:12:26 2024 +0000
Commit:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Tue Apr 16 15:12:26 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=00f988e1

dev-build/ninja: enable docs build when cross-compiling

... if ninja is in PATH.

Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>

 dev-build/ninja/ninja-1.12.0.ebuild | 21 +++++++++++++--------
 dev-build/ninja/ninja-9999.ebuild   | 21 +++++++++++++--------
 2 files changed, 26 insertions(+), 16 deletions(-)

diff --git a/dev-build/ninja/ninja-1.12.0.ebuild 
b/dev-build/ninja/ninja-1.12.0.ebuild
index 932bf822922b..fd0e6fc7d748 100644
--- a/dev-build/ninja/ninja-1.12.0.ebuild
+++ b/dev-build/ninja/ninja-1.12.0.ebuild
@@ -44,17 +44,13 @@ pkg_setup() {
        :
 }
 
-docs_enabled() {
-       use doc && ! tc-is-cross-compiler
-}
-
 src_configure() {
        local mycmakeargs=(
                -DBUILD_TESTING=$(usex test ON OFF)
        )
        cmake_src_configure
 
-       if docs_enabled; then
+       if use doc; then
                python_setup
                edo ${EPYTHON} configure.py
        fi
@@ -63,8 +59,17 @@ src_configure() {
 src_compile() {
        cmake_src_compile
 
-       if docs_enabled; then
-               edo ./ninja -v -j1 doxygen manual
+       if use doc; then
+               local ninja=./ninja
+               if tc-is-cross-compiler; then
+                       ninja=$(type -P ninja)
+               fi
+               if [[ -n ${ninja} ]]; then
+                       edo "${ninja}" -v -j1 doxygen manual
+                       DOCS_BUILT=yes
+               else
+                       DOCS_BUILT=no
+               fi
        fi
 }
 
@@ -81,7 +86,7 @@ src_install() {
 
        mv "${ED}"/usr/bin/ninja{,-reference} || die
 
-       if docs_enabled; then
+       if [[ ${DOCS_BUILT} == yes ]]; then
                docinto html
                dodoc -r doc/doxygen/html/.
                dodoc doc/manual.html

diff --git a/dev-build/ninja/ninja-9999.ebuild 
b/dev-build/ninja/ninja-9999.ebuild
index 932bf822922b..fd0e6fc7d748 100644
--- a/dev-build/ninja/ninja-9999.ebuild
+++ b/dev-build/ninja/ninja-9999.ebuild
@@ -44,17 +44,13 @@ pkg_setup() {
        :
 }
 
-docs_enabled() {
-       use doc && ! tc-is-cross-compiler
-}
-
 src_configure() {
        local mycmakeargs=(
                -DBUILD_TESTING=$(usex test ON OFF)
        )
        cmake_src_configure
 
-       if docs_enabled; then
+       if use doc; then
                python_setup
                edo ${EPYTHON} configure.py
        fi
@@ -63,8 +59,17 @@ src_configure() {
 src_compile() {
        cmake_src_compile
 
-       if docs_enabled; then
-               edo ./ninja -v -j1 doxygen manual
+       if use doc; then
+               local ninja=./ninja
+               if tc-is-cross-compiler; then
+                       ninja=$(type -P ninja)
+               fi
+               if [[ -n ${ninja} ]]; then
+                       edo "${ninja}" -v -j1 doxygen manual
+                       DOCS_BUILT=yes
+               else
+                       DOCS_BUILT=no
+               fi
        fi
 }
 
@@ -81,7 +86,7 @@ src_install() {
 
        mv "${ED}"/usr/bin/ninja{,-reference} || die
 
-       if docs_enabled; then
+       if [[ ${DOCS_BUILT} == yes ]]; then
                docinto html
                dodoc -r doc/doxygen/html/.
                dodoc doc/manual.html

Reply via email to