Fork me on GitHub

Sigil.org The musings of a professional drunkard with a coding problem

GWT on FreeBSD

GWT plugin for FreeBSD

Google's GWT supports Windows, OS X and Linux out of the box, but they apparently have no FreeBSD geeks working on the GWT team. The most useful GWT feature for time saving is the devmode which requires a browser plugin. FreeBSD is not supported officially, so I have taken preliminary work by GWT Dev John Tamplin and build the plugin for myself.

The following instructions worked for me and have been sent back to John. Hopefully, we'll see an official FreeBSD build of the plugin in the near future. Until then, I provide instructions to build it yourself.

Initialize build environment

Get source trees:
mkdir ~/gwt_build
cd ~/gwt_build
svn co http://google-web-toolkit.googlecode.com/svn/plugin-sdks
svn co http://google-web-toolkit.googlecode.com/svn/trunk/
Create dir structure. To build for x86, switch x86_64 to x86. Use the gecko version corresponding with your Firefox build.

Firefox 3.6 => gecko-1.9.2
Firefox 3.5 => gecko-1.9.1
Firefox 3.0 => gecko-1.9.0
cd ~/gwt_build/plugin-sdks/gecko-1.9.2
mkdir -p FreeBSD_x86_64-gcc3/{bin,lib,include}
cd FreeBSD_x86_64-gcc3
Install ports

The following ports should be installed. This should work for Firefox 3.x < 3.5 (i.e. www/firefox3), but I have not tested it. I have included the config options my ports were built with, though these should be immaterial to building the GWT plugin.
firefox-3.5.5,1
WITH_DBUS=true
WITH_NEWTAB=true
WITHOUT_SMB=true
WITHOUT_DEBUG=true
WITHOUT_LOGGING=true
WITH_OPTIMIZED_CFLAGS=true
libxul-1.9.0.15 (.17 is in ports and should also work)
WITHOUT_JAVA=true
WITHOUT_DEBUG=true
WITHOUT_LOGGING=true
WITHOUT_OPTIMIZED_CFLAGS=true
nspr-4.8.2
Note: I upgraded to Firefox 3.6 (www/firefox), and I compiled with the same options.
Copy files

From www/libxul:

For anything before 3.6:
cp /usr/local/lib/libxul/xpidl bin/
cp /usr/local/lib/libxul/libxul.so lib/
cp /usr/local/lib/libxul/libmozjs.so lib/
cp /usr/local/lib/libxul/libxpcom.so lib/
cp /usr/local/include/libxul/stable/xpcom-config.h include/
cp /usr/local/include/libxul/unstable/mozilla-config.h include/
For Firefox 3.6:
cp /usr/local/lib/libxul/xpidl bin/
From devel/nspr:
cp /usr/local/lib/libnspr4.so lib/
cp /usr/local/lib/libplds4.so lib/
cp /usr/local/lib/libplc4.so lib/
cp /usr/local/include/nspr/prcpucfg.h include/
From Firefox:

For anything before 3.6:
cp /usr/local/lib/firefox3/sdk/lib/libxpcomglue_s.a lib/
cp /usr/local/include/firefox3/unstable/jsautocfg.h include/
cp /usr/local/include/firefox3/unstable/js-config.h include/
For Firefox 3.6:
cp /usr/local/lib/firefox3/libxul.so lib/
cp /usr/local/lib/firefox3/libmozjs.so lib/
cp /usr/local/lib/firefox3/libxpcom.so lib/
cp /usr/local/include/firefox3/xpcom-config.h include/
cp /usr/local/include/firefox3/mozilla-config.h include/
cp /usr/local/include/firefox3/jsautocfg.h include/
cp /usr/local/include/firefox3/js-config.h include/
Apply patches

If you are compiling for non-3.6, edit the patch and change ff36 to correspond to your target in the first 4 lines (patching IOOPHM.h).
cd ~/gwt_build/
fetch http://www.sigil.org/files/gwt-freebsd.patch
cd trunk/plugins/xpcom
patch -p0 < ~/gwt_build/gwt-freebsd.patch
Build

ARCH can be x86 or x86_64, and BROWSER can be ff36, ff35 or ff3.
cd trunk/plugins/xpcom && gmake ARCH=x86_64 BROWSER=ff36
Install

Now, you should be able to install the xpi in ~/gwt_build/trunk/plugins/xpcom/prebuilt/gwt-dev-plugin.xpi through Firefox.

If you have any issues building or installing, please contact me.