1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
|
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:
-----------------------------
* Install MinGW64 tools through [msys2](
https://github.com/msys2/msys2-installer/releases).
* Rename mingw32-make.exe to make.exe.
```
rename C:\msys64\mingw64\bin\mingw32-make.exe C:\msys64\mingw64\bin\make.exe
```
* Add your MinGW directory's bin (`C:\msys64\mingw64\bin`) to your system path variable.
* Install latest [python](http://www.python.org/). You'll need it to build the python module.
* Git-clone the pacparser source code, or download the source code tarball from the [releases](
https://github.com/manugarg/pacparser/releases) page, and extract it somewhere,
say `C:\workspace`.
* Compile pacparser and create ditribution.
```
cd C:\workspace\pacparser-*
make -C src -f Makefile.win32 dist
```
* Compile pacparser python module and copy required files to a directory (dist).
```
make -C src -f Makefile.win32 pymod-3.9
```
* Compile pacparser python module and copy required files to a directory (dist).
```
make -C src -f Makefile.win32 pymod-dist-3.9
```
## 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.3.8\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:
```python
=> 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()
```
|