This file is about the instructions to build (and use) pacparser on Windows.
For general information on pacparser, please have a look at README in the same
directory.

Building pacparser on Windows:
-----------------------------
For compiling pacparser on Windows, you'll need MinGW (www.mingw.org) tools.

Detailed Instructions:
----------------------

Set up tools:

1.  Install MinGW. Download the automated installer from here:
    http://sourceforge.net/projects/mingw/files/
    Running this installer lets you select what component you want to install.
    Default options (C-compiler and MinGW Development Toolkit) should work
    fine.

2.  Rename mingw32-make.exe to make.exe.
      rename C:\MinGW\bin\mingw32-make.exe C:\MinGW\bin\make.exe

3.  Add your MinGW directory's bin (C:\MinGW\bin) to your system path variable.

4.  Install 7-zip to extract .tar.gz files, if you don't have an equivalent
    program already.
    http://www.7-zip.org/download.html

5.  Install latest python. You'll need it to build python module.
    http://www.python.org/getit/

======== Done setting up tools ==========

6.  Now download pacparser source code tarball from
    https://github.com/pacparser/pacparser/releases and extract it somewhere,
    say C:\workspace.

7.  Now extract the spidermonekey source tarball, js-*.tar.gz, located at
    src\spidermonkey\js-*.tar.gz inside the pacparser source directory.

8.  Compile pacparser and create ditribution.
      cd C:\workspace\pacparser-*
      make -C src -f Makefile.win32 dist

9. Compile pacparser python module and copy required files to a directory
    (dist).
      make -C src -f Makefile.win32 pymod

Using pacparser on Windows:
--------------------------
* In C programs:

Make sure that you have pacparser.dll in the sytem path somewhere
(current directory would do just fine for testing purpose).
  Change to your program's directory:
  =>  cd c:\workspace\pacparser-1.2.1\examples
  Copy pacparser.dll here and compile your program:
  => gcc -o pactest pactest.c -lpacparser -L.
  Run your program:
  => pactest wpad.dat http://www.google.com www.google.com
  'PROXY proxy1.manugarg.com:3128; PROXY proxy2.manugarg.com:3128; DIRECT'

* In python programs:

Install pacparser python module by running install.py in the distribution
folder. You'll then be able to use pacparser python module in the following
manner:

  => C:\python25\python
  >>> import pacparser
  >>> pacparser.init()
  >>> pacparser.parse_pac('examples/wpad.dat')
  >>> pacparser.find_proxy('http://www.google.com', 'www.google.com')
  'PROXY proxy1.manugarg.com:3128; PROXY proxy2.manugarg.com:3128; DIRECT'
  >>> pacparser.cleanup()
