tWin32 installer now uses libbz2 rather than libz for compression. - vaccinewar… | |
git clone git://src.adamsgaard.dk/vaccinewars | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 8b171504a7e2a3cee902c6e438424b9524f12836 | |
parent 3521db4a721ef8de4665a2a4e6382b0fb8c24991 | |
Author: Ben Webb <[email protected]> | |
Date: Wed, 18 Sep 2002 10:15:41 +0000 | |
Win32 installer now uses libbz2 rather than libz for compression. | |
Diffstat: | |
M win32/Makefile | 10 +++++----- | |
A win32/bzlib/Makefile.nocygwin | 33 +++++++++++++++++++++++++++++… | |
A win32/bzlib/README.bzlib | 6 ++++++ | |
M win32/makeinstall.c | 63 ++++++++++++++++-------------… | |
M win32/setup.c | 70 ++++++++++++++++-------------… | |
M win32/setup.rc | 2 +- | |
D win32/zlib/Makefile.nocygwin | 155 -----------------------------… | |
D win32/zlib/README.zlib | 6 ------ | |
8 files changed, 115 insertions(+), 230 deletions(-) | |
--- | |
diff --git a/win32/Makefile b/win32/Makefile | |
t@@ -2,10 +2,10 @@ all: setup makeinstall uninstall | |
clean: | |
/bin/rm -f *.o *.res uninstall.exe setup.exe makeinstall.exe core *~ | |
- /bin/rm -f installfiles.gz manifest | |
+ /bin/rm -f installfiles.bz2 manifest | |
setup: setup.o util.o guifunc.o setup.res | |
- gcc -Wall -mno-cygwin -mwindows -o setup setup.o util.o guifunc.o setu… | |
+ gcc -Wall -mno-cygwin -mwindows -o setup setup.o util.o guifunc.o setu… | |
strip setup.exe | |
uninstall: uninstall.o util.o guifunc.o uninstall.res | |
t@@ -27,7 +27,7 @@ util.o: util.c util.h | |
guifunc.o: guifunc.c guifunc.h | |
gcc -Wall -mno-cygwin -c guifunc.c | |
-manifest installfiles.gz: filelist makeinstall uninstall | |
+manifest installfiles.bz2: filelist makeinstall uninstall | |
sed -e 's/LICENCE/licence.txt/' < ../doc/index.html > index.html | |
sed -e 's/LICENCE/licence.txt/' < ../doc/developer.html > developer.ht… | |
sed -e 's/example-cfg/example-cfg.txt/' < ../doc/configfile.html > con… | |
t@@ -38,11 +38,11 @@ manifest installfiles.gz: filelist makeinstall uninstall | |
/bin/rm -f index.html configfile.html developer.html licence.txt | |
/bin/rm -f example-cfg.txt readme.txt | |
-setup.res: setup.rc dialogs.rc contid.h manifest installfiles.gz | |
+setup.res: setup.rc dialogs.rc contid.h manifest installfiles.bz2 | |
windres -O coff -o setup.res setup.rc | |
makeinstall: makeinstall.o util.o | |
- gcc -Wall -mno-cygwin -o makeinstall makeinstall.o util.o zlib/libz.a | |
+ gcc -Wall -mno-cygwin -o makeinstall makeinstall.o util.o bzlib/libbz2… | |
makeinstall.o: makeinstall.c util.h | |
gcc -Wall -mno-cygwin -c makeinstall.c | |
diff --git a/win32/bzlib/Makefile.nocygwin b/win32/bzlib/Makefile.nocygwin | |
t@@ -0,0 +1,33 @@ | |
+ | |
+SHELL=/bin/sh | |
+ | |
+# To assist in cross-compiling | |
+CC=gcc | |
+AR=ar | |
+RANLIB=ranlib | |
+LDFLAGS= | |
+ | |
+# Suitably paranoid flags to avoid bugs in gcc-2.7 | |
+BIGFILES=-D_FILE_OFFSET_BITS=64 | |
+CFLAGS=-mno-cygwin -Wall -Winline -O2 -fomit-frame-pointer -fno-strength-reduc… | |
+ | |
+# Where you want it installed when you do 'make install' | |
+PREFIX=/usr | |
+ | |
+ | |
+OBJS= blocksort.o \ | |
+ huffman.o \ | |
+ crctable.o \ | |
+ randtable.o \ | |
+ compress.o \ | |
+ decompress.o \ | |
+ bzlib.o | |
+ | |
+libbz2.a: $(OBJS) | |
+ rm -f libbz2.a | |
+ $(AR) cq libbz2.a $(OBJS) | |
+ @if ( test -f $(RANLIB) -o -f /usr/bin/ranlib -o \ | |
+ -f /bin/ranlib -o -f /usr/ccs/bin/ranlib ) ; then \ | |
+ echo $(RANLIB) libbz2.a ; \ | |
+ $(RANLIB) libbz2.a ; \ | |
+ fi | |
diff --git a/win32/bzlib/README.bzlib b/win32/bzlib/README.bzlib | |
t@@ -0,0 +1,6 @@ | |
+If you are intending to build the Win32 installer for dopewars, then place | |
+the bzlib distribution into this directory. The installer expects to | |
+statically link with the file libbz2.a in this directory; the libbz2.a file | |
+included in the Cygwin distribution should _not_ be used, as this requires | |
+the CYGWIN.DLL file, which is not a standard Windows DLL. Use the | |
+Makefile.nocygwin file to compile bzlib, as this adds in the -mno-cygwin flag. | |
diff --git a/win32/makeinstall.c b/win32/makeinstall.c | |
t@@ -23,7 +23,7 @@ | |
#include <windows.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
-#include "zlib/zlib.h" | |
+#include "bzlib/bzlib.h" | |
#include "util.h" | |
char *read_line(HANDLE hin) | |
t@@ -166,7 +166,7 @@ InstData *ReadInstallData() | |
} | |
#define BUFFER_SIZE (32*1024) | |
-#define COMPRESSION Z_BEST_COMPRESSION | |
+#define COMPRESSION 9 | |
void OpenNextFile(InstFiles *filelist, InstFiles **listpt, HANDLE *fin) | |
{ | |
t@@ -203,23 +203,23 @@ int main() | |
char *inbuf, *outbuf; | |
int status, count; | |
bstr *str; | |
- z_stream z; | |
+ bz_stream bz; | |
idata = ReadInstallData(); | |
- fout = CreateFile("installfiles.gz", GENERIC_WRITE, 0, NULL, | |
+ fout = CreateFile("installfiles.bz2", GENERIC_WRITE, 0, NULL, | |
CREATE_ALWAYS, 0, NULL); | |
outbuf = bmalloc(BUFFER_SIZE); | |
inbuf = bmalloc(BUFFER_SIZE); | |
- z.zalloc = Z_NULL; | |
- z.zfree = Z_NULL; | |
- z.opaque = Z_NULL; | |
- deflateInit(&z, COMPRESSION); | |
- z.avail_in = 0; | |
- z.next_out = outbuf; | |
- z.avail_out = BUFFER_SIZE; | |
+ bz.bzalloc = NULL; | |
+ bz.bzfree = NULL; | |
+ bz.opaque = NULL; | |
+ BZ2_bzCompressInit(&bz, COMPRESSION, 0, 30); | |
+ bz.avail_in = 0; | |
+ bz.next_out = outbuf; | |
+ bz.avail_out = BUFFER_SIZE; | |
filept = NULL; | |
fin = NULL; | |
t@@ -229,8 +229,8 @@ int main() | |
} | |
while (fin != INVALID_HANDLE_VALUE) { | |
- if (z.avail_in == 0) { | |
- z.next_in = inbuf; | |
+ if (bz.avail_in == 0) { | |
+ bz.next_in = inbuf; | |
bytes_read = 0; | |
while (!bytes_read && fin) { | |
if (!ReadFile(fin, inbuf, BUFFER_SIZE, &bytes_read, NULL)) { | |
t@@ -241,29 +241,27 @@ int main() | |
if (!bytes_read) | |
OpenNextFile(idata->instfiles, &filept, &fin); | |
} | |
- z.avail_in = bytes_read; | |
+ bz.avail_in = bytes_read; | |
} | |
- if (z.avail_in == 0) { | |
- status = deflate(&z, Z_FINISH); | |
- count = BUFFER_SIZE - z.avail_out; | |
- if (!WriteFile(fout, outbuf, count, &bytes_written, NULL)) { | |
- printf("Write error\n"); | |
- } | |
- break; | |
- } | |
- status = deflate(&z, Z_NO_FLUSH); | |
- count = BUFFER_SIZE - z.avail_out; | |
+ status = BZ2_bzCompress(&bz, bz.avail_in == 0 ? BZ_FINISH : BZ_RUN); | |
+ count = BUFFER_SIZE - bz.avail_out; | |
if (!WriteFile(fout, outbuf, count, &bytes_written, NULL)) { | |
printf("Write error\n"); | |
} | |
- z.next_out = outbuf; | |
- z.avail_out = BUFFER_SIZE; | |
+ bz.next_out = outbuf; | |
+ bz.avail_out = BUFFER_SIZE; | |
+ if (status == BZ_STREAM_END) { | |
+ break; | |
+ } else if (status != BZ_RUN_OK && status != BZ_FINISH_OK) { | |
+ printf("Unexpected bzlib status: %d\n", status); | |
+ break; | |
+ } | |
} | |
- printf("Written compressed data: raw %lu, compressed %lu\n", | |
- z.total_in, z.total_out); | |
- bytes_written = z.total_out; | |
- deflateEnd(&z); | |
+ printf("Written compressed data: raw %d, compressed %d\n", | |
+ bz.total_in_lo32, bz.total_out_lo32); | |
+ bytes_written = bz.total_out_lo32; | |
+ BZ2_bzCompressEnd(&bz); | |
CloseHandle(fout); | |
t@@ -310,3 +308,8 @@ int main() | |
return 0; | |
} | |
+ | |
+void bz_internal_error(int errcode) | |
+{ | |
+ printf("bzip error %d\n", errcode); | |
+} | |
diff --git a/win32/setup.c b/win32/setup.c | |
t@@ -25,7 +25,7 @@ | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
-#include "zlib/zlib.h" | |
+#include "bzlib/bzlib.h" | |
#include <shlobj.h> | |
#include "contid.h" | |
t@@ -429,7 +429,7 @@ char *GetFirstFile(InstFiles *filelist, DWORD totalsize) | |
DWORD bufsiz; | |
char *inbuf, *outbuf; | |
int status; | |
- z_stream z; | |
+ bz_stream bz; | |
if (!filelist) | |
return NULL; | |
t@@ -441,22 +441,22 @@ char *GetFirstFile(InstFiles *filelist, DWORD totalsize) | |
bufsiz = filelist->filesize; | |
outbuf = bmalloc(bufsiz + 1); | |
- z.zalloc = Z_NULL; | |
- z.zfree = Z_NULL; | |
- z.opaque = Z_NULL; | |
- z.next_in = inbuf; | |
- z.avail_in = totalsize; | |
+ bz.bzalloc = NULL; | |
+ bz.bzfree = NULL; | |
+ bz.opaque = NULL; | |
+ bz.next_in = inbuf; | |
+ bz.avail_in = totalsize; | |
- inflateInit(&z); | |
- z.next_out = outbuf; | |
- z.avail_out = bufsiz; | |
+ BZ2_bzDecompressInit(&bz, 0, 0); | |
+ bz.next_out = outbuf; | |
+ bz.avail_out = bufsiz; | |
while (1) { | |
- status = inflate(&z, Z_SYNC_FLUSH); | |
- if ((status != Z_OK && status != Z_STREAM_END) || z.avail_out == 0) | |
+ status = BZ2_bzDecompress(&bz); | |
+ if ((status != BZ_OK && status != BZ_STREAM_END) || bz.avail_out == 0) | |
break; | |
} | |
- inflateEnd(&z); | |
+ BZ2_bzDecompressEnd(&bz); | |
outbuf[bufsiz] = '\0'; | |
return outbuf; | |
t@@ -827,7 +827,7 @@ DWORD WINAPI DoInstall(LPVOID lpParam) | |
BOOL skipfile, service_installed; | |
char *inbuf, *outbuf; | |
int status, count; | |
- z_stream z; | |
+ bz_stream bz; | |
InstFiles *listpt; | |
InstData *oldidata; | |
t@@ -877,28 +877,28 @@ DWORD WINAPI DoInstall(LPVOID lpParam) | |
outbuf = bmalloc(BUFFER_SIZE); | |
- z.zalloc = Z_NULL; | |
- z.zfree = Z_NULL; | |
- z.opaque = Z_NULL; | |
- z.next_in = inbuf; | |
- z.avail_in = idata->totalsize; | |
+ bz.bzalloc = NULL; | |
+ bz.bzfree = NULL; | |
+ bz.opaque = NULL; | |
+ bz.next_in = inbuf; | |
+ bz.avail_in = idata->totalsize; | |
- inflateInit(&z); | |
- z.next_out = outbuf; | |
- z.avail_out = BUFFER_SIZE; | |
+ BZ2_bzDecompressInit(&bz, 0, 0); | |
+ bz.next_out = outbuf; | |
+ bz.avail_out = BUFFER_SIZE; | |
while (1) { | |
- status = inflate(&z, Z_SYNC_FLUSH); | |
- if (status == Z_OK || status == Z_STREAM_END) { | |
- count = BUFFER_SIZE - z.avail_out; | |
- z.next_out = outbuf; | |
+ status = BZ2_bzDecompress(&bz); | |
+ if (status == BZ_OK || status == BZ_STREAM_END) { | |
+ count = BUFFER_SIZE - bz.avail_out; | |
+ bz.next_out = outbuf; | |
while (count >= fileleft) { | |
if (fileleft && !skipfile | |
- && !WriteFile(fout, z.next_out, fileleft, &bytes_written, NULL)) { | |
+ && !WriteFile(fout, bz.next_out, fileleft, &bytes_written, NULL)) { | |
printf("Write error\n"); | |
} | |
count -= fileleft; | |
- z.next_out += fileleft; | |
+ bz.next_out += fileleft; | |
if (!OpenNextOutput(&fout, idata->instfiles, idata->keepfiles, | |
&listpt, &fileleft, logf, &skipfile)) | |
break; | |
t@@ -906,18 +906,18 @@ DWORD WINAPI DoInstall(LPVOID lpParam) | |
if (fout == INVALID_HANDLE_VALUE) | |
break; | |
if (count && !skipfile | |
- && !WriteFile(fout, z.next_out, count, &bytes_written, NULL)) { | |
+ && !WriteFile(fout, bz.next_out, count, &bytes_written, NULL)) { | |
printf("Write error\n"); | |
} | |
fileleft -= count; | |
- z.next_out = outbuf; | |
- z.avail_out = BUFFER_SIZE; | |
+ bz.next_out = outbuf; | |
+ bz.avail_out = BUFFER_SIZE; | |
} | |
- if (status != Z_OK) | |
+ if (status != BZ_OK) | |
break; | |
} | |
- inflateEnd(&z); | |
+ BZ2_bzDecompressEnd(&bz); | |
if (!skipfile) | |
CloseHandle(fout); | |
t@@ -1174,3 +1174,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPre… | |
return 0; | |
} | |
+ | |
+void bz_internal_error(int errcode) | |
+{ | |
+} | |
diff --git a/win32/setup.rc b/win32/setup.rc | |
t@@ -3,6 +3,6 @@ | |
1 24 "setup.manifest" | |
0 INSTLIST "manifest" | |
-1 INSTFILE "installfiles.gz" | |
+1 INSTFILE "installfiles.bz2" | |
#include "dialogs.rc" | |
diff --git a/win32/zlib/Makefile.nocygwin b/win32/zlib/Makefile.nocygwin | |
t@@ -1,155 +0,0 @@ | |
-# Makefile for zlib | |
-# Copyright (C) 1995-1998 Jean-loup Gailly. | |
-# For conditions of distribution and use, see copyright notice in zlib.h | |
- | |
-# To compile and test, type: | |
-# ./configure; make test | |
-# The call of configure is optional if you don't have special requirements | |
-# If you wish to build zlib as a shared library, use: ./configure -s | |
- | |
-# To install /usr/local/lib/libz.* and /usr/local/include/zlib.h, type: | |
-# make install | |
-# To install in $HOME instead of /usr/local, use: | |
-# make install prefix=$HOME | |
- | |
-CC=gcc -mno-cygwin | |
- | |
-CFLAGS=-O | |
-#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7 | |
-#CFLAGS=-g -DDEBUG | |
-#CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \ | |
-# -Wstrict-prototypes -Wmissing-prototypes | |
- | |
-LDFLAGS=-L. -lz | |
-LDSHARED=$(CC) | |
-CPP=$(CC) -E | |
- | |
-VER=1.1.3 | |
-LIBS=libz.a | |
-SHAREDLIB=libz.so | |
- | |
-AR=ar rc | |
-RANLIB=ranlib | |
-TAR=tar | |
-SHELL=/bin/sh | |
- | |
-prefix = /usr/local | |
-exec_prefix = ${prefix} | |
-libdir = ${exec_prefix}/lib | |
-includedir = ${prefix}/include | |
- | |
-OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \ | |
- zutil.o inflate.o infblock.o inftrees.o infcodes.o infutil.o inffast.o | |
- | |
-OBJA = | |
-# to use the asm code: make OBJA=match.o | |
- | |
-DISTFILES = README FAQ INDEX ChangeLog configure Make*[a-z0-9] *.[ch] *.mms \ | |
- algorithm.txt zlib.3 msdos/Make*[a-z0-9] msdos/zlib.def msdos/zlib.rc \ | |
- nt/Make*[a-z0-9] nt/zlib.dnt amiga/Make*.??? os2/M*.os2 os2/zlib.def \ | |
- contrib/RE*.contrib contrib/*.txt contrib/asm386/*.asm contrib/asm386/*.c \ | |
- contrib/asm386/*.bat contrib/asm386/zlibvc.d?? contrib/asm[56]86/*.?86 \ | |
- contrib/asm[56]86/*.S contrib/iostream/*.cpp \ | |
- contrib/iostream/*.h contrib/iostream2/*.h contrib/iostream2/*.cpp \ | |
- contrib/untgz/Makefile contrib/untgz/*.c contrib/untgz/*.w32 \ | |
- contrib/minizip/[CM]*[pe] contrib/minizip/*.[ch] contrib/minizip/*.[td]?? \ | |
- contrib/delphi*/*.??? | |
- | |
-all: libz.a | |
- | |
-libz.a: $(OBJS) $(OBJA) | |
- $(AR) $@ $(OBJS) $(OBJA) | |
- -@ ($(RANLIB) $@ || true) >/dev/null 2>&1 | |
- | |
-match.o: match.S | |
- $(CPP) match.S > _match.s | |
- $(CC) -c _match.s | |
- mv _match.o match.o | |
- rm -f _match.s | |
- | |
-$(SHAREDLIB).$(VER): $(OBJS) | |
- $(LDSHARED) -o $@ $(OBJS) | |
- rm -f $(SHAREDLIB) $(SHAREDLIB).1 | |
- ln -s $@ $(SHAREDLIB) | |
- ln -s $@ $(SHAREDLIB).1 | |
- | |
-install: $(LIBS) | |
- -@if [ ! -d $(includedir) ]; then mkdir $(includedir); fi | |
- -@if [ ! -d $(libdir) ]; then mkdir $(libdir); fi | |
- cp zlib.h zconf.h $(includedir) | |
- chmod 644 $(includedir)/zlib.h $(includedir)/zconf.h | |
- cp $(LIBS) $(libdir) | |
- cd $(libdir); chmod 755 $(LIBS) | |
- -@(cd $(libdir); $(RANLIB) libz.a || true) >/dev/null 2>&1 | |
- cd $(libdir); if test -f $(SHAREDLIB).$(VER); then \ | |
- rm -f $(SHAREDLIB) $(SHAREDLIB).1; \ | |
- ln -s $(SHAREDLIB).$(VER) $(SHAREDLIB); \ | |
- ln -s $(SHAREDLIB).$(VER) $(SHAREDLIB).1; \ | |
- (ldconfig || true) >/dev/null 2>&1; \ | |
- fi | |
-# The ranlib in install is needed on NeXTSTEP which checks file times | |
-# ldconfig is for Linux | |
- | |
-uninstall: | |
- cd $(includedir); \ | |
- v=$(VER); \ | |
- if test -f zlib.h; then \ | |
- v=`sed -n '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`; \ | |
- rm -f zlib.h zconf.h; \ | |
- fi; \ | |
- cd $(libdir); rm -f libz.a; \ | |
- if test -f $(SHAREDLIB).$$v; then \ | |
- rm -f $(SHAREDLIB).$$v $(SHAREDLIB) $(SHAREDLIB).1; \ | |
- fi | |
- | |
-clean: | |
- rm -f *.o *~ libz.a libz.so* foo.gz so_locations \ | |
- _match.s maketree | |
- | |
-distclean: clean | |
- | |
-zip: | |
- mv Makefile Makefile~; cp -p Makefile.in Makefile | |
- rm -f test.c ztest*.c contrib/minizip/test.zip | |
- v=`sed -n -e 's/\.//g' -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`;\ | |
- zip -ul9 zlib$$v $(DISTFILES) | |
- mv Makefile~ Makefile | |
- | |
-dist: | |
- mv Makefile Makefile~; cp -p Makefile.in Makefile | |
- rm -f test.c ztest*.c contrib/minizip/test.zip | |
- d=zlib-`sed -n '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`;\ | |
- rm -f $$d.tar.gz; \ | |
- if test ! -d ../$$d; then rm -f ../$$d; ln -s `pwd` ../$$d; fi; \ | |
- files=""; \ | |
- for f in $(DISTFILES); do files="$$files $$d/$$f"; done; \ | |
- cd ..; \ | |
- GZIP=-9 $(TAR) chofz $$d/$$d.tar.gz $$files; \ | |
- if test ! -d $$d; then rm -f $$d; fi | |
- mv Makefile~ Makefile | |
- | |
-tags: | |
- etags *.[ch] | |
- | |
-depend: | |
- makedepend -- $(CFLAGS) -- *.[ch] | |
- | |
-# DO NOT DELETE THIS LINE -- make depend depends on it. | |
- | |
-adler32.o: zlib.h zconf.h | |
-compress.o: zlib.h zconf.h | |
-crc32.o: zlib.h zconf.h | |
-deflate.o: deflate.h zutil.h zlib.h zconf.h | |
-gzio.o: zutil.h zlib.h zconf.h | |
-infblock.o: infblock.h inftrees.h infcodes.h infutil.h zutil.h zlib.h zconf.h | |
-infcodes.o: zutil.h zlib.h zconf.h | |
-infcodes.o: inftrees.h infblock.h infcodes.h infutil.h inffast.h | |
-inffast.o: zutil.h zlib.h zconf.h inftrees.h | |
-inffast.o: infblock.h infcodes.h infutil.h inffast.h | |
-inflate.o: zutil.h zlib.h zconf.h infblock.h | |
-inftrees.o: zutil.h zlib.h zconf.h inftrees.h | |
-infutil.o: zutil.h zlib.h zconf.h infblock.h inftrees.h infcodes.h infutil.h | |
-minigzip.o: zlib.h zconf.h | |
-trees.o: deflate.h zutil.h zlib.h zconf.h trees.h | |
-uncompr.o: zlib.h zconf.h | |
-zutil.o: zutil.h zlib.h zconf.h | |
diff --git a/win32/zlib/README.zlib b/win32/zlib/README.zlib | |
t@@ -1,6 +0,0 @@ | |
-If you are intending to build the Win32 installer for dopewars, then place | |
-the zlib distribution into this directory. The installer expects to | |
-statically link with the file libz.a in this directory; the libz.a file | |
-included in the Cygwin distribution should _not_ be used, as this requires | |
-the CYGWIN.DLL file, which is not a standard Windows DLL. Use the | |
-Makefile.nocygwin file to compile zlib, as this adds in the -mno-cygwin flag. |