Work-around missing librt for cross-compiling Chrome for Android in AOSP.
authorbmeurer@chromium.org <bmeurer@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Fri, 30 Aug 2013 14:10:13 +0000 (14:10 +0000)
committerbmeurer@chromium.org <bmeurer@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Fri, 30 Aug 2013 14:10:13 +0000 (14:10 +0000)
R=jkummerow@chromium.org

Review URL: https://codereview.chromium.org/23819005

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16456 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/platform/time.cc
tools/gyp/v8.gyp

index 653eb14..073ca1e 100644 (file)
@@ -509,6 +509,15 @@ TimeTicks TimeTicks::HighResNow() {
            info.numer / info.denom);
 #elif V8_OS_SOLARIS
   ticks = (gethrtime() / Time::kNanosecondsPerMicrosecond);
+#elif V8_LIBRT_NOT_AVAILABLE
+  // TODO(bmeurer): This is a temporary hack to support cross-compiling
+  // Chrome for Android in AOSP. Remove this once AOSP is fixed, also
+  // cleanup the tools/gyp/v8.gyp file.
+  struct timeval tv;
+  int result = gettimeofday(&tv, NULL);
+  ASSERT_EQ(0, result);
+  USE(result);
+  ticks = (tv.tv_sec * Time::kMicrosecondsPerSecond + tv.tv_usec);
 #elif V8_OS_POSIX
   struct timespec ts;
   int result = clock_gettime(CLOCK_MONOTONIC, &ts);
index 3f99b13..a73ece0 100644 (file)
                   }],
                 ],
               }, {
-                'link_settings': {
-                  'target_conditions': [
-                    ['_toolset=="host"', {
-                      'libraries': [
-                        '-lrt'
-                      ]
-                    }]
-                  ]
-                },
+                # TODO(bmeurer): What we really want here, is this:
+                #
+                # 'link_settings': {
+                #   'target_conditions': [
+                #     ['_toolset=="host"', {
+                #       'libraries': [
+                #         '-lrt'
+                #       ]
+                #     }]
+                #   ]
+                # },
+                #
+                # but we can't do this right now, as the AOSP does not support
+                # linking against the host librt, so we need to work around this
+                # for now, using the following hack (see platform/time.cc):
+                'target_conditions': [
+                  ['_toolset=="host"', {
+                    'defines': [
+                      'V8_LIBRT_NOT_AVAILABLE',
+                    ],
+                  }],
+                ],
                 'sources': [
                   '../../src/platform-linux.cc'
                 ]