OSDN Git Service

Support dalvikvm on a Linux x86 host
authorJesse Wilson <jessewilson@google.com>
Wed, 18 Aug 2010 18:35:23 +0000 (11:35 -0700)
committerJesse Wilson <jessewilson@google.com>
Thu, 19 Aug 2010 04:16:56 +0000 (21:16 -0700)
Change-Id: Id166ab03a01833e06ec1a9aa0059e4eb28ec04ce

dalvikvm/Android.mk
dexopt/Android.mk
libnativehelper/Android.mk
vm/Android.mk
vm/Dvm.mk
vm/ReconfigureDvm.mk

index 05a4013..21b7805 100644 (file)
@@ -53,28 +53,21 @@ include $(BUILD_EXECUTABLE)
 ifeq ($(WITH_HOST_DALVIK),true)
 
     include $(CLEAR_VARS)
-
     LOCAL_SRC_FILES := $(dalvikvm_src_files)
     LOCAL_C_INCLUDES := $(dalvikvm_c_includes)
 
-    LOCAL_STATIC_LIBRARIES := \
-        libdvm-host
-
     ifeq ($(HOST_OS)-$(HOST_ARCH),darwin-x86)
         # OS X comes with all these libraries, so there is no need
         # to build any of them. Note: OpenSSL consists of libssl
         # and libcrypto.
         LOCAL_LDLIBS := -lffi -lssl -lcrypto -lz -lsqlite3
     else
-        # In this case, include libssl and libz, but libffi isn't listed:
-        # The recommendation is that host builds should always either
-        # have sufficient custom code so that libffi isn't needed at all,
-        # or they should use the platform's provided libffi (as is done
-        # for darwin-x86 above).
-        LOCAL_STATIC_LIBRARIES += libssl libz
+        LOCAL_LDLIBS += -ldl -lpthread
+        LOCAL_SHARED_LIBRARIES += libdvm libcrypto libicuuc libicui18n libssl
+#        LOCAL_STATIC_LIBRARIES += libcutils liblog libdex libexpat libnativehelper libutils libz
     endif
 
-    LOCAL_MODULE := dalvikvm-host
+    LOCAL_MODULE := dalvikvm
 
     include $(BUILD_HOST_EXECUTABLE)
 
index eb486c8..96ec3b2 100644 (file)
 # so it must be linked against the full VM shared library.
 #
 LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
 
-LOCAL_SRC_FILES := \
+local_src_files := \
                OptMain.c
 
-LOCAL_C_INCLUDES := \
+local_c_includes := \
                dalvik \
                dalvik/libdex \
                dalvik/vm \
                $(JNI_H_INCLUDE)
 
-LOCAL_SHARED_LIBRARIES := \
-               libcutils \
-               liblog \
-               libz \
+local_shared_libraries := \
                libssl \
-               libdvm
+               libdvm \
+               libcrypto \
+               libicuuc \
+               libicui18n
 
+include $(CLEAR_VARS)
 ifeq ($(TARGET_CPU_SMP),true)
     LOCAL_CFLAGS += -DANDROID_SMP=1
 else
     LOCAL_CFLAGS += -DANDROID_SMP=0
 endif
-
+LOCAL_SRC_FILES := $(local_src_files)
+LOCAL_C_INCLUDES := $(local_c_includes)
+LOCAL_SHARED_LIBRARIES := $(local_shared_libraries) libcutils libexpat liblog libnativehelper libutils libz
 LOCAL_MODULE := dexopt
-
 include $(BUILD_EXECUTABLE)
+
+ifeq ($(WITH_HOST_DALVIK),true)
+    include $(CLEAR_VARS)
+    LOCAL_SRC_FILES := $(local_src_files)
+    LOCAL_C_INCLUDES := $(local_c_includes)
+    LOCAL_SHARED_LIBRARIES := $(local_shared_libraries)
+    LOCAL_STATIC_LIBRARIES :=  libcutils libexpat liblog libnativehelper libutils libz
+    LOCAL_LDLIBS += -ldl -lpthread
+    LOCAL_CFLAGS += -DANDROID_SMP=1
+    LOCAL_MODULE := dexopt
+    include $(BUILD_HOST_EXECUTABLE)
+endif
index 2acc869..b2056c6 100644 (file)
@@ -20,29 +20,26 @@ LOCAL_PATH := $(call my-dir)
 #
 
 src_files := \
-       JNIHelp.c \
-       Register.c
+    JNIHelp.c \
+    Register.c
 
 c_includes := \
-       $(JNI_H_INCLUDE)
+    $(JNI_H_INCLUDE)
 
 # Any shared/static libs required by libjavacore
 # need to be mentioned here as well.
 # TODO: fix this requirement
 
 shared_libraries := \
-       libexpat \
-       libssl \
-       libutils \
-       libz \
-       libcrypto  \
-       libicuuc   \
-       libicui18n \
-       libsqlite
+    libcrypto  \
+    libicui18n \
+    libicuuc   \
+    libsqlite \
+    libssl
 
 static_libraries := \
-       libjavacore \
-       libfdlibm
+    libjavacore \
+    libfdlibm
 
 
 
@@ -55,11 +52,7 @@ include $(CLEAR_VARS)
 LOCAL_SRC_FILES := $(src_files)
 LOCAL_C_INCLUDES := $(c_includes)
 LOCAL_STATIC_LIBRARIES := $(static_libraries)
-LOCAL_SHARED_LIBRARIES := $(shared_libraries)
-
-# liblog and libcutils are shared for target.
-LOCAL_SHARED_LIBRARIES += \
-       liblog libcutils
+LOCAL_SHARED_LIBRARIES := $(shared_libraries) libcutils libexpat liblog libutils libz
 
 LOCAL_MODULE := libnativehelper
 
@@ -82,17 +75,13 @@ ifeq ($(WITH_HOST_DALVIK),true)
         # OSX has a lot of libraries built in, which we don't have to
         # bother building; just include them on the ld line.
         LOCAL_LDLIBS := -lexpat -lssl -lz -lcrypto -licucore -lsqlite3
-       LOCAL_WHOLE_STATIC_LIBRARIES += libutils
+        LOCAL_WHOLE_STATIC_LIBRARIES += libutils
     else
         LOCAL_SHARED_LIBRARIES := $(shared_libraries)
+        LOCAL_STATIC_LIBRARIES := libcutils libexpat liblog libutils libz
     endif
 
-    # liblog and libcutils are static for host.
-    LOCAL_STATIC_LIBRARIES += \
-        liblog libcutils
-
-    LOCAL_MODULE := libnativehelper-host
-
+    LOCAL_MODULE := libnativehelper
     include $(BUILD_HOST_STATIC_LIBRARY)
 
 endif
index be71d3c..98f004c 100644 (file)
@@ -105,15 +105,18 @@ ifeq ($(WITH_HOST_DALVIK),true)
 
     include $(LOCAL_PATH)/Dvm.mk
 
-    # We need to include all of these libraries. The end result of this
-    # section is a static library, but LOCAL_STATIC_LIBRARIES doesn't
-    # actually cause any code from the specified libraries to be included,
-    # whereas LOCAL_WHOLE_STATIC_LIBRARIES does. No, I (danfuzz) am not
-    # entirely sure what LOCAL_STATIC_LIBRARIES is even supposed to mean
-    # in this context, but it is in (apparently) meaningfully used in
-    # other parts of the build.
-    LOCAL_WHOLE_STATIC_LIBRARIES += \
-       libnativehelper-host libdex liblog libcutils
+    LOCAL_SHARED_LIBRARIES += libcrypto libssl libicuuc libicui18n
+
+    LOCAL_LDLIBS := -lpthread -ldl
+    ifeq ($(HOST_OS),linux)
+      # need this for clock_gettime() in profiling
+      LOCAL_LDLIBS += -lrt
+    endif
+
+    # Build as a WHOLE static library so dependencies are available at link
+    # time. When building this target as a regular static library, certain
+    # dependencies like expat are not found by the linker.
+    LOCAL_WHOLE_STATIC_LIBRARIES += libexpat libcutils libdex liblog libnativehelper libutils libz
 
     # The libffi from the source tree should never be used by host builds.
     # The recommendation is that host builds should always either
@@ -126,8 +129,8 @@ ifeq ($(WITH_HOST_DALVIK),true)
     endif
 
     LOCAL_CFLAGS += $(host_smp_flag)
-    LOCAL_MODULE := libdvm-host
+    LOCAL_MODULE := libdvm
 
-    include $(BUILD_HOST_STATIC_LIBRARY)
+    include $(BUILD_HOST_SHARED_LIBRARY)
 
 endif
index c624258..1a0c5d0 100644 (file)
--- a/vm/Dvm.mk
+++ b/vm/Dvm.mk
@@ -263,10 +263,6 @@ ifeq ($(dvm_simulator),true)
     # need this for clock_gettime() in profiling
     LOCAL_LDLIBS += -lrt
   endif
-else
-  ifeq ($(dvm_os),linux)
-    LOCAL_SHARED_LIBRARIES += libdl
-  endif
 endif
 
 MTERP_ARCH_KNOWN := false
index 62a0e0f..1284bc8 100644 (file)
@@ -23,7 +23,7 @@ dvm_simulator := $(TARGET_SIMULATOR)
 include $(LOCAL_PATH)/Dvm.mk
 
 LOCAL_SHARED_LIBRARIES += \
-        liblog libcutils libnativehelper libz
+        liblog libcutils libdl libnativehelper libz
 
 LOCAL_STATIC_LIBRARIES += libdex