From: Laurent Sansonetti Date: 2007-10-25T01:13:40+09:00 Subject: OSX patches Hi ruby-core, # I work for Apple, in the OS team. We internally have a set of patches that we apply to the Ruby 1.8 source tree to build the version of Ruby that ships with Mac OS X. Some of them were written for Leopard (10.5, the upcoming version of Mac OS X that will be released in a few days), others were written for previous versions. We would like to offer them upstream. Here is a brief description of each of them. They all target the 1.8 branch, though some of them may also be meaningful for trunk. I uploaded the patches on a separate temporary website directory for more convenience: http://chopine.be/lrz/ruby-osx-patches : dot-darwin.diff: A very simple one. The --diagram option of rdoc checks if the dot program exists in the system, and this test is currently skipped for Windows environments (by looking for the "win" word in the platform name), but also for Mac OS X, which platform name is "darwin". We want the test for darwin though. etc-irbrc.diff: This is an addition to IRB, to allow it to load its configuration file from a system-wide directory, /etc/irb#{rc}. This change is only effective for non-Windows environments. ignore-gsetcontext.diff: In Leopard, the setcontext/getcontext functions have been modified to confirm to the UNIX norm, however, their implementation changed to not use the default structure by default, which makes Ruby segfaulting during initialization. This patch just force the non-set/getcontext code path for Leopard environments, but use set/getcontext for systems below. md5_sha1_commoncrypto.diff: In Leopard, a new cryptographic API was introduced, which is compatible with OpenSSL's libcrypto. This patch enables the md5 and sha1 extensions to use the new CommonCrypto API instead of libcrypto, if the new API is found on the system. The new API is preferred on Leopard for performance purposes. use-dyld.diff: Ruby currently uses the NSSymbol APIs for its C extension loader on Mac OS X, however, this API was deprecated since Tiger (10.4) and it's recommended to use the dyld API instead. This patch makes Ruby using dlopen/dlsym instead of NSSymbol, for systems greater or equal than Tiger. use-setreugid.diff: Ruby marked the setreuid/setregid system calls broken on Mac OS X, which is true for systems below or equal than Tiger. However, in Leopard, these functions have been fixed to conform to the UNIX specs. Ruby can therefore use them safely on Leopard or greater. words-bigendian-from-arch.diff: This patch moves some code that was only effective for NeXT systems, for both Mac OS X and NeXT. WORDS_BIGENDIAN isn't trusted from configure, but instead we use __BIG_ENDIAN__. This is to make sure you can build Ruby for both ppc and i386 architectures (as a fat binary) on ppc, then use the binary on i386 without getting endianness problems. That's all. It would be nice if you could look at them, and consider merging them in the 1.8 branch. At least, ignore-gsetcontext.diff is important, because without it Ruby cannot build on Leopard (miniruby segfaults then). I would be happy to discuss the patches, and propose updated versions if necessary. Thanks, Laurent