PortSystem 1.0

name			samba4
version			4.0.0tp5
revision		4
categories		net
platforms		darwin
maintainers		nomaintainer
license			GPL-3
description		SMB/CIFS server and client, ALPHA release
long_description	Samba is an software suite that provides seamless file \
			and print services to SMB/CIFS clients. \
			This is an ALPHA release!

homepage		http://www.samba.org/
master_sites		http://download.samba.org/samba/ftp/samba4/ \
			ftp://de.samba.org/samba.org/samba4/
distname		samba-${version}
checksums           md5     dbc2e04455d67b01d2020808065b96df \
                    sha1    8897cc7a824a594b3543245cdbbceaea32e9e08d \
                    rmd160  1870f67aa851751e381a3b03dadfa1d0afa28a12

depends_lib		port:gnutls port:readline port:libiconv port:popt port:sqlite3 port:zlib port:gettext

worksrcdir		samba-${version}/source

configure.args		--with-fhs \
			--mandir=${prefix}/share/man \
			--with-libiconv=${prefix} --with-readline=${prefix} --with-sqlite3

destroot.target-append	installman
post-destroot {
	# add a postfix of '4' to all executables to avoid file conflicts
	foreach dir {bin sbin} {
		foreach bin [glob -directory "${destroot}${prefix}/${dir}" -type f *] {
			file rename "${bin}" "${bin}4"
		}
	}
	# ..and also to the manpages
	foreach dir [glob -directory "${destroot}${prefix}/share/man" "man\[138\]"] {
		foreach man [glob -directory "${dir}" -type f *] {
			file rename "${man}" [string range "${man}" 0 [expr [string last . "${man}"] - 1]]4[string range "${man}" [string last . "${man}"] [string length "${man}"]]
		}
	}
}

livecheck.type	regex
livecheck.url	http://us4.samba.org/samba/ftp/samba4/?M=D
livecheck.regex	samba-(\[0-9a-z.\]+)\\.tar\\.gz