This commit is contained in:
Maksim Gamarnik 2016-02-12 05:10:44 +02:00
parent e5b0d4b95c
commit 4a1647fcf4
2 changed files with 83 additions and 113 deletions

View File

@ -20,7 +20,7 @@ TARGET_HOST = arm-linux
TARGET_HOST2 = arm-linux
TARGET_ABI = armeabi-v7a-hard
TARGET_LIBDIR = armeabi-v7a
TARGET_TOOLCHAIN = arm-linux-androideabi
TARGET_TOOLCHAIN = arm-linux-androideabi-
TARGET_CFLAGS_ADDON = -D_NDK_MATH_NO_SOFTFP=1 -mfloat-abi=hard -Ofast -march=armv7-a
TARGET_CXXFLAGS_ADDON = $(TARGET_CFLAGS_ADDON)
TARGET_LDFLAGS_ADDON = -Wl,--no-warn-mismatch -lm_hard
@ -37,7 +37,7 @@ HAVE_LEVELDB = 0
# TARGET_HOST2 = arm-linux
# TARGET_ABI = arm64-v8a
# TARGET_LIBDIR = arm64-v8a
# TARGET_TOOLCHAIN = aarch64-linux-android
# TARGET_TOOLCHAIN = aarch64-linux-android-
# TARGET_CFLAGS_ADDON = -Ofast
# TARGET_CXXFLAGS_ADDON = $(TARGET_CFLAGS_ADDON)
# TARGET_ARCH = arm64
@ -53,7 +53,7 @@ HAVE_LEVELDB = 0
# TARGET_HOST2 = x86-linux
# TARGET_ABI = x86
# TARGET_LIBDIR = x86
# TARGET_TOOLCHAIN = x86
# TARGET_TOOLCHAIN = x86-
# TARGET_CFLAGS_ADDON = -Ofast
# TARGET_CXXFLAGS_ADDON = $(TARGET_CFLAGS_ADDON)
# TARGET_ARCH = x86
@ -71,12 +71,11 @@ LEVELDB_TIMESTAMP = $(LEVELDB_DIR)/timestamp
LEVELDB_TIMESTAMP_INT = $(ROOT)/deps/leveldb_timestamp
LEVELDB_URL_GIT = https://github.com/google/leveldb
OPENAL_VERSION = 1.17.2
OPENAL_DIR = $(ROOT)/deps/openal-soft-$(OPENAL_VERSION)
OPENAL_LIB = $(OPENAL_DIR)/build/libopenal.so
OPENAL_DIR = $(ROOT)/deps/openal-soft/
OPENAL_LIB = $(OPENAL_DIR)libs/$(TARGET_ABI)/libopenal.so
OPENAL_TIMESTAMP = $(OPENAL_DIR)/timestamp
OPENAL_TIMESTAMP_INT = $(ROOT)/deps/openal_timestamp
OPENAL_URL_HTTP = http://kcat.strangesoft.net/openal-releases/openal-soft-$(OPENAL_VERSION).tar.bz2
OPENAL_URL_GIT = https://github.com/apportable/openal-soft
OGG_DIR = $(ROOT)/deps/libvorbis-libogg-android/
OGG_LIB = $(OGG_DIR)libs/$(TARGET_ABI)/libogg.so
@ -214,60 +213,34 @@ $(OPENAL_TIMESTAMP) : openal_download
fi
openal_download :
@if [ ! -d "${OPENAL_DIR}" ] ; then \
@if [ ! -d ${OPENAL_DIR} ] ; then \
echo "openal sources missing, downloading..."; \
mkdir -p ${ROOT}/deps; \
cd deps; \
wget ${OPENAL_URL_HTTP} || exit 1; \
tar -xjf openal-soft-${OPENAL_VERSION}.tar.bz2 || exit 1; \
rm openal-soft-${OPENAL_VERSION}.tar.bz2; \
ln -s openal-soft-${OPENAL_VERSION} openal; \
cd openal; \
patch -p1 < ../../openal_soundcard.patch || exit 1; \
patch -p1 < ../../openal_cmake.patch || exit 1; \
cd ${ROOT}/deps ; \
git clone ${OPENAL_URL_GIT} || exit 1; \
fi
openal : $(OPENAL_LIB)
$(OPENAL_LIB) : $(OPENAL_TIMESTAMP)
$(OPENAL_LIB): $(OPENAL_TIMESTAMP)
+ @REFRESH=0; \
if [ ! -e ${OPENAL_TIMESTAMP_INT} ] ; then \
REFRESH=1; \
fi; \
if [ ! -e ${OPENAL_LIB} ] ; then \
REFRESH=1; \
fi; \
if [ ${OPENAL_TIMESTAMP} -nt ${OPENAL_TIMESTAMP_INT} ] ; then \
REFRESH=1; \
fi; \
if [ $$REFRESH -ne 0 ] ; then \
mkdir -p ${OPENAL_DIR}; \
export PATH=$$PATH:${SDKFOLDER}/platform-tools:${ANDROID_NDK}; \
echo "changed timestamp for openal detected building..."; \
cd deps/openal-soft-${OPENAL_VERSION}/build; \
export CROSS_PREFIX=${CROSS_PREFIX}; \
export TOOLCHAIN=/tmp/ndk-${TARGET_HOST}-openal; \
${ANDROID_NDK}/build/tools/make-standalone-toolchain.sh \
--toolchain=${TARGET_TOOLCHAIN}-${COMPILER_VERSION} \
--install-dir=$${TOOLCHAIN}; \
export PATH="$${TOOLCHAIN}/bin:$${PATH}"; \
export CXX=${CROSS_PREFIX}g++; \
export CC=${CROSS_PREFIX}gcc; \
export AR=${CROSS_PREFIX}ar; \
export LD=${CROSS_PREFIX}ld; \
export AS=${CROSS_PREFIX}as; \
export NM=${CROSS_PREFIX}nm; \
export STRIP=${CROSS_PREFIX}strip; \
export RANLIB=${CROSS_PREFIX}ranlib; \
export OBJDUMP=${CROSS_PREFIX}objdump; \
export TARGET_OS=OS_ANDROID_CROSSCOMPILE; \
cmake .. -DCMAKE_TOOLCHAIN_FILE=../XCompile-Android.txt \
-DHOST=${TARGET_TOOLCHAIN} -DTOOLCHAIN=${TOOLCHAIN} \
-DALSOFT_EXAMPLES=0 -DALSOFT_UTILS=0 -DALSOFT_HRTF_DEFS=0 || exit 1; \
$(MAKE) -s || exit 1; \
cd ${OPENAL_DIR}; \
ndk-build NDEBUG=${NDEBUG} NDK_MODULE_PATH=${NDK_MODULE_PATH} \
APP_ABI=${TARGET_ABI} TARGET_ARCH_ABI=${TARGET_ABI} \
APP_PLATFORM=${APP_PLATFORM} TARGET_CFLAGS+="${TARGET_CFLAGS_ADDON}" \
TARGET_LDFLAGS+="${TARGET_LDFLAGS_ADDON}" \
TARGET_CXXFLAGS+="${TARGET_CXXFLAGS_ADDON}" || exit 1; \
touch ${OPENAL_TIMESTAMP}; \
touch ${OPENAL_TIMESTAMP_INT}; \
$(RM) -rf $${TOOLCHAIN}; \
else \
echo "nothing to be done for openal"; \
fi
@ -354,7 +327,7 @@ $(OPENSSL_LIB): $(OPENSSL_TIMESTAMP) $(GMP_LIB)
ln -s ${OPENSSL_DIR} ../openssl; \
export TOOLCHAIN=/tmp/ndk-${TARGET_HOST}-openssl; \
${ANDROID_NDK}/build/tools/make-standalone-toolchain.sh \
--toolchain=${TARGET_TOOLCHAIN}-${COMPILER_VERSION} \
--toolchain=${TARGET_TOOLCHAIN}${COMPILER_VERSION} \
--install-dir=$${TOOLCHAIN}; \
export PATH="$${TOOLCHAIN}/bin:$${PATH}"; \
CC=${CROSS_PREFIX}gcc ./Configure enable-gmp -DL_ENDIAN -I${GMP_DIR} -L${GMP_DIR}/usr/lib android-${TARGET_ARCH};\
@ -403,7 +376,7 @@ $(LEVELDB_LIB): $(LEVELDB_TIMESTAMP)
export CROSS_PREFIX=${CROSS_PREFIX}; \
export TOOLCHAIN=/tmp/ndk-${TARGET_HOST}-leveldb; \
${ANDROID_NDK}/build/tools/make-standalone-toolchain.sh \
--toolchain=${TARGET_TOOLCHAIN}-${COMPILER_VERSION} \
--toolchain=${TARGET_TOOLCHAIN}${COMPILER_VERSION} \
--install-dir=$${TOOLCHAIN}; \
export PATH="$${TOOLCHAIN}/bin:$${PATH}"; \
export CC=${CROSS_PREFIX}gcc; \
@ -462,7 +435,7 @@ $(FREETYPE_LIB) : $(FREETYPE_TIMESTAMP)
export CROSS_PREFIX=${CROSS_PREFIX}; \
export TOOLCHAIN=/tmp/ndk-${TARGET_HOST}-freetype; \
${ANDROID_NDK}/build/tools/make-standalone-toolchain.sh \
--toolchain=${TARGET_TOOLCHAIN}-${COMPILER_VERSION} \
--toolchain=${TARGET_TOOLCHAIN}${COMPILER_VERSION} \
--install-dir=$${TOOLCHAIN}; \
export PATH="$${TOOLCHAIN}/bin:$${PATH}"; \
export CXX=${CROSS_PREFIX}g++; \
@ -475,9 +448,10 @@ $(FREETYPE_LIB) : $(FREETYPE_TIMESTAMP)
export RANLIB=${CROSS_PREFIX}ranlib; \
export OBJDUMP=${CROSS_PREFIX}objdump; \
export TARGET_OS=OS_ANDROID_CROSSCOMPILE; \
CC=${CROSS_PREFIX}gcc ./configure --host=${TARGET_TOOLCHAIN} \
CC=${CROSS_PREFIX}gcc ./configure --host=${TARGET_HOST}-androideabi \
--prefix=${TOOLCHAIN} --with-png=no --with-harfbuzz=no || exit 1; \
CC=${CROSS_PREFIX}gcc ANDROID_DEV=/tmp/ndk-${TARGET_HOST}-freetype make || exit 1; \
# $(MAKE) -s || exit 1; \
touch ${FREETYPE_TIMESTAMP}; \
touch ${FREETYPE_TIMESTAMP_INT}; \
$(RM) -rf $${TOOLCHAIN}; \
@ -526,9 +500,10 @@ $(ICONV_LIB) : $(ICONV_TIMESTAMP)
export PATH=$$PATH:${SDKFOLDER}/platform-tools:${ANDROID_NDK}; \
echo "changed timestamp for iconv detected building..."; \
cd ${ICONV_DIR}; \
\
export TOOLCHAIN=/tmp/ndk-${TARGET_HOST}-iconv; \
${ANDROID_NDK}/build/tools/make-standalone-toolchain.sh \
--toolchain=${TARGET_TOOLCHAIN}-${COMPILER_VERSION} \
--toolchain=${TARGET_TOOLCHAIN}${COMPILER_VERSION} \
--install-dir=$${TOOLCHAIN}; \
export PATH="$${TOOLCHAIN}/bin:$${PATH}"; \
export CC=${CROSS_PREFIX}gcc; \
@ -641,7 +616,7 @@ $(CURL_LIB): $(CURL_TIMESTAMP) $(OPENSSL_LIB)
export CROSS_PREFIX=${CROSS_PREFIX}; \
export TOOLCHAIN=/tmp/ndk-${TARGET_HOST}-curl; \
${ANDROID_NDK}/build/tools/make-standalone-toolchain.sh \
--toolchain=${TARGET_TOOLCHAIN}-${COMPILER_VERSION} \
--toolchain=${TARGET_TOOLCHAIN}${COMPILER_VERSION} \
--install-dir=$${TOOLCHAIN}; \
export PATH="$${TOOLCHAIN}/bin:$${PATH}"; \
export CC=${CROSS_PREFIX}gcc; \
@ -702,7 +677,7 @@ $(GMP_LIB): $(GMP_TIMESTAMP)
export CROSS_PREFIX=${CROSS_PREFIX}; \
export TOOLCHAIN=/tmp/ndk-${TARGET_HOST}-gmp; \
${ANDROID_NDK}/build/tools/make-standalone-toolchain.sh \
--toolchain=${TARGET_TOOLCHAIN}-${COMPILER_VERSION} \
--toolchain=${TARGET_TOOLCHAIN}${COMPILER_VERSION} \
--install-dir=$${TOOLCHAIN}; \
export PATH="$${TOOLCHAIN}/bin:$${PATH}"; \
export CC=${CROSS_PREFIX}gcc; \

View File

@ -31,7 +31,7 @@ include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := openal
LOCAL_SRC_FILES := deps/openal/build/libopenal.so
LOCAL_SRC_FILES := deps/openal-soft/libs/$(TARGET_LIBDIR)/libopenal.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
@ -44,11 +44,6 @@ LOCAL_MODULE := vorbis
LOCAL_SRC_FILES := deps/libvorbis-libogg-android/libs/$(TARGET_LIBDIR)/libvorbis.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := vorbisfile
LOCAL_SRC_FILES := deps/libvorbis/lib/.libs/libvorbisfile.so
include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := gmp
LOCAL_SRC_FILES := deps/gmp/usr/lib/libgmp.so
@ -110,7 +105,7 @@ LOCAL_C_INCLUDES := \
deps/libiconv/include \
deps/freetype/include \
deps/curl/include \
deps/openal/include \
deps/openal-soft/jni/OpenAL/include \
deps/libvorbis-libogg-android/jni/include \
deps/gmp/usr/include \
deps/leveldb/include \
@ -363,7 +358,7 @@ LOCAL_SRC_FILES += \
# JSONCPP
LOCAL_SRC_FILES += jni/src/json/jsoncpp.cpp
LOCAL_SHARED_LIBRARIES := iconv openal ogg vorbis vorbisfile gmp
LOCAL_SHARED_LIBRARIES := iconv openal ogg vorbis gmp
LOCAL_STATIC_LIBRARIES := Irrlicht freetype curl ssl crypto android_native_app_glue $(PROFILER_LIBS)
ifeq ($(HAVE_LEVELDB), 1)