DARWIN PORTING NOTES -------------------- Porting P4Ruby to MAX OSX has been problematic to say the least. Apple's dynamic loader can't handle the use of signal(3) within the initialisation of global data objects - it sends it into a loop. The Perforce API includes a class called Signaler which instantiates a single global instance of the class at module initialisation time. The constructor for this object invokes signal(3). For P4Ruby this occurs when the P4 module is loaded, and on OSX it sends the ruby process into an infaloop. There's no nice way to fix this, but there is a nasty way. The nasty hack is documented here, but the fact that this is necessary means I have to declare P4Ruby on Mac OSX unsupported for the moment. If this hack doesn't work for you, I may not be able to help. Steps ----- 1. Build Ruby itself (the pre-installed Ruby is not good enough) 2. Download and install the Perforce API 3. Patch the Perforce API with an ugly hack 3. Build P4Ruby Building Ruby ------------- You need to build Ruby using gcc2 as the Perforce API for Darwin is currently built with gcc2 whilst the pre-installed Ruby on OSX 10.3 is built with gcc3 and is also out of date. Here's what works with Ruby 1.8.1 CC=gcc2 CXX=g++2 CFLAGS=-no-cpp-precomp ./configure make make install Downloading the Perforce API ---------------------------- Currently (2004/02/10) the API build you need is at: http://www.perforce.com/downloads/perforce/r03.1/bin.darwinppc/p4api.tar Install it in a p4-api directory under your home directory. i.e. ~/p4-api Patching the Perforce API ------------------------- 1. Unpack the P4Ruby distribution. tar zxf P4Ruby.tar.gz cd P4Ruby-* 2. Compile the darwin-hack/signaler.cc file into an object g++2 -c -I ~/p4-api -DOS_DARWIN -DOS_DARWIN60PPC darwin-hack/signaler.cpp 3. Patch the Perforce API with this new version of signaler.o ar rv ~/p4-api/libsupp.a signaler.o rm signaler.o ranlib ~/p4-api/lib*.a Building P4Ruby --------------- ruby p4conf.rb --apidir=~/p4-api --apiver=2003.1 --gccver=2 make # Then test it ruby -I . -I./lib -rP4 -e 'puts( P4.identify )' # if it works make install