gecko/embedding/android/Makefile.in
2010-08-30 17:52:53 +02:00

200 lines
6.5 KiB
Makefile

# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is the Mozilla browser.
#
# The Initial Developer of the Original Code is
# Mozilla Foundation
# Portions created by the Initial Developer are Copyright (C) 2009-2010
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Vladimir Vukicevic <vladimir@pobox.com>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
DEPTH = ../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/ipc/app/defs.mk
JAVAFILES = \
GeckoApp.java \
GeckoAppShell.java \
GeckoEvent.java \
GeckoSurfaceView.java \
GeckoInputConnection.java \
$(NULL)
PROCESSEDJAVAFILES = \
App.java \
Restarter.java \
NotificationHandler.java \
$(NULL)
DEFINES += \
-DMOZ_APP_DISPLAYNAME=$(MOZ_APP_DISPLAYNAME) \
-DMOZ_APP_NAME=$(MOZ_APP_NAME) \
-DMOZ_APP_VERSION=$(MOZ_APP_VERSION) \
-DMOZ_CHILD_PROCESS_NAME=$(MOZ_CHILD_PROCESS_NAME)
GARBAGE += \
AndroidManifest.xml \
classes.dex \
$(MOZ_APP_NAME).apk \
$(PROCESSEDJAVAFILES) \
gecko.ap_ \
gecko-unaligned.apk \
gecko-unsigned-unaligned.apk \
$(NULL)
GARBAGE_DIRS += res libs dist 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
ICON_PATH = $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/content/icon48.png
ICON_PATH_HDPI = $(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/content/icon64.png
endif
RES_DRAWABLE = \
res/drawable/alertaddons.png \
res/drawable/alertdownloads.png \
$(NULL)
RES_DRAWABLE_HDPI = \
res/drawable-hdpi/alertaddons.png \
res/drawable-hdpi/alertdownloads.png \
$(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 \
$(NULL)
ifdef MOZ_IPC
DIST_LINK_FILES += $(MOZ_CHILD_PROCESS_NAME)
endif
JAVA_CLASSPATH = $(ANDROID_SDK)/android.jar
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
$(PYTHON) $(topsrcdir)/config/Preprocessor.py \
$(AUTOMATION_PPARGS) $(DEFINES) $(ACDEFINES) $< > $@
res/drawable/icon.png: $(MOZ_APP_ICON)
$(NSINSTALL) -D res/drawable
cp $(ICON_PATH) $@
res/drawable-hdpi/icon.png: $(MOZ_APP_ICON)
$(NSINSTALL) -D res/drawable-hdpi
cp $(ICON_PATH_HDPI) $@
$(RES_DRAWABLE):
$(NSINSTALL) -D res/drawable
cp $(topsrcdir)/mobile/app/android/drawable/* res/drawable/
$(RES_DRAWABLE_HDPI):
$(NSINSTALL) -D res/drawable-hdpi
cp $(topsrcdir)/mobile/app/android/drawable-hdpi/* res/drawable-hdpi/
R.java: $(MOZ_APP_ICON) $(RES_DRAWABLE) $(RES_DRAWABLE_HDPI)
$(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_DRAWABLE) $(RES_DRAWABLE_HDPI)
$(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)
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 $@