1#!/bin/bash
2set -e
3
4STRIP_PATH="${1}"
5CORE="${2}"
6VENDOR="${3}"
7
8TMPDIR="$(mktemp -d ${CORE}.vndk_lib_check.XXXXXXXX)"
9stripped_core="${TMPDIR}/core"
10stripped_vendor="${TMPDIR}/vendor"
11
12function cleanup() {
13  rm -f "${stripped_core}" "${stripped_vendor}"
14  rmdir "${TMPDIR}"
15}
16trap cleanup EXIT
17
18function strip_lib() {
19  ${STRIP_PATH} \
20    -i ${1} \
21    -o ${2} \
22    -d /dev/null \
23    --remove-build-id
24}
25
26strip_lib ${CORE} ${stripped_core}
27strip_lib ${VENDOR} ${stripped_vendor}
28if ! cmp -s ${stripped_core} ${stripped_vendor}; then
29  echo "VNDK library not in vndkMustUseVendorVariantList but has different core and vendor variant: $(basename ${CORE})"
30  echo "If the two variants need to have different runtime behavior, consider using libvndksupport."
31  exit 1
32fi
33