File odb_api.spec of Package odb_api

Name: odb_api
Version: 0.17.6
Release: 11.1
Summary: Library and tools to handle ODB archive files
URL:https://software.ecmwf.int/wiki/display/ODBAPI/ODB+API+Home
BuildRoot:    %{_tmppath}/%{name}_bundle-%{version}-build
Source0: %{name}_bundle-%{version}-Source.tar.gz
License: Apache License 2.0
Group: Productivity/Scientific/Other

#
# Build requirements
#
BuildRequires: cmake >= 2.8
BuildRequires: gcc-c++ bison flex
BuildRequires: swig

%if 0%{?fedora_version} >= 24
BuildRequires: pkgconfig
%else
BuildRequires: pkg-config
%endif

%if 0%{?suse_version} 
BuildRequires: fdupes
BuildRequires: ncurses-devel
Requires: ncurses-devel
%if 0%{?sle_version} > 140000  	
BuildRequires: python3-numpy-devel python3-devel 
Requires: python3 python3-numpy python3-devel
%else
BuildRequires: python-numpy-devel python-devel
Requires: python python-numpy python-devel
%endif

%else
%if 0%{?centos_version} || 0%{?rhel_version} > 600
Requires: python python2-numpy
%endif

%endif

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

#!BuildIgnore: post-build-checks

%description
Runtime files of the ECMWF ODB_API.

%package devel
Summary: Developing package for ODB_API
Group: Development/Languages/C and C++
%description devel
Header files and library of the ECMWF ODB_API.


%prep
#%setup -q
cd %{_topdir}/BUILD
rm -rf %{name}_bundle-%{version}-Source
cp -rf %{_topdir}/SOURCES/%{name}_bundle-%{version}-Source.tar.gz .
tar -xzf %{name}_bundle-%{version}-Source.tar.gz
cd %{name}_bundle-%{version}-Source

%build
cd %{_topdir}/BUILD/%{name}_bundle-%{version}-Source
mkdir build
cd build

%if 0%{?suse_version}
  cmake .. -DCMAKE_PREFIX_PATH=/usr -DCMAKE_INSTALL_PREFIX=/usr -DINSTALL_LIB_DIR=lib64 -DENABLE_PYTHON=ON -DCMAKE_SKIP_RPATH=ON
%else
  cmake .. -DCMAKE_PREFIX_PATH=/usr -DCMAKE_INSTALL_PREFIX=/usr -DINSTALL_LIB_DIR=lib64 -DENABLE_PYTHON=OFF
%endif

make

# install all files into the BuildRoot
make DESTDIR=$RPM_BUILD_ROOT install
rm -rf $RPM_BUILD_ROOT/usr/share/odb_api_bundle/cmake

%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/

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