Checking out the Cappuccino Source Code
Once you've completed the other tutorials and are familiar with the basics of creating Cappuccino applications, you may want to dig deeper into the source code for Cappuccino. The code is managed using the Git version control system, and hosted on GitHub.
Prerequisites
There a few requirements before you can begin building Cappuccino from source:
- Git
- Apache Ant
- gcc
- Cygwin (only on Windows)
- Cappuccino Tools
Tools Installation
There are many tutorials for installing the first 4 requirements, so we'll focus on the Cappuccino Tools here. Once the other requirements are installed, download and unzip the tools package. Inside you'll find a copy of Objective-J and Cappuccino (already built), Objective-J syntax highlighting modes for SubEthaEdit and TextMate, and the build tools.
To install the tools, navigate your terminal to the CappuccinoTools directory, give the "install-tools" script executable permissions, and execute it (On Windows, you must use the Cygwin bash shell):
unzip CappuccinoTools-0.5.zip
cd CappuccinoTools-0.5
chmod +x install-tools
sudo ./install-tools
By default the tools are installed into /usr/local/share/objj and /usr/local/bin.
Once the installation is complete, be sure to setup the environment variables described by the installer. The most important variable is the STEAM_BUILD path, which should be set to a directory of your chosing. This is where the frameworks will be built when using the "steam" tool described below. For example, the following would go in one of your shell config files (.profile, .bashrc, etc):
export STEAM_BUILD=/Users/YourUsername/steam_build
If the installation's "bin" directory isn't already in your PATH variable, be sure to append it to your path:
export PATH=$PATH:/usr/local/bin
The OBJJ_HOME variable is only required if didn't install in the default (/usr/local) directory using the --prefix option of install-tools.
On Windows, you should add these environment variables in both Windows ("System Properties" control panel) and Cygwin (shell config files .bashrc). For the Windows environment variables, be sure to convert from Cygwin paths to Windows paths (for example, in a default Cygwin install "/usr/local" becomes "C:\cygwin\usr\local"). The Cygwin tool "cygpath" can help with this.
The Tools
Currently there are 3 main tools:
- objj - a command-line interpreter and interactive shell for Objective-J
- objjc - an Objective-J static-preinterpreter (compiler)
- steam - a simple tool for managing Objective-J projects
Checking Out From Git
To obtain the latest source, simply clone the Cappuccino repository from GitHub to a directory of your choice:
git clone git://github.com/280north/cappuccino.git ~/Cappuccino
Building Cappuccino
This repository contains the Objective-J language, the Cappuccino frameworks (Foundation and AppKit), Tools, and sample projects. To build a release of Cappuccino, simply run "ant" from the root of the checkout:
cd ~/Cappuccino
ant
If all goes well, Cappuccino and Objective-J will be built and placed in the directory pointed to by $STEAM_BUILD/Release.
You can also build frameworks using the steam tool directly:
cd ~/Cappuccino/Foundation
steam
cd ../AppKit
steam
Note that the "ant" task in the root Cappuccino directory does not currently work under Cygwin. Instead, you can run "ant" from the Objective-J directory, and "steam" from the Foundation and AppKit directories.
We're still working out these and other inevitable kinks, so if you're having problems don't be afraid to ask for help!
