Allow users of Skia to optionally link against X11 and GL on Linux.

Change-Id: Id46986c0c7865d1877766e1584550e0b9e1af6c2
Reviewed-on: https://skia-review.googlesource.com/154803
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
diff --git a/BUILD.gn b/BUILD.gn
index e03fe06..f84dbae 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -31,6 +31,7 @@
   skia_use_zlib = true
   skia_use_metal = false
   skia_use_libheif = is_skia_dev_build
+  skia_use_x11 = is_linux
 
   skia_android_serial = ""
   skia_enable_discrete_gpu = true
@@ -599,7 +600,7 @@
   } else if (skia_use_egl) {
     sources += [ "src/gpu/gl/egl/GrGLMakeNativeInterface_egl.cpp" ]
     libs += [ "EGL" ]
-  } else if (is_linux) {
+  } else if (is_linux && skia_use_x11) {
     sources += [ "src/gpu/gl/glx/GrGLMakeNativeInterface_glx.cpp" ]
     libs += [ "GL" ]
   } else if (is_mac) {