Remove host build rules for libffi, and no longer build it for x86
device targets.

The new recommendation for libffi usage is: Libffi is fine to use as a
means of bootstrapping your device build for a new architecture, but
you probably want to replace it with custom code before you ship. As
for a host build, if you need it (which isn't actually that likely),
you should use the libffi that comes with your platform or build it as
a normal library (e.g., download it and then "./configure; make
install").

Change-Id: I710daa136a2cacc4f95cdf6b5fd60a3d3c072df5
diff --git a/Android.mk b/Android.mk
index 773023f..2352581 100644
--- a/Android.mk
+++ b/Android.mk
@@ -23,43 +23,25 @@
 # Build rules for the target.
 #
 
-# We only build ffi for non-arm targets.
+# We only build ffi at all for non-arm, non-x86 targets.
 ifneq ($(TARGET_ARCH),arm)
+    ifneq ($(TARGET_ARCH),x86)
 
-    include $(CLEAR_VARS)
+       include $(CLEAR_VARS)
 
-    ffi_arch := $(TARGET_ARCH)
-    ffi_os := $(TARGET_OS)
+       ffi_arch := $(TARGET_ARCH)
+       ffi_os := $(TARGET_OS)
 
-    include $(LOCAL_PATH)/Libffi.mk
+       # This include just keeps the nesting a bit saner.
+       include $(LOCAL_PATH)/Libffi.mk
 
-    LOCAL_MODULE := libffi
+       LOCAL_MODULE := libffi
 
-    include $(BUILD_SHARED_LIBRARY)
+       include $(BUILD_SHARED_LIBRARY)
 
+    endif
 endif
 
-
-#
-# Build rules for the host.
-#
-
-ifeq ($(WITH_HOST_DALVIK),true)
-
-    include $(CLEAR_VARS)
-
-    ffi_arch := $(HOST_ARCH)
-    ffi_os := $(HOST_OS)
-
-    include $(LOCAL_PATH)/Libffi.mk
-
-    LOCAL_MODULE := libffi-host
-
-    include $(BUILD_HOST_STATIC_LIBRARY)
-
-endif
-
-
 # Also include the rules for the test suite.
 include external/libffi/testsuite/Android.mk
 
diff --git a/Libffi.mk b/Libffi.mk
index dbcf736..32478a6 100644
--- a/Libffi.mk
+++ b/Libffi.mk
@@ -12,10 +12,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-#
-# Common definitions for host or target builds of libffi
-#
-
 # The libffi code is organized primarily by architecture, but at some
 # point OS-specific issues started to creep in. In some cases there
 # are OS-specific source files, in others there are just #ifdefs in
@@ -43,6 +39,9 @@
   LOCAL_SRC_FILES := your-architecture-not-supported-by-ffi-makefile.c
 endif
 
-LOCAL_SRC_FILES += src/debug.c src/prep_cif.c src/types.c \
-        src/raw_api.c src/java_raw_api.c
-
+LOCAL_SRC_FILES += \
+	src/debug.c \
+	src/java_raw_api.c \
+	src/prep_cif.c \
+        src/raw_api.c \
+	src/types.c
diff --git a/testsuite/Android.mk b/testsuite/Android.mk
index 6135f73..d7f53de 100644
--- a/testsuite/Android.mk
+++ b/testsuite/Android.mk
@@ -16,53 +16,23 @@
 include $(CLEAR_VARS)
 
 
-#
-# Common definitions for host and target
-#
-
-# Single test file to use when doing default build. For the target
-# (device), this is the only way to build and run tests, but for the
-# host you can use the "run-ffi-tests" script in this directory to
-# run all the tests.
+# Single test file to use when doing a default build.
 FFI_SINGLE_TEST_FILE := libffi.call/struct5.c
 
-
-#
-# Build rules for the target.
-#
-
-# We only build ffi at all for non-arm targets.
+# We only build ffi at all for non-arm, non-x86 targets.
 ifneq ($(TARGET_ARCH),arm)
+    ifneq ($(TARGET_ARCH),x86)
 
-    include $(CLEAR_VARS)
+        include $(CLEAR_VARS)
 
-    LOCAL_SRC_FILES := $(FFI_SINGLE_TEST_FILE)
-    LOCAL_C_INCLUDES := external/libffi/$(TARGET_OS)-$(TARGET_ARCH)
-    LOCAL_SHARED_LIBRARIES := libffi
+        LOCAL_SRC_FILES := $(FFI_SINGLE_TEST_FILE)
+        LOCAL_C_INCLUDES := external/libffi/$(TARGET_OS)-$(TARGET_ARCH)
+        LOCAL_SHARED_LIBRARIES := libffi
 
-    LOCAL_MODULE := ffi-test
-    LOCAL_MODULE_TAGS := tests
+        LOCAL_MODULE := ffi-test
+        LOCAL_MODULE_TAGS := tests
 
-    include $(BUILD_EXECUTABLE)
+        include $(BUILD_EXECUTABLE)
 
-endif
-
-
-#
-# Build rules for the host.
-#
-
-ifeq ($(WITH_HOST_DALVIK),true)
-
-    include $(CLEAR_VARS)
-
-    LOCAL_SRC_FILES := $(FFI_SINGLE_TEST_FILE)
-    LOCAL_C_INCLUDES := external/libffi/$(HOST_OS)-$(HOST_ARCH)
-    LOCAL_SHARED_LIBRARIES := libffi-host
-
-    LOCAL_MODULE := ffi-test-host
-    LOCAL_MODULE_TAGS := tests
-
-    include $(BUILD_HOST_EXECUTABLE)
-
+    endif
 endif