Commit 4db904f7 authored by gsell's avatar gsell

postinstall_Linux: specific content moved from general post-install script

parent c4c17e33
......@@ -10,36 +10,49 @@ if [[ -z $(which patchelf) ]]; then
exit 1
fi
mydir=$(cd $(dirname "$0") && pwd)
#
# cp some shared libs which might not be installed on the target system
#
libs=( $(ldd "${OTB_PREFIX}/bin/ccmake" | awk '/ => \// && !/'${OTB_PREFIX//\//\\/}'|lib(c|dl|keyutils|m|resolv|pthread|rt|selinux).so/ {print $3}') )
if (( ${#libs[@]} > 0 )); then
cp "${libs[@]}" "${OTB_PREFIX}/lib"
fi
#
# set RPATH to $ORIGIN in all shared libraries to make them
# relocatable.
#
for f in "${OTB_PREFIX}"/lib/*.so; do
# is this an ELF 64-bit binary?
file -L "$f" | grep -q "ELF 64-bit" || continue
rpath=$(patchelf --print-rpath "$f")
[[ -z "${rpath}" ]] && continue
patchelf --force-rpath --set-rpath '$ORIGIN' "$f"
done
#
# set RPATH to $ORIGIN in all ELF binaries found in "${OTB_PREFIX}/bin"
# to make them relocatable.
# Linux specific post-install
#
postinstall_linux() {
#
# cp non-standard libraries required by CMake to tool-chain
#
copy_non_standard_system_libs() {
libs=( $(ldd "${OTB_PREFIX}/bin/ccmake" | awk '/ => \// && !/'${OTB_PREFIX//\//\\/}'|lib(c|dl|keyutils|m|resolv|pthread|rt|selinux).so/ {print $3}') )
if (( ${#libs[@]} > 0 )); then
cp "${libs[@]}" "${OTB_PREFIX}/lib"
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
# relocatable.
#
for f in "${OTB_PREFIX}"/lib/*.so; do
# is this an ELF 64-bit binary?
file -L "$f" | grep -q "ELF 64-bit" || continue
rpath=$(patchelf --print-rpath "$f")
[[ -z "${rpath}" ]] && continue
patchelf --force-rpath --set-rpath '$ORIGIN' "$f"
done
#
# 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
}
postinstall_linux
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
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