Skip to content

Commit

Permalink
Also guard ZLIB_DLL properties for BUILD_SHARED_LIBS.
Browse files Browse the repository at this point in the history
  • Loading branch information
BillyONeal committed Oct 19, 2022
1 parent ec159dc commit f0e26a5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
14 changes: 9 additions & 5 deletions ports/zlib/0003-build-static-or-shared-not-both.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f46c8e6..29508ae 100644
index f46c8e6..6fa5575 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -121,9 +121,11 @@ set(ZLIB_SRCS
Expand All @@ -14,22 +14,26 @@ index f46c8e6..29508ae 100644
endif()

# parse the full version number from zlib.h and include in ZLIB_FULL_VERSION
@@ -144,11 +146,12 @@ if(MINGW)
@@ -144,13 +146,16 @@ if(MINGW)
-I ${CMAKE_CURRENT_BINARY_DIR}
-o ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj
-i ${CMAKE_CURRENT_SOURCE_DIR}/win32/zlib1.rc)
+ if(BUILD_SHARED_LIBS)
set(ZLIB_DLL_SRCS ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj)
endif(MINGW)
+ endif()
endif(MINGW)

-add_library(zlib SHARED ${ZLIB_SRCS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
-add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
+add_library(zlib ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
+if (BUILD_SHARED_LIBS)
set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL)
set_target_properties(zlib PROPERTIES SOVERSION 1)
+endif()

@@ -165,7 +168,7 @@ endif()
if(NOT CYGWIN)
# This property causes shared libraries on Linux to have the full version
@@ -165,7 +170,7 @@ endif()

if(UNIX)
# On unix-like platforms the library is almost always called libz
Expand All @@ -38,7 +42,7 @@ index f46c8e6..29508ae 100644
if(NOT APPLE)
set_target_properties(zlib PROPERTIES LINK_FLAGS "-Wl,--version-script,\"${CMAKE_CURRENT_SOURCE_DIR}/zlib.map\"")
endif()
@@ -175,7 +178,7 @@ elseif(BUILD_SHARED_LIBS AND WIN32)
@@ -175,7 +180,7 @@ elseif(BUILD_SHARED_LIBS AND WIN32)
endif()

if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL )
Expand Down
9 changes: 4 additions & 5 deletions ports/zlib/0004-android-and-mingw-fixes.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 29508ae..4223676 100644
index 6fa5575..7c345db 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -56,7 +56,7 @@ endif()
Expand All @@ -20,13 +20,12 @@ index 29508ae..4223676 100644
# This gets us DLL resource information when compiling on MinGW.
if(NOT CMAKE_RC_COMPILER)
set(CMAKE_RC_COMPILER windres.exe)
@@ -148,8 +148,8 @@ if(MINGW)
-i ${CMAKE_CURRENT_SOURCE_DIR}/win32/zlib1.rc)
@@ -149,7 +149,7 @@ if(MINGW)
if(BUILD_SHARED_LIBS)
set(ZLIB_DLL_SRCS ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj)
-endif(MINGW)
endif()
-endif(MINGW)
+endif(MINGW AND NOT ANDROID)

add_library(zlib ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL)
if (BUILD_SHARED_LIBS)

0 comments on commit f0e26a5

Please sign in to comment.