If you're on a recent Illumos system, then you should be able to get a working build environment by installing the following packages using your system's package manager.
Use pkgin to install the following:
Configure PATH to contain ~/.cabal/bin.
Use cabal to install the following:
From here return to Building and follow Getting the sources then Just building and installing GHC.
These instructions have only been checked for GHC 7.6.3 on OpenIndiana 151a8. They should also apply to earlier and later versions of GHC.
In order to build GHC on OpenIndiana we'll be using already precompiled version of ghc 7.2.2 from sfe repository
pfexec pkg install runtime/ghc
To configure system for building we need to specify correct gmp include directory
In order to build GHC you need to use GNU's gmake command instead of OpenIndiana's make which is