Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the script that copies system dependencies #58

Merged
merged 2 commits into from
Feb 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions utils/lib-copy/copy-dependencies.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
}
[$_, $pathToCheck, $targetDirectory] = $argv;

// Create the target directory if it doesn't exist
if (! is_dir($targetDirectory)) {
mkdir($targetDirectory, 0777, true);
}

$arch = 'x86';
if (php_uname('m') !== 'x86_64') {
$arch = 'arm';
Expand Down Expand Up @@ -75,6 +80,9 @@ function listDependencies(string $path): array
}
$dependencies = [];
foreach ($lines as $line) {
if (str_ends_with($line, ' => not found')) {
throw new RuntimeException("This library is a dependency for $path but cannot be found by 'ldd':\n$line\n");
}
$matches = [];
if (preg_match('/=> (.*) \(0x[0-9a-f]+\)/', $line, $matches)) {
$dependencies[] = $matches[1];
Expand Down