Skip to content
mistydemeo edited this page Mar 24, 2013 · 2 revisions

This page covers a few special features which Tigerbrew has added to make working with PowerPC and Tiger machines more easily.

Determining CPU type

You might need to use different configure switches on PowerPC, or you may need to configure a package differently based on which kind of PowerPC processor the user has. Tigerbrew provides a few helper methods for this.

CPU type

Hardware::CPU.type will return :intel for Intel processors, or :ppc for PowerPC processors. You can base conditional logic off of this. For example, from OpenSSL, which has to be configured differently between Intel and PPC:

if Hardware.cpu_type == :intel
  args << (MacOS.prefer_64_bit? ? "darwin64-x86_64-cc" : "darwin-i386-cc")
else
  args << (MacOS.prefer_64_bit? ? "darwin-ppc64-cc" : "darwin-ppc-cc")
end

PowerPC type

Hardware::CPU.family will return the family of processor the user's computer has. This works both for Intel and PowerPC. The values for PowerPC processors are:

  • :g3 - PowerPC 750
  • :g4 - PowerPC 7400
  • :g4e - PowerPC 7450
  • :g5 - PowerPC 970

You might use this to enable or disable certain features - for instance, to disable Altivec optimizations on G3. However, for Altivec, you might want to use...

AltiVec and SSE helpers

A few helper methods can help you figure out whether certain special instruction sets are available. These include:

  • Hardware::CPU.altivec? - Returns true on PowerPC processors newer than G3
  • Hardware::CPU.sse3? - Returns true on Intel processors
  • Hardware::CPU.sse4? - Returns true on Intel processors newer than Core 2