Make src/effects explicitly optional.

This adds a GN argument to disable src/effects, which can cut about 1M
off libskia.  It's not the first place you'd go to trim code size, but
after turning off easy big things like Ganesh, it starts looking big.

I tested that fiddle builds and links.  It uses Skia but not effects.
Most of our test apps use effects and can't build in this new mode.

Change-Id: I9b5d6e9289a87bc08eedf6d202d0eabe754da41a
Reviewed-on: https://skia-review.googlesource.com/8263
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
diff --git a/BUILD.gn b/BUILD.gn
index 656ed5e..471b3fd 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -28,6 +28,7 @@
   skia_android_serial = ""
   skia_enable_android_framework_defines = false
   skia_enable_discrete_gpu = true
+  skia_enable_effects = true
   skia_enable_gpu = true
   skia_enable_pdf = true
   skia_enable_splicer = is_skia_standalone && sanitize != "MSAN" && !is_ios
@@ -322,6 +323,13 @@
   }
 }
 
+optional("effects") {
+  enabled = skia_enable_effects
+  sources =
+      skia_effects_sources + [ "src/ports/SkGlobalInitialization_default.cpp" ]
+  sources_when_disabled = [ "src/ports/SkGlobalInitialization_none.cpp" ]
+}
+
 optional("fontmgr_android") {
   enabled = fontmgr_android_enabled
 
@@ -543,6 +551,7 @@
     ":armv7",
     ":avx",
     ":crc32",
+    ":effects",
     ":fontmgr_android",
     ":fontmgr_custom",
     ":fontmgr_fontconfig",
@@ -571,7 +580,6 @@
 
   sources = []
   sources += skia_core_sources
-  sources += skia_effects_sources
   sources += skia_sksl_sources
   sources += skia_utils_sources
   sources += skia_xps_sources
@@ -595,7 +603,6 @@
     "src/codec/SkWbmpCodec.cpp",
     "src/images/SkImageEncoder.cpp",
     "src/ports/SkDiscardableMemory_none.cpp",
-    "src/ports/SkGlobalInitialization_default.cpp",
     "src/ports/SkImageGenerator_skia.cpp",
     "src/ports/SkMemory_malloc.cpp",
     "src/ports/SkOSFile_stdio.cpp",