SUMMARY="GNU cpio copies files into or out of a cpio or tar archive"
DESCRIPTION="
GNU cpio copies files into or out of a cpio or tar archive. \
The archive can be another file on the disk, a magnetic tape, or a pipe.

GNU cpio supports the following archive formats: binary, old ASCII, \
new ASCII, crc, HPUX binary, HPUX old ASCII, old tar, and POSIX.1 tar. \
The tar format is provided for compatability with the tar program. \
By default, cpio creates binary format archives, for compatibility \
with older cpio programs. When extracting from archives, cpio automatically \
recognizes which kind of archive it is reading and can read archives created \
on machines with a different byte-order.
"
HOMEPAGE="http://www.gnu.org/software/cpio/cpio.html"
COPYRIGHT="1988-2009 Free Software Foundation, Inc."
LICENSE="GNU GPL v3"
SRC_URI="http://ftp.gnu.org/gnu/cpio/cpio-2.10.tar.gz"
CHECKSUM_MD5="351ab3d38d8949913e478cc23b9d6ad4"
REVISION="1"
ARCHITECTURES="x86 ?x86_gcc2"

PATCHES="cpio-2.10.patch"

PROVIDES="
	cpio = $portVersion
	cmd:cpio = $portVersion compat >= 2
	"

REQUIRES="
	haiku >= $haikuVersion
	"

BUILD_REQUIRES="
	haiku_devel >= $haikuVersion
	"

BUILD_PREREQUIRES="
#	cmd:aclocal
#	cmd:autoconf
#	cmd:gettext
#	cmd:libtoolize
	cmd:make
	cmd:gcc
	cmd:ld
	"

PATCH()
{
	sed -i 's/restrict//g' gnu/string.in.h
}

BUILD()
{
# TODO: The patch already contains a fix for libnetwork not being auto-detected,
# but rebuilding the build system seems to be severely broken for gnulib (gnu/).
# Maybe the included gnulib needs to be replaced by a newer version.
#	libtoolize --force --copy --install
#	aclocal
#	autoconf
	LIBS=-lnetwork runConfigure ./configure
	make $jobArgs
}

INSTALL()
{
	make install

	rm $libDir/charset.alias
}

TEST()
{
	make check
}
