3 # Copyright (C) 2020 OpenWrt.org
5 # This is free software, licensed under the GNU General Public License v2.
6 # See /LICENSE for more information.
10 [ -n "$PATCHELF" ] ||
{
11 echo "$SELF: patchelf command not defined (PATCHELF variable not set)"
19 [ -n "$ABI_VER" -a -n "$PATCH_DIR" ] ||
{
20 echo "$SELF: no ABI version or files/directories specified"
21 echo "usage: $SELF <VERSION> [<PATH>...]"
41 find "$PATCH_DIR" -type f
-a -name 'lib*.so*' | \
44 NEW_F
="${F%%.so*}.so.$ABI_VER"
45 NEW_NAME
="${NEW_F##*/}"
46 [ "$NEW_F" != "$F" ] ||
continue
48 [ "$REF_LIST" ] || cmd
ln -s "$NEW_NAME" "$F"
49 cmd
$PATCHELF --set-soname "$NEW_NAME" "$NEW_F"
53 [ -n "$REF_LIST" ] ||
exit 0
55 LIBS
="$(gen_lib_list)"
57 find "$PATCH_DIR" -type f
-a -exec file {} \
; | \
58 sed -n -e 's/^\(.*\):.*ELF.*\(executable\|relocatable\|shared object\).*,.*/\1:\2/p' | \
62 $PATCHELF --print-needed "$F" |
while read L
; do
65 base_lib
="${lib%%.so*}"
66 [ "$BASE_L" = "$base_lib" ] ||
continue
67 [ "$l" = "$lib" ] && continue
68 cmd
$PATCHELF --replace-needed "$L" "$lib" "$F"