File eccodes.spec of Package eccodes

Name: eccodes
Version: 2.0.2
Release: 7.1
Summary: Library and tools to handle Grib 1/2 and BUFR files
URL:https://software.ecmwf.int/wiki/display/ECC/ecCodes+Home
BuildRoot:    %{_tmppath}/%{name}-%{version}-build
Source0: %{name}-%{version}.tar.gz
License: Apache License 2.0
Group: Productivity/Scientific/Other

# https://en.opensuse.org/openSUSE:Package_dependencies#Renaming_a_package
Obsoletes: grib_api < %version
#Conflicts: grib_api
Provides:  grib_api = %version

#
# Build requirements
#
BuildRequires: gcc cmake
%if 0%{?fedora_version} >= 24
BuildRequires: pkgconfig
%else
BuildRequires: pkg-config
%endif

%if 0%{?suse_version} 
BuildRequires: fdupes
%endif

%if 0%{?suse_version} >= 1130
BuildRequires: python-numpy-devel python-devel swig
Requires: python python-numpy python-devel
#  SLES 9 & 10 do NOT have jasper!!!
BuildRequires: libjasper-devel
%endif

BuildRequires: netcdf-devel hdf5-devel zlib-devel
Requires: netcdf-devel hdf5-devel zlib-devel

%if 0%{?suse_version}  
BuildRequires: gcc-fortran 
%else  
BuildRequires: gcc-gfortran  
%endif

#!BuildIgnore: post-build-checks

%description
Runtime files of the ECMWF GRIB API is an application program interface accessible from C and FORTRAN programs developed for encoding and decoding WMO FM-92 GRIB and BUFR messages. A useful set of command line tools is also provided to give quick access to GRIB and BUFR messages.

%package devel
Summary: Developing package for eccodes
Group: Development/Languages/C and C++
%description devel
Header files and library of the ECMWF ecCodes is an application program interface accessible from C and FORTRAN programs developed for encoding and decoding WMO FM-92 GRIB and BUFR messages. A useful set of command line tools is also provided to give quick access to GRIB and BUFR messages.

Obsoletes: grib_api-devel
Conflicts: grib_api-devel
Provides:  grib_api-devel

%prep
%setup -q

%build
mkdir build
cd build

%if 0%{?suse_version} > 1210
%ifarch x86_64
cmake .. -DCMAKE_PREFIX_PATH=/usr -DCMAKE_INSTALL_PREFIX=/usr -DECCODES_INSTALL_LIB_DIR=lib64 -DENABLE_NETCDF=ON
%else
cmake .. -DCMAKE_PREFIX_PATH=/usr -DCMAKE_INSTALL_PREFIX=/usr -DENABLE_NETCDF=ON -DENABLE_PYTHON=ON
%endif
%else
%if 0%{?fedora_version} > 20 || 0%{?centos_version} == 600 || 0%{?rhel_version} == 600
%ifarch x86_64
cmake .. -DCMAKE_PREFIX_PATH=/usr -DCMAKE_INSTALL_PREFIX=/usr -DECCODES_INSTALL_LIB_DIR=lib64 -DENABLE_PYTHON=OFF
%else
cmake .. -DCMAKE_PREFIX_PATH=/usr -DCMAKE_INSTALL_PREFIX=/usr -DENABLE_PYTHON=OFF
%endif
%else
%ifarch x86_64
cmake .. -DCMAKE_PREFIX_PATH=/usr -DCMAKE_INSTALL_PREFIX=/usr -DECCODES_INSTALL_LIB_DIR=lib64 -DENABLE_NETCDF=ON
%else
cmake .. -DCMAKE_PREFIX_PATH=/usr -DCMAKE_INSTALL_PREFIX=/usr -DENABLE_PYTHON=ON
%endif
%endif

%endif

make

# install all files into the BuildRoot
make DESTDIR=$RPM_BUILD_ROOT install
rm -f /usr/share/eccodes/definitions/grib2/tables/5/4.2.10.191.table
rm -f /usr/share/eccodes/definitions/installDefinitions.sh

%if 0%{?suse_version}
%fdupes -s %buildroot/
%endif

%clean
# clean up the hard disc after build
rm -rf $RPM_BUILD_ROOT

%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig

%files
%defattr(-,root,root,-)
/usr/bin/*
/usr/share/*
%_libdir/*.so*

%files devel
%defattr(-,root,root,-)
/usr/include
%_libdir/pkgconfig
%if 0%{?suse_version} > 1130
%_libdir/python2.7
%endif
openSUSE Build Service is sponsored by