mirror of
https://github.com/lemonade-sdk/mac_linuxgpu.git
synced 2026-11-22 23:57:31 -10:00
Installer: libmlg_drm and libdrm_mlg go to /usr/local/lib with the HSA runtime
The Linux-file client library (libmlg_drm) and the libdrm over it (libdrm_mlg, which RADV and other DRM clients load) now ship in the app's runtime payload, signed by the team like the HSA runtime, and the installer puts them in /Library/MacAMDGPU/runtime and /usr/local/lib in the same transaction (staged, backed up, restored on failure), so local apps pick up the libraries that match the driver on every update. Both have @rpath install names, as before. activate.sh --install-hsa builds them (make libdrm-mlg); the DMG check and the installer's validation accept and verify exactly these files.
This commit is contained in:
1 parent
8f783e486d
commit
56165a894a
3 files changed
+23
-11
No files matched your search
@@ -49,10 +49,11 @@ private let firmwareRootPath = "/Library/Application Support/MacLinuxGPU/firmwar
|
||||
// The disk image contains the signed host app and its embedded dext. Verify the
|
||||
// exact package before allowing a privileged replacement in /Applications.
|
||||
private enum InstallPackage {
|
||||
// Only the HSA runtime ships with the driver; it must match the dext.
|
||||
// HRX and Loom belong to the applications that use them (LemonSeed
|
||||
// bundles its own).
|
||||
private static let runtimeFiles = ["libhsa-runtime64.0.1.0.dylib"]
|
||||
// The HSA runtime and the Linux-file libraries (libmlg_drm, and
|
||||
// libdrm_mlg, the libdrm Vulkan and other DRM clients load) ship with
|
||||
// the driver; they must match the dext. HRX and Loom belong to the
|
||||
// applications that use them (LemonSeed bundles its own).
|
||||
private static let runtimeFiles = ["libhsa-runtime64.0.1.0.dylib", "libmlg_drm.dylib", "libdrm_mlg.dylib"]
|
||||
private static let runtimeLinks = [
|
||||
"libhsa-runtime64.1.dylib": "libhsa-runtime64.0.1.0.dylib",
|
||||
"libhsa-runtime64.dylib": "libhsa-runtime64.1.dylib"
|
||||
@@ -184,13 +185,15 @@ private enum InstallPackage {
|
||||
app_old=0
|
||||
app_new=0
|
||||
local_started=0
|
||||
libraries="libhsa-runtime64.0.1.0.dylib libmlg_drm.dylib libdrm_mlg.dylib"
|
||||
local_names="$libraries libhsa-runtime64.1.dylib libhsa-runtime64.dylib"
|
||||
finish() {
|
||||
result=$?
|
||||
trap - EXIT
|
||||
if [ "$committed" -ne 1 ]; then
|
||||
set +e
|
||||
if [ "$local_started" -eq 1 ]; then
|
||||
for name in libhsa-runtime64.0.1.0.dylib libhsa-runtime64.1.dylib libhsa-runtime64.dylib; do
|
||||
for name in $local_names; do
|
||||
if [ ! -e "$local_stage/$name" ] && [ ! -L "$local_stage/$name" ]; then
|
||||
/bin/rm -f "$local_dst/$name" || result=1
|
||||
fi
|
||||
@@ -238,10 +241,11 @@ private enum InstallPackage {
|
||||
if [ ! -e "$entry" ] && [ ! -L "$entry" ]; then continue; fi
|
||||
case "${entry##*/}" in
|
||||
libhsa-runtime64.0.1.0.dylib|libhsa-runtime64.1.dylib|libhsa-runtime64.dylib) ;;
|
||||
libmlg_drm.dylib|libdrm_mlg.dylib) ;;
|
||||
*) exit 1 ;;
|
||||
esac
|
||||
done
|
||||
for lib in libhsa-runtime64.0.1.0.dylib; do
|
||||
for lib in $libraries; do
|
||||
[ -f "$runtime_stage/$lib" ] && [ ! -L "$runtime_stage/$lib" ]
|
||||
/usr/bin/codesign --verify --strict "$runtime_stage/$lib"
|
||||
/usr/bin/codesign -dv "$runtime_stage/$lib" 2>&1 | /usr/bin/grep -Fxq \(shellQuote("TeamIdentifier=" + expectedTeamIdentifier))
|
||||
@@ -249,7 +253,7 @@ private enum InstallPackage {
|
||||
[ -L "$runtime_stage/libhsa-runtime64.1.dylib" ] && [ "$(/usr/bin/readlink "$runtime_stage/libhsa-runtime64.1.dylib")" = libhsa-runtime64.0.1.0.dylib ]
|
||||
[ -L "$runtime_stage/libhsa-runtime64.dylib" ] && [ "$(/usr/bin/readlink "$runtime_stage/libhsa-runtime64.dylib")" = libhsa-runtime64.1.dylib ]
|
||||
/bin/mkdir "$local_stage" "$local_backup"
|
||||
/usr/bin/ditto "$runtime_stage/libhsa-runtime64.0.1.0.dylib" "$local_stage/libhsa-runtime64.0.1.0.dylib"
|
||||
for lib in $libraries; do /usr/bin/ditto "$runtime_stage/$lib" "$local_stage/$lib"; done
|
||||
/bin/ln -s libhsa-runtime64.0.1.0.dylib "$local_stage/libhsa-runtime64.1.dylib"
|
||||
/bin/ln -s libhsa-runtime64.1.dylib "$local_stage/libhsa-runtime64.dylib"
|
||||
if [ -e "$runtime_dst" ]; then /bin/mv "$runtime_dst" "$runtime_backup"; runtime_old=1; fi
|
||||
@@ -259,7 +263,7 @@ private enum InstallPackage {
|
||||
/bin/mv "$stage" "$dst"
|
||||
app_new=1
|
||||
local_started=1
|
||||
for name in libhsa-runtime64.0.1.0.dylib libhsa-runtime64.1.dylib libhsa-runtime64.dylib; do
|
||||
for name in $local_names; do
|
||||
if [ -e "$local_dst/$name" ] || [ -L "$local_dst/$name" ]; then
|
||||
/bin/mv "$local_dst/$name" "$local_backup/$name"
|
||||
fi
|
||||
@@ -279,7 +283,7 @@ private enum InstallPackage {
|
||||
fi
|
||||
committed=1
|
||||
if [ "$fw_old" -eq 1 ]; then /bin/rm -rf "$fw_backup"; fi
|
||||
printf 'Installed %s\\nPrevious app backup: %s\\nPrevious runtime backup: %s\\nPrevious /usr/local HSA backup: %s\\n' "$dst" "$backup" "$runtime_backup" "$local_backup"
|
||||
printf 'Installed %s\\nPrevious app backup: %s\\nPrevious runtime backup: %s\\nPrevious /usr/local runtime backup: %s\\n' "$dst" "$backup" "$runtime_backup" "$local_backup"
|
||||
"""
|
||||
// AppleScript handles the administrator prompt. The command is fixed;
|
||||
// only paths, each shell quoted, vary. A failure retains the old app.
|
||||
|
||||
+8
-1
@@ -159,6 +159,11 @@ fi
|
||||
if [[ $install_hsa -eq 1 ]]; then
|
||||
echo "==> building HSA runtime dylib (make hsa)"
|
||||
make -C "$PROJECT_ROOT" hsa
|
||||
# The Linux-file libraries Vulkan and other DRM clients load (libmlg_drm,
|
||||
# libdrm_mlg): installed beside the HSA runtime so each driver update
|
||||
# brings the matching ones.
|
||||
echo "==> building libmlg_drm and libdrm_mlg (make libdrm-mlg)"
|
||||
make -C "$PROJECT_ROOT" libdrm-mlg
|
||||
for source in "$PROJECT_ROOT/build/hsa/libhsa-runtime64.0.1.0.dylib"; do
|
||||
[[ -f "$source" ]] || {
|
||||
echo "error: missing HSA runtime: $source" >&2
|
||||
@@ -329,7 +334,9 @@ stage_runtime_payload() {
|
||||
}
|
||||
rm -rf "$payload"
|
||||
mkdir -p "$payload"
|
||||
for source in "$PROJECT_ROOT/build/hsa/libhsa-runtime64.0.1.0.dylib"; do
|
||||
for source in "$PROJECT_ROOT/build/hsa/libhsa-runtime64.0.1.0.dylib" \
|
||||
"$PROJECT_ROOT/build/libdrm-mlg/lib/libmlg_drm.dylib" \
|
||||
"$PROJECT_ROOT/build/libdrm-mlg/lib/libdrm_mlg.dylib"; do
|
||||
[[ -f "$source" && ! -L "$source" ]] || {
|
||||
echo "error: expected a regular runtime library: $source" >&2
|
||||
return 1
|
||||
|
||||
@@ -150,10 +150,11 @@ validate_runtime_payload() {
|
||||
[[ -e "$entry" || -L "$entry" ]] || continue
|
||||
case "${entry##*/}" in
|
||||
libhsa-runtime64.0.1.0.dylib|libhsa-runtime64.1.dylib|libhsa-runtime64.dylib) ;;
|
||||
libmlg_drm.dylib|libdrm_mlg.dylib) ;;
|
||||
*) echo "error: unexpected runtime payload entry: $entry" >&2; return 1 ;;
|
||||
esac
|
||||
done
|
||||
for name in libhsa-runtime64.0.1.0.dylib; do
|
||||
for name in libhsa-runtime64.0.1.0.dylib libmlg_drm.dylib libdrm_mlg.dylib; do
|
||||
[[ -f "$runtime/$name" && ! -L "$runtime/$name" ]] || {
|
||||
echo "error: required runtime library is missing or linked: $name" >&2
|
||||
return 1
|
||||
|
||||
Reference in new issue
Block a user