Support to build apk odex for both arch.

Build odex for both arch in multilib build if an app has
LOCAL_MULTILIB := both.
Refactored the common setup code to a separate file setup_one_odex.mk.

Bug: 17409149
Bug: 14694978
Change-Id: I74c9426cd74fe0b0cb4811368f740a88ac2ae022
diff --git a/core/package_internal.mk b/core/package_internal.mk
index 0d6f9ea..d1e4212 100644
--- a/core/package_internal.mk
+++ b/core/package_internal.mk
@@ -403,7 +403,8 @@
 ## Rule to build the odex file
 ifdef LOCAL_DEX_PREOPT
 $(built_odex): PRIVATE_DEX_FILE := $(built_dex)
-$(built_odex) : $(built_dex)
+# Use pattern rule - we may have multiple built odex files.
+$(built_odex) : $(dir $(LOCAL_BUILT_MODULE))% : $(built_dex)
 	$(hide) mkdir -p $(dir $@) && rm -f $@
 	$(add-dex-to-package)
 	$(hide) mv $@ $@.input