From b67a058a5f9b561871ad37fc5a8b02002c4259ec Mon Sep 17 00:00:00 2001 From: Mika Lindqvist Date: Thu, 7 May 2015 18:21:28 +0300 Subject: [PATCH] Fix building under Cygwin. --- deflate.c | 2 ++ gzlib.c | 2 +- win32/Makefile.gcc | 31 +++++++++++++------------------ 3 files changed, 16 insertions(+), 19 deletions(-) diff --git a/deflate.c b/deflate.c index eecd9253..16d5c83e 100644 --- a/deflate.c +++ b/deflate.c @@ -76,7 +76,9 @@ local void fill_window (deflate_state *s); local block_state deflate_stored (deflate_state *s, int flush); local block_state deflate_fast (deflate_state *s, int flush); block_state deflate_quick (deflate_state *s, int flush); +#ifdef MEDIUM_STRATEGY local block_state deflate_medium (deflate_state *s, int flush); +#endif local block_state deflate_slow (deflate_state *s, int flush); local block_state deflate_rle (deflate_state *s, int flush); local block_state deflate_huff (deflate_state *s, int flush); diff --git a/gzlib.c b/gzlib.c index 028a2d3c..ce208415 100644 --- a/gzlib.c +++ b/gzlib.c @@ -288,7 +288,7 @@ gzFile ZEXPORT gzdopen(fd, mode) } /* -- see zlib.h -- */ -#ifdef _WIN32 +#if defined(_WIN32) || defined(__CYGWIN__) gzFile ZEXPORT gzopen_w(path, mode) const wchar_t *path; const char *mode; diff --git a/win32/Makefile.gcc b/win32/Makefile.gcc index 6d1ded62..c95fb830 100644 --- a/win32/Makefile.gcc +++ b/win32/Makefile.gcc @@ -1,7 +1,8 @@ # Makefile for zlib, derived from Makefile.dj2. # Modified for mingw32 by C. Spieler, 6/16/98. # Updated for zlib 1.2.x by Christian Spieler and Cosmin Truta, Mar-2003. -# Last updated: Mar 2012. +# Updated for zlib-ng by Mika Lindqvist +# Last updated: May 2015. # Tested under Cygwin and MinGW. # Copyright (C) 1995-2003 Jean-loup Gailly. @@ -11,10 +12,6 @@ # # make -fwin32/Makefile.gcc; make test testdll -fwin32/Makefile.gcc # -# To use the asm code, type: -# cp contrib/asm?86/match.S ./match.S -# make LOC=-DASMV OBJA=match.o -fwin32/Makefile.gcc -# # To install libz.a, zconf.h and zlib.h in the system directories, type: # # make install -fwin32/Makefile.gcc @@ -38,16 +35,12 @@ IMPLIB = libz.dll.a # SHARED_MODE=0 -#LOC = -DASMV #LOC = -DDEBUG -g PREFIX = CC = $(PREFIX)gcc CFLAGS = $(LOC) -O3 -Wall -AS = $(CC) -ASFLAGS = $(LOC) -Wall - LD = $(CC) LDFLAGS = $(LOC) @@ -68,8 +61,7 @@ prefix ?= /usr/local exec_prefix = $(prefix) OBJS = adler32.o compress.o crc32.o deflate.o gzclose.o gzlib.o gzread.o \ - gzwrite.o infback.o inffast.o inflate.o inftrees.o trees.o uncompr.o zutil.o -OBJA = + gzwrite.o infback.o inffast.o inflate.o inftrees.o match.o trees.o uncompr.o zutil.o all: $(STATICLIB) $(SHAREDLIB) $(IMPLIB) example.exe minigzip.exe example_d.exe minigzip_d.exe @@ -84,17 +76,14 @@ testdll: example_d.exe minigzip_d.exe .c.o: $(CC) $(CFLAGS) -c -o $@ $< -.S.o: - $(AS) $(ASFLAGS) -c -o $@ $< - -$(STATICLIB): $(OBJS) $(OBJA) - $(AR) $(ARFLAGS) $@ $(OBJS) $(OBJA) +$(STATICLIB): $(OBJS) + $(AR) $(ARFLAGS) $@ $(OBJS) $(IMPLIB): $(SHAREDLIB) -$(SHAREDLIB): win32/zlib.def $(OBJS) $(OBJA) zlibrc.o +$(SHAREDLIB): win32/zlib.def $(OBJS) zlibrc.o $(CC) -shared -Wl,--out-implib,$(IMPLIB) $(LDFLAGS) \ - -o $@ win32/zlib.def $(OBJS) $(OBJA) zlibrc.o + -o $@ win32/zlib.def $(OBJS) zlibrc.o $(STRIP) $@ example.exe: example.o $(STATICLIB) @@ -165,6 +154,12 @@ clean: -$(RM) *.exe -$(RM) foo.gz +distclean: clean + -$(CP) zconf.h.in zconf.h + @printf 'all:\n\t-@echo "Please use ./configure first. Thank you."\n' > Makefile + @printf '\ndistclean:\n\tmake -f Makefile.in distclean\n' >> Makefile + @touch -r Makefile.in Makefile + adler32.o: zlib.h zconf.h compress.o: zlib.h zconf.h crc32.o: crc32.h zlib.h zconf.h -- 2.47.2