freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freetype2] master 602be7c: [gzip] Improve building with external zlib (


From: Werner LEMBERG
Subject: [freetype2] master 602be7c: [gzip] Improve building with external zlib (#49673).
Date: Thu, 1 Dec 2016 10:38:50 +0000 (UTC)

branch: master
commit 602be7c810634f6d565b45f719e429ec5144dfd3
Author: Werner Lemberg <address@hidden>
Commit: Werner Lemberg <address@hidden>

    [gzip] Improve building with external zlib (#49673).
    
    Building FreeType with external zlib 1.2.8 makes msvc 14 stop with
    the following error.
    
      ftgzip.c
      zlib-1.2.8\zlib.h(86): error C2061:
                             syntax error: identifier 'z_const'
      zlib-1.2.8\zlib.h(94): error C2054:
                             expected '(' to follow 'z_const'
      zlib-1.2.8\zlib.h(94): error C2085:
                             'msg': not in formal parameter list
      ...
      zlib-1.2.8\zlib.h(877): fatal error C1003:
                              error count exceeds 100; stopping compilation
    
    The error happens because FreeType keeps an own copy of zlib-1.1.4
    under `src/gzip'.  When building `src/gzip/ftgzip.c' with
    FT_CONFIG_OPTION_SYSTEM_ZLIB defined, it uses
    
      #include <zlib.h>
    
    which correctly finds an external `zlib.h', but `zlib.h' itself has
    a line
    
      #include "zconf.h"
    
    which makes Visual Studio 2015 find `src/gzip/zconf.h' while
    compiling the files in `src/gzip'.
    
    * src/gzip/zconf.h: Rename to...
    * src/gzip/ftzconf.h: ... this.
    * src/gzip/zlib.h, src/gzip/rules.mk (GZIP_DRV_SRCS): Updated.
---
 ChangeLog                       |   36 ++++++++++++++++++++++++++++++++++++
 src/gzip/ftgzip.c               |   24 ++++++++++++++++++------
 src/gzip/{zconf.h => ftzconf.h} |    0
 src/gzip/rules.mk               |    2 +-
 src/gzip/zlib.h                 |    2 +-
 5 files changed, 56 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 2387cf1..60fca96 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,39 @@
+2016-12-01  Werner Lemberg  <address@hidden>
+
+       [gzip] Improve building with external zlib (#49673).
+
+       Building FreeType with external zlib 1.2.8 makes msvc 14 stop with
+       the following error.
+
+         ftgzip.c
+         zlib-1.2.8\zlib.h(86): error C2061:
+                                syntax error: identifier 'z_const'
+         zlib-1.2.8\zlib.h(94): error C2054:
+                                expected '(' to follow 'z_const'
+         zlib-1.2.8\zlib.h(94): error C2085:
+                                'msg': not in formal parameter list
+         ...
+         zlib-1.2.8\zlib.h(877): fatal error C1003:
+                                 error count exceeds 100; stopping compilation
+
+       The error happens because FreeType keeps an own copy of zlib-1.1.4
+       under `src/gzip'.  When building `src/gzip/ftgzip.c' with
+       FT_CONFIG_OPTION_SYSTEM_ZLIB defined, it uses
+
+         #include <zlib.h>
+
+       which correctly finds an external `zlib.h', but `zlib.h' itself has
+       a line
+
+         #include "zconf.h"
+
+       which makes Visual Studio 2015 find `src/gzip/zconf.h' while
+       compiling the files in `src/gzip'.
+
+       * src/gzip/zconf.h: Rename to...
+       * src/gzip/ftzconf.h: ... this.
+       * src/gzip/zlib.h, src/gzip/rules.mk (GZIP_DRV_SRCS): Updated.
+
 2016-12-01  Oleksandr Chekhovskyi  <address@hidden>
 
        [autofit] Fix Emscripten crash (patch #9180).
diff --git a/src/gzip/ftgzip.c b/src/gzip/ftgzip.c
index 9cab80e..0e1792d 100644
--- a/src/gzip/ftgzip.c
+++ b/src/gzip/ftgzip.c
@@ -51,17 +51,29 @@
 
 #else /* !FT_CONFIG_OPTION_SYSTEM_ZLIB */
 
- /* In this case, we include our own modified sources of the ZLib    */
- /* within the "ftgzip" component.  The modifications were necessary */
- /* to #include all files without conflicts, as well as preventing   */
- /* the definition of "extern" functions that may cause linking      */
- /* conflicts when a program is linked with both FreeType and the    */
- /* original ZLib.                                                   */
+  /* In this case, we include our own modified sources of the ZLib  */
+  /* within the `gzip' component.  The modifications were necessary */
+  /* to #include all files without conflicts, as well as preventing */
+  /* the definition of `extern' functions that may cause linking    */
+  /* conflicts when a program is linked with both FreeType and the  */
+  /* original ZLib.                                                 */
 
 #ifndef USE_ZLIB_ZCALLOC
 #define MY_ZCALLOC /* prevent all zcalloc() & zfree() in zutil.c */
 #endif
 
+  /* Note that our `zlib.h' includes `ftzconf.h' instead of `zconf.h'; */
+  /* the main reason is that even a global `zlib.h' includes `zconf.h' */
+  /* with                                                              */
+  /*                                                                   */
+  /*   #include "zconf.h"                                              */
+  /*                                                                   */
+  /* instead of the expected                                           */
+  /*                                                                   */
+  /*   #include <zconf.h>                                              */
+  /*                                                                   */
+  /* so that configuration with `FT_CONFIG_OPTION_SYSTEM_ZLIB' might   */
+  /* include the wrong `zconf.h' file, leading to errors.              */
 #include "zlib.h"
 
 #undef  SLOW
diff --git a/src/gzip/zconf.h b/src/gzip/ftzconf.h
similarity index 100%
rename from src/gzip/zconf.h
rename to src/gzip/ftzconf.h
diff --git a/src/gzip/rules.mk b/src/gzip/rules.mk
index b0c9056..16af8c0 100644
--- a/src/gzip/rules.mk
+++ b/src/gzip/rules.mk
@@ -40,6 +40,7 @@ endif
 # unconditionally.
 #
 GZIP_DRV_SRCS := $(GZIP_DIR)/adler32.c  \
+                 $(GZIP_DIR)/ftzconf.h  \
                  $(GZIP_DIR)/infblock.c \
                  $(GZIP_DIR)/infblock.h \
                  $(GZIP_DIR)/infcodes.c \
@@ -50,7 +51,6 @@ GZIP_DRV_SRCS := $(GZIP_DIR)/adler32.c  \
                  $(GZIP_DIR)/inftrees.h \
                  $(GZIP_DIR)/infutil.c  \
                  $(GZIP_DIR)/infutil.h  \
-                 $(GZIP_DIR)/zconf.h    \
                  $(GZIP_DIR)/zlib.h     \
                  $(GZIP_DIR)/zutil.c    \
                  $(GZIP_DIR)/zutil.h
diff --git a/src/gzip/zlib.h b/src/gzip/zlib.h
index d361ff4..a4e82c6 100644
--- a/src/gzip/zlib.h
+++ b/src/gzip/zlib.h
@@ -31,7 +31,7 @@
 #ifndef _ZLIB_H
 #define _ZLIB_H
 
-#include "zconf.h"
+#include "ftzconf.h"
 
 #ifdef __cplusplus
 extern "C" {



reply via email to

[Prev in Thread] Current Thread [Next in Thread]