Convert the bootstrap system to using improved host platform detection.

Part of #6849.

Closes #9051.

PiperOrigin-RevId: 261196683
diff --git a/compile.sh b/compile.sh
index a53dc83..d91583d 100755
--- a/compile.sh
+++ b/compile.sh
@@ -61,12 +61,12 @@
 new_step 'Building Bazel with Bazel'
 display "."
 log "Building output/bazel"
-# We set host and target platform directly since the defaults in @bazel_tools
-# have not yet been generated.
+# We set host and target platform directly because we are building for the local
+# host.
 bazel_build "src:bazel_nojdk${EXE_EXT}" \
   --action_env=PATH \
-  --host_platform=@bazel_tools//platforms:host_platform \
-  --platforms=@bazel_tools//platforms:target_platform \
+  --host_platform=@local_config_platform//:host \
+  --platforms=@local_config_platform//:host \
   || fail "Could not build Bazel"
 bazel_bin_path="$(get_bazel_bin_path)/src/bazel_nojdk${EXE_EXT}"
 [ -e "$bazel_bin_path" ] \
diff --git a/scripts/bootstrap/compile.sh b/scripts/bootstrap/compile.sh
index 6434f48..06a9854 100755
--- a/scripts/bootstrap/compile.sh
+++ b/scripts/bootstrap/compile.sh
@@ -301,6 +301,7 @@
   cat <<EOF >${OUTPUT_DIR}/classes/com/google/devtools/build/lib/bazel/rules/tools.WORKSPACE
 local_repository(name = 'bazel_tools', path = '${BAZEL_TOOLS_REPO}')
 bind(name = "cc_toolchain", actual = "@bazel_tools//tools/cpp:default-toolchain")
+local_config_platform(name = 'local_config_platform')
 EOF
 
   create_deploy_jar "libblaze" "com.google.devtools.build.lib.bazel.Bazel" \