[MacRuby-devel] XCode 4 and ObjC bundles

Julien Jassaud sojastar07 at gmail.com
Thu Apr 14 08:15:36 PDT 2011


Joshua,

It works fine now. Thanks a lot for your detailed explanations.

Julien

Le 13 avr. 2011 à 07:06, Joshua Ballanco a écrit :

> In Xcode 4:
> 
> - Double-click on the project in the left pannel to bring up the Project Info window
> - Click on the "Build Phases" tab across the top
> - Click the "+" above "Add Build Phase" and choose a "Add Run Script"
> - Use "macruby extconf.rb; make; cp MyBundle.bundle" as the script...well, it's actually not quite that easy, but so long as you leave the box next to "Show environment variables in build log" checked, you can run the build the first time to find out what ENV variables you can use in your script. You'll probably need "PROJECT_DIR" and "DSTROOT"
> 
> In general, script build phases are *extremely* useful. In fact, most of my Xcode projects end up being at least half script build phases. Hope that helps!
> 
> On Tue, Apr 12, 2011 at 5:48 PM, Julien Jassaud <julien at collectapply.jp> wrote:
> Joshua,
> 
> Thanks again. The official doc is a bit dry for a first contact. I ended up copying and editing the ControlTower extconf.rb file which worked just fine. That wasn't too hard :) I'll look into mkmf subtleties later.
> 
> Unfortunately I am at a loss when it comes to the XCode part. I added a script to the "pre-actions" part of the "Build" step of the "Compile" scheme but the bundle is never built. Any idea ?
> 
> Julien
> 
> Le 12 avr. 2011 à 22:18, Joshua Ballanco a écrit :
> 
>> One advantage to mkmf and extconf.rb (that's the file that you actually run through macruby to generate a Makefile) is that it can take care of most of the difficult parts of generating a Makefile for you (like determining header locations and library availability, etc.). Finding good documentation on mkmf can be a bit tricky, but you might try starting with the official library docs here: http://www.ruby-doc.org/stdlib/libdoc/mkmf/rdoc/index.html
>> 
>> - Josh
>> 
>> On Tue, Apr 12, 2011 at 8:04 PM, Julien Jassaud <sojastar07 at gmail.com> wrote:
>> Joshua,
>> 
>> Thanks for your prompt answer. I'll look into both mkmf and ControlTower. This is totally new territory for me. Exciting !
>> 
>> Julien
>> 
>>> My suggestion would be to forgo using XCode to build the Obj-C extension, and instead use mkmf like you would with any other Ruby C-extension. Then you can just add a script build stage to your project. If you want to see an example of a MacRuby project with an Obj-C extension, take a look at ControlTower. If you have any other questions, ask!
>>> 
>>> Cheers,
>>> 
>>> Josh
>>> 
>>> On Tue, Apr 12, 2011 at 5:29 PM, Julien Jassaud <sojastar07 at gmail.com> wrote:
>>> Hi,
>>> 
>>> A while back I tried to port some ObjC examples to MacRuby ( github.com/sojastar/Some-MacRuby-sample-code ). I had to leave parts dealing with C strings in an ObjC bundle that is required in the MacRuby code. The ported samples' building process was a bit complicated with XCode 3 :
>>> 
>>> 1) clone from github
>>> 2) run the ObjC bundle Makefile. The Makefile also copied the compiled bundle at the proper location in the build directory.
>>> 3) build the project in XCode
>>> 
>>> An inelegant process but it was working fine.
>>> 
>>> Now that XCode 4 adds some random string to the build directory's name I don't know how to point the Makefile to the proper location for copying the bundle. So my question is : what is good practice when it comes to ObjC bundles and MacRuby in XCode 4 ? Is there a way to automate the whole bundle build / copy process ? I tried to modify the "Compile" scheme's "Build" step by adding a pre-action script to it but I don't really know what to put in it. I couldn't even run the Makefile from it.
>>> 
>>> Thanks,
>>> Julien Jassaud
>>> 
>>> 
>>> _______________________________________________
>>> MacRuby-devel mailing list
>>> MacRuby-devel at lists.macosforge.org
>>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>> 
>>> _______________________________________________
>>> MacRuby-devel mailing list
>>> MacRuby-devel at lists.macosforge.org
>>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>> 
>> 
>> _______________________________________________
>> MacRuby-devel mailing list
>> MacRuby-devel at lists.macosforge.org
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>> 
>> 
>> _______________________________________________
>> MacRuby-devel mailing list
>> MacRuby-devel at lists.macosforge.org
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
> 
> 
> _______________________________________________
> MacRuby-devel mailing list
> MacRuby-devel at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
> 
> 
> _______________________________________________
> MacRuby-devel mailing list
> MacRuby-devel at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20110414/d0e08c66/attachment.html>


More information about the MacRuby-devel mailing list