summaryrefslogtreecommitdiff
path: root/Android.mk
blob: fb58a29d8d89e50f74f83cc16fff12331c668dd0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)

GSTREAMER_AGGREGATE_TOP := $(abspath $(LOCAL_PATH))

ifneq ($(SYSROOT),)
NDK_BUILD := true
else
NDK_BUILD := false
endif

ifeq ($(GLIB_TOP),)
GLIB_TOP := $(GSTREAMER_AGGREGATE_TOP)/glib
endif

ifeq ($(gstreamer_TOP),)
gstreamer_TOP := $(GSTREAMER_AGGREGATE_TOP)/gstreamer
endif

ifeq ($(GST_PLUGINS_BASE_TOP),)
GST_PLUGINS_BASE_TOP := $(GSTREAMER_AGGREGATE_TOP)/gst-plugins-base
endif

ifeq ($(GST_PLUGINS_GOOD_TOP),)
GST_PLUGINS_GOOD_TOP := $(GSTREAMER_AGGREGATE_TOP)/gst-plugins-good
endif

ifeq ($(GST_PLUGINS_BAD_TOP),)
GST_PLUGINS_BAD_TOP := $(GSTREAMER_AGGREGATE_TOP)/gst-plugins-bad
endif

ifeq ($(GNONLIN_TOP),)
GNONLIN_TOP := $(GSTREAMER_AGGREGATE_TOP)/gnonlin
endif

ifeq ($(GES_TOP),)
GES_TOP := $(GSTREAMER_AGGREGATE_TOP)/gst-editing-services
endif

CONFIGURE_CC := $(TARGET_CC)
CONFIGURE_INCLUDES :=
CONFIGURE_LDFLAGS := -lc -ldl

ifeq ($(NDK_BUILD),true)
CONFIGURE_CFLAGS := \
    -nostdlib -Bdynamic \
    -Wl,-dynamic-linker,/system/bin/linker \
    -Wl,--gc-sections \
    -Wl,-z,nocopyreloc \
    $(call host-path,\
        $(TARGET_CRTBEGIN_DYNAMIC_O) \
        $(PRIVATE_OBJECTS)) \
    $(call link-whole-archives,$(PRIVATE_WHOLE_STATIC_LIBRARIES))\
    $(call host-path,\
        $(PRIVATE_STATIC_LIBRARIES) \
        $(TARGET_LIBGCC) \
        $(PRIVATE_SHARED_LIBRARIES)) \
    $(PRIVATE_LDFLAGS) \
    $(PRIVATE_LDLIBS) \
    $(call host-path,\
        $(TARGET_CRTEND_O)) \
	$(CONFIGURE_INCLUDES)
CONFIGURE_LDFLAGS += -L$(SYSROOT)/usr/lib -L$(TARGET_OUT)
CONFIGURE_INCLUDES += -I$(SYSROOT)/usr/include \
		-I$(GSTREAMER_AGGREGATE_TOP)/libid3tag \
		-I$(GSTREAMER_AGGREGATE_TOP)/libmad \
		-I$(GSTREAMER_AGGREGATE_TOP)/faad/include
CONFIGURE_CPP := $(TOOLCHAIN_PREFIX)cpp
LIB := $(SYSROOT)/usr/lib
else
LIB := $(TARGET_OUT_SHARED_LIBRARIES)

CONFIGURE_CC := $(patsubst %,$(PWD)/%,$(TARGET_CC))
CONFIGURE_LDFLAGS += -L$(PWD)/$(TARGET_OUT_INTERMEDIATE_LIBRARIES)

CONFIGURE_CFLAGS := \
    -nostdlib -Bdynamic \
    -Wl,-dynamic-linker,/system/bin/linker \
    -Wl,--gc-sections \
    -Wl,-z,nocopyreloc
CONFIGURE_LDFLAGS += \
    $(PWD)/$(TARGET_CRTBEGIN_DYNAMIC_O) \
    $(call link-whole-archives,$(PRIVATE_WHOLE_STATIC_LIBRARIES))\
    $(PRIVATE_STATIC_LIBRARIES) \
    $(PWD)/$(TARGET_LIBGCC) \
    $(PRIVATE_SHARED_LIBRARIES) \
		$(PWD)/$(TARGET_CRTEND_O)


CONFIGURE_CPP := $(PWD)/$(TARGET_TOOLS_PREFIX)cpp

CONFIGURE_INCLUDES += \
		$(foreach incdir, $(realpath $(C_INCLUDES) $(TARGET_C_INCLUDES)), \
				-I$(incdir)) \
		-I$(abspath $(TOP)/external/zlib) \
		-I$(GSTREAMER_AGGREGATE_TOP)/libid3tag \
		-I$(GSTREAMER_AGGREGATE_TOP)/libmad \
		-I$(GSTREAMER_AGGREGATE_TOP)/faad/include
endif

CONFIGURE_CPPFLAGS := \
	$(CONFIGURE_INCLUDES)

CONFIGURE_PKG_CONFIG_LIBDIR := $(GLIB_TOP):$(gstreamer_TOP)/pkgconfig:$(GST_PLUGINS_BASE_TOP)/pkgconfig:$(GST_PLUGINS_GOOD_TOP)/pkgconfig:$(GST_PLUGINS_BAD_TOP)/pkgconfig:$(GSTREAMER_AGGREGATE_TOP)/x264

PKG_CONFIG := PKG_CONFIG_LIBDIR=$(CONFIGURE_PKG_CONFIG_LIBDIR) PKG_CONFIG_TOP_BUILD_DIR="/" pkg-config
GST_CFLAGS := \
	-DD_GNU_SOURCE					\
	-DGST_DISABLE_DEPRECATED			\
	-DHAVE_CONFIG_H					\
	-I$(gstreamer_TOP)				\
	$(shell $(PKG_CONFIG) gstreamer --cflags)

CONFIGURE := autogen.sh

.SECONDARYEXPANSION:
CONFIGURE_TARGETS :=

#only in this order for reference... this is optimal build order
include $(GSTREAMER_AGGREGATE_TOP)/x264/Android.mk
include $(GSTREAMER_AGGREGATE_TOP)/faad/Android.mk
include $(GSTREAMER_AGGREGATE_TOP)/ogg/Android.mk
include $(GSTREAMER_AGGREGATE_TOP)/libmad/Android.mk
include $(GSTREAMER_AGGREGATE_TOP)/libid3tag/Android.mk
include $(GSTREAMER_AGGREGATE_TOP)/glib/Android.mk
include $(GSTREAMER_AGGREGATE_TOP)/gstreamer/Android.mk
include $(GSTREAMER_AGGREGATE_TOP)/gst-plugins-base/Android.mk
include $(GSTREAMER_AGGREGATE_TOP)/gst-plugins-good/Android.mk
include $(GSTREAMER_AGGREGATE_TOP)/gnonlin/Android.mk
include $(GSTREAMER_AGGREGATE_TOP)/gst-editing-services/Android.mk
include $(GSTREAMER_AGGREGATE_TOP)/gst-openmax/Android.mk
include $(GSTREAMER_AGGREGATE_TOP)/gst-plugins-bad/Android.mk
ifeq ($(NDK_BUILD),false)
include $(GSTREAMER_AGGREGATE_TOP)/gst-android/Android.mk
endif
include $(GSTREAMER_AGGREGATE_TOP)/gst-plugins-ugly/Android.mk

TARGETS:
	@echo $(CONFIGURE_TARGETS)

#has a funny gstreamer_TOP of its own, fix that
#include $(GSTREAMER_AGGREGATE_TOP)/gst-android/Android.mk

.PHONY: gstreamer-aggregate-configure
gstreamer-aggregate-configure: $(TARGET_CRTBEGIN_DYNAMIC_O) $(TARGET_CRTEND_O) $(LIB)/libc.so $(LIB)/libz.so $(CONFIGURE_TARGETS)