[FIXED] AppletLoader bitness support for OS X

Started by Simon Felix, May 13, 2011, 00:07:23

Previous topic - Next topic

Simon Felix

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:

    }
 
   } 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/

kappa

Sounds like a good enhancement especially for non LWJGL natives and as its just a minor change can be added easily (hopefully tonight).

Simon Felix

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/

kappa

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.

Simon Felix

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/

kappa