commit:     869ed0f9863ce676ae14d8cdd7504c54f9f5cd94
Author:     WANG Xuerui <xen0n <AT> gentoo <DOT> org>
AuthorDate: Fri Feb 21 02:13:19 2025 +0000
Commit:     WANG Xuerui <xen0n <AT> gentoo <DOT> org>
CommitDate: Fri Feb 21 09:17:58 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=869ed0f9

www-client/firefox: add build support for loong

Some patches are still needed for a successful build with popular CFLAGS
on loong, but src_prepare and src_configure need adaptation as well.

Reviewed-by: Joonas Niilola <juippis <AT> gentoo.org>
Signed-off-by: WANG Xuerui <xen0n <AT> gentoo.org>

 www-client/firefox/firefox-128.7.0.ebuild | 10 +++++++---
 www-client/firefox/firefox-135.0.1.ebuild | 10 +++++++---
 www-client/firefox/firefox-135.0.ebuild   | 10 +++++++---
 3 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/www-client/firefox/firefox-128.7.0.ebuild 
b/www-client/firefox/firefox-128.7.0.ebuild
index 593ba0759bb1..bffe2b9202a7 100644
--- a/www-client/firefox/firefox-128.7.0.ebuild
+++ b/www-client/firefox/firefox-128.7.0.ebuild
@@ -614,6 +614,10 @@ src_prepare() {
                        export RUST_TARGET="i686-unknown-linux-musl"
                elif use arm64 ; then
                        export RUST_TARGET="aarch64-unknown-linux-musl"
+               elif use loong; then
+                       # Only the LP64D ABI of LoongArch64 is actively 
supported among
+                       # the wider Linux ecosystem, so the assumption is safe.
+                       export RUST_TARGET="loongarch64-unknown-linux-musl"
                elif use ppc64 ; then
                        export RUST_TARGET="powerpc64le-unknown-linux-musl"
                elif use riscv ; then
@@ -846,7 +850,7 @@ src_configure() {
        # amd64, arm, arm64 & x86.
        # Might want to flip the logic around if Firefox is to support more 
arches.
        # bug 833001, bug 903411#c8
-       if use ppc64 || use riscv; then
+       if use loong || use ppc64 || use riscv; then
                mozconfig_add_options_ac '' --disable-sandbox
        else
                mozconfig_add_options_ac '' --enable-sandbox
@@ -1043,8 +1047,8 @@ src_configure() {
                else
                        mozconfig_add_options_ac 'relr elf-hack' 
--enable-elf-hack=relr
                fi
-       elif use ppc64 || use riscv ; then
-               # '--disable-elf-hack' is not recognized on ppc64/riscv,
+       elif use loong || use ppc64 || use riscv ; then
+               # '--disable-elf-hack' is not recognized on loong/ppc64/riscv,
                # see bgo #917049, #930046
                :;
        else

diff --git a/www-client/firefox/firefox-135.0.1.ebuild 
b/www-client/firefox/firefox-135.0.1.ebuild
index 277ebf5efdd0..878488cd4e1c 100644
--- a/www-client/firefox/firefox-135.0.1.ebuild
+++ b/www-client/firefox/firefox-135.0.1.ebuild
@@ -616,6 +616,10 @@ src_prepare() {
                        export RUST_TARGET="i686-unknown-linux-musl"
                elif use arm64 ; then
                        export RUST_TARGET="aarch64-unknown-linux-musl"
+               elif use loong; then
+                       # Only the LP64D ABI of LoongArch64 is actively 
supported among
+                       # the wider Linux ecosystem, so the assumption is safe.
+                       export RUST_TARGET="loongarch64-unknown-linux-musl"
                elif use ppc64 ; then
                        export RUST_TARGET="powerpc64le-unknown-linux-musl"
                elif use riscv ; then
@@ -831,7 +835,7 @@ src_configure() {
        # amd64, arm, arm64 & x86.
        # Might want to flip the logic around if Firefox is to support more 
arches.
        # bug 833001, bug 903411#c8
-       if use ppc64 || use riscv; then
+       if use loong || use ppc64 || use riscv; then
                mozconfig_add_options_ac '' --disable-sandbox
        elif use valgrind; then
                mozconfig_add_options_ac 'valgrind requirement' 
--disable-sandbox
@@ -1030,8 +1034,8 @@ src_configure() {
                else
                        mozconfig_add_options_ac 'relr elf-hack' 
--enable-elf-hack=relr
                fi
-       elif use ppc64 || use riscv ; then
-               # '--disable-elf-hack' is not recognized on ppc64/riscv,
+       elif use loong || use ppc64 || use riscv ; then
+               # '--disable-elf-hack' is not recognized on loong/ppc64/riscv,
                # see bgo #917049, #930046
                :;
        else

diff --git a/www-client/firefox/firefox-135.0.ebuild 
b/www-client/firefox/firefox-135.0.ebuild
index 1fa325505b35..aaf2355e3c90 100644
--- a/www-client/firefox/firefox-135.0.ebuild
+++ b/www-client/firefox/firefox-135.0.ebuild
@@ -616,6 +616,10 @@ src_prepare() {
                        export RUST_TARGET="i686-unknown-linux-musl"
                elif use arm64 ; then
                        export RUST_TARGET="aarch64-unknown-linux-musl"
+               elif use loong; then
+                       # Only the LP64D ABI of LoongArch64 is actively 
supported among
+                       # the wider Linux ecosystem, so the assumption is safe.
+                       export RUST_TARGET="loongarch64-unknown-linux-musl"
                elif use ppc64 ; then
                        export RUST_TARGET="powerpc64le-unknown-linux-musl"
                elif use riscv ; then
@@ -831,7 +835,7 @@ src_configure() {
        # amd64, arm, arm64 & x86.
        # Might want to flip the logic around if Firefox is to support more 
arches.
        # bug 833001, bug 903411#c8
-       if use ppc64 || use riscv; then
+       if use loong || use ppc64 || use riscv; then
                mozconfig_add_options_ac '' --disable-sandbox
        elif use valgrind; then
                mozconfig_add_options_ac 'valgrind requirement' 
--disable-sandbox
@@ -1030,8 +1034,8 @@ src_configure() {
                else
                        mozconfig_add_options_ac 'relr elf-hack' 
--enable-elf-hack=relr
                fi
-       elif use ppc64 || use riscv ; then
-               # '--disable-elf-hack' is not recognized on ppc64/riscv,
+       elif use loong || use ppc64 || use riscv ; then
+               # '--disable-elf-hack' is not recognized on loong/ppc64/riscv,
                # see bgo #917049, #930046
                :;
        else

Reply via email to