commit:     1122aa04647a60de150811c133490d248de4bc43
Author:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Thu Apr 18 19:27:38 2024 +0000
Commit:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Thu Apr 18 19:30:03 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1122aa04

dev-build/ninja: improve docs support when cross-compiling

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, 22 insertions(+), 20 deletions(-)

diff --git a/dev-build/ninja/ninja-1.12.0.ebuild 
b/dev-build/ninja/ninja-1.12.0.ebuild
index fd0e6fc7d748..c7a7c9ee0b26 100644
--- a/dev-build/ninja/ninja-1.12.0.ebuild
+++ b/dev-build/ninja/ninja-1.12.0.ebuild
@@ -3,7 +3,6 @@
 
 EAPI=8
 
-CMAKE_IN_SOURCE_BUILD=1 # Simplifies doc build
 CMAKE_MAKEFILE_GENERATOR=emake
 PYTHON_COMPAT=( python3_{10..12} )
 
@@ -51,6 +50,13 @@ src_configure() {
        cmake_src_configure
 
        if use doc; then
+               if tc-is-cross-compiler; then
+                       mycmakeargs=( -DBUILD_TESTING=OFF )
+                       local BUILD_DIR=${WORKDIR}/native
+                       local SYSROOT=
+                       tc-env_build cmake_src_configure
+               fi
+
                python_setup
                edo ${EPYTHON} configure.py
        fi
@@ -60,16 +66,11 @@ src_compile() {
        cmake_src_compile
 
        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
+                       local BUILD_DIR=${WORKDIR}/native
+                       cmake_build ninja
                fi
+               edo "${BUILD_DIR}/ninja" -v -j1 doxygen manual
        fi
 }
 
@@ -86,7 +87,7 @@ src_install() {
 
        mv "${ED}"/usr/bin/ninja{,-reference} || die
 
-       if [[ ${DOCS_BUILT} == yes ]]; then
+       if use doc; 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 fd0e6fc7d748..c7a7c9ee0b26 100644
--- a/dev-build/ninja/ninja-9999.ebuild
+++ b/dev-build/ninja/ninja-9999.ebuild
@@ -3,7 +3,6 @@
 
 EAPI=8
 
-CMAKE_IN_SOURCE_BUILD=1 # Simplifies doc build
 CMAKE_MAKEFILE_GENERATOR=emake
 PYTHON_COMPAT=( python3_{10..12} )
 
@@ -51,6 +50,13 @@ src_configure() {
        cmake_src_configure
 
        if use doc; then
+               if tc-is-cross-compiler; then
+                       mycmakeargs=( -DBUILD_TESTING=OFF )
+                       local BUILD_DIR=${WORKDIR}/native
+                       local SYSROOT=
+                       tc-env_build cmake_src_configure
+               fi
+
                python_setup
                edo ${EPYTHON} configure.py
        fi
@@ -60,16 +66,11 @@ src_compile() {
        cmake_src_compile
 
        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
+                       local BUILD_DIR=${WORKDIR}/native
+                       cmake_build ninja
                fi
+               edo "${BUILD_DIR}/ninja" -v -j1 doxygen manual
        fi
 }
 
@@ -86,7 +87,7 @@ src_install() {
 
        mv "${ED}"/usr/bin/ninja{,-reference} || die
 
-       if [[ ${DOCS_BUILT} == yes ]]; then
+       if use doc; then
                docinto html
                dodoc -r doc/doxygen/html/.
                dodoc doc/manual.html

Reply via email to