mrrl

Minimal Reliable Reproducible Linux
git clone https://ccx.te2000.cz/git/mrrl
Log | Files | Refs | Submodules | README

check_dynamic (793B)


      1 linker_path_mcm='{{pkg_install_dir("musl-cross-make")}}/{{triplet}}/lib/ld-musl-{{triplet.split('-')[0]}}.so.1'
      2 linker_path_musl='{{pkg_install_dir("musl")}}/{{dynlibdir}}/ld-musl-{{triplet.split('-')[0]}}.so.1'
      3 check_dynamic() {
      4 	local exe || true
      5 	exe=$pthbs_destdir'{{versions}}'/$pthbs_package/$1
      6 	if ! test -f $exe; then
      7 		printf '%s\n' "Error: file '$1' doesn't exist!"
      8 		exit 1
      9 	fi
     10 	local interp_info || true
     11 	interp_info=$(readelf --string-dump=.interp "$exe") || exit $?
     12 	case $interp_info in
     13 		('')
     14 			printf '%s\n' "Error: '$1' is not a dynamic binary!"
     15 			exit 1
     16 			;;
     17 		(*"$linker_path_mcm")
     18 			return 0
     19 			;;
     20 		(*"$linker_path_musl")
     21 			return 0
     22 			;;
     23 		(*)
     24 			printf '%s\n' "Error: '$1' unexpected linker path!"
     25 			ls -l "$linker_path_mcm" "$linker_path_musl"
     26 			exit 1
     27 	esac
     28 }