Make Mac explicitly target 10.9

Before:

[scottmg:~/work/gn ((90dcf0c7...))]$ otool -l out/gn | grep -2 LC_VERS
    uuid 79185434-2B98-355D-8C32-41A075FDECAD
Load command 9
      cmd LC_VERSION_MIN_MACOSX
  cmdsize 16
  version 10.13

After:

[scottmg:~/work/gn ((098bc140...))]$ otool -l out/gn | grep -2 LC_VERS
    uuid 368967ED-9FC0-3297-AC0E-FD1961818512
Load command 9
      cmd LC_VERSION_MIN_MACOSX
  cmdsize 16
  version 10.9

Change-Id: Iba8072f3032ef76011bc0d13b20e04bbf41dff90
Reviewed-on: https://gn-review.googlesource.com/1960
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Brett Wilson <brettw@chromium.org>
diff --git a/build/gen.py b/build/gen.py
index eb506e3..41ed3cd 100755
--- a/build/gen.py
+++ b/build/gen.py
@@ -245,6 +245,11 @@
           '-lgcc_s',
           '-lpthread',
       ])
+    elif is_mac:
+      min_mac_version_flag = '-mmacosx-version-min=10.9'
+      cflags.append(min_mac_version_flag)
+      ldflags.append(min_mac_version_flag)
+
   elif is_win:
     if not options.debug:
       cflags.extend(['/Ox', '/DNDEBUG', '/GL'])
diff --git a/tools/gn/function_write_file_unittest.cc b/tools/gn/function_write_file_unittest.cc
index 95414ce..8b64a29 100644
--- a/tools/gn/function_write_file_unittest.cc
+++ b/tools/gn/function_write_file_unittest.cc
@@ -13,6 +13,10 @@
 #include "tools/gn/test_with_scope.h"
 #include "util/test/test.h"
 
+#if defined(OS_LINUX) || defined(OS_MACOSX)
+#include <sys/time.h>
+#endif
+
 namespace {
 
 // Returns true on success, false if write_file signaled an error.
@@ -82,8 +86,8 @@
   ASSERT_TRUE(::SetFileTime(foo_file.GetPlatformFile(), nullptr,
                             &last_access_filetime, &last_modified_filetime));
 #else
-  timespec ts_times[2] = {};
-  ASSERT_EQ(futimens(foo_file.GetPlatformFile(), ts_times), 0);
+  struct timeval times[2] = {};
+  ASSERT_EQ(futimes(foo_file.GetPlatformFile(), times), 0);
 #endif
 
   // Read the current time to avoid timer resolution issues when comparing