]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Fix creating shared library under MSYS64.
authorMika Lindqvist <postmaster@raasu.org>
Sun, 22 Nov 2015 17:35:34 +0000 (19:35 +0200)
committerHans Kristian Rosbach <hk-git@circlestorm.org>
Wed, 25 Nov 2015 15:12:13 +0000 (16:12 +0100)
CMakeLists.txt
gzguts.h
gzlib.c
zlib.h

index 0ec1c055385a636cfbad1f851ffe6da8d5b76136..bb7f030095cb43aa06ea42de03fbe6ddb6f9b286 100644 (file)
@@ -1,5 +1,6 @@
 cmake_minimum_required(VERSION 2.4.4)
 set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON)
+set(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required
 
 project(zlib C)
 
@@ -219,6 +220,9 @@ if(UNIX)
    if(NOT APPLE)
      set_target_properties(zlib PROPERTIES LINK_FLAGS "-Wl,--version-script,\"${CMAKE_CURRENT_SOURCE_DIR}/zlib.map\"")
    endif()
+elseif(MSYS)
+   # Suppress version number from shared library name
+   set(CMAKE_SHARED_LIBRARY_NAME_WITH_VERSION 0)
 elseif(BUILD_SHARED_LIBS AND WIN32)
     # Creates zlib1.dll when building shared library version
     set_target_properties(zlib PROPERTIES SUFFIX "1.dll")
index ffaa5826ed68c98d681baad27628bbf9ff899777..3930d7e4179626651e832b6767c40a2fed40cf44 100644 (file)
--- a/gzguts.h
+++ b/gzguts.h
@@ -35,7 +35,7 @@
 #  include <io.h>
 #endif
 
-#if defined(_WIN32) || defined(__CYGWIN__)
+#if defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW__)
 #  define WIDECHAR
 #endif
 
@@ -47,7 +47,7 @@
 #endif
 
 /* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */
-#if !defined(STDC99) && !defined(__CYGWIN__) && defined(WIN32)
+#if !defined(STDC99) && !defined(__CYGWIN__) && !defined(__MINGW__) && defined(WIN32)
 #  if !defined(vsnprintf)
 #    if !defined(_MSC_VER) || ( defined(_MSC_VER) && _MSC_VER < 1500 )
 #       define vsnprintf _vsnprintf
diff --git a/gzlib.c b/gzlib.c
index f7b4ca382ee72e89d08e5a700ff549d15738f894..44b14a02112005bb1a8cddae224f22ac651ce943 100644 (file)
--- a/gzlib.c
+++ b/gzlib.c
@@ -178,7 +178,7 @@ local gzFile gz_open(const void *path, int fd, const char *mode) {
 
     /* open the file with the appropriate flags (or just use fd) */
     state->fd = fd > -1 ? fd : (
-#ifdef _WIN32
+#if defined(_WIN32) || defined(__MINGW__)
         fd == -2 ? _wopen(path, oflag, 0666) :
 #elif __CYGWIN__
         fd == -2 ? open(state->path, oflag, 0666) :
diff --git a/zlib.h b/zlib.h
index 4f5fb131ce2c9bc97ea96e8f8ee264b210e656bd..0c5994dbafc22cc52cd108894f0af3c60a506b86 100644 (file)
--- a/zlib.h
+++ b/zlib.h
@@ -1715,7 +1715,7 @@ ZEXTERN int ZEXPORT inflateResetKeep(z_stream *);
 ZEXTERN int ZEXPORT deflateResetKeep(z_stream *);
 
 #ifdef WITH_GZFILEOP
-# if (defined(_WIN32) || defined(__CYGWIN__))
+# if (defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW__))
     ZEXTERN gzFile ZEXPORT gzopen_w(const wchar_t *path, const char *mode);
 # endif
 ZEXTERN int ZEXPORTVA gzvprintf(gzFile file, const char *format, va_list va);