Zlib
From FreeOrionWiki
FreeOrion uses libpng which depends on another library, zlib.
If you need to build libpng from source, you also need to build zlib at the same time.
Getting Sources
The libpng source can be downloaded here:
http://www.libpng.org/pub/png/libpng.html
Building libpng also requires the zlib source code, which can be gotten here:
Scroll down a page or two to find links to source files in tar.gz format.
Unpack the libpng source somewhere, and put the zlib source in a directory called zlib in the same place as the libpng directory. For example, if your libpng source is in
c:\stuff\lpng1234\
then rename the zlib directory from the tar.gz and place it here:
c:\stuff\zlib\
Building
Load up the libpng MSVC7.1 project file, and update it to your version of MSVC. This works with MSVC 2008 and 2010.
You only need to build the libpng DLL, which will also build the zlib DLL.
As of libpng 1.44 with zlib zlib 1.2.5, this should work.
Previous versions
With some previosu versions of zlib, there may be errors such as:
------ Build started: Project: zlib, Configuration: DLL ASM Debug Win32 ------ Assembling... Assembling: c:\build\zlib\contrib\masmx86\inffas32.asm c:\build\zlib\contrib\masmx86\inffas32.asm(647) : error A2070:invalid instruction operands c:\build\zlib\contrib\masmx86\inffas32.asm(649) : error A2070:invalid instruction operands c:\build\zlib\contrib\masmx86\inffas32.asm(663) : error A2070:invalid instruction operands c:\build\zlib\contrib\masmx86\inffas32.asm(720) : error A2070:invalid instruction operands Project : error PRJ0019: A tool returned an error code from "Assembling..." Build Time 0:00 Build log was saved at "file://c:\build\lpng1234\projects\visualc71\Win32_DLL_ASM_Debug\ZLib\BuildLog.htm" zlib - 1 error(s), 0 warning(s)
Searching for a fix online, I found this:
http://www.achacha.org/vc2008_zlib123/
which says, in part, to make this change to the error lines above:
- movd mm7,[esi]
+ movd mm7,dword ptr[esi]
However only two of the four error lines actually look like this. The solution is to put a
dword ptr
immediately before the [ on all four lines.
After this, zlib an libpng should build. Use the Release DLL configurations.
The resulting files, libpng13.dll and zlib1.dll as of this writing, go in the main FreeOrion directory, where freeorion.exe is located.