SUMMARY="Pre-built binaries for the FPC build"
DESCRIPTION="Pre-built FPC binaries for Haiku i386."
HOMEPAGE="https://www.freepascal.org"
COPYRIGHT="1993-2015 Florian Klaempfl and others"
LICENSE="GNU LGPL v3
	GNU GPL v3"
REVISION="2"
SOURCE_URI="http://sourceforge.net/projects/freepascal/files/Haiku/$portVersion/fpc-$portVersion.i386-haiku.tar"
CHECKSUM_SHA256="4c6461a1c989667d08cd31f033d9a5e30b3a3fd58ab064c6adefafb23f4c0582"
SOURCE_DIR="fpc-$portVersion.i386-haiku"

ARCHITECTURES="x86_gcc2 x86"
DISABLE_SOURCE_PACKAGE="YES"

PROVIDES="
	fpc_bin = $portVersion
	cmd:bin2obj = $portVersion
	cmd:chmcmd = $portVersion
	cmd:chmls = $portVersion
	cmd:data2inc = $portVersion
	cmd:delp = $portVersion
	cmd:fd2pascal = $portVersion
	cmd:fp = $portVersion
	cmd:fpc = $portVersion
	cmd:fpcjres = $portVersion
	cmd:fpclasschart = $portVersion
	cmd:fpcmake = $portVersion
	cmd:fpcmkcfg = $portVersion
	cmd:fpcres = $portVersion
	cmd:fpcsubst = $portVersion
	cmd:fpdoc = $portVersion
	cmd:fppkg = $portVersion
	cmd:fprcp = $portVersion
	cmd:h2pas = $portVersion
	cmd:h2paspp = $portVersion
	cmd:instantfpc = $portVersion
	cmd:makeskel = $portVersion
	cmd:mkarmins = $portVersion
	cmd:mkinsadd = $portVersion
	cmd:mkx86ins = $portVersion
	cmd:pas2fpm = $portVersion
	cmd:pas2jni = $portVersion
	cmd:pas2ut = $portVersion
	cmd:plex = $portVersion
	cmd:postw32 = $portVersion
	cmd:ppc386 = $portVersion
	cmd:ppdep = $portVersion
	cmd:ppudump = $portVersion
	cmd:ppufiles = $portVersion
	cmd:ppumove = $portVersion
	cmd:ptop = $portVersion
	cmd:pyacc = $portVersion
	cmd:rmcvsdir = $portVersion
	cmd:rstconv = $portVersion
	cmd:unitdiff = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	ncurses6
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	"
BUILD_PREREQUIRES="
	binutils
	cmd:tar
	"

BUILD()
{
	true
}

INSTALL()
{
	for f in `tar tf binary.i386-haiku.tar`; do
		tar -xOf binary.i386-haiku.tar $f | tar -C $prefix -xzf -
	done
	mkdir -p $docDir/examples
	tar -xzf doc-pdf.tar.gz -C $docDir --strip 1
	tar -xzf demo.tar.gz -C $docDir/examples
	ln -s ../lib/fpc/$portVersion/ppc386 ../../packaging/fpc_bin/bin/ppc386
	# generate configuration file
	pwd
	mkdir -p ../../packaging/fpc_bin/lib/fpc/etc
	../../packaging/fpc_bin/lib/fpc/$portVersion/samplecfg /boot/system/lib/fpc/$portVersion ../../packaging/fpc_bin/lib/fpc/etc
}
