Blob Blame History Raw
Name:           libpoly
Version:        0.1.4
Release:        2%{?dist}
Summary:        C library for manipulating polynomials

License:        LGPLv3+
URL:            https://github.com/SRI-CSL/%{name}
Source0:        https://github.com/SRI-CSL/%{name}/archive/v%{version}/%{name}-%{version}.tar.gz

BuildRequires:  cmake
BuildRequires:  gcc
BuildRequires:  gmp-devel
BuildRequires:  python2-devel
BuildRequires:  python2-sympy

%description
LibPoly is a C library for manipulating polynomials.  The target
applications are symbolic reasoning engines, such as SMT solvers, that
need to reason about polynomial constraints.

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

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

%package -n     python2-%{name}
Summary:        Python interface to %{name}
Requires:       %{name}%{?_isa} = %{version}-%{release}

%{?python_provide:%python_provide python2-%{name}}

%description -n python2-%{name}
Python interface to %{name}.

%prep
%autosetup

# The python interface violates strict aliasing rules
sed -i '/^set_tar/iset(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-strict-aliasing")' \
  python/CMakeLists.txt

# Install in the right place
if [ "%{_lib}" != "lib" ]; then
  sed -i 's/\(DESTINATION \)lib/\1%{_lib}/' src/CMakeLists.txt
fi

# Enable the sympy tests
sed -i 's/check\.py/& --sympy/' test/CMakeLists.txt

# Clean up hidden files before they get installed
find . -name .gitignore -exec rm {} +

%build
cd build
%cmake .. %{_cmake_skip_rpath} \
  -DCMAKE_BUILD_TYPE=RelWithDebInfo \
  -DLIBPOLY_BUILD_STATIC:BOOL=OFF \
  -DLIBPOLY_BUILD_STATIC_PIC:BOOL=OFF \
  -DLIBPOLY_BUILD_PYTHON_API:BOOL=ON
%make_build

%install
cd build
%make_install

# The python interface is not installed
mkdir -p %{buildroot}%{python2_sitearch}
cp -p python/polypy.so %{buildroot}%{python2_sitearch}

%check
# NOTE: 2 gcd tests fail.  Upstream is aware and working on a fix.
export LD_LIBRARY_PATH=%{buildroot}%{_libdir}
cd build
make check

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files
%license LICENCE
%doc README.md
%{_libdir}/*.so.*

%files devel
%{_includedir}/poly/
%{_libdir}/*.so

%files -n python2-%{name}
%doc examples
%{python2_sitearch}/polypy.so

%changelog
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.1.4-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Mon Jan  1 2018 Jerry James <loganjerry@gmail.com> - 0.1.4-1
- Initial RPM