Jump to content

Mini-Guide: Porting Transmission to Mac OS X x86

2 posts in this topic

Recommended Posts

Porting Transmission to Mac OS X x86


Transmission website


This is the first time I release an application as a Universal Binary, here is how it happened... Transmission is a small application, but what is true for small apps probably applies to the big ones. I hope this might be of some help to other devs.


Endianness issues

All messages in the BitTorrent protocol store values in network order (big endian). This was the only potential endianness issue in Transmission, which is not an issue if you just use the ntohl / htonl / etc functions when required. This was straightforward to me because I run Transmission on BeOS and Linux (x86) too, but you never know, there may be PPC-addicts around who assume it will always run on a big endian CPU.


Updating my Jamfile

Because Transmission is multi platform, only the GUI is built with Xcode. The core routines are first compiled into a static library, libtransmission.a, using a Jamfile (if you don't know what jam is, here you go). The command-line version of Transmission is built from the Jamfile too.

Just add the proper compiler flags (-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch ppc -arch i386) and linker flags (-Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk) and you can start compiling universal binaries.

One issue though: Jamfiles, and probably many Makefiles too, use 'ar' to archive static libraries. This doesn't work with universal binaries. On OS X, you need to replace the jam or make rule so it runs 'libtool -static foo.o bar.o -o libfoo.o' instead of 'ar ru libfoo.a foo.o bar.o'. Now you get a static library for both architectures.


Updating the Xcode project

Not much too say here, just do what Apple writes in its "Universal Binary Programming Guidelines": choose the MacOSX10.4u SDK, click to build for both PPC and Intel.


That's it!

Transmission 0.3 was released as a UB, and I hear it works fine on x86...

Link to comment
Share on other sites


  • Create New...