Skip to content

Commit

Permalink
Try to make sure we have unistd.h for OSX
Browse files Browse the repository at this point in the history
  • Loading branch information
starseeker committed Mar 15, 2024
1 parent 36d36de commit 1d0275f
Showing 1 changed file with 40 additions and 22 deletions.
62 changes: 40 additions & 22 deletions zlib/zlib.patch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
diff -Naur zlib/CMakeLists.txt ZLIB_BLD/CMakeLists.txt
--- zlib/CMakeLists.txt 2024-03-06 18:22:33.423844858 -0500
+++ ZLIB_BLD/CMakeLists.txt 2024-03-06 18:21:58.292423507 -0500
--- zlib/CMakeLists.txt 2024-03-14 20:07:06.811461199 -0400
+++ ZLIB_BLD/CMakeLists.txt 2024-03-14 20:02:42.716002504 -0400
@@ -3,6 +3,13 @@

project(zlib C)
Expand All @@ -15,10 +15,14 @@ diff -Naur zlib/CMakeLists.txt ZLIB_BLD/CMakeLists.txt
set(VERSION "1.3.1")

option(ZLIB_BUILD_EXAMPLES "Enable Zlib Examples" ON)
@@ -58,40 +65,34 @@
@@ -57,41 +64,38 @@
# Check for unistd.h
#
check_include_file(unistd.h Z_HAVE_UNISTD_H)

+if(Z_HAVE_UNISTD_H)
+ add_definitions(-DZ_HAVE_UNISTD_H)
+endif(Z_HAVE_UNISTD_H)
+
+option(ENABLE_Z_PREFIX "Add z_ prefix to all library functions." OFF)
+if (DEFINED Z_PREFIX_STR)
+ set (ENABLE_Z_PREFIX ON CACHE BOOL "Ensure prefix is set" FORCE)
Expand All @@ -28,7 +32,7 @@ diff -Naur zlib/CMakeLists.txt ZLIB_BLD/CMakeLists.txt
+endif (ENABLE_Z_PREFIX)
+mark_as_advanced (ENABLE_Z_PREFIX)
+mark_as_advanced (Z_PREFIX_STR)
+
if(MSVC)
- set(CMAKE_DEBUG_POSTFIX "d")
+ #set(CMAKE_DEBUG_POSTFIX "d")
Expand Down Expand Up @@ -72,7 +76,7 @@ diff -Naur zlib/CMakeLists.txt ZLIB_BLD/CMakeLists.txt
)
set(ZLIB_PRIVATE_HDRS
crc32.h
@@ -122,14 +123,8 @@
@@ -122,14 +126,8 @@
zutil.c
)

Expand All @@ -88,7 +92,7 @@ diff -Naur zlib/CMakeLists.txt ZLIB_BLD/CMakeLists.txt
string(REGEX REPLACE ".*#define[ \t]+ZLIB_VERSION[ \t]+\"([-0-9A-Za-z.]+)\".*"
"\\1" ZLIB_FULL_VERSION ${_zlib_h_contents})

@@ -147,16 +142,35 @@
@@ -147,16 +145,35 @@
-o ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj
-i ${CMAKE_CURRENT_SOURCE_DIR}/win32/zlib1.rc)
set(ZLIB_DLL_SRCS ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj)
Expand Down Expand Up @@ -125,7 +129,7 @@ diff -Naur zlib/CMakeLists.txt ZLIB_BLD/CMakeLists.txt
# This property causes shared libraries on Linux to have the full version
# encoded into their final filename. We disable this on Cygwin because
# it causes cygz-${ZLIB_FULL_VERSION}.dll to be created when cygz.dll
@@ -165,18 +179,12 @@
@@ -165,18 +182,12 @@
# This has no effect with MSVC, on that platform the version info for
# the DLL comes from the resource file win32/zlib1.rc
set_target_properties(zlib PROPERTIES VERSION ${ZLIB_FULL_VERSION})
Expand All @@ -148,7 +152,7 @@ diff -Naur zlib/CMakeLists.txt ZLIB_BLD/CMakeLists.txt

if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL )
install(TARGETS zlib zlibstatic
@@ -187,12 +195,7 @@
@@ -187,12 +198,7 @@
if(NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL )
install(FILES ${ZLIB_PUBLIC_HDRS} DESTINATION "${INSTALL_INC_DIR}")
endif()
Expand All @@ -163,8 +167,8 @@ diff -Naur zlib/CMakeLists.txt ZLIB_BLD/CMakeLists.txt
#============================================================================
# Example binaries
diff -Naur zlib/deflate.c ZLIB_BLD/deflate.c
--- zlib/deflate.c 2024-03-06 10:40:23.317104725 -0500
+++ ZLIB_BLD/deflate.c 2024-03-06 10:28:32.672849320 -0500
--- zlib/deflate.c 2024-03-14 20:07:06.811461199 -0400
+++ ZLIB_BLD/deflate.c 2024-03-14 19:58:58.475865772 -0400
@@ -52,7 +52,7 @@
#include "deflate.h"

Expand All @@ -174,9 +178,23 @@ diff -Naur zlib/deflate.c ZLIB_BLD/deflate.c
/*
If you use the zlib library in a product, an acknowledgment is welcome
in the documentation of your product. If for some reason you cannot
diff -Naur zlib/gzguts.h ZLIB_BLD/gzguts.h
--- zlib/gzguts.h 2024-03-14 20:07:06.811461199 -0400
+++ ZLIB_BLD/gzguts.h 2024-03-14 20:06:50.839735639 -0400
@@ -25,6 +25,10 @@
# include <limits.h>
#endif

+#ifdef Z_HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
#ifndef _POSIX_SOURCE
# define _POSIX_SOURCE
#endif
diff -Naur zlib/gzread.c ZLIB_BLD/gzread.c
--- zlib/gzread.c 2024-03-06 10:40:23.317104725 -0500
+++ ZLIB_BLD/gzread.c 2024-03-06 10:28:32.672849320 -0500
--- zlib/gzread.c 2024-03-14 20:07:06.811461199 -0400
+++ ZLIB_BLD/gzread.c 2024-03-14 20:06:03.664546399 -0400
@@ -400,9 +400,7 @@
}

Expand All @@ -189,8 +207,8 @@ diff -Naur zlib/gzread.c ZLIB_BLD/gzread.c
#endif
int ZEXPORT gzgetc(gzFile file) {
diff -Naur zlib/inftrees.c ZLIB_BLD/inftrees.c
--- zlib/inftrees.c 2024-03-06 10:40:23.317104725 -0500
+++ ZLIB_BLD/inftrees.c 2024-03-06 10:28:32.672849320 -0500
--- zlib/inftrees.c 2024-03-14 20:07:06.811461199 -0400
+++ ZLIB_BLD/inftrees.c 2024-03-14 19:58:58.483865634 -0400
@@ -9,7 +9,7 @@
#define MAXBITS 15

Expand All @@ -201,8 +219,8 @@ diff -Naur zlib/inftrees.c ZLIB_BLD/inftrees.c
If you use the zlib library in a product, an acknowledgment is welcome
in the documentation of your product. If for some reason you cannot
diff -Naur zlib/win32/zlib1.rc ZLIB_BLD/win32/zlib1.rc
--- zlib/win32/zlib1.rc 2024-03-06 19:12:16.939923796 -0500
+++ ZLIB_BLD/win32/zlib1.rc 2024-03-06 19:12:32.387672768 -0500
--- zlib/win32/zlib1.rc 2024-03-14 20:07:06.823460993 -0400
+++ ZLIB_BLD/win32/zlib1.rc 2024-03-14 19:58:58.483865634 -0400
@@ -1,5 +1,5 @@
#include <winver.h>
-#include "../zlib.h"
Expand All @@ -211,7 +229,7 @@ diff -Naur zlib/win32/zlib1.rc ZLIB_BLD/win32/zlib1.rc
#ifdef GCC_WINDRES
VS_VERSION_INFO VERSIONINFO
diff -Naur zlib/zconf.h ZLIB_BLD/zconf.h
--- zlib/zconf.h 2024-03-06 10:40:23.317104725 -0500
--- zlib/zconf.h 2024-03-14 20:07:06.815461130 -0400
+++ ZLIB_BLD/zconf.h 1969-12-31 19:00:00.000000000 -0500
@@ -1,543 +0,0 @@
-/* zconf.h -- configuration of the zlib compression library
Expand Down Expand Up @@ -758,8 +776,8 @@ diff -Naur zlib/zconf.h ZLIB_BLD/zconf.h
-
-#endif /* ZCONF_H */
diff -Naur zlib/zconf.h.in ZLIB_BLD/zconf.h.in
--- zlib/zconf.h.in 2024-03-06 10:40:23.317104725 -0500
+++ ZLIB_BLD/zconf.h.in 2024-03-06 10:28:32.676849254 -0500
--- zlib/zconf.h.in 2024-03-14 20:07:06.815461130 -0400
+++ ZLIB_BLD/zconf.h.in 2024-03-14 19:58:58.483865634 -0400
@@ -3,8 +3,6 @@
* For conditions of distribution and use, see copyright notice in zlib.h
*/
Expand Down Expand Up @@ -1145,7 +1163,7 @@ diff -Naur zlib/zconf.h.in ZLIB_BLD/zconf.h.in
# else
# define z_off64_t z_off_t
diff -Naur zlib/zlib.h ZLIB_BLD/zlib.h
--- zlib/zlib.h 2024-03-06 10:40:23.317104725 -0500
--- zlib/zlib.h 2024-03-14 20:07:06.815461130 -0400
+++ ZLIB_BLD/zlib.h 1969-12-31 19:00:00.000000000 -0500
@@ -1,1938 +0,0 @@
-/* zlib.h -- interface of the 'zlib' general purpose compression library
Expand Down Expand Up @@ -3088,7 +3106,7 @@ diff -Naur zlib/zlib.h ZLIB_BLD/zlib.h
-#endif /* ZLIB_H */
diff -Naur zlib/zlib.h.in ZLIB_BLD/zlib.h.in
--- zlib/zlib.h.in 1969-12-31 19:00:00.000000000 -0500
+++ ZLIB_BLD/zlib.h.in 2024-03-06 10:28:32.676849254 -0500
+++ ZLIB_BLD/zlib.h.in 2024-03-14 19:58:58.483865634 -0400
@@ -0,0 +1,1943 @@
+/* zlib.h -- interface of the 'zlib' general purpose compression library
+ version 1.3.1, January 22nd, 2024
Expand Down

0 comments on commit 1d0275f

Please sign in to comment.