summaryrefslogtreecommitdiff
path: root/fftw.spec
blob: b9c93720212a2c1e82039f33b4844eab275e6371 (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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
%define debug_package %{nil}
%bcond_with openmpi
%bcond_with mpich

%if %{with mpich}
%global mpi_list %{?mpi_list} mpich
%endif
%if %{with openmpi}
%global mpi_list %{?mpi_list} openmpi
%endif

Name:             fftw
Version:          3.3.10
Release:          1
Summary:          A C subroutine library for computing the discrete Fourier transform
License:          GPLv2+
URL:              http://www.fftw.org
Source0:          http://www.fftw.org/fftw-%{version}.tar.gz
BuildRequires:    gcc-gfortran autoconf automake libtool time perl-interpreter gcc_secure make

%global quad 0
# disable quad-precision compile tempoary
%ifarch x86_64
%global quad 0
%endif

%if %{with mpich}
BuildRequires:    mpich-devel nss-myhostname
%endif

%if %{with openmpi}
BuildRequires:    openmpi-devel
%endif

%if %{with mpich} || %{with openmpi}
BuildRequires:    environment-modules
%endif

Requires(post):   info
Requires(preun):  info

%description
This package is a C subroutine library for computing the discrete Fourier transform (DFT) in one or more dimensions, of arbitrary input size,
and of both real and complex data (as well as of even/odd data, i.e. the discrete cosine/sine transforms or DCT/DST).

%package          libs
Summary:          FFTW run-time library
Provides:         fftw3 = %{version}-%{release}
Obsoletes:        fftw-libs-threads < %{version}-%{release} fftw-libs-openmp < %{version}-%{release}

Requires:         %{name}-libs-single = %{version}-%{release} %{name}-libs-double = %{version}-%{release}
Requires:         %{name}-libs-long = %{version}-%{release}

%if %{quad}
Requires:         %{name}-libs-quad = %{version}-%{release}
%endif

%description      libs
This Package is a dummy package.

%package          devel
Summary:          Header files and libraries for development
Provides:         fftw3-devel = %{version}-%{release} %{name}-static = %{version}-%{release}
Provides:         fftw3-static = %{version}-%{release}
Obsoletes:        %{name}-static < %{version}-%{release}

Requires:         pkgconfig %{name} = %{version}-%{release} %{name}-libs = %{version}-%{release}

%description      devel
The fftw-devel package contains the static libraries, the header files and other development content.

%package          libs-double
Summary:          FFTW library, double precision

%description      libs-double
This package contains the FFTW library compiled in double precision.

%package          libs-single
Summary:          FFTW library, single precision

%description      libs-single
This package contains the FFTW library compiled in single precision.

%package          libs-long
Summary:          FFTW library, long double precision

%description      libs-long
This package contains the FFTW library compiled in long double
precision.

%if %{quad}
%package          libs-quad
Summary:          The FFTW library compiled in quadruple precision

%description      libs-quad
This package contains the FFTW library compiled in quadruple precision.
%endif

%if %{with mpich}
%package          mpich-libs
Summary:          FFTW MPICH run-time library
Provides:         fftw3-mpich = %{version}-%{release}

Requires:         %{name}-mpich-libs-single = %{version}-%{release} %{name}-mpich-libs-double = %{version}-%{release}
Requires:         %{name}-mpich-libs-long = %{version}-%{release}

%description      mpich-libs
This package contains the FFTW MPICH run-time library.

%package          mpich-devel
Summary:          Header files and libraries for the FFTW MPICH library
Provides:         fftw3-mpich-devel = %{version}-%{release} fftw3-mpich-static = %{version}-%{release}
Provides:         %{name}-mpich-static = %{version}-%{release}
Obsoletes:        %{name}-mpich-static < %{version}-%{release}

Requires:         mpich-devel pkgconfig %{name}-devel = %{version}-%{release} %{name}-mpich-libs = %{version}-%{release}

%description      mpich-devel
This package contains the header files and development libraries for MPICH.

%package          mpich-libs-double
Summary:          Double precision
Requires:         %{name}-libs-double = %{version}-%{release}

%description      mpich-libs-double
This package contains the FFTW MPICH library compiled in double precision.

%package          mpich-libs-single
Summary:          Single precision
Requires:         %{name}-libs-single = %{version}-%{release}

%description      mpich-libs-single
This package contains the FFTW MPICH library compiled in single precision.

%package          mpich-libs-long
Summary:          Long double precision
Requires:         %{name}-libs-long = %{version}-%{release}

%description      mpich-libs-long
This package contains the FFTW MPICH library compiled in long double precision.
%endif

%if %{with openmpi}
%package          openmpi-libs
Summary:          FFTW OpenMPI run-time library
Provides:         fftw3-openmpi = %{version}-%{release}

Requires:         %{name}-openmpi-libs-single = %{version}-%{release} %{name}-openmpi-libs-double = %{version}-%{release}
Requires:         %{name}-openmpi-libs-long = %{version}-%{release}

%description      openmpi-libs
This package contains the individual FFTW.

%package          openmpi-devel
Summary:          Header files and libraries for the FFTW OpenMPI library
Provides:         fftw3-openmpi-devel = %{version}-%{release} fftw3-openmpi-static = %{version}-%{release}
Provides:         %{name}-openmpi-static = %{version}-%{release}
Obsoletes:        %{name}-openmpi-static < %{version}-%{release}
Requires:         openmpi-devel pkgconfig %{name}-devel = %{version}-%{release}  %{name}-openmpi-libs = %{version}-%{release}

%description      openmpi-devel
This package contains the header files and libraries for the FFTW OpenMPI library.

%package          openmpi-libs-double
Summary:          Double precision
Requires:         %{name}-libs-double = %{version}-%{release}

%description      openmpi-libs-double
This package contains the FFTW OpenMPI library compiled in double precision.

%package          openmpi-libs-single
Summary:          Single precision
Requires:         %{name}-libs-single = %{version}-%{release}

%description      openmpi-libs-single
This package contains the FFTW OpenMPI library compiled in single precision.

%package          openmpi-libs-long
Summary:          Long double precision
Requires:         %{name}-libs-long = %{version}-%{release}

%description      openmpi-libs-long
This package contains the FFTW OpenMPI library compiled in long double precision.
%endif

%package          help
Summary:          Help documentation related to %{name}
BuildArch:        noarch
Provides:         %{name}-doc = %{version}-%{release}
Obsoletes:        %{name}-doc < %{version}-%{release}

%description      help
This package includes help documentation and manuals related to %{name}

%prep
%autosetup -p1

%build
%if %{with mpich} || %{with openmpi}
source /etc/profile.d/modules.sh
%endif
autoreconf -vfi
export F77=gfortran

function build_section()
{
    ln -s ../configure .
    %configure --enable-shared --disable-dependency-tracking --enable-threads --enable-openmp $1
    sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
    sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
    %make_build
}

function mpi_build_section()
{
    ln -s ../configure .
    export CC=mpicc
    %configure --enable-shared --disable-dependency-tracking --enable-threads --enable-openmp $1 --enable-mpi --libdir=%{_libdir}/$mpi/lib \
    --bindir=%{_libdir}/$mpi/bin --sbindir=%{_libdir}/$mpi/sbin --includedir=%{_includedir}/$mpi-%{_arch} --mandir=%{_libdir}/$mpi/share/man
    %make_build
}

mkdir single double long quad
%ifarch x86_64
    cd single
    siarch="--enable-single --enable-sse2 --enable-avx"
    build_section $siarch
    cd ../double
    diarch="--enable-double --enable-sse2 --enable-avx"
    build_section $diarch
%else
    cd single
    build_section --enable-single
    cd ../double
    build_section --enable-double
%endif

cd ../long
build_section --enable-long-double

%if %{quad}
    cd ../quad
    build_section --enable-quad-precision
%endif
cd ..

%if %{with mpich} || %{with openmpi}
for mpi in %{mpi_list}
do
        module load mpi/${mpi}-%{_arch}
    mkdir ${mpi}-single ${mpi}-double ${mpi}-long ${mpi}-quad
    %ifarch x86_64
        cd ${mpi}-single
        msiarch="--enable-single --enable-sse2 --enable-avx"
        mpi_build_section $msiarch
        cd ../${mpi}-double
        mdiarch="--enable-double --enable-sse2 --enable-avx"
        mpi_build_section $mdiarch
    %else
        cd ${mpi}-single
        mpi_build_section --enable-single
        cd ../${mpi}-double
        mpi_build_section --enable-double
    %endif

    cd ../${mpi}-long
    mpi_build_section --enable-long-double
    cd ..
    module unload mpi/${mpi}-%{_arch}
done
%endif

%install
function install_section()
{
    %make_install -C ${mpi}-$1
    find %{buildroot}%{_libdir}/${mpi}/lib -name libfftw\* -a \! -name \*_mpi.\* -delete
    rm -r %{buildroot}%{_libdir}/${mpi}/{bin,share}
}
%if %{with mpich} || %{with openmpi}
source /etc/profile.d/modules.sh
%endif

%make_install -C single
%make_install -C double
%make_install -C long

%if %{quad}
    %make_install -C quad
%endif

%global delete_la  find $RPM_BUILD_ROOT -type f -name "*.la" -delete

%if %{with mpich} || %{with openmpi}
for mpi in %{mpi_list}
do
    module load mpi/${mpi}-%{_arch}
    install_section single
    install_section double
    install_section long
    module unload mpi/${mpi}-%{_arch}
done
%endif

rm -f %{buildroot}%{_infodir}/dir
%delete_la

find %{buildroot} -type f -name '*.so*' -exec strip '{}' ';'
find %{buildroot} -type f -name 'fftw*-wisdom*' -exec strip '{}' ';'

%check
%if %{with mpich} || %{with openmpi}
source /etc/profile.d/modules.sh
%endif
mydir=`pwd`

export LD_LIBRARY_PATH=$mydir/single/.libs:$mydir/single/threads/.libs
make %{?_smp_mflags} -C single check
export LD_LIBRARY_PATH=$mydir/double/.libs:$mydir/double/threads/.libs
make %{?_smp_mflags} -C double check
export LD_LIBRARY_PATH=$mydir/long/.libs:$mydir/long/threads/.libs
make %{?_smp_mflags} -C long check

%if %{quad}
    export LD_LIBRARY_PATH=$mydir/quad/.libs:$mydir/quad/threads/.libs
    make %{?_smp_mflags} -C quad check
%endif

%if %{with mpich} || %{with openmpi}
for mpi in %{mpi_list}
do
    module load mpi/${mpi}-%{_arch}
    export LD_LIBRARY_PATH=$mydir/${mpi}-single/.libs:$mydir/single/threads/.libs
    make %{?_smp_mflags} -C ${mpi}-single/mpi check
    export LD_LIBRARY_PATH=$mydir/${mpi}-double/mpi check
    export LD_LIBRARY_PATH=$mydir/${mpi}-long/.libs:$mydir/long/threads/.libs
    make %{?_smp_mflags} -C ${mpi}-long/mpi check
    module unload mpi/${mpi}-%{_arch}
done
%endif

%post libs-single -p /sbin/ldconfig
%postun libs-single -p /sbin/ldconfig
%post libs-double -p /sbin/ldconfig
%postun libs-double -p /sbin/ldconfig
%post libs-long -p /sbin/ldconfig
%postun libs-long -p /sbin/ldconfig

%if %{quad}
%post libs-quad -p /sbin/ldconfig
%postun libs-quad -p /sbin/ldconfig
%endif

%post devel
/sbin/install-info --section="Math" %{_infodir}/%{name}.info.gz %{_infodir}/dir  2>/dev/null || :

%preun devel
if [ "$1" = 0 ]
then
  /sbin/install-info --delete %{_infodir}/%{name}.info.gz %{_infodir}/dir 2>/dev/null || :
fi

%files
%{_bindir}/fftw*-wisdom*
%exclude /usr/lib/debug/usr/bin/fftw*-wisdom*

%files libs
%exclude /usr/lib/debug/usr/lib64/

%files libs-single
%license COPYING COPYRIGHT
%doc AUTHORS ChangeLog NEWS README* TODO
%{_libdir}/libfftw3f.so.*
%{_libdir}/libfftw3f_threads.so.*
%{_libdir}/libfftw3f_omp.so.*

%files libs-double
%license COPYING COPYRIGHT
%doc AUTHORS ChangeLog NEWS README* TODO
%{_libdir}/libfftw3.so.*
%{_libdir}/libfftw3_threads.so.*
%{_libdir}/libfftw3_omp.so.*

%files libs-long
%license COPYING COPYRIGHT
%doc AUTHORS ChangeLog NEWS README* TODO
%{_libdir}/libfftw3l.so.*
%{_libdir}/libfftw3l_threads.so.*
%{_libdir}/libfftw3l_omp.so.*

%if %{quad}
%files libs-quad
%license COPYING COPYRIGHT
%doc AUTHORS ChangeLog NEWS README* TODO
%{_libdir}/libfftw3q.so.*
%{_libdir}/libfftw3q_threads.so.*
%{_libdir}/libfftw3q_omp.so.*
%endif

%files devel
%doc doc/FAQ/fftw-faq.html/
%doc %{_infodir}/fftw3.info*
%{_includedir}/fftw3*
%{_libdir}/cmake/fftw3/*.cmake
%{_libdir}/pkgconfig/fftw3*.pc
%{_libdir}/libfftw3*.{so,a}

%files help
%doc doc/*.pdf doc/html/
%{_mandir}/man1/fftw*.1*

%if %{with mpich}
%files mpich-libs

%files mpich-libs-single
%license COPYING COPYRIGHT
%doc AUTHORS ChangeLog NEWS README* TODO
%{_libdir}/mpich/lib/libfftw3f_mpi.so.*

%files mpich-libs-double
%license COPYING COPYRIGHT
%doc AUTHORS ChangeLog NEWS README* TODO
%{_libdir}/mpich/lib/libfftw3_mpi.so.*

%files mpich-libs-long
%license COPYING COPYRIGHT
%doc AUTHORS ChangeLog NEWS README* TODO
%{_libdir}/mpich/lib/libfftw3l_mpi.so.*

%files mpich-devel
%doc doc/FAQ/fftw-faq.html/
%{_includedir}/mpich-%{_arch}
%{_libdir}/mpich/lib/cmake/fftw3/*.cmake
%{_libdir}/mpich/lib/pkgconfig/fftw3*.pc
%{_libdir}/mpich/lib/libfftw3*.{so,a}
%endif

%if %{with openmpi}
%files openmpi-libs

%files openmpi-libs-single
%license COPYING COPYRIGHT
%doc AUTHORS ChangeLog NEWS README* TODO
%{_libdir}/openmpi/lib/libfftw3f_mpi.so.*

%files openmpi-libs-double
%license COPYING COPYRIGHT
%doc AUTHORS ChangeLog NEWS README* TODO
%{_libdir}/openmpi/lib/libfftw3_mpi.so.*

%files openmpi-libs-long
%license COPYING COPYRIGHT
%doc AUTHORS ChangeLog NEWS README* TODO
%{_libdir}/openmpi/lib/libfftw3l_mpi.so.*

%files openmpi-devel
%doc doc/FAQ/fftw-faq.html/
%{_includedir}/openmpi-%{_arch}
%{_libdir}/openmpi/lib/cmake/fftw3/*.cmake
%{_libdir}/openmpi/lib/pkgconfig/fftw3*.pc
%{_libdir}/openmpi/lib/libfftw3*.{so,a}
%endif

%changelog
* Thu Sep 15 2022 lutkunpeng <lutkunpeng@163.com> - 3.3.10-1
- DESC: update to 3.3.10

* Sat Jul 30 2022 yaoxin <yaoxin30@h-partners.com> - 3.3.8-9
- Strip the symbol table
- Fix self build fail
- Strip the binary fftw*-wisdom* symbol

* Mon Mar 28 2022 baizhonggui <baizhonggui@huawei.com> - 3.3.8-8
- fix build fail

* Tue May 26 2020 Captain Wei <captain.a.wei@gmail.com> - 3.3.8-7
- isable quad-precision compile tempoary

* Wed Jan 15 2020 zhangrui <zhangrui182@huawei.com> - 3.3.8-6
- fix selfbuild fail

* Thu Dec 19 2019 zhujunhao <zhujunhao5@huawei.com> - 3.3.8-5
- Modify for x86 build fail

* Wed Nov 27 2019 dongjian <dongjian13@huawei.com> - 3.3.8-4
- Package init

* Fri Nov 15 2019 dongjian <dongjian13@huawei.com> - 3.3.8-3
- Package init