add ogg, vorbis

This commit is contained in:
grigoriis 2016-02-09 21:26:55 +02:00
parent a8c0bedc4f
commit 8abae4e924
2 changed files with 110 additions and 27 deletions

View File

@ -78,12 +78,19 @@ OPENAL_TIMESTAMP = $(OPENAL_DIR)/timestamp
OPENAL_TIMESTAMP_INT = $(ROOT)/deps/openal_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_HTTP = http://kcat.strangesoft.net/openal-releases/openal-soft-$(OPENAL_VERSION).tar.bz2
OGG_DIR = $(ROOT)/deps/libvorbis-libogg-android/ OGG_VERSION = 1.3.2
OGG_LIB = $(OGG_DIR)libs/$(TARGET_ABI)/libogg.so OGG_DIR = $(ROOT)/deps/libogg-$(OGG_VERSION)
VORBIS_LIB = $(OGG_DIR)libs/$(TARGET_ABI)/libogg.so OGG_LIB = $(OGG_DIR)/build/libogg.so
OGG_TIMESTAMP = $(OGG_DIR)timestamp OGG_TIMESTAMP = $(OGG_DIR)/timestamp
OGG_TIMESTAMP_INT = $(ROOT)/deps/ogg_timestamp OGG_TIMESTAMP_INT = $(ROOT)/deps/ogg_timestamp
OGG_URL_GIT = https://github.com/vincentjames501/libvorbis-libogg-android OGG_URL_HTTP = http://downloads.xiph.org/releases/ogg/libogg-$(OGG_VERSION).tar.gz
VORBIS_VERSION = 1.3.5
VORBIS_DIR = $(ROOT)/deps/libvorbis-$(VORBIS_VERSION)
VORBIS_LIB = $(VORBIS_DIR)/build/libvorbis.so
VORBIS_TIMESTAMP = $(VORBIS_DIR)/timestamp
VORBIS_TIMESTAMP_INT = $(ROOT)/deps/vorbis_timestamp
VORBIS_URL_HTTP = http://downloads.xiph.org/releases/vorbis/libvorbis-$(VORBIS_VERSION).tar.gz
IRRLICHT_REVISION = 5122 IRRLICHT_REVISION = 5122
IRRLICHT_DIR = $(ROOT)/deps/irrlicht/ IRRLICHT_DIR = $(ROOT)/deps/irrlicht/
@ -163,7 +170,7 @@ endif
$(ASSETS_TIMESTAMP) $(LEVELDB_TIMESTAMP) \ $(ASSETS_TIMESTAMP) $(LEVELDB_TIMESTAMP) \
$(OPENAL_TIMESTAMP) $(OGG_TIMESTAMP) \ $(OPENAL_TIMESTAMP) $(OGG_TIMESTAMP) \
$(IRRLICHT_TIMESTAMP) $(CURL_TIMESTAMP) \ $(IRRLICHT_TIMESTAMP) $(CURL_TIMESTAMP) \
$(OPENSSL_TIMESTAMP) \ $(OPENSSL_TIMESTAMP) $(VORBIS_TIMESTAMP\
$(ROOT)/jni/src/android_version.h \ $(ROOT)/jni/src/android_version.h \
$(ROOT)/jni/src/android_version_githash.h $(ROOT)/jni/src/android_version_githash.h
@ -286,41 +293,116 @@ ogg_download :
echo "ogg sources missing, downloading..."; \ echo "ogg sources missing, downloading..."; \
mkdir -p ${ROOT}/deps; \ mkdir -p ${ROOT}/deps; \
cd ${ROOT}/deps ; \ cd ${ROOT}/deps ; \
git clone ${OGG_URL_GIT}|| exit 1; \ wget ${OGG_URL_HTTP} || exit 1; \
cd libvorbis-libogg-android ; \ tar -xzf libogg-${OGG_VERSION}.tar.gz; \
patch -p1 < ../../libvorbis-libogg-fpu.patch || exit 1; \ rm libogg-${OGG_VERSION}.tar.gz; \
sed -i 's-:-?-' jni/Application.mk; \ ln -s libogg-${OGG_VERSION} libogg; \
fi fi
ogg : $(OGG_LIB) ogg : $(OGG_LIB)
$(OGG_LIB): $(OGG_TIMESTAMP) $(OGG_LIB): $(OGG_TIMESTAMP)
+ @REFRESH=0; \ @REFRESH=0; \
if [ ! -e ${OGG_TIMESTAMP_INT} ] ; then \ if [ ! -e ${OGG_TIMESTAMP_INT} ] ; then \
echo "${OGG_TIMESTAMP_INT} doesn't exist"; \ echo "${OGG_TIMESTAMP_INT} doesn't exist"; \
REFRESH=1; \ REFRESH=1; \
fi; \ fi; \
if [ ${OGG_TIMESTAMP} -nt ${OGG_TIMESTAMP_INT} ] ; then \ if [ ${OGG_TIMESTAMP} -nt ${OGG_TIMESTAMP_INT} ] ; then \
REFRESH=1; \ REFRESH=1; \
fi; \ fi; \
if [ $$REFRESH -ne 0 ] ; then \ if [ $$REFRESH -ne 0 ] ; then \
export PATH=$$PATH:${SDKFOLDER}/platform-tools:${ANDROID_NDK}; \
echo "changed timestamp for ogg detected building..."; \ echo "changed timestamp for ogg detected building..."; \
cd ${OGG_DIR}; \ cd ${OGG_DIR}; \
ndk-build NDEBUG=${NDEBUG} NDK_MODULE_PATH=${NDK_MODULE_PATH} \ export TOOLCHAIN=/tmp/ndk-${TARGET_HOST}-ogg; \
APP_ABI=${TARGET_ABI} APP_PLATFORM=${APP_PLATFORM} \ ${ANDROID_NDK}/build/tools/make-standalone-toolchain.sh \
TARGET_CFLAGS+="${TARGET_CFLAGS_ADDON}" \ --toolchain=${TARGET_TOOLCHAIN}${COMPILER_VERSION} \
TARGET_LDFLAGS+="${TARGET_LDFLAGS_ADDON}" \ --install-dir=$${TOOLCHAIN}; \
TARGET_CXXFLAGS+="${TARGET_CXXFLAGS_ADDON}" || exit 1; \ 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; \
CC=${CROSS_PREFIX}gcc ./configure --host=${TARGET_HOST} --target=${TARGET_HOST} \
--build=x86_64-linux --with-sysroot="${TOOLCHAIN}" --prefix="${TOOLCHAIN}" || exit 1; \
$(MAKE) -s || exit 1; \
touch ${OGG_TIMESTAMP}; \ touch ${OGG_TIMESTAMP}; \
touch ${OGG_TIMESTAMP_INT}; \ touch ${OGG_TIMESTAMP_INT}; \
$(RM) -rf $${TOOLCHAIN}; \
else \ else \
echo "nothing to be done for libogg/libvorbis"; \ echo "nothing to be done for ogg"; \
fi fi
clean_ogg : clean_ogg :
$(RM) -rf ${OGG_DIR} $(RM) -rf ${OGG_DIR}
$(VORBIS_TIMESTAMP) : vorbis_download
@LAST_MODIF=$$(find ${VORBIS_DIR} -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" "); \
if [ $$(basename $$LAST_MODIF) != "timestamp" ] ; then \
touch ${VORBIS_TIMESTAMP}; \
fi
vorbis_download :
@if [ ! -d ${VORBIS_DIR} ] ; then \
echo "vorbis sources missing, downloading..."; \
mkdir -p ${ROOT}/deps; \
cd ${ROOT}/deps ; \
wget ${VORBIS_URL_HTTP} || exit 1; \
tar -xzf libvorbis-${VORBIS_VERSION}.tar.gz; \
rm libvorbis-${VORBIS_VERSION}.tar.gz; \
ln -s libvorbis-${VORBIS_VERSION} libvorbis; \
fi
vorbis : $(VORBIS_LIB) $(OGG_LIB)
$(VORBIS_LIB): $(VORBIS_TIMESTAMP)
@REFRESH=0; \
if [ ! -e ${VORBIS_TIMESTAMP_INT} ] ; then \
echo "${VORBIS_TIMESTAMP_INT} doesn't exist"; \
REFRESH=1; \
fi; \
if [ ${VORBIS_TIMESTAMP} -nt ${VORBIS_TIMESTAMP_INT} ] ; then \
REFRESH=1; \
fi; \
if [ $$REFRESH -ne 0 ] ; then \
echo "changed timestamp for vorbis detected building..."; \
cd ${VORBIS_DIR}; \
export TOOLCHAIN=/tmp/ndk-${TARGET_HOST}-vorbis; \
${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; \
CC=${CROSS_PREFIX}gcc ./configure --host=${TARGET_HOST} --target=${TARGET_HOST} \
--build=x86_64-linux --with-sysroot="${TOOLCHAIN}" \
--with-ogg-libraries="${VORBIS_DIR}/../libogg/src/.libs" \
--with-ogg-includes="${VORBIS_DIR}/../libogg/include" OGG_CFLAGS="${VORBIS_DIR}/../libogg" \
--prefix="${TOOLCHAIN}" || exit 1; \
$(MAKE) -s || exit 1; \
touch ${VORBIS_TIMESTAMP}; \
touch ${VORBIS_TIMESTAMP_INT}; \
$(RM) -rf $${TOOLCHAIN}; \
else \
echo "nothing to be done for vorbis"; \
fi
clean_vorbis :
$(RM) -rf ${VORBIS_DIR}
$(OPENSSL_TIMESTAMP) : openssl_download $(OPENSSL_TIMESTAMP) : openssl_download
@LAST_MODIF=$$(find ${OPENSSL_DIR} -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" "); \ @LAST_MODIF=$$(find ${OPENSSL_DIR} -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" "); \
if [ $$(basename $$LAST_MODIF) != "timestamp" ] ; then \ if [ $$(basename $$LAST_MODIF) != "timestamp" ] ; then \
@ -802,8 +884,8 @@ assets : $(ASSETS_TIMESTAMP)
clean_assets : clean_assets :
@$(RM) -r assets @$(RM) -r assets
apk: $(PATHCFGFILE) assets $(ICONV_LIB) $(IRRLICHT_LIB) $(CURL_LIB) $(GMP_LIB) $(LEVELDB_TARGET) \ apk: $(PATHCFGFILE) assets $(ICONV_LIB) $(IRRLICHT_LIB) $(CURL_LIB) $(GMP_LIB) $(LEVELDB_TARGET) \
$(OPENAL_LIB) $(OGG_LIB) prep_srcdir $(ROOT)/jni/src/android_version.h \ $(OPENAL_LIB) $(OGG_LIB) $(VORBIS_LIB) prep_srcdir $(ROOT)/jni/src/android_version.h \
$(ROOT)/jni/src/android_version_githash.h sqlite3_download $(ROOT)/jni/src/android_version_githash.h sqlite3_download
@export NDEBUG=$$NDEBUG; $(MAKE) manifest; \ @export NDEBUG=$$NDEBUG; $(MAKE) manifest; \
export PATH=$$PATH:${SDKFOLDER}/platform-tools:${ANDROID_NDK}; \ export PATH=$$PATH:${SDKFOLDER}/platform-tools:${ANDROID_NDK}; \
@ -845,7 +927,7 @@ envpaths :
clean_all : clean_all :
@$(MAKE) clean_apk; \ @$(MAKE) clean_apk; \
$(MAKE) clean_assets clean_iconv clean_irrlicht clean_leveldb clean_curl clean_openssl \ $(MAKE) clean_assets clean_iconv clean_irrlicht clean_leveldb clean_curl clean_openssl \
clean_openal clean_ogg clean_gmp clean_manifest; \ clean_openal clean_ogg clean_vorbis clean_gmp clean_manifest; \
sleep 1; \ sleep 1; \
$(RM) -r gen libs obj deps bin Debug and_env $(RM) -r gen libs obj deps bin Debug and_env

View File

@ -36,12 +36,12 @@ include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS) include $(CLEAR_VARS)
LOCAL_MODULE := ogg LOCAL_MODULE := ogg
LOCAL_SRC_FILES := deps/libvorbis-libogg-android/libs/$(TARGET_LIBDIR)/libogg.so LOCAL_SRC_FILES := deps/libogg/src/.libs/libogg.so
include $(PREBUILT_SHARED_LIBRARY) include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS) include $(CLEAR_VARS)
LOCAL_MODULE := vorbis LOCAL_MODULE := vorbis
LOCAL_SRC_FILES := deps/libvorbis-libogg-android/libs/$(TARGET_LIBDIR)/libvorbis.so LOCAL_SRC_FILES := deps/libvorbis/lib/.libs/libvorbis.so
include $(PREBUILT_SHARED_LIBRARY) include $(PREBUILT_SHARED_LIBRARY)
include $(CLEAR_VARS) include $(CLEAR_VARS)
@ -106,7 +106,8 @@ LOCAL_C_INCLUDES := \
deps/freetype/include \ deps/freetype/include \
deps/curl/include \ deps/curl/include \
deps/openal/include \ deps/openal/include \
deps/libvorbis-libogg-android/jni/include \ deps/libogg/include \
deps/libvorbis/include \
deps/gmp/usr/include \ deps/gmp/usr/include \
deps/leveldb/include \ deps/leveldb/include \
deps/sqlite/ deps/sqlite/