# $Id: Portfile 119784 2014-05-06 20:17:22Z ricci@macports.org $

PortSystem 1.0
name		wireshark
version		1.10.7
revision	0
categories	net
license		{GPL-2 GPL-3}
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     0e8a111d24c11255eae139c8f27fd25b \
                    sha1    5e5ce4fdc9aa53e545fc0fbd22eea6adcf7dfc0b \
                    rmd160  67fcd4cce612a5af705e1db5a57549444d4c4e57

use_bzip2	yes

conflicts	wireshark-devel

patchfiles	patch-configure.diff

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

configure.args	\
		--without-libsmi \
		--disable-usr-local \
		--without-adns \
		--with-c-ares=${prefix} \
		--without-geoip \
		--without-gnutls \
		--with-gcrypt=no \
		--without-lua \
		--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 \
		--with-krb5=${prefix} \
		--without-ssl \
		--disable-wireshark


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

default_variants +adns +gnutls +libgcrypt +ipv6 +lua +libsmi +geoip +rtp +ssl +x11


## 1.10.0 doesn't include python options in configure
## if {[variant_isset no_python]} {
## } elseif {[variant_isset python25]} {
## } elseif {[variant_isset python26]} {
## } elseif {[variant_isset python27]} {
## } else {
## 	default_variants +no_python
## }


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 {[string match *llvm-gcc-4.2* ${configure.compiler}]} {
	# 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-delete	--without-adns \
							--with-c-ares=${prefix}
	configure.args-append	--with-adns=${prefix} \
							--without-c-ares
	depends_lib-append	port:adns
	depends_lib-delete	port:c-ares
}

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

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

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

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

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

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

## 1.10.0 doesn't include python options in configure
## variant python25 description {use python25 for the experimental python interface} conflicts no_python python26 python27 {
## 	configure.args-append	--with-python=${prefix}
## 	depends_lib-append	port:python25
## }
## 
## variant python26 description {use python26 for the experimental python interface} conflicts no_python python25 python27 {
## 	configure.args-append	--with-python=${prefix}
## 	depends_lib-append	port:python26
## }
## 
## variant python27 description {use python27 for the experimental python interface} conflicts no_python python25 python26 {
## 	configure.args-append	--with-python=${prefix}/lib/wireshark/python/${version}
## 	depends_lib-append	port:python27
## }
## 
## variant no_python description {do not build python interface} conflicts python25 python26 python27 {
## 	configure.args-append	--without-python
## }

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

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

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


#
##EOF
