docs: def build_extensions(self):
          """Compile the python extension module for further installation."""
          global final_supported_archs
  
          ext_extra_objects = []
          ext_libs = []
          ext_libs_dir = []
          ext_includes = []
  
          self.platform = CustomBuildExtension.PLATFORMS.get( sys.platform, None )
          if self.platform == None:
              raise Exception("unsupported platform: %s" % sys.platform)
  
          if self.with_static_binutils: # the user has specified a custom binutils distro.
              print "[+] Using specific binutils static distribution"
              print "[+]   %s" % self.with_static_binutils
              self.platform["libs"] = [os.path.join( self.with_static_binutils, "lib"),]
              self.platform["includes"] = [os.path.join( self.with_static_binutils, "include"),]
              self.platform["possible-lib-ext"] = [".a",] # for all unix platforms.
  
          # check for known includes
          for inc in self.platform["includes"]:
              if self.check_includes(inc):
                  self.includes = inc # found a valid include dir with bintuils
                  break
          if self.includes == None:
              raise Exception("unable to determine correct include path for bfd.h / dis-asm.h")
  
          print "[+] Using binutils headers at:"
          print "[+]   %s" % self.includes
  
          # we'll use this include path for building.
          ext_includes = [self.includes, ]
  
          # Try to guess libopcodes / libbfd libs.
          libs_dirs = self.platform["libs"]
          print "[+] Searching binutils libraries..."
          for libdir in libs_dirs:
              for possible_lib_ext in self.platform["possible-lib-ext"]:
                  libs = self.find_binutils_libs(libdir, possible_lib_ext)
                  if libs:
                      if self.libs:
                          self.libs = self.libs + libs
                      else:
                          self.libs = libs
                      break
  
          if self.libs == None:
              raise Exception("unable to find binutils libraries.")
  
          for lib in self.libs:
              print "[+]   %s" % lib
          #
          # check for libopcodes / libbfd
          #
          libnames = [os.path.basename(lib) for lib in self.libs]
          libraries_paths = [os.path.dirname(lib) for lib in self.libs]
          libraries_paths = list(set(libraries_paths))  # removing duplicates
          if not all( [lib.startswith("libopcodes") or lib.startswith("libbfd") for lib in libnames] ):
              raise Exception("missing expected library (libopcodes / libbfd) in %s." % "\n".join(libraries_paths))
  
          ext_libs_dir += libraries_paths
  
          if self.with_static_binutils:
              # use libs as extra objects...
              ext_extra_objects.extend( self.libs )
          else:
              ext_libs = [self.prepare_libs_for_cc(os.path.basename(lib)) for lib in self.libs]
  
          # add dependecy to libiberty
          if self.with_static_binutils or sys.platform == "darwin": # in OSX we always needs a static lib-iverty.
  
              lib_liberty_partialpath = libraries_paths
              if sys.platform == "darwin": # in osx the lib-iberty is prefixe by "machine" ppc/i386/x86_64
                  lib_liberty_partialpath.append( self._darwin_current_arch() )
              lib_liberty_partialpath.append( "libiberty.a" )
  
              lib_liberty_fullpath = os.path.join(*lib_liberty_partialpath ) # merge the prefix and the path
              if not os.path.isfile(lib_liberty_fullpath):
                  raise Exception("missing expected library (libiberty) in %s." % "\n".join(libraries_paths))
              ext_extra_objects.append(lib_liberty_fullpath)
  
          # generate .py / .h files that depends of libopcodes / libbfd currently selected
          final_supported_archs = self.generate_source_files()
  
          # final hacks for OSX
          if sys.platform == "darwin":
              # fix arch value.
              os.environ["ARCHFLAGS"] = "-arch %s" % self._darwin_current_arch()
              # In OSX we've to link against libintl.
              ext_libs.append("intl")
  
              # TODO: we have to improve the detection of gettext/libintl in OSX.. this is a quick fix.
              dirs = [
                  "/usr/local/opt/gettext/lib", # homebrew
                  "/opt/local/lib" # macports
              ]
              for d in dirs:
                  if os.path.exists(d):
                      ext_libs_dir.append(d)
  
          # fix extensions.
          for extension in self.extensions:
              extension.include_dirs.extend( ext_includes )
              extension.extra_objects.extend( ext_extra_objects )
              extension.libraries.extend( ext_libs )
              extension.library_dirs.extend( ext_libs_dir )
  
          return build_ext.build_extensions(self)