[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:
Mathieu Maret 2016-02-15 15:53:45 +01:00
parent c3f255aec0
commit f897e5394e
1 changed files with 42 additions and 0 deletions

42
scripts/ndk-deps-to-mk.sh Executable file
View 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"