[iOS] Update configure-xcode-for-ios-development to copy missing headers to iphoneos SDK
authorddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 21 Jan 2015 23:21:59 +0000 (23:21 +0000)
committerddkilzer@apple.com <ddkilzer@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 21 Jan 2015 23:21:59 +0000 (23:21 +0000)
<http://webkit.org/b/140704>

Reviewed by Daniel Bates.

* Scripts/configure-xcode-for-ios-development:
- Update copyright.
- Remove FIXME addressed by r178709.
- Call copyMissingHeadersToIPhoneOSSDKIfNeeded().
(copyMissingHeadersToIPhoneOSSDKIfNeeded): Add method to copy
missing headers from iphonesimulator SDK to iphoneos SDK.
(sdkDirectory): Add method that returns SDK directory.
(sdkPlatformDirectory): Extract method from
xcodeSDKSpecificationsPath() that returns SDK platform
directory.
(xcodeSDKSpecificationsPath): Update to use
sdkPlatformDirectory().

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

Tools/ChangeLog
Tools/Scripts/configure-xcode-for-ios-development

index 5fc4ad16bf5ec5ae6e8b4984294f0ddce0d76adc..7b1f2e4c173e8776e2c7bbc8cae9513c8eae5185 100644 (file)
@@ -1,3 +1,23 @@
+2015-01-21  David Kilzer  <ddkilzer@apple.com>
+
+        [iOS] Update configure-xcode-for-ios-development to copy missing headers to iphoneos SDK
+        <http://webkit.org/b/140704>
+
+        Reviewed by Daniel Bates.
+
+        * Scripts/configure-xcode-for-ios-development:
+        - Update copyright.
+        - Remove FIXME addressed by r178709.
+        - Call copyMissingHeadersToIPhoneOSSDKIfNeeded().
+        (copyMissingHeadersToIPhoneOSSDKIfNeeded): Add method to copy
+        missing headers from iphonesimulator SDK to iphoneos SDK.
+        (sdkDirectory): Add method that returns SDK directory.
+        (sdkPlatformDirectory): Extract method from
+        xcodeSDKSpecificationsPath() that returns SDK platform
+        directory.
+        (xcodeSDKSpecificationsPath): Update to use
+        sdkPlatformDirectory().
+
 2015-01-21  Alexey Proskuryakov  <ap@apple.com>
 
         https://build.webkit.org/dashboard/metrics.html fails because of ios-ews
index e1f93d6f9c6432677f89de11dc2954f37d278684..17ce262ec5de29b1cb66ef467c8e17550fa80e37 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/perl -w
 
-# Copyright (C) 2014 Apple Inc. All rights reserved.
+# Copyright (C) 2014, 2015 Apple Inc. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
 # modification, are permitted provided that the following conditions
@@ -27,8 +27,6 @@
 # tool product- and package- type using the definitions in the OS X SDK for the
 # same types.
 
-# FIXME: We should also configure Xcode to support building a command line tool for an iOS device.
-
 use strict;
 use warnings;
 
@@ -38,8 +36,11 @@ use File::Find;
 use File::Spec;
 use File::Temp qw(tempfile);
 
+sub copyMissingHeadersToIPhoneOSSDKIfNeeded();
 sub createXcodeSpecificationFilesForSDKIfNeeded($);
 sub createXcodeSpecificationFromSpecificationAndId($$$);
+sub sdkDirectory($);
+sub sdkPlatformDirectory($);
 sub readXcodeSpecificationById($$);
 sub xcodeSDKSpecificationsPath($);
 
@@ -58,8 +59,40 @@ for my $sdk (qw(iphoneos iphonesimulator)) {
     createXcodeSpecificationFilesForSDKIfNeeded($sdk);
 }
 
+copyMissingHeadersToIPhoneOSSDKIfNeeded();
+
 exit 0;
 
+sub copyMissingHeadersToIPhoneOSSDKIfNeeded()
+{
+    my @missingHeaders = qw(
+        /usr/include/crt_externs.h
+        /usr/include/MacErrors.h
+        /usr/include/mach/mach_types.defs
+        /usr/include/mach/machine/machine_types.defs
+        /usr/include/mach/std_types.defs
+        /usr/include/objc/objc-class.h
+        /usr/include/objc/objc-runtime.h
+        /usr/include/objc/Protocol.h
+        /usr/include/readline/history.h
+        /usr/include/readline/readline.h
+        /usr/include/sqlite3_private.h
+    );
+
+    my $iphoneosSDKDirectory = sdkDirectory("iphoneos");
+    my $iphonesimulatorSDKDirectory = sdkDirectory("iphonesimulator");
+
+    for my $header (@missingHeaders) {
+        my $iphoneosSDKPath = File::Spec->canonpath(File::Spec->catfile($iphoneosSDKDirectory, $header));
+        next if (-f $iphoneosSDKPath);
+
+        my $iphonesimulatorSDKPath = File::Spec->canonpath(File::Spec->catfile($iphonesimulatorSDKDirectory, $header));
+        system("/usr/bin/ditto", $iphonesimulatorSDKPath, $iphoneosSDKPath);
+        die "Could not copy $iphonesimulatorSDKPath to $iphoneosSDKPath: $!" if exitStatus($?);
+        print "Successfully copied $iphonesimulatorSDKPath to $iphoneosSDKPath.\n";
+    }
+}
+
 sub createXcodeSpecificationFilesForSDKIfNeeded($)
 {
     my ($sdk) = @_;
@@ -119,6 +152,22 @@ sub createXcodeSpecificationFilesForSDKIfNeeded($)
     }
 }
 
+sub sdkDirectory($)
+{
+    my ($sdkName) = @_;
+    chomp(my $sdkDirectory = `xcrun --sdk '$sdkName' --show-sdk-path`);
+    die "Failed to get SDK path from xcrun: $!" if exitStatus($?);
+    return $sdkDirectory;
+}
+
+sub sdkPlatformDirectory($)
+{
+    my ($sdkName) = @_;
+    chomp(my $sdkPlatformDirectory = `xcrun --sdk '$sdkName' --show-sdk-platform-path`);
+    die "Failed to get SDK platform path from xcrun: $!" if exitStatus($?);
+    return $sdkPlatformDirectory;
+}
+
 sub writeXcodeSpecification($$)
 {
     my ($xcodeSpecificationFile, $specification) = @_;
@@ -177,10 +226,8 @@ sub readXcodeSpecificationById($$)
 sub xcodeSDKSpecificationsPath($)
 {
     my ($sdkName) = @_;
-    chomp(my $sdkPlatformDirectory = `xcrun --sdk '$sdkName' --show-sdk-platform-path`);
-    die "Failed to get SDK platform path from xcrun" if $?;
 
-    return File::Spec->catdir($sdkPlatformDirectory, "Developer", "Library", "Xcode", "Specifications");
+    return File::Spec->catdir(sdkPlatformDirectory($sdkName), "Developer", "Library", "Xcode", "Specifications");
 }
 
 sub createXcodeSpecificationFromSpecificationAndId($$$)