blob: 0b2701eea9c587fd9b6341ab5f45ab99849e4327 (
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
|
# Maintainer: Gonzalo Exequiel Pedone <hipersayan DOT x AT gmail DOT com>
# Contributor: David Runge <dvzrv@archlinux.org>
# Contributor: Ronald van Haren <ronald.archlinux.org>
# Contributor: David Runge <dvzrv@archlinux.org>
# Contributor: damir <damir@archlinux.org>
_android_arch=aarch64
pkgbase=android-${_android_arch}-fftw
pkgname=("android-${_android_arch}-fftw"
"android-${_android_arch}-fftw-openmpi")
pkgver=3.3.10
pkgrel=1
arch=('any')
pkgdesc="A library for computing the discrete Fourier transform (DFT) (Android ${_android_arch})"
url="http://www.fftw.org/"
license=('GPL-2.0-or-later')
makedepends=('android-cmake'
"android-${_android_arch}-openmpi")
options=(!strip !buildflags staticlibs !emptydirs)
source=("http://www.fftw.org/fftw-$pkgver.tar.gz")
md5sums=('8ccbf6a5ea78a16dbc3e1306e234cc5c')
_build_types=(single double long-double)
# Android's clang does not support quad precision
# _build_types+=(quad)
_soname=3.6.10
_pick() {
local p="$1" f d; shift
for f; do
d="$srcdir/$p/${f#$pkgdir/}"
mkdir -p "$(dirname "$d")"
mv "$f" "$d"
rmdir -p --ignore-fail-on-non-empty "$(dirname "$f")"
done
}
prepare() {
cd "${srcdir}/fftw-${pkgver}"
# fix wrong soname in FFTW3LibraryDepends.cmake
sed -i "s/3.6.9/$_soname/g" CMakeLists.txt
}
build() {
cd "${srcdir}/fftw-${pkgver}"
source android-env ${_android_arch}
cmake_options=
if [ "${_android_arch}" = x86* ]; then
cmake_options="-DENABLE_AVX=ON -DENABLE_AVX2=ON -DENABLE_SSE=ON -DENABLE_SSE2=ON"
fi
# create missing FFTW3LibraryDepends.cmake
# https://bugs.archlinux.org/task/67604
android-${_android_arch}-cmake \
-S . \
-B build \
-DBUILD_TESTS=OFF \
-DDISABLE_FORTRAN=ON \
-DENABLE_OPENMP=ON \
-DENABLE_THREADS=ON \
-DENABLE_FLOAT=ON \
-DENABLE_LONG_DOUBLE=ON \
-DENABLE_QUAD_PRECISION=ON \
${cmake_options}
# fix broken IMPORTED_LOCATION: https://github.com/FFTW/fftw3/issues/130#issuecomment-1030280157
sed -i "s|\(IMPORTED_LOCATION_NONE\).*|\1 \"${ANDROID_PREFIX_LIB}/libfftw3.so.3\"|g" build/FFTW3LibraryDepends.cmake
export MPICC=${CC}
# use upstream default CFLAGS while keeping our -march/-mtune
export CFLAGS="${CFLAGS} -O3 -fomit-frame-pointer -malign-double -fstrict-aliasing -ffast-math"
for precision in "${_build_types[@]}"; do
mkdir -p build-${precision} && pushd build-${precision}
configure_options=
case $precision in
single)
configure_options='--enable-single'
case "${_android_arch}" in
x86*)
configure_options="${configure_options} --enable-avx --enable-sse"
;;
*)
configure_options="${configure_options} --enable-neon"
;;
esac
;;
double)
if [ "${_android_arch}" = x86* ]; then
configure_options="${configure_options} --enable-avx --enable-sse2"
fi
;;
long-double)
configure_options="${configure_options} --enable-long-double"
;;
quad)
configure_options="${configure_options} --disable-mpi --enable-quad-precision"
;;
esac
case "${_android_arch}" in
aarch64)
configure_options="${configure_options} --enable-armv8-cntvct-el0 --enable-armv8-pmccntr-el0"
;;
armv7a-eabi)
configure_options="${configure_options} --enable-armv7a-pmccntr"
# configure_options="${configure_options} --enable-armv7a-cntvct"
;;
*)
;;
esac
target=${_android_arch/x86-/x86_}-linux-android
../configure \
--host=${target} \
--target=${target} \
--build=${CHOST} \
--prefix=${ANDROID_PREFIX} \
--libdir=${ANDROID_PREFIX_LIB} \
--includedir=${ANDROID_PREFIX_INCLUDE} \
--enable-shared \
--enable-static \
--disable-doc \
--disable-fortran \
--enable-threads \
--enable-mpi \
--enable-openmp \
MPILIBS="-Wl,-rpath -Wl,${ANDROID_PREFIX_LIB} -Wl,--enable-new-dtags -lmpi" \
${configure_options}
# fix overlinking because of libtool
sed -i 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
make $MAKEFLAGS
popd
done
}
package_android-aarch64-fftw() {
depends=('android-ndk')
optdepends=("android-${_android_arch}-fftw-openmpi: for OpenMPI integration")
cd "${srcdir}/fftw-${pkgver}"
source android-env ${_android_arch}
for precision in "${_build_types[@]}"; do
make -C build-${precision} DESTDIR="$pkgdir" install
done
rm -rf "${pkgdir}/${ANDROID_PREFIX_BIN}"
rm -rf "${pkgdir}/${ANDROID_PREFIX_SHARE}"
${ANDROID_STRIP} -g --strip-unneeded "${pkgdir}"/${ANDROID_PREFIX_LIB}/*.so
${ANDROID_STRIP} -g "$pkgdir"/${ANDROID_PREFIX_LIB}/*.a
_pick fftw-openmpi "${pkgdir}/${ANDROID_PREFIX_INCLUDE}"/fftw3-mpi.h
_pick fftw-openmpi "${pkgdir}/${ANDROID_PREFIX_INCLUDE}"/fftw3{,l}-mpi.f03
_pick fftw-openmpi "${pkgdir}/${ANDROID_PREFIX_LIB}"/libfftw3{,f,l}_mpi.{a,so}
# install missing FFTW3LibraryDepends.cmake
install -vDm 644 build/FFTW3LibraryDepends.cmake -t "${pkgdir}/${ANDROID_PREFIX_LIB}/cmake/fftw3/"
}
package_android-aarch64-fftw-openmpi() {
pkgdesc+=" - OpenMPI libraries (Android ${_android_arch})"
depends=("android-${_android_arch}-fftw"
"android-${_android_arch}-openmpi")
mv -v "${srcdir}/fftw-openmpi"/* "${pkgdir}"
}
|