summaryrefslogtreecommitdiff
path: root/user/fftw/APKBUILD
blob: 1e4e09d44fca7ae29d86033ea4e9ff2cff0af7f8 (plain) (blame)
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
88
89
90
91
92
93
94
95
96
97
98
# Contributor: Ariadne Conill <ariadne@dereferenced.org>
# Maintainer: Zach van Rijn <me@zv.io>
pkgname=fftw
pkgver=3.3.10
_pkgver=$(printf '%s' "$pkgver" | sed 's/p/-pl/')
pkgrel=0
pkgdesc="Fastest fourier transform in the west"
url="http://www.fftw.org/"
# s390x: hangs on container and KVM
arch="all !s390x"
license="GPL-2.0+"
makedepends="texinfo"
# 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
	clock-sgi-cycle.patch
	"
builddir="$srcdir/$pkgname-$_pkgver"

_precision="single double long-double"

prepare() {
	default_prepare

	local i; for i in $_precision; do
		cp -r "$builddir" $srcdir/$i
	done
}

build() {
	local _openmp=

	local i; 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* | single--aarch64)
				_cf="$_cf --enable-neon";;
		esac

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

check() {
	local i; for i in $_precision; do
		cd "$srcdir"/$i
		make check
	done
}

package() {
	local i; for i in $_precision; do
		cd "$srcdir"/$i
		make DESTDIR="$pkgdir" install
	done
}

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

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

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

sha512sums="2d34b5ccac7b08740dbdacc6ebe451d8a34cf9d9bfec85a5e776e87adf94abfd803c222412d8e10fbaa4ed46f504aa87180396af1b108666cde4314a55610b40  fftw-3.3.10.tar.gz
7683b31fd56c1883fd9ac553ced161b0e253163a97fb9f718f830da93ff1e45692dae4ddda3d9f3f238b8e8047f2cd62bd1933b67839328ccf386137f592f5b0  clock-sgi-cycle.patch"