20
20

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

MinGWでSilver Searcher(ag.exe)をビルドする方法。

Last updated at Posted at 2013-04-17

下記の手順でビルドした実行ファイルをGithubにあげました。
もし、ビルドするのがめんどくさかったら使ってください。

====

必要なもの

手順

  • ggreer/the_silver_searcherをクローンし、c9c2b5b をcheckoutする。(最近のコミットだとうまくいかないらしい。下のコメント欄参照)
git clone git://github.com/ggreer/the_silver_searcher.git
cd the_silver_searcher
git checkout c9c2b5b 
  • pcre-x86-mingw4-8.21-src.tar.bz2内のpcre.h.genericconfig.h.genericを.genericを外してthe_silver_searcher/src内にコピーする。
  • zlib-x86-mingw4-1.2.6-1-lib.tar.bz2内のinclude/zconf.hinclude/zlib.hthe_silver_searcher/src内にコピーする。

  • pcre-x86-mingw4-8.21-bin.tar.bz2内のbin/libpcre.dllthe_silver_searcher内にコピーする。

  • zlib-x86-mingw4-1.2.6-1-bin.tar.bz2内のbin/libz.dllthe_silver_searcher内にコピーする。

  • the_silver_searcher/Makefile.w32を以下のように書き換える。

make
- LIBS = -lz -lpthread -lpcre -lshlwapi
+ LIBS =  ./libz.dll ./libpcre.dll -lpthread  -lshlwapi
  • the_silver_searcherに移動してコマンドプロンプトからmakeする。
shell
C:/Users/rbtnn/Desktop/the_silver_searcher>ls
LICENSE       README.md       doc          the_silver_searcher.spec
Makefile.am   ag.bashcomp.sh  libpcre.dll
Makefile.w32  build.sh        libz.dll
NOTICE        configure.ac    src

C:/Users/rbtnn/Desktop/the_silver_searcher>ls src
config.h      ignore.h  options.c  print.h    search.h  zconf.h
decompress.c  log.c     options.h  scandir.c  uthash.h  zlib.h
decompress.h  log.h     pcre.h     scandir.h  util.c
ignore.c      main.c    print.c    search.c   util.h

C:/Users/rbtnn/Desktop/the_silver_searcher>mingw32-make -f Makefile.w32
gcc -c -O2 -Isrc src/decompress.c -o src/decompress.o
gcc -c -O2 -Isrc src/ignore.c -o src/ignore.o
gcc -c -O2 -Isrc src/log.c -o src/log.o
gcc -c -O2 -Isrc src/main.c -o src/main.o
gcc -c -O2 -Isrc src/options.c -o src/options.o
gcc -c -O2 -Isrc src/print.c -o src/print.o
gcc -c -O2 -Isrc src/scandir.c -o src/scandir.o
gcc -c -O2 -Isrc src/search.c -o src/search.o
gcc -c -O2 -Isrc src/util.c -o src/util.o
gcc -o ag.exe src/decompress.o src/ignore.o src/log.o src/main.o src/options.o s
rc/print.o src/scandir.o src/search.o src/util.o ./libz.dll ./libpcre.dll -lpthr
ead  -lshlwapi

C:/Users/rbtnn/Desktop/the_silver_searcher>ls
LICENSE       README.md       configure.ac  src
Makefile.am   ag.bashcomp.sh  doc           the_silver_searcher.spec
Makefile.w32  ag.exe          libpcre.dll
NOTICE        build.sh        libz.dll

C:/Users/rbtnn/Desktop/the_silver_searcher>
20
20
6

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
20
20

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?