From 3e9bfe0bed2f27d01efdb03a71025c421d321956 Mon Sep 17 00:00:00 2001 From: Jesse Wilson Date: Wed, 18 Aug 2010 11:35:23 -0700 Subject: [PATCH] Support dalvikvm on a Linux x86 host Change-Id: Id166ab03a01833e06ec1a9aa0059e4eb28ec04ce --- dalvikvm/Android.mk | 15 ++++----------- dexopt/Android.mk | 33 +++++++++++++++++++++++---------- libnativehelper/Android.mk | 39 ++++++++++++++------------------------- vm/Android.mk | 25 ++++++++++++++----------- vm/Dvm.mk | 4 ---- vm/ReconfigureDvm.mk | 2 +- 6 files changed, 56 insertions(+), 62 deletions(-) diff --git a/dalvikvm/Android.mk b/dalvikvm/Android.mk index 05a4013c6..21b780520 100644 --- a/dalvikvm/Android.mk +++ b/dalvikvm/Android.mk @@ -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) diff --git a/dexopt/Android.mk b/dexopt/Android.mk index eb486c8cd..96ec3b268 100644 --- a/dexopt/Android.mk +++ b/dexopt/Android.mk @@ -17,30 +17,43 @@ # 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 diff --git a/libnativehelper/Android.mk b/libnativehelper/Android.mk index 2acc86984..b2056c6f1 100644 --- a/libnativehelper/Android.mk +++ b/libnativehelper/Android.mk @@ -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 diff --git a/vm/Android.mk b/vm/Android.mk index be71d3c07..98f004c4f 100644 --- a/vm/Android.mk +++ b/vm/Android.mk @@ -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 diff --git a/vm/Dvm.mk b/vm/Dvm.mk index c624258b7..1a0c5d079 100644 --- 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 diff --git a/vm/ReconfigureDvm.mk b/vm/ReconfigureDvm.mk index 62a0e0fcb..1284bc8a6 100644 --- a/vm/ReconfigureDvm.mk +++ b/vm/ReconfigureDvm.mk @@ -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 -- 2.11.0