SK_NO_FLATE
authormtklein <mtklein@chromium.org>
Tue, 17 Feb 2015 21:10:43 +0000 (13:10 -0800)
committerCommit bot <commit-bot@chromium.org>
Tue, 17 Feb 2015 21:10:43 +0000 (13:10 -0800)
Also remove skia_zlib_static.  We're not using it.  We don't even have zlib in DEPS.

No public API changes.
TBR=reed@google.com

BUG=skia:

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

gyp/common_conditions.gypi
gyp/common_variables.gypi
gyp/zlib.gyp
include/config/SkUserConfig.h
include/core/SkPostConfig.h
src/core/SkFlate.cpp
tests/FlateTest.cpp

index 676ec0897a9b929c171daa23b7c6f25c58985083..9642f3d3f999b6df76887803424154ff7b51d6fa 100644 (file)
@@ -39,6 +39,7 @@
       {
         'defines': [
           'SK_BUILD_FOR_WIN32',
+          'SK_NO_FLATE',  # Too much of a pain to set up zlib on our bots.
           '_CRT_SECURE_NO_WARNINGS',
           'GR_GL_FUNCTION_TYPE=__stdcall',
         ],
index a20550b08d0d8feac5840ea86d6e99f55c42af7d..97501871a9a0607884aadd204199c57fff678135 100644 (file)
       #     libpng in third_party/externals/libpng.
       'skia_libpng_static%': '0',
 
-      # skia_zlib_static - on OS variants that normally would link zlib with
-      #     '-lz' or libz.dylib and include the headers from '<zlib.h>',
-      #     don't do that; instead compile and staticlly link the version of
-      #     zlib in third_party/externals/zlib.
-      'skia_zlib_static%': '0',
-
       # skia_no_fontconfig - On POSIX systems that would normally use the
       #     SkFontHost_fontconfig interface; use the SkFontHost_linux
       #     version instead.
     'skia_freetype_static%': '<(skia_freetype_static)',
     'skia_giflib_static%': '<(skia_giflib_static)',
     'skia_libpng_static%': '<(skia_libpng_static)',
-    'skia_zlib_static%': '<(skia_zlib_static)',
     'skia_no_fontconfig%': '<(skia_no_fontconfig)',
     'skia_sanitizer%': '<(skia_sanitizer)',
     'skia_scalar%': '<(skia_scalar)',
index 78adc34b72486f9ac41381bd776c681f77b91c05..a573dc7498d970d83f7e35848ba709aa823cb976 100644 (file)
@@ -4,75 +4,14 @@
 # found in the LICENSE file.
 
 {
-  'variables': {
-    'skia_warnings_as_errors': 0,
-  },
-  'targets': [
-    {
-      'target_name': 'zlib',
+  'targets': [{
+    'target_name': 'zlib',
+    'type': 'none',
+    'link_settings': { 'libraries': [ '-lz' ] },
+    'direct_dependent_settings': {
       'conditions': [
-        [ 'skia_zlib_static',
-          {
-            'type': 'static_library',
-            'include_dirs': [
-              '../third_party/externals/zlib',
-            ],
-            'direct_dependent_settings': {
-              'defines': [
-                'SK_ZLIB_INCLUDE="zlib.h"',
-              ],
-              'include_dirs': [
-                '../third_party/externals/zlib',
-              ],
-            },
-            'sources': [
-              '../third_party/externals/zlib/src/adler32.c',
-              '../third_party/externals/zlib/src/compress.c',
-              '../third_party/externals/zlib/src/crc32.c',
-              '../third_party/externals/zlib/src/deflate.c',
-              '../third_party/externals/zlib/src/gzclose.c',
-              '../third_party/externals/zlib/src/gzlib.c',
-              '../third_party/externals/zlib/src/gzread.c',
-              '../third_party/externals/zlib/src/gzwrite.c',
-              '../third_party/externals/zlib/src/infback.c',
-              '../third_party/externals/zlib/src/inffast.c',
-              '../third_party/externals/zlib/src/inflate.c',
-              '../third_party/externals/zlib/src/inftrees.c',
-              '../third_party/externals/zlib/src/trees.c',
-              '../third_party/externals/zlib/src/uncompr.c',
-              '../third_party/externals/zlib/src/zutil.c',
-            ],
-          }, {  # not skia_zlib_static
-            'type': 'none',
-            'direct_dependent_settings': {
-              'conditions': [
-                [ 'skia_android_framework', {
-                  'include_dirs': [
-                    'external/zlib',
-                  ],
-                }, {
-                  'defines': [
-                    'SK_SYSTEM_ZLIB=1',
-                  ],
-                }]
-              ],
-              'link_settings': {
-                'conditions': [
-                  [ 'skia_os == "mac" or skia_os == "ios"', {
-                    'libraries': [
-                      '$(SDKROOT)/usr/lib/libz.dylib',
-                    ]
-                  }, {  # skia_os != "mac" and skia_os != "ios"
-                    'libraries': [
-                      '-lz',
-                    ]
-                  }],
-                ],
-              }
-            },
-          }
-        ]
-      ]
-    }
-  ]
+        [ 'skia_android_framework', { 'include_dirs': [ 'external/zlib' ] }]
+      ],
+    },
+  }],
 }
index 92e2b907628df266ff8e81811a271fa7c7114c6f..a6f12930b292edf13b4c0d0f5c2f9cb6e1b3c651 100644 (file)
  */
 //#define SK_DEFAULT_IMAGE_CACHE_LIMIT (1024 * 1024)
 
-/*  If zlib is available and you want to support the flate compression
-    algorithm (used in PDF generation), define SK_ZLIB_INCLUDE to be the
-    include path. Alternatively, define SK_SYSTEM_ZLIB to use the system zlib
-    library specified as "#include <zlib.h>".
+/*  If zlib is not available or you don't want to support flate compression
+    in PDF generation, define SK_NO_FLATE.
  */
-//#define SK_ZLIB_INCLUDE <zlib.h>
-//#define SK_SYSTEM_ZLIB
+//#define SK_NO_FLATE
 
 /*  Define this to allow PDF scalars above 32k.  The PDF/A spec doesn't allow
     them, but modern PDF interpreters should handle them just fine.
index 330454cbead8b6f51e4a4fb308047c5e75f75298..ad0098f4294d11dd0a0519f8572adcb60b1de378 100644 (file)
 #  endif
 #endif
 
-#if defined(SK_ZLIB_INCLUDE) && defined(SK_SYSTEM_ZLIB)
-#  error "cannot define both SK_ZLIB_INCLUDE and SK_SYSTEM_ZLIB"
-#elif defined(SK_ZLIB_INCLUDE) || defined(SK_SYSTEM_ZLIB)
-#  define SK_HAS_ZLIB
-#endif
-
 ///////////////////////////////////////////////////////////////////////////////
 
 #ifndef SkNEW
index 2b4e36d7271ea99fe11e8ac2b302d5b8fed4f28a..ff11a11ca89eecdb01ab90aa1f178c5aae49bef0 100644 (file)
@@ -11,7 +11,7 @@
 #include "SkFlate.h"
 #include "SkStream.h"
 
-#ifndef SK_HAS_ZLIB
+#ifdef SK_NO_FLATE
 bool SkFlate::HaveFlate() { return false; }
 bool SkFlate::Deflate(SkStream*, SkWStream*) { return false; }
 bool SkFlate::Deflate(const void*, size_t, SkWStream*) { return false; }
@@ -26,11 +26,7 @@ bool SkFlate::HaveFlate() {
 
 namespace {
 
-#ifdef SK_SYSTEM_ZLIB
-#include <zlib.h>
-#else
-#include SK_ZLIB_INCLUDE
-#endif
+#include "zlib.h"
 
 // static
 const size_t kBufferSize = 1024;
index 9f6a5b5f432c7ecc8bdd9cb9db1af79d54060eed..8ad4d50376e86ca9d6a8e72f00288e04fb84ae61 100644 (file)
@@ -104,7 +104,7 @@ static void TestFlate(skiatest::Reporter* reporter, SkMemoryStream* testStream,
 }
 
 DEF_TEST(Flate, reporter) {
-#ifdef SK_HAS_ZLIB
+#ifndef SK_NO_FLATE
     REPORTER_ASSERT(reporter, SkFlate::HaveFlate());
 #endif
     if (SkFlate::HaveFlate()) {