Contents |
My Macbook Pro suffered a cataclysmic error for the third time in as many weeks tonight. Two times due to user error, once due to issues which I can only attribute to a failing hard drive. The writing is on the wall. The end is nigh. So it is that I've decided to stop procrastinating and begin my write-up on how to make universal packages for OS X.
In order to "future-proof" the KDE/Mac distribution I thought it best to compile the whole thing with gcc 4.2. When OS X.6 comes out, it is quite possible (though unlikely IMO) that gcc 4.2 will be the lowest version supported by XCode. In addition, prominent KDE software projects rely on features of C++ which do not work in Apple's current version gcc 4.0 due to bugs. Compiling the software with gcc 4.2 will help us to avoid this limitation.
As such you will be instructed on how to create universal packages using gcc 4.2. Leopard users can already can gcc 4.2 by installing Xcode (grab 3.1 or greate please). Tigers users will have to install it manually. We'll then integrate gcc 4.2 with the 10.4 universal SDK on Tiger. We're going to cheat. Pay close Attention.
The following information is old and may no longer be necessary.
sudo ditto /opt/local/var/macports/software/apple-gcc42/*/opt/local/ /Developer/SDKs/MacOSX10.4u.sdk/usr/
sudo ditto /opt/local/var/macports/software/apple-gcc42/*/opt/local/ /Developer/usr/
sudo ln -hsf 4.2 /Developer/SDKs/MacOSX10.4u.sdk/usr/include/gcc/darwin/default
sudo port selfupdate && sudo port sync
Macports automatically sets the SDK used when compiling software. In order to compile universal binaries for both 10.4 and 10.5, we must use the 10.4u SDk. Beginning with Macports version 1.7.0 this can be set in the macports.conf file.
/opt/local/etc/macports/macports.conf
Since we'll be doing a lot of port compilations we're going to change some default settings. In /opt/local/etc/macports/macports.conf change
x11prefix /usr/X11R6 to x11prefix /usr/Z11R6
buildmakejobs 1 to buildmakejobs 0
The zero settings tells macports to automatically select how many build jobs to run. I set manually mine at 4 for my Core 2 Duo Macbook and 2 for my Core Duo (1st gen) Macbook Pro.
I also change
portautoclean yes to portautoclean no
to prevent macports from automatically deleting the build tree. Follow at your own discretion.
And finally to the file /opt/local/etc/macports/variants.conf add
+no_x11 +quartz +universal +qt4 -x11
Now comes the (relatively) easy part. Instead of recompiling all of the macports packages (which require some Portfile massaging), you'll just install the pkgs from the kde-mac site. They come with all the headers, etc you need. If there is some software there that is necessary just ask in the #kde-mac channel on Freenode or on the kde-mac@kde.org mailing list for it to be added.
Now all you need to do is create your own Portfile and compile your little heart out. I'll add any hiccups experienced here as they show up. You should too.
For convenience I'll dump my local macports repo here for you to check out. This can serve as an outdated reference for creating portfiles (kde4 directory) or be used to see what i did when I encountered probblems compiling universal ports.
djvulibre needs a file, djvulibre-3.5.19/tools/jb2cmp/libjb2cmp.a run through ranlib before the universal build will progress. I had this problem on both 10.4 and 10.5. Should report to upstream...