SUMMARY="Double precision SIMD-oriented Fast Mersenne Twister"
DESCRIPTION="The purpose of dSFMT is to speed up the generation by avoiding \
the expensive conversion of integer to double (floating point). \
dSFMT directly generates double precision floating point pseudo-random \
numbers which have the IEEE Standard for Binary Floating-Point Arithmetic \
(ANSI/IEEE Std 754-1985) format. dSFMT is only available on the CPUs which \
use IEEE 754 format double precision floating point numbers."
HOMEPAGE="http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/#dSFMT"
COPYRIGHT="2006,2007 Mutsuo Saito, Makoto Matsumoto and \
Hiroshima University. \
2012 Mutsuo Saito, Makoto Matsumoto, Hiroshima University \
and The University of Tokyo."
LICENSE="BSD (3-clause)"
REVISION="1"
SOURCE_URI="https://github.com/MersenneTwister-Lab/dSFMT/archive/v$portVersion.tar.gz"
CHECKSUM_SHA256="b7bc498cd140b4808963b1ff9f33b42a491870f54775c1060ecad0e02bcaffb4"
SOURCE_DIR="dSFMT-$portVersion"

ARCHITECTURES="all"

PROVIDES="
	dsfmt = $portVersion
	lib:libdsfmt = $portVersion
	"
REQUIRES="
	haiku
	"

PROVIDES_devel="
	dsfmt_devel = $portVersion
	devel:libdSFMT = $portVersion
	"
REQUIRES_devel="
	haiku_devel
	"

BUILD_REQUIRES="
	haiku_devel
	"
BUILD_PREREQUIRES="
	cmd:gcc
	"

BUILD()
{
	gcc -O3 -finline-functions -fomit-frame-pointer -DNDEBUG -fno-strict-aliasing \
	-Wmissing-prototypes -Wall  -std=c99 -DDSFMT_MEXP=19937 \
	-DDSFMT_SHLIB -DDSFMT_DO_NOT_USE_OLD_NAMES -shared -fPIC dSFMT.c -o libdSFMT.so
}

INSTALL()
{
	mkdir -p $includeDir
	mkdir -p $libDir
	cp ./dSFMT.h $includeDir
	cp ./libdSFMT.so $libDir

	prepareInstalledDevelLibs libdSFMT

	packageEntries devel $developDir
}