Blob Blame Raw
Name:           cadical
Epoch:          1
Version:        1.0.3
Release:        3%{?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

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

%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} = %{epoch}:%{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 %{?_smp_mflags}
%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}
cp -p src/ccadical.h %{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
%{_includedir}/c%{name}.h
%{_libdir}/lib%{name}.so

%changelog
* Wed Jul 24 2019 Jerry James <loganjerry@gmail.com> - 1:1.0.3-3
- Bump Epoch to fix upgrades from version 06w

* Mon Jul 22 2019 Jerry James <loganjerry@gmail.com> - 1.0.3-2
- Add ccadical.h to the -devel subpackage (bz 1731887)

* Sat Jul 13 2019 Jerry James <loganjerry@gmail.com> - 1.0.3-1
- New upstream version
- Drop upstreamed -32bit patch

* Fri Jul 12 2019 Jerry James <loganjerry@gmail.com> - 1.0.2-1
- New upstream version

* 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