anchor.diff:  
     nativeGhcCommand = "${nativeGhc.targetPrefix}ghc";
   
  +  buildPkgDb = ghcName: ''
  +    if [ -d "$p/lib/${ghcName}/package.conf.d" ]; then
  +      cp -f "$p/lib/${ghcName}/package.conf.d/"*.conf $packageConfDir/
  +      continue
  +    fi
  +    if [ -d "$p/include" ]; then
  +      configureFlags+=" --extra-include-dirs=$p/include"
  +    fi
  +    if [ -d "$p/lib" ]; then
  +      configureFlags+=" --extra-lib-dirs=$p/lib"
  +    fi
  +    if [[ -d "$p/Library/Frameworks" ]]; then
  +      configureFlags+=" --extra-framework-dirs=$p/Library/Frameworks"
  +    fi
  +  '';
  +
   in
   
   assert allPkgconfigDepends != [] -> pkgconfig != null;
  
positive.code:     echo "Build with ${ghc}."
      ${optionalString (hasActiveLibrary && hyperlinkSource) "export PATH=${hscolour}/bin:$PATH"}
  
      packageConfDir="$TMPDIR/package.conf.d"
      mkdir -p $packageConfDir
  
      setupCompileFlags="${concatStringsSep " " setupCompileFlags}"
      configureFlags="${concatStringsSep " " defaultConfigureFlags} $configureFlags"
  
      # host.*Pkgs defined in stdenv/setup.hs
      for p in "''${pkgsHostHost[@]}" "''${pkgsHostTarget[@]}"; do
        if [ -d "$p/lib/${ghc.name}/package.conf.d" ]; then
          cp -f "$p/lib/${ghc.name}/package.conf.d/"*.conf $packageConfDir/
          continue
        fi
        if [ -d "$p/include" ]; then
          configureFlags+=" --extra-include-dirs=$p/include"
        fi
        if [ -d "$p/lib" ]; then
          configureFlags+=" --extra-lib-dirs=$p/lib"
        fi
        if [[ -d "$p/Library/Frameworks" ]]; then
          configureFlags+=" --extra-framework-dirs=$p/Library/Frameworks"
        fi
      done
    ''
    # only use the links hack if we're actually building dylibs. otherwise, the
  
negative.code:     done
  
      echo setupCompileFlags: $setupCompileFlags
      ${optionalString (setupHaskellDepends != [])
         ''
         echo GHC_PACKAGE_PATH="$setupPackageConfDir:"
         GHC_PACKAGE_PATH="$setupPackageConfDir:" ''
      }${nativeGhcCommand} $setupCompileFlags --make -o Setup -odir $TMPDIR -hidir $TMPDIR $i
  
      runHook postCompileBuildDriver
    '';
  