Browse Source

common: Implement global symlink creation build-module style.

This build module emits a module with custom shell commands to create
symlinks based on the SONY_SYMLINKS variable.

Change-Id: I6d43d74ff0e1d6e04af88c153400af1ea60e8993
Signed-off-by: MarijnS95 <marijns95@gmail.com>
vintf-enforce
MarijnS95 10 months ago
parent
commit
cc676fd3ee
4 changed files with 30 additions and 10 deletions
  1. +4
    -0
      common.mk
  2. +5
    -10
      hardware/adreno/Android.mk
  3. +18
    -0
      sony_build_symlinks.mk
  4. +3
    -0
      sony_clear_vars.mk

+ 4
- 0
common.mk View File

@@ -29,6 +29,10 @@ PRODUCT_DEFAULT_DEV_CERTIFICATE := vendor/oss/release-keys/testkey
# Common path
COMMON_PATH := device/sony/common

# Build scripts
SONY_CLEAR_VARS := $(COMMON_PATH)/sony_clear_vars.mk
SONY_BUILD_SYMLINKS := $(COMMON_PATH)/sony_build_symlinks.mk

DEVICE_PACKAGE_OVERLAYS += $(COMMON_PATH)/overlay

PRODUCT_ENFORCE_RRO_TARGETS := \

+ 5
- 10
hardware/adreno/Android.mk View File

@@ -2,10 +2,9 @@

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)
include $(SONY_CLEAR_VARS)
LOCAL_MODULE := adreno_symlinks

TARGET_DIRECTORY := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_VENDOR)
LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)

library_names := \
egl \
@@ -27,15 +26,11 @@ library_names := \
librs_adreno_sha1.so \
hw/vulkan.$(TARGET_BOARD_PLATFORM).so

# Create target directories
CREATE_FOLDERS := lib/hw lib64/hw
LOCAL_POST_INSTALL_CMD += mkdir -p $(foreach p,$(CREATE_FOLDERS),$(TARGET_DIRECTORY)/$p);

# Create symlinks to 32- and 64-bit directories:
LOCAL_POST_INSTALL_CMD += $(foreach lib_dir,lib lib64, \
SONY_SYMLINKS := $(foreach lib_dir,lib lib64, \
$(foreach p,$(library_names), \
ln -sf /odm/$(lib_dir)/$p $(TARGET_DIRECTORY)/$(lib_dir)/$(dir $p); \
/odm/$(lib_dir)/$p:$(TARGET_COPY_OUT_VENDOR)/$(lib_dir)/$p \
) \
)

include $(BUILD_PHONY_PACKAGE)
include $(SONY_BUILD_SYMLINKS)

+ 18
- 0
sony_build_symlinks.mk View File

@@ -0,0 +1,18 @@
# Creates symlinks relative to the PRODUCT_OUT folder.
# This is different from BOARD_ROOT_EXTRA_SYMLINKS in that it allows symlinks on other partitions.
#
# Links can be specified in TARGET:DIRECTORY or TARGET:LINK_NAME notation. This creates a link named LINK_NAME or DIRECTORY/$(basename TARGET) pointing to TARGET.
#
# This script is based on conversion from BOARD_ROOT_EXTRA_SYMLINKS to LOCAL_POST_INSTALL_CMD from system/core/rootdir/Android.mk.

ifeq ($(SONY_SYMLINKS),)
$(warning "No symlinks set!")
else
LOCAL_POST_INSTALL_CMD := $(foreach s,$(SONY_SYMLINKS), \
$(eval p := $(subst :,$(space),$(s))) \
mkdir -p $(dir $(PRODUCT_OUT)/$(word 2,$(p))); \
ln -sf $(word 1,$(p)) $(PRODUCT_OUT)/$(word 2,$(p)); \
)
endif

include $(BUILD_PHONY_PACKAGE)

+ 3
- 0
sony_clear_vars.mk View File

@@ -0,0 +1,3 @@
SONY_SYMLINKS :=

include $(CLEAR_VARS)

Loading…
Cancel
Save