1#!/bin/sh 2 3cd "$(dirname "$0")/.." 4 5# Check for dependencies 6./scripts/normalize_dependencies.sh || exit 1 7 8SONAME=libmali.so.1 9LIBS=$(find optimize_*/ -name "*.so") 10 11for lib in $LIBS; do 12 DEPS=$(readelf -d $lib) 13 14 # Hack out-dated deps 15 for dep in libffi.so libcrypto.so; do 16 DEP=$(echo $DEPS | grep -oE "$dep.[0-9]*") 17 [ -z "$DEP" ] || patchelf $lib --replace-needed $DEP $dep 18 done 19 20 # Set a common soname 21 echo $DEPS | grep -q "Library soname: \[$SONAME\]" || 22 patchelf --set-soname $SONAME $lib 23 24 # Increase .dynsym's sh_info to workaround local symbol warning: 25 # 'found local symbol in global part of symbol table' 26 # 27 # depends on lief (pip3 install lief) 28 readelf -s $lib 2>&1 | grep -wq Warning && \ 29 scripts/fixup_dynsym.py $lib& 30done 31 32wait 33 34for lib in $LIBS; do 35 # Normalize library name 36 mv $lib "${lib%/*}/$(scripts/parse_name.sh --format $lib)" 2>/dev/null 37done 38 39# Update debian control and rules 40scripts/update_debian.sh 41