SUMMARY="A programming language focused on simplicity and productivity"
DESCRIPTION="
Ruby is a dynamic, reflective, object-oriented, general-purpose
programming language. It was designed and developed in the mid-1990s
by Yukihiro 'Matz' Matsumoto in Japan.

Ruby embodies syntax inspired by Perl with Smalltalk-like features and
was also influenced by Eiffel and Lisp.  It supports multiple
programming paradigms, including functional, object oriented, and
imperative. It also has a dynamic type system and automatic memory
management. Therefore, it is similar in varying degrees to, Smalltalk,
Python, Perl, Lisp, Dylan, and CLU."
HOMEPAGE="http://www.ruby-lang.org" 
SRC_URI="http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.1.tar.gz"
CHECKSUM_SHA256="c843df31ae88ed49f5393142b02b9a9f5a6557453805fd489a76fbafeae88941"
LICENSE="Ruby
	BSD (3-clause)"
COPYRIGHT="1993-2014 Yukihiro Matsumoto"

REVISION="1"

ARCHITECTURES="!x86_gcc2 ?x86 ?x86_64"
SECONDARY_ARCHITECTURES="!x86"

PROVIDES="
	ruby$secondaryArchSuffix = $portVersion compat >= 1.9
	cmd:ruby = $portVersion compat >= 1.9
	cmd:erb = $portVersion compat >= 1.9
	cmd:gem = $portVersion compat >= 1.9
	cmd:irb = $portVersion compat >= 1.9
	cmd:rake = $portVersion compat >= 1.9
	cmd:rdoc = $portVersion compat >= 1.9
	cmd:ri = $portVersion compat >= 1.9
	cmd:testrb = $portVersion compat >= 1.9
	lib:libruby$secondaryArchSuffix = $portVersion compat >= 1.9
	"

REQUIRES="
	haiku$secondaryArchSuffix >= $haikuVersion
	lib:libedit$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	lib:libcrypto$secondaryArchSuffix
	lib:libssl$secondaryArchSuffix
	lib:libiconv$secondaryArchSuffix
	lib:libncursesw$secondaryArchSuffix
	"
	
BUILD_REQUIRES="
	devel:libedit$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	devel:libcrypto$secondaryArchSuffix
	devel:libssl$secondaryArchSuffix
	devel:libiconv$secondaryArchSuffix
	devel:libncursesw$secondaryArchSuffix
	"

BUILD_PREREQUIRES="
	haiku${secondaryArchSuffix}_devel >= $haikuVersion
	cmd:gcc$secondaryArchSuffix
	cmd:g++$secondaryArchSuffix
	cmd:autoconf
	cmd:make
	cmd:bison
	"

PROVIDES_devel="
	ruby_devel$secondaryArchSuffix = $portVersion
	devel:libruby_static$secondaryArchSuffix = $portVersion compat >= 1.9
	lib:libruby_static$secondaryArchSuffix = $portVersion compat >= 1.9
	devel:libruby$secondaryArchSuffix = $portVersion compat >= 1.9
	"

REQUIRES_devel="
	ruby$secondaryArchSuffix == $portVersion base
	"

BUILD()
{
	runConfigure ./configure --enable-shared
	# The build process needs to run ruby, and without this it fails to find
	# libruby.so.
	export LIBRARY_PATH=$LIBRARY_PATH:%A
	make $jobArgs
}

INSTALL()
{
	export LIBRARY_PATH=$LIBRARY_PATH:%A
	make install
	prepareInstalledDevelLibs libruby-static libruby
	packageEntries devel $developDir
}

TEST()
{
	make check
}
