Add NaCl port of Skia

Initial commit. This is far from done.
Review URL: https://codereview.appspot.com/6428064

git-svn-id: http://skia.googlecode.com/svn/trunk@5398 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gyp/common_variables.gypi b/gyp/common_variables.gypi
index 4e4c43c..3226212 100644
--- a/gyp/common_variables.gypi
+++ b/gyp/common_variables.gypi
@@ -71,6 +71,7 @@
       'skia_arch_type%': 'x86',
       'skia_directwrite%': 0,
       'android_make_apk%': 1,
+      'skia_nacl%': 0,
       'skia_gpu%': 1,
       'skia_static_initializers%': 1,
     },
@@ -87,6 +88,7 @@
     'skia_arch_width%': '<(skia_arch_width)',
     'skia_directwrite%': '<(skia_directwrite)',
     'android_make_apk%': '<(android_make_apk)',
+    'skia_nacl%': '<(skia_nacl)',
     'skia_gpu%': '<(skia_gpu)',
     'skia_static_initializers%': '<(skia_static_initializers)',
 
diff --git a/gyp/ports.gyp b/gyp/ports.gyp
index f070ac6..3f8140d 100644
--- a/gyp/ports.gyp
+++ b/gyp/ports.gyp
@@ -37,23 +37,36 @@
       ],
       'conditions': [
         [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris"]', {
-          'defines': [
-            #The font host requires at least FreeType 2.3.0 at runtime.
-            'SK_FONTHOST_FREETYPE_RUNTIME_VERSION=0x020300',
-            'SK_CAN_USE_DLOPEN=1',
+          'conditions': [
+            [ 'skia_nacl', {
+              'defines': [
+                'SK_CAN_USE_DLOPEN=0',
+              ],
+              'sources': [
+                '../src/ports/SkFontHost_none.cpp',
+              ],
+            }, {
+              'defines': [
+                #The font host requires at least FreeType 2.3.0 at runtime.
+                'SK_FONTHOST_FREETYPE_RUNTIME_VERSION=0x020300',
+                'SK_CAN_USE_DLOPEN=1',
+              ],
+              'sources': [
+                '../src/ports/SkFontHost_FreeType.cpp',
+                '../src/ports/SkFontHost_FreeType_common.cpp',
+                '../src/ports/SkFontHost_linux.cpp',
+              ],
+              'link_settings': {
+                'libraries': [
+                  '-lfreetype',
+                  '-ldl',
+                ],
+              },
+            }],
           ],
           'sources': [
             '../src/ports/SkThread_pthread.cpp',
-            '../src/ports/SkFontHost_FreeType.cpp',
-            '../src/ports/SkFontHost_FreeType_common.cpp',
-            '../src/ports/SkFontHost_linux.cpp',
           ],
-          'link_settings': {
-            'libraries': [
-              '-lfreetype',
-              '-ldl',
-            ],
-          },
         }],
         [ 'skia_os == "mac"', {
           'include_dirs': [
diff --git a/gyp/utils.gyp b/gyp/utils.gyp
index 9cfe46e..49b4599 100644
--- a/gyp/utils.gyp
+++ b/gyp/utils.gyp
@@ -164,6 +164,14 @@
             '../src/utils/win/SkIStream.cpp',
           ],
         }],
+        [ 'skia_nacl == 1', {
+          'sources': [
+            '../src/utils/SkThreadUtils_pthread_other.cpp',
+          ],
+          'sources!': [
+            '../src/utils/SkThreadUtils_pthread_linux.cpp',
+          ],
+        }],
       ],
       'direct_dependent_settings': {
         'include_dirs': [