It is possible to move the final installation path of a shared library by using LOCAL_MODULE_PATH/LOCAL_UNSTRIPPED_PATH in its module declaration. We do this for example to put certain libraries under /system/lib/egl or /system/lib/hw. However, the Android build system has a small bug where you cannot depend on these shared libraries because it will complain it doesn't find them under /system/lib, the default install location. More precisely, consider libfoo defined as: include $(CLEAR_VARS) LOCAL_MODULE := libfoo LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/egl ... include $(BUILD_SHARED_LIBRARY) Its final binary will be installed to /system/lib/egl/libfoo.so Now, let's write a module that depends on it, as: include $(CLEAR_VARS) LOCAL_MODULE := libbar LOCAL_SHARED_LIBRARIES += libfoo ... include $(BUILD_SHARED_LIBRARY) The build system will complain there is no rule to define the target /system/lib/libfoo.so, but the target should be /system/lib/egl/libfoo.so. A work-around is to define libbar as follows instead: include $(CLEAR_VARS) LOCAL_MODULE := libbar LOCAL_ADDITIONAL_DEPENDENCIES := $(TARGET_OUT_SHARED_LIBRARIES)/egl/libfoo.so ... include $(BUILD_SHARED_LIBRARY) This works if you don't need to link against the library when building your shared library (which is fortunately the case for the GLES emulation libraries). That's essentially what this patch implements under common.mk. We update emugl-set-shared-library-subpath to record that a module has been "moved", and we avoid adding them to the LOCAL_SHARED_LIBRARIES variable of the modules that export it. + Simplify three Android.mk files accordingly. Change-Id: Id15bef5359b0daa8d82bfaa5abf9346f00190ab5
43 lines
1.1 KiB
Makefile
43 lines
1.1 KiB
Makefile
ifneq (false,$(BUILD_EMULATOR_OPENGL_DRIVER))
|
|
|
|
LOCAL_PATH := $(call my-dir)
|
|
|
|
$(call emugl-begin-shared-library,libEGL_emulation)
|
|
$(call emugl-import,libOpenglSystemCommon)
|
|
$(call emugl-set-shared-library-subpath,egl)
|
|
|
|
LOCAL_CFLAGS += -DLOG_TAG=\"EGL_emulation\" -DEGL_EGLEXT_PROTOTYPES -DWITH_GLES2
|
|
|
|
LOCAL_SRC_FILES := \
|
|
eglDisplay.cpp \
|
|
egl.cpp \
|
|
ClientAPIExts.cpp
|
|
|
|
LOCAL_SHARED_LIBRARIES += libdl
|
|
|
|
# Used to access the Bionic private OpenGL TLS slot
|
|
LOCAL_C_INCLUDES += bionic/libc/private
|
|
|
|
$(call emugl-end-module)
|
|
|
|
#### egl.cfg ####
|
|
|
|
# Ensure that this file is only copied to emulator-specific builds.
|
|
# Other builds are device-specific and will provide their own
|
|
# version of this file to point to the appropriate HW EGL libraries.
|
|
#
|
|
ifneq (,$(filter full full_x86 sdk sdk_x86,$(TARGET_PRODUCT)))
|
|
include $(CLEAR_VARS)
|
|
|
|
LOCAL_MODULE := egl.cfg
|
|
LOCAL_SRC_FILES := $(LOCAL_MODULE)
|
|
|
|
LOCAL_MODULE_PATH := $(TARGET_OUT)/lib/egl
|
|
LOCAL_MODULE_TAGS := debug
|
|
LOCAL_MODULE_CLASS := ETC
|
|
|
|
include $(BUILD_PREBUILT)
|
|
endif # TARGET_PRODUCT in 'full sdk full_x86 sdk_x86)
|
|
|
|
endif # BUILD_EMULATOR_OPENGL_DRIVER != false
|