CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
71 lines
2.4 KiB
Bash
Executable File
71 lines
2.4 KiB
Bash
Executable File
#!/bin/bash
|
|
# Copyright Advanced Micro Devices, Inc.
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
set -e
|
|
|
|
PREFIX="${1:?Expected install prefix argument}"
|
|
PATCHELF="${PATCHELF:-patchelf}"
|
|
|
|
# update_library_links
|
|
# ---------------------
|
|
# Purpose:
|
|
# Normalize a shared library so that its real file is named exactly as its ELF SONAME,
|
|
# and rename the input file (usually a symlink) to a desired linker name (e.g., libfoo.so).
|
|
#
|
|
# Synopsis:
|
|
# update_library_links <libfile> <linker_name>
|
|
#
|
|
# Arguments:
|
|
# libfile Path to the library file or symlink.
|
|
# Example: $PREFIX/lib/librocm_sysdeps_cap.so
|
|
# linker_name Desired linker-name filename to exist in the same directory.
|
|
# Example: libcap.so
|
|
update_library_links() {
|
|
local libfile="$1" # e.g. $PREFIX/lib/librocm_sysdeps_cap.so
|
|
local linker_name="$2" # e.g. libcap.so
|
|
|
|
if [ ! -e "$libfile" ]; then
|
|
echo "Error: File '$libfile' not found" >&2
|
|
return 1
|
|
fi
|
|
|
|
local dir="$(dirname -- "$libfile")"
|
|
# Get the soname and realname
|
|
local lib_soname="$("$PATCHELF" --print-soname "$libfile" 2>/dev/null || true)"
|
|
local realname="$(readlink -f -- "$libfile" 2>/dev/null || true)"
|
|
|
|
if [[ -z "$lib_soname" || -z "$realname" ]]; then
|
|
[[ -z "$lib_soname" ]] && echo "Error: No SONAME found in '$libfile'" >&2
|
|
[[ -z "$realname" ]] && echo "Error: readlink -f failed for '$libfile'" >&2
|
|
return 1
|
|
fi
|
|
|
|
if [[ "$realname" != "$dir/$lib_soname" ]]; then
|
|
# Move the real file to $dir/$lib_soname
|
|
mv -v -- "$realname" "$dir/$lib_soname"
|
|
pushd "$dir" > /dev/null
|
|
ln -sf "$lib_soname" "$linker_name"
|
|
popd > /dev/null
|
|
rm "$libfile"
|
|
else
|
|
# Rename symlink in the same directory
|
|
mv "$libfile" "$dir/$linker_name"
|
|
fi
|
|
}
|
|
|
|
update_library_links "$PREFIX/lib/librocm_sysdeps_cap.so" "libcap.so"
|
|
update_library_links "$PREFIX/lib/librocm_sysdeps_psx.so" "libpsx.so"
|
|
|
|
# pc files are not output with a relative prefix. Sed it to relative.
|
|
if [ -d "$PREFIX/lib/pkgconfig" ]; then
|
|
for pcfile in "$PREFIX/lib/pkgconfig"/*.pc; do
|
|
if [ -f "$pcfile" ]; then
|
|
sed -i -E 's|^prefix=.+|prefix=${pcfiledir}/../..|' "$pcfile"
|
|
sed -i -E 's|^exec_prefix=.+|exec_prefix=${pcfiledir}/../..|' "$pcfile"
|
|
sed -i -E 's|^libdir=.+|libdir=${prefix}/lib|' "$pcfile"
|
|
sed -i -E 's|^includedir=.+|includedir=${prefix}/include|' "$pcfile"
|
|
fi
|
|
done
|
|
fi
|