Provide a sensible default architecture when building on iOS SDKs
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 1 Feb 2013 01:34:04 +0000 (01:34 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 1 Feb 2013 01:34:04 +0000 (01:34 +0000)
https://bugs.webkit.org/show_bug.cgi?id=108395

Patch by David Farler <dfarler@apple.com> on 2013-01-31
Reviewed by Joseph Pecoraro.

* Scripts/webkitdirs.pm:
(determineArchitecture):
Check for iphoneos and iphonesimulator SDKs for a default arch.
(determineXcodeSDK): Added.
(xcodeSDK): Added.
(XcodeOptions): Add ARCHS= if defined.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@141515 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/Scripts/webkitdirs.pm

index e7dbafc..8a46a3d 100644 (file)
@@ -1,3 +1,17 @@
+2013-01-31  David Farler  <dfarler@apple.com>
+
+        Provide a sensible default architecture when building on iOS SDKs
+        https://bugs.webkit.org/show_bug.cgi?id=108395
+
+        Reviewed by Joseph Pecoraro.
+
+        * Scripts/webkitdirs.pm:
+        (determineArchitecture):
+        Check for iphoneos and iphonesimulator SDKs for a default arch.
+        (determineXcodeSDK): Added.
+        (xcodeSDK): Added.
+        (XcodeOptions): Add ARCHS= if defined.
+
 2013-01-31  Christopher Cameron  <ccameron@chromium.org>
 
         Fix rubber-band effect on non-scrollable pages
index c0f760b..74557bb 100755 (executable)
@@ -80,6 +80,7 @@ my $numberOfCPUs;
 my $baseProductDir;
 my @baseProductDirOption;
 my $configuration;
+my $xcodeSDK;
 my $configurationForVisualStudio;
 my $configurationProductDir;
 my $sourceDir;
@@ -301,6 +302,7 @@ sub determineArchitecture
     $architecture = "";
 
     determineBaseProductDir();
+    determineXcodeSDK();
 
     if (isGtk()) {
         determineConfigurationProductDir();
@@ -317,9 +319,15 @@ sub determineArchitecture
         if ($architecture) {
             chomp $architecture;
         } else {
-            my $supports64Bit = `sysctl -n hw.optional.x86_64`;
-            chomp $supports64Bit;
-            $architecture = 'x86_64' if $supports64Bit;
+            if (not defined $xcodeSDK or $xcodeSDK =~ /\/|macosx/) {
+                my $supports64Bit = `sysctl -n hw.optional.x86_64`;
+                chomp $supports64Bit;
+                $architecture = 'x86_64' if $supports64Bit;
+            } elsif ($xcodeSDK =~ /iphonesimulator/) {
+                $architecture = 'i386';
+            } elsif ($xcodeSDK =~ /iphoneos/) {
+                $architecture = 'armv7';
+            }
         }
     } elsif (isEfl()) {
         my $host_processor = "";
@@ -396,6 +404,30 @@ sub argumentsForConfiguration()
     return @args;
 }
 
+sub determineXcodeSDK
+{
+    return if defined $xcodeSDK;
+    for (my $i = 0; $i <= $#ARGV; $i++) {
+        my $opt = $ARGV[$i];
+        if ($opt =~ /^--sdk$/i) {
+            splice(@ARGV, $i, 1);
+            $xcodeSDK = splice(@ARGV, $i, 1);
+        } elsif ($opt =~ /^--device$/i) {
+            splice(@ARGV, $i, 1);
+            $xcodeSDK = 'iphoneos.internal';
+        } elsif ($opt =~ /^--sim(ulator)?/i) {
+            splice(@ARGV, $i, 1);
+            $xcodeSDK = 'iphonesimulator';
+        }
+    }
+}
+
+sub xcodeSDK
+{
+    determineXcodeSDK();
+    return $xcodeSDK;
+}
+
 sub determineConfigurationForVisualStudio
 {
     return if defined $configurationForVisualStudio;
@@ -520,7 +552,12 @@ sub XcodeOptions
     determineBaseProductDir();
     determineConfiguration();
     determineArchitecture();
-    return (@baseProductDirOption, "-configuration", $configuration, "ARCHS=$architecture", argumentsForXcode());
+    determineXcodeSDK();
+
+    my @sdkOption = ($xcodeSDK ? "SDKROOT=$xcodeSDK" : ());
+    my @architectureOption = ($architecture ? "ARCHS=$architecture" : ());
+
+    return (@baseProductDirOption, "-configuration", $configuration, @architectureOption, @sdkOption, argumentsForXcode());
 }
 
 sub XcodeOptionString