shithub: openh264

Download patch

ref: 538d22560f6dbd98d0b3bea5085c134a6fdfaecc
parent: a921bc6589620e0e1dbd6d7d3e6eb09f505595db
author: Licai Guo <[email protected]>
date: Wed Feb 19 15:49:30 EST 2014

refine android build, add TARGET option to specify target in sdk

--- a/README.md
+++ b/README.md
@@ -59,11 +59,12 @@
 
 The codec and demo can be built by
 
-'make OS=android NDKROOT=**ANDROID_NDK**'
+'make OS=android NDKROOT=**ANDROID_NDK** TARGET= **ANDROID_TARGET**'
 
-You can also set ARCH, APILEVEL, GCCVERSION according to your device and NDK version.
+Valid **ANDROID_TARGET** can be found in **ANDROID_SDK**/platforms, such as android-12. 
+You can also set ARCH, NDKLEVEL, GCCVERSION according to your device and NDK version.
 ARCH specifies the architecture of android device. Currently only arm and x86 are supported, the default is arm.
-APILEVEL specifies android api level, the api level can be 12-19, the default is 19.
+NDKLEVEL specifies android api level, the api level can be 12-19, the default is 19.
 GCCVERSION specifies which gcc in NDK is used, the default is 4.8.
 
 For Windows Builds
--- a/build/platform-android.mk
+++ b/build/platform-android.mk
@@ -2,7 +2,7 @@
 ARCH = arm
 SHAREDLIBSUFFIX = so
 GCCVERSION = 4.8
-APILEVEL = 19
+NDKLEVEL = 12
 HOSTOS = $(shell uname | tr A-Z a-z | tr -d \\-[:digit:].)
 HOSTARCH = $(shell uname -m)
 ifeq ($(ARCH), arm)
@@ -25,7 +25,14 @@
 endif
 endif
 
-SYSROOT = $(NDKROOT)/platforms/android-$(APILEVEL)/arch-$(ARCH)
+ifndef NDKROOT
+$(error NDKROOT is not set)
+endif
+ifndef TARGET
+$(error TARGET is not set)
+endif
+
+SYSROOT = $(NDKROOT)/platforms/android-$(NDKLEVEL)/arch-$(ARCH)
 CXX = $(NDKROOT)/toolchains/$(GCCPATHPREFIX)-$(GCCVERSION)/prebuilt/$(HOSTOS)-$(HOSTARCH)/bin/$(GCCPREFIX)-g++
 CFLAGS += -DLINUX -fpic --sysroot=$(SYSROOT) -fno-rtti -fno-exceptions
 LDFLAGS += --sysroot=$(SYSROOT) -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,-soname,libwels.so
@@ -34,7 +41,7 @@
 binaries : decdemo encdemo
 
 decdemo: libraries
-	sh -c 'cd ./codec/build/android/dec/jni; $(NDKROOT)/ndk-build -B APP_ABI=$(APP_ABI); cd ..; android update project -p . ; ant debug; cd ../../../..'
+	sh -c 'cd ./codec/build/android/dec/jni; $(NDKROOT)/ndk-build -B APP_ABI=$(APP_ABI); cd ..; android update project -t $(TARGET) -p . ; ant debug; cd ../../../..'
 
 encdemo: libraries
-	sh -c 'cd ./codec/build/android/enc/jni; $(NDKROOT)/ndk-build -B APP_ABI=$(APP_ABI); cd ..; android update project -p . ; ant debug; cd ../../../..'
+	sh -c 'cd ./codec/build/android/enc/jni; $(NDKROOT)/ndk-build -B APP_ABI=$(APP_ABI); cd ..; android update project -t $(TARGET) -p . ; ant debug; cd ../../../..'
--- a/codec/build/android/dec/project.properties
+++ /dev/null
@@ -1,14 +1,0 @@
-# This file is automatically generated by Android Tools.
-# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
-#
-# This file must be checked in Version Control Systems.
-#
-# To customize properties used by the Ant build system edit
-# "ant.properties", and override values to adapt the script to your
-# project structure.
-#
-# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
-#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
-
-# Project target.
-target=android-12
--- a/codec/build/android/enc/project.properties
+++ /dev/null
@@ -1,14 +1,0 @@
-# This file is automatically generated by Android Tools.
-# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
-#
-# This file must be checked in Version Control Systems.
-#
-# To customize properties used by the Ant build system edit
-# "ant.properties", and override values to adapt the script to your
-# project structure.
-#
-# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
-#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
-
-# Project target.
-target=android-12