Hello Guest

[FIXED] AppletLoader bitness support for OS X

  • 5 Replies
  • 6063 Views
[FIXED] AppletLoader bitness support for OS X
« on: May 13, 2011, 00:07:23 »
Although OS X supports fat/universal binaries not all libraries are built that way. It'd be useful for me to specify different native libraries for OS X depending on whether an applet runs with a 32bit or 64bit VM.

The (untested, as I don't have OS X) fix should be trivial:

Code: [Select]
    }
 
   } else if (osName.startsWith("Mac") || osName.startsWith("Darwin")) {
-      nativeJarList = getParameter("al_mac");
+  
+      // check if arch specific natives have been specified
+      if (System.getProperty("os.arch").endsWith("64")) {
+        nativeJarList = getParameter("al_mac64");
+      } else {
+        nativeJarList = getParameter("al_mac32");
+      }
+     
+      if (nativeJarList == null) {
+        nativeJarList = getParameter("al_mac");
+      }
+     
     } else if (osName.startsWith("Solaris") || osName.startsWith("SunOS")) {
       nativeJarList = getParameter("al_solaris");
     } else if (osName.startsWith("FreeBSD")) {

Cheers,
Simon
Download Cultris II, the fastest Tetris clone from http://gewaltig.net/

*

Offline kappa

  • *****
  • 1315
Re: [RFE] AppletLoader bitness support for OS X
« Reply #1 on: May 13, 2011, 08:55:35 »
Sounds like a good enhancement especially for non LWJGL natives and as its just a minor change can be added easily (hopefully tonight).
« Last Edit: May 13, 2011, 08:59:07 by kappa »

Re: [RFE] AppletLoader bitness support for OS X
« Reply #2 on: May 13, 2011, 14:28:51 »
Did you ever know that you're my hero,
and everything I would like to be?
I can fly higher than an eagle,
'cause you are the wind beneath my wings.

 :)
Download Cultris II, the fastest Tetris clone from http://gewaltig.net/

*

Offline kappa

  • *****
  • 1315
Re: [RFE] AppletLoader bitness support for OS X
« Reply #3 on: May 13, 2011, 16:27:32 »
Code: [Select]
else if (osName.startsWith("Mac") || osName.startsWith("Darwin")) {

// check if arch specific natives have been specified
if (System.getProperty("os.arch").endsWith("64")) {
nativeJarList = getParameter("al_mac64");
} else if (System.getProperty("os.arch").endsWith("ppc")) {
nativeJarList = getParameter("al_macppc");
} else {
nativeJarList = getParameter("al_mac32");
}

if (nativeJarList == null) {
nativeJarList = getParameter("al_mac");
}

committed the above code, so you'd use al_mac32, al_mac64 or al_macppc otherwise if they are not specified the AppletLoader will fall back to al_mac parameter.

Re: [RFE] AppletLoader bitness support for OS X
« Reply #4 on: May 13, 2011, 17:47:57 »
Well, "ppc" and "ppc64" are possible values for OS X. You'll probably want to change System.getProperty("os.arch").endsWith("ppc") instead of System.getProperty("os.arch").startsWith("ppc") to match both architectures.
Download Cultris II, the fastest Tetris clone from http://gewaltig.net/

*

Offline kappa

  • *****
  • 1315
Re: [RFE] AppletLoader bitness support for OS X
« Reply #5 on: May 13, 2011, 19:17:25 »
ah, good point, fixed.