mirror of https://github.com/ksherlock/ample.git
auto set the rpath in mame64.
I would prefer to do it after copying but the copy also codesigns.
This commit is contained in:
parent
328ab815fb
commit
dc7adde938
|
@ -665,6 +665,7 @@
|
||||||
B6BA257824E99BE9005FB8FF /* Frameworks */,
|
B6BA257824E99BE9005FB8FF /* Frameworks */,
|
||||||
B6BA257924E99BE9005FB8FF /* Resources */,
|
B6BA257924E99BE9005FB8FF /* Resources */,
|
||||||
B66236B124FDA443006CABD7 /* Embed Frameworks */,
|
B66236B124FDA443006CABD7 /* Embed Frameworks */,
|
||||||
|
B6152B5C25F6F4F800605E6E /* ShellScript */,
|
||||||
B66236BB24FDA71D006CABD7 /* CopyFiles */,
|
B66236BB24FDA71D006CABD7 /* CopyFiles */,
|
||||||
);
|
);
|
||||||
buildRules = (
|
buildRules = (
|
||||||
|
@ -903,6 +904,27 @@
|
||||||
};
|
};
|
||||||
/* End PBXResourcesBuildPhase section */
|
/* End PBXResourcesBuildPhase section */
|
||||||
|
|
||||||
|
/* Begin PBXShellScriptBuildPhase section */
|
||||||
|
B6152B5C25F6F4F800605E6E /* ShellScript */ = {
|
||||||
|
isa = PBXShellScriptBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
);
|
||||||
|
inputFileListPaths = (
|
||||||
|
);
|
||||||
|
inputPaths = (
|
||||||
|
);
|
||||||
|
outputFileListPaths = (
|
||||||
|
);
|
||||||
|
outputPaths = (
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
shellPath = /bin/sh;
|
||||||
|
shellScript = "# Type a script or drag a script file from your workspace to insert its path.\n\ncd \"embedded\"\necho perl install_name_tool.pl --verbose mame64 \"@executable_path/../Frameworks\"\nperl install_name_tool.pl --verbose mame64 \"@executable_path/../Frameworks\"\n";
|
||||||
|
showEnvVarsInLog = 0;
|
||||||
|
};
|
||||||
|
/* End PBXShellScriptBuildPhase section */
|
||||||
|
|
||||||
/* Begin PBXSourcesBuildPhase section */
|
/* Begin PBXSourcesBuildPhase section */
|
||||||
B6841BCC251EC913006A5C39 /* Sources */ = {
|
B6841BCC251EC913006A5C39 /* Sources */ = {
|
||||||
isa = PBXSourcesBuildPhase;
|
isa = PBXSourcesBuildPhase;
|
||||||
|
|
|
@ -0,0 +1,89 @@
|
||||||
|
use strict;
|
||||||
|
use Getopt::Long;
|
||||||
|
use Data::Dumper;
|
||||||
|
|
||||||
|
my $file;
|
||||||
|
my @rpaths;
|
||||||
|
my $path;
|
||||||
|
my $verbose = 0;
|
||||||
|
my $help = 0;
|
||||||
|
my $dry_run = 0;
|
||||||
|
|
||||||
|
sub help($) {
|
||||||
|
print("Usage: install_name_tool.pl [--dry-run] [--verbose] exec-file rpath\n");
|
||||||
|
exit(shift);
|
||||||
|
}
|
||||||
|
|
||||||
|
GetOptions("help" => \$help, "verbose" => \$verbose, "dry-run" => \$dry_run);
|
||||||
|
help(0) if $help;
|
||||||
|
$verbose = 1 if $dry_run;
|
||||||
|
|
||||||
|
help(1) unless scalar(@ARGV) == 2;
|
||||||
|
($file, $path) = @ARGV;
|
||||||
|
|
||||||
|
|
||||||
|
open(my $fh, "-|", "otool", "-l", $file);
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
#Load command 33
|
||||||
|
# cmd LC_RPATH
|
||||||
|
# cmdsize 32
|
||||||
|
# path ./Frameworks/ (offset 12)
|
||||||
|
#
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
my $cmd = '';
|
||||||
|
while (<$fh>) {
|
||||||
|
chomp;
|
||||||
|
if ($_ =~ /^Load command/) {
|
||||||
|
$cmd = '';
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
if ($_ =~ /^\s+cmd ([A-Z_]+)$/) {
|
||||||
|
$cmd = $1;
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
if ($cmd eq 'LC_RPATH' && $_ =~ /^\s+path (.+) \(offset \d+\)$/) {
|
||||||
|
push(@rpaths, $1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
close($fh);
|
||||||
|
|
||||||
|
if ($verbose) {
|
||||||
|
print "current rpaths:\n";
|
||||||
|
foreach(@rpaths) {
|
||||||
|
print($_ . "\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
my @args;
|
||||||
|
|
||||||
|
# equal or changeable.
|
||||||
|
if (scalar @rpaths == 1) {
|
||||||
|
exit(0) if $rpaths[0] eq $path;
|
||||||
|
push(@args, ("-change_rpath", ${rpaths[0]}, $path))
|
||||||
|
} else {
|
||||||
|
|
||||||
|
my @tmp;
|
||||||
|
@tmp = grep {$_ ne $path } @rpaths;
|
||||||
|
|
||||||
|
foreach (@tmp) {
|
||||||
|
push(@args, ("-delete_rpath", $_))
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@tmp = grep {$_ eq $path } @rpaths;
|
||||||
|
if (!scalar @tmp) {
|
||||||
|
push(@args, ("-add_rpath", $path));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (scalar @args) {
|
||||||
|
print( join(' ', "install_name_tool", @args, $file) . "\n") if $verbose;
|
||||||
|
exit(0) if $dry_run;
|
||||||
|
system("install_name_tool", @args, $file);
|
||||||
|
exit($?);
|
||||||
|
}
|
||||||
|
exit(0);
|
Loading…
Reference in New Issue