aboutsummaryrefslogtreecommitdiff
path: root/tools/android/packaging/Makefile.in
diff options
context:
space:
mode:
Diffstat (limited to 'tools/android/packaging/Makefile.in')
-rw-r--r--tools/android/packaging/Makefile.in132
1 files changed, 132 insertions, 0 deletions
diff --git a/tools/android/packaging/Makefile.in b/tools/android/packaging/Makefile.in
new file mode 100644
index 0000000000..2c0efa4b90
--- /dev/null
+++ b/tools/android/packaging/Makefile.in
@@ -0,0 +1,132 @@
+include ../../depends/Makefile.include
+
+OBJS = libcurl.so \
+ librtmp.so \
+ libafpclient.so \
+ libplist.so libshairplay.so \
+ libxbogg.so libxbvorbis.so libxbvorbisfile.so libxbmpeg2.so \
+ libxbmpeg2convert.so libnfs.so libass.so libbluray.so
+
+PLATFORM_OBJS =
+EXCLUDED_ADDONS = screensaver.rsxs.euphoria visualization.dxspectrum visualization.milkdrop visualization.projectm
+
+XBMCROOT = $(shell cd $(CURDIR)/../../..; pwd)
+COPYDIRS = system addons language media
+GCC_VERSION=$(shell $(CC) -dumpversion)
+
+X86OVERRIDES=XBMC_OVERRIDE_HOST=i686-android-linux XBMC_OVERRIDE_TOOLCHAIN=$(XBMC_X86_TOOLCHAIN)
+ARMOVERRIDES=XBMC_OVERRIDE_HOST=arm-linux-androideabi XBMC_OVERRIDE_TOOLCHAIN=$(XBMC_ARM_TOOLCHAIN)
+
+#this fixes a android ndk fuckup where the pathes to
+#prebuilt stuff follow different name shemes for
+#arm and x86
+ifeq ($(findstring i686,$(CPU)),i686)
+ARCH=x86
+CPU=x86
+endif
+ifeq ($(findstring arm,$(CPU)),arm)
+ARCH=arm
+endif
+
+#older ndk x86
+GDBPATH=$(NDKROOT)/toolchains/$(ARCH)-$(GCC_VERSION)/prebuilt/gdbserver
+
+ifneq ($(shell test -f $(GDBPATH) && echo 1),1)
+#older ndk arm
+GDBPATH=$(NDKROOT)/toolchains/$(HOST)-$(GCC_VERSION)/prebuilt/gdbserver
+endif
+
+ifneq ($(shell test -f $(GDBPATH) && echo 1),1)
+#vanilla ndk >= 8
+GDBPATH=$(NDKROOT)/prebuilt/android-$(ARCH)/gdbserver/gdbserver
+endif
+
+all: package
+SRCLIBS = $(addprefix $(PREFIX)/lib/,$(OBJS)) $(addprefix $(PREFIX)/lib/$(SDK_PLATFORM)/,$(PLATFORM_OBJS))
+DSTLIBS = $(CPU)/lib/lib@APP_NAME_LC@.so $(addprefix $(CPU)/lib/,$(OBJS)) $(addprefix $(CPU)/lib/,$(PLATFORM_OBJS))
+libs= $(DSTLIBS)
+
+multi: x86 arm
+ @cp images/@APP_NAME_LC@app-debug-skeleton.apk images/@APP_NAME_LC@app-debug-multi-unaligned.apk
+ @cd xbmc; zip -r -q ../images/@APP_NAME_LC@app-debug-multi-unaligned.apk lib/ assets
+ @jarsigner -sigalg MD5withRSA -digestalg SHA1 -keystore ~/.android/debug.keystore -storepass android images/@APP_NAME_LC@app-debug-multi-unaligned.apk androiddebugkey
+ @$(ZIPALIGN) -f 4 images/@APP_NAME_LC@app-debug-multi-unaligned.apk $(XBMCROOT)/@APP_NAME_LC@app-multi-debug.apk
+ @rm images/@APP_NAME_LC@app-debug-multi-unaligned.apk
+ @echo "$(XBMCROOT)/@APP_NAME_LC@app-multi-debug.apk created"
+
+package: extras
+ @cp images/@APP_NAME_LC@app-debug-skeleton.apk images/@APP_NAME_LC@app-debug-$(CPU)-unaligned.apk
+ @javac -classpath $(SDKROOT)/platforms/$(SDK_PLATFORM)/android.jar:xbmc/obj -d xbmc/obj -sourcepath xbmc/src xbmc/src/*.java
+ @javac -classpath $(SDKROOT)/platforms/$(SDK_PLATFORM)/android.jar:xbmc/obj -d xbmc/obj -sourcepath xbmc/src xbmc/src/org/xbmc/xbmc/*.java
+ @$(DX) --dex --output=xbmc/classes.dex xbmc/obj
+ @cd xbmc; zip -r -q ../images/@APP_NAME_LC@app-debug-$(CPU)-unaligned.apk lib/$(CPU) assets classes.dex
+ @jarsigner -sigalg MD5withRSA -digestalg SHA1 -keystore ~/.android/debug.keystore -storepass android images/@APP_NAME_LC@app-debug-$(CPU)-unaligned.apk androiddebugkey
+ @$(ZIPALIGN) -f 4 images/@APP_NAME_LC@app-debug-$(CPU)-unaligned.apk $(XBMCROOT)/@APP_NAME_LC@app-$(CPU)-debug.apk
+ @rm images/@APP_NAME_LC@app-debug-$(CPU)-unaligned.apk
+ @echo "$(XBMCROOT)/@APP_NAME_LC@app-$(CPU)-debug.apk created"
+
+extras: libs
+ rm -rf xbmc/assets
+ mkdir -p xbmc/assets xbmc/res xbmc/res/raw xbmc/assets/python2.6/lib/
+ cp -rfp $(PREFIX)/share/@APP_NAME_LC@/* ./xbmc/assets
+ find `pwd`/xbmc/assets/ -depth -name ".git" -exec rm -rf {} \;
+ find `pwd`/xbmc/assets/system/ -name "*.so" -exec rm {} \;
+ find `pwd`/xbmc/assets/addons/skin.*/media/* -depth -not -iname "Textures.xbt" -exec rm -rf {} \;
+ find `pwd`/xbmc/assets/system/keymaps/ -depth -name "joystick*.xml" -exec rm {} \;
+ mv -f `pwd`/xbmc/assets/system/keymaps/joystick.xml.sample `pwd`/xbmc/assets/system/keymaps/joystick.xml
+ @echo "native_arch=$(ARCH)" > xbmc/res/raw/xbmc.properties
+ cd xbmc/assets/addons; rm -rf $(EXCLUDED_ADDONS)
+ cp -rfp $(PREFIX)/lib/python2.6 xbmc/assets/python2.6/lib/
+ cp -fp $(XBMCROOT)/media/Splash.png xbmc/res/drawable/splash.png
+ cp -fp media/drawable-hdpi/ic_launcher.png xbmc/res/drawable-hdpi/ic_launcher.png
+ cp -fp media/drawable-ldpi/ic_launcher.png xbmc/res/drawable-ldpi/ic_launcher.png
+ cp -fp media/drawable-mdpi/ic_launcher.png xbmc/res/drawable-mdpi/ic_launcher.png
+ cp -fp media/drawable-xhdpi/ic_launcher.png xbmc/res/drawable-xhdpi/ic_launcher.png
+ cp -fp media/drawable-xxhdpi/ic_launcher.png xbmc/res/drawable-xxhdpi/ic_launcher.png
+ cd xbmc/assets/python2.6/lib/python2.6/; rm -rf test config lib-dynload
+ mkdir -p tmp/res; $(AAPT) c -S xbmc/res -C tmp/res; cp -r -n xbmc/res tmp/ || true
+ $(AAPT) p -f -I $(SDKROOT)/platforms/$(SDK_PLATFORM)/android.jar -S tmp/res/ -M xbmc/AndroidManifest.xml -F images/@APP_NAME_LC@app-debug-skeleton.apk -J xbmc/src
+ @rm -rf tmp/
+
+libs: $(PREFIX)/lib/@APP_NAME_LC@/lib@APP_NAME_LC@.so
+ rm -rf xbmc/lib/$(CPU) xbmc/libs/$(CPU) xbmc/obj/local/$(CPU)
+ mkdir -p xbmc/lib/$(CPU) images xbmc/assets/python2.6/lib/ xbmc/libs/$(CPU) xbmc/obj/local/$(CPU)
+ cp -fp $(SRCLIBS) xbmc/obj/local/$(CPU)/
+ cp -fp $(PREFIX)/lib/@APP_NAME_LC@/lib@APP_NAME_LC@.so xbmc/obj/local/$(CPU)/
+ find $(PREFIX)/lib/@APP_NAME_LC@/addons -name "*.so" -exec cp -fp {} xbmc/obj/local/$(CPU)/ \;
+ find $(PREFIX)/lib/@APP_NAME_LC@/system -name "*.so" -exec cp -fp {} xbmc/obj/local/$(CPU)/ \;
+ cd xbmc/obj/local/$(CPU)/; find . -name "*.so" -not -name "lib*.so" | sed "s/\.\///" | xargs -I@ mv @ lib@
+ cp -fp xbmc/obj/local/$(CPU)/*.so xbmc/lib/$(CPU)/
+ $(STRIP) --strip-unneeded xbmc/lib/$(CPU)/*.so
+ install -p $(GDBPATH) ./xbmc/libs/$(CPU)/gdbserver
+ echo "set solib-search-path ./obj/local/$(CPU)" > ./xbmc/libs/$(CPU)/gdb.setup
+ echo "directory $(TOOLCHAIN)/sysroot/usr/include $(NDKROOT)/sources/android/native_app_glue" \
+ "$(NDKROOT)/sources/cxx-stl/gnu-libstdc++/$(GCC_VERSION)/include $(XBMCROOT) $(PREFIX)/include jni" >> ./xbmc/libs/$(CPU)/gdb.setup
+ cp -fp xbmc/libs/$(CPU)/* xbmc/lib/$(CPU)
+
+$(PREFIX)/lib/xbmc/lib@APP_NAME_LC@.so: $(SRCLIBS)
+ $(MAKE) -C ../../depends/target/xbmc
+
+$(SRCLIBS):
+
+arm: armeabi-v7a
+
+armeabi-v7a: $(XBMC_ARM_TOOLCHAIN) force
+ XBMC_OVERRIDE_PLATFORM=$@ $(ARMOVERRIDES) $(MAKE) package
+
+x86: $(XBMC_X86_TOOLCHAIN) force
+ XBMC_OVERRIDE_PLATFORM=$@ $(X86OVERRIDES) $(MAKE) package
+
+clean:
+ rm -rf images
+ rm -rf xbmc/lib
+ rm -rf xbmc/libs
+ rm -rf xbmc/assets
+ rm -rf xbmc/obj
+ rm -rf xbmc/res/raw
+ rm -rf tmp
+ rm -f xbmc/res/drawable/splash.png
+ rm -f xbmc/src/R.java
+ rm -f xbmc/classes.dex
+
+.PHONY: arm armeabi-v7a x86 force extras libs