Blog : Suit My Mind - Software that suits you

Cappuccino : building the jake branch

As you may have already read, the Cappuccino jake branch will be merged soon into the master branch. This is a quick post that will try to recap all the steps required to install and test the jake branch.

Feedback needed

Please post your feedback here and I'll update the post accordingly. I'll post a Cappuccino Cast based on this post, so the more accurate it is, the better the screencast will be.

Cleanup old install

If you already built Cappuccino from source, it's a good idea to cleanup the old install. If you never installed Cappuccino, you can skip this step.

$ sudo rm -Rf /usr/local/share/narwhal
$ cd /usr/local/bin
# those are old symlinks that referenced the /usr/local/share/narwhal/bin we just deleted
$ sudo rm activate activate.bash activate.cmd bake blend capp cplutil jackup js json narwhal narwhal.cmd nib2cib objj objjc ojtest press sea sea.cmd tusk tusk.cmd

# check if you have the $CAPP_BUILD env variable set
$ echo $CAPP_BUILD

# if it is set, make sure to remove the directory (it will be automatically recreated)
$ rm -Rf $CAPP_BUILD

Get the sources

If it's the first time you build Cappuccino, you have to set the CAPP_BUILD environment variable in your ~/.profile file and make sure to reload your environment :

export CAPP_BUILD="/your/path/of/choice"
$ source ~/.profile

Get the sources from Github, then switch to the jake branch

$ git clone git://github.com/280north/cappuccino.git
$ cd cappuccino
[master]$ git checkout -b jake origin/jake
[jake]$ # you are now in the jake branch

Install

Run the bootstrap script (answer "yes" to all questions, except if you are really sure you don't want to install a particular package) :

[jake]$ sudo ./bootstrap.sh
[jake]$ source ~/.profile # it reloads your environment so /usr/local/narwhal/bin will be available in your path

Then you can choose to use Narwhal with Rhino or with JavaScriptCore (which is much more faster but still incomplete, for instance, the "tusk" package manager is not supported yet)

To use Narwhal with Rhino, just run :

[jake]$ sudo env CAPP_BUILD=$CAPP_BUILD jake install

Calling the env command will make sure the CAPP_BUILD variable is preserved while running the sudo command. On Mac OS X 10.6, you could just run sudo -E jake install, the -E flag would make sure your environment is preserved. But since it's not working with Mac OS X 10.5, I prefer to show you the command using env.

If you don't do that, the CAPP_BUILD environment variable won't be available to the jake script, and your CAPP_BUILD folder will remain empty.

To use Narwhal with JavaScriptCore, you have to set the NARWHAL_ENGINE variable in your ~/.profile file and reload your environment :

# add this line to your ~/.profile file
export NARWHAL_ENGINE=jsc

Then reload your environment :

$ source ~/.profile

And run :

[jake]$ sudo env CAPP_BUILD=$CAPP_BUILD NARWHAL_ENGINE=$NARWHAL_ENGINE jake install

Again here, we make sure both the CAPP_BUILD and the NARWHAL_ENGINE variables are preserved.

Test it

If everything went smoothly, you should be able to create a brand new Cappuccino app and test it in your browser :

$ cd ~/Desktop
$ capp gen HelloJake

It is a good idea to test it with your existing apps too. Let's say you have a Cappuccino app in the MyApp folder :

# we will overwrite the Frameworks directory, so it may be a good idea to backup your app
$ cp -R MyApp MyAppTestJake
$ capp gen -f MyAppTestJake --force

Then test your app and please report any problem. Thanks in advance for your feedback!