views:

59

answers:

2

I have created a NPAPI browser plugin for Firefox on linux. I installed the plugin by copying the shared library into my user's profile plugin directory. I am able to build the shared library on OS X, but I am not familiar with how to create a plugin bundle that Firefox/Chrome/Safari can use. How can I create a plugin bundle that will work with browsers on OS X?

+2  A: 

This is the definitive reference from Apple; there are WebKit-only plug-ins, and NPAPI plug-ins. For the latter, get the sample code at Mozilla. This blog article is also helpful.

Yuji
+1  A: 

You could also look at FireBreath, which takes care of the abstraction of building the plugin on linux vs windows vs mac for you. http://firebreath.googlecode.com

The main thing to understand is that you'll need to create a particular type of binary; I'm not sure if it's actually a dylib or not, but the easiest way I've found is to create it using xcode.

FireBreath creates an Application Bundle project in xcode using cmake (that's all that cmake supports) and then uses a python script to convert it to the correct type. The reftype of the app bundle is "compiled.mach-o.executable" and the reftype of the plugin bundle is wrapper.cfbundle.

You can find the code I wrote to do the conversion here: http://code.google.com/p/firebreath/source/browse/cmake/patch_xcode.py

The listed filetype for a 32-bit Internet Plugin (npapi plugin compatible with all major browsers on Mac OS X) is "Mach-O bundle i386". That file resides in ~/Library/Internet Plugins/.plugin/Contents/MacOS

Hope that helps

Taxilian