SUMMARY="Tools to archive files using LZSS and Huffman compression (.lzh files)"
DESCRIPTION="LHA archives are often used on Amiga computers. The compression \
is rather effective and the unpacking is fast."
HOMEPAGE="http://sourceforge.jp/projects/lha/"
COPYRIGHT="1991 Masaru Oki
	1993-1995 Nobutaka Watazaki
	2000 Tsugio Okamoto et al.
	2000-2020 Koji Arai"
LICENSE="lha"
REVISION="1"
SOURCE_URI="https://github.com/jca02266/lha/archive/7c3cd95fdf0d2f9198bb779561724cd314bc39a6.tar.gz"
CHECKSUM_SHA256="0f00ac5167dfa5754ad6e02d9cddce4dae997093515f5a906934b52426115efa"
SOURCE_DIR="lha-7c3cd95fdf0d2f9198bb779561724cd314bc39a6"
PATCHES="lha-$portVersion.patchset"

ARCHITECTURES="all"

PROVIDES="
	lha = $portVersion
	cmd:lha = $portVersion
	"
REQUIRES="
	haiku
	lib:libiconv
	"

BUILD_REQUIRES="
	haiku_devel
	devel:libiconv
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoconf
	cmd:autoheader
	cmd:automake
	cmd:autoreconf
	cmd:gcc
	cmd:libtoolize
	cmd:make
	"

BUILD()
{
	autoreconf -vfi
	#LDFLAGS=-liconv runConfigure ./configure
	runConfigure ./configure
	make $jobArgs
}

INSTALL()
{
	make install

	# Create expander rule
	mkdir -p $dataDir/expander/rules
	echo '"application/x-lharc"	.lha	"lha l --system-kanji-code=utf8 %s"	"lha x --system-kanji-code=utf8 %s"' > $dataDir/expander/rules/lha
}

TEST()
{
	make check
}
