How to compile CvsGraph on Windows with Mingw
Building CvsGraph on Windows can be a rather involved process depending on what tools and libraries you've already got installed on your system. If you just need CvsGraph binaries, you can get them from the
CvsGraph Homepage. But if you need to compile CvsGraph yourself, these instructions will tell you how.
CvsGraph depends on a 2D graphics library called
gd which in turn depends on the
freetype2,
libpng,
jpeg, and
gzip libraries. The instructions will walk you through the installation of all of the dependencies. They use the following two placeholders to represent system paths which you should substitute with your own values:
<MINGW_INSTALL> represents mingw installation directory, typically c:/mingw
<DEST_DIR> represents the destination directory for installed cvsgraph files and dependencies (I use c:/mingw/usr as the destination for CvsGraph and other packages I manually compile, and add c:/mingw/usr/bin to the system PATH).
Steps:
1) Download and install
mingw and
msys from
http://www.mingw.org/download.shtml. Both packages have gui installers.
2) Download zlib from
http://www.gzip.org/zlib/. Install it by running the following commands at the msys bash prompt:
$ tar -xzvf zlib-1.1.4.tar.gz $ cd zlib-1.1.4 $ ./configure --prefix=<DEST_DIR> $ make $ make install
3) Download libpng from
http://www.libpng.org/pub/png/libpng.html. Install it with these commands.
$ tar -xjvf libpng-1.2.5.tar.bz2 $ cd libpng-1.2.5 $ cp scripts/makefile.cygwin Makefile # cygwin makefile seems to work $ rm INSTALL # bug in makefile causes errors when this file is present $ make install prefix=<DEST_DIR> ZLIBINC=<DEST_DIR>/include ZLIBLIB=<DEST_DIR>/lib
4) Download the jpeg library from
http://www.ijg.org/. Install with
$ tar -xzvf jpegsrc.v6b.tar.gz $ cd jpeg-6b $ ./configure --prefix=<DEST_DIR> $ make $ mkdir <DEST_DIR>/man/man1 # I needed this to prevent errors during install $ make install install-lib
5) Download Freetype2 from
http://www.freetype.org/. Install with
$ tar -xjvf freetype-2.1.5.tar.bz2 $ cd freetype-2.1.5 $ ./configure --prefix=<DEST_DIR> $ make $ make install
6) Download libgd from
http://www.boutell.com/gd/. Install with
$ tar -xzvf gd-2.0.15.tar.gz $ cd gd-2.0.15 $ LDFLAGS=-L<DEST_DIR>/lib CPPFLAGS=-I<DEST_DIR>/include ./configure --prefix=<DEST_DIR> $ make $ make install
7) Download gnu regex from
http://www.gnu.org/directory/regex.html. Install with
$ tar -xzvf regex-0.12.tar.gz $ cd regex-0.12 $ ./configure --prefix=<DEST_DIR> $ make regex.o $ cp -p regex.h <DEST_DIR>/include/ $ ar rcs <DEST_DIR>/lib/libregex.a regex.o
8) If you don't have the lex and yacc tools (or their equivalents flex and bison) installed you can download executables from the gnuwin32 project at
http://gnuwin32.sourceforge.net/packages/flex.htm and
http://gnuwin32.sourceforge.net/packages/bison.htm. To install the gnuwin32 packages just extract the zip files to a folder like c:/gnuwin32. Then add the bin subdirectory to the path PATH by running
$ export PATH=$PATH:/c/gnuwin32/bin
9) Finally, download cvsgraph from
http://www.akhphd.au.dk/~bertho/cvsgraph/. Start installing with
$ tar -xzvf cvsgraph-1.4.0.tar.gz $ cd cvsgraph-1.4.0 $ ./configure --prefix=<DEST_DIR> --with-gd-inc=<DEST_DIR>/include --with-gd-lib=<DEST_DIR>/lib
Then edit cvsgraph.c and remove the line
#include <sys/wait.h>
and edit Makefile changing the assignment of LIBS from
LIBS = -L<DEST_DIR>/lib -lgd -lfreetype -ljpeg -lpng -lm
to
LIBS = -L<DEST_DIR>/lib -lgd -lfreetype -ljpeg -lpng -lm -liberty -lregex
Build and install with
$ make $ cp cvsgraph.exe <DEST_DIR>/bin/

