blob: 75696fb361ba992482c975bb92e65602bc321d8a (
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
|
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=6
FORTRAN_NEEDED=fortran
inherit autotools flag-o-matic fortran-2 multibuild toolchain-funcs
DESCRIPTION="Fast C library for the Discrete Fourier Transform"
HOMEPAGE="http://www.fftw.org"
SRC_URI="http://www.fftw.org/${P}.tar.gz"
KEYWORDS="alpha amd64 arm hppa ia64 ppc ppc64 ~s390 sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x86-macos"
LICENSE="GPL-2+"
SLOT="2.1"
IUSE="doc float fortran mpi openmp threads static-libs"
RDEPEND="mpi? ( virtual/mpi )"
DEPEND="${RDEPEND}"
PATCHES=(
"${FILESDIR}"/${P}-as-needed.patch
"${FILESDIR}"/${P}-configure.in.patch
"${FILESDIR}"/${P}-no-test.patch
"${FILESDIR}"/${P}-cc.patch
"${FILESDIR}"/${P}-texinfo5.1.patch
"${FILESDIR}"/${P}-parallel-tests.patch
)
pkg_pretend() {
[[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
}
pkg_setup() {
if [[ ${MERGE_TYPE} != binary ]] && use openmp; then
tc-check-openmp
FORTRAN_NEED_OPENMP=1
fi
fortran-2_pkg_setup
MULTIBUILD_VARIANTS=( single double )
}
src_prepare() {
default
# fix info files
local infofile
for infofile in doc/fftw*info*; do
cat >> ${infofile} <<-EOF || die
INFO-DIR-SECTION Libraries
START-INFO-DIR-ENTRY
* fftw: (fftw). ${DESCRIPTION}
END-INFO-DIR-ENTRY
EOF
done
mv configure.{in,ac} || die
sed -i 's/AM_CONFIG_HEADER/AC_CONFIG_HEADERS/g' configure.ac || die
eautoreconf
# 'FAQ' is actually a dir and causes issues with einstalldocs
rm -r FAQ || die
multibuild_copy_sources
}
fftw_src_configure() {
local myconf=(
--with-gcc=$(tc-getCC)
--enable-shared
--enable-type-prefix
--enable-vec-recurse
$(use_enable fortran)
$(use_enable mpi)
$(use_enable static-libs static)
$(use_enable x86 i386-hacks)
$(use_with openmp)
)
if use openmp || use threads; then
myconf+=( --enable-threads )
else
myconf+=( --disable-threads )
fi
[[ $MULTIBUILD_VARIANT == single ]] && myconf+=( --enable-float )
econf "${myconf[@]}"
}
src_configure() {
# this one is reported to cause trouble on pentium4 m series
filter-mfpmath sse
# here I need (surprise) to increase optimization:
# --enable-i386-hacks requires -fomit-frame-pointer to work properly
if use x86; then
is-flag -fomit-frame-pointer || append-flags -fomit-frame-pointer
fi
use openmp && [[ $(tc-getCC)$ == icc* ]] && append-ldflags $(no-as-needed)
multibuild_foreach_variant run_in_build_dir fftw_src_configure
}
src_compile() {
multibuild_foreach_variant run_in_build_dir default_src_compile
}
src_test() {
multibuild_foreach_variant run_in_build_dir default_src_test
}
src_install () {
use doc && HTML_DOCS=( doc/*.{html,gif} )
multibuild_foreach_variant run_in_build_dir default_src_install
doheader fortran/fftw_f77.i
create_fftw_symlinks() {
local i f letter=$1
for i in fft rfft; do
for f in "${ED%/}"/usr/{include,$(get_libdir)}/*${letter}${i}*; do
ln -s $(basename ${f}) ${f/${letter}${i}/${i}} || die
done
done
}
create_fftw_symlinks $(usex float s d)
if ! use static-libs; then
find "${D}" -name '*.la' -delete || die
fi
}
|