What should I learn for porting linux and unix apps to Mac?

alphap1us

Registered
Hello,
I am anundergraduate, non-CS major. I am interested in learning how to port or help port apps written in linux and any of the unix variants to run natively in Mac OS X. By this I mean take whatever the orginal programmer has written and make it into a a double-clickabble package that someone can install easily and then double click on an icon to launch a GUI, just like a native app. Could someone tell me the things I need to learn in order to do this? It would be most helpful if people could provide both the "fields of expertise" I need to learn and specific sources (books, but links to tutorials especially since I am poor) I hope to be able to benefit the OS X community by helping to port more apps to native OS X faster. As far as my current skills go. I under stand using OS X pretty well but not really even X11 or anything deeper than that. Thanks all,
Joe Bolte
 
I would guess that you mean porting *nix GUI apps? If that is the case, you've got your work cut out for you. You'll need to study how GTK+ works & how the applications interact with it. Most *nix GUI apps use GTK+ to make their windows and stuff. Not all of them, but the vast majority.

It won't be easy. GTK+ is very convoluted, if you ask me. It has thousands of different commands (some of which seem to do the same thing!) to create a UI. Plus there are different versions of it - some programs use the older versions. So you'd have to find out which version it uses (you can usually check the configure script, if it has one. It'll have a check to see if you have a version of GTK+ greater than or equal to the one it needs).

That definitely isn't going to be easy - it's basically why you haven't seen a lot of *nix GUI apps being ported over. You don't have to understand every small part of GTK+, but you will need to understand the calls that the app is using to create the UI to create one like it in Cocoa and have the program still work as intended.

There's also the problem of libraries - most *nix apps require additional libraries to be installed. If you want a simple double clickable app, and don't want the user to have to install all of these libraries, you'll have to include them as part of the application bundle. There you could link against them. This will up the size of the application, though.

And of course, there are a few incompatibilites in the code itself - some calls that are available on *nix's, but not on Darwin (OS X). You would need to figure out what the app is trying to do and find out if it can be done on Darwin.

You'll have a lot of things to look at. You'll need to know C/C++ and you'll need to know Obj-C & it's runtime pretty well. Some *nix apps use assembly code as well - and that doesn't port between the two different kernel architectures, so if you wanted to port any of them, you'd need to learn assembly as well. Luckily, there aren't that many that use assembly. It's a heavy load of stuff to learn! You can see why there are very few things actually ported, and those that are are mainly apps that don't have a GUI.
 
Thanks both of you for those pointers. This sounds like a tough job and I am now confused. I see the pdf for porting from *nix to Carbon but is there one for Cocoa? For some reason, I think it would be simpler to port to Cocoa since it is all Darwin and the apps run faster but this is only becuase of my hazy conception of how these things actually work. Sounds like a thakless job but I have some time this summer....
 
Back
Top