tcpdump 4.5.1をAndroid NDKでクロスコンパイルする

http://www.tcpdump.org/#latest-releaseからtcpdump-4.5.1.tar.gzをダウンロード。

libpcap 1.5.3をAndroid NDKでクロスコンパイルする - android-memoの日記」に従ってlibpcapがインストールされている前提です。

例によってconfig.subが古いので、libtoolのファイルをコピーしてからconfigureします。

$ tar xvzf tcpdump-4.5.1.tar.gz
$ cd tcpdump-4.5.1
$ for i in `find . -name config.guess` ; do cp /usr/local/share/libtool/config/config.guess $i ; done
$ for i in `find . -name config.sub` ; do cp /usr/local/share/libtool/config/config.sub $i ; done
$ PATH=$ANDROID_APP_ROOT/libpcap-1.5.3/bin:$PATH CFLAGS='-O2 -DNBBY=8' LDFLAGS=-s ac_cv_linux_vers=2 ./configure --host=arm-linux-androideabi --prefix=$ANDROID_APP_ROOT/tcpdump-4.5.1
$ perl -i.bak -pe 's#setprotoent#//setprotoent#g;s#endprotoent#//endprotoent#g;' print-isakmp.c
$ make
$ make install

installed file

sbin/tcpdump
sbin/tcpdump.4.5.1
share/man/man1/tcpdump.1