$mingw-get install pthread
$mingw-get install autotools
download zlib-1.2.7
$tar vxzf zlib-1.2.7.tar.gz
$cd zlib-1.2.7
$vim win32/Makefile.gcc
add following three lines
BINARY_PATH=/mingw/bin
INCLUDE_PATH=/mingw/include
LIBRARY_PATH=/mingw/lib
Then
$make -f win32/Makefile.gcc
$make install
download pcre-8.32
$unzip pcre-8.32.zip
$cd pcre-8.32.zip
$./configure CC=mingw32-gcc CXX=mingw32-g++ --prefix=/mingw --enable-jit --disable-shared
$make
$git clone https://github.com/ggreer/the_silver_searcher.git
$cd the_silver_searcher
$vim configure
Comment out line PKG_CHEC_MODULES(PCRE, libpcre)
$aclocal && autoconf && autoheader && automake --add-missing
$./configure CC=mingw32-gcc CXX=mingw32-g++ PCRE_CFLAGS='-I/z/tmp/pcre/pcre-8.32' PCRE_LIBS='-L/z/tmp/pcre/pcre-8.32/.libs -static -lpcre' LIBS='-lshlwapi'
$ make CFLAGS='-g -O2 -I/z/tmp/pcre/pcre-8.32 -Wall -Wextra -DPCRE_STATIC'
if the last linking process has error, directly issue command below to link
$mingw32-gcc -g -O2 -I/z/tmp/pcre/pcre-8.32 -Wall -Wextra -DPCRE_STATIC -o ag.exe src/ignore.o src/log.o src/options.o src/print.o src/scandir.o src/search.o src/util.o src/decompress.o src/main.o -lz -lpthread -lshlwapi
Now you have ag.exe, copy ag.exe and pthreadGC2.dll to same place, add this folder to your PATH, now you can use ag to search.
Install ack.vim
Put line below in to your .vimrc
let g:ackprg = 'ag --nogroup --nocolor --column'
When I use the ag build from the process above, I always got this error message, don't know how to eliminate it. Why ag will issue git command?
'git' is not recognized as an internal or external command, operable program or batch file.