From 75de633db7ffa63d8c2d8a4cfe525acd077e96d6 Mon Sep 17 00:00:00 2001 From: Friedrich von Never Date: Sun, 26 May 2024 22:50:52 +0200 Subject: [PATCH] Test: migrate from ldd-apple to otool --- .gitmodules | 3 --- ldd-apple | 1 - macos/Test-Dependencies.ps1 | 21 +++++---------------- 3 files changed, 5 insertions(+), 20 deletions(-) delete mode 160000 ldd-apple diff --git a/.gitmodules b/.gitmodules index 4c045d9..cc3d990 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,6 +4,3 @@ [submodule "tdsharp"] path = tdsharp url = https://github.com/egramtel/tdsharp.git -[submodule "ldd-apple"] - path = ldd-apple - url = https://github.com/tetractius/ldd-apple.git diff --git a/ldd-apple b/ldd-apple deleted file mode 160000 index 6de2533..0000000 --- a/ldd-apple +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 6de25338ac214579dddfc65059be6bfa9b819d8d diff --git a/macos/Test-Dependencies.ps1 b/macos/Test-Dependencies.ps1 index fcc0502..d8e0f53 100644 --- a/macos/Test-Dependencies.ps1 +++ b/macos/Test-Dependencies.ps1 @@ -7,7 +7,6 @@ param ( [string] $Package = "$RepoRoot/build/$PackageName/runtimes/osx-$DotNetArch/native", [string] $GoldFile = "$RepoRoot/macos/libraries.$DotNetArch.gold.txt", [string] $ResultFile = "$RepoRoot/macos/libraries.temp.txt", - [string] $LddApple = "$RepoRoot/ldd-apple/ldd-apple.sh", [switch] $GenerateGold ) @@ -24,26 +23,16 @@ Get-ChildItem "$Package/*.dylib" | Sort-Object -Property Name | ForEach-Object { $libraryPath = $_.FullName Write-Output "Checking file `"$libraryPath`"…" - $output = & $LddApple $libraryPath *>&1 + $output = otool -L $libraryPath if (!$?) { - throw "ldd-apple returned an exit code $LASTEXITCODE." + throw "otool returned an exit code $LASTEXITCODE." } - Write-Output "Output from ldd-apple $($libraryPath):" + Write-Output "Output from otool -L $($libraryPath):" Write-Output $output - $libraryNames = $output | Where-Object { - [string]$line = $_ - $line.StartsWith('dyld[') -or $line.StartsWith('dyld: loaded:') - } | ForEach-Object { - if (!($_ -match 'dyld(?:: loaded|\[\d+\]): <.*?> (.*)')) { - throw "Failed to parse ldd-apple output: $_" - } - - $filePath = $Matches[1] - if ($filePath -ne $libraryPath -and !$filePath.Contains('cpp.exec')) { - $filePath - } + $libraryNames = $output | Where-Object { $_.StartsWith(' ') } | ForEach-Object { + $_.Trim() } | Sort-Object $_.Name >> $ResultFile $libraryNames | ForEach-Object { " $_" >> $ResultFile }