# $Id: Portfile 92837 2012-05-09 00:51:48Z ryandesign@macports.org $

PortSystem 1.0
name		wireshark
version		1.6.7
revision	1
categories	net
maintainers	darkart.com:opendarwin.org
description	Graphical network analyzer and capture tool
homepage	http://wireshark.org/
platforms	darwin

long_description A network analyzer that lets you capture and \
		 interactively browse Ethernet frames. \
		 Packet data can be read from a file, or live from a local \
		 network interface.

master_sites	http://www.wireshark.org/download/src/			\
		http://www.wireshark.org/download/src/all-versions/

checksums           md5     7e39f1c0ea4abd8bffa5122df800ca5d \
                    sha1    392c4f35cd8d16287ba9eba3afec226fcadd9746 \
                    rmd160  20ced0176d0c2f7a856078d033ebf7ba531f7f57

use_bzip2	yes

conflicts	wireshark-devel

depends_build 		\
		port:pkgconfig
depends_lib 		\
		port:bzip2 \
		port:c-ares \
		path:lib/pkgconfig/glib-2.0.pc:glib2 \
		port:gtk2 \
		port:openssl \
		port:libpcap \
		port:zlib

configure.args	\
		--without-libsmi \
		--disable-usr-local \
		--without-adns \
		--with-c-ares=${prefix} \
		--without-pcre \
		--disable-ipv6 \
		--with-pcap=${prefix} \
		--with-ssl=${prefix} \
		--with-zlib=${prefix} \
		--mandir=\\\${prefix}/share/man \
		--infodir=\\\${prefix}/share/info \
		--without-portaudio \
		--disable-warnings-as-errors \
		--without-gnutls	\
		--without-python

configure.ldflags-append "-Wl,-search_paths_first"

pre-destroot {
	xinstall -d ${destroot}${prefix}/include/wireshark/epan/crypt/
	xinstall -d ${destroot}${prefix}/include/wireshark/epan/dfilter/
	xinstall -d ${destroot}${prefix}/include/wireshark/epan/dissectors/
	xinstall -d ${destroot}${prefix}/include/wireshark/epan/ftypes/
	xinstall -d ${destroot}${prefix}/include/wireshark/wiretap/
	xinstall -m 644 -W ${worksrcpath}/ color.h config.h register.h ${destroot}${prefix}/include/wireshark/
	eval xinstall -m 644 [glob ${worksrcpath}/epan/*.h] ${destroot}${prefix}/include/wireshark/epan/
	eval xinstall -m 644 [glob ${worksrcpath}/epan/crypt/*.h] ${destroot}${prefix}/include/wireshark/epan/crypt/
	eval xinstall -m 644 [glob ${worksrcpath}/epan/dfilter/*.h] ${destroot}${prefix}/include/wireshark/epan/dfilter/
	eval xinstall -m 644 [glob ${worksrcpath}/epan/dissectors/*.h] ${destroot}${prefix}/include/wireshark/epan/dissectors/
	eval xinstall -m 644 [glob ${worksrcpath}/epan/ftypes/*.h] ${destroot}${prefix}/include/wireshark/epan/ftypes/
	eval xinstall -m 644 [glob ${worksrcpath}/wiretap/*.h] ${destroot}${prefix}/include/wireshark/wiretap/
}

if {${configure.compiler} == "clang"} {
	configure.compiler llvm-gcc-4.2
	# see #32386
	configure.cflags -fno-var-tracking
}

variant adns description {use adns library for async. dns resolution instead of the default c-ares library} {
	configure.args-append	--with-adns=${prefix} \
							--without-c-ares
	configure.args-delete	--without-adns \
							--with-c-ares=${prefix}
	depends_lib-append	port:adns
}

variant gnutls {
	configure.args-append	--with-gnutls=yes
	depends_lib-append	port:gnutls
}

variant libgcrypt {
	configure.args-append	--with-libgcrypt-prefix=${prefix}
	depends_lib-append	port:libgcrypt
}

variant ipv6 {
	configure.args-append	--enable-ipv6
	configure.args-delete	--disable-ipv6
}

variant lua {
	configure.args-delete	--without-lua
	configure.args-append	--with-lua=${prefix}
	depends_lib-append	port:lua
}

variant libsmi {
	configure.args-append	--with-libsmi=${prefix}
	configure.args-delete	--without-libsmi
	depends_lib-append	port:libsmi
}

variant pcre {
	configure.args-append	--with-pcre=${prefix}
	configure.args-delete	--without-pcre
	depends_lib-append	port:pcre
}

variant python25 description {use python25 for the experimental python interface} conflicts python26 python27 {
	configure.args-append	--with-python=${prefix}
	configure.args-delete	--without-python
	depends_lib-append	port:python25
}

variant python26 description {use python26 for the experimental python interface} conflicts python25 python27 {
	configure.args-append	--with-python=${prefix}
	configure.args-delete	--without-python
	depends_lib-append	port:python26
}

variant python27 description {use python27 for the experimental python interface} conflicts python25 python26 {
	configure.args-append	--with-python=${prefix}/lib/wireshark/python/${version}
	configure.args-delete	--without-python
	depends_lib-append	port:python27
}

variant rtp description {add rtp support with portaudio} {
	configure.args-append   --with-portaudio=${prefix}
	configure.args-delete   --without-portaudio
	depends_lib-append      port:portaudio
}

variant no_ssl {
	configure.args-append --without-ssl
	depends_lib-delete	port:openssl
}

variant no_x11	{
	depends_lib-delete	port:gtk2
	configure.args-delete	--disable-gtk2
	configure.args-append	--disable-wireshark
}


#
##EOF
