commit:     bbd42d18598697ade22657741cb7bd96c4de40e4
Author:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 31 21:59:57 2016 +0000
Commit:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
CommitDate: Tue Aug  2 22:34:20 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bbd42d18

java-vm-2.eclass: Make get_system_arch ABI-aware

The old version just sucked. Closes bug #159439.

 eclass/java-vm-2.eclass | 27 +++++++++++++++++++++------
 1 file changed, 21 insertions(+), 6 deletions(-)

diff --git a/eclass/java-vm-2.eclass b/eclass/java-vm-2.eclass
index c544191..52f040e 100644
--- a/eclass/java-vm-2.eclass
+++ b/eclass/java-vm-2.eclass
@@ -132,14 +132,29 @@ java_set_default_vm_() {
 # @FUNCTION: get_system_arch
 # @DESCRIPTION:
 # Get Java specific arch name.
+#
+# NOTE the mips and sparc values are best guesses. Oracle uses sparcv9
+# but does OpenJDK use sparc64? We don't support OpenJDK on sparc or any
+# JVM on mips though so it doesn't matter much.
 
 get_system_arch() {
-       local sarch
-       sarch=$(echo ${ARCH} | sed -e s/[i]*.86/i386/ -e s/x86_64/amd64/ -e 
s/sun4u/sparc/ -e s/sparc64/sparc/ -e s/arm.*/arm/ -e s/sa110/arm/)
-       if [ -z "${sarch}" ]; then
-               sarch=$(uname -m | sed -e s/[i]*.86/i386/ -e s/x86_64/amd64/ -e 
s/sun4u/sparc/ -e s/sparc64/sparc/ -e s/arm.*/arm/ -e s/sa110/arm/)
-       fi
-       echo ${sarch}
+       local abi=${1-${ABI}}
+
+       case $(get_abi_CHOST ${abi}) in
+               mips*l*) echo mipsel ;;
+               mips*) echo mips ;;
+               ppc64le*) echo ppc64le ;;
+               *)
+                       case ${abi} in
+                               *_fbsd) get_system_arch ${abi%_fbsd} ;;
+                               arm64) echo aarch64 ;;
+                               hppa) echo parisc ;;
+                               sparc32) echo sparc ;;
+                               sparc64) echo sparcv9 ;;
+                               x86*) echo i386 ;;
+                               *) echo ${abi} ;;
+                       esac ;;
+       esac
 }
 
 

Reply via email to