SUMMARY="Standard GNU core utilities"
DESCRIPTION="
Most of these programs have significant advantages over their Unix \
counterparts, such as greater speed, additional options, and fewer \
arbitrary limits.

The programs that can be built with this package are:

  [ arch base64 basename cat chcon chgrp chmod chown chroot cksum comm cp \
csplit cut date dd df dir dircolors dirname du echo env expand expr \
factor false fmt fold groups head hostid hostname id install join kill \
link ln logname ls md5sum mkdir mkfifo mknod mktemp mv nice nl nohup \
nproc numfmt od paste pathchk pinky pr printenv printf ptx pwd readlink \
realpath rm rmdir runcon seq sha1sum sha224sum sha256sum sha384sum sha512sum \
shred shuf sleep sort split stat stdbuf stty sum sync tac tail tee test \
timeout touch tr true truncate tsort tty uname unexpand uniq unlink \
uptime users vdir wc who whoami yes
"
HOMEPAGE="http://www.gnu.org/software/coreutils"
COPYRIGHT="1994-2013 Free Software Foundation, Inc."
LICENSE="GNU GPL v3"
SRC_URI="http://ftp.gnu.org/gnu/coreutils/coreutils-$portVersion.tar.xz"
CHECKSUM_SHA256="5b3e94998152c017e6c75d56b9b994188eb71bf46d4038a642cb9141f6ff1212"
REVISION="1"
ARCHITECTURES="x86_gcc2 x86 x86_64 arm"

PATCHES="
	coreutils-$portVersion.patchset
	coreutils-$portVersion.gcc2.patchset
	"

PROVIDES="
	coreutils = $portVersion compat >= 8
	cmd:[ = $portVersion compat >= 8
	cmd:base64 = $portVersion compat >= 8
	cmd:basename = $portVersion compat >= 8
	cmd:cat = $portVersion compat >= 8
	cmd:chcon = $portVersion compat >= 8
	cmd:chgrp = $portVersion compat >= 8
	cmd:chmod = $portVersion compat >= 8
	cmd:chown = $portVersion compat >= 8
	cmd:chroot = $portVersion compat >= 8
	cmd:cksum = $portVersion compat >= 8
	cmd:comm = $portVersion compat >= 8
	cmd:cp = $portVersion compat >= 8
	cmd:csplit = $portVersion compat >= 8
	cmd:cut = $portVersion compat >= 8
	cmd:date = $portVersion compat >= 8
	cmd:dd = $portVersion compat >= 8
	cmd:df = $portVersion compat >= 8
	cmd:dir = $portVersion compat >= 8
	cmd:dircolors = $portVersion compat >= 8
	cmd:dirname = $portVersion compat >= 8
	cmd:du = $portVersion compat >= 8
	cmd:echo = $portVersion compat >= 8
	cmd:env = $portVersion compat >= 8
	cmd:expand = $portVersion compat >= 8
	cmd:expr = $portVersion compat >= 8
	cmd:factor = $portVersion compat >= 8
	cmd:false = $portVersion compat >= 8
	cmd:fmt = $portVersion compat >= 8
	cmd:fold = $portVersion compat >= 8
	cmd:groups = $portVersion compat >= 8
	cmd:head = $portVersion compat >= 8
	cmd:hostname = $portVersion compat >= 8
	cmd:id = $portVersion compat >= 8
	cmd:install = $portVersion compat >= 8
	cmd:join = $portVersion compat >= 8
	cmd:kill = $portVersion compat >= 8
	cmd:link = $portVersion compat >= 8
	cmd:ln = $portVersion compat >= 8
	cmd:logname = $portVersion compat >= 8
	cmd:ls = $portVersion compat >= 8
	cmd:md5sum = $portVersion compat >= 8
	cmd:mkdir = $portVersion compat >= 8
	cmd:mkfifo = $portVersion compat >= 8
	cmd:mknod = $portVersion compat >= 8
	cmd:mktemp = $portVersion compat >= 8
	cmd:mv = $portVersion compat >= 8
	cmd:nl = $portVersion compat >= 8
	cmd:nohup = $portVersion compat >= 8
	cmd:nproc = $portVersion compat >= 8
	cmd:numfmt = $portVersion compat >= 8
	cmd:od = $portVersion compat >= 8
	cmd:paste = $portVersion compat >= 8
	cmd:pathchk = $portVersion compat >= 8
	cmd:pr = $portVersion compat >= 8
	cmd:printenv = $portVersion compat >= 8
	cmd:printf = $portVersion compat >= 8
	cmd:ptx = $portVersion compat >= 8
	cmd:pwd = $portVersion compat >= 8
	cmd:readlink = $portVersion compat >= 8
	cmd:realpath = $portVersion compat >= 8
	cmd:rm = $portVersion compat >= 8
	cmd:rmdir = $portVersion compat >= 8
	cmd:runcon = $portVersion compat >= 8
	cmd:seq = $portVersion compat >= 8
	cmd:sha1sum = $portVersion compat >= 8
	cmd:sha224sum = $portVersion compat >= 8
	cmd:sha256sum = $portVersion compat >= 8
	cmd:sha384sum = $portVersion compat >= 8
	cmd:sha512sum = $portVersion compat >= 8
	cmd:shred = $portVersion compat >= 8
	cmd:shuf = $portVersion compat >= 8
	cmd:sleep = $portVersion compat >= 8
	cmd:sort = $portVersion compat >= 8
	cmd:split = $portVersion compat >= 8
	cmd:stat = $portVersion compat >= 8
	cmd:stdbuf = $portVersion compat >= 8
	cmd:stty = $portVersion compat >= 8
	cmd:sum = $portVersion compat >= 8
	cmd:sync = $portVersion compat >= 8
	cmd:tac = $portVersion compat >= 8
	cmd:tail = $portVersion compat >= 8
	cmd:tee = $portVersion compat >= 8
	cmd:test = $portVersion compat >= 8
	cmd:timeout = $portVersion compat >= 8
	cmd:touch = $portVersion compat >= 8
	cmd:tr = $portVersion compat >= 8
	cmd:true = $portVersion compat >= 8
	cmd:truncate = $portVersion compat >= 8
	cmd:tsort = $portVersion compat >= 8
	cmd:tty = $portVersion compat >= 8
	cmd:uname = $portVersion compat >= 8
	cmd:unexpand = $portVersion compat >= 8
	cmd:uniq = $portVersion compat >= 8
	cmd:unlink = $portVersion compat >= 8
	cmd:vdir = $portVersion compat >= 8
	cmd:wc = $portVersion compat >= 8
	cmd:whoami = $portVersion compat >= 8
	cmd:yes = $portVersion compat >= 8
	"
REQUIRES="
	haiku >= $haikuVersion
	"
BUILD_PREREQUIRES="
	haiku_devel >= $haikuVersion
	cmd:gcc
	cmd:ld
	cmd:make
	cmd:awk
	cmd:sed
	cmd:help2man
	"

defineDebugInfoPackage coreutils \
	$binDir/[ \
	$binDir/base64 \
	$binDir/basename \
	$binDir/cat \
	$binDir/chcon \
	$binDir/chgrp \
	$binDir/chmod \
	$binDir/chown \
	$binDir/chroot \
	$binDir/cksum \
	$binDir/comm \
	$binDir/cp \
	$binDir/csplit \
	$binDir/cut \
	$binDir/date \
	$binDir/dd \
	$binDir/df \
	$binDir/dir \
	$binDir/dircolors \
	$binDir/dirname \
	$binDir/du \
	$binDir/echo \
	$binDir/env \
	$binDir/expand \
	$binDir/expr \
	$binDir/factor \
	$binDir/false \
	$binDir/fmt \
	$binDir/fold \
	$binDir/groups \
	$binDir/head \
	$binDir/hostname \
	$binDir/id \
	$binDir/install \
	$binDir/join \
	$binDir/kill \
	$binDir/link \
	$binDir/ln \
	$binDir/logname \
	$binDir/ls \
	$binDir/md5sum \
	$binDir/mkdir \
	$binDir/mkfifo \
	$binDir/mknod \
	$binDir/mktemp \
	$binDir/mv \
	$binDir/nl \
	$binDir/nohup \
	$binDir/nproc \
	$binDir/numfmt \
	$binDir/od \
	$binDir/paste \
	$binDir/pathchk \
	$binDir/pr \
	$binDir/printenv \
	$binDir/printf \
	$binDir/ptx \
	$binDir/pwd \
	$binDir/readlink \
	$binDir/realpath \
	$binDir/rm \
	$binDir/rmdir \
	$binDir/runcon \
	$binDir/seq \
	$binDir/sha1sum \
	$binDir/sha224sum \
	$binDir/sha256sum \
	$binDir/sha384sum \
	$binDir/sha512sum \
	$binDir/shred \
	$binDir/shuf \
	$binDir/sleep \
	$binDir/sort \
	$binDir/split \
	$binDir/stat \
	$binDir/stdbuf \
	$binDir/stty \
	$binDir/sum \
	$binDir/sync \
	$binDir/tac \
	$binDir/tail \
	$binDir/tee \
	$binDir/test \
	$binDir/timeout \
	$binDir/touch \
	$binDir/tr \
	$binDir/true \
	$binDir/truncate \
	$binDir/tsort \
	$binDir/tty \
	$binDir/uname \
	$binDir/unexpand \
	$binDir/uniq \
	$binDir/unlink \
	$binDir/vdir \
	$binDir/wc \
	$binDir/whoami \
	$binDir/yes \
	
PATCH()
{
	sed -i -e 's|O_NOCACHE|DD_NOCACHE|g' src/dd.c
}

BUILD()
{
	FORCE_UNSAFE_CONFIGURE=1 runConfigure ./configure \
		--without-included-regex \
		--disable-rpath --with-gnu-ld \
		--enable-no-install-program=uptime \
		--enable-install-program=hostname
	touch doc/*.info
	make $jobArgs
}

INSTALL()
{
	make install
}
