Build Skia for a bare-bones embedded Linux system.

Motivation:

    I have downloaded a barebones Linux system built for 64-bit ARM
    from linaro.org and a ARMv8 Foundation Model from arm.com to run
    it on.  This will let us build and test Skia on ARM64 before we
    aquire hardware to allow that.  This CL introduces the changes to
    the build files necessary to build Skia on a barebones embedded
    Linux system.  I tested it with the aarch64 GCC compiler provided
    by linaro.org.

Changes:

    Add a "barelinux" target_os for the DEPS file.  Add an optional
    git download of zlib.

    Changes to gyp files: these changes abstract out libpng, libz, and
    giflib so that images.gyp doesn't know whether they are static or
    dynamically linked.  I also add the variables skia_giflib_static,
    skia_libpng_static, skia_zlib_static, and skia_freetype_static,
    all of which default to false but when set to true will override
    the behavior of the giflib, libpng, zlib, and freetype build
    targets to require them to build statically.  Also, the
    skia_no_fontconfig variable turns off use of the fontconfig service.

	Scripts in platform_tools/barelinux/bin:

    arm64_download - this script downloads the Linaro's ARMv8 Aarch64
	toolchain and minimal embedded Linux system as well as ARM's
	foundation model.  The required files are mirrored on Google
	Cloud.  The script then starts a emulated Arm64 Linux system in
	the background.  After the boot is complete, you can SSH into the
	system at port 8022 via user@localhost.  The SSH key will be
	downloaded into the working directery as well.

	download_deps - Uses gclient to download Skia's dependencies for a
    bare Linux system (the normal dependecies plus giflib, libpng, and
    zlib.)

	barelinux_make - this script builds a version of skia that does
    not depend on external libraries, perfect for putting in an
    embedded system running Linux.  Assumes you have run download_deps
    first.

To test:
    To build a barelinux target, use the barelinux_make script.

    To build for a armv8 system: skia_arch_type=arm arm_neon=0 armv7=1
    armv8=1 arm_thumb=0 skia_arch_width=64 and set the CC and CXX
    variables to point at the cross-compiler downloaded by
    arm64_download.

R=djsollen@google.com, scroggo@google.com, borenet@google.com

Author: halcanary@google.com

Review URL: https://codereview.chromium.org/152513007

git-svn-id: http://skia.googlecode.com/svn/trunk@13570 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gyp/freetype.gyp b/gyp/freetype.gyp
index 6717c78..cd71e78 100644
--- a/gyp/freetype.gyp
+++ b/gyp/freetype.gyp
@@ -5,54 +5,71 @@
       'target_name': 'freetype',
       'type': 'none',
       'conditions': [
-        [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "chromeos"]', {
-          'direct_dependent_settings': {
-            'include_dirs' : [
-              '/usr/include/freetype2',
+        [ 'skia_freetype_static',
+          {
+            'dependencies': [
+              'freetype_static'
             ],
-            'link_settings': {
-              'libraries': [
-                '-lfreetype',
+            'export_dependent_settings': [
+              'freetype_static'
+            ],
+            'conditions': [
+              [ 'skia_os in ["android", "nacl"]',
+                {
+                  'direct_dependent_settings': {
+                    'defines': [
+                      # Both Android and NaCl provide at least FreeType 2.4.0
+                      'SK_FONTHOST_FREETYPE_RUNTIME_VERSION=0x020400',
+                      'SK_CAN_USE_DLOPEN=0',
+                    ],
+                  }
+                }
+              ]
+            ],
+          }, { # (not skia_freetype_static)
+            # dynamic linking depends on the OS:
+            'conditions': [
+              [ 'skia_os in ["linux", "freebsd", "openbsd", "solaris", "chromeos"]',
+                {
+                  'direct_dependent_settings': {
+                    'include_dirs' : [
+                      '/usr/include/freetype2',
+                    ],
+                    'link_settings': {
+                      'libraries': [
+                        '-lfreetype',
+                      ],
+                    },
+                    'defines': [
+                      # The font host requires at least FreeType 2.3.0
+                      # at runtime.
+                      'SK_FONTHOST_FREETYPE_RUNTIME_VERSION=0x020300',
+                      'SK_CAN_USE_DLOPEN=1',
+                    ],
+                  }
+                },
               ],
-              'defines': [
-                #The font host requires at least FreeType 2.3.0 at runtime.
-                'SK_FONTHOST_FREETYPE_RUNTIME_VERSION=0x020300',\
-                'SK_CAN_USE_DLOPEN=1',
+              [ 'skia_android_framework',
+                {
+                  'direct_dependent_settings': {
+                    'defines': [
+                      # Android provides at least FreeType 2.4.0
+                      'SK_FONTHOST_FREETYPE_RUNTIME_VERSION=0x020400',
+                      'SK_CAN_USE_DLOPEN=0',
+                    ],
+                  },
+                  'include_dirs': [
+                    'external/expat/lib',
+                    'external/freetype/include',
+                  ],
+                  'libraries': [
+                    '-lft2',
+                  ],
+                }
               ],
-            }
-          },
-        }],
-        [ 'skia_os in ["android", "nacl"]', {
-          'dependencies': [
-            'freetype_static'
-          ],
-          'export_dependent_settings': [
-            'freetype_static'
-          ],
-          'direct_dependent_settings': {
-            'defines': [
-              # Both Android and NaCl provide at least FreeType 2.4.0
-              'SK_FONTHOST_FREETYPE_RUNTIME_VERSION=0x020400',
-              'SK_CAN_USE_DLOPEN=0',
             ],
-          },
-        }],
-        [ 'skia_android_framework', {
-            'include_dirs': [
-              'external/expat/lib',
-              'external/freetype/include',
-            ],
-            'libraries': [
-              '-lft2',
-            ],
-            # Remove these, and use the system's freetype instead.
-            'dependencies!': [
-              'freetype_static',
-            ],
-            'export_dependent_settings!': [
-              'freetype_static',
-            ]
-        }],
+          }
+        ],
       ],
     },
     {
@@ -61,7 +78,7 @@
       'standalone_static_library': 1,
       'dependencies': [
         # we are dependent upon PNG for color emoji glyphs
-        'images.gyp:images'
+        'libpng.gyp:libpng',
       ],
       'includes': [
         # common freetype sources needed for both the base Skia build and the