[script] Android AOSP generate mk from binary dep
Generate the content of a .mk to be included in an AOSP. This define the binary module + dependencies modules
This commit is contained in:
parent
c3f255aec0
commit
f897e5394e
42
scripts/ndk-deps-to-mk.sh
Executable file
42
scripts/ndk-deps-to-mk.sh
Executable file
@ -0,0 +1,42 @@
|
||||
#!/bin/bash
|
||||
|
||||
# To be used in the root path of system partition dump
|
||||
# Will only get lib in vendor/lib
|
||||
|
||||
first=1
|
||||
libs=$(ndk-depends -Lvendor/lib $@ | grep -v "Could not" | grep -v "\\$" | grep camera)
|
||||
echo "$libs"
|
||||
|
||||
LIBS=""
|
||||
DEPS=""
|
||||
APP="${1#bin\/}"
|
||||
while read line; do
|
||||
lib=$(echo $line | awk -F" -> " '{print $1}')
|
||||
path=$(echo $line | awk -F" -> " '{print $2}')
|
||||
LIBS+="$path "
|
||||
DEPS+="${lib%.so} "
|
||||
echo -e "
|
||||
include \$(CLEAR_VARS)
|
||||
LOCAL_MODULE := ${lib%.so}
|
||||
LOCAL_SRC_FILES := $path
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
LOCAL_MODULE_SUFFIX := .so
|
||||
LOCAL_MODULE_CLASS := SHARED_LIBRARIES
|
||||
LOCAL_MODULE_PATH := \$(TARGET_OUT)/${path%${lib}}
|
||||
include \$(BUILD_PREBUILT)"
|
||||
done < <(ndk-depends -Lvendor/lib --print-paths $@ | grep -v "Could not" | grep -v "\\$" | grep vendor )
|
||||
|
||||
echo -e "
|
||||
include \$(CLEAR_VARS)
|
||||
LOCAL_MODULE := $APP
|
||||
LOCAL_SRC_FILES := system/bin/$APP
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
LOCAL_MODULE_CLASS := EXECUTABLES
|
||||
LOCAL_MODULE_PATH := \$(TARGET_OUT)/bin
|
||||
LOCAL_MODULE_SUFFIX :=
|
||||
LOCAL_SHARED_LIBRARIES := $DEPS
|
||||
include \$(BUILD_PREBUILT)
|
||||
"
|
||||
|
||||
echo "Install your lib using"
|
||||
echo "cp $LIBS YOUR_INSTALL_PATH"
|
Loading…
Reference in New Issue
Block a user