I'm deeply invested in Firefox and OS X and while the LizardTech plug-in lives on at Celartem and works on Firefox 3.6.x, it's closed-source, its toolbar buttons don't work and I'm not sure it'll survive for long. DjView 4 includes an open NPAPI plug-in which works on Linux but isn't available for OS X, so I thought I'd have a go at getting the DjView 4 plug-in working on OS X in case it was something trivial. It wasn't, and I thought I'd document why in case anyone else wasted their time wondering/speculating before (or after) the resulting patch gets accepted.
My first misdirected effort was to simply build the DjView 4.7 tree outside MacPorts and copy the resulting nsdejavu.so into the ~/Library/Internet Plug-Ins/ directory, hoping simple shared objects still worked like the good ol' Linux days. They don't; on OS X, plug-ins must be "loadable bundles" (well, technically a "loadable module" bundle within a loadable bundle, which also happens to be a package — and let's not even get started on flat packages).
My second misdirected effort was to simply copy the built nsdejavu.so into an existing plug-in bundle (updating
CFBundleExecutable). The plug-in ceased to appear in about:plugins. I guess if Firefox cared to check, the stuff returned by
NP_GetValue()would be inconsistent with the Info.plist, but that seemed unlikely.
My third effort was to build the plug-in as a bundle, using the OS X template plug-in from the new NPAPI SDK. After altering the
HEADER_SEARCH_PATHSto include config.h, the MacPorts glib headers and the NPAPI headers and fixing a bunch of trivial compile errors, I hit a wall at:
DjVuPlugin.c: In function 'NPP_SetWindow':
DjVuPlugin.c:2484: error: 'NPWindow' has no member named 'ws_info'
ws_infoif you're compiling for Mozilla on non-OSX UNIX. Reading a little more closely, it turns out the plug-in runs DjView in a separate process, relying on Firefox support for either Xt or XEmbed to render the document, neither of which are supported on the normal Cocoa-based Firefox most OS X users use. (While it's possible to run X11-based Firefox on OS X and probably possible to build an Qt-on-X11 variant of DjView that would support the -netscape flag, it's not worth it.)
So we're stuck with Celartem's plug-in for now.