1#!/bin/bash 2 3# Checks that, when we define a local library, we use it everywhere 4 5pushd "$(dirname "$0")" >/dev/null 2>&1 6base="$(pwd)" 7popd >/dev/null 2>&1 8 9local_libraries=( \ 10 $(find "${base}"/x86_64-linux-gnu/bin \ 11 "${base}"/aarch64-linux-gnu/bin \ 12 -type f -print) 13) 14 15exit_code=0 16 17for check_links_for in "${local_libraries[@]}"; do 18 library_stub="$(basename "${check_links_for}")" 19 library_stub="${library_stub/.*/}" 20 for library_to_check in "${local_libraries[@]}"; do 21 bad_links="$(ldd "${library_to_check}" | grep "${library_stub}" | grep -v "${base}" )" 22 if [[ -n "${bad_links}" ]]; then 23 echo ${library_to_check} has bad link to ${library_stub}: ${bad_links} 24 exit_code=2 25 fi 26 done 27done 28exit ${exit_code} 29