Skip to content
Snippets Groups Projects
Commit 29fbfc0d authored by Alexandre Janniaux's avatar Alexandre Janniaux Committed by Steve Lhomme
Browse files

contrib: zlib: bump to 1.3.1

Rewrite the first patch on top of v1.3.1 and simplify it since we always
need the same name for the static zlib target.

Remove the second patch since there is now a ZLIB_BUILD_EXAMPLES cmake
switch to disable the examples.
parent 348ee31a
No related branches found
No related tags found
1 merge request!4925contrib: zlib: bump to 1.3.1
Pipeline #437614 passed with stage
in 1 hour, 25 minutes, and 43 seconds
From 5c03377a53b137d647f1e485cd89e57f358ee3e9 Mon Sep 17 00:00:00 2001
From 32e97d1efafa48d81c3d019d7d5fe7083a812768 Mon Sep 17 00:00:00 2001
From: Steve Lhomme <robux4@ycbcr.xyz>
Date: Fri, 9 Sep 2022 10:19:56 +0200
Subject: [PATCH 1/2] Fix mingw static library name on mingw and Emscripten
Date: Mon, 12 Feb 2024 20:39:05 +0100
Subject: [PATCH] CMakeList.txt: force static library name to `z`
They build code in a UNIX like environment but CMake doesn't set UNIX for it.
They build code in a UNIX like environment but CMake doesn't set UNIX
for it.
In contribs, we can always enforce this value.
Co-authored-by: Alexandre Janniaux <ajanni@videolabs.io>
---
CMakeLists.txt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b412dc7..3f42869 100644
index 15ceebe..c952cde 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -163,10 +163,10 @@ if(NOT CYGWIN)
@@ -167,9 +167,9 @@ if(NOT CYGWIN)
set_target_properties(zlib PROPERTIES VERSION ${ZLIB_FULL_VERSION})
endif()
-if(UNIX)
+if(UNIX OR MINGW OR EMSCRIPTEN)
# On unix-like platforms the library is almost always called libz
set_target_properties(zlib zlibstatic PROPERTIES OUTPUT_NAME z)
- if(NOT APPLE)
+ if(NOT APPLE AND NOT MINGW AND NOT EMSCRIPTEN)
+# On unix-like platforms the library is almost always called libz
+set_target_properties(zlib zlibstatic PROPERTIES OUTPUT_NAME z)
if(UNIX)
- # On unix-like platforms the library is almost always called libz
- set_target_properties(zlib zlibstatic PROPERTIES OUTPUT_NAME z)
if(NOT APPLE AND NOT(CMAKE_SYSTEM_NAME STREQUAL AIX))
set_target_properties(zlib PROPERTIES LINK_FLAGS "-Wl,--version-script,\"${CMAKE_CURRENT_SOURCE_DIR}/zlib.map\"")
endif()
elseif(BUILD_SHARED_LIBS AND WIN32)
--
2.37.3.windows.1
2.43.0
From dc5305dbdd39d5f90c0413704d6945c5f8ac6617 Mon Sep 17 00:00:00 2001
From: Steve Lhomme <robux4@ycbcr.xyz>
Date: Thu, 29 Sep 2022 06:32:21 +0200
Subject: [PATCH 2/2] Add an option to enable/disable building examples
---
CMakeLists.txt | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3f42869..3f6de05 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -5,6 +5,8 @@ project(zlib C)
set(VERSION "1.2.13")
+option(BUILD_EXAMPLES "Build examples" ON)
+
set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables")
set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries")
set(INSTALL_INC_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "Installation directory for headers")
@@ -194,6 +196,7 @@ endif()
# Example binaries
#============================================================================
+if(BUILD_EXAMPLES)
add_executable(example test/example.c)
target_link_libraries(example zlib)
add_test(example example)
@@ -211,3 +214,4 @@ if(HAVE_OFF64_T)
target_link_libraries(minigzip64 zlib)
set_target_properties(minigzip64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64")
endif()
+endif(BUILD_EXAMPLES)
--
2.37.3.windows.1
9e7ac71a1824855ae526506883e439456b74ac0b811d54e94f6908249ba8719bec4c8d7672903c5280658b26cb6b5e93ecaaafe5cdc2980c760fa196773f0725 zlib-1.2.13.tar.xz
1e8e70b362d64a233591906a1f50b59001db04ca14aaffad522198b04680be501736e7d536b4191e2f99767e7001ca486cd802362cca2be05d5d409b83ea732d zlib-1.3.1.tar.xz
# ZLIB
ZLIB_VERSION := 1.2.13
ZLIB_VERSION := 1.3.1
ZLIB_URL := $(GITHUB)/madler/zlib/releases/download/v$(ZLIB_VERSION)/zlib-$(ZLIB_VERSION).tar.xz
PKGS += zlib
......@@ -14,15 +14,14 @@ $(TARBALLS)/zlib-$(ZLIB_VERSION).tar.xz:
zlib: zlib-$(ZLIB_VERSION).tar.xz .sum-zlib
$(UNPACK)
$(APPLY) $(SRC)/zlib/0001-Fix-mingw-static-library-name-on-mingw-and-Emscripte.patch
$(APPLY) $(SRC)/zlib/0002-Add-an-option-to-enable-disable-building-examples.patch
$(APPLY) $(SRC)/zlib/0001-CMakeList.txt-force-static-library-name-to-z.patch
# disable the installation of the dynamic library since there's no option
sed -e 's,install(TARGETS zlib zlibstatic,install(TARGETS zlibstatic,' -i.orig $(UNPACK_DIR)/CMakeLists.txt
# only use the proper libz name for the static library
sed -e 's,set_target_properties(zlib zlibstatic ,set_target_properties(zlibstatic ,' -i.orig $(UNPACK_DIR)/CMakeLists.txt
$(MOVE)
ZLIB_CONF = -DINSTALL_PKGCONFIG_DIR:STRING=$(PREFIX)/lib/pkgconfig -DBUILD_EXAMPLES=OFF
ZLIB_CONF = -DINSTALL_PKGCONFIG_DIR:STRING=$(PREFIX)/lib/pkgconfig -DZLIB_BUILD_EXAMPLES=OFF
.zlib: zlib toolchain.cmake
$(CMAKECLEAN)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment