[Chromium] Remove unneeded build logic for Android
https://bugs.webkit.org/show_bug.cgi?id=93962

Reviewed by Dimitri Glazkov.

The Android SDK and NDK have been checked in to the Chromium tree, which
allows WebKit to leverage those as well. They will already be pulled in
through a DEPS change made last week, and by not setting the ANDROID_NDK_ROOT
environment variable, the envsetup.sh will set the project files up
appropriately for us.

Source/WebKit/chromium:

* DEPS:

Tools:

* Scripts/webkitdirs.pm:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@125561 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebKit/chromium/ChangeLog b/Source/WebKit/chromium/ChangeLog
index 57ed06d..0a2e1fa 100644
--- a/Source/WebKit/chromium/ChangeLog
+++ b/Source/WebKit/chromium/ChangeLog
@@ -1,5 +1,20 @@
 2012-08-14  Peter Beverloo  <peter@chromium.org>
 
+        [Chromium] Remove unneeded build logic for Android
+        https://bugs.webkit.org/show_bug.cgi?id=93962
+
+        Reviewed by Dimitri Glazkov.
+
+        The Android SDK and NDK have been checked in to the Chromium tree, which
+        allows WebKit to leverage those as well. They will already be pulled in
+        through a DEPS change made last week, and by not setting the ANDROID_NDK_ROOT
+        environment variable, the envsetup.sh will set the project files up
+        appropriately for us.
+
+        * DEPS:
+
+2012-08-14  Peter Beverloo  <peter@chromium.org>
+
         Unreviewed.  Rolled DEPS.
 
         * DEPS:
diff --git a/Source/WebKit/chromium/DEPS b/Source/WebKit/chromium/DEPS
index 78d3b8e..5154bff 100644
--- a/Source/WebKit/chromium/DEPS
+++ b/Source/WebKit/chromium/DEPS
@@ -181,8 +181,6 @@
   'android': {
     'third_party/android_tools':
       From('chromium_deps', 'src/third_party/android_tools'),
-    'third_party/aosp':
-      From('chromium_deps', 'src/third_party/aosp'),
     'third_party/freetype':
       From('chromium_deps', 'src/third_party/freetype'),
     'tools/android':
diff --git a/Source/WebKit/chromium/gyp_webkit b/Source/WebKit/chromium/gyp_webkit
index fb720d9..36f0f43 100755
--- a/Source/WebKit/chromium/gyp_webkit
+++ b/Source/WebKit/chromium/gyp_webkit
@@ -87,9 +87,6 @@
       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:
-      # FIXME: v8 requires the CXX_target variable to determine whether -m32 should be
-      # set. The current Android build set-up is not sustainable and breaks too often.
-      os.environ['CXX_target'] = glob.glob('%s/*-g++' % os.environ.get('ANDROID_TOOLCHAIN'))[0]
       args.remove('--no-envsetup-recursion')
 
   # Add includes.
diff --git a/Tools/ChangeLog b/Tools/ChangeLog
index 178e64f..d689b0b 100644
--- a/Tools/ChangeLog
+++ b/Tools/ChangeLog
@@ -1,3 +1,18 @@
+2012-08-14  Peter Beverloo  <peter@chromium.org>
+
+        [Chromium] Remove unneeded build logic for Android
+        https://bugs.webkit.org/show_bug.cgi?id=93962
+
+        Reviewed by Dimitri Glazkov.
+
+        The Android SDK and NDK have been checked in to the Chromium tree, which
+        allows WebKit to leverage those as well. They will already be pulled in
+        through a DEPS change made last week, and by not setting the ANDROID_NDK_ROOT
+        environment variable, the envsetup.sh will set the project files up
+        appropriately for us.
+
+        * Scripts/webkitdirs.pm:
+
 2012-08-14  Sergio Villar Senin  <svillar@igalia.com>
 
         [WK2] [GTK] Plugin tests failing in WK2 bot
diff --git a/Tools/Scripts/update-webkit-chromium b/Tools/Scripts/update-webkit-chromium
index a5c2424..b21d09e 100755
--- a/Tools/Scripts/update-webkit-chromium
+++ b/Tools/Scripts/update-webkit-chromium
@@ -1,5 +1,4 @@
 #!/usr/bin/perl -w
-
 # Copyright (C) 2009 Google Inc. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
@@ -59,26 +58,10 @@
            "--spec=solutions=[{'name':'./','url':None}]") == 0 or die $!;
 }
 
-# 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.
+# When building Chromium for Android, the envsetup.sh script needs to be
+# executed prior to project file generation. We need to tell gyp_webkit to do
+# that, as it's a Chromium file and may not be available yet right now.
 if (isChromiumAndroid()) {
-    if (! -e "android-ndk-r7b") {
-        print "Installing the Android NDK, version 7b...\n";
-        my $host_os = isLinux() ? "linux" : "darwin";
-        my $result = system("curl", "-o", "android-ndk-r7b.tar.bz2", "http://dl.google.com/android/ndk/android-ndk-r7b-" . $host_os . "-x86.tar.bz2");
-        die "Couldn't download the Android NDK." if $result;
-
-        $result = system("tar", "jx", "-f", "android-ndk-r7b.tar.bz2");
-        die "Couldn't extract the Android NDK." if $result;
-    }
-
-    my $androidNdkRoot = sourceDir() . "/Source/WebKit/chromium/android-ndk-r7b";
-
-    # Attempt to replace the NDK's linker with a 64-bit version if the host
-    # OS is Linux. This will significantly speed up link times.
-    chromiumInstall64BitAndroidLinkerIfNeeded($androidNdkRoot) if isLinux();
-
-    $ENV{ANDROID_NDK_ROOT} = $androidNdkRoot;
     $ENV{WEBKIT_ANDROID_BUILD} = 1;
 }
 
diff --git a/Tools/Scripts/webkitdirs.pm b/Tools/Scripts/webkitdirs.pm
index e5bf957..1c3a960 100755
--- a/Tools/Scripts/webkitdirs.pm
+++ b/Tools/Scripts/webkitdirs.pm
@@ -2618,49 +2618,6 @@
     return $result;
 }
 
-sub chromiumInstall64BitAndroidLinkerIfNeeded
-{
-    my ($androidNdkRoot) = @_;
-
-    # Resolve the toolchain version through glob().
-    my $linkerDirPrefix = glob("$androidNdkRoot/toolchains/arm-linux-androideabi-*/prebuilt/linux-x86");
-
-    my $linkerDirname1 = "$linkerDirPrefix/bin";
-    my $linkerBasename1 = "arm-linux-androideabi-ld";
-    my $linkerDirname2 = "$linkerDirPrefix/arm-linux-androideabi/bin";
-    my $linkerBasename2 = "ld";
-    my $newLinker = "arm-linux-androideabi-ld.e4df3e0a5bb640ccfa2f30ee67fe9b3146b152d6";
-
-    # Do not continue if the new linker is not (yet) available.
-    if (! -e "third_party/aosp/$newLinker") {
-        return;
-    }
-
-    chromiumReplaceAndroidLinkerIfNeeded($linkerDirname1, $linkerBasename1, $newLinker);
-    chromiumReplaceAndroidLinkerIfNeeded($linkerDirname2, $linkerBasename2, $newLinker);
-}
-
-sub chromiumReplaceAndroidLinkerIfNeeded
-{
-    my ($linkerDirname, $linkerBasename, $newLinker) = @_;
-
-    # If the destination directory does not exist, or the linker has already
-    # been installed, replacing it will not be necessary.
-    if (! -d "$linkerDirname" || -e "$linkerDirname/$newLinker") {
-        return;
-    }
-
-    print "Installing 64-bit Android linker in $linkerDirname..\n";
-    system("cp", "third_party/aosp/$newLinker", "$linkerDirname/$newLinker");
-    system("mv", "$linkerDirname/$linkerBasename", "$linkerDirname/$linkerBasename.orig");
-    system("ln", "-s", "$newLinker", "$linkerDirname/$linkerBasename");
-
-    if (! -e "$linkerDirname/$newLinker") {
-        print "Unable to copy the linker.\n";
-        exit 1;
-    }
-}
-
 sub appleApplicationSupportPath
 {
     open INSTALL_DIR, "</proc/registry/HKEY_LOCAL_MACHINE/SOFTWARE/Apple\ Inc./Apple\ Application\ Support/InstallDir";