Index: Sigil-0.2.2-Code/CMakeLists.txt
===================================================================
--- Sigil-0.2.2-Code/CMakeLists.txt
+++ Sigil-0.2.2-Code/CMakeLists.txt	2010-06-22 21:57:19.400603838 +0300
@@ -54,7 +54,9 @@
 
 add_subdirectory( src/tidyLib )
 add_subdirectory( src/ZipArchive )
+if( NOT UNIX )
 add_subdirectory( src/BoostParts )
+endif()
 add_subdirectory( src/Sigil )
 
 
Index: Sigil-0.2.2-Code/src/ZipArchive/CMakeLists.txt
===================================================================
--- Sigil-0.2.2-Code/src/ZipArchive/CMakeLists.txt
+++ Sigil-0.2.2-Code/src/ZipArchive/CMakeLists.txt	2010-06-22 21:29:46.427416354 +0300
@@ -20,11 +20,10 @@
 SOURCE_GROUP( zlib FILES ${SOURCES_ZLIB} )
 SOURCE_GROUP( bzip2 FILES ${SOURCES_BZIP2} )
 
-list( APPEND SOURCES ${SOURCES_ZLIB} ${SOURCES_BZIP2} )
-
 # Adding resource (RC) files for windows
 if (MSVC)
 	list( APPEND SOURCES ZipArchive.rc)
+	list( APPEND SOURCES ${SOURCES_ZLIB} ${SOURCES_BZIP2} )
 endif()
 
 add_library( ZipArchive ${SOURCES} ) 
@@ -42,6 +41,7 @@
 # Special compiler and linker flags for GCC
 if( UNIX )
 	add_definitions( -D_ZIP_SYSTEM_LINUX -D_ZIP_BZIP2_INTERNAL )
+	target_link_libraries( ZipArchive z bz2 )
 endif()
 
 
Index: Sigil-0.2.2-Code/src/ZipArchive/DeflateCompressor.cpp
===================================================================
--- Sigil-0.2.2-Code/src/ZipArchive/DeflateCompressor.cpp
+++ Sigil-0.2.2-Code/src/ZipArchive/DeflateCompressor.cpp	2010-06-22 21:54:14.268416506 +0300
@@ -14,7 +14,11 @@
 
 #include "stdafx.h"
 #include "DeflateCompressor.h"
+#ifdef _ZIP_SYSTEM_LINUX
+#include <zlib.h>
+#else
 #include "zlib/deflate.h"
+#endif
 
 namespace ZipArchiveLib
 {
@@ -31,8 +35,8 @@
 CDeflateCompressor::CDeflateCompressor(CZipStorage* pStorage)
 	:CBaseLibCompressor(pStorage)
 {
-	m_stream.zalloc = (zarch_alloc_func)_zipalloc;
-	m_stream.zfree = (zarch_free_func)_zipfree;	
+	m_stream.zalloc = (alloc_func)_zipalloc;
+	m_stream.zfree = (free_func)_zipfree;	
 }
 
 
@@ -40,9 +44,9 @@
 {
 	CZipCompressor::InitCompression(iLevel, pFile, pCryptograph);
 
-	m_stream.avail_in = (zarch_uInt)0;
-	m_stream.avail_out = (zarch_uInt)m_pBuffer.GetSize();
-	m_stream.next_out = (zarch_Bytef*)(char*)m_pBuffer;
+	m_stream.avail_in = (uInt)0;
+	m_stream.avail_out = (uInt)m_pBuffer.GetSize();
+	m_stream.next_out = (Bytef*)(char*)m_pBuffer;
 	m_stream.total_in = 0;
 	m_stream.total_out = 0;
 	
@@ -50,8 +54,8 @@
 	{
 		SetOpaque(&m_stream.opaque, &m_options);
 		
-		int err = zarch_deflateInit2_(&m_stream, iLevel,
-			Z_DEFLATED, -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, ZLIB_VERSION, sizeof(zarch_z_stream));
+		int err = deflateInit2_(&m_stream, iLevel,
+			Z_DEFLATED, -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, ZLIB_VERSION, sizeof(z_stream));
 		
 		CheckForError(err);
 	}	
@@ -59,7 +63,7 @@
 
 void CDeflateCompressor::Compress(const void *pBuffer, DWORD uSize)
 { 
-	m_stream.next_in = (zarch_Bytef*)pBuffer;
+	m_stream.next_in = (Bytef*)pBuffer;
 	m_stream.avail_in = uSize;
 	UpdateFileCrc(pBuffer, uSize);
 	
@@ -70,13 +74,13 @@
 		{
 			FlushWriteBuffer();
 			m_stream.avail_out = m_pBuffer.GetSize();
-			m_stream.next_out = (zarch_Bytef*)(char*)m_pBuffer;
+			m_stream.next_out = (Bytef*)(char*)m_pBuffer;
 		}
 		
 		if (m_pFile->m_uMethod == methodDeflate)
 		{
 			ZIP_ZLIB_TYPE uTotal = m_stream.total_out;
-			CheckForError(zarch_deflate(&m_stream,  Z_NO_FLUSH));
+			CheckForError(deflate(&m_stream,  Z_NO_FLUSH));
 			m_uComprLeft += m_stream.total_out - uTotal;
 		}
 		else
@@ -111,10 +115,10 @@
 				{
 					FlushWriteBuffer();
 					m_stream.avail_out = m_pBuffer.GetSize();
-					m_stream.next_out = (zarch_Bytef*)(char*)m_pBuffer;
+					m_stream.next_out = (Bytef*)(char*)m_pBuffer;
 				}
 				ZIP_SIZE_TYPE uTotal = m_stream.total_out;
-				err = zarch_deflate(&m_stream,  Z_FINISH);
+				err = deflate(&m_stream,  Z_FINISH);
 				m_uComprLeft += m_stream.total_out - uTotal;
 			}
 			while (err == Z_OK);
@@ -128,7 +132,7 @@
 			FlushWriteBuffer();
 		
 		if (m_pFile->m_uMethod == methodDeflate)
-			CheckForError(zarch_deflateEnd(&m_stream));
+			CheckForError(deflateEnd(&m_stream));
 		
 		
 		// it may be increased by the encrypted header size in CZipFileHeader::PrepareData
@@ -145,7 +149,7 @@
 	if (m_pFile->m_uMethod == methodDeflate)
 	{
 		SetOpaque(&m_stream.opaque, &m_options);
-		CheckForError(zarch_inflateInit2_(&m_stream, -MAX_WBITS, ZLIB_VERSION, sizeof(zarch_z_stream)));
+		CheckForError(inflateInit2_(&m_stream, -MAX_WBITS, ZLIB_VERSION, sizeof(z_stream)));
 	}
 	m_stream.total_out = 0;
 	m_stream.avail_in = 0;
@@ -156,7 +160,7 @@
 	if (m_bDecompressionDone)
 		return 0;
 
-	m_stream.next_out = (zarch_Bytef*)pBuffer;
+	m_stream.next_out = (Bytef*)pBuffer;
 	m_stream.avail_out = uSize > m_uUncomprLeft 
 		? (DWORD)m_uUncomprLeft : uSize;
 			
@@ -181,7 +185,7 @@
 				m_uComprLeft -= uToRead;
 			}
 			
-			m_stream.next_in = (zarch_Bytef*)(char*)m_pBuffer;
+			m_stream.next_in = (Bytef*)(char*)m_pBuffer;
 			m_stream.avail_in = uToRead;
 		}
 		
@@ -205,8 +209,8 @@
 		else
 		{
 			ZIP_SIZE_TYPE uTotal = m_stream.total_out;
-			zarch_Bytef* pOldBuf =  m_stream.next_out;
-			int ret = zarch_inflate(&m_stream, Z_SYNC_FLUSH);
+			Bytef* pOldBuf =  m_stream.next_out;
+			int ret = inflate(&m_stream, Z_SYNC_FLUSH);
 			// will not exceed DWORD
 			DWORD uToCopy = (DWORD)(m_stream.total_out - uTotal);
 			
@@ -227,7 +231,7 @@
 
 	if (!uRead && m_options.m_bCheckLastBlock && uSize != 0 && m_pFile->m_uMethod == methodDeflate)
 	{
-		if (zarch_inflate(&m_stream, Z_SYNC_FLUSH) != Z_STREAM_END)
+		if (inflate(&m_stream, Z_SYNC_FLUSH) != Z_STREAM_END)
 			// there were no more bytes to read and there was no ending block, 
 			// otherwise the method would return earlier
 			ThrowError(CZipException::badZipFile);
@@ -239,7 +243,7 @@
 void CDeflateCompressor::FinishDecompression(bool bAfterException)
 {	
 	if (!bAfterException && m_pFile->m_uMethod == methodDeflate)
-		zarch_inflateEnd(&m_stream);
+		inflateEnd(&m_stream);
 	EmptyPtrList();
 	ReleaseBuffer();
 }
Index: Sigil-0.2.2-Code/src/ZipArchive/DeflateCompressor.h
===================================================================
--- Sigil-0.2.2-Code/src/ZipArchive/DeflateCompressor.h
+++ Sigil-0.2.2-Code/src/ZipArchive/DeflateCompressor.h	2010-06-22 21:54:14.289604212 +0300
@@ -28,7 +28,11 @@
 #include "ZipExport.h"
 #include "BaseLibCompressor.h"
 #include "ZipException.h"
+#ifdef _ZIP_SYSTEM_LINUX
+#include <zlib.h>
+#else
 #include "zlib/zlib.h"
+#endif
 
 namespace ZipArchiveLib
 {
@@ -139,7 +143,7 @@
 
 private:			
 	COptions m_options;
-	zarch_z_stream m_stream;
+	z_stream m_stream;
 };
 
 } // namespace
Index: Sigil-0.2.2-Code/src/ZipArchive/ZipCompressor.cpp
===================================================================
--- Sigil-0.2.2-Code/src/ZipArchive/ZipCompressor.cpp
+++ Sigil-0.2.2-Code/src/ZipArchive/ZipCompressor.cpp	2010-06-22 21:54:14.278603859 +0300
@@ -28,12 +28,12 @@
 
 void CZipCompressor::UpdateFileCrc(const void *pBuffer, DWORD uSize)
 {
-	m_pFile->m_uCrc32 = zarch_crc32(m_pFile->m_uCrc32, (zarch_Bytef*)pBuffer, uSize);
+	m_pFile->m_uCrc32 = crc32(m_pFile->m_uCrc32, (Bytef*)pBuffer, uSize);
 }
 
 void CZipCompressor::UpdateCrc(const void *pBuffer, DWORD uSize)
 {
-	m_uCrc32 = zarch_crc32(m_uCrc32, (zarch_Bytef*)pBuffer, uSize);
+	m_uCrc32 = crc32(m_uCrc32, (Bytef*)pBuffer, uSize);
 }
 
 void CZipCompressor::UpdateOptions(const COptionsMap& optionsMap)
Index: Sigil-0.2.2-Code/src/ZipArchive/ZipCrc32Cryptograph.h
===================================================================
--- Sigil-0.2.2-Code/src/ZipArchive/ZipCrc32Cryptograph.h
+++ Sigil-0.2.2-Code/src/ZipArchive/ZipCrc32Cryptograph.h	2010-06-22 21:54:14.305416768 +0300
@@ -25,7 +25,11 @@
 	#pragma once
 #endif
 
+#ifdef _ZIP_SYSTEM_LINUX
+#include <zlib.h>
+#else
 #include "zlib/zlib.h"
+#endif
 
 #include "ZipCryptograph.h"
 #include "ZipFileHeader.h"
@@ -84,7 +88,7 @@
 	*/
 	static const unsigned long* GetCRCTable()
 	{
-			return zarch_get_crc_table();
+			return get_crc_table();
 	}
 private:
 
@@ -103,7 +107,7 @@
 	void CryptUpdateKeys(char c);
 	DWORD CryptCRC32(DWORD l, char c)
 	{
-		const unsigned long* CRC_TABLE = zarch_get_crc_table();
+		const unsigned long* CRC_TABLE = get_crc_table();
 		return CRC_TABLE[(l ^ c) & 0xff] ^ (l >> 8);
 	}
 	void CryptEncode(char &c)
Index: Sigil-0.2.2-Code/src/ZipArchive/ZipException.cpp
===================================================================
--- Sigil-0.2.2-Code/src/ZipArchive/ZipException.cpp
+++ Sigil-0.2.2-Code/src/ZipArchive/ZipException.cpp	2010-06-22 21:54:14.279593422 +0300
@@ -14,7 +14,11 @@
 
 #include "stdafx.h"
 #include "ZipException.h"
+#ifdef _ZIP_SYSTEM_LINUX
+#include <zlib.h>
+#else
 #include "zlib/zlib.h"
+#endif
 #include <errno.h>
 
 //////////////////////////////////////////////////////////////////////
Index: Sigil-0.2.2-Code/src/ZipArchive/ZipFileHeader.cpp
===================================================================
--- Sigil-0.2.2-Code/src/ZipArchive/ZipFileHeader.cpp
+++ Sigil-0.2.2-Code/src/ZipArchive/ZipFileHeader.cpp	2010-06-22 21:54:14.282603865 +0300
@@ -22,7 +22,11 @@
 
 #include "ZipCrc32Cryptograph.h"
 #include "BytesWriter.h"
+#ifdef _ZIP_SYSTEM_LINUX
+#include <zlib.h>
+#else
 #include "zlib/zlib.h"
+#endif
 
 #define FILEHEADERSIZE	46
 #define LOCALFILEHEADERSIZE	30
Index: Sigil-0.2.2-Code/src/Sigil/CMakeLists.txt
===================================================================
--- Sigil-0.2.2-Code/src/Sigil/CMakeLists.txt
+++ Sigil-0.2.2-Code/src/Sigil/CMakeLists.txt	2010-06-22 22:09:22.574416286 +0300
@@ -366,7 +366,10 @@
 
 # We need to pick up the stdafx.h file, the ui*.h files,
 # and the headers for the linked-to libraries
-include_directories( ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ../ZipArchive ../tidyLib ../BoostParts )
+include_directories( ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ../ZipArchive ../tidyLib )
+if ( NOT UNIX )
+    include_directories( ../BoostParts )
+endif()
 
 link_directories ( ${PROJECT_BINARY_DIR}/lib ) 
 
@@ -379,7 +382,14 @@
     add_executable( ${PROJECT_NAME} ${ALL_SOURCES} )
 endif()
 
-target_link_libraries( ${PROJECT_NAME} tidyLib ZipArchive BoostParts ${QT_LIBRARIES} )
+target_link_libraries( ${PROJECT_NAME} ZipArchive tidyLib ${QT_LIBRARIES} )
+if ( UNIX )
+    # These seem to not be actually currently used, left just in case
+    # this changes in the future (-Wl,--as-needed pulls them out until then)
+    target_link_libraries( ${PROJECT_NAME} boost_date_time boost_thread )
+else()
+    target_link_libraries( ${PROJECT_NAME} BoostParts )
+endif()
 
 # "Link time code generation" flags for MSVC
 if( MSVC )
