Building zlib, libpng with mingw
Thursday, August 4, 2011 11:32:05 AM
I wanted to use libpng library from C++. It depends on zlib.
It looks like pngwriter does not compile with the latest 1.5.x version
of libpng. Instead, using older 1.4.x is ok.
Download(ftp://ftp.simplesystems.org/pub/libpng/png/src/libpng-1.4.8.tar.bz2
)
Freetype2 has no external library dependence.
Building zlib
- Unzip the zlib file and edit win32/makefile.gcc
- Add following lines at the head of the file
BINARY_PATH=${HOME}/Local/zlib-1.2.5/bin INCLUDE_PATH=${HOME}/Local/zlib-1.2.5/include LIBRARY_PATH=${HOME}/Local/zlib-1.2.5/lib
Wrapping the HOME variables with curl bracket is important in
makefile. Without it, the actual installation path would be
./${H}OME/Local/..., and if ${H} is undefined, it’s just
./OME/Local/…, which is not what I want.
To build a shared library, change the SHARED_MODE to 1, as is written
in the makefile. - Then build by ‘make –f win32/makefile.gcc’
- Test by ‘make –f win32/makefile.gcc test’
- Install by ‘make –f win32/makefile.gcc test’
Building libpng
It looks like pngwriter does not compile with the latest 1.5.x version
of libpng. Instead, using older 1.4.x is ok.
Download(ftp://ftp.simplesystems.org/pub/libpng/png/src/libpng-1.4.8.tar.bz2
)
- Untar and configure like this
export LDFLAGS="-L/home/est/Local/zlib-1.2.5/lib" export CPPFLAGS="-I/home/est/Local/zlib-1.2.5/include" export CXXFLAGS="-I/home/est/Local/zlib-1.2.5/include" ./configure --prefix=/home/est/Local/libpng-1.5.4 make make install
Building freetype
Freetype2 has no external library dependence.
./configure --prefix=/home/est/Local/freetype-2.4.6
- make && make install




