Fix MacOS (darwin) Chromium build on LLVM 10

Chromium MacOS bots are at version 10.10, while the configs were
compiled on 10.13. We now pass the version to the compiler when building
LLVM, which modifies the config files to support the specified version.
In this case, it simply undefines HAVE_FUTIMENS.

Bug: b/152339534
Change-Id: I76d231660e6ee6f087bb67389a0a61abe4673740
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/46549
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Antonio Maiorano <amaiorano@google.com>
diff --git a/third_party/llvm-10.0/configs/darwin/include/llvm/Config/config.h b/third_party/llvm-10.0/configs/darwin/include/llvm/Config/config.h
index c4f0ea2..22aa5a2 100644
--- a/third_party/llvm-10.0/configs/darwin/include/llvm/Config/config.h
+++ b/third_party/llvm-10.0/configs/darwin/include/llvm/Config/config.h
@@ -74,7 +74,7 @@
 /* #undef HAVE_FFI_H */
 
 /* Define to 1 if you have the `futimens' function. */
-#define HAVE_FUTIMENS 1
+/* #undef HAVE_FUTIMENS */
 
 /* Define to 1 if you have the `futimes' function. */
 #define HAVE_FUTIMES 1
diff --git a/third_party/llvm-10.0/scripts/update.py b/third_party/llvm-10.0/scripts/update.py
index a4c2ab1..d25eecf 100644
--- a/third_party/llvm-10.0/scripts/update.py
+++ b/third_party/llvm-10.0/scripts/update.py
@@ -118,6 +118,8 @@
     '-DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON'
 ]
 
+# Used when building LLVM for darwin. Affects values set in the generated config files.
+MIN_MACOS_VERSION = '10.10'
 
 @contextlib.contextmanager
 def pushd(new_dir):
@@ -210,6 +212,9 @@
     cmake_options = LLVM_CMAKE_OPTIONS + ['-DLLVM_TARGETS_TO_BUILD=' +
                                           ';'.join(t for t in get_cmake_targets_to_build(name))]
 
+    if name == 'darwin':
+        cmake_options.append('-DCMAKE_OSX_DEPLOYMENT_TARGET={}'.format(MIN_MACOS_VERSION))
+
     os.makedirs(LLVM_OBJS, exist_ok=True)
     run_subprocess(['cmake', host, LLVM_DIR] +
                    cmake_options, log_level=2, cwd=LLVM_OBJS)