Improve NaCl support

- Add nacl_make script to build Skia targets for NaCl using gyp
- Add nacl_interface for command-line apps
- Add nacl_sample as front-end for SampleApp
- Add freetype to DEPS
- Various gyp tweaks for NaCl

TODO:
- Implement GL interface
- Implement font host
- Fix plumbing so that SampleApp works properly
Review URL: https://codereview.appspot.com/6671044

git-svn-id: http://skia.googlecode.com/svn/trunk@6245 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gyp/ports.gyp b/gyp/ports.gyp
index f743ad4..6403693 100644
--- a/gyp/ports.gyp
+++ b/gyp/ports.gyp
@@ -20,6 +20,7 @@
         '../src/utils',
       ],
       'sources': [
+        '../src/ports/SkDebug_nacl.cpp',
         '../src/ports/SkDebug_stdio.cpp',
         '../src/ports/SkDebug_win.cpp',
         '../src/ports/SkFontDescriptor.h',
@@ -39,36 +40,51 @@
       ],
       'conditions': [
         [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris"]', {
-          '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',
-                ],
-              },
-            }],
+          'defines': [
+            #The font host requires at least FreeType 2.3.0 at runtime.
+            'SK_FONTHOST_FREETYPE_RUNTIME_VERSION=0x020300',\
+            'SK_CAN_USE_DLOPEN=1',
+          ],
+          'link_settings': {
+            'libraries': [
+              '-lfreetype',
+              '-ldl',
+            ],
+          },
+          'sources': [
+            '../src/ports/SkFontHost_FreeType.cpp',
+            '../src/ports/SkFontHost_FreeType_common.cpp',
+            '../src/ports/SkFontHost_linux.cpp',
+            '../src/ports/SkThread_pthread.cpp',
+          ],
+        }],
+        [ 'skia_os == "nacl"', {
+          'dependencies': [
+            # On other OS, we can dynamically link against freetype.  For nacl,
+            # we have to include our own version since the naclports version is
+            # too old (<0x020300) to provide the functionality we need.
+            'freetype.gyp:freetype',
+          ],
+          'export_dependent_settings': [
+            'freetype.gyp:freetype',
+          ],
+          'defines': [
+            # We use Android's repo, which provides at least FreeType 2.4.0
+            'SK_FONTHOST_FREETYPE_RUNTIME_VERSION=0x020400',\
           ],
           'sources': [
+            '../src/ports/SkFontHost_FreeType.cpp',
+            '../src/ports/SkFontHost_FreeType_common.cpp',
+            '../src/ports/SkFontHost_linux.cpp',
             '../src/ports/SkThread_pthread.cpp',
           ],
+          'sources!': [
+            '../src/ports/SkDebug_stdio.cpp',
+          ],
+        }, {
+          'sources!': [
+            '../src/ports/SkDebug_nacl.cpp',
+          ],
         }],
         [ 'skia_os == "mac"', {
           'include_dirs': [
@@ -150,7 +166,7 @@
             #TODO: include the ports/SkImageRef_ashmem.cpp for non-NDK builds
           ],
           'dependencies': [
-             'android_deps.gyp:ft2',
+             'freetype.gyp:freetype',
              'android_deps.gyp:expat',
           ],
         }],