SUMMARY="An open source compiler for Pascal and Object Pascal"
DESCRIPTION="Free Pascal (aka FPK Pascal) is a 32 and 64 bit professional \
Pascal compiler. It can target multiple processor architectures: Intel x86, \
AMD64/x86-64, PowerPC, PowerPC64, SPARC, and ARM. Supported operating systems \
include Linux, FreeBSD, Haiku, Mac OS X/iOS/Darwin, DOS, Win32, Win64, WinCE, \
OS/2, MorphOS, Nintendo GBA, Nintendo DS, and Nintendo Wii. Additionally, JVM, \
MIPS (big and little endian variants) and Motorola 68k architecture targets \
are available in the development versions."
HOMEPAGE="http://www.freepascal.org"
SOURCE_URI="http://sourceforge.net/projects/freepascal/files/Source/2.6.2/fpc-2.6.2.source.tar.gz/download"
CHECKSUM_SHA256="71dd1be93593daf184556377dfde61c7882bc749ad8c0bc342210e542555f9d0"
LICENSE="
	GNU LGPL v3
	GNU GPL v3
	"
COPYRIGHT="1993-2013 by Florian Klaempfl"
REVISION="2"

DISABLE_SOURCE_PACKAGE=yes

ARCHITECTURES="x86 ?x86_64"
if [ $effectiveTargetArchitecture != x86_gcc2 ]; then
	ARCHITECTURES="$ARCHITECTURES x86_gcc2"
else
    ARCHITECTURES="$ARCHITECTURES !x86_gcc2"
fi
SECONDARY_ARCHITECTURES="x86"

PROVIDES="
	fpc$secondaryArchSuffix = $portVersion
	cmd:fpc$secondaryArchSuffix = $portVersion
	cmd:bin2obj$secondaryArchSuffix = $portVersion
	cmd:fp$secondaryArchSuffix = $portVersion
	cmd:fpcmake$secondaryArchSuffix = $portVersion
	cmd:unitdiff$secondaryArchSuffix = $portVersion
	cmd:chmcmd$secondaryArchSuffix = $portVersion
	cmd:chmls$secondaryArchSuffix = $portVersion
	cmd:data2inc$secondaryArchSuffix = $portVersion
	cmd:delp$secondaryArchSuffix = $portVersion
	cmd:fd2pascal$secondaryArchSuffix = $portVersion
	cmd:fpclasschart$secondaryArchSuffix = $portVersion
	cmd:fpcmkcfg$secondaryArchSuffix = $portVersion
	cmd:fpcres$secondaryArchSuffix = $portVersion
	cmd:fpcsubst$secondaryArchSuffix = $portVersion
	cmd:fpdoc$secondaryArchSuffix = $portVersion
	cmd:fppkg$secondaryArchSuffix = $portVersion
	cmd:fprcp$secondaryArchSuffix = $portVersion
	cmd:h2pas$secondaryArchSuffix = $portVersion
	cmd:h2paspp$secondaryArchSuffix = $portVersion
	cmd:instantfpc$secondaryArchSuffix = $portVersion
	cmd:makeskel$secondaryArchSuffix = $portVersion
	cmd:mkarmins$secondaryArchSuffix = $portVersion
	cmd:mkx86ins$secondaryArchSuffix = $portVersion
	cmd:plex$secondaryArchSuffix = $portVersion
	cmd:postw32$secondaryArchSuffix = $portVersion
	cmd:ppc386$secondaryArchSuffix = $portVersion
	cmd:ppdep$secondaryArchSuffix = $portVersion
	cmd:ppudump$secondaryArchSuffix = $portVersion
	cmd:ppufiles$secondaryArchSuffix = $portVersion
	cmd:ppumove$secondaryArchSuffix = $portVersion
	cmd:ptop$secondaryArchSuffix = $portVersion
	cmd:pyacc$secondaryArchSuffix = $portVersion
	cmd:rmcvsdir$secondaryArchSuffix = $portVersion
	cmd:rstconv$secondaryArchSuffix = $portVersion
	cmd:unitdiff$secondaryArchSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	"
BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:make
	cmd:tar
	cmd:wget
	fpc_bin = 2.6.2
	"

SOURCE_DIR="fpc-2.6.2"
#Create the fpc-2.6.2-1-x86.hpkg
#Download the FreePascalCompiler from www.freepascal.org
#Extract the tarball and run ./install.sh
#Create a .PackageInfo where the compiler is installed
#Run package create -0 fpc-2.6.2-1-x86.hpkg
#Put it on the common folders
MESSAGE="This recipe requires an existing fpc_bin-2.6.2 package"

BUILD()
{
	fpcmake -Tall -r
	make build
}
INSTALL()
{
	make install INSTALL_PREFIX=$prefix
}
