From fe491ddf9466828b38dca717c7ea1e9ecc1e1841 Mon Sep 17 00:00:00 2001 From: anders_k Date: Sat, 19 Sep 2015 18:54:02 +0000 Subject: [PATCH] Changed the order of the zlib lib files SConstruct searches for so it can find the MinGW specific .a first. 64-bit MinGW has problems with a MSVC generated lib file. git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6615 212acab6-be3b-0410-9dea-997c60f758d6 --- SConstruct | 4 ++-- Source/build.cpp | 17 ----------------- Source/cbzip2.h | 14 +++++++------- Source/czlib.h | 15 +++++++-------- 4 files changed, 16 insertions(+), 34 deletions(-) diff --git a/SConstruct b/SConstruct index a4fe73e4..f3be7f26 100644 --- a/SConstruct +++ b/SConstruct @@ -468,8 +468,8 @@ if 'ZLIB_W32' in defenv: ] ) )) - # Search for import library of zlib for VisualC or mingw - for importlib in ['zdll.lib', 'libzdll.a', 'libz.dll.a']: + # Search for import library of zlib for mingw or VisualC + for importlib in ['libzdll.a', 'libz.dll.a', 'zdll.lib']: defenv['ZLIB_W32_LIB'] = os.path.dirname(str( defenv.FindFile(importlib, [ diff --git a/Source/build.cpp b/Source/build.cpp index 283f6c5f..20b94ecb 100644 --- a/Source/build.cpp +++ b/Source/build.cpp @@ -857,14 +857,6 @@ int CEXEBuild::add_db_data(IMMap *mmap) // returns offset bufferlen = INT_MAX-st-sizeof(int); // so maximize compressor room and hope the file compresses well db->resize(st + bufferlen + sizeof(int)); -#if defined(NSIS_CONFIG_COMPRESSION_SUPPORT) && defined(__GNUC__) && defined(_WIN64) // There is another one of these, remove both when fixed - // BUGBUG: zlib is currently broken on 64-bit MinGW - if (compressor == &zlib_compressor) - { - ERROR_MSG(_T("\nError: ZLib is currently broken on this platform!\n")); - return -1; - } -#endif int n = compressor->Init(build_compress_level, build_compress_dict_size); if (n != C_OK) { @@ -2577,15 +2569,6 @@ int CEXEBuild::write_output(void) RET_UNLESS_OK( check_write_output_errors() ); -#if defined(NSIS_CONFIG_COMPRESSION_SUPPORT) && defined(__GNUC__) && defined(_WIN64) // There is another one of these, remove both when fixed - // BUGBUG: zlib is currently broken on 64-bit MinGW - if (compressor == &zlib_compressor) - { - ERROR_MSG(_T("\nError: ZLib is currently broken on this platform!\n")); - return PS_ERROR; - } -#endif - has_called_write_output=true; #ifdef NSIS_CONFIG_PLUGIN_SUPPORT diff --git a/Source/cbzip2.h b/Source/cbzip2.h index 9ec12182..ee6cefe4 100644 --- a/Source/cbzip2.h +++ b/Source/cbzip2.h @@ -26,20 +26,20 @@ class CBzip2 : public ICompressor { public: virtual ~CBzip2() {} - int Init(int level, unsigned int dict_size) { + virtual int Init(int level, unsigned int dict_size) { last_ret = !BZ_STREAM_END; stream = new bz_stream; if (!stream) return BZ_MEM_ERROR; return BZ2_bzCompressInit(stream, level, 0, 30); } - int End() { + virtual int End() { int ret = BZ2_bzCompressEnd(stream); delete stream; return ret; } - int Compress(bool finish) { + virtual int Compress(bool finish) { // act like zlib when it comes to stream ending if (last_ret == BZ_STREAM_END && finish) return C_FINISHED; @@ -51,12 +51,12 @@ class CBzip2 : public ICompressor { return C_OK; } - void SetNextIn(char *in, unsigned int size) { + virtual void SetNextIn(char *in, unsigned int size) { stream->next_in = (unsigned char*) in; stream->avail_in = size; } - void SetNextOut(char *out, unsigned int size) { + virtual void SetNextOut(char *out, unsigned int size) { stream->next_out = (unsigned char*) out; stream->avail_out = size; } @@ -73,11 +73,11 @@ class CBzip2 : public ICompressor { return stream->avail_out; } - const TCHAR* GetName() { + virtual const TCHAR* GetName() { return _T("bzip2"); } - const TCHAR* GetErrStr(int err) { + virtual const TCHAR* GetErrStr(int err) { switch (err) { case BZ_SEQUENCE_ERROR: diff --git a/Source/czlib.h b/Source/czlib.h index 4156d619..5f24f068 100644 --- a/Source/czlib.h +++ b/Source/czlib.h @@ -26,34 +26,33 @@ class CZlib : public ICompressor { public: virtual ~CZlib() {} - int Init(int level, unsigned int dict_size) { + virtual int Init(int level, unsigned int dict_size) { stream = new z_stream; if (!stream) return Z_MEM_ERROR; stream->zalloc = (alloc_func)Z_NULL; stream->zfree = (free_func)Z_NULL; stream->opaque = (voidpf)Z_NULL; - return deflateInit2(stream, level, Z_DEFLATED, -MAX_WBITS, MAX_MEM_LEVEL, Z_DEFAULT_STRATEGY); } - int End() { + virtual int End() { int ret = deflateEnd(stream); delete stream; return ret; } - int Compress(bool finish) { + virtual int Compress(bool finish) { return deflate(stream, finish?Z_FINISH:0); } - void SetNextIn(char *in, unsigned int size) { + virtual void SetNextIn(char *in, unsigned int size) { stream->next_in = (unsigned char*)in; stream->avail_in = size; } - void SetNextOut(char *out, unsigned int size) { + virtual void SetNextOut(char *out, unsigned int size) { stream->next_out = (unsigned char*)out; stream->avail_out = size; } @@ -70,11 +69,11 @@ class CZlib : public ICompressor { return stream->avail_out; } - const TCHAR* GetName() { + virtual const TCHAR* GetName() { return _T("zlib"); } - const TCHAR* GetErrStr(int err) { + virtual const TCHAR* GetErrStr(int err) { switch (err) { case Z_STREAM_ERROR: