LWJGL Forum

Archive => Resolved Bugs/RFE => Topic started by: Simon Felix on May 13, 2011, 00:07:23

Title: [FIXED] AppletLoader bitness support for OS X
Post by: Simon Felix 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
Title: Re: [RFE] AppletLoader bitness support for OS X
Post by: kappa 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).
Title: Re: [RFE] AppletLoader bitness support for OS X
Post by: Simon Felix 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.

 :)
Title: Re: [RFE] AppletLoader bitness support for OS X
Post by: kappa 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.
Title: Re: [RFE] AppletLoader bitness support for OS X
Post by: Simon Felix 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.
Title: Re: [RFE] AppletLoader bitness support for OS X
Post by: kappa on May 13, 2011, 19:17:25
ah, good point, fixed.