summaryrefslogtreecommitdiff
path: root/cgnslib.spec
blob: 565934c647d68eac8e5751b6947203ec3fd0a101 (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
%bcond_with openmpi
%bcond_with mpich

Name:           cgnslib
Version:        4.3.0
Release:        1
Summary:        Computational Fluid Dynamics General Notation System
License:        zlib
URL:            http://www.cgns.org/
Source0:        https://github.com/CGNS/CGNS/archive/v%{version}/%{name}-%{version}.tar.gz
# Allow overriding all BIN/LIB/INCLUDE install dirs
Patch0:         cgnslib-cmake-install-dirs.patch

BuildRequires:  cmake
BuildRequires:  gcc
BuildRequires:  gcc-gfortran
BuildRequires:  hdf5-devel
BuildRequires:  libXmu-devel
BuildRequires:  make
BuildRequires:  mesa-libGL-devel
BuildRequires:  mesa-libGLU-devel
BuildRequires:  tcl-devel
BuildRequires:  tk-devel
BuildRequires:  zlib-devel
Requires:       hdf5%{?_isa} = %{_hdf5_version}
Requires:       %{name}-common = %{version}-%{release}

%description
The Computational Fluid Dynamics General Notation System (CGNS) provides a
general, portable, and extensible standard for the storage and retrieval of
computational fluid dynamics (CFD) analysisdata. It consists of a collection
of conventions, and free and open software implementing those conventions. It
is self-descriptive, machine-independent, well-documented, and administered by
an international steering committee.


%package common
Summary:        Common files for %{name}
BuildArch:      noarch

%description common
Common files for %{name}.


%package        devel
Summary:        Development files for %{name}
Requires:       %{name}%{?_isa} = %{version}-%{release}
Requires:       hdf5-devel%{?_isa}
Requires:       gcc-gfortran%{?_isa}

%description    devel
This package contains libraries and header files for
developing applications that use %{name} libraries.


###############################################################################

%if %{with openmpi}
%package        openmpi
Summary:        %{name} compiled against openmpi
Requires:       %{name}-common = %{version}-%{release}
BuildRequires:  openmpi-devel
BuildRequires:  hdf5-openmpi-devel

%description    openmpi
%{name} compiled against openmpi.


%package        openmpi-devel
Summary:        Development files for %{name} compiled against openmpi
# Require explicitly for dir ownership
Requires:       openmpi-devel
Requires:       %{name}-openmpi%{?_isa} = %{version}-%{release}

%description    openmpi-devel
Development files for %{name} compiled against openmpi.
%endif

###############################################################################

%if %{with mpich}
%package        mpich
Summary:        %{name} compiled against mpich
Requires:       %{name}-common = %{version}-%{release}
BuildRequires:  mpich-devel
BuildRequires:  hdf5-mpich-devel

%description    mpich
%{name} compiled against mpich.


%package        mpich-devel
Summary:        Development files for %{name} compiled against mpich
# Require explicitly for dir ownership
Requires:       mpich-devel
Requires:       %{name}-mpich%{?_isa} = %{version}-%{release}

%description    mpich-devel
Development files for %{name} compiled against mpich.
%endif

###############################################################################

%prep
%autosetup -p1 -n CGNS-%{version}

# Remove executable bit
chmod a-x src/cgnstools/utilities/cgns_to_vtk.c


%build
# This is needed for GCC10, whenever a new cgnslib release is published, check whether it is still needed
# export FCFLAGS+=-fallow-argument-mismatch
cgnslib_cmake_args="\
        -DCMAKE_SKIP_RPATH=ON \
        -DCGNS_ENABLE_TESTS=ON \
        -DCGNS_ENABLE_FORTRAN=ON \
        -DCGNS_BUILD_CGNSTOOLS=ON \
        -DCGNS_ENABLE_HDF5=ON"
#        -DCMAKE_Fortran_FLAGS_RELEASE:STRING='$FCFLAGS -DNDEBUG $LDFLAGS -lhdf5 -fPIC'"

### Serial version ###
%define _vpath_builddir %{_target_platform}
%cmake \
    -DBIN_INSTALL_DIR=%{_bindir} \
    -DLIB_INSTALL_DIR=%{_libdir} \
    -DINCLUDE_INSTALL_DIR=%{_includedir} \
    $cgnslib_cmake_args
%cmake_build


### openmpi version ###
%if %{with openmpi}
(
%{_openmpi_load}
%define _vpath_builddir %{_target_platform}-openmpi
export CXX=mpicxx
export FC=mpifort
%cmake \
    -DHDF5_NEED_MPI=ON -DCGNS_ENABLE_PARALLEL=ON \
    -DBIN_INSTALL_DIR=$MPI_BIN \
    -DLIB_INSTALL_DIR=$MPI_LIB \
    -DINCLUDE_INSTALL_DIR=$MPI_INCLUDE \
    -DCMAKE_Fortran_FLAGS_RELEASE="%{optflags} -I $MPI_FORTRAN_MOD_DIR" \
    $cgnslib_cmake_args

%cmake_build
%{_openmpi_unload}
)
%endif


### mpich version ###
%if %{with mpich}
(
%{_mpich_load}
%define _vpath_builddir %{_target_platform}-mpich
export CXX=mpicxx
export FC=mpifort
%cmake \
    -DHDF5_NEED_MPI=ON -DCGNS_ENABLE_PARALLEL=ON \
    -DBIN_INSTALL_DIR=$MPI_BIN \
    -DLIB_INSTALL_DIR=$MPI_LIB \
    -DINCLUDE_INSTALL_DIR=$MPI_INCLUDE \
    -DCMAKE_Fortran_FLAGS_RELEASE="%{optflags} -I $MPI_FORTRAN_MOD_DIR" \
    $cgnslib_cmake_args

%cmake_build
%{_mpich_unload}
)
%endif



%install
### openmpi version ###
%if %{with openmpi}
(
%{_openmpi_load}
%define _vpath_builddir %{_target_platform}-openmpi
%cmake_install

# Move fortran module to correct location
mkdir -p %{buildroot}$MPI_FORTRAN_MOD_DIR
mv %{buildroot}$MPI_INCLUDE/cgns.mod %{buildroot}$MPI_FORTRAN_MOD_DIR

# Drop desktop files
rm -f %{buildroot}$MPI_BIN/*.desktop
%{_openmpi_unload}
)
%endif

### mpich version ###
%if %{with mpich}
(
%{_mpich_load}
%define _vpath_builddir %{_target_platform}-mpich
%cmake_install

# Move fortran module to correct location
mkdir -p %{buildroot}$MPI_FORTRAN_MOD_DIR
mv %{buildroot}$MPI_INCLUDE/cgns.mod %{buildroot}$MPI_FORTRAN_MOD_DIR

# Drop desktop files
rm -f %{buildroot}$MPI_BIN/*.desktop
%{_mpich_unload}
)
%endif

### Serial version ###
%define _vpath_builddir %{_target_platform}
%cmake_install

# Move fortran module to correct location
mkdir -p %{buildroot}%{_libdir}/gfortran/modules
mv %{buildroot}%{_includedir}/cgns.mod %{buildroot}%{_libdir}/gfortran/modules

# Move desktop files to correct location
mkdir -p %{buildroot}%{_datadir}/applications
mv %{buildroot}%{_bindir}/*.desktop %{buildroot}%{_datadir}/applications


find %{buildroot} -name '*.a' -delete -print


%check
### Serial version ###
(
%define _vpath_builddir %{_target_platform}
export LD_LIBRARY_PATH=%{buildroot}%{_libdir}:$LD_LIBRARY_PATH
%ctest || :
)

### openmpi version ###
%if %{with openmpi}
(
%{_openmpi_load}
%define _vpath_builddir %{_target_platform}-openmpi
export LD_LIBRARY_PATH=%{buildroot}$MPI_LIB:$LD_LIBRARY_PATH
# parallel tests hang on i686,armv7hl
%ifnarch i686 armv7hl
%ctest || :
%endif
%{_mpich_unload}
)
%endif

### mpich version ###
%if %{with mpich}
(
%{_mpich_load}
%define _vpath_builddir %{_target_platform}-mpich
export LD_LIBRARY_PATH=%{buildroot}$MPI_LIB:$LD_LIBRARY_PATH
# parallel tests hang on i686,armv7hl
%ifnarch i686 armv7hl
%ctest || :
%endif
%{_mpich_unload}
)
%endif


%files
%{_bindir}/adf2hdf
%{_bindir}/cgconfig
%{_bindir}/cgnscalc
%{_bindir}/cgnscheck
%{_bindir}/cgnscompress
%{_bindir}/cgnsconvert
%{_bindir}/cgnsdiff
%{_bindir}/cgnslist
%{_bindir}/cgnsplot
%{_bindir}/cgnsnodes
%{_bindir}/cgnsnames
%{_bindir}/cgnstools/
%{_bindir}/cgnsupdate
%{_bindir}/cgnsview
%{_bindir}/hdf2adf
%{_bindir}/unitconv
%{_libdir}/libcgns.so.4.3

%files devel
%{_includedir}/cgnsBuild.defs
%{_includedir}/cgns_io.h
%{_includedir}/cgnslib.h
%{_includedir}/cgnstypes.h
%{_includedir}/cgnstypes_f.h
%{_includedir}/cgnstypes_f03.h
%{_includedir}/cgnswin_f.h
%{_includedir}/cgnsconfig.h
%{_libdir}/libcgns.so
%{_libdir}/cmake/cgns/
%{_fmoddir}/cgns.mod

%files common
%doc release_docs/RELEASE.txt README.md
%license license.txt
%{_datadir}/cgnstools/
%{_datadir}/applications/cgnscalc.desktop
%{_datadir}/applications/cgnsnodes.desktop
%{_datadir}/applications/cgnsplot.desktop
%{_datadir}/applications/cgnsview.desktop
%{_datadir}/applications/unitconv.desktop

%if %{with openmpi}
%files openmpi
%{_libdir}/openmpi/bin/adf2hdf
%{_libdir}/openmpi/bin/cgconfig
%{_libdir}/openmpi/bin/cgnscalc
%{_libdir}/openmpi/bin/cgnscheck
%{_libdir}/openmpi/bin/cgnscompress
%{_libdir}/openmpi/bin/cgnsconvert
%{_libdir}/openmpi/bin/cgnsdiff
%{_libdir}/openmpi/bin/cgnslist
%{_libdir}/openmpi/bin/cgnsplot
%{_libdir}/openmpi/bin/cgnsnodes
%{_libdir}/openmpi/bin/cgnsnames
%{_libdir}/openmpi/bin/cgnstools/
%{_libdir}/openmpi/bin/cgnsupdate
%{_libdir}/openmpi/bin/cgnsview
%{_libdir}/openmpi/bin/hdf2adf
%{_libdir}/openmpi/bin/unitconv
%{_libdir}/openmpi/lib/libcgns.so.4.3

%files openmpi-devel
%{_includedir}/openmpi*/cgnsBuild.defs
%{_includedir}/openmpi*/cgns_io.h
%{_includedir}/openmpi*/cgnslib.h
%{_includedir}/openmpi*/cgnstypes.h
%{_includedir}/openmpi*/cgnstypes_f.h
%{_includedir}/openmpi*/cgnstypes_f03.h
%{_includedir}/openmpi*/cgnswin_f.h
%{_includedir}/openmpi*/cgnsconfig.h
%{_includedir}/openmpi*/pcgnslib.h
%{_libdir}/openmpi/lib/libcgns.so
%{_libdir}/openmpi/lib/cmake/cgns/
%{_fmoddir}/openmpi/cgns.mod
%endif

%if %{with mpich}
%files mpich
%{_libdir}/mpich/bin/adf2hdf
%{_libdir}/mpich/bin/cgconfig
%{_libdir}/mpich/bin/cgnscalc
%{_libdir}/mpich/bin/cgnscheck
%{_libdir}/mpich/bin/cgnscompress
%{_libdir}/mpich/bin/cgnsconvert
%{_libdir}/mpich/bin/cgnsdiff
%{_libdir}/mpich/bin/cgnslist
%{_libdir}/mpich/bin/cgnsplot
%{_libdir}/mpich/bin/cgnsnodes
%{_libdir}/mpich/bin/cgnsnames
%{_libdir}/mpich/bin/cgnstools/
%{_libdir}/mpich/bin/cgnsupdate
%{_libdir}/mpich/bin/cgnsview
%{_libdir}/mpich/bin/hdf2adf
%{_libdir}/mpich/bin/unitconv
%{_libdir}/mpich/lib/libcgns.so.4.3

%files mpich-devel
%{_includedir}/mpich*/cgnsBuild.defs
%{_includedir}/mpich*/cgns_io.h
%{_includedir}/mpich*/cgnslib.h
%{_includedir}/mpich*/cgnstypes.h
%{_includedir}/mpich*/cgnstypes_f.h
%{_includedir}/mpich*/cgnstypes_f03.h
%{_includedir}/mpich*/cgnswin_f.h
%{_includedir}/mpich*/cgnsconfig.h
%{_includedir}/mpich*/pcgnslib.h
%{_libdir}/mpich/lib/libcgns.so
%{_libdir}/mpich/lib/cmake/cgns/
%{_fmoddir}/mpich/cgns.mod
%endif


%changelog
* Tue Aug 5 2025 mimanchiok <mimanchiok@qq.com> - 4.3.0-1
- project init