anchor.diff:      "--prefix=$out"
       "--libdir=\\$prefix/lib/\\$compiler"
       "--libsubdir=\\$abi/\\$libname"
  -    (optionalString enableSeparateDataOutput "--datadir=$data/share/${ghc.name}")
  +    (optionalString enableSeparateDataOutput "--datadir=$data/share/${ghcNameWithPrefix}")
       (optionalString enableSeparateDocOutput "--docdir=${docdir "$doc"}")
     ] ++ optionals stdenv.hasCC [
       "--with-gcc=$CC" # Clang won't work without that extra information.
     ] ++ [
       "--package-db=$packageConfDir"
  -    (optionalString (enableSharedExecutables && stdenv.isLinux) "--ghc-option=-optl=-Wl,-rpath=$out/lib/${ghc.name}/${pname}-${version}")
  +    (optionalString (enableSharedExecutables && stdenv.isLinux) "--ghc-option=-optl=-Wl,-rpath=$out/lib/${ghcNameWithPrefix}/${pname}-${version}")
       (optionalString (enableSharedExecutables && stdenv.isDarwin) "--ghc-option=-optl=-Wl,-headerpad_max_install_names")
       (optionalString enableParallelBuilding "--ghc-options=${parallelBuildingFlags}")
       (optionalString useCpphs "--with-cpphs=${cpphs}/bin/cpphs --ghc-options=-cpp --ghc-options=-pgmP${cpphs}/bin/cpphs --ghc-options=-optP--cpp")
  
positive.code:   # pkgs* arrays defined in stdenv/setup.hs
    + ''
      for p in "''${pkgsBuildBuild[@]}" "''${pkgsBuildHost[@]}" "''${pkgsBuildTarget[@]}"; do
        ${buildPkgDb nativeGhc.name "$setupPackageConfDir"}
      done
      ${nativeGhcCommand}-pkg --${nativePackageDbFlag}="$setupPackageConfDir" recache
    ''
    # For normal components
    + ''
      for p in "''${pkgsHostHost[@]}" "''${pkgsHostTarget[@]}"; do
        ${buildPkgDb ghc.name "$packageConfDir"}
        if [ -d "$p/include" ]; then
          configureFlags+=" --extra-include-dirs=$p/include"
        fi
  
negative.code:   ghcCommand' = if isGhcjs then "ghcjs" else "ghc";
    ghcCommand = "${ghc.targetPrefix}${ghcCommand'}";
  
    ghcNameWithPrefix = "${ghc.targetPrefix}${ghc.haskellCompilerName}";
  
    nativeGhcCommand = "${nativeGhc.targetPrefix}ghc";
  
    buildPkgDb = ghcName: packageConfDir: ''
  