mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
chore(osx): Added macos instalation script
Implementation by @iphydf Fix #3747.
This commit is contained in:
parent
f0467abc34
commit
30e8a69d11
37
osx/macfixrpath
Executable file
37
osx/macfixrpath
Executable file
|
@ -0,0 +1,37 @@
|
|||
#!/usr/bin/env perl
|
||||
# This script used in `CMakeList.txt`. It's not required to run manually
|
||||
|
||||
use strict;
|
||||
use File::Find;
|
||||
use Data::Dumper;
|
||||
|
||||
local $Data::Dumper::Terse = 1;
|
||||
local $Data::Dumper::Indent = 1;
|
||||
|
||||
my $BUNDLE_PATH = @ARGV[0] or die "Usage: macfixrpath <BUNDLE_PATH>\n";
|
||||
|
||||
my $prefix = `brew --prefix`;
|
||||
chomp $prefix;
|
||||
$prefix .= "/Cellar/";
|
||||
|
||||
my @libs = <$BUNDLE_PATH/Contents/Frameworks/*.framework/Versions/5/Qt*>;
|
||||
find sub {
|
||||
/\.dylib$/ or return;
|
||||
push @libs, $File::Find::name;
|
||||
}, $BUNDLE_PATH;
|
||||
|
||||
my %deps;
|
||||
for (@libs) {
|
||||
my @deps = grep { @$_ } map { [m!^\t($prefix.+)/([^/]+) \(.+\)$!] } grep { /^\t/ } split /\n/, `otool -L $_`;
|
||||
my @resolved = map { my $dep = $_; [@$dep, grep { m!/$dep->[1]$! } @libs] } @deps;
|
||||
$_->[2] =~ s|\Q$BUNDLE_PATH\E/Contents/|\@executable_path/../| for @resolved;
|
||||
$deps{$_} = \@resolved if @deps;
|
||||
}
|
||||
|
||||
for my $lib (sort keys %deps) {
|
||||
my $count = @{$deps{$lib}};
|
||||
for my $dep (@{$deps{$lib}}) {
|
||||
my ($path, $name, $dest) = @$dep;
|
||||
system "install_name_tool", "-change", "$path/$name", $dest, $lib;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user