This post originated from an RSS feed registered with Ruby Buzz
by Ruby MacOSforge.
Original Post: New Build System, Faster Objective-C Dispatcher, Screencast
Feed Title: Mac OS X related Ruby News
Feed URL: http://www.macruby.org/feeds/posts/macruby/index.xml
Feed Description: Ruby news related to Mac OS X, from Apple.
MacRuby trunk got a new build system, entirely written with Rake. We managed to replace the previous autotools-based build system with a 570 lines of code Rakefile (which can still be refactored). We didn't really need autotools since MacRuby aims to be installed on only one platform: Mac OS X. Maintaining the autotools files were really difficult, and we are very glad to now have a pure-Ruby build script.
Building and installing MacRuby is now very simple:
$ rake $ sudo rake install
This will build and install MacRuby in /Library/Frameworks/MacRuby.framework, executable symbolic links in /usr/local/bin (with a "mac" prefix, for example "macruby"), Xcode templates and sample code.
To see the list of all tasks;
$ rake -T (in /Volumes/Data/src/MacRuby) rake all # Build MacRuby and extensions rake clean # Clean local and extension build files rake clean:ext # Clean extension build files rake clean:local # Clean local build files rake config_h # Create config.h rake default # Same as all rake extensions # Build extensions rake framework:info_plist # Create the plist file for the framework rake framework:install # Install the framework rake install # Same as framework:install rake macruby # Same as macruby:build rake macruby:build # Build MacRuby rake macruby:dylib # Build dynamic libraries for MacRuby rake macruby:static # Build static libraries for MacRuby rake miniruby # Create miniruby rake objects # Build known objects rake rbconfig # Create config file rake sample_test # Run the sample tests rake test # Same as sample_test
Also, MacRuby trunk has a faster Objective-C dispatcher. Around 4 times faster that MacRuby 0.2 (and way faster than RubyCocoa). This was possible by fixing bugs in the dispatcher and also cache some of the runtime information.
Let's consider the following Objective-C class.
$ cat dummy.m #import <Foundation/Foundation.h>
@interface Dummy : NSObject @end
@implementation Dummy
- (id)doSomething { return @""; }
- (id)doSomethingWith:(id)value { return value; }
@end
void Init_dummy (void) {}
We can build it as a Ruby extension.
$ gcc dummy.m -o dummy.bundle -framework Foundation -dynamiclib -fobjc-gc"
Then, test calling the methods. First, the doSomething method, which is a very simple case.
These are very premature results, we expect to continue reducing the time spent in the dispatcher, in the near future, and hopefully to make it twice faster.
On a side note, Konrad M. Lawson was kind enough to generate a very nice screencast of MacRuby, demonstrating the Xcode/IB integration. Thanks Konrad!