# $Id: Portfile,v 1.10 2006/01/14 00:03:54 toby Exp $

PortSystem 1.0
name             p7zip
version          4.30
revision         1
categories       archivers
maintainers      toby@opendarwin.org
description      7-Zip implementation
long_description \
	p7zip is a port of 7-Zip, a file archiver with \
	highest compression ratio.
homepage         http://p7zip.sourceforge.net/
platforms        darwin

master_sites     sourceforge
distname         ${name}_${version}_src_all
use_bzip2        yes
checksums        sha1 16ea805087e2699106eda6d4adf0d254303e7395

worksrcdir       ${name}_${version}

patch {
	reinplace "s|/usr|${prefix}|" \
		${worksrcpath}/man1/7z.1 \
		${worksrcpath}/man1/7za.1
}

configure {
	if {${os.platform} == "darwin"} {
		file copy -force ${worksrcpath}/makefile.macosx ${worksrcpath}/makefile.machine
	}
}

destroot.destdir DEST_BIN=${destroot}${prefix}/bin \
                 DEST_SHARE=${destroot}${prefix}/lib/${name} \
                 DEST_MAN=${destroot}${prefix}/share/man

post-destroot {
	set docDir ${destroot}${prefix}/share/doc/${name}
	file mkdir ${docDir}
	file copy ${worksrcpath}/DOCS ${docDir}
	file attributes ${docDir}/DOCS -permissions 0755
	file attributes ${docDir}/DOCS/7zC.txt -permissions 0644
	file attributes ${docDir}/DOCS/copying.txt -permissions 0644
}
