install *.so in different paths for their types
Shared libraries are now installed to different directories depending on
their types.
* NDK libraries: /system/lib/ndk (with symlink from /system/lib)
* VNDK libraries: /system/lib/vndk
* VNDK-ext libraries: /system/lib/vndk-ext
* Framework-only libraries: /system/lib
* Vendor-only libraries: /vendor/lib
* Same-process HALs: /vendor/lib/sameprocess
However, if LOCAL_MODULE_PATH is explicitly set, then it is respected,
with a warning message. Module owners are highly encouraged to
investigate the warnings and use alternatives to LOCAL_MODULE_PATH;
combination of LOCAL_[PROPRIETARY|OEM|ODM]_MODULE, LOCAL_MODULE_CLASS
and LOCAL_RELATIVE_PATH will cover most of the cases.
Furthermore, for each shared libraries whose path is changed, a symolic
link from the original path to the new path is *temporarily* generated.
e.g. /system/lib/libbase.so -> vndk/libbase.so. This is
to prevent sudden breakage of the code expecting the lib from the old
path. This symbolic links will eventually be removed before O launch
(b/34917183).
Finally, BOARD_SAME_PROCESS_HAL_DEPS is added. It contains the list of
shared libraries implementing the same-process HALs and its internal sub
libraries. This is designed to be defined in BoardConfig.mk
Bug: 33681361
Test: build & run. Libraries must be in the correct directories.
Symlinks from the old path to the new path must exist.
Change-Id: I46130aac09ae65400fd4d0abbc2e12dddd154fb1
diff --git a/core/definitions.mk b/core/definitions.mk
index 556b41f..1145e97 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -2870,8 +2870,10 @@
# Define a rule to create a symlink to a file.
# $(1): full path to source
-# $(2): source (may be relative)
-# $(3): full path to destination
+# $(2): target of the link
+# $(3): full path of the symlink
+# $(4): (optional) when set to true, $(2) is recognized as a path from the build root and
+# thus -r option is used to link $(3) to $(2). Off by default.
define symlink-file
$(eval $(_symlink-file))
endef
@@ -2883,7 +2885,9 @@
@echo "Symlink: $$@ -> $(2)"
@mkdir -p $(dir $$@)
@rm -rf $$@
- $(hide) ln -sf $(2) $$@
+ $(if $(filter true,$(4)),\
+ $(hide) python -c "import os.path; import os; os.symlink(os.path.relpath('$(2)','$(dir $(3))'), '$$@')",\
+ $(hide) ln -sf $(2) $$@)
endef
###########################################################