aboutsummaryrefslogtreecommitdiffstats
path: root/community/dsfmt/APKBUILD
blob: 14b1ef3f5e8a04b7cc7ac6de770abb348e7f5d32 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=dsfmt
_pkgname=dSFMT
pkgver=2.2.3
pkgrel=0
pkgdesc="Double precision SIMD-oriented Fast Mersenne Twister"
url="http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/#dSFMT"
arch="all"
license="BSD"
depends=""
makedepends=""
subpackages="$pkgname-dev"
source="http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/$_pkgname-src-$pkgver.tar.gz
	$pkgname.pc
	0001-dSFMT.patch
	"
builddir="$srcdir/$_pkgname-src-$pkgver"

_soname="lib$_pkgname.so"

prepare() {
	cd "$builddir"

	sed "s/@VERSION@/$pkgver/" "$srcdir"/$pkgname.pc > $pkgname.pc || return 1
	default_prepare
}

build() {
	cd "$builddir"

	# copied from https://github.com/JuliaLang/julia/blob/master/deps/dsfmt.mk
	local cflags="$CFLAGS -DNDEBUG -DDSFMT_MEXP=19937 -DDSFMT_DO_NOT_USE_OLD_NAMES
		-fPIC -O3 -finline-functions -fomit-frame-pointer
		-fno-strict-aliasing --param max-inline-insns-single=1800
		-Wmissing-prototypes -Wall -std=c99 -shared"

	if [ "$CARCH" = x86_64 ]; then
		cflags="$cflags -msse2 -DHAVE_SSE2"
	fi

	gcc $cflags dSFMT.c -o $_soname
}

package() {
	cd "$builddir"

	install -D $_soname "$pkgdir"/usr/lib/$_soname || return 1
	install -D dSFMT.h "$pkgdir"/usr/include/dSFMT.h || return 1
	install -D $pkgname.pc "$pkgdir"/usr/lib/pkgconfig/$pkgname.pc
}

sha512sums="6d8ddcd01aab3f9039f4f0288a8af53e290cc2f293ed8c4a8c9f3b3f12398e7eedfce8016117b425766ba89c61c86c13b3e420035b5f9bf91315b8b814c03662  dSFMT-src-2.2.3.tar.gz
07810381fea8477478a968aaeca983ef639dd42ee0efccf7bdc910d137b07f55c43f3feb1ee59eaf97f4143ac273e32a02f557cb3a0d4e430480f650efee4fbd  dsfmt.pc
9feac5b96e431d110e88631e5540cec1e8ce3443c0c74afd8132650a077ae569e0214bbee9326d4f8a91e8fc10603fdcceedebbc3713bf0c3713117906b1f6da  0001-dSFMT.patch"