Universal binaries
I am just starting to create a help system on the Mac. Been doing a lot on the Mac version this werek, mostly as a result of using the excellent jar-bundler Ant task (thanks Greg and Will).
To get the help system called up on the Mac, you need to create a JNIlib, but the problem is that the example code in jar-bundler only builds the code for the current platform. So as soon as I transferred the binary from my Intel MacBook to my PowerPC iMac, the thing broke.
The trick is to pass a couple of -arch calls to cc:
<exec executable="cc">
<arg line="-c">
<arg line="-I/System/Library/Frameworks/JavaVM.framework/Headers">
<arg line="-o build/HelpBookJNI.o">
<arg value="platforms/macosx/obj-c/HelpBookJNI.m">
</exec>
<exec executable="cc">
<arg line="-dynamiclib">
<arg line="-framework JavaVM">
<arg line="-framework Cocoa">
<arg line="-o build/libHelpBookJNI.jnilib">
<arg value="build/HelpBookJNI.o">
</exec>
becomes:
<exec executable="cc">
<arg line="-arch ppc">
<arg line="-arch i386">
<arg line="-c">
<arg line="-I/System/Library/Frameworks/JavaVM.framework/Headers">
<arg line="-o build/HelpBookJNI.o">
<arg value="platforms/macosx/obj-c/HelpBookJNI.m">
</exec>
<exec executable="cc">
<arg line="-arch i386">
<arg line="-arch ppc">
<arg line="-dynamiclib">
<arg line="-framework JavaVM">
<arg line="-framework Cocoa">
<arg line="-o build/libHelpBookJNI.jnilib">
<arg value="build/HelpBookJNI.o">
</exec>

0 Comments:
Post a Comment
<< Home