gecko/embedding/android/geckoview_example/Makefile.in
Nick Alexander ec8ac4c085 Bug 1099501 - Export and use ANDROID_TOOLS where appropriate. r=snorp,bnicholson
In certain configurations, in particular when installing the Android SDK
using HomeBrew, one sees a configuration with symlinks like:

    [brian@brian-macbook git]$ ls -l /usr/local/Cellar/android-sdk/23.0.2/
    total 72
    ...
    lrwxr-xr-x   1 brian  admin    38 Nov 14 16:39 platforms -> ../../../var/lib/android-sdk/platforms
    ...
    drwxr-xr-x  26 brian  admin   884 Nov 14 17:43 tools

In this case, we have
ANDROID_SDK=/usr/local/Cellar/android-sdk/23.0.2/platforms/android-21.

It is an anti-pattern to use ANDORID_SDK/.. to find other paths in the
tree.  This pattern is used in at least two places:

1) When we try to find
/usr/local/Cellar/android-sdk/23.0.2/platforms/android-21/../../tools,
we end up in the /usr/local/var/lib subtree.  This patch works around
that by exporting and using ANDROID_TOOLS; ANDROID_TOOLS itself is
extracted using path matching, rather than following .. through the
filesystem.

2) We also need to use ANDROID_SDK_ROOT rather than
ANDROID_SDK/../.. through-out.

--HG--
extra : rebase_source : 5e0323a94f2b80550f17a624e16f338cdeec406d
2014-11-17 11:12:00 -08:00

66 lines
1.7 KiB
Makefile

PP_TARGETS = properties manifest
manifest = AndroidManifest.xml.in
include $(topsrcdir)/config/rules.mk
GARBAGE = \
AndroidManifest.xml \
proguard-project.txt \
project.properties \
ant.properties \
build.xml \
local.properties \
geckoview_example.apk \
$(NULL)
GARBAGE_DIRS = \
assets \
geckoview_library \
gen \
bin \
libs \
res \
src \
binaries \
$(NULL)
ANDROID=$(ANDROID_TOOLS)/android
TARGET="android-$(ANDROID_TARGET_SDK)"
PACKAGE_DEPS = \
assets/libxul.so \
build.xml \
src/org/mozilla/geckoviewexample/GeckoViewExample.java \
$(CURDIR)/res/layout/main.xml \
$(CURDIR)/AndroidManifest.xml \
$(NULL)
$(CURDIR)/res/layout/main.xml: $(srcdir)/main.xml
$(NSINSTALL) $(srcdir)/main.xml res/layout/
src/org/mozilla/geckoviewexample/GeckoViewExample.java: $(srcdir)/GeckoViewExample.java
$(NSINSTALL) $(srcdir)/GeckoViewExample.java src/org/mozilla/geckoviewexample/
assets/libxul.so: $(DIST)/geckoview_library/geckoview_assets.zip FORCE
$(UNZIP) -o $(DIST)/geckoview_library/geckoview_assets.zip
build.xml: $(CURDIR)/AndroidManifest.xml
mv AndroidManifest.xml AndroidManifest.xml.save
$(ANDROID) create project --name GeckoViewExample --target $(TARGET) --path $(CURDIR) --activity GeckoViewExample --package org.mozilla.geckoviewexample
$(ANDROID) update project --target $(TARGET) --path $(CURDIR) --library $(DEPTH)/mobile/android/geckoview_library
$(RM) $(CURDIR)/res/layout/main.xml
$(NSINSTALL) $(srcdir)/main.xml res/layout/
$(RM) AndroidManifest.xml
mv AndroidManifest.xml.save AndroidManifest.xml
echo jar.libs.dir=libs >> project.properties
bin/GeckoViewExample-debug.apk: $(PACKAGE_DEPS)
ant debug
geckoview_example.apk: bin/GeckoViewExample-debug.apk
cp $< $@
package: geckoview_example.apk FORCE