Use `--enable_platform_specific_config` in `.bazelrc`.

This magically applies the `linux`, `macos` or `windows` configuration
depending on the OS. Apart from simplifying things for us, this should
hopefully also unbreak the RE2 build that Bazel folks run in their CI.

Fixes #428.

Change-Id: I2f4192dd728661558a8c4c4c8dd68a720af3ff71
Reviewed-on: https://code-review.googlesource.com/c/re2/+/61370
Reviewed-by: Perry Lorier <perryl@google.com>
Reviewed-by: Paul Wankadia <junyer@google.com>
diff --git a/.bazelrc b/.bazelrc
index a102ac0..8141639 100644
--- a/.bazelrc
+++ b/.bazelrc
@@ -7,6 +7,7 @@
 # `BAZEL_USE_CPP_ONLY_TOOLCHAIN` since Bazel wouldn't respect the former without
 # the latter. However, the latter stopped Bazel from using Xcode and `-framework
 # Foundation`, which CCTZ (vendored into Abseil) requires.
+build --enable_platform_specific_config
 build:linux --cxxopt=-std=c++14
 build:macos --cxxopt=-std=c++14
 build:windows --cxxopt=/std:c++14
diff --git a/.github/bazel.sh b/.github/bazel.sh
index 2268b57..7295ec6 100755
--- a/.github/bazel.sh
+++ b/.github/bazel.sh
@@ -1,12 +1,9 @@
 #!/bin/bash
 set -eux
 
-# macOS has GNU bash 3.x, so ${RUNNER_OS,,} isn't supported.
-config=--config=$(echo ${RUNNER_OS} | tr '[:upper:]' '[:lower:]')
-
 bazel clean
-bazel build ${config} --compilation_mode=dbg -- //:all
-bazel test  ${config} --compilation_mode=dbg -- //:all \
+bazel build --compilation_mode=dbg -- //:all
+bazel test  --compilation_mode=dbg -- //:all \
   -//:dfa_test \
   -//:exhaustive1_test \
   -//:exhaustive2_test \
@@ -15,8 +12,8 @@
   -//:random_test
 
 bazel clean
-bazel build ${config} --compilation_mode=opt -- //:all
-bazel test  ${config} --compilation_mode=opt -- //:all \
+bazel build --compilation_mode=opt -- //:all
+bazel test  --compilation_mode=opt -- //:all \
   -//:dfa_test \
   -//:exhaustive1_test \
   -//:exhaustive2_test \
diff --git a/app/build.sh b/app/build.sh
index c8c9837..c272bf5 100755
--- a/app/build.sh
+++ b/app/build.sh
@@ -23,7 +23,7 @@
   # Emscripten doesn't support `-fstack-protector`.
   AR=emar CC=emcc \
     ${BAZEL} build --compilation_mode=opt \
-    --config=linux --copt=-fno-stack-protector \
+    --copt=-fno-stack-protector \
     -- :all
   # Bazel doesn't retain the `_re2.wasm` artifact;
   # we have to redo the link command to obtain it.
diff --git a/python/setup.py b/python/setup.py
index 16d8e69..b0cbd5b 100644
--- a/python/setup.py
+++ b/python/setup.py
@@ -45,7 +45,7 @@
 class BuildExt(setuptools.command.build_ext.build_ext):
 
   def build_extension(self, ext):
-    if 'RUNNER_OS' not in os.environ:
+    if 'GITHUB_ACTIONS' not in os.environ:
       return super().build_extension(ext)
 
     # For @pybind11_bazel's `python_configure()`.
@@ -55,7 +55,6 @@
     self.spawn(cmd)
 
     cmd = ['bazel', 'build']
-    cmd.append(f'--config={os.environ["RUNNER_OS"].lower()}')
     if 'BAZEL_CPU' in os.environ:
       cmd.append(f'--cpu={os.environ["BAZEL_CPU"].lower()}')
     cmd += ['--compilation_mode=opt', '--', ':all']