aboutsummaryrefslogtreecommitdiffstats
path: root/main/fftw/APKBUILD
blob: 9bc7a4b46e3a11723aa8c6c9198785942bdc9dbb (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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# Contributor: William Pitcock <nenolod@dereferenced.org>
# Maintainer: William Pitcock <nenolod@dereferenced.org>
pkgname=fftw
pkgver=3.3.4
pkgrel=2
pkgdesc="fastest fourier transform in the west"
url="http://www.fftw.org/"
license="GPL"
depends=
makedepends="texinfo"
install=
# order of the libs split functions are important because of lib naming
subpackages="$pkgname-dev $pkgname-doc $pkgname-single-libs:single
	$pkgname-long-double-libs:long_double $pkgname-double-libs:double"
source="http://www.fftw.org/$pkgname-$pkgver.tar.gz"
arch="all"
_precision="single double long-double"

_builddir="$srcdir"

prepare() {
	cd "$_builddir"
	for i in $_precision; do
		cp -r "$srcdir"/$pkgname-$pkgver $srcdir/$i
	done
}

build() {
	for i in $_precision; do
		case "$i" in
			single)_cf="--enable-single";;
			double)_cf="";;
			long-double)_cf="--enable-long-double";;
		esac

		case "$i--$CARCH" in
		single--x86_64 | double--x86_64)
			_cf="$_cf --enable-sse2 --enable-avx";;
		single--arm*)
			_cf="$_cf --enable-neon";;
		esac

		msg "Building for $i precision ($_cf)"
		cd "$_builddir"/$i
		./configure \
			--build=$CBUILD \
			--host=$CHOST \
			--prefix=/usr \
			--sysconfdir=/etc \
			--mandir=/usr/share/man \
			--infodir=/usr/share/info \
			--enable-shared \
			--enable-threads \
			$_cf \
			|| return 1
		make || return 1
	done
}

package() {
	for i in $_precision; do
		cd "$_builddir"/$i
		make DESTDIR="$pkgdir" install || return 1
	done
}

single() {
	mkdir -p "$subpkgdir"/usr/lib || return 1
	mv "$pkgdir"/usr/lib/libfftw3f*.so* \
		"$subpkgdir"/usr/lib/ || return 1
}

double() {
	mkdir -p "$subpkgdir"/usr/lib || return 1
	mv "$pkgdir"/usr/lib/libfftw3*.so* \
		"$subpkgdir"/usr/lib/ || return 1
}

long_double() {
	mkdir -p "$subpkgdir"/usr/lib || return 1
	mv "$pkgdir"/usr/lib/libfftw3l*.so* \
		"$subpkgdir"/usr/lib/ || return 1
}

md5sums="2edab8c06b24feeb3b82bbb3ebf3e7b3  fftw-3.3.4.tar.gz"
sha256sums="8f0cde90929bc05587c3368d2f15cd0530a60b8a9912a8e2979a72dbe5af0982  fftw-3.3.4.tar.gz"
sha512sums="1ee2c7bec3657f6846e63c6dfa71410563830d2b951966bf0123bd8f4f2f5d6b50f13b76d9a7b0eae70e44856f829ca6ceb3d080bb01649d1572c9f3f68e8eb1  fftw-3.3.4.tar.gz"