Compiling for Powerpc, how to?

skinniezinho

macrumors 65816
Original poster
Jan 1, 2009
1,022
44
Portugal
Hi guys,
As some may noticed I love powerpc, I love linux (the thinkpad is running arch linux) and with a Quad G5 on it's way I want to contribute a little more to a good life for powerpc.
I noticed that some opensource programs offer builds for Intel mac, Powerpc linux but not powerpc mac, how can I do it since I have the source?
One good example is librecad http://librecad.org/cms/home.html

And sometimes there are others, any easy way to do it?
I understand zero of programming.
 

Wildy

macrumors 6502
Jan 25, 2011
323
0
A little disclaimer: Many FOSS programs only offer Intel binaries because they happened to be built on an Intel machine. While there will be some which genuinely need the newer features from Snow Leopard etc., it is possible to build many on PPC.

Most Linux programs are available from Macports, but there are many which don't use Mac-native libraries (Cocoa in particular) and so pull in a ton of other Linux dependancies that you won't find many Mac-native applications using (GTK for example). The bottom line is that if you want to provide binaries of these projects for PowerPC Mac users then you need to strip out these dependancies and substitute them for something which doesn't require a ton of setup.

Anyway, LibreCAD looks to use Qt (instead of Cocoa or GTK), which provides a native UI for us Mac users. You will need to install the Qt devlopment kit. LibreCAD uses Qt 4, which is lucky because Qt 5 is not supported on PowerPC. Here is the download page: http://qt-project.org/downloads. It's quite possible that they don't ship a PowerPC binary, in which case you will have to compile this from source (will take a while). You may want to install Macports to get this, otherwise you can find the source on the Qt downloads page. Also on the list of things to build is git (also in Macports), which you will need when working with just about any FOSS project.

So, on to the good stuff...

Get the dependancies:
Code:
sudo port install gitgcc46 qt4-creator-mac qt4-mac boost muparser
Change the gcc used to build ports:
Code:
sudo port select --set gcc mp-gcc46
Once you have these tools, it's simply a case of following the instructions they provide. Download the source, and compile:
Code:
git clone https://github.com/LibreCAD/LibreCAD.git
cd LibreCAD
qmake librecad.pro -r -spec mkspec/macports
make -j 2
You may change the number 2 to whatever your core count+1 is.

This should produce an executable .app.


Installing Macports: http://trac.macports.org/wiki/InstallingMacPorts
Building ports from source: http://trac.macports.org/wiki/UsingMacPortsQuickStart


You are going to need to install a bunch of stuff first - there are a few hoops to jump through.

First step is getting and installing the latest Xcode for PowerPC (I believe it's 3.x). This will provide you with the toolchain you'll be using to compile everything from now on.
 
Last edited:

CptSky

macrumors regular
Feb 1, 2013
140
13
[...]And sometimes there are others, any easy way to do it?
I understand zero of programming.
You will be able to port only few apps if you know nothing in programming. When porting an app to another system, there is always bugs and you must update the build script. If the original maintainer doesn't support OS X PPC, except if you propose him a patch, he won't probably work on the issues.
 

rabidz7

macrumors 65816
Jun 24, 2012
1,203
2
Ohio
I tried to port nVclock, I never could figure it out. It would have been one of the greatest PowerPC apps. If anyone wants to attempt to port this, it would be wonderful!
 

spunkgarLEWII

macrumors regular
Jun 1, 2013
100
0
Why don't u do it, Rabidz? You seem to have gotten Mountain Lion and soon Mavericks to run on a PPC processor.. so, we will open the stage to you to develop nVclock for PowerPC.

I tried to port nVclock, I never could figure it out. It would have been one of the greatest PowerPC apps. If anyone wants to attempt to port this, it would be wonderful!
 

skinniezinho

macrumors 65816
Original poster
Jan 1, 2009
1,022
44
Portugal
Wildy Thanks for the instructions, as soon as I can I will try it.

You will be able to port only few apps if you know nothing in programming. When porting an app to another system, there is always bugs and you must update the build script. If the original maintainer doesn't support OS X PPC, except if you propose him a patch, he won't probably work on the issues.
Yes I know that I will only be able to port a few apps, or even none :p but I would like to try it =) if I can do it sucessfully it is one program more for ppc =)

I tried to port nVclock, I never could figure it out. It would have been one of the greatest PowerPC apps. If anyone wants to attempt to port this, it would be wonderful!
NVclock for overclocking nvidia cards?
 

Wildy

macrumors 6502
Jan 25, 2011
323
0
I tried to port nVclock, I never could figure it out. It would have been one of the greatest PowerPC apps. If anyone wants to attempt to port this, it would be wonderful!
Nvclock relies very much on the Linux graphics subsystem, which is radically different from that of OSX. Nvclock would be good as a reference, but it would be quicker to rewrite it than to port it (there'd be more new code than unchanged code).
 

rabidz7

macrumors 65816
Jun 24, 2012
1,203
2
Ohio
Nvclock relies very much on the Linux graphics subsystem, which is radically different from that of OSX. Nvclock would be good as a reference, but it would be quicker to rewrite it than to port it (there'd be more new code than unchanged code).
I am working with the command line version.
I do not know much about programming other than good html and css, and very, very basic java.
I could not even find the stuff in the software that actually does the overclocking.
 

Wildy

macrumors 6502
Jan 25, 2011
323
0
By graphics subsystem, I mean the way the OS interacts with the graphics card, as opposed to the user interface.

It has to be said, you didn't pick the easiest project to begin with!