Skip to content

Commit

Permalink
Updated Android native Makefiles for new external libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Oct 13, 2017
1 parent 0952ea6 commit f23f283
Show file tree
Hide file tree
Showing 4 changed files with 338 additions and 14 deletions.
36 changes: 22 additions & 14 deletions Android.mk
Expand Up @@ -4,25 +4,31 @@ include $(CLEAR_VARS)

LOCAL_MODULE := SDL2_mixer

# Enable this if you want to support loading MOD music via modplug
# Enable this if you want to support loading FLAC music via libFLAC
# The library path should be a relative path to this directory.
SUPPORT_MOD_MODPLUG ?= true
MODPLUG_LIBRARY_PATH := external/libmodplug-0.8.8.4
#
# You need to symlink the FLAC_LIBRARY_PATH to your jni directory
# so the shared library is built.
SUPPORT_FLAC ?= true
FLAC_LIBRARY_PATH := external/flac-1.3.2

# Enable this if you want to support loading MOD music via mikmod
# Enable this if you want to support loading MOD music via modplug
# The library path should be a relative path to this directory.
SUPPORT_MOD_MIKMOD ?= true
MIKMOD_LIBRARY_PATH := external/libmikmod-3.1.12
SUPPORT_MOD_MODPLUG ?= true
MODPLUG_LIBRARY_PATH := external/libmodplug-0.8.9.0

# Enable this if you want to support loading MP3 music via SMPEG
# The library path should be a relative path to this directory.
#
# You need to symlink the SMPEG_LIBRARY_PATH to your jni directory
# so the shared library is built.
SUPPORT_MP3_SMPEG ?= true
SMPEG_LIBRARY_PATH := external/smpeg2-2.0.0

# Enable this if you want to support loading OGG Vorbis music via Tremor
# The library path should be a relative path to this directory.
SUPPORT_OGG ?= true
OGG_LIBRARY_PATH := external/libogg-1.3.1
OGG_LIBRARY_PATH := external/libogg-1.3.2
VORBIS_LIBRARY_PATH := external/libvorbisidec-1.2.1


Expand All @@ -45,6 +51,12 @@ ifeq ($(SUPPORT_TIMIDITY),true)
LOCAL_SRC_FILES += $(subst $(LOCAL_PATH)/,,$(wildcard $(LOCAL_PATH)/timidity/*.c))
endif

ifeq ($(SUPPORT_FLAC),true)
LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(FLAC_LIBRARY_PATH)/include
LOCAL_CFLAGS += -DFLAC_MUSIC
LOCAL_SHARED_LIBRARIES += libFLAC
endif

ifeq ($(SUPPORT_MOD_MODPLUG),true)
LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(MODPLUG_LIBRARY_PATH)/src $(LOCAL_PATH)/$(MODPLUG_LIBRARY_PATH)/src/libmodplug
LOCAL_CFLAGS += -DMODPLUG_MUSIC -DMODPLUG_HEADER="<modplug.h>" -DHAVE_SETENV -DHAVE_SINF
Expand Down Expand Up @@ -85,20 +97,16 @@ ifeq ($(SUPPORT_MOD_MODPLUG),true)
$(MODPLUG_LIBRARY_PATH)/src/sndmix.cpp
endif

ifeq ($(SUPPORT_MOD_MIKMOD),true)
LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(MIKMOD_LIBRARY_PATH)/include
LOCAL_CFLAGS += -DMOD_MUSIC
LOCAL_SHARED_LIBRARIES += mikmod
endif

ifeq ($(SUPPORT_MP3_SMPEG),true)
LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(SMPEG_LIBRARY_PATH)
LOCAL_CFLAGS += -DMP3_MUSIC
LOCAL_SHARED_LIBRARIES += smpeg2
endif

ifeq ($(SUPPORT_OGG),true)
LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(OGG_LIBRARY_PATH)/include $(LOCAL_PATH)/$(VORBIS_LIBRARY_PATH)
LOCAL_C_INCLUDES += $(LOCAL_PATH)/$(OGG_LIBRARY_PATH)/android \
$(LOCAL_PATH)/$(OGG_LIBRARY_PATH)/include \
$(LOCAL_PATH)/$(VORBIS_LIBRARY_PATH)
LOCAL_CFLAGS += -DOGG_MUSIC -DOGG_USE_TREMOR -DOGG_HEADER="<ivorbisfile.h>"
ifeq ($(TARGET_ARCH_ABI),armeabi)
LOCAL_CFLAGS += -D_ARM_ASSEM_
Expand Down
51 changes: 51 additions & 0 deletions external/flac-1.3.2/Android.mk
@@ -0,0 +1,51 @@
LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := libFLAC

OGG_LIBRARY_PATH := $(LOCAL_PATH)/../libogg-1.3.2

LOCAL_C_INCLUDES := $(LOCAL_PATH)/include \
$(LOCAL_PATH)/src/libFLAC/include \
$(OGG_LIBRARY_PATH)/include \
$(OGG_LIBRARY_PATH)/android
LOCAL_CFLAGS := -include $(LOCAL_PATH)/android/config.h

LOCAL_SRC_FILES := \
src/libFLAC/bitmath.c \
src/libFLAC/bitreader.c \
src/libFLAC/bitwriter.c \
src/libFLAC/cpu.c \
src/libFLAC/crc.c \
src/libFLAC/fixed.c \
src/libFLAC/fixed_intrin_sse2.c \
src/libFLAC/fixed_intrin_ssse3.c \
src/libFLAC/float.c \
src/libFLAC/format.c \
src/libFLAC/lpc.c \
src/libFLAC/lpc_intrin_sse.c \
src/libFLAC/lpc_intrin_sse2.c \
src/libFLAC/lpc_intrin_sse41.c \
src/libFLAC/lpc_intrin_avx2.c \
src/libFLAC/md5.c \
src/libFLAC/memory.c \
src/libFLAC/metadata_iterators.c \
src/libFLAC/metadata_object.c \
src/libFLAC/stream_decoder.c \
src/libFLAC/stream_encoder.c \
src/libFLAC/stream_encoder_intrin_sse2.c \
src/libFLAC/stream_encoder_intrin_ssse3.c \
src/libFLAC/stream_encoder_intrin_avx2.c \
src/libFLAC/stream_encoder_framing.c \
src/libFLAC/window.c \
src/libFLAC/ogg_decoder_aspect.c \
src/libFLAC/ogg_encoder_aspect.c \
src/libFLAC/ogg_helper.c \
src/libFLAC/ogg_mapping.c \
$(OGG_LIBRARY_PATH)/src/framing.c \
$(OGG_LIBRARY_PATH)/src/bitwise.c

LOCAL_EXPORT_C_INCLUDES += $(LOCAL_C_INCLUDES)

include $(BUILD_SHARED_LIBRARY)
240 changes: 240 additions & 0 deletions external/flac-1.3.2/android/config.h
@@ -0,0 +1,240 @@
/* config.h. Generated from config.h.in by configure. */
/* config.h.in. Generated from configure.ac by autoheader. */

/* Define if building universal (internal helper macro) */
/* #undef AC_APPLE_UNIVERSAL_BUILD */

/* Target processor is big endian. */
#define CPU_IS_BIG_ENDIAN 0

/* Target processor is little endian. */
#define CPU_IS_LITTLE_ENDIAN 1

/* Set FLAC__BYTES_PER_WORD to 8 (4 is the default) */
#define ENABLE_64_BIT_WORDS 0

/* define to align allocated memory on 32-byte boundaries */
#define FLAC__ALIGN_MALLOC_DATA 1

/* define if building for ia32/i386 */
/* #undef FLAC__CPU_IA32 */

/* define if building for PowerPC */
/* #undef FLAC__CPU_PPC */

/* define if building for PowerPC with SPE ABI */
/* #undef FLAC__CPU_PPC_SPE */

/* define if building for SPARC */
/* #undef FLAC__CPU_SPARC */

/* define if building for x86_64 */
/* #undef FLAC__CPU_X86_64 */

/* define if you have docbook-to-man or docbook2man */
/* #undef FLAC__HAS_DOCBOOK_TO_MAN */

/* define if you are compiling for x86 and have the NASM assembler */
/* #undef FLAC__HAS_NASM */

/* define if you have the ogg library */
#define FLAC__HAS_OGG 1

/* Set to 1 if <x86intrin.h> is available. */
#define FLAC__HAS_X86INTRIN 0

/* define to disable use of assembly code */
/* #undef FLAC__NO_ASM */

/* define if building for Darwin / MacOS X */
/* #undef FLAC__SYS_DARWIN */

/* define if building for Linux */
/* #undef FLAC__SYS_LINUX */

/* define to enable use of Altivec instructions */
#define FLAC__USE_ALTIVEC 1

/* define to enable use of AVX instructions */
#define FLAC__USE_AVX 1

/* Compiler has the __builtin_bswap16 intrinsic */
#define HAVE_BSWAP16 1

/* Compiler has the __builtin_bswap32 intrinsic */
#define HAVE_BSWAP32 1

/* Define to 1 if you have the <byteswap.h> header file. */
#define HAVE_BYTESWAP_H 1

/* define if you have clock_gettime */
/* #undef HAVE_CLOCK_GETTIME */

/* Define to 1 if you have the <cpuid.h> header file. */
/* #undef HAVE_CPUID_H */

/* Define to 1 if C++ supports variable-length arrays. */
#define HAVE_CXX_VARARRAYS 1

/* Define to 1 if C supports variable-length arrays. */
#define HAVE_C_VARARRAYS 1

/* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1

/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
#define HAVE_FSEEKO 1

/* Define to 1 if you have the `getopt_long' function. */
#define HAVE_GETOPT_LONG 1

/* Define if you have the iconv() function and it works. */
/* #undef HAVE_ICONV */

/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1

/* Define if you have <langinfo.h> and nl_langinfo(CODESET). */
/* #undef HAVE_LANGINFO_CODESET */

/* lround support */
#define HAVE_LROUND 1

/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1

/* Define to 1 if the system has the type `socklen_t'. */
/* #undef HAVE_SOCKLEN_T */

/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1

/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1

/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1

/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1

/* Define to 1 if you have the <sys/ioctl.h> header file. */
#define HAVE_SYS_IOCTL_H 1

/* Define to 1 if you have the <sys/param.h> header file. */
#define HAVE_SYS_PARAM_H 1

/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1

/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1

/* Define to 1 if you have the <termios.h> header file. */
#define HAVE_TERMIOS_H 1

/* Define to 1 if typeof works with your compiler. */
#define HAVE_TYPEOF 1

/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1

/* Define to 1 if you have the <x86intrin.h> header file. */
/* #undef HAVE_X86INTRIN_H */

/* Define as const if the declaration of iconv() needs const. */
/* #undef ICONV_CONST */

/* Define to the sub-directory where libtool stores uninstalled libraries. */
#define LT_OBJDIR ".libs/"

/* Name of package */
#define PACKAGE "flac"

/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "flac-dev@xiph.org"

/* Define to the full name of this package. */
#define PACKAGE_NAME "flac"

/* Define to the full name and version of this package. */
#define PACKAGE_STRING "flac 1.3.2"

/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "flac"

/* Define to the home page for this package. */
#define PACKAGE_URL "https://www.xiph.org/flac/"

/* Define to the version of this package. */
#define PACKAGE_VERSION "1.3.2"

/* The size of `off_t', as computed by sizeof. */
#define SIZEOF_OFF_T 4

/* The size of `void*', as computed by sizeof. */
#define SIZEOF_VOIDP 4

/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1

/* Enable extensions on AIX 3, Interix. */
#ifndef _ALL_SOURCE
# define _ALL_SOURCE 1
#endif
/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
# define _GNU_SOURCE 1
#endif
/* Enable threading extensions on Solaris. */
#ifndef _POSIX_PTHREAD_SEMANTICS
# define _POSIX_PTHREAD_SEMANTICS 1
#endif
/* Enable extensions on HP NonStop. */
#ifndef _TANDEM_SOURCE
# define _TANDEM_SOURCE 1
#endif
/* Enable general extensions on Solaris. */
#ifndef __EXTENSIONS__
# define __EXTENSIONS__ 1
#endif


/* Version number of package */
#define VERSION "1.3.2"

/* Target processor is big endian. */
#define WORDS_BIGENDIAN 0

/* Enable large inode numbers on Mac OS X 10.5. */
#ifndef _DARWIN_USE_64_BIT_INODE
# define _DARWIN_USE_64_BIT_INODE 1
#endif

/* Number of bits in a file offset, on hosts where this is settable. */
/* #undef _FILE_OFFSET_BITS */

/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */
/* #undef _LARGEFILE_SOURCE */

/* Define for large files, on AIX-style hosts. */
/* #undef _LARGE_FILES */

/* Define to 1 if on MINIX. */
/* #undef _MINIX */

/* Define to 2 if the system does not provide POSIX.1 features except with
this defined. */
/* #undef _POSIX_1_SOURCE */

/* Define to 1 if you need to in order for `stat' and other things to work. */
/* #undef _POSIX_SOURCE */

/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
#ifndef __cplusplus
/* #undef inline */
#endif

/* Define to __typeof__ if your compiler spells it that way. */
/* #undef typeof */
25 changes: 25 additions & 0 deletions external/libogg-1.3.2/android/ogg/config_types.h
@@ -0,0 +1,25 @@
#ifndef __CONFIG_TYPES_H__
#define __CONFIG_TYPES_H__

/* these are filled in by configure */
#define INCLUDE_INTTYPES_H 1
#define INCLUDE_STDINT_H 1
#define INCLUDE_SYS_TYPES_H 1

#if INCLUDE_INTTYPES_H
# include <inttypes.h>
#endif
#if INCLUDE_STDINT_H
# include <stdint.h>
#endif
#if INCLUDE_SYS_TYPES_H
# include <sys/types.h>
#endif

typedef int16_t ogg_int16_t;
typedef uint16_t ogg_uint16_t;
typedef int32_t ogg_int32_t;
typedef uint32_t ogg_uint32_t;
typedef int64_t ogg_int64_t;

#endif

0 comments on commit f23f283

Please sign in to comment.