
* OpenCV-2.1.0-win32-vs2008.exe
* Cygwin 1.5.25
* Windows XP SP3


1. copy *.h *.lib *dll

$ export CV=/cygdrive/c/OpenCV2.1
$ cp $CV/include/opencv /usr/local/include/
$ cp $CV/bin/*.dll /usr/local/bin
$ cp $CV/lib/*.lib /usr/local/lib


2. make *.a from *.dll and *.lib

$ cat >dll2a.sh
#!/bin/sh
bindir=/usr/local/bin
libdir=/usr/local/lib
for i in $*; do
  echo EXPORTS >$$.def
  nm $libdir/$i.lib | grep ' T _' | sed 's/.* T _//' >>$$.def
  dlltool --def $$.def --dllname $bindir/$i.dll --output-lib $libdir/lib$i.a
  rm $$.def
done
^D
$ sh dll2a.sh cxcore210 cv210 highgui210 cvaux210 ml210 cxts210


3. create opencv.pc

$ cat >/usr/lib/pkgconfig/opencv.pc
# Package Information for pkg-config

prefix=/usr/local
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include/opencv

Name: OpenCV
Description: Intel(R) Open Source Computer Vision Library
Version: 2.1.0
Libs: -L${libdir} -lcxcore210 -lcv210 -lhighgui210 -lcvaux210 -lml210 -lcxts210
Cflags: -I${includedir}
^D
$ pkg-config opencv --cflags
-I/usr/local/include/opencv
$ pkg-config opencv --libs
-L/usr/local/lib -lcxcore210 -lcv210 -lhighgui210 -lcvaux210 -lml210 -lcxts210

4. install Cv.pm

$ perl -MCPAN -eshell
cpan> make Cv
cpan> test Cv
cpan> install Cv


thanks,
Yuta
