commit:     035bae314b847add8934886e11a4df62b9c7f16d
Author:     Sv. Lockal <lockalsash <AT> gmail <DOT> com>
AuthorDate: Sat Jul 13 14:40:56 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Nov 23 16:54:04 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=035bae31

games-board/stockfish: fix clang build failure

COMP should be a fixed string like clang/gcc to set tools for PGO.
Possible values are described in 
https://disservin.github.io/stockfish-docs/stockfish-wiki/Compiling-from-source.html#compilers
Note that even though COMP points to C compiler, stockfish calls only C++ 
compile provided in COMPILER parameter.

Closes: https://bugs.gentoo.org/919781
Signed-off-by: Sv. Lockal <lockalsash <AT> gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/37542
Signed-off-by: Sam James <sam <AT> gentoo.org>

 games-board/stockfish/stockfish-16-r1.ebuild | 13 ++++++++++++-
 games-board/stockfish/stockfish-16.1.ebuild  | 13 ++++++++++++-
 games-board/stockfish/stockfish-16.ebuild    | 13 ++++++++++++-
 games-board/stockfish/stockfish-17.ebuild    | 13 ++++++++++++-
 4 files changed, 48 insertions(+), 4 deletions(-)

diff --git a/games-board/stockfish/stockfish-16-r1.ebuild 
b/games-board/stockfish/stockfish-16-r1.ebuild
index 87fef36d749c..ff7e0ac8d26a 100644
--- a/games-board/stockfish/stockfish-16-r1.ebuild
+++ b/games-board/stockfish/stockfish-16-r1.ebuild
@@ -22,6 +22,12 @@ DEPEND="|| ( app-arch/unzip app-arch/zip )"
 
 S="${WORKDIR}/Stockfish-sf_${PV}/src"
 
+pkg_setup() {
+       if ! tc-is-clang && ! tc-is-gcc; then
+               die "Unsupported compiler: $(tc-getCC)"
+       fi
+}
+
 src_prepare() {
        default
 
@@ -66,11 +72,16 @@ src_compile() {
        use ppc && my_arch=ppc
        use ppc64 && my_arch=ppc64
 
+       # Bug 919781: COMP is a fixed string like clang/gcc to set tools for PGO
+       local comp
+       tc-is-gcc && comp="gcc"
+       tc-is-clang && comp="clang"
+
        # There's a nice hack in the Makefile that overrides the value of CXX 
with
        # COMPILER to support Travis CI and we abuse it to make sure that we
        # build with our compiler of choice.
        emake profile-build ARCH="${my_arch}" \
-               COMP="$(tc-getCXX)" \
+               COMP="${comp}" \
                COMPILER="$(tc-getCXX)" \
                debug=$(usex debug "yes" "no") \
                optimize=$(usex optimize "yes" "no")

diff --git a/games-board/stockfish/stockfish-16.1.ebuild 
b/games-board/stockfish/stockfish-16.1.ebuild
index 8d66d9cfa7cf..4cc6280b6b5d 100644
--- a/games-board/stockfish/stockfish-16.1.ebuild
+++ b/games-board/stockfish/stockfish-16.1.ebuild
@@ -26,6 +26,12 @@ DEPEND="|| ( app-arch/unzip app-arch/zip )"
 
 S="${WORKDIR}/Stockfish-sf_${PV}/src"
 
+pkg_setup() {
+       if ! tc-is-clang && ! tc-is-gcc; then
+               die "Unsupported compiler: $(tc-getCC)"
+       fi
+}
+
 src_prepare() {
        default
 
@@ -72,11 +78,16 @@ src_compile() {
        use ppc && my_arch=ppc
        use ppc64 && my_arch=ppc64
 
+       # Bug 919781: COMP is a fixed string like clang/gcc to set tools for PGO
+       local comp
+       tc-is-gcc && comp="gcc"
+       tc-is-clang && comp="clang"
+
        # There's a nice hack in the Makefile that overrides the value of CXX 
with
        # COMPILER to support Travis CI and we abuse it to make sure that we
        # build with our compiler of choice.
        emake profile-build ARCH="${my_arch}" \
-               COMP="$(tc-getCXX)" \
+               COMP="${comp}" \
                COMPILER="$(tc-getCXX)" \
                debug=$(usex debug "yes" "no") \
                optimize=$(usex optimize "yes" "no")

diff --git a/games-board/stockfish/stockfish-16.ebuild 
b/games-board/stockfish/stockfish-16.ebuild
index 4cabca417965..9103928f0daa 100644
--- a/games-board/stockfish/stockfish-16.ebuild
+++ b/games-board/stockfish/stockfish-16.ebuild
@@ -22,6 +22,12 @@ DEPEND="|| ( app-arch/unzip app-arch/zip )"
 
 S="${WORKDIR}/Stockfish-sf_${PV}/src"
 
+pkg_setup() {
+       if ! tc-is-clang && ! tc-is-gcc; then
+               die "Unsupported compiler: $(tc-getCC)"
+       fi
+}
+
 src_prepare() {
        default
 
@@ -61,11 +67,16 @@ src_compile() {
        use ppc && my_arch=ppc
        use ppc64 && my_arch=ppc64
 
+       # Bug 919781: COMP is a fixed string like clang/gcc to set tools for PGO
+       local comp
+       tc-is-gcc && comp="gcc"
+       tc-is-clang && comp="clang"
+
        # There's a nice hack in the Makefile that overrides the value of CXX 
with
        # COMPILER to support Travis CI and we abuse it to make sure that we
        # build with our compiler of choice.
        emake profile-build ARCH="${my_arch}" \
-               COMP="$(tc-getCXX)" \
+               COMP="${comp}" \
                COMPILER="$(tc-getCXX)" \
                debug=$(usex debug "yes" "no") \
                optimize=$(usex optimize "yes" "no")

diff --git a/games-board/stockfish/stockfish-17.ebuild 
b/games-board/stockfish/stockfish-17.ebuild
index bbc0c90cbf73..b535bb5e9f54 100644
--- a/games-board/stockfish/stockfish-17.ebuild
+++ b/games-board/stockfish/stockfish-17.ebuild
@@ -26,6 +26,12 @@ DEPEND="|| ( app-arch/unzip app-arch/zip )"
 
 S="${WORKDIR}/Stockfish-sf_${PV}/src"
 
+pkg_setup() {
+       if ! tc-is-clang && ! tc-is-gcc; then
+               die "Unsupported compiler: $(tc-getCC)"
+       fi
+}
+
 src_prepare() {
        default
 
@@ -72,11 +78,16 @@ src_compile() {
        use ppc && my_arch=ppc
        use ppc64 && my_arch=ppc64
 
+       # Bug 919781: COMP is a fixed string like clang/gcc to set tools for PGO
+       local comp
+       tc-is-gcc && comp="gcc"
+       tc-is-clang && comp="clang"
+
        # There's a nice hack in the Makefile that overrides the value of CXX 
with
        # COMPILER to support Travis CI and we abuse it to make sure that we
        # build with our compiler of choice.
        emake profile-build ARCH="${my_arch}" \
-               COMP="$(tc-getCXX)" \
+               COMP="${comp}" \
                COMPILER="$(tc-getCXX)" \
                debug=$(usex debug "yes" "no") \
                optimize=$(usex optimize "yes" "no")

Reply via email to