File netcdf-cxx4.spec of Package netcdf-cxx4 (Revision fa78c0a90e51aceff40fb8a71c48c109)
Currently displaying revision fa78c0a90e51aceff40fb8a71c48c109 , Show latest
298
1
#
2
# spec file for package netcdf
3
#
4
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
5
#
6
# All modifications and additions to the file contributed by third parties
7
# remain the property of their copyright owners, unless otherwise agreed
8
# upon. The license for this file, and modifications and additions to the
9
# file, is the same license as for the pristine package itself (unless the
10
# license for the pristine package is not an Open Source License, in which
11
# case the license is the MIT License). An "Open Source License" is a
12
# license that conforms to the Open Source Definition (Version 1.9)
13
# published by the Open Source Initiative.
14
15
# Please submit bugfixes or comments via http://bugs.opensuse.org/
16
#
17
18
19
%global flavor @BUILD_FLAVOR@%{nil}
20
21
%global pname netcdf-cxx4
22
%global ver 4.3.0
23
%global _ver 4_3_0
24
%define sover 1
25
26
ExcludeArch: s390 s390x
27
28
%if "%flavor" == ""
29
ExclusiveArch: do_not_build
30
%endif
31
32
%if "%flavor" == "standard"
33
%undefine compiler_family
34
%bcond_with hpc
35
%endif
36
37
%if "%flavor" == "gnu-hpc"
38
%global compiler_family gnu
39
%bcond_without hpc
40
%endif
41
42
%if "%flavor" == "gnu7-hpc"
43
%global compiler_family gnu
44
%bcond_without hpc
45
%define c_f_ver 7
46
%endif
47
48
%if !0%{?is_opensuse} && !0%{?with_hpc:1}
49
ExclusiveArch: do_not_build
50
%endif
51
52
%define hpc_upcase_trans_hyph() %(echo %{**} | tr [a-z] [A-Z] | tr '-' '_')
53
54
%if %{with hpc}
55
%{hpc_init -c %{compiler_family} %{?c_f_ver:-v %{c_f_ver}}}
56
%define package_name %{hpc_package_name %_ver}
57
%define libname(s:l:) lib%{pname}%{hpc_package_name_tail %{?-l:%{-l*}}}
58
%define p_bindir %hpc_bindir
59
%define p_libdir %hpc_libdir
60
%define p_includedir %hpc_includedir
61
%else
62
%define package_name %pname
63
%define libname(s:l:) libnetcdf_c++4%{?-s:-%{-s*}}
64
%define p_bindir %_bindir
65
%define p_libdir %_libdir
66
%define p_includedir %_includedir
67
%endif
68
69
Name: %{package_name}
70
Version: %ver
71
Release: 0
72
Summary: C++ library for the Unidata network Common Data Form version 4
73
License: NetCDF
74
Group: Productivity/Scientific/Other
75
Url: http://www.unidata.ucar.edu/software/netcdf/
76
Source0: http://www.unidata.ucar.edu/downloads/netcdf/ftp/netcdf-cxx4-%{version}.tar.gz
77
Patch0: netcdf-cxx4-testsuite_bigendian.patch
78
%if %{without hpc}
79
BuildRequires: gcc-c++
80
BuildRequires: pkg-config
81
BuildRequires: pkgconfig(netcdf)
82
%else
83
BuildRequires: %{compiler_family}%{?c_f_ver}-compilers-hpc-macros-devel
84
BuildRequires: lua-lmod
85
BuildRequires: netcdf-%{compiler_family}%{?c_f_ver}-hpc-devel
86
BuildRequires: suse-hpc
87
%endif
88
89
%description
90
NetCDF4 (network Common Data Form) is a set of software libraries and
91
machine-independent data formats that support the creation, access, and sharing
92
of array-oriented scientific data.
93
94
This package provides the C++ API.
95
96
%package tools
97
Summary: Tools for working with the netcdf4 C++ library
98
Group: Productivity/Scientific/Other
99
%{?with_hpc:Requires: %{libname -s %{sover} -l %_ver}}
100
BuildArch: noarch
101
102
%description tools
103
NetCDF4 (network Common Data Form) is a set of software libraries and
104
machine-independent data formats that support the creation, access, and sharing
105
of array-oriented scientific data.
106
107
This package provides tools for working with the C++ API.
108
109
%{?with_hpc:%{hpc_master_package tools}}
110
111
%package -n %{libname -s %{sover} -l %_ver}
112
Summary: C++ library for the Unidata network Common Data Form version 4
113
Group: System/Libraries
114
%if %{without hpc}
115
Provides: libnetcdf%{sover}:%{p_libdir}/libnetcdf_c++.so.%{sover}
116
%else
117
%hpc_requires
118
Requires: libnetcdf-%{compiler_family}%{?c_f_ver}-hpc
119
%endif
120
121
%description -n %{libname -s %{sover} -l %_ver}
122
NetCDF4 (network Common Data Form) is a set of software libraries and
123
machine-independent data formats that support the creation, access, and sharing
124
of array-oriented scientific data.
125
126
This package provides the C++ API.
127
128
%{?with_hpc:%{hpc_master_package -n %{libname} -L -l}}
129
130
%package -n %{libname -l %_ver}-devel
131
Summary: Development files for netcdf_c++
132
Group: Development/Libraries/C and C++
133
%if %{without hpc}
134
Provides: libnetcdf-devel:%{_libdir}/libnetcdf_c++.so
135
%else
136
Requires: netcdf-%{compiler_family}%{?c_f_ver}-hpc-devel
137
%endif
138
Requires: %{libname -s %{sover} -l %_ver} = %{version}
139
%{?with_hpc:%hpc_requires_devel}
140
141
%description -n %{libname -l %_ver}-devel
142
This package contains the netcdf_c++4 header files and shared devel libs.
143
144
%{?with_hpc:%{hpc_master_package -l devel}}
145
146
%package -n %{libname -l %_ver}-devel-static
147
Summary: Static development files for netcdf_c++
148
Group: Development/Libraries/C and C++
149
Requires: %{libname -l %_ver}-devel = %{version}
150
151
%description -n %{libname -l %_ver}-devel-static
152
Libraries to build statically linked applications with NetCDF.
153
154
%prep
155
%setup -q -n %{pname}-%{version}
156
%ifarch ppc ppc64 s390 s390x
157
%patch0 -p1
158
%endif
159
160
%build
161
%{?with_hpc:%hpc_setup}
162
%if %{without hpc}
163
%configure \
164
--disable-static
165
%else
166
module load netcdf
167
export CFLAGS="-I $NETCDF_INC -L$NETCDF_LIB -lnetcdf -L$HDF5_LIB -lhdf5"
168
export CPPFLAGS=$CFLAGS
169
export LDFLAGS="-L$NETCDF_LIB -lnetcdf -L$HDF5_LIB -lhdf5"
170
%hpc_configure \
171
--enable-shared \
172
--enable-netcdf-4 \
173
--enable-dap \
174
--enable-ncgen4 \
175
--with-pic \
176
--disable-doxygen \
177
--enable-static
178
%endif
179
make %{?_smp_mflags}
180
181
%install
182
%if %{with hpc}
183
%{hpc_setup}
184
module load netcdf
185
export CFLAGS="-I $NETCDF_INC -L$NETCDF_LIB -lnetcdf -L$HDF5_LIB -lhdf5"
186
export CPPFLAGS=$CFLAGS
187
export LDFLAGS="-L$NETCDF_LIB -lnetcdf -L$HDF5_LIB -lhdf5"
188
%endif
189
%make_install
190
rm %{buildroot}%{p_libdir}/libnetcdf_c++4.la
191
192
%if %{with hpc}
193
%hpc_write_modules_files
194
#%%Module1.0#####################################################################
195
196
proc ModulesHelp { } {
197
198
puts stderr " "
199
puts stderr "This module loads the NetCDF C++ API built with the %{compiler_family} compiler toolchain."
200
puts stderr " "
201
puts stderr "Note that this build of NetCDF leverages the HDF I/O library and requires linkage"
202
puts stderr "against hdf5 and the native C NetCDF library. Consequently, phdf5 and the standard C"
203
puts stderr "version of NetCDF are loaded automatically via this module. A typical compilation"
204
puts stderr "example for C++ applications requiring NetCDF is as follows:"
205
puts stderr " "
206
puts stderr "\\\$CXX -I\\\$NETCDF_CXX_INC app.cpp -L\\\$NETCDF_CXX_LIB -lnetcdf_c++4 -L\\\$NETCDF_LIB -lnetcdf -L\\\$HDF5_LIB -lhdf5"
207
208
puts stderr "\nVersion %{version}\n"
209
210
}
211
module-whatis "Name: %{hpc_upcase %pname} built with %{compiler_family} toolchain"
212
module-whatis "Version: %{version}"
213
module-whatis "Category: runtime library"
214
module-whatis "Description: %{SUMMARY:0}"
215
module-whatis "%{url}"
216
217
# Require generic netcdf
218
219
if [ expr [ module-info mode load ] || [module-info mode display ] ] {
220
if { ![is-loaded netcdf] } {
221
module load netcdf
222
}
223
}
224
225
set version %{version}
226
227
prepend-path PATH %{hpc_bindir}
228
prepend-path MANPATH %{hpc_mandir}
229
prepend-path LD_LIBRARY_PATH %{hpc_libdir}
230
231
setenv %{hpc_upcase_trans_hyph %pname}_DIR %{hpc_prefix}
232
if ([file isdirectory %{hpc_bindir}]) {
233
setenv %{hpc_upcase_trans_hyph %pname}_BIN %{hpc_bindir}
234
}
235
if {[file isdirectory %{hpc_includedir}]} {
236
prepend-path LIBRARY_PATH %{hpc_libdir}
237
prepend-path CPATH %{hpc_includedir}
238
prepend-path C_INCLUDE_PATH %{hpc_includedir}
239
prepend-path CPLUS_INCLUDE_PATH %{hpc_includedir}
240
prepend-path INCLUDE %{hpc_includedir}
241
%hpc_modulefile_add_pkgconfig_path
242
243
setenv %{hpc_upcase_trans_hyph %pname}_LIB %{hpc_libdir}
244
setenv %{hpc_upcase_trans_hyph %pname}_INC %{hpc_includedir}
245
}
246
EOF
247
248
%endif
249
250
%check
251
%{?hpc_setup}
252
%if %{with hpc}
253
module load netcdf
254
export CFLAGS="-I $NETCDF_INC -L$NETCDF_LIB -lnetcdf -L$HDF5_LIB -lhdf5"
255
export CPPFLAGS=$CFLAGS
256
export LDFLAGS="-L$NETCDF_LIB -lnetcdf -L$HDF5_LIB -lhdf5"
257
%endif
258
make check || {
259
cat cxx4/test-suite.log
260
exit 1
261
}
262
263
%post -n %{libname -s %{sover} -l %_ver} -p /sbin/ldconfig
264
265
%postun -n %{libname -s %{sover} -l %_ver}
266
/sbin/ldconfig
267
%{?with_hpc:%hpc_module_delete_if_default}
268
269
%files tools
270
%defattr(-,root,root)
271
%doc COPYRIGHT
272
%{?with_hpc:%dir %{p_bindir}}
273
%{p_bindir}/ncxx4-config
274
275
%files -n %{libname -s %{sover} -l %_ver}
276
%defattr(-,root,root)
277
%doc COPYRIGHT
278
%{?with_hpc:%hpc_dirs}
279
%{?with_hpc:%hpc_modules_files}
280
%{p_libdir}/libnetcdf_c++4.so.%{sover}
281
%{p_libdir}/libnetcdf_c++4.so.%{sover}.*
282
283
%files -n %{libname -l %_ver}-devel
284
%defattr(-,root,root)
285
%doc COPYRIGHT
286
%{p_includedir}/
287
%{?with_hpc:%dir %{hpc_pkgconfigdir}}
288
%{p_libdir}/pkgconfig/netcdf-cxx4.pc
289
%{p_libdir}/libnetcdf_c++4.so
290
291
%if %{with hpc}
292
%files -n %{libname -l %_ver}-devel-static
293
%defattr(-,root,root)
294
%{p_libdir}/*.a
295
%endif
296
297
%changelog
298