Commit f0f5e22a authored by Thomas Guillem's avatar Thomas Guillem

build: use clang

Since this is the future default toolchain of the Android NDK.
parent f0c307f4
# VLC
/vlc/
/toolchains/
# Android .so
/android-libs/**/*.so
......
This diff is collapsed.
......@@ -7,7 +7,7 @@ android {
sourceSets {
main {
jni.srcDirs = [] // Prevent gradle from building native code with ndk; we have our own Makefile for it.
jniLibs.srcDir 'jni/libs' // Where generated .so files are placed.
jniLibs.srcDirs = [ 'jni/libs', 'private_libs/libs' ] // Where generated .so files are placed.
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
......
LOCAL_PATH := $(call my-dir)
ANDROID_PRIVATE_LIBDIR := $(LOCAL_PATH)/../../android-libs
include $(CLEAR_VARS)
LOCAL_MODULE := libvlc
......@@ -7,8 +6,9 @@ ARCH=$(APP_ABI)
ifeq ($(ARCH), armeabi)
LOCAL_ARM_MODE := arm
endif
LOCAL_SRC_FILES += libvlcjni-modules.c libvlcjni-symbols.c
LOCAL_LDLIBS := -L$(VLC_CONTRIB)/lib \
LOCAL_SRC_FILES += libvlcjni-modules.c libvlcjni-symbols.c dummy.cpp
LOCAL_LDLIBS := \
-L$(VLC_CONTRIB)/lib \
$(VLC_MODULES) \
$(VLC_BUILD_DIR)/lib/.libs/libvlc.a \
$(VLC_BUILD_DIR)/src/.libs/libvlccore.a \
......@@ -19,7 +19,7 @@ LOCAL_LDLIBS := -L$(VLC_CONTRIB)/lib \
-la52 -ljpeg \
-lavcodec -lebml \
-llua \
$(EXTRA_LDFLAGS)
$(VLC_LDFLAGS)
ifeq ($(HAVE_LIBCOMPAT), 1)
LOCAL_SHARED_LIBRARIES:= libcompat.7
......@@ -42,7 +42,7 @@ LOCAL_C_INCLUDES := $(VLC_SRC_DIR)/include
ARCH=$(APP_ABI)
LOCAL_CFLAGS := -std=gnu99
LOCAL_CFLAGS := -std=c11
ifeq ($(ARCH), armeabi)
LOCAL_CFLAGS += -DHAVE_ARMEABI
# Needed by ARMv6 Thumb1 (the System Control coprocessor/CP15 is mandatory on ARMv6)
......@@ -66,100 +66,3 @@ include $(CLEAR_VARS)
LOCAL_MODULE := libcompat.7
include $(BUILD_SHARED_LIBRARY)
endif
################
# PRIVATE LIBS #
################
ANDROID_PRIVATE_LIBS=$(ANDROID_PRIVATE_LIBDIR)/$(TARGET_TUPLE)/libstagefright.so \
$(ANDROID_PRIVATE_LIBDIR)/$(TARGET_TUPLE)/libmedia.so \
$(ANDROID_PRIVATE_LIBDIR)/$(TARGET_TUPLE)/libutils.so \
$(ANDROID_PRIVATE_LIBDIR)/$(TARGET_TUPLE)/libcutils.so \
$(ANDROID_PRIVATE_LIBDIR)/$(TARGET_TUPLE)/libbinder.so \
$(ANDROID_PRIVATE_LIBDIR)/$(TARGET_TUPLE)/libui.so \
$(ANDROID_PRIVATE_LIBDIR)/$(TARGET_TUPLE)/libhardware.so
$(ANDROID_PRIVATE_LIBDIR)/$(TARGET_TUPLE)/%.so: $(ANDROID_PRIVATE_LIBDIR)/%.c
mkdir -p $(ANDROID_PRIVATE_LIBDIR)/$(TARGET_TUPLE)
$(GEN)$(TARGET_TUPLE)-gcc $< -shared -o $@ --sysroot=$(SYSROOT)
$(ANDROID_PRIVATE_LIBDIR)/%.c: $(ANDROID_PRIVATE_LIBDIR)/%.symbols
$(VERBOSE)rm -f $@ && touch $@
$(GEN)for s in `cat $<`; do echo "void $$s() {}" >> $@; done
###########
# libiOMX #
###########
LIBIOMX_INCLUDES_COMMON := $(VLC_SRC_DIR)/modules/codec/omxil
# no hwbuffer for gingerbread
LIBIOMX_INCLUDES_10 := $(LIBIOMX_INCLUDES_COMMON) \
$(ANDROID_SYS_HEADERS)/10/frameworks/base/include \
$(ANDROID_SYS_HEADERS)/10/system/core/include \
$(ANDROID_SYS_HEADERS)/10/hardware/libhardware/include
LIBIOMX_INCLUDES_13 := $(LIBIOMX_INCLUDES_COMMON) \
$(ANDROID_SYS_HEADERS)/13/frameworks/base/include \
$(ANDROID_SYS_HEADERS)/13/frameworks/base/native/include \
$(ANDROID_SYS_HEADERS)/13/system/core/include \
$(ANDROID_SYS_HEADERS)/13/hardware/libhardware/include
LIBIOMX_INCLUDES_14 := $(LIBIOMX_INCLUDES_COMMON) \
$(ANDROID_SYS_HEADERS)/14/frameworks/base/include \
$(ANDROID_SYS_HEADERS)/14/frameworks/base/native/include \
$(ANDROID_SYS_HEADERS)/14/system/core/include \
$(ANDROID_SYS_HEADERS)/14/hardware/libhardware/include
LIBIOMX_INCLUDES_18 := $(LIBIOMX_INCLUDES_COMMON) \
$(ANDROID_SYS_HEADERS)/18/frameworks/native/include \
$(ANDROID_SYS_HEADERS)/18/frameworks/av/include \
$(ANDROID_SYS_HEADERS)/18/system/core/include \
$(ANDROID_SYS_HEADERS)/18/hardware/libhardware/include
LIBIOMX_INCLUDES_19 := $(LIBIOMX_INCLUDES_COMMON) \
$(ANDROID_SYS_HEADERS)/19/frameworks/native/include \
$(ANDROID_SYS_HEADERS)/19/frameworks/av/include \
$(ANDROID_SYS_HEADERS)/19/system/core/include \
$(ANDROID_SYS_HEADERS)/19/hardware/libhardware/include
LIBIOMX_INCLUDES_21 := $(LIBIOMX_INCLUDES_COMMON) \
$(ANDROID_SYS_HEADERS)/21/frameworks/native/include \
$(ANDROID_SYS_HEADERS)/21/frameworks/av/include \
$(ANDROID_SYS_HEADERS)/21/system/core/include \
$(ANDROID_SYS_HEADERS)/21/hardware/libhardware/include
define build_iomx
include $(CLEAR_VARS)
LOCAL_MODULE := $(1)
LOCAL_SRC_FILES := $(VLC_SRC_DIR)/modules/codec/omxil/iomx.cpp
LOCAL_C_INCLUDES := $(LIBIOMX_INCLUDES_$(2))
LOCAL_LDLIBS := -L$(ANDROID_PRIVATE_LIBDIR)/$(TARGET_TUPLE) -lgcc -lstagefright -lmedia -lutils -lbinder -llog -lcutils -lui
LOCAL_CFLAGS := -Wno-psabi -DANDROID_API=$(2)
$(TARGET_OUT)/$(1).so: $(ANDROID_PRIVATE_LIBS)
include $(BUILD_SHARED_LIBRARY)
endef
# call build_iomx for each libiomx-* in LIBIOMX_LIBS
$(foreach IOMX_MODULE, $(LIBIOMX_LIBS), \
$(eval $(call build_iomx,$(IOMX_MODULE),$(subst libiomx.,,$(IOMX_MODULE)))))
#######
# ANW #
#######
LIBANW_SRC_FILES_COMMON += $(VLC_SRC_DIR)/modules/video_output/android/nativewindowpriv.c
define build_anw
include $(CLEAR_VARS)
LOCAL_MODULE := $(1)
LOCAL_SRC_FILES := $(LIBANW_SRC_FILES_COMMON)
LOCAL_C_INCLUDES := $(LIBIOMX_INCLUDES_$(2))
LOCAL_LDLIBS := -L$(ANDROID_PRIVATE_LIBDIR)/$(TARGET_TUPLE) -llog -lhardware
LOCAL_CFLAGS := $(LIBIOMX_CFLAGS_COMMON) -DANDROID_API=$(2)
$(TARGET_OUT)/$(1).so: $(ANDROID_PRIVATE_LIBS)
include $(BUILD_SHARED_LIBRARY)
endef
$(foreach ANW_MODULE,$(LIBANW_LIBS), \
$(eval $(call build_anw,$(ANW_MODULE),$(subst libanw.,,$(ANW_MODULE)))))
/* Force ndk build system to link with c++_shared and install it */
LOCAL_PATH := $(call my-dir)
ANDROID_PRIVATE_LIBDIR := $(LOCAL_PATH)/../../android-libs
include $(CLEAR_VARS)
ANDROID_PRIVATE_LIBS=$(ANDROID_PRIVATE_LIBDIR)/$(TARGET_TUPLE)/libstagefright.so \
$(ANDROID_PRIVATE_LIBDIR)/$(TARGET_TUPLE)/libmedia.so \
$(ANDROID_PRIVATE_LIBDIR)/$(TARGET_TUPLE)/libutils.so \
$(ANDROID_PRIVATE_LIBDIR)/$(TARGET_TUPLE)/libcutils.so \
$(ANDROID_PRIVATE_LIBDIR)/$(TARGET_TUPLE)/libbinder.so \
$(ANDROID_PRIVATE_LIBDIR)/$(TARGET_TUPLE)/libui.so \
$(ANDROID_PRIVATE_LIBDIR)/$(TARGET_TUPLE)/libhardware.so
$(ANDROID_PRIVATE_LIBDIR)/$(TARGET_TUPLE)/%.so: $(ANDROID_PRIVATE_LIBDIR)/%.c
mkdir -p $(ANDROID_PRIVATE_LIBDIR)/$(TARGET_TUPLE)
$(GEN)clang $< -shared -o $@
$(ANDROID_PRIVATE_LIBDIR)/%.c: $(ANDROID_PRIVATE_LIBDIR)/%.symbols
$(VERBOSE)rm -f $@ && touch $@
$(GEN)for s in `cat $<`; do echo "void $$s() {}" >> $@; done
###########
# libiOMX #
###########
LIBIOMX_INCLUDES_COMMON := $(VLC_SRC_DIR)/modules/codec/omxil
# no hwbuffer for gingerbread
LIBIOMX_INCLUDES_10 := $(LIBIOMX_INCLUDES_COMMON) \
$(ANDROID_SYS_HEADERS)/10/frameworks/base/include \
$(ANDROID_SYS_HEADERS)/10/system/core/include \
$(ANDROID_SYS_HEADERS)/10/hardware/libhardware/include
LIBIOMX_INCLUDES_13 := $(LIBIOMX_INCLUDES_COMMON) \
$(ANDROID_SYS_HEADERS)/13/frameworks/base/include \
$(ANDROID_SYS_HEADERS)/13/frameworks/base/native/include \
$(ANDROID_SYS_HEADERS)/13/system/core/include \
$(ANDROID_SYS_HEADERS)/13/hardware/libhardware/include
LIBIOMX_INCLUDES_14 := $(LIBIOMX_INCLUDES_COMMON) \
$(ANDROID_SYS_HEADERS)/14/frameworks/base/include \
$(ANDROID_SYS_HEADERS)/14/frameworks/base/native/include \
$(ANDROID_SYS_HEADERS)/14/system/core/include \
$(ANDROID_SYS_HEADERS)/14/hardware/libhardware/include
LIBIOMX_INCLUDES_18 := $(LIBIOMX_INCLUDES_COMMON) \
$(ANDROID_SYS_HEADERS)/18/frameworks/native/include \
$(ANDROID_SYS_HEADERS)/18/frameworks/av/include \
$(ANDROID_SYS_HEADERS)/18/system/core/include \
$(ANDROID_SYS_HEADERS)/18/hardware/libhardware/include
LIBIOMX_INCLUDES_19 := $(LIBIOMX_INCLUDES_COMMON) \
$(ANDROID_SYS_HEADERS)/19/frameworks/native/include \
$(ANDROID_SYS_HEADERS)/19/frameworks/av/include \
$(ANDROID_SYS_HEADERS)/19/system/core/include \
$(ANDROID_SYS_HEADERS)/19/hardware/libhardware/include
LIBIOMX_INCLUDES_21 := $(LIBIOMX_INCLUDES_COMMON) \
$(ANDROID_SYS_HEADERS)/21/frameworks/native/include \
$(ANDROID_SYS_HEADERS)/21/frameworks/av/include \
$(ANDROID_SYS_HEADERS)/21/system/core/include \
$(ANDROID_SYS_HEADERS)/21/hardware/libhardware/include
define build_iomx
include $(CLEAR_VARS)
LOCAL_MODULE := $(1)
LOCAL_SRC_FILES := $(VLC_SRC_DIR)/modules/codec/omxil/iomx.cpp
LOCAL_C_INCLUDES := $(LIBIOMX_INCLUDES_$(2))
LOCAL_LDLIBS := -L$(ANDROID_PRIVATE_LIBDIR)/$(TARGET_TUPLE) -lgcc -lstagefright -lmedia -lutils -lbinder -llog -lcutils -lui
LOCAL_CFLAGS := -Wno-psabi -DANDROID_API=$(2)
$(TARGET_OUT)/$(1).so: $(ANDROID_PRIVATE_LIBS)
include $(BUILD_SHARED_LIBRARY)
endef
# call build_iomx for each libiomx-* in LIBIOMX_LIBS
$(foreach IOMX_MODULE, $(LIBIOMX_LIBS), \
$(eval $(call build_iomx,$(IOMX_MODULE),$(subst libiomx.,,$(IOMX_MODULE)))))
#######
# ANW #
#######
LIBANW_SRC_FILES_COMMON += $(VLC_SRC_DIR)/modules/video_output/android/nativewindowpriv.c
define build_anw
include $(CLEAR_VARS)
LOCAL_MODULE := $(1)
LOCAL_SRC_FILES := $(LIBANW_SRC_FILES_COMMON)
LOCAL_C_INCLUDES := $(LIBIOMX_INCLUDES_$(2))
LOCAL_LDLIBS := -L$(ANDROID_PRIVATE_LIBDIR)/$(TARGET_TUPLE) -llog -lhardware
LOCAL_CFLAGS := $(LIBIOMX_CFLAGS_COMMON) -DANDROID_API=$(2)
$(TARGET_OUT)/$(1).so: $(ANDROID_PRIVATE_LIBS)
include $(BUILD_SHARED_LIBRARY)
endef
$(foreach ANW_MODULE,$(LIBANW_LIBS), \
$(eval $(call build_anw,$(ANW_MODULE),$(subst libanw.,,$(ANW_MODULE)))))
......@@ -153,6 +153,7 @@ public class LibVLC extends VLCObject<LibVLC.Event> {
return;
sLoaded = true;
System.loadLibrary("c++_shared");
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD_MR1) {
try {
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.HONEYCOMB_MR1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment