62
62
}
63
63
64
64
print (" >>> Building x86_64\n " );
65
- system (" perl" , " $buildscriptsdir /build.pl" , " --clean=1" , " --classlibtests=0" , @passAlongArgs ) eq 0 or die (' failing building x86_64' );
65
+ system (" perl" , " $buildscriptsdir /build.pl" , " --clean=1" , " --classlibtests=0" , " --targetarch=x86_64" , @passAlongArgs ) eq 0 or die (' failing building x86_64' );
66
+
67
+ print (" >>> Building ARM64\n " );
68
+ system (" perl" , " $buildscriptsdir /build.pl" , " --clean=1" , " --classlibtests=0" , " --targetarch=arm64" , @passAlongArgs ) eq 0 or die (" failing building ARM64" );
66
69
67
70
if ($artifact )
68
71
{
69
72
print (" >>> Moving built binaries to final output directories\n " );
70
- # Merge stuff in the embedruntimes directory
71
- my $embedDirRoot = " $buildsroot /embedruntimes" ;
72
- my $embedDirDestination = " $embedDirRoot /osx" ;
73
- my $embedDirSource64 = " $embedDirRoot /osx-tmp-x86_64" ;
74
-
75
- system (" mkdir -p $embedDirDestination " );
76
-
77
- if (!(-d $embedDirSource64 ))
78
- {
79
- die (" Expected source directory not found : $embedDirSource64 \n " );
80
- }
81
73
82
- for my $file (' libmonobdwgc-2.0.dylib' ,' libmonosgen-2.0.dylib' ,' libMonoPosixHelper.dylib' )
83
- {
84
- print (" >>> cp $embedDirSource64 /$file $embedDirDestination /$file \n\n " );
85
- system (' cp' , " $embedDirSource64 /$file " , " $embedDirDestination /$file " );
86
- }
87
-
88
- if (not $buildMachine )
89
- {
90
- print (" >>> Doing non-build machine stuff...\n " );
91
- for my $file (' libmonobdwgc-2.0.dylib' ,' libmonosgen-2.0.dylib' ,' libMonoPosixHelper.dylib' )
92
- {
93
- print (" >>> Removing $embedDirDestination /$file .dSYM\n " );
94
- rmtree (" $embedDirDestination /$file .dSYM" );
95
- print (" >>> 'dsymutil $embedDirDestination /$file \n " );
96
- system (' dsymutil' , " $embedDirDestination /$file " ) eq 0 or warn (" Failed creating $embedDirDestination /$file .dSYM" );
97
- }
74
+ # Copy stuff in the embedruntimes directory
75
+ my $embedDirRoot = " $buildsroot /embedruntimes" ;
76
+ my $embedDirSourceX64 = " $embedDirRoot /osx-tmp-x86_64" ;
77
+ my $embedDirSourceARM64 = " $embedDirRoot /osx-tmp-arm64" ;
98
78
99
- print ( " >>> Done with non-build machine stuff \n " );
100
- }
79
+ CopyEmbedRuntimeBinaries( $embedDirSourceX64 , " $embedDirRoot /osx " );
80
+ CopyEmbedRuntimeBinaries( $embedDirSourceARM64 , " $embedDirRoot /osx-arm64 " );
101
81
102
82
# Merge stuff in the monodistribution directory
103
83
my $distDirRoot = " $buildsroot /monodistribution" ;
104
84
my $distDirDestinationBin = " $buildsroot /monodistribution/bin" ;
105
85
my $distDirDestinationLib = " $buildsroot /monodistribution/lib" ;
106
- my $distDirSourceBin64 = " $distDirRoot /bin-osx-tmp-x86_64" ;
86
+ my $distDirSourceBinX64 = " $distDirRoot /bin-osx-tmp-x86_64" ;
87
+ my $distDirSourceBinARM64 = " $distDirRoot /bin-osx-tmp-arm64" ;
107
88
108
89
# Should always exist because build_all would have put stuff in it, but in some situations
109
90
# depending on the options it may not. So create it if it does not exist
117
98
system (" mkdir -p $distDirDestinationLib " );
118
99
}
119
100
120
- if (!(-d $distDirSourceBin64 ))
101
+ if (!(-d $distDirSourceBinX64 ))
102
+ {
103
+ die (" Expected source directory not found : $distDirSourceBinX64 \n " );
104
+ }
105
+
106
+ if (!(-d $distDirSourceBinARM64 ))
107
+ {
108
+ die (" Expected source directory not found : $distDirSourceBinARM64 \n " );
109
+ }
110
+
111
+ for my $file (' mono' )
121
112
{
122
- die ( " Expected source directory not found : $distDirSourceBin64 \n " );
113
+ MergeIntoFatBinary( " $distDirSourceBinX64 / $file " , " $distDirSourceBinARM64 / $file " , " $distDirDestinationBin / $file " );
123
114
}
124
115
125
- for my $file (' mono ' , ' pedump' )
116
+ for my $file (' pedump' )
126
117
{
127
- system (' mv' , " $distDirSourceBin64 /$file " , " $distDirDestinationBin /$file " );
118
+ # pedump doens't get cross-compiled
119
+ system (' mv' , " $distDirSourceBinX64 /$file " , " $distDirDestinationBin /$file " ) eq 0 or die (" Failed to move '$distDirSourceBinX64 /$file ' to '$distDirDestinationBin /$file '." );
128
120
}
129
121
130
122
for my $file (' libMonoPosixHelper.dylib' )
131
123
{
132
- print (" >>> cp $embedDirSource64 /$file $distDirDestinationLib /$file \n\n " );
133
- system (' cp' , " $embedDirSource64 /$file " , " $distDirDestinationLib /$file " );
124
+ MergeIntoFatBinary(" $embedDirSourceX64 /$file " , " $embedDirSourceARM64 /$file " , " $distDirDestinationLib /$file " );
134
125
}
135
126
136
127
if ($buildMachine )
137
128
{
138
129
print (" >>> Clean up temporary arch specific build directories\n " );
139
130
140
- rmtree(" $distDirSourceBin64 " );
141
- rmtree(" $embedDirSource64 " );
131
+ rmtree(" $distDirSourceBinX64 " );
132
+ rmtree(" $distDirSourceBinARM64 " );
133
+ rmtree(" $embedDirSourceX64 " );
134
+ rmtree(" $embedDirSourceARM64 " );
142
135
}
143
136
}
137
+
138
+ sub CopyEmbedRuntimeBinaries
139
+ {
140
+ my ($embedDirSource , $embedDirDestination ) = @_ ;
141
+
142
+ system (" mkdir -p $embedDirDestination " );
143
+
144
+ if (!(-d $embedDirSource ))
145
+ {
146
+ die (" Expected source directory not found : $embedDirSource \n " );
147
+ }
148
+
149
+ for my $file (' libmonobdwgc-2.0.dylib' ,' libmonosgen-2.0.dylib' ,' libMonoPosixHelper.dylib' )
150
+ {
151
+ print (" >>> cp $embedDirSource /$file $embedDirDestination /$file \n\n " );
152
+ system (' cp' , " $embedDirSource /$file " , " $embedDirDestination /$file " ) eq 0 or die (" Failed to copy '$embedDirSource /$file ' to '$embedDirDestination /$file '." );
153
+ }
154
+
155
+ if (not $buildMachine )
156
+ {
157
+ print (" >>> Doing non-build machine stuff...\n " );
158
+ for my $file (' libmonobdwgc-2.0.dylib' ,' libmonosgen-2.0.dylib' ,' libMonoPosixHelper.dylib' )
159
+ {
160
+ print (" >>> Removing $embedDirDestination /$file .dSYM\n " );
161
+ rmtree(" $embedDirDestination /$file .dSYM" );
162
+ print (" >>> 'dsymutil $embedDirDestination /$file \n " );
163
+ system (' dsymutil' , " $embedDirDestination /$file " ) eq 0 or warn (" Failed creating $embedDirDestination /$file .dSYM" );
164
+ }
165
+
166
+ print (" >>> Done with non-build machine stuff\n " );
167
+ }
168
+ }
169
+
170
+ sub MergeIntoFatBinary
171
+ {
172
+ my ($binary1 , $binary2 , $binaryOutput ) = @_ ;
173
+
174
+ print (" >>> Merging '$binary1 ' and '$binary2 ' into '$binaryOutput '\n\n " );
175
+ system (' lipo' , " $binary1 " , " $binary2 " , " -create" , " -output" , " $binaryOutput " ) eq 0 or die (" Failed to run lipo!" );
176
+ }
0 commit comments