Commit 90896ee8 authored by gsell's avatar gsell
Browse files

postinstall_Linux: set RPATH in all shared libs and all executables

parent 7dd7e3e7
...@@ -25,32 +25,18 @@ postinstall_linux() { ...@@ -25,32 +25,18 @@ postinstall_linux() {
fi fi
} }
if [[ -z $(which patchelf) ]]; then
echo -e "patchelf missing!\nAborting..." 1>&2
exit 1
fi
# #
# set RPATH to $ORIGIN in all shared libraries to make them # set RPATH relative to $ORIGIN in all shared libraries and executables
# relocatable. # under ${OTB_PREFIX}/{bin,lib}
# #
for f in "${OTB_PREFIX}"/lib/*.so; do echo "Patching RPATH in executables and libraries..."
# is this an ELF 64-bit binary? while read depth fname; do
file -L "$f" | grep -q "ELF 64-bit" || continue file "${fname}" | egrep -q "ELF 64-bit LSB (shared|executable) " || continue
rpath=$(patchelf --print-rpath "$f") local str=$(printf "../%0.s" $(seq 1 $depth))
[[ -z "${rpath}" ]] && continue local rpath='$ORIGIN/'"${str}lib"
patchelf --force-rpath --set-rpath '$ORIGIN' "$f" patchelf --force-rpath --set-rpath "${rpath}" "${fname}"
done done < <(find "${OTB_PREFIX}/bin" "${OTB_PREFIX}/lib" -type f -printf "%d %p\n" )
#
# set RPATH to $ORIGIN in all ELF binaries found in "${OTB_PREFIX}/bin"
# to make them relocatable.
#
for f in "${OTB_PREFIX}"/bin/*; do
# is this an ELF 64-bit binary?
file -L "$f" | grep -q "ELF 64-bit" || continue
patchelf --force-rpath --set-rpath '$ORIGIN/../lib' "$f"
done
copy_non_standard_system_libs copy_non_standard_system_libs
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment