-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathAndroid.mk
190 lines (149 loc) · 5.38 KB
/
Android.mk
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
LOCAL_PATH := $(call my-dir)
# $(1): module name; required
# $(2): module stem name if non-empty
# $(3): source file name
# $(4): relative install dir
# $(5): create symbolic links
# $(6): depend modules
define define-redroid-prebuilt-lib
include $$(CLEAR_VARS)
LOCAL_MODULE := $1
ifneq ($2,)
LOCAL_INSTALLED_MODULE_STEM := $2
endif
ifneq ($3,)
src := $3
else
src := $1
endif
LOCAL_MODULE_CLASS := SHARED_LIBRARIES
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES_$$(TARGET_ARCH) := prebuilts/$$(TARGET_ARCH)/lib/$$(src)
ifneq ($$(TARGET_2ND_ARCH),)
LOCAL_SRC_FILES_$$(TARGET_2ND_ARCH) := prebuilts/$$(TARGET_2ND_ARCH)/lib/$$(src)
endif
#LOCAL_STRIP_MODULE := false
LOCAL_MODULE_SUFFIX := .so
LOCAL_MODULE_RELATIVE_PATH := $4
LOCAL_MULTILIB := both
LOCAL_PROPRIETARY_MODULE := true
LOCAL_MODULE_SYMLINKS := $5
LOCAL_CHECK_ELF_FILES := false
LOCAL_REQUIRED_MODULES := $6
include $$(BUILD_PREBUILT)
endef
# $(1): module name; required
# $(2): module stem name if non-empty
# $(3): source file name
# $(4): relative install dir
# $(5): create symbolic links
# $(6): depend modules
define define-redroid-prebuilt-etc
include $$(CLEAR_VARS)
LOCAL_MODULE := $1
ifneq ($2,)
LOCAL_INSTALLED_MODULE_STEM := $2
endif
ifneq ($3,)
src := $3
else
src := $1
endif
LOCAL_MODULE_CLASS := ETC
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := prebuilts/$$(TARGET_ARCH)/share/$$(src)
LOCAL_MODULE_RELATIVE_PATH := $4
LOCAL_PROPRIETARY_MODULE := true
LOCAL_MODULE_SYMLINKS := $5
LOCAL_REQUIRED_MODULES := $6
include $$(BUILD_PREBUILT)
endef
# NDK libs
ndk_libs_cxx := libc++_shared
libs := $(ndk_libs_cxx)
$(foreach lib,$(libs),\
$(eval $(call define-redroid-prebuilt-lib,$(lib)_p,$(lib).so,$(lib).so)))
# DRI
dri_libs := libgallium_dri
drv_libs := libgallium_drv_video
ifeq ($(TARGET_ARCH),$(filter $(TARGET_ARCH),x86 x86_64))
$(eval $(call define-redroid-prebuilt-lib,libigdgmm,,libigdgmm.so))
drv_libs_intel := i965_drv_video iHD_drv_video
$(foreach lib,$(drv_libs_intel),\
$(eval $(call define-redroid-prebuilt-lib,$(lib),,dri/$(lib).so,dri,,libigdgmm)))
drv_libs += $(drv_libs_intel)
endif
dri_links := $(shell cd $(LOCAL_PATH)/prebuilts/$(TARGET_ARCH)/lib/dri && find * -name '*_dri.so' -type l)
drv_links := $(shell cd $(LOCAL_PATH)/prebuilts/$(TARGET_ARCH)/lib/dri && find * -name '*_drv_video.so' -type l)
$(eval $(call define-redroid-prebuilt-lib,libgallium_dri,,dri/libgallium_dri.so,dri,$(dri_links)))
$(eval $(call define-redroid-prebuilt-lib,libgallium_drv_video,,dri/libgallium_drv_video.so,dri,$(drv_links)))
## amdgpu.ids
$(eval $(call define-redroid-prebuilt-etc,amdgpu.ids.redroid,,libdrm/amdgpu.ids,hwdata))
# libs with SOVERSION
gbm_libs := libgbm.so.1
glapi_libs := libglapi.so.0
libs = $(gbm_libs) $(glapi_libs)
drm_libs := $(shell cd $(LOCAL_PATH)/prebuilts/$(TARGET_ARCH)/lib && find * -name 'libdrm*.so.*' -type l)
libs += $(drm_libs)
$(foreach lib,$(libs),\
$(eval $(call define-redroid-prebuilt-lib,$(lib),$(lib))))
## VA
va_libs := libva.so.2 libva-drm.so.2
$(foreach lib,$(va_libs),\
$(eval $(call define-redroid-prebuilt-lib,$(lib),$(lib),,,,$(drv_libs) $(drm_libs))))
## LLVM
llvm_libs := $(shell cd $(LOCAL_PATH)/prebuilts/$(TARGET_ARCH)/lib && find * -name 'libLLVM*' -type f)
llvm_libs := $(llvm_libs:.so=)
$(foreach lib,$(llvm_libs),\
$(eval $(call define-redroid-prebuilt-lib,$(lib),,$(lib).so)))
# GLES
libs := libEGL_mesa libGLESv1_CM_mesa libGLESv2_mesa
$(foreach lib,$(libs),\
$(eval $(call define-redroid-prebuilt-lib,$(lib),,egl/$(lib).so,egl,,\
$(dri_libs) $(glapi_libs) $(drm_libs))))
# Vulkan
vulkan_libs := $(shell cd $(LOCAL_PATH)/prebuilts/$(TARGET_ARCH)/lib/hw && find * -name 'libvulkan_*.so' -type f)
$(foreach lib,$(vulkan_libs),\
$(eval $(call define-redroid-prebuilt-lib,$(lib:libvulkan_%.so=vulkan.%),,hw/$(lib),hw,,$(ndk_libs_cxx:%=%_p))))
# minigbm gralloc
$(eval $(call define-redroid-prebuilt-lib,gralloc.cros,,hw/gralloc.cros.so,hw))
# gbm gralloc
$(eval $(call define-redroid-prebuilt-lib,gralloc.gbm,,hw/gralloc.gbm.so,hw,,$(gbm_libs)))
# redroid audio
$(eval $(call define-redroid-prebuilt-lib,audio.primary.redroid,,hw/audio.primary.redroid.so,hw))
# redroid hwcomposer
$(eval $(call define-redroid-prebuilt-lib,hwcomposer.redroid,,hw/hwcomposer.redroid.so,hw))
## libOmxCore
$(eval $(call define-redroid-prebuilt-lib,libOmxCore,,libOmxCore.so, , ,$(va_libs) ))
## libevdev
evdev_libs := libevdev.so.2
$(foreach lib,$(evdev_libs),\
$(eval $(call define-redroid-prebuilt-lib,$(lib),$(lib))))
## libvncserver
vncserver_libs := libvncserver
$(eval $(call define-redroid-prebuilt-lib,$(vncserver_libs),,$(vncserver_libs).so))
# $(1): module name (and file name)
# $(2): depended modules
# $(3): init.rc
define define-redroid-prebuilt-bin
include $$(CLEAR_VARS)
LOCAL_MODULE := $1
LOCAL_MODULE_CLASS := EXECUTABLES
LOCAL_SRC_FILES_$$(TARGET_ARCH) := prebuilts/$$(TARGET_ARCH)/bin/$1
#LOCAL_STRIP_MODULE := false
LOCAL_MULTILIB := first
LOCAL_MODULE_TAGS := optional
LOCAL_PROPRIETARY_MODULE := true
LOCAL_CHECK_ELF_FILES := false
LOCAL_REQUIRED_MODULES := $2
ifneq ($3,)
LOCAL_INIT_RC := prebuilts/$$(TARGET_ARCH)/share/$3
endif
include $$(BUILD_PREBUILT)
endef
# vaapi
bins:=avcenc h264encode hevcencode jpegenc vp8enc vp9enc vainfo
$(foreach i,$(bins),\
$(eval $(call define-redroid-prebuilt-bin,$(i),$(va_libs))))
$(eval $(call define-redroid-prebuilt-bin,uinputd,$(evdev_libs),uinputd/uinputd.rc))
$(eval $(call define-redroid-prebuilt-bin,vncserver,$(vncserver_libs),vncserver/vncserver.rc))