2018-11-13 05:16:26 +01:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
|
|
|
|
STRIP_PATH="${1}"
|
|
|
|
CORE="${2}"
|
|
|
|
VENDOR="${3}"
|
|
|
|
|
2020-01-08 23:39:10 +01:00
|
|
|
TMPDIR="$(mktemp -d ${CORE}.vndk_lib_check.XXXXXXXX)"
|
|
|
|
stripped_core="${TMPDIR}/core"
|
|
|
|
stripped_vendor="${TMPDIR}/vendor"
|
2018-11-13 05:16:26 +01:00
|
|
|
|
|
|
|
function cleanup() {
|
2020-01-08 23:39:10 +01:00
|
|
|
rm -f "${stripped_core}" "${stripped_vendor}"
|
|
|
|
rmdir "${TMPDIR}"
|
2018-11-13 05:16:26 +01:00
|
|
|
}
|
|
|
|
trap cleanup EXIT
|
|
|
|
|
|
|
|
function strip_lib() {
|
|
|
|
${STRIP_PATH} \
|
|
|
|
-i ${1} \
|
|
|
|
-o ${2} \
|
|
|
|
-d /dev/null \
|
|
|
|
--remove-build-id
|
|
|
|
}
|
|
|
|
|
|
|
|
strip_lib ${CORE} ${stripped_core}
|
|
|
|
strip_lib ${VENDOR} ${stripped_vendor}
|
|
|
|
if ! cmp -s ${stripped_core} ${stripped_vendor}; then
|
2020-08-06 20:02:31 +02:00
|
|
|
echo "ERROR: VNDK library $(basename ${CORE%.so}) has different core and" \
|
|
|
|
"vendor variants! This means that the copy used in the system.img/etc" \
|
|
|
|
"and vendor.img/etc images are different. In order to preserve space on" \
|
|
|
|
"some devices, it is helpful if they are the same. Frequently, " \
|
|
|
|
"libraries are different because they or their dependencies compile" \
|
|
|
|
"things based on the macro '__ANDROID_VNDK__' or they specify custom" \
|
|
|
|
"options under 'target: { vendor: { ... } }'. Here are some possible" \
|
|
|
|
"resolutions:"
|
|
|
|
echo "ERROR: 1). Remove differences, possibly using the libvndksupport" \
|
|
|
|
"function android_is_in_vendor_process in order to turn this into a" \
|
|
|
|
"runtime difference."
|
|
|
|
echo "ERROR: 2). Add the library to the VndkMustUseVendorVariantList" \
|
|
|
|
"variable in build/soong/cc/config/vndk.go, which is used to" \
|
|
|
|
"acknowledge this difference."
|
2018-11-13 05:16:26 +01:00
|
|
|
exit 1
|
|
|
|
fi
|