From f897e5394e6ac77fc5b604a3063d19f5e46707c4 Mon Sep 17 00:00:00 2001 From: Mathieu Maret Date: Mon, 15 Feb 2016 15:53:45 +0100 Subject: [PATCH] [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 --- scripts/ndk-deps-to-mk.sh | 42 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100755 scripts/ndk-deps-to-mk.sh diff --git a/scripts/ndk-deps-to-mk.sh b/scripts/ndk-deps-to-mk.sh new file mode 100755 index 0000000..e2c59ef --- /dev/null +++ b/scripts/ndk-deps-to-mk.sh @@ -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"