install_name_tool fixes

This commit is contained in:
Kelvin Sherlock 2023-11-04 21:29:52 -04:00
parent 70fc811b0d
commit 9f7c49e3e0
1 changed files with 12 additions and 2 deletions

View File

@ -14,6 +14,11 @@ sub help($) {
exit(shift); exit(shift);
} }
sub uniq {
my %seen;
grep !$seen{$_}++, @_;
}
GetOptions("help" => \$help, "verbose" => \$verbose, "dry-run" => \$dry_run); GetOptions("help" => \$help, "verbose" => \$verbose, "dry-run" => \$dry_run);
help(0) if $help; help(0) if $help;
$verbose = 1 if $dry_run; $verbose = 1 if $dry_run;
@ -51,6 +56,8 @@ while (<$fh>) {
} }
close($fh); close($fh);
@rpaths = uniq(@rpaths);
if ($verbose) { if ($verbose) {
print "current rpaths:\n"; print "current rpaths:\n";
foreach(@rpaths) { foreach(@rpaths) {
@ -60,11 +67,14 @@ if ($verbose) {
my @args; my @args;
# grrr... -change doesn't seem to work anymore.
# equal or changeable. # equal or changeable.
if (scalar @rpaths == 1) { if (scalar @rpaths == 1) {
exit(0) if $rpaths[0] eq $path; exit(0) if $rpaths[0] eq $path;
push(@args, ("-change", ${rpaths[0]}, $path)) # push(@args, ("-change", ${rpaths[0]}, $path))
} else { }
#} else {
if (1) {
my @tmp; my @tmp;
@tmp = grep {$_ ne $path } @rpaths; @tmp = grep {$_ ne $path } @rpaths;