Title: [97493] trunk
Revision
97493
Author
[email protected]
Date
2011-10-14 12:47:35 -0700 (Fri, 14 Oct 2011)

Log Message

[Chromium] Inherit settings from Chromium's envsetup.sh, address a NDK todo
https://bugs.webkit.org/show_bug.cgi?id=70028

Patch by Peter Beverloo <[email protected]> on 2011-10-14
Reviewed by Adam Barth.

Source/_javascript_Core:

* _javascript_Core.gyp/_javascript_Core.gyp:

Source/WebCore:

* WebCore.gyp/WebCore.gyp:

Source/WebKit/chromium:

* WebKit.gyp:
* gyp_webkit:

Tools:

* Scripts/update-webkit-chromium:
* Scripts/webkitdirs.pm:
(buildChromiumMakefile):
(buildChromium):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (97492 => 97493)


--- trunk/Source/_javascript_Core/ChangeLog	2011-10-14 19:45:38 UTC (rev 97492)
+++ trunk/Source/_javascript_Core/ChangeLog	2011-10-14 19:47:35 UTC (rev 97493)
@@ -1,3 +1,12 @@
+2011-10-14  Peter Beverloo  <[email protected]>
+
+        [Chromium] Inherit settings from Chromium's envsetup.sh, address a NDK todo
+        https://bugs.webkit.org/show_bug.cgi?id=70028
+
+        Reviewed by Adam Barth.
+
+        * _javascript_Core.gyp/_javascript_Core.gyp:
+
 2011-10-14  Yuqiang Xian  <[email protected]>
 
         DFG JIT 32_64 - Performance fix for ResolveGlobal

Modified: trunk/Source/_javascript_Core/_javascript_Core.gyp/_javascript_Core.gyp (97492 => 97493)


--- trunk/Source/_javascript_Core/_javascript_Core.gyp/_javascript_Core.gyp	2011-10-14 19:45:38 UTC (rev 97492)
+++ trunk/Source/_javascript_Core/_javascript_Core.gyp/_javascript_Core.gyp	2011-10-14 19:47:35 UTC (rev 97493)
@@ -48,7 +48,7 @@
     ],
   },
   'conditions': [
-    ['os_posix == 1 and OS != "mac" and gcc_version==46', {
+    ['os_posix == 1 and OS != "mac" and OS != "android" and gcc_version==46', {
       'target_defaults': {
         # Disable warnings about c++0x compatibility, as some names (such as nullptr) conflict
         # with upcoming c++0x types.

Modified: trunk/Source/WebCore/ChangeLog (97492 => 97493)


--- trunk/Source/WebCore/ChangeLog	2011-10-14 19:45:38 UTC (rev 97492)
+++ trunk/Source/WebCore/ChangeLog	2011-10-14 19:47:35 UTC (rev 97493)
@@ -1,3 +1,12 @@
+2011-10-14  Peter Beverloo  <[email protected]>
+
+        [Chromium] Inherit settings from Chromium's envsetup.sh, address a NDK todo
+        https://bugs.webkit.org/show_bug.cgi?id=70028
+
+        Reviewed by Adam Barth.
+
+        * WebCore.gyp/WebCore.gyp:
+
 2011-10-14  Nate Chapin  <[email protected]>
 
         Check CachedResourceClient types with ASSERTs rather

Modified: trunk/Source/WebCore/WebCore.gyp/WebCore.gyp (97492 => 97493)


--- trunk/Source/WebCore/WebCore.gyp/WebCore.gyp	2011-10-14 19:45:38 UTC (rev 97492)
+++ trunk/Source/WebCore/WebCore.gyp/WebCore.gyp	2011-10-14 19:47:35 UTC (rev 97493)
@@ -106,7 +106,7 @@
         'cflags!': ['-g'],
       },
     }],
-    ['os_posix==1 and OS!="mac" and gcc_version==46', {
+    ['os_posix==1 and OS!="mac" and OS!="android" and gcc_version==46', {
       'target_defaults': {
         # Disable warnings about c++0x compatibility, as some names (such as nullptr) conflict
         # with upcoming c++0x types.
@@ -1663,7 +1663,7 @@
             ['exclude', 'rendering/RenderThemeChromiumSkia\\.cpp$'],
           ],
         }],
-        ['os_posix == 1 and OS != "mac" and gcc_version == 42', {
+        ['os_posix == 1 and OS != "mac" and OS != "android" and gcc_version == 42', {
           # Due to a bug in gcc 4.2.1 (the current version on hardy), we get
           # warnings about uninitialized this.
           'cflags': ['-Wno-uninitialized'],
@@ -1799,7 +1799,7 @@
             ['include', '/TransparencyWin\\.cpp$'],
           ],
         }],
-        ['os_posix == 1 and OS != "mac" and gcc_version == 42', {
+        ['os_posix == 1 and OS != "mac" and OS != "android" and gcc_version == 42', {
           # Due to a bug in gcc 4.2.1 (the current version on hardy), we get
           # warnings about uninitialized this.
           'cflags': ['-Wno-uninitialized'],

Modified: trunk/Source/WebKit/chromium/ChangeLog (97492 => 97493)


--- trunk/Source/WebKit/chromium/ChangeLog	2011-10-14 19:45:38 UTC (rev 97492)
+++ trunk/Source/WebKit/chromium/ChangeLog	2011-10-14 19:47:35 UTC (rev 97493)
@@ -1,3 +1,13 @@
+2011-10-14  Peter Beverloo  <[email protected]>
+
+        [Chromium] Inherit settings from Chromium's envsetup.sh, address a NDK todo
+        https://bugs.webkit.org/show_bug.cgi?id=70028
+
+        Reviewed by Adam Barth.
+
+        * WebKit.gyp:
+        * gyp_webkit:
+
 2011-10-14  Ryosuke Niwa  <[email protected]>
 
         Chromium Mac build fix after r97478.

Modified: trunk/Source/WebKit/chromium/WebKit.gyp (97492 => 97493)


--- trunk/Source/WebKit/chromium/WebKit.gyp	2011-10-14 19:45:38 UTC (rev 97492)
+++ trunk/Source/WebKit/chromium/WebKit.gyp	2011-10-14 19:47:35 UTC (rev 97493)
@@ -1349,7 +1349,7 @@
                 'sources': ['../../../Tools/DumpRenderTree/chromium/LayoutTestHelperWin.cpp'],
             }],
         }],
-        ['os_posix==1 and OS!="mac" and gcc_version==46', {
+        ['os_posix==1 and OS!="mac" and OS!="android" and gcc_version==46', {
             'target_defaults': {
                 # Disable warnings about c++0x compatibility, as some names (such
                 # as nullptr) conflict with upcoming c++0x types.

Modified: trunk/Source/WebKit/chromium/gyp_webkit (97492 => 97493)


--- trunk/Source/WebKit/chromium/gyp_webkit	2011-10-14 19:45:38 UTC (rev 97492)
+++ trunk/Source/WebKit/chromium/gyp_webkit	2011-10-14 19:47:35 UTC (rev 97493)
@@ -33,6 +33,7 @@
 import glob
 import os
 import shlex
+import subprocess
 import sys
 
 script_dir = os.path.dirname(__file__)
@@ -77,6 +78,18 @@
 
   args = sys.argv[1:]
 
+  # When building the WebKit Chromium port for Android, we have to cross-compile
+  # the source to ARM, check for the right Android NDK and set the appropriate
+  # GYP flags. Chromium's envsetup.sh script will handle these steps, but as it
+  # exports variables and commands we have to re-call ourselves afterwards.
+  if 'WEBKIT_ANDROID_BUILD' in os.environ:
+    if not '--no-envsetup-recursion' in args:
+      envsetup_location = os.path.join(chrome_src, 'build', 'android', 'envsetup.sh')
+      exit(subprocess.call(['bash', '-c', 'source %s && python gyp_webkit --no-envsetup-recursion %s' % (envsetup_location, ' '.join(args))]))
+    else:
+      os.environ['CC.target'] = os.environ['CROSS_CC']
+      args.remove('--no-envsetup-recursion')
+
   # Add includes.
   args.extend(['-I' + i for i in additional_include_files(args)])
 
@@ -90,7 +103,7 @@
     args.append('--no-circular-check')
 
   # On linux, we want gyp to output a makefile (default is scons).
-  if sys.platform.startswith('linux') or 'GYP_ANDROID_BUILD' in os.environ:
+  if sys.platform.startswith('linux') or 'WEBKIT_ANDROID_BUILD' in os.environ:
     args.extend(['-fmake',
                  '--suffix=.chromium',
                  '--toplevel-dir=../../..',

Modified: trunk/Tools/ChangeLog (97492 => 97493)


--- trunk/Tools/ChangeLog	2011-10-14 19:45:38 UTC (rev 97492)
+++ trunk/Tools/ChangeLog	2011-10-14 19:47:35 UTC (rev 97493)
@@ -1,3 +1,15 @@
+2011-10-14  Peter Beverloo  <[email protected]>
+
+        [Chromium] Inherit settings from Chromium's envsetup.sh, address a NDK todo
+        https://bugs.webkit.org/show_bug.cgi?id=70028
+
+        Reviewed by Adam Barth.
+
+        * Scripts/update-webkit-chromium:
+        * Scripts/webkitdirs.pm:
+        (buildChromiumMakefile):
+        (buildChromium):
+
 2011-10-14  Leandro Pereira  <[email protected]>
 
         Unreviewed; add missing #includes.

Modified: trunk/Tools/Scripts/update-webkit-chromium (97492 => 97493)


--- trunk/Tools/Scripts/update-webkit-chromium	2011-10-14 19:45:38 UTC (rev 97492)
+++ trunk/Tools/Scripts/update-webkit-chromium	2011-10-14 19:47:35 UTC (rev 97493)
@@ -58,12 +58,24 @@
            "--spec=solutions=[{'name':'./','url':None}]") == 0 or die $!;
 }
 
-# Set certain gyp settings for the Android build
+# When building WebKit's Chromium port for Android, we need the Android NDK as
+# it will allow us to cross-compile all sources to the target architecture.
 if (isChromiumAndroid()) {
-    # FIXME: Add code to automatically download the NDK
-    my $host_os = isLinux() ? "linux" : "mac";
-    $ENV{GYP_DEFINES} = "OS=android host_os=" . $host_os . " target_arch=arm arm_neon=1 armv7=1 arm_thumb=1 linux_fpic=1 use_openssl=1 use_system_libjpeg=0 linux_use_tcmalloc=0";
-    $ENV{GYP_ANDROID_BUILD} = 1;
+    if (! -e "third_party/android-ndk-r6b") {
+        print "Installing the Android NDK, version 6b...\n";
+        if (! -e "third_party/") {
+            mkdir "third_party";
+        }
+        my $host_os = isLinux() ? "linux" : "darwin";
+        my $result = system("curl", "-o", "third_party/android-ndk-r6b.tar.bz2", "http://dl.google.com/android/ndk/android-ndk-r6b-" . $host_os . "-x86.tar.bz2");
+        die "Couldn't download the Android NDK." if $result;
+
+        $result = system("tar", "jxC", "third_party", "-f", "third_party/android-ndk-r6b.tar.bz2");
+        die "Couldn't extract the Android NDK." if $result;
+    }
+
+    $ENV{ANDROID_NDK_ROOT} = sourceDir() . "/Source/WebKit/chromium/third_party/android-ndk-r6b";
+    $ENV{WEBKIT_ANDROID_BUILD} = 1;
 }
 
 my $force = 0;

Modified: trunk/Tools/Scripts/webkitdirs.pm (97492 => 97493)


--- trunk/Tools/Scripts/webkitdirs.pm	2011-10-14 19:45:38 UTC (rev 97492)
+++ trunk/Tools/Scripts/webkitdirs.pm	2011-10-14 19:47:35 UTC (rev 97493)
@@ -1908,7 +1908,20 @@
         $makeArgs = $1 if /^--makeargs=(.*)/i;
     }
     $makeArgs = "-j$numCpus" if not $makeArgs;
-    my $command = "make -fMakefile.chromium $makeArgs BUILDTYPE=$config $target";
+    my $command = "";
+
+    # Building the WebKit Chromium port for Android requires us to cross-
+    # compile, which will be set up by Chromium's envsetup.sh. The script itself
+    # will verify that the installed NDK is indeed available.
+    if (isChromiumAndroid()) {
+        $command .= "bash -c \"source " . sourceDir() . "/Source/WebKit/chromium/build/android/envsetup.sh && ";
+        $ENV{ANDROID_NDK_ROOT} = sourceDir() . "/Source/WebKit/chromium/third_party/android-ndk-r6b";
+        $ENV{WEBKIT_ANDROID_BUILD} = 1;
+    }
+
+    $command .= "make -fMakefile.chromium $makeArgs BUILDTYPE=$config $target";
+    $command .= "\"" if isChromiumAndroid();
+
     print "$command\n";
     return system $command;
 }
@@ -1963,29 +1976,13 @@
     }
 
     my $result = 1;
-    if (isChromiumAndroid()) {
-        # Building Chromium for Android needs to cross-compile using the
-        # Toolchains supplied by the Android NDK.
-        my $ndkBaseDir = sourceDir() . "/Source/WebKit/chromium/third_party/android-ndk-r6";
-        my $platform = isDarwin() ? "darwin-x86" : "linux-x86";
-
-        my $toolchainBase = $ndkBaseDir . "/toolchains/arm-linux-androideabi-4.4.3/prebuilt/" . $platform . "/bin/arm-linux-androideabi-";
-
-        $ENV{AR} = $toolchainBase . "ar";
-        $ENV{CC} = $toolchainBase . "gcc";
-        $ENV{CXX} = $toolchainBase . "g++";
-        $ENV{LINK} = $toolchainBase . "gcc";
-        $ENV{RANLIB} = $toolchainBase . "ranlib";
-        $ENV{STRIP} = $toolchainBase . "strip";
-
-        $result = buildChromiumMakefile("all", $clean);
-    } elsif (isDarwin()) {
+    if (isDarwin() && !isChromiumAndroid()) {
         # Mac build - builds the root xcode project.
         $result = buildXCodeProject("Source/WebKit/chromium/WebKit", $clean, "-configuration", configuration(), @options);
     } elsif (isCygwin() || isWindows()) {
         # Windows build - builds the root visual studio solution.
         $result = buildChromiumVisualStudioProject("Source/WebKit/chromium/WebKit.sln", $clean);
-    } elsif (isLinux()) {
+    } elsif (isLinux() || isChromiumAndroid()) {
         # Linux build - build using make.
         $result = buildChromiumMakefile("all", $clean, @options);
     } else {
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to