Blob Blame History Raw
Name:           cadical
Version:        1.0.0
Release:        1%{?dist}
Summary:        Simplified SAT solver

License:        MIT
URL:            http://fmv.jku.at/cadical/
Source0:        https://github.com/arminbiere/%{name}/archive/rel-%{version}.tar.gz
# Fedora-only patch: build a shared library instead of a static library
Patch0:         %{name}-shared.patch
# Fix building on 32-bit platforms
Patch1:         %{name}-32bit.patch

BuildRequires:  drat-trim-tools
BuildRequires:  gcc-c++
BuildRequires:  glibc-langpack-en
BuildRequires:  help2man
BuildRequires:  zlib-devel
Requires:       %{name}-libs%{?_isa} = %{version}-%{release}

# This can be removed when Fedora 30 reaches EOL
Obsoletes:      cadical = 06w

%description
CaDiCaL is a simplified Satisfiability solver.  The goal of the
development of CaDiCaL is to obtain a CDCL solver, which is easy to
understand and change, while at the same time not being much slower
than other state-of-the-art CDCL solvers.

%package libs
Summary:        Simplified SAT solver library

%description libs
This package contains the CaDiCaL simplified Satisfiability solver as a
library, for use in applications that need a SAT solver.

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

%description devel
Library links and header files for developing applications that use
%{name}.

%prep
%autosetup -p0 -n %{name}-rel-%{version}

# We have commas in optflags, so commas can't be used as sed delimiters in
# the configure script.  Also, do not override our build flags.
sed -i '/^-e/s/,/|/g;s/-O3/-O2/' configure

%build
# The configure script is NOT generated by autoconf.  Do NOT use the
# %%configure macro here.
CXXFLAGS="%{optflags} -fPIC" ./configure
%make_build

# Make man pages for the command line interface
export LD_LIBRARY_PATH=$PWD/build
help2man --version-string=%{version} -N -o cadical.1 build/cadical
help2man --version-string=%{version} -N -o mobical.1 -h -h build/mobical

%install
# The makefile has no install target.  Install by hand.
# Install the binaries
mkdir -p %{buildroot}%{_bindir}
cp -p build/{cad,mob}ical %{buildroot}%{_bindir}

# Install the library
mkdir -p %{buildroot}%{_libdir}
cp -p build/libcadical.so.0.0.0 %{buildroot}%{_libdir}
ln -s libcadical.so.0.0.0 %{buildroot}%{_libdir}/libcadical.so.0
ln -s libcadical.so.0 %{buildroot}%{_libdir}/libcadical.so

# Install the header files
mkdir -p %{buildroot}%{_includedir}
cp -p src/cadical.hpp %{buildroot}%{_includedir}

# Install the man pages
mkdir -p %{buildroot}%{_mandir}/man1
cp -p *.1 %{buildroot}%{_mandir}/man1

%check
# Prevent rebuilding the library while testing
sed -i '/make -C \$CADICALBUILD/d;/^make$/d' test/*/run.sh

# Some mobical tests randomly fail due to exceeding time or memory limits.
# Turn those tests off.
sed -i 's/ mbt$//' test/makefile

export LD_LIBRARY_PATH=$PWD/build
make -C test

%files
%{_bindir}/cadical
%{_bindir}/mobical
%{_mandir}/man1/cadical.1*
%{_mandir}/man1/mobical.1*

%files libs
%license LICENSE
%doc CONTRIBUTING README.md
%{_libdir}/lib%{name}.so.0*

%files devel
%{_includedir}/%{name}.hpp
%{_libdir}/lib%{name}.so

%changelog
* Sat Jun 29 2019 Jerry James <loganjerry@gmail.com> - 1.0.0-1
- New upstream version

* Wed Jun 12 2019 Jerry James <loganjerry@gmail.com> - 0-1.sr19
- New upstream version
- Adapt to upstream version scheme
- Drop upstreamed -vector patch
- Add -32bit patch
- Add man pages

* Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org> - 06w-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

* Thu Jul 12 2018 Fedora Release Engineering <releng@fedoraproject.org> - 06w-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

* Fri Jul  6 2018 Jerry James <loganjerry@gmail.com> - 06w-1
- Initial RPM