Create a cocoa framework from the command line (using nuke)
Objective-C C
Pull request Compare This branch is 1 commit ahead, 3 commits behind claybridges:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


* CommandLineCocoaFramework

This project shows how to build Cocoa frameworks from the command line. The
goal is to do this with as many make tools as folks find useful. At present,
we have files for:
- nuke 
- rake

Details for these are in their own sections below. Push requests for other 
make tools encouraged.

* Min, the minimal framework

For illustration, we use a minimal framework, called Min. It contains one Objective-C class, 
Min, with a single method -yo, which we call for verification. In addition, framework 
initialization seems to require an C initialization function.  For simplicity, that's
in the class file.

There is also an Xcode project for Min, for comparison & convenience.

* Defining the builds

The build should have three targets: build, install & clean, though they don't need
those exact names. The default target, the equivalent of "make", should do a build. 

Installs should go to /Library/Fromeworks. Since some folks are picky about what goes
there, this should be parameterized someplace obvious.

* Defining success

At present, the only bar for success is whether the framework successfully
loads in the nu & macruby shells, nush & macirb. These are good bookend tests,
because they sit on both sides of garbage collection. Here's the results for the
nuke build:

gort:~ clay$ macirb
irb(main):001:0> framework "Min"
=> true
irb(main):002:0> Min.yo
=> "'Sup. I'm the Min framework."

Nu Shell.
% (load "Min")
% (Min yo)
"'Sup. I'm the Min framework."

This should likely be automated, and there are surely more ways to test this.


While the Min example is instructive, real frameworks have more stuff, and more wrinkles. 
To be complete, I'd like to have more examples, including perhaps a simple but complete
example called Max, perhaps with some of the following

- resources
- an icon
- public/private header file distinction
- sub frameworks

In addition, we might want examples of frameworks written in other languges, e.g. 

- C++
- F-Script
- MacRuby
- Nu
- Objective-C++

We might also want to automate the testing somehow.

* nuke (script by Clay Bridges (diffengr))

nuke is the make tool for Nu. You can find out more about Nu at

From what I can tell, nuke is not as fully baked as, say, rake. On the other
hand, it has built-in support for frameworks, and did the job in 11 lines of
code. Not too shabby.

nuke seems to occasionally segfault when running on top of a dirty framework,
so in that case, just "nuke clobber; nuke install".

* rake (script by Steffen Siering (urso))

Rake can describe build rules and collect dependencies dynamically, which most
find much easier then make.

The Rakefile will autmotically find dependencies of every object file to be
generated. So no 'rake clean' will be needed for incremental development.