1SUMMARY="Fast C library for the Discrete Fourier Transform"
2DESCRIPTION="FFTW is a C subroutine library for computing the discrete \
3Fourier transform (DFT) in one or more dimensions, of arbitrary input size, \
4and of both real and complex data (as well as of even/odd data, i.e. the \
5discrete cosine/sine transforms or DCT/DST). We believe that FFTW, which is \
6free software, should become the FFT library of choice for most applications.
7Our benchmarks, performed on on a variety of platforms, show that FFTW's \
8performance is typically superior to that of other publicly available FFT \
9software, and is even competitive with vendor-tuned codes. In contrast to \
10vendor-tuned codes, however, FFTW's performance is portable: the same program \
11will perform well on most architectures without modification. Hence the name, \
12FFTW, which stands for the somewhat whimsical title of Fastest Fourier \
13Transform in the West."
14HOMEPAGE="http://www.fftw.org/"
15COPYRIGHT="2003, 2007-2011 Matteo Frigo
16	2003, 2007-2011 Massachusetts Institute of Technology"
17LICENSE="GNU GPL v2"
18REVISION="3"
19SOURCE_URI="http://www.fftw.org/fftw-$portVersion.tar.gz"
20CHECKSUM_SHA256="56c932549852cddcfafdab3820b0200c7742675be92179e59e6215b340e26467"
21PATCHES="fftw-$portVersion.patchset"
22
23ARCHITECTURES="all"
24SECONDARY_ARCHITECTURES="x86_gcc2 x86"
25
26libVersion="3.6.10"
27libVersionCompat="$libVersion compat >= ${libVersion%%.*}"
28
29PROVIDES="
30	fftw$secondaryArchSuffix = $portVersion compat >= 3
31	cmd:fftw_wisdom$secondaryArchSuffix
32	cmd:fftwf_wisdom$secondaryArchSuffix
33	cmd:fftwl_wisdom$secondaryArchSuffix
34	cmd:fftwq_wisdom$secondaryArchSuffix
35	cmd:fftw_wisdom_to_conf$secondaryArchSuffix
36	lib:libfftw3$secondaryArchSuffix = $libVersionCompat
37	lib:libfftw3_threads$secondaryArchSuffix = $libVersionCompat
38	lib:libfftw3f$secondaryArchSuffix = $libVersionCompat
39	lib:libfftw3f_threads$secondaryArchSuffix = $libVersionCompat
40	lib:libfftw3l$secondaryArchSuffix = $libVersionCompat
41	lib:libfftw3l_threads$secondaryArchSuffix = $libVersionCompat
42	"
43if [ "$effectiveTargetArchitecture" != x86_gcc2 ]; then
44PROVIDES+="
45	lib:libfftw3q$secondaryArchSuffix = $libVersionCompat
46	lib:libfftw3q_threads$secondaryArchSuffix = $libVersionCompat
47	"
48fi
49
50REQUIRES="
51	haiku$secondaryArchSuffix
52	"
53if [ "$effectiveTargetArchitecture" != x86_gcc2 ]; then
54REQUIRES+="
55	lib:libquadmath$secondaryArchSuffix
56	"
57fi
58
59PROVIDES_devel="
60	fftw${secondaryArchSuffix}_devel = $portVersion compat >= 3
61	devel:libfftw3$secondaryArchSuffix = $libVersionCompat
62	devel:libfftw3_threads$secondaryArchSuffix = $libVersionCompat
63	devel:libfftw3f$secondaryArchSuffix = $libVersionCompat
64	devel:libfftw3f_threads$secondaryArchSuffix = $libVersionCompat
65	devel:libfftw3l$secondaryArchSuffix = $libVersionCompat
66	devel:libfftw3l_threads$secondaryArchSuffix = $libVersionCompat
67	"
68if [ "$effectiveTargetArchitecture" != x86_gcc2 ]; then
69PROVIDES_devel+="
70	devel:libfftw3q$secondaryArchSuffix = $libVersionCompat
71	devel:libfftw3q_threads$secondaryArchSuffix = $libVersionCompat
72	"
73fi
74REQUIRES_devel="
75	fftw$secondaryArchSuffix == $portVersion base
76	"
77
78BUILD_REQUIRES="
79	haiku${secondaryArchSuffix}_devel
80	"
81if [ "$effectiveTargetArchitecture" != x86_gcc2 ]; then
82BUILD_REQUIRES+="
83	devel:libgfortran$secondaryArchSuffix
84	"
85fi
86BUILD_PREREQUIRES="
87	cmd:aclocal
88	cmd:autoreconf
89	cmd:awk
90	cmd:cmp
91	cmd:diff
92	cmd:find
93	cmd:gcc$secondaryArchSuffix
94	cmd:ld$secondaryArchSuffix
95	cmd:libtoolize$secondaryArchSuffix
96	cmd:make
97	cmd:perl
98	"
99
100debugList=(
101	"$libDir"/libfftw3.so.$libVersion
102	"$libDir"/libfftw3_threads.so.$libVersion
103	"$libDir"/libfftw3f.so.$libVersion
104	"$libDir"/libfftw3f_threads.so.$libVersion
105	"$libDir"/libfftw3l.so.$libVersion
106	"$libDir"/libfftw3l_threads.so.$libVersion
107	)
108if [ "$effectiveTargetArchitecture" != x86_gcc2 ]; then
109debugList+=(
110	"$libDir"/libfftw3q.so.$libVersion
111	"$libDir"/libfftw3q_threads.so.$libVersion
112	)
113fi
114defineDebugInfoPackage fftw$secondaryArchSuffix "${debugList[@]}"
115
116BUILD()
117{
118	# Autoreconf because m4 patching
119	autoreconf --verbose --install --symlink --force
120
121	mkdir -p double long-double quad float
122
123	# 32 bit targets NORTHWOOD
124	# 64 bit targets PRESCOTT
125
126	CONFIGURE="--enable-shared \
127		--disable-static \
128		--enable-threads \
129		--disable-avx \
130		--disable-avx2 \
131		--disable-avx512"
132	#CONFIGURE="--enable-shared --enable-threads"
133	if [ "$effectiveTargetArchitecture" = x86_64 ]; then
134		CONFIGURE_DOUBLE_X86_64="--enable-sse2"
135		CONFIGURE_SINGLE_X86_64="--enable-sse"
136		#CONFIGURE_DOUBLE_X86_64="--enable-sse2 --enable-avx"
137		#CONFIGURE_SINGLE_X86_64="--enable-sse --enable-avx"
138	fi
139
140	# build double-precision version
141	cd double
142	runConfigure ../configure \
143		$CONFIGURE \
144		$CONFIGURE_DOUBLE_X86_64
145	make $jobArgs
146	cd ..
147
148	# build long-double-precision version, can't handle sse2
149	cd long-double
150	runConfigure ../configure \
151		--enable-long-double \
152		$CONFIGURE
153	make $jobArgs
154	cd ..
155
156if [ "$effectiveTargetArchitecture" != x86_gcc2 ]; then
157	# build long-quad-precision version, can't handle sse2
158	cd quad
159	runConfigure ../configure \
160		--enable-quad-precision \
161		$CONFIGURE
162	make $jobArgs
163	cd ..
164fi
165
166	# build single-precision version
167	cd float
168	runConfigure ../configure \
169		--enable-single \
170		$CONFIGURE \
171		$CONFIGURE_SINGLE_X86_64
172	make $jobArgs
173	cd ..
174}
175
176DIRS="double long-double float"
177fftwLibs="libfftw3 libfftw3_threads libfftw3f libfftw3f_threads libfftw3l libfftw3l_threads"
178if [ "$effectiveTargetArchitecture" != x86_gcc2 ]; then
179	DIRS="$DIRS quad"
180	fftwLibs="$fftwLibs libfftw3q libfftw3q_threads"
181fi
182
183INSTALL()
184{
185	for i in $DIRS; do
186 		make -C $i install
187 	done
188
189	rm -f "$libDir"/libfftw*.la
190
191	prepareInstalledDevelLibs $fftwLibs
192	fixPkgconfig
193
194	packageEntries devel \
195		"$developDir" \
196		"$libDir"/cmake
197}
198
199TEST()
200{
201	for i in $DIRS; do
202		make -C $i check $jobArgs
203	done
204}
205