Bug 567873 - Android packaging should use standard packaging code, r=ted a=blocking-fennec
authorMichael Wu <mwu@mozilla.com>
Tue, 12 Oct 2010 12:30:41 -0700
changeset 55376 354b5ce1181d03bbf88a31441ccb750964a66feb
parent 55375 e3701c6f77fd8cffd49659e4a3639f81bbb45fad
child 55377 3c4f52eb4d8e5eb04a11cfaab92a188fcf9df069
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted, blocking-fennec
bugs567873
milestone2.0b8pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 567873 - Android packaging should use standard packaging code, r=ted a=blocking-fennec
embedding/Makefile.in
embedding/android/Makefile.in
toolkit/mozapps/installer/packager.mk
--- a/embedding/Makefile.in
+++ b/embedding/Makefile.in
@@ -49,12 +49,12 @@ MODULE       = embed
 DIRS = base components browser
 
 ifdef ENABLE_TESTS
 XPCSHELL_TESTS = tests/unit
 DIRS += test
 endif
 
 ifeq ($(OS_TARGET),Android)
-TOOL_DIRS = android
+DIRS += android
 endif
 
 include $(topsrcdir)/config/rules.mk
--- a/embedding/android/Makefile.in
+++ b/embedding/android/Makefile.in
@@ -71,26 +71,23 @@ DEFINES += \
   -DMOZ_APP_VERSION=$(MOZ_APP_VERSION) \
   -DMOZ_CHILD_PROCESS_NAME=$(MOZ_CHILD_PROCESS_NAME) \
   -DMOZ_MIN_CPU_VERSION=$(MIN_CPU_VERSION) \
   $(NULL)
 
 GARBAGE += \
   AndroidManifest.xml  \
   classes.dex  \
-  $(MOZ_APP_NAME).apk  \
   $(PROCESSEDJAVAFILES) \
   gecko.ap_  \
-  gecko-unaligned.apk  \
-  gecko-unsigned-unaligned.apk \
   res/values/strings.xml \
   R.java \
   $(NULL)
 
-GARBAGE_DIRS += res libs dist classes
+GARBAGE_DIRS += classes
 
 DIRS = utils
 
 # Bug 567884 - Need a way to find appropriate icons during packaging
 ifeq ($(MOZ_APP_NAME),fennec)
 ICON_PATH = $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/content/fennec_48x48.png
 ICON_PATH_HDPI = $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/content/fennec_72x72.png
 else
@@ -98,58 +95,26 @@ ICON_PATH = $(topsrcdir)/$(MOZ_BRANDING_
 ICON_PATH_HDPI = $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/content/icon64.png
 endif
 
 RES_LAYOUT = \
   res/layout/notification_progress.xml \
   res/layout/notification_progress_text.xml
   $(NULL)
 
-NATIVE_LIBS = $(shell cat $(DIST)/bin/dependentlibs.list) libxpcom.so libnssckbi.so libfreebl3.so libmozutils.so
-FULL_LIBS = $(addprefix libs/armeabi/,$(NATIVE_LIBS))
-
-# We'll strip all the libs by default, due to size, but we might
-# want to have a non-stripped version for debugging.  We should
-# really pull out debuginfo and stuff.
-ifdef NO_STRIP
-DO_STRIP=echo not stripping
-else
-DO_STRIP=$(STRIP)
-endif
-
-# The set of files/directories from the dist/bin dir that we'll make available in the apk
-# some directories not listed due to special handling
-DIST_LINK_FILES = \
-  modules \
-  res \
-  application.ini \
-  platform.ini \
-  greprefs.js \
-  browserconfig.properties \
-  blocklist.xml \
-  chrome.manifest \
-  extensions \
-  $(NULL)
-
-ifdef MOZ_IPC
-DIST_LINK_FILES += $(MOZ_CHILD_PROCESS_NAME)
-endif
-
 JAVA_CLASSPATH = $(ANDROID_SDK)/android.jar
 
 DEFAULT_BRANDPATH = $(DEPTH)/$(MOZ_BRANDING_DIRECTORY)/locales/en-US/brand.dtd
 DEFAULT_STRINGSPATH = android_strings.dtd
 
 include $(topsrcdir)/config/rules.mk
 
 # Override the Java settings with some specific android settings
 include $(topsrcdir)/config/android-common.mk
 
-tools:: $(MOZ_APP_NAME).apk
-
 # Note that we're going to set up a dependency directly between embed_android.dex and the java files
 # Instead of on the .class files, since more than one .class file might be produced per .java file
 classes.dex: $(JAVAFILES) $(PROCESSEDJAVAFILES) R.java
 	$(NSINSTALL) -D classes
 	$(JAVAC) $(JAVAC_FLAGS) -d classes  $(addprefix $(srcdir)/,$(JAVAFILES)) $(PROCESSEDJAVAFILES) R.java
 	$(DX) --dex --output=$@ classes
 
 AndroidManifest.xml $(PROCESSEDJAVAFILES): % : %.in
@@ -177,48 +142,19 @@ endif
 	$(NSINSTALL) $(srcdir)/resources/layout/* res/layout/
 
 R.java: $(MOZ_APP_ICON) $(RES_LAYOUT) $(RES_DRAWABLE) res/values/strings.xml $(LOCALIZED_STRINGS_XML) AndroidManifest.xml
 	$(AAPT) package -f -M AndroidManifest.xml -I $(ANDROID_SDK)/android.jar -S res -J . --custom-package org.mozilla.gecko
 
 gecko.ap_: AndroidManifest.xml res/drawable/icon.png res/drawable-hdpi/icon.png $(RES_LAYOUT) $(RES_DRAWABLE) res/values/strings.xml $(LOCALIZED_STRINGS_XML)
 	$(AAPT) package -f -M AndroidManifest.xml -I $(ANDROID_SDK)/android.jar  -S res -F $@
 
-libs/armeabi/%: $(DIST)/lib/%
-	@$(NSINSTALL) -D libs/armeabi
-	@cp -L -v $< $@
-	@$(DO_STRIP) $@
-
-# Bug 567873 - Android packaging should use standard packaging code
-dist: FORCE
-	$(NSINSTALL) -D dist/components
-	rm -rf dist/components/*
-	@(for f in $(DIST)/bin/components/* ; do $(NSINSTALL) $$f dist/components ; done)
-	$(NSINSTALL) -D dist/chrome
-	rm -rf dist/chrome/*
-	@(for f in $(DIST)/bin/chrome/* ; do $(NSINSTALL) $$f dist/chrome ; done)
-	$(NSINSTALL) -D dist/defaults
-	rm -rf dist/defaults/*
-	@(for f in $(DIST)/bin/defaults/* ; do $(NSINSTALL) $$f dist/defaults ; done )
-	@(for f in $(DIST_LINK_FILES) ; do if [ -e $(DIST)/bin/$$f ] ; then echo $$f ; ln -sf ../$(DIST)/bin/$$f dist ; fi ; done)
-ifdef MOZ_UPDATER
-	$(NSINSTALL) $(DIST)/bin/update.locale dist
-endif
-
-gecko-unsigned-unaligned.apk: gecko.ap_ classes.dex dist $(FULL_LIBS)
-	$(APKBUILDER) $@ -v $(APKBUILDER_FLAGS) -z gecko.ap_ -f classes.dex -nf `pwd`/libs -rf dist
-
-gecko-unaligned.apk: gecko-unsigned-unaligned.apk
-	cp gecko-unsigned-unaligned.apk $@
-ifdef JARSIGNER
-	$(JARSIGNER) $@
-endif
-
-$(MOZ_APP_NAME).apk: gecko-unaligned.apk
-	$(ZIPALIGN) -f -v 4 gecko-unaligned.apk $@
-
 res/values/strings.xml: FORCE
 	mkdir -p res/values
 	$(PYTHON) $(topsrcdir)/config/Preprocessor.py $(DEFINES) \
 	  -DBRANDPATH="$(DEFAULT_BRANDPATH)" \
 	  -DSTRINGSPATH="$(DEFAULT_STRINGSPATH)" \
 	  $(srcdir)/strings.xml.in \
 	  > $@
+
+libs:: gecko.ap_ classes.dex
+	$(INSTALL) classes.dex $(FINAL_TARGET)
+	$(UNZIP) -o gecko.ap_ -d $(FINAL_TARGET)
--- a/toolkit/mozapps/installer/packager.mk
+++ b/toolkit/mozapps/installer/packager.mk
@@ -50,17 +50,21 @@ ifeq (,$(filter-out OS2 WINNT WINCE BeOS
 MOZ_PKG_FORMAT  = ZIP
 else
 ifeq (,$(filter-out SunOS, $(OS_ARCH)))
    MOZ_PKG_FORMAT  = BZ2
 else
    ifeq (,$(filter-out gtk2 qt, $(MOZ_WIDGET_TOOLKIT)))
       MOZ_PKG_FORMAT  = BZ2
    else
-      MOZ_PKG_FORMAT  = TGZ
+      ifeq (Android,$(OS_TARGET))
+          MOZ_PKG_FORMAT = APK
+      else
+          MOZ_PKG_FORMAT = TGZ
+      endif
    endif
 endif
 endif
 endif
 endif # MOZ_PKG_FORMAT
 
 ifeq ($(OS_ARCH),OS2)
 INSTALLER_DIR   = os2
@@ -142,16 +146,77 @@ INNER_MAKE_PACKAGE	= rm -f app.7z && \
   $(CYGWIN_WRAPPER) 7z a -r -t7z app.7z -mx -m0=BCJ2 -m1=LZMA:d24 \
     -m2=LZMA:d19 -m3=LZMA:d19 -mb0:1 -mb0s1:2 -mb0s2:3 && \
   mv core $(MOZ_PKG_DIR) && \
   cat $(SFX_HEADER) app.7z > $(PACKAGE) && \
   chmod 0755 $(PACKAGE)
 INNER_UNMAKE_PACKAGE	= $(CYGWIN_WRAPPER) 7z x $(UNPACKAGE) && \
   mv core $(MOZ_PKG_DIR)
 endif
+ifeq ($(MOZ_PKG_FORMAT),APK)
+
+# we have custom stuff for Android
+MOZ_OMNIJAR =
+
+JAVA_CLASSPATH = $(ANDROID_SDK)/android.jar
+include $(topsrcdir)/config/android-common.mk
+
+JARSIGNER ?= echo
+
+DIST_FILES = \
+  resources.arsc \
+  AndroidManifest.xml \
+  chrome \
+  components \
+  defaults \
+  modules \
+  res \
+  lib \
+  extensions \
+  application.ini \
+  platform.ini \
+  greprefs.js \
+  browserconfig.properties \
+  blocklist.xml \
+  chrome.manifest \
+  update.locale \
+  $(NULL)
+
+NON_DIST_FILES = \
+  classes.dex \
+  $(NULL)
+
+UPLOAD_EXTRA_FILES += gecko-unsigned-unaligned.apk
+
+include $(topsrcdir)/ipc/app/defs.mk
+
+ifdef MOZ_IPC
+DIST_FILES += $(MOZ_CHILD_PROCESS_NAME)
+endif
+
+PKG_SUFFIX      = .apk
+INNER_MAKE_PACKAGE	= \
+  rm -f $(_ABS_DIST)/gecko.ap_ && \
+  ( cd $(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH) && \
+    rm -rf lib && \
+    mkdir -p lib/armeabi && \
+    cp lib*.so lib/armeabi && \
+    $(ZIP) -r9D $(_ABS_DIST)/gecko.ap_ $(DIST_FILES) -x $(NON_DIST_FILES) ) && \
+  rm -f $(_ABS_DIST)/gecko.apk && \
+  $(APKBUILDER) $(_ABS_DIST)/gecko.apk -v $(APKBUILDER_FLAGS) -z $(_ABS_DIST)/gecko.ap_ -f $(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH)/classes.dex && \
+  cp $(_ABS_DIST)/gecko.apk $(_ABS_DIST)/gecko-unsigned-unaligned.apk && \
+  $(JARSIGNER) $(_ABS_DIST)/gecko.apk && \
+  $(ZIPALIGN) -f -v 4 $(_ABS_DIST)/gecko.apk $(PACKAGE)
+INNER_UNMAKE_PACKAGE	= \
+  mkdir $(MOZ_PKG_DIR) && \
+  cd $(MOZ_PKG_DIR) && \
+  $(UNZIP) $(UNPACKAGE) && \
+  mv lib/armeabi/*.so . && \
+  rm -rf lib
+endif
 ifeq ($(MOZ_PKG_FORMAT),DMG)
 ifndef _APPNAME
 ifdef MOZ_DEBUG
 _APPNAME	= $(MOZ_APP_DISPLAYNAME)Debug.app
 else
 _APPNAME	= $(MOZ_APP_DISPLAYNAME).app
 endif
 endif