SUMMARY="7-zip file compression program"
DESCRIPTION="
p7zip is a port of 7za.exe for POSIX systems like Unix (Linux, Solaris, \
OpenBSD, FreeBSD, Cygwin, AIX, ...), MacOS X and also for BeOS and Amiga.
"
HOMEPAGE="http://p7zip.sourceforge.net"
SRC_URI="http://downloads.sourceforge.net/project/p7zip/p7zip/9.20.1/p7zip_9.20.1_src_all.tar.bz2"
CHECKSUM_SHA256="49557e7ffca08100f9fc687f4dfc5aea703ca207640c76d9dee7b66f03cb4782"
LICENSE="GNU LGPL v2.1"
COPYRIGHT="1999-2011 7-Zip Igor Pavlov."
REVISION="5"
ARCHITECTURES="x86_gcc2 x86 x86_64"

PATCHES="p7zip-9.20.1.patch"

ADDITIONAL_FILES="p7zip-expander-rules"

PROVIDES="
	p7zip = $portVersion
	cmd:7za = $portVersion compat >= 9
	"
REQUIRES="
	haiku >= $haikuVersion
	"
BUILD_REQUIRES="
	"
BUILD_PREREQUIRES="
	haiku_devel >= $haikuVersion
	cmd:gcc
	cmd:ld
	cmd:make
	"

SOURCE_DIR="p7zip_9.20.1"

BUILD()
{
	cp makefile.haiku makefile.machine
	make
}

INSTALL()
{
	make install DEST_DIR="" DEST_HOME=$prefix DEST_SHARE_DOC=$docDir \
		DEST_MAN=$manDir

	expanderRulesDir=$dataDir/expander/rules
	mkdir -p $expanderRulesDir
	cp "$portDir/additional-files/p7zip-expander-rules" \
		"$expanderRulesDir/p7zip"
}
