From 06296e80c975a189744a13c7fbfeb4dd4986b330 Mon Sep 17 00:00:00 2001 From: DRC Date: Mon, 5 May 2014 20:55:24 +0000 Subject: [PATCH] First pass at an Android makefile git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1265 632fc199-4ca6-4c93-a231-07263d6284db --- Android.mk | 276 +++++++++++++++++++++++++++++++++++++++++++ android/jconfig.h | 46 ++++++++ android/jconfigint.h | 2 + 3 files changed, 324 insertions(+) create mode 100644 Android.mk create mode 100644 android/jconfig.h create mode 100644 android/jconfigint.h diff --git a/Android.mk b/Android.mk new file mode 100644 index 0000000..ad4badc --- /dev/null +++ b/Android.mk @@ -0,0 +1,276 @@ +# Android makefile for libjpeg-turbo + +ifneq ($(TARGET_SIMULATOR), true) + +LOCAL_PATH := $(my-dir) +VERSION = 1.3.80 +BUILD := $(shell date +%Y%m%d) + +DEFINES = -DPACKAGE_NAME=\"libjpeg-turbo\" -DVERSION=\"$(VERSION)\" \ + -DBUILD=\"$(BUILD)\" + +# Default configuration (all of these can be overridden on the command line) +CFLAGS = -O3 +ifeq ($(strip $(TARGET_ARCH)), arm) +ifeq ($(TARGET_ARCH_VARIANT), armv7-a-neon) +WITH_SIMD = 1 +SIMD_ARCH = arm +endif +ifneq ($(findstring armv7-a, $(TARGET_ARCH_VARIANT)),) +CFLAGS += -fstrict-aliasing +endif +endif +WITH_TURBOJPEG = 1 +WITH_ARITH_ENC = 1 +WITH_ARITH_DEC = 1 +JPEG_LIB_VERSION = 62 +WITH_JPEG7 = 0 +WITH_JPEG8 = 0 +WITH_MEM_SRCDST = 1 + +# Define C macros based on configuration +ifeq ($(WITH_SIMD), 1) +DEFINES += -DWITH_SIMD +endif + +ifeq ($(WITH_ARITH_ENC), 1) +WITH_ARITH = 1 +DEFINES += -DC_ARITH_CODING_SUPPORTED +endif +ifeq ($(WITH_ARITH_DEC), 1) +WITH_ARITH = 1 +DEFINES += -DD_ARITH_CODING_SUPPORTED +endif + +ifeq ($(WITH_JPEG7), 1) +JPEG_LIB_VERSION = 70 +endif +ifeq ($(WITH_JPEG8), 1) +JPEG_LIB_VERSION = 80 +endif +DEFINES += -DJPEG_LIB_VERSION=$(JPEG_LIB_VERSION) + +ifeq ($(WITH_MEM_SRCDST), 1) +DEFINES += -DMEM_SRCDST_SUPPORTED +endif + +################################################## +### SIMD ### +################################################## + +include $(CLEAR_VARS) + +ifeq ($(WITH_SIMD), 1) + +ifeq ($(SIMD_ARCH), arm) +LOCAL_SRC_FILES = simd/jsimd_arm_neon.S simd/jsimd_arm.c +LOCAL_ARM_NEON := true +endif + +LOCAL_CFLAGS := $(CFLAGS) $(DEFINES) + +LOCAL_C_INCLUDES := $(LOCAL_PATH)/simd $(LOCAL_PATH)/android + +LOCAL_MODULE = simd + +include $(BUILD_STATIC_LIBRARY) + +endif # WITH_SIMD + +################################################## +### libjpeg ### +################################################## + +include $(CLEAR_VARS) + +LIBJPEG_SRC_FILES = jcapimin.c jcapistd.c jccoefct.c jccolor.c jcdctmgr.c \ + jchuff.c jcinit.c jcmainct.c jcmarker.c jcmaster.c jcomapi.c jcparam.c \ + jcphuff.c jcprepct.c jcsample.c jctrans.c jdapimin.c jdapistd.c jdatadst.c \ + jdatasrc.c jdcoefct.c jdcolor.c jddctmgr.c jdhuff.c jdinput.c jdmainct.c \ + jdmarker.c jdmaster.c jdmerge.c jdphuff.c jdpostct.c jdsample.c jdtrans.c \ + jerror.c jfdctflt.c jfdctfst.c jfdctint.c jidctflt.c jidctfst.c jidctint.c \ + jidctred.c jquant1.c jquant2.c jutils.c jmemmgr.c jmemnobs.c + +ifneq ($(WITH_SIMD), 1) +LIBJPEG_SRC_FILES += jsimd_none.c +endif + +ifeq ($(WITH_ARITH), 1) +LIBJPEG_SRC_FILES += jaricom.c +endif +ifeq ($(WITH_ARITH_ENC), 1) +LIBJPEG_SRC_FILES += jcarith.c +endif +ifeq ($(WITH_ARITH_DEC), 1) +LIBJPEG_SRC_FILES += jdarith.c +endif + +LOCAL_SRC_FILES := ${LIBJPEG_SRC_FILES} + +LOCAL_CFLAGS := $(CFLAGS) $(DEFINES) + +LOCAL_C_INCLUDES := $(LOCAL_PATH) $(LOCAL_PATH)/android + +ifeq ($(WITH_SIMD), 1) +LOCAL_STATIC_LIBRARIES = libsimd +endif +LOCAL_MODULE = jpeg +include $(BUILD_SHARED_LIBRARY) + +################################################## +### libturbojpeg ### +################################################## + +ifeq ($(WITH_TURBOJPEG), 1) + +include $(CLEAR_VARS) + +LOCAL_SRC_FILES := ${LIBJPEG_SRC_FILES} turbojpeg.c transupp.c jdatadst-tj.c \ + jdatasrc-tj.c turbojpeg-jni.c + +LOCAL_CFLAGS := $(CFLAGS) $(DEFINES) + +LOCAL_C_INCLUDES := $(LOCAL_PATH) $(LOCAL_PATH)/android + +ifeq ($(WITH_SIMD), 1) +LOCAL_STATIC_LIBRARIES = libsimd +endif +LOCAL_MODULE = turbojpeg +include $(BUILD_SHARED_LIBRARY) + +endif # WITH_TURBOJPEG + +###################################################### +### cjpeg ### +###################################################### + +include $(CLEAR_VARS) + +LOCAL_SRC_FILES = cdjpeg.c cjpeg.c rdbmp.c rdgif.c rdppm.c rdswitch.c \ + rdtarga.c + +LOCAL_CFLAGS := $(CFLAGS) $(DEFINES) -DBMP_SUPPORTED -DGIF_SUPPORTED \ + -DPPM_SUPPORTED -DTARGA_SUPPORTED + +LOCAL_C_INCLUDES := $(LOCAL_PATH) $(LOCAL_PATH)/android + +LOCAL_SHARED_LIBRARIES = libjpeg +LOCAL_MODULE = cjpeg +include $(BUILD_EXECUTABLE) + +###################################################### +### djpeg ### +###################################################### + +include $(CLEAR_VARS) + +LOCAL_SRC_FILES = cdjpeg.c djpeg.c rdcolmap.c rdswitch.c wrbmp.c wrgif.c \ + wrppm.c wrtarga.c + +LOCAL_CFLAGS := $(CFLAGS) $(DEFINES) -DBMP_SUPPORTED -DGIF_SUPPORTED \ + -DPPM_SUPPORTED -DTARGA_SUPPORTED + +LOCAL_SHARED_LIBRARIES = libjpeg + +LOCAL_C_INCLUDES := $(LOCAL_PATH) $(LOCAL_PATH)/android + +LOCAL_SHARED_LIBRARIES = libjpeg +LOCAL_MODULE = djpeg +include $(BUILD_EXECUTABLE) + +###################################################### +### jpegtran ### +###################################################### + +include $(CLEAR_VARS) + +LOCAL_SRC_FILES = jpegtran.c rdswitch.c cdjpeg.c transupp.c + +LOCAL_CFLAGS := $(CFLAGS) $(DEFINES) + +LOCAL_C_INCLUDES := $(LOCAL_PATH) $(LOCAL_PATH)/android + +LOCAL_SHARED_LIBRARIES = libjpeg +LOCAL_MODULE = jpegtran +include $(BUILD_EXECUTABLE) + +###################################################### +### rdjpgcom ### +###################################################### + +include $(CLEAR_VARS) + +LOCAL_SRC_FILES = rdjpgcom.c + +LOCAL_CFLAGS := $(CFLAGS) $(DEFINES) + +LOCAL_C_INCLUDES := $(LOCAL_PATH) $(LOCAL_PATH)/android + +LOCAL_SHARED_LIBRARIES = libjpeg +LOCAL_MODULE = rdjpgcom +include $(BUILD_EXECUTABLE) + +###################################################### +### wrjpgcom ### +###################################################### + +include $(CLEAR_VARS) + +LOCAL_SRC_FILES = wrjpgcom.c + +LOCAL_CFLAGS := $(CFLAGS) $(DEFINES) + +LOCAL_C_INCLUDES := $(LOCAL_PATH) $(LOCAL_PATH)/android + +LOCAL_SHARED_LIBRARIES = libjpeg +LOCAL_MODULE = wrjpgcom +include $(BUILD_EXECUTABLE) + +###################################################### +### tjunittest ### +###################################################### + +ifeq ($(WITH_TURBOJPEG), 1) + +include $(CLEAR_VARS) + +LOCAL_SRC_FILES = tjunittest.c tjutil.c + +LOCAL_CFLAGS := $(CFLAGS) $(DEFINES) + +LOCAL_C_INCLUDES := $(LOCAL_PATH) $(LOCAL_PATH)/android + +LOCAL_SHARED_LIBRARIES = libturbojpeg +LOCAL_MODULE = tjunittest +include $(BUILD_EXECUTABLE) + +###################################################### +### tjbench ### +###################################################### + +include $(CLEAR_VARS) + +LOCAL_SRC_FILES = tjbench.c bmp.c tjutil.c rdbmp.c rdppm.c wrbmp.c wrppm.c + +LOCAL_CFLAGS = $(DEFINES) -DBMP_SUPPORTED -DPPM_SUPPORTED + +LOCAL_C_INCLUDES := $(LOCAL_PATH) $(LOCAL_PATH)/android + +LOCAL_SHARED_LIBRARIES = libturbojpeg +LOCAL_MODULE = tjbench +include $(BUILD_EXECUTABLE) + +endif # WITH_TURBOJPEG + +###################################################### +### md5cmp ### +###################################################### + +include $(CLEAR_VARS) + +LOCAL_SRC_FILES = md5/md5cmp.c md5/md5.c md5/md5hl.c + +LOCAL_MODULE = md5cmp +include $(BUILD_EXECUTABLE) + +endif # TARGET_SIMULATOR != true diff --git a/android/jconfig.h b/android/jconfig.h new file mode 100644 index 0000000..568d58a --- /dev/null +++ b/android/jconfig.h @@ -0,0 +1,46 @@ +/* Define to 1 if you have the header file. */ +#define HAVE_LOCALE_H 1 + +/* Define if your compiler supports prototypes */ +#define HAVE_PROTOTYPES 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDDEF_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if the system has the type `unsigned char'. */ +#define HAVE_UNSIGNED_CHAR 1 + +/* Define to 1 if the system has the type `unsigned short'. */ +#define HAVE_UNSIGNED_SHORT 1 + +/* Compiler does not support pointers to undefined structures. */ +/* #undef INCOMPLETE_TYPES_BROKEN */ + +/* Define if you have BSD-like bzero and bcopy in rather than + memset/memcpy in . */ +/* #undef NEED_BSD_STRINGS */ + +/* Define if linker requires that the first 15 characters of global names be + unique. */ +/* #undef NEED_SHORT_EXTERNAL_NAMES */ + +/* Define if you need to include to get size_t. */ +#define NEED_SYS_TYPES_H 1 + +/* Define if your (broken) compiler shifts signed values as if they were + unsigned. */ +/* #undef RIGHT_SHIFT_IS_UNSIGNED */ + +/* Define to 1 if type `char' is unsigned and you are not using gcc. */ +#ifndef __CHAR_UNSIGNED__ +/* # undef __CHAR_UNSIGNED__ */ +#endif + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ + +/* Define to `unsigned int' if does not define. */ +/* #undef size_t */ diff --git a/android/jconfigint.h b/android/jconfigint.h new file mode 100644 index 0000000..a54554e --- /dev/null +++ b/android/jconfigint.h @@ -0,0 +1,2 @@ +/* How to obtain function inlining. */ +#define INLINE inline __attribute__((always_inline)) -- 2.40.0