blob: 15924362a5fcf6e297d5068fcd6395d7e0b52738 (
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
|
# 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
pkgname=android-${_android_arch}-fftw
pkgver=3.3.10
pkgrel=3
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')
groups=('android-fftw')
depends=('android-ndk')
makedepends=('android-cmake')
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
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 \
-DCMAKE_POLICY_DEFAULT_CMP0057=NEW \
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
-DBUILD_TESTS=OFF \
-DDISABLE_FORTRAN=ON \
-DENABLE_OPENMP=ON \
-DENABLE_THREADS=ON \
-DENABLE_FLOAT=ON \
-DENABLE_LONG_DOUBLE=ON \
-DENABLE_QUAD_PRECISION=ON \
-Wno-dev \
${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
# 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"
;;
aarch64|armv7a-eabi)
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} --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-openmp \
--disable-mpi \
${configure_options}
# fix overlinking because of libtool
sed -i 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
make $MAKEFLAGS
popd
done
}
package() {
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
# install missing FFTW3LibraryDepends.cmake
install -vDm 644 build/FFTW3LibraryDepends.cmake -t "${pkgdir}/${ANDROID_PREFIX_LIB}/cmake/fftw3/"
install -vDm 644 COPYING -t "${pkgdir}/usr/share/licenses/${pkgname}/"
}
|