aboutsummaryrefslogtreecommitdiff
path: root/tools/check_identical_lib.sh
blob: c3aa41a7227b4aba4e5f5580daa7cdc61fefb3d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash
set -e

STRIP_PATH="${1}"
CORE="${2}"
VENDOR="${3}"

TMPDIR="$(mktemp -d ${CORE}.vndk_lib_check.XXXXXXXX)"
stripped_core="${TMPDIR}/core"
stripped_vendor="${TMPDIR}/vendor"

function cleanup() {
  rm -f "${stripped_core}" "${stripped_vendor}"
  rmdir "${TMPDIR}"
}
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
  echo "VNDK library not in vndkMustUseVendorVariantList but has different core and vendor variant: $(basename ${CORE})"
  echo "If the two variants need to have different runtime behavior, consider using libvndksupport."
  exit 1
fi