Skip to content

Commit 38cd777

Browse files
Sign binaries after lipo-ing them since lipo drops signature added by the linker. Also, use JIT entitlement for signing executables.
1 parent 2dae0c5 commit 38cd777

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

external/buildscripts/build_all_osx.pl

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@
110110

111111
for my $file ('mono')
112112
{
113-
MergeIntoFatBinary("$distDirSourceBinX64/$file", "$distDirSourceBinARM64/$file", "$distDirDestinationBin/$file");
113+
MergeIntoFatBinary("$distDirSourceBinX64/$file", "$distDirSourceBinARM64/$file", "$distDirDestinationBin/$file", 1);
114114
}
115115

116116
for my $file ('pedump')
@@ -121,7 +121,7 @@
121121

122122
for my $file ('libMonoPosixHelper.dylib')
123123
{
124-
MergeIntoFatBinary("$embedDirSourceX64/$file", "$embedDirSourceARM64/$file", "$distDirDestinationLib/$file");
124+
MergeIntoFatBinary("$embedDirSourceX64/$file", "$embedDirSourceARM64/$file", "$distDirDestinationLib/$file", 0);
125125
}
126126

127127
if ($buildMachine)
@@ -169,8 +169,17 @@ sub CopyEmbedRuntimeBinaries
169169

170170
sub MergeIntoFatBinary
171171
{
172-
my ($binary1, $binary2, $binaryOutput) = @_;
172+
my ($binary1, $binary2, $binaryOutput, $isExe) = @_;
173173

174174
print(">>> Merging '$binary1' and '$binary2' into '$binaryOutput'\n\n");
175175
system('lipo', "$binary1", "$binary2", "-create", "-output", "$binaryOutput") eq 0 or die("Failed to run lipo!");
176-
}
176+
177+
if ($isExe)
178+
{
179+
system("codesign", "--entitlements", $buildscriptsdir . "/entitlements.plist", "-s", "-", "$binaryOutput") eq 0 or die("Failed to codesign $binaryOutput!");
180+
}
181+
else
182+
{
183+
system("codesign", "-s", "-", "$binaryOutput") eq 0 or die("Failed to codesign $binaryOutput!");
184+
}
185+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>com.apple.security.cs.allow-jit</key>
6+
<true/>
7+
</dict>
8+
</plist>
9+

0 commit comments

Comments
 (0)