Skip to content

Commit

Permalink
Cherry-pick 271986@main (f365728). rdar://119615600
Browse files Browse the repository at this point in the history
    [build-webkit] Add --architecture argument
    https://bugs.webkit.org/show_bug.cgi?id=266342
    rdar://119615600

    Reviewed by Ryan Haddad.

    Add a '--architecture' argument to 'build-webkit' which allows
    the caller to override the architecutre used by 'build-webkit',
    and appropriately sets 'ONLY_ACTIVE_ARCH=NO' if '--architecture'
    is specified.

    * Tools/Scripts/build-webkit: Add documentation of '--architecture' option.
    * Tools/Scripts/webkitdirs.pm:
    (determineArchitecture): Parse the '--architecture' option and set didUserSpecifyArchitecture.
    (XcodeOptions): Set ONLY_ACTIVE_ARCH=NO if '--architecutre' was passed.

    Canonical link: https://commits.webkit.org/271986@main

Canonical link: https://commits.webkit.org/267815.629@safari-7617-branch
  • Loading branch information
JonWBedard committed Dec 13, 2023
1 parent c52d8a9 commit 87ffe53
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions Tools/Scripts/build-webkit
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ Usage: $programName [options] [options to pass to build system]
--debug Compile with Debug configuration
--release Compile with Release configuration
--sdk=<sdk> Use a specific Xcode SDK (Apple platforms only)
--arch=<architecture> Compile for a specific architecture (or architectures)
--ios-device Use "iphoneos.internal" SDK if installed, else "iphoneos" SDK (iOS only)
--device DEPRECATED alias of --ios-device
--ios-simulator Use "iphonesimulator.internal" SDK if installed, else "iphonesimulator" SDK (iOS only)
Expand Down
9 changes: 9 additions & 0 deletions Tools/Scripts/webkitdirs.pm
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ use constant IOS_DEVELOPMENT_CERTIFICATE_NAME_PREFIX => "iPhone Developer: ";
our @EXPORT_OK;

my $architecture;
my $didUserSpecifyArchitecture = 0;
my %nativeArchitectureMap = ();
my $asanIsEnabled;
my $tsanIsEnabled;
Expand Down Expand Up @@ -539,6 +540,13 @@ sub determineArchitecture
return if defined $architecture;

determineBaseProductDir();

# The user explicitly specified the architecture, don't assume anything
if (checkForArgumentAndRemoveFromARGVGettingValue("--architecture", \$architecture)) {
$didUserSpecifyArchitecture = 1;
return;
}

$architecture = nativeArchitecture([]);
if (isAppleCocoaWebKit() && $architecture eq "arm64") {
determineXcodeSDK();
Expand Down Expand Up @@ -1259,6 +1267,7 @@ sub XcodeOptions
push @options, "WK_LTO_MODE=$ltoMode" if $ltoMode;
push @options, @baseProductDirOption;
push @options, "ARCHS=$architecture" if $architecture;
push @options, "ONLY_ACTIVE_ARCH=NO" if $didUserSpecifyArchitecture;
push @options, "SDKROOT=$xcodeSDK" if $xcodeSDK;
if (xcodeVersion() lt "15.0") {
push @options, "TAPI_USE_SRCROOT=YES" if $ENV{UseSRCROOTSupportForTAPI};
Expand Down

0 comments on commit 87ffe53

Please sign in to comment.