Projects/KDE on Mac OS X/Macbook Manifesto

Jump to: navigation, search

Contents

The Macbook Manifesto

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.

Install Apple's gcc-4.2

Leopard

  • Sign up for an ADC account and download Xcode. The most recent version as of this writing is 3.1.1.
  • Install it

Tiger


The following information is old and may no longer be necessary.

  • Run the following commands in the Terminal
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/
  • The following may also be needed
sudo ln -hsf 4.2 /Developer/SDKs/MacOSX10.4u.sdk/usr/include/gcc/darwin/default
  • That should be it if memory serves, but a similar ditto to /Developer/SDKs/MacOSX10.4u.sdk/usr/ may also be necessary

Install and Configure Macports

  • Install Macports
  • Update macports via the following commands
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.

  • The first, and simplest method is to edit
    /opt/local/etc/macports/macports.conf
    and change
    • universal_target to 10.4
    • universal_sysroot to /Developer/SDKs/MacOSX10.4u.sdk

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

Install the software

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.

Issues so far

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...

Package it all up

  • Open up PackageMaker.app.
  • Navigate to /opt/local/var/macports/software/
  • Drag the directories you need into Packagemaker.

This page was last modified on 29 June 2011, at 21:57. This page has been accessed 10,549 times. Content is available under Creative Commons License SA 3.0 as well as the GNU Free Documentation License 1.2.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V.Legal