Skip to content

Commit

Permalink
build: fix framework path detection for macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
osy committed May 23, 2021
1 parent 294a660 commit 9c70901
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
7 changes: 6 additions & 1 deletion Managers/UTMQemu.m
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,12 @@ - (void)startQemuRemote:(nonnull NSString *)name completion:(void(^)(BOOL,NSStri

- (void)startQemu:(nonnull NSString *)arch completion:(void(^)(BOOL,NSString *))completion {
[self printArgv];
NSString *dylib = [NSString stringWithFormat:@"qemu-%@-softmmu.framework/qemu-%@-softmmu", arch, arch];
#if TARGET_OS_IPHONE
NSString *base = @"";
#else
NSString *base = @"Versions/A/";
#endif
NSString *dylib = [NSString stringWithFormat:@"qemu-%@-softmmu.framework/%@qemu-%@-softmmu", arch, base, arch];
if (_connection) {
[self startQemuRemote:dylib completion:completion];
} else {
Expand Down
4 changes: 3 additions & 1 deletion Platform/UTMData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -475,11 +475,13 @@ class UTMData: ObservableObject {
let bundleURL = Bundle.main.bundleURL
#if os(macOS)
let contentsURL = bundleURL.appendingPathComponent("Contents", isDirectory: true)
let base = "Versions/A/"
#else
let contentsURL = bundleURL
let base = ""
#endif
let frameworksURL = contentsURL.appendingPathComponent("Frameworks", isDirectory: true)
let framework = frameworksURL.appendingPathComponent("qemu-" + arch + "-softmmu.framework/qemu-" + arch + "-softmmu", isDirectory: false)
let framework = frameworksURL.appendingPathComponent("qemu-" + arch + "-softmmu.framework/" + base + "qemu-" + arch + "-softmmu", isDirectory: false)
logger.error("\(framework.path)")
return fileManager.fileExists(atPath: framework.path)
}
Expand Down
6 changes: 5 additions & 1 deletion scripts/build_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,11 @@ fixup () {
libname=${basefilename#lib*}
dir=$(dirname "$g")
if [ "$dir" == "$PREFIX/lib" ]; then
newname="@rpath/$libname.framework/$libname"
if [ "$PLATFORM" == "macos" ]; then
newname="@rpath/$libname.framework/Versions/A/$libname"
else
newname="@rpath/$libname.framework/$libname"
fi
install_name_tool -change "$g" "$newname" "$NEWFILE"
fi
done
Expand Down

0 comments on commit 9c70901

Please sign in to comment.