## START: Set by rpmautospec
## (rpmautospec version 0.7.3)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 1;
    base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
    print(release_number + base_release_number - 1);
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
## END: Set by rpmautospec

Name:       clingo
Version:    5.7.1
Release:    %autorelease
Summary:    A grounder and solver for logic programs

License:    MIT
URL:        https://potassco.org/clingo/
Source0:    https://github.com/potassco/clingo/archive/v%{version}/%{name}-%{version}.tar.gz
# Disable gcc warning no-class-memaccess, which is intended use in this case
Patch0:     clingo.clasp-disable-class-memaccess-warning.patch

BuildRequires: bison
BuildRequires: cmake
BuildRequires: gcc-c++
BuildRequires: python3-setuptools
BuildRequires: re2c

%description
Clingo is part of the Potassco project for Answer Set Programming
(ASP). ASP offers a simple and powerful modeling language to describe
combinatorial problems as logic programs. The clingo system then takes
such a logic program and computes answer sets representing solutions
to the given problem.


%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 lua-%{name}
Summary:        Lua bindings for Clingo
Requires:       %{name}%{?_isa} = %{version}-%{release}
BuildRequires:  lua-devel

%description -n lua-%{name}
Lua bindings for Clingo, a grounder and solver for logic programs.

Detailed information (including a User's manual), source code, and pre-compiled
binaries are available at: http://potassco.org/

%package -n python3-%{name}
Summary:        Python 3 bindings for Clingo
Requires:       %{name}%{?_isa} = %{version}-%{release}
BuildRequires:  python3, python3-devel
BuildRequires:  python3-cffi
BuildRequires:  make
%{?python_provide:%python_provide python3-%{name}}

%description -n python3-%{name}
This module provides functions and classes to work with ground terms and to
control the instantiation process. In clingo builts, additional functions to
control and inspect the solving process are available.

Functions defined in a python script block are callable during the
instantiation process using @-syntax. The default grounding/solving process can
be customized if a main function is provided.

Detailed information (including a User's manual), source code, and pre-compiled
binaries are available at: http://potassco.org/


%prep
%autosetup -p1


%build
%cmake \
  -H. \
  -Brelease \
  -DCLINGO_MANAGE_RPATH:BOOL=OFF \
  -DBUILD_SHARED_LIBS:BOOL=OFF \
  -DCLINGO_BUILD_APPS:BOOL=ON \
  -DPython_EXECUTABLE=%{__python3} \
  -DCLINGO_BUILD_SHARED:BOOL=ON \
  -DCLINGO_BUILD_WITH_PYTHON:BOOL=ON \
  -DLUACLINGO_INSTALL_DIR:PATH=%{lua_libdir}

cmake --build release -- %{?_smp_mflags}


%install
%make_install -C release

%files
%doc README.md INSTALL.md
%license LICENSE.md
%{_libdir}/libclingo.so.4*
%{_bindir}/*

%files devel
%{_includedir}/*
%{_libdir}/*.so
%{_libdir}/cmake/Clingo

%files -n lua-%{name}
%{lua_libdir}/%{name}.so

%files -n python3-%{name}
%{python3_sitearch}/%{name}*

%changelog
## START: Generated by rpmautospec
* Sun Aug 11 2024 Till Hofmann <thofmann@fedoraproject.org> - 5.7.1-1
- Update to 5.7.1

* Wed Jul 17 2024 Fedora Release Engineering <releng@fedoraproject.org> - 5.6.2-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild

* Fri Jun 07 2024 Python Maint <python-maint@redhat.com> - 5.6.2-10
- Rebuilt for Python 3.13

* Fri Jun 07 2024 Python Maint <python-maint@redhat.com> - 5.6.2-9
- Rebuilt for Python 3.13

* Wed Jan 24 2024 Fedora Release Engineering <releng@fedoraproject.org> - 5.6.2-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Fri Jan 19 2024 Fedora Release Engineering <releng@fedoraproject.org> - 5.6.2-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Wed Jul 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 5.6.2-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild

* Wed Jun 14 2023 Python Maint <python-maint@redhat.com> - 5.6.2-5
- Rebuilt for Python 3.12

* Sat May 13 2023 Till Hofmann <thofmann@fedoraproject.org> - 5.6.2-4
- BR python3-setuptools for python3.12

* Sun Mar 12 2023 Till Hofmann <thofmann@fedoraproject.org> - 5.6.2-3
- Switch to SPDX MIT license

* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 5.6.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild

* Sat Nov 12 2022 Till Hofmann <thofmann@fedoraproject.org> - 5.6.2-1
- Update to 5.6.2

* Sun Sep 18 2022 Till Hofmann <thofmann@fedoraproject.org> - 5.6.1-1
- Update to 5.6.1

* Wed Jul 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 5.5.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild

* Mon Jun 13 2022 Python Maint <python-maint@redhat.com> - 5.5.2-2
- Rebuilt for Python 3.11

* Sun May 08 2022 Till Hofmann <thofmann@fedoraproject.org> - 5.5.2-1
- Update to 5.5.2

* Tue Apr 12 2022 Till Hofmann <thofmann@fedoraproject.org> - 5.5.1-1
- Update to 5.5.1

* Wed Jan 19 2022 Fedora Release Engineering <releng@fedoraproject.org> - 5.5.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild

* Tue Nov 09 2021 Michael Kuhn <suraia@fedoraproject.org> - 5.5.0-1
- Update to 5.5.0
- Clingo does not ship shared libraries for Lua and Python anymore

* Wed Jul 21 2021 Fedora Release Engineering <releng@fedoraproject.org> - 5.4.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild

* Fri Jun 04 2021 Python Maint <python-maint@redhat.com> - 5.4.1-2
- Rebuilt for Python 3.10

* Sun Mar 07 2021 Till Hofmann <thofmann@fedoraproject.org> - 5.4.1-1
- Update to 5.4.1

* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 5.4.0-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild

* Mon Jul 27 2020 Fedora Release Engineering <releng@fedoraproject.org> - 5.4.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild

* Tue May 26 2020 Miro Hrončok <mhroncok@redhat.com> - 5.4.0-3
- Rebuilt for Python 3.9

* Tue Jan 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 5.4.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild

* Fri Sep 06 2019 Till Hofmann <thofmann@fedoraproject.org> - 5.4.0-1
- Update to 5.4.0
- Add patch to fix compatibility with Python 3.8
- Remove upstreamed patch
- Rebase patches to allow usage of %%autosetup

* Mon Aug 19 2019 Miro Hrončok <mhroncok@redhat.com> - 5.3.0-6
- Rebuilt for Python 3.8

* Fri Jul 26 2019 Till Hofmann <thofmann@fedoraproject.org> - 5.3.0-5
- Do not glob library sonames to avoid unintentional soname bumps

* Thu Jul 25 2019 Till Hofmann <thofmann@fedoraproject.org> - 5.3.0-4
- Do not build python2 bindings

* Tue Nov 13 2018 Tim Niemueller <tim@niemueller.de> - 5.3.0-3
- build python2 and python3 bindings

* Tue Nov 13 2018 Tim Niemueller <tim@niemueller.de> - 5.3.0-2
- update clasp patch

* Mon Nov 12 2018 Tim Niemueller <tim@niemueller.de> - 5.3.0-1
- Initial package

## END: Generated by rpmautospec