SUMMARY="The programming language Erlang/OTP"
DESCRIPTION="Erlang is a programming language used to build massively \
scalable soft real-time systems with requirements on high availability. \
Some of its uses are in telecoms, banking, e-commerce, computer telephony \
and instant messaging. Erlang's runtime system has built-in support for \
concurrency, distribution and fault tolerance."
HOMEPAGE="https://www.erlang.org/"
COPYRIGHT="1997-2017 Ericsson AB"
LICENSE="EPL"
REVISION="3"
SOURCE_URI="http://www.erlang.org/download/otp_src_$portVersion.tar.gz"
CHECKSUM_SHA256="900d35eb563607785a8e27f4b4c03cf6c98b4596028c5d6958569ddde5d4ddbf"
SOURCE_DIR="otp_src_$portVersion"
PATCHES="erlang-$portVersion.patchset"

ARCHITECTURES="all !x86_gcc2"

PROVIDES="
	erlang = $portVersion
	cmd:ct_run = $portVersion
	cmd:dialyzer = $portVersion
	cmd:epmd = $portVersion
	cmd:erl = $portVersion
	cmd:erlc = $portVersion
	cmd:escript = $portVersion
	cmd:run_erl = $portVersion
	cmd:to_erl = $portVersion
	"
REQUIRES="
	haiku
	cmd:gcc
	cmd:libtool
	cmd:perl
	#cmd:wx_config
	lib:libcrypto
	lib:libgl
	lib:libglu
	lib:libncurses
	lib:libssl
	lib:libz
	"

BUILD_REQUIRES="
	haiku_devel
	devel:libcrypto
	devel:libgl
	devel:libglu
	devel:libncurses
	devel:libssl
	devel:libz
	"
BUILD_PREREQUIRES="
	cmd:bison
	cmd:find
	cmd:flex
	cmd:gcc
	cmd:make
	cmd:perl
	cmd:pkg_config
	cmd:sed
	cmd:tar
	cmd:uname
	#cmd:wx_config
	cmd:yacc
	"

BUILD()
{
	CFLAGS="-D_BSD_SOURCE -I`finddir B_SYSTEM_HEADERS_DIRECTORY`" \
		LDFLAGS="-lnetwork" \
		runConfigure --omit-dirs "docDir dataRootDir" configure \
		--prefix="$prefix" \
		--disable-ipv6 \
		--enable-dynamic-ssl-lib \
		--with-ssl="`finddir B_SYSTEM_DEVELOP_DIRECTORY`" \
		--disable-hipe \
		--enable-builtin-zlib \
		--disable-threads

	HOME=$sourceDir make $jobArgs
}

INSTALL()
{
	make install
}
