4
4
use File::Basename;
5
5
use File::Path;
6
6
use lib (' external/buildscripts' , " ../../Tools/perl_lib" ," perl_lib" , ' external/buildscripts/perl_lib' );
7
+ use strict;
8
+ use warnings;
7
9
use Tools qw( InstallNameTool) ;
8
10
9
11
print " >>> PATH in Build All = $ENV {PATH}\n\n " ;
10
12
11
13
my $currentdir = getcwd();
12
14
13
15
my $monoroot = File::Spec-> rel2abs(dirname(__FILE__ ) . " /../.." );
14
- my $monoroot = abs_path($monoroot );
16
+ $monoroot = abs_path($monoroot );
15
17
16
18
my $buildscriptsdir = " $monoroot /external/buildscripts" ;
17
19
my $addtoresultsdistdir = " $buildscriptsdir /add_to_build_results/monodistribution" ;
50
52
my $existingMonoRootPath = ' ' ;
51
53
my $sdk = ' ' ;
52
54
my $arch32 = 0;
55
+ my $targetArch = " " ;
53
56
my $winPerl = " " ;
54
57
my $winMonoRoot = " " ;
55
58
my $msBuildVersion = " 14.0" ;
95
98
' runtimetests=i' => \$runRuntimeTests ,
96
99
' classlibtests=i' => \$runClasslibTests ,
97
100
' arch32=i' => \$arch32 ,
101
+ ' targetarch=s' => \$targetArch ,
98
102
' jobs=i' => \$jobs ,
99
103
' sdk=s' => \$sdk ,
100
104
' existingmono=s' => \$existingMonoRootPath ,
204
208
}
205
209
elsif ($^O eq ' darwin' )
206
210
{
207
- $monoHostArch = $arch32 ? " i386 " : " x86_64" ;
211
+ $monoHostArch = " x86_64" ;
208
212
$existingExternalMono = " $existingExternalMonoRoot " ;
209
213
$existingExternalMonoBinDir = " bin" ;
210
214
215
+ if ($targetArch eq " arm64" )
216
+ {
217
+ $disableMcs = 1;
218
+ $test = 0;
219
+ }
220
+
211
221
# From Massi: I was getting failures in install_name_tool about space
212
222
# for the commands being too small, and adding here things like
213
223
# $ENV{LDFLAGS} = '-headerpad_max_install_names' and
294
304
}
295
305
else
296
306
{
297
- if (not $checkoutonthefly )
307
+ if (not $checkoutOnTheFly )
298
308
{
299
309
print (" >>> No external build deps found. Might as well try to check them out. If it fails, we'll continue and trust mono is in your PATH\n " );
300
310
}
445
455
}
446
456
447
457
my $macSdkPath = " " ;
448
- my $macversion = ' 10.8 ' ;
458
+ my $macversion = ' 10.12 ' ;
449
459
my $darwinVersion = " 10" ;
450
460
if ($^O eq ' darwin' )
451
461
{
452
- if ($sdk eq ' ' )
453
- {
454
- $sdk =' 10.11' ;
455
- }
456
-
457
- my $macBuildEnvDir = " $externalBuildDeps /MacBuildEnvironment" ;
458
- $macSdkPath = " $macBuildEnvDir /builds/MacOSX$sdk .sdk" ;
459
- if (! -d $macSdkPath )
460
- {
461
- print (" >>> Unzipping mac build toolchain\n " );
462
- system (" unzip" , ' -qd' , " $macBuildEnvDir " , " $macBuildEnvDir /builds.zip" ) eq 0 or die (" failed unzipping mac build toolchain\n " );
463
- }
462
+ $sdk =' 11.0' ;
463
+ $macSdkPath = " $externalBuildDeps /mac-toolchain-11_0/MacOSX$sdk .sdk" ;
464
464
}
465
465
466
466
if ($iphone || $iphoneSimulator )
681
681
my $platformRootPostfix = " " ;
682
682
my $useKraitPatch = 1;
683
683
my $kraitPatchPath = " $monoroot /../../android_krait_signal_handler/build" ;
684
- my $toolChainExtension = " " ;
685
684
686
685
$ENV {ANDROID_PLATFORM } = " android-$apiLevel " ;
687
686
759
758
760
759
if ($runningOnWindows )
761
760
{
762
- $toolChainExtension = " .exe" ;
763
-
764
761
$androidPlatformRoot = ` cygpath -w $androidPlatformRoot ` ;
765
762
# clean up trailing new lines that end up in the output from cygpath.
766
763
$androidPlatformRoot =~ s /\n +$// ;
968
965
969
966
if ($runningOnWindows )
970
967
{
971
- $toolChainExtension = " .exe" ;
972
-
973
968
$tizenPlatformRoot = ` cygpath -w $tizenPlatformRoot ` ;
974
969
# clean up trailing new lines that end up in the output from cygpath.
975
970
$tizenPlatformRoot =~ s /\n +$// ;
1159
1154
$existingMonoRootPath = " $monoInstalls /$monoVersionToUse " ;
1160
1155
}
1161
1156
1157
+ if ($targetArch eq " arm64" )
1158
+ {
1159
+ $macversion = " 11.0" ; # To build on ARM64, we need to specify min OS version as 11.0 as we need to use new APIs from 11.0
1160
+ }
1161
+
1162
1162
$mcs = " EXTERNAL_MCS=$existingMonoRootPath /bin/mcs" ;
1163
1163
1164
1164
$ENV {' CC' } = " $macSdkPath /../usr/bin/clang" ;
1165
1165
$ENV {' CXX' } = " $macSdkPath /../usr/bin/clang++" ;
1166
- $ENV {' CFLAGS' } = $ENV {MACSDKOPTIONS } = " -D_XOPEN_SOURCE -I $macBuildEnvDir /builds/usr/include - mmacosx-version-min=$macversion -isysroot $macSdkPath " ;
1166
+ $ENV {' CFLAGS' } = $ENV {MACSDKOPTIONS } = " -mmacosx-version-min=$macversion -isysroot $macSdkPath -g " ;
1167
1167
1168
- $ENV {CFLAGS } = " $ENV {CFLAGS} -g - O0" if $debug ;
1168
+ $ENV {CFLAGS } = " $ENV {CFLAGS} -O0" if $debug ;
1169
1169
$ENV {CFLAGS } = " $ENV {CFLAGS} -Os" if not $debug ; # optimize for size
1170
1170
1171
- $ENV {CC } = " $ENV {CC} -arch $monoHostArch " ;
1172
- $ENV {CXX } = " $ENV {CXX} -arch $monoHostArch " ;
1171
+ $ENV {CC } = " $ENV {CC} -arch $targetArch " ;
1172
+ $ENV {CXX } = " $ENV {CXX} -arch $targetArch " ;
1173
1173
1174
1174
# Add OSX specific autogen args
1175
- push @configureparams , " --host=$monoHostArch -apple-darwin12.2.0" ;
1175
+
1176
+ if ($targetArch eq " x86_64" )
1177
+ {
1178
+ push @configureparams , " --host=x86_64-apple-darwin12.2.0" ;
1179
+ }
1180
+ elsif ($targetArch eq " arm64" )
1181
+ {
1182
+ push @configureparams , " --host=aarch64-apple-darwinmacos12.2.0" ;
1183
+ }
1184
+ else
1185
+ {
1186
+ die (" Unsupported macOS architecture: $targetArch " );
1187
+ }
1176
1188
1177
1189
# Need to define because Apple's SIP gets in the way of us telling mono where to find this
1178
1190
push @configureparams , " --with-libgdiplus=$addtoresultsdistdir /lib/libgdiplus.dylib" ;
1510
1522
}
1511
1523
elsif ($^O eq ' darwin' )
1512
1524
{
1513
- # Note these tmp directories will get merged into a single 'osx' directory later by a parent script
1514
- $embedDirArchDestination = " $embedDirRoot /osx-tmp-$monoHostArch " ;
1515
- $distDirArchBin = " $distdir /bin-osx-tmp-$monoHostArch " ;
1516
- $versionsOutputFile = $arch32 ? " $buildsroot /versions-osx32.txt" : " $buildsroot /versions-osx64.txt" ;
1525
+ $embedDirArchDestination = " $embedDirRoot /osx-tmp-$targetArch " ;
1526
+ $distDirArchBin = " $distdir /bin-osx-tmp-$targetArch " ;
1527
+ $versionsOutputFile = " $buildsroot /versions-macos-$targetArch .txt" ;
1517
1528
}
1518
1529
else
1519
1530
{
1598
1609
system (" ln" ," -f" , " $monoroot /mono/mini/.libs/libmonosgen-2.0.dylib" ," $embedDirArchDestination /libmonosgen-2.0.dylib" ) eq 0 or die (" failed symlinking libmonosgen-2.0.dylib\n " );
1599
1610
1600
1611
print " Hardlinking libMonoPosixHelper.dylib\n " ;
1601
- system (" ln" ," -f" , " $monoroot /support/.libs/libMonoPosixHelper.dylib" ," $embedDirArchDestination /libMonoPosixHelper.dylib" ) eq 0 or die (" failed symlinking $libtarget /libMonoPosixHelper.dylib\n " );
1612
+ system (" ln" ," -f" , " $monoroot /support/.libs/libMonoPosixHelper.dylib" ," $embedDirArchDestination /libMonoPosixHelper.dylib" ) eq 0 or die (" failed symlinking $embedDirArchDestination /libMonoPosixHelper.dylib\n " );
1602
1613
1603
1614
InstallNameTool(" $embedDirArchDestination /libmonobdwgc-2.0.dylib" , " \@ executable_path/../Frameworks/MonoEmbedRuntime/osx/libmonobdwgc-2.0.dylib" );
1604
1615
InstallNameTool(" $embedDirArchDestination /libmonosgen-2.0.dylib" , " \@ executable_path/../Frameworks/MonoEmbedRuntime/osx/libmonosgen-2.0.dylib" );
1691
1702
1692
1703
if ($test )
1693
1704
{
1705
+ my $runtimeTestsDir = " $monoroot /mono/mini" ;
1694
1706
if ($runRuntimeTests )
1695
1707
{
1696
- my $runtimeTestsDir = " $monoroot /mono/mini" ;
1697
1708
chdir (" $runtimeTestsDir " ) eq 1 or die (" failed to chdir" );
1698
1709
print (" \n >>> Calling make check in $runtimeTestsDir \n\n " );
1699
1710
system (" make" ," check" ) eq 0 or die (" runtime tests failed\n " );
1727
1738
print (" >>> Skipping unit tests\n " );
1728
1739
}
1729
1740
1730
- chdir ($currentdir );
1741
+ chdir ($currentdir );
0 commit comments