first cut at making iOS work

Replace __arm__ with SK_CPU_ARM
add support for iOS simulator and device
fix const warning in iOSSampleApp
update gyp files

https://code.google.com/p/skia/issues/detail?id=900
tracks fixing missing arm assembly
Review URL: https://codereview.appspot.com/6552045

git-svn-id: http://skia.googlecode.com/svn/trunk@5606 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/experimental/iOSSampleApp/Shared/SkOptionsTableViewController.h b/experimental/iOSSampleApp/Shared/SkOptionsTableViewController.h
index 2c9f391..13d6c1b 100644
--- a/experimental/iOSSampleApp/Shared/SkOptionsTableViewController.h
+++ b/experimental/iOSSampleApp/Shared/SkOptionsTableViewController.h
@@ -29,8 +29,8 @@
 @property (nonatomic, retain) SkOptionListItem* fCurrentList;
 
 - (void)registerMenus:(const SkTDArray<SkOSMenu*>*)menus;
-- (void)updateMenu:(const SkOSMenu*)menu;
-- (void)loadMenu:(const SkOSMenu*)menu;
+- (void)updateMenu:(SkOSMenu*)menu;
+- (void)loadMenu:(SkOSMenu*)menu;
 
 - (UITableViewCell*)createAction:(NSString*)title;
 - (UITableViewCell*)createSlider:(NSString*)title min:(float)min max:(float)max default:(float)value;
diff --git a/experimental/iOSSampleApp/Shared/SkOptionsTableViewController.mm b/experimental/iOSSampleApp/Shared/SkOptionsTableViewController.mm
index acf70b8..4383976 100644
--- a/experimental/iOSSampleApp/Shared/SkOptionsTableViewController.mm
+++ b/experimental/iOSSampleApp/Shared/SkOptionsTableViewController.mm
@@ -1,5 +1,6 @@
 #import "SkOptionsTableViewController.h"
 #include "SkEvent.h"
+#include "SkTArray.h"
 
 @implementation SkOptionItem
 @synthesize fCell, fItem;
@@ -31,7 +32,7 @@
 
 //SkUIViewOptionsDelegate
 - (void) view:(SkUIView*)view didAddMenu:(const SkOSMenu*)menu {}
-- (void) view:(SkUIView*)view didUpdateMenu:(const SkOSMenu*)menu {
+- (void) view:(SkUIView*)view didUpdateMenu:(SkOSMenu*)menu {
     [self updateMenu:menu];
 }
 
@@ -65,7 +66,7 @@
     [self.tableView reloadData];
 }
 
-- (void)loadMenu:(const SkOSMenu*)menu {
+- (void)loadMenu:(SkOSMenu*)menu {
     const SkOSMenu::Item* menuitems[menu->getCount()];
     menu->getItems(menuitems);
     for (int i = 0; i < menu->getCount(); ++i) {
@@ -81,8 +82,9 @@
             
             int count = 0;
             SkOSMenu::FindListItemCount(*item->getEvent(), &count);
-            SkString options[count];
-            SkOSMenu::FindListItems(*item->getEvent(), options);
+            SkTArray<SkString> options;
+            options.resize_back(count);
+            SkOSMenu::FindListItems(*item->getEvent(), &options.front());
             for (int i = 0; i < count; ++i)
                 [List.fOptions addOption:[NSString stringWithUTF8String:options[i].c_str()]];
             SkOSMenu::FindListIndex(*item->getEvent(), item->getSlotName(), &value);
diff --git a/experimental/iOSSampleApp/Shared/SkUIView.h b/experimental/iOSSampleApp/Shared/SkUIView.h
index c88b2fe..a0640d4 100644
--- a/experimental/iOSSampleApp/Shared/SkUIView.h
+++ b/experimental/iOSSampleApp/Shared/SkUIView.h
@@ -20,7 +20,7 @@
 @optional
 // Called when the view needs to handle adding an SkOSMenu
 - (void) view:(SkUIView*)view didAddMenu:(const SkOSMenu*)menu;
-- (void) view:(SkUIView*)view didUpdateMenu:(const SkOSMenu*)menu;
+- (void) view:(SkUIView*)view didUpdateMenu:(SkOSMenu*)menu;
 @end
 
 @interface SkUIView : UIView  {
@@ -40,7 +40,7 @@
 
 - (void)setSkTitle:(const char*)title;
 - (void)onAddMenu:(const SkOSMenu*)menu;
-- (void)onUpdateMenu:(const SkOSMenu*)menu;
+- (void)onUpdateMenu:(SkOSMenu*)menu;
 - (void)postInvalWithRect:(const SkIRect*)rectOrNil;
 - (BOOL)onHandleEvent:(const SkEvent&)event;
 @end
diff --git a/experimental/iOSSampleApp/Shared/SkUIView.mm b/experimental/iOSSampleApp/Shared/SkUIView.mm
index 50d1954..835e970 100644
--- a/experimental/iOSSampleApp/Shared/SkUIView.mm
+++ b/experimental/iOSSampleApp/Shared/SkUIView.mm
@@ -97,7 +97,7 @@
 - (void)onAddMenu:(const SkOSMenu*)menu {
     [self.fOptionsDelegate view:self didAddMenu:menu];
 }
-- (void)onUpdateMenu:(const SkOSMenu*)menu {
+- (void)onUpdateMenu:(SkOSMenu*)menu {
     [self.fOptionsDelegate view:self didUpdateMenu:menu];
 }
 
diff --git a/gyp/SampleApp.gyp b/gyp/SampleApp.gyp
index ac5c87f..753d374 100644
--- a/gyp/SampleApp.gyp
+++ b/gyp/SampleApp.gyp
@@ -204,28 +204,75 @@
             '../samplecode/SampleDecode.cpp',
           ],
           'sources': [
-            '../experimental/iOSSampleApp/SkIOSNotifier.mm',
-            '../experimental/iOSSampleApp/SkTime_iOS.mm',
-            '../experimental/iOSSampleApp/SkUIDetailViewController.mm',
-            '../experimental/iOSSampleApp/SkUIRootViewController.mm',
-            '../experimental/iOSSampleApp/SkUIView_shell.mm',
-
+            '../src/views/mac/SkEventNotifier.h',
+            '../src/views/mac/SkEventNotifier.mm',
+            '../experimental/iOSSampleApp/SkiOSSampleApp-Base.xcconfig',
+            '../experimental/iOSSampleApp/SkiOSSampleApp-Debug.xcconfig',
+            '../experimental/iOSSampleApp/SkiOSSampleApp-Release.xcconfig',
+            '../experimental/iOSSampleApp/iOSSampleApp-Info.plist',
             '../experimental/iOSSampleApp/iOSSampleApp_Prefix.pch',
-            '../experimental/iOSSampleApp/Shared/main.m',
+            '../experimental/iOSSampleApp/Shared/SkOptionListController.h',
+            '../experimental/iOSSampleApp/Shared/SkOptionListController.mm',
+            '../experimental/iOSSampleApp/Shared/SkUIRootViewController.h',
+            '../experimental/iOSSampleApp/Shared/SkUIRootViewController.mm',
+            '../experimental/iOSSampleApp/Shared/SkOptionsTableViewController.h',
+            '../experimental/iOSSampleApp/Shared/SkOptionsTableViewController.mm',
+            '../experimental/iOSSampleApp/Shared/SkUIView.h',
+            '../experimental/iOSSampleApp/Shared/SkUIView.mm',
+            '../experimental/iOSSampleApp/Shared/SkUIDetailViewController.h',
+            '../experimental/iOSSampleApp/Shared/SkUIDetailViewController.mm',
+            '../experimental/iOSSampleApp/Shared/skia_ios.mm',
+
+            # iPad
+            '../experimental/iOSSampleApp/iPad/AppDelegate_iPad.h',
             '../experimental/iOSSampleApp/iPad/AppDelegate_iPad.mm',
+            '../experimental/iOSSampleApp/iPad/SkUISplitViewController.h',
             '../experimental/iOSSampleApp/iPad/SkUISplitViewController.mm',
+            '../experimental/iOSSampleApp/iPad/MainWindow_iPad.xib',
+
+            # iPhone
+            '../experimental/iOSSampleApp/iPhone/AppDelegate_iPhone.h',
             '../experimental/iOSSampleApp/iPhone/AppDelegate_iPhone.mm',
+            '../experimental/iOSSampleApp/iPhone/SkUINavigationController.h',
             '../experimental/iOSSampleApp/iPhone/SkUINavigationController.mm',
+            '../experimental/iOSSampleApp/iPhone/MainWindow_iPhone.xib',
 
             '../src/views/ios/SkOSWindow_iOS.mm',
             '../src/utils/ios/SkImageDecoder_iOS.mm',
             '../src/utils/ios/SkStream_NSData.mm',
             '../src/utils/ios/SkOSFile_iOS.mm',
 
+            '../include/utils/mac/SkCGUtils.h',
             '../src/utils/mac/SkCreateCGImageRef.cpp',
             '../experimental/iOSSampleApp/SkiOSSampleApp-Debug.xcconfig',
             '../experimental/iOSSampleApp/SkiOSSampleApp-Release.xcconfig',
           ],
+          'link_settings': {
+            'variables': {
+              'ios_sdk_version%': '5.1',
+            },
+            'conditions' : [
+              [ 'skia_arch_type == "x86"', {
+                'variables': {
+                  'ios_sdk_dir%': '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator',
+                },
+              }],
+              [ 'skia_arch_type == "arm"', {
+                'variables': {
+                  'ios_sdk_dir%': '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS',
+                },
+              }],
+            ],
+            'libraries': [
+              '<(ios_sdk_dir)<(ios_sdk_version).sdk/System/Library/Frameworks/CoreFoundation.framework',
+              '<(ios_sdk_dir)<(ios_sdk_version).sdk/System/Library/Frameworks/CoreGraphics.framework',
+              '<(ios_sdk_dir)<(ios_sdk_version).sdk/System/Library/Frameworks/CoreText.framework',
+              '<(ios_sdk_dir)<(ios_sdk_version).sdk/System/Library/Frameworks/UIKit.framework',
+              '<(ios_sdk_dir)<(ios_sdk_version).sdk/System/Library/Frameworks/Foundation.framework',
+              '<(ios_sdk_dir)<(ios_sdk_version).sdk/System/Library/Frameworks/QuartzCore.framework',
+              '<(ios_sdk_dir)<(ios_sdk_version).sdk/System/Library/Frameworks/OpenGLES.framework',
+            ],
+          },
           'include_dirs' : [
             '../experimental/iOSSampleApp',
             '../experimental/iOSSampleApp/iPad',
diff --git a/gyp/common_conditions.gypi b/gyp/common_conditions.gypi
index f798360..c63095c 100644
--- a/gyp/common_conditions.gypi
+++ b/gyp/common_conditions.gypi
@@ -221,7 +221,12 @@
           },
         },
         'xcode_settings': {
+          'ARCHS': 'armv7',
+          'CODE_SIGNING_REQUIRED': 'NO',
+          'CODE_SIGN_IDENTITY[sdk=iphoneos*]': '',
           'SYMROOT': '<(DEPTH)/xcodebuild',
+          'SDKROOT': 'iphoneos',
+          'OTHER_CPLUSPLUSFLAGS': '-fvisibility=hidden -fvisibility-inlines-hidden',
         },
       },
     ],
diff --git a/gyp/core.gyp b/gyp/core.gyp
index 1982a90..b565c08 100644
--- a/gyp/core.gyp
+++ b/gyp/core.gyp
@@ -57,14 +57,29 @@
             '../include/utils/mac/SkCGUtils.h',
           ],
           'link_settings': {
+            'variables': {
+              'ios_sdk_version%': '5.1',
+            },
+            'conditions' : [
+              [ 'skia_arch_type == "x86"', {
+                'variables': {
+                  'ios_sdk_dir%': '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator',
+                },
+              }],
+              [ 'skia_arch_type == "arm"', {
+                'variables': {
+                  'ios_sdk_dir%': '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS',
+                },
+              }],
+            ],
             'libraries': [
-              '/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/System/Library/Frameworks/CoreFoundation.framework',
-              '/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/System/Library/Frameworks/CoreGraphics.framework',
-              '/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/System/Library/Frameworks/CoreText.framework',
-              '/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/System/Library/Frameworks/UIKit.framework',
-              '/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/System/Library/Frameworks/Foundation.framework',
-              '/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/System/Library/Frameworks/QuartzCore.framework',
-              '/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/System/Library/Frameworks/OpenGLES.framework',
+              '<(ios_sdk_dir)<(ios_sdk_version).sdk/System/Library/Frameworks/CoreFoundation.framework',
+              '<(ios_sdk_dir)<(ios_sdk_version).sdk/System/Library/Frameworks/CoreGraphics.framework',
+              '<(ios_sdk_dir)<(ios_sdk_version).sdk/System/Library/Frameworks/CoreText.framework',
+              '<(ios_sdk_dir)<(ios_sdk_version).sdk/System/Library/Frameworks/UIKit.framework',
+              '<(ios_sdk_dir)<(ios_sdk_version).sdk/System/Library/Frameworks/Foundation.framework',
+              '<(ios_sdk_dir)<(ios_sdk_version).sdk/System/Library/Frameworks/QuartzCore.framework',
+              '<(ios_sdk_dir)<(ios_sdk_version).sdk/System/Library/Frameworks/OpenGLES.framework',
             ],
           },
         }],
diff --git a/gyp/opts.gyp b/gyp/opts.gyp
index 2ac395c..d5a4b9d 100644
--- a/gyp/opts.gyp
+++ b/gyp/opts.gyp
@@ -28,7 +28,7 @@
         '../src/opts',
       ],
       'conditions': [
-        [ 'skia_arch_type == "x86"', {
+        [ 'skia_arch_type == "x86" and skia_os != "ios"', {
           'conditions': [
             [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris"]', {
               'cflags': [
@@ -71,10 +71,16 @@
               'dependencies': [
                 'opts_neon',
               ]
-            }]
+            }],
+            [ 'skia_os == "ios"', {
+              'sources!': [
+                # this needs to be rewritten to be xcode-friendly
+                '../src/opts/memset.arm.S',
+              ],
+            }],
           ],
         }],
-        [ 'skia_arch_type == "arm" and armv7 != 1', {
+        [ '(skia_arch_type == "arm" and armv7 == 0) or (skia_arch_type == "x86" and skia_os == "ios")', {
           'sources': [
             '../src/opts/SkBitmapProcState_opts_none.cpp',
             '../src/opts/SkBlitRow_opts_none.cpp',
diff --git a/gyp/ports.gyp b/gyp/ports.gyp
index cc301b6..1aa112f 100644
--- a/gyp/ports.gyp
+++ b/gyp/ports.gyp
@@ -92,8 +92,12 @@
           ],
           'sources': [
             '../src/ports/SkFontHost_mac_coretext.cpp',
+            '../src/utils/mac/SkStream_mac.cpp',
             '../src/ports/SkThread_pthread.cpp',
           ],
+          'sources!': [
+            '../src/ports/SkFontHost_tables.cpp',
+          ],
         }],
         [ 'skia_os == "win"', {
           'include_dirs': [
diff --git a/include/core/SkFixed.h b/include/core/SkFixed.h
index c15d469..0f8f758 100644
--- a/include/core/SkFixed.h
+++ b/include/core/SkFixed.h
@@ -190,7 +190,7 @@
     #define SkFixedSquare(a)    SkFixedSquare_longlong(a)
 #endif
 
-#if defined(__arm__) && !defined(__thumb__)
+#if defined(SK_CPU_ARM) && !defined(__thumb__)
     /* This guy does not handle NaN or other obscurities, but is faster than
        than (int)(x*65536) when we only have software floats
     */
diff --git a/include/core/SkMath.h b/include/core/SkMath.h
index e8d8f76..35f7eda 100644
--- a/include/core/SkMath.h
+++ b/include/core/SkMath.h
@@ -40,7 +40,7 @@
 //! Returns the number of leading zero bits (0...32)
 int SkCLZ_portable(uint32_t);
 
-#if defined(__arm__)
+#if defined(SK_CPU_ARM)
     #define SkCLZ(x)    __builtin_clz(x)
 #endif
 
diff --git a/include/core/SkOSFile.h b/include/core/SkOSFile.h
index 45d9d66..b5477cd 100644
--- a/include/core/SkOSFile.h
+++ b/include/core/SkOSFile.h
@@ -13,7 +13,7 @@
 
 #include "SkString.h"
 
-#if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_UNIX) || defined(SK_BUILD_FOR_ANDROID)
+#if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_UNIX) || defined(SK_BUILD_FOR_ANDROID) || defined(SK_BUILD_FOR_IOS)
     #include <dirent.h>
 #endif
 
@@ -58,7 +58,7 @@
 #ifdef SK_BUILD_FOR_WIN
         HANDLE      fHandle;
         uint16_t*   fPath16;
-#elif defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_UNIX) || defined(SK_BUILD_FOR_ANDROID)
+#elif defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_UNIX) || defined(SK_BUILD_FOR_ANDROID) || defined(SK_BUILD_FOR_IOS)
         DIR*        fDIR;
         SkString    fPath, fSuffix;
 #endif
diff --git a/include/core/SkPostConfig.h b/include/core/SkPostConfig.h
index cc00f79..cbfe9b1 100644
--- a/include/core/SkPostConfig.h
+++ b/include/core/SkPostConfig.h
@@ -285,7 +285,7 @@
 #ifndef SK_OVERRIDE
     #if defined(_MSC_VER)
         #define SK_OVERRIDE override
-    #elif defined(__clang__)
+    #elif defined(__clang__) && !defined(SK_BUILD_FOR_IOS)
         #if __has_feature(cxx_override_control)
             // Some documentation suggests we should be using __attribute__((override)),
             // but it doesn't work.
@@ -326,48 +326,3 @@
 #ifndef SK_ALLOW_STATIC_GLOBAL_INITIALIZERS
 #define SK_ALLOW_STATIC_GLOBAL_INITIALIZERS 1
 #endif
-
-//////////////////////////////////////////////////////////////////////
-// ARM defines
-
-#if defined(__GNUC__) && defined(__arm__)
-
-#  define SK_ARM_ARCH 3
-
-#  if defined(__ARM_ARCH_4__) || defined(__ARM_ARCH_4T__) \
-   || defined(_ARM_ARCH_4)
-#    undef SK_ARM_ARCH
-#    define SK_ARM_ARCH 4
-#  endif
-
-#  if defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5T__) \
-   || defined(__ARM_ARCH_5E__) || defined(__ARM_ARCH_5TE__) \
-   || defined(__ARM_ARCH_5TEJ__) || defined(_ARM_ARCH_5)
-#    undef SK_ARM_ARCH
-#    define SK_ARM_ARCH 5
-#  endif
-
-#  if defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) \
-   || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) \
-   || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__) \
-   || defined(__ARM_ARCH_6M__) || defined(_ARM_ARCH_6)
-#    undef SK_ARM_ARCH
-#    define SK_ARM_ARCH 6
-#  endif
-
-#  if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) \
-   || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) \
-   || defined(__ARM_ARCH_7EM__) || defined(_ARM_ARCH_7)
-#    undef SK_ARM_ARCH
-#    define SK_ARM_ARCH 7
-#  endif
-
-#  undef SK_ARM_HAS_EDSP
-#  if defined(__thumb2__) && (SK_ARM_ARCH >= 6) \
-   || !defined(__thumb__) \
-   && ((SK_ARM_ARCH > 5) || defined(__ARM_ARCH_5E__) \
-       || defined(__ARM_ARCH_5TE__) || defined(__ARM_ARCH_5TEJ__))
-#    define SK_ARM_HAS_EDSP 1
-#  endif
-
-#endif
diff --git a/include/core/SkPreConfig.h b/include/core/SkPreConfig.h
index 14767f6..756aaea 100644
--- a/include/core/SkPreConfig.h
+++ b/include/core/SkPreConfig.h
@@ -144,6 +144,40 @@
 #endif
 
 //////////////////////////////////////////////////////////////////////
+// ARM defines
+
+#if defined(__arm__) && (!defined(__APPLE__) || !TARGET_IPHONE_SIMULATOR)
+    #define SK_CPU_ARM
+
+    #if defined(__GNUC__)
+        #if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) \
+                || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) \
+                || defined(__ARM_ARCH_7EM__) || defined(_ARM_ARCH_7)
+            #define SK_ARM_ARCH 7
+        #elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) \
+                || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) \
+                || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__) \
+                || defined(__ARM_ARCH_6M__) || defined(_ARM_ARCH_6)
+            #define SK_ARM_ARCH 6
+        #elif defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5T__) \
+                || defined(__ARM_ARCH_5E__) || defined(__ARM_ARCH_5TE__) \
+                || defined(__ARM_ARCH_5TEJ__) || defined(_ARM_ARCH_5)
+            #define SK_ARM_ARCH 5
+        #elif defined(__ARM_ARCH_4__) || defined(__ARM_ARCH_4T__) || defined(_ARM_ARCH_4)
+            #define SK_ARM_ARCH 4
+        #else
+            #define SK_ARM_ARCH 3
+        #endif
+
+        #if defined(__thumb2__) && (SK_ARM_ARCH >= 6) \
+                || !defined(__thumb__) && ((SK_ARM_ARCH > 5) || defined(__ARM_ARCH_5E__) \
+                || defined(__ARM_ARCH_5TE__) || defined(__ARM_ARCH_5TEJ__))
+            #define SK_ARM_HAS_EDSP
+        #endif
+    #endif
+#endif
+
+//////////////////////////////////////////////////////////////////////
 
 /**
  *  THUMB is the only known config where we avoid small branches in
diff --git a/include/views/SkOSWindow_iOS.h b/include/views/SkOSWindow_iOS.h
index a1c4956..eda7c5f 100755
--- a/include/views/SkOSWindow_iOS.h
+++ b/include/views/SkOSWindow_iOS.h
@@ -35,7 +35,7 @@
     virtual void onHandleInval(const SkIRect&);
     // overrides from SkView
     virtual void onAddMenu(const SkOSMenu*);
-    virtual void onUpdateMenu(const SkOSMenu*);
+    virtual void onUpdateMenu(SkOSMenu*);
     virtual void onSetTitle(const char[]);
 
 private:
diff --git a/src/core/SkUtilsArm.h b/src/core/SkUtilsArm.h
index 6a5aab8..9ae648a 100644
--- a/src/core/SkUtilsArm.h
+++ b/src/core/SkUtilsArm.h
@@ -21,9 +21,9 @@
 #define SK_ARM_NEON_MODE_ALWAYS   1
 #define SK_ARM_NEON_MODE_DYNAMIC  2
 
-#if defined(__arm__) && defined(__ARM_HAVE_OPTIONAL_NEON_SUPPORT)
+#if defined(SK_CPU_ARM) && defined(__ARM_HAVE_OPTIONAL_NEON_SUPPORT)
 #  define SK_ARM_NEON_MODE  SK_ARM_NEON_MODE_DYNAMIC
-#elif defined(__arm__) && defined(__ARM_HAVE_NEON)
+#elif defined(SK_CPU_ARM) && defined(__ARM_HAVE_NEON)
 #  define SK_ARM_NEON_MODE  SK_ARM_NEON_MODE_ALWAYS
 #else
 #  define SK_ARM_NEON_MODE  SK_ARM_NEON_MODE_NONE
diff --git a/src/opts/opts_check_arm.cpp b/src/opts/opts_check_arm.cpp
index cd0f626..69cedb2 100644
--- a/src/opts/opts_check_arm.cpp
+++ b/src/opts/opts_check_arm.cpp
@@ -29,7 +29,8 @@
 #endif
 
 SkMemset16Proc SkMemset16GetPlatformProc() {
-#if !defined(SK_CPU_LENDIAN)
+    // FIXME: memset.arm.S is using syntax incompatible with XCode
+#if !defined(SK_CPU_LENDIAN) || defined(SK_BUILD_FOR_IOS)
     return NULL;
 #elif SK_ARM_NEON_IS_DYNAMIC
     if (sk_cpu_arm_has_neon()) {
@@ -45,7 +46,8 @@
 }
 
 SkMemset32Proc SkMemset32GetPlatformProc() {
-#if !defined(SK_CPU_LENDIAN)
+    // FIXME: memset.arm.S is using syntax incompatible with XCode
+#if !defined(SK_CPU_LENDIAN) || defined(SK_BUILD_FOR_IOS)
     return NULL;
 #elif SK_ARM_NEON_IS_DYNAMIC
     if (sk_cpu_arm_has_neon()) {
diff --git a/src/utils/SkDumpCanvas.cpp b/src/utils/SkDumpCanvas.cpp
index f1af88f..b3f463d 100644
--- a/src/utils/SkDumpCanvas.cpp
+++ b/src/utils/SkDumpCanvas.cpp
@@ -138,11 +138,11 @@
                         byteLen > 32 ? "..." : "");
             break;
         case SkPaint::kUTF16_TextEncoding:
-            str->appendf("\"%.*S\"%s", SkMax32(byteLen, 32), (const wchar_t*) text,
+            str->appendf("\"%.*ls\"%s", SkMax32(byteLen, 32), (const wchar_t*) text,
                         byteLen > 64 ? "..." : "");
             break;
         case SkPaint::kUTF32_TextEncoding:
-            str->appendf("\"%.*S\"%s", SkMax32(byteLen, 32), (const wchar_t*) text,
+            str->appendf("\"%.*ls\"%s", SkMax32(byteLen, 32), (const wchar_t*) text,
                         byteLen > 128 ? "..." : "");
             break;
         case SkPaint::kGlyphID_TextEncoding:
diff --git a/src/utils/SkOSFile.cpp b/src/utils/SkOSFile.cpp
index 7c2b024..1fec35a 100644
--- a/src/utils/SkOSFile.cpp
+++ b/src/utils/SkOSFile.cpp
@@ -132,7 +132,7 @@
     return fHandle != (HANDLE)~0 && get_the_file(fHandle, name, dataPtr, getDir);
 }
 
-#elif defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_UNIX) || defined(SK_BUILD_FOR_ANDROID)
+#elif defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_UNIX) || defined(SK_BUILD_FOR_ANDROID) || defined(SK_BUILD_FOR_IOS)
 
 #if 0
 OSStatus FSPathMakeRef (
diff --git a/src/views/ios/SkOSWindow_iOS.mm b/src/views/ios/SkOSWindow_iOS.mm
index 8813625..6fac765 100755
--- a/src/views/ios/SkOSWindow_iOS.mm
+++ b/src/views/ios/SkOSWindow_iOS.mm
@@ -50,7 +50,7 @@
     [(SkUIView*)fHWND onAddMenu:menu];
 }
 
-void SkOSWindow::onUpdateMenu(const SkOSMenu* menu) {
+void SkOSWindow::onUpdateMenu(SkOSMenu* menu) {
     [(SkUIView*)fHWND onUpdateMenu:menu];
 }