Igor Gnatenko 06911e8
%global libname solv
Igor Gnatenko 06911e8
6fff0c1
%bcond_without python_bindings
Igor Gnatenko 06911e8
%bcond_without perl_bindings
Igor Gnatenko 06911e8
%bcond_without ruby_bindings
Igor Gnatenko 93e79d1
# Creates special prefixed pseudo-packages from appdata metadata
1f372d1
%bcond_without appdata
Igor Gnatenko 93e79d1
# Creates special prefixed "group:", "category:" pseudo-packages
Igor Gnatenko 93e79d1
%bcond_without comps
4ba5788
%bcond_without conda
Igor Gnatenko 93e79d1
# For rich dependencies
Igor Gnatenko 93e79d1
%bcond_without complex_deps
c68db57
%bcond_without helix_repo
c68db57
%bcond_without suse_repo
Igor Gnatenko 44efe14
%bcond_without debian_repo
Igor Gnatenko 44efe14
%bcond_without arch_repo
Igor Gnatenko 44efe14
# For handling deb + rpm at the same time
Denis Ollier 5d51fc8
%bcond_without multi_semantics
57fddd3
%if %{defined rhel}
57fddd3
%bcond_with zchunk
57fddd3
%else
a51205b
%bcond_without zchunk
57fddd3
%endif
7d109bb
%bcond_without zstd
Igor Gnatenko 06911e8
6fff0c1
%define __cmake_switch(b:) %[%{expand:%%{?with_%{-b*}}} ? "ON" : "OFF"]
6fff0c1
Igor Gnatenko 06911e8
Name:           lib%{libname}
2c6b9a1
Version:        0.7.28
6b483d9
Release:        %autorelease
Igor Gnatenko 06911e8
Summary:        Package dependency solver
Igor Gnatenko 06911e8
7753ff6
License:        BSD-3-Clause
Igor Gnatenko 06911e8
URL:            https://github.com/openSUSE/libsolv
394695c
Source:         %{url}/archive/%{version}/%{name}-%{version}.tar.gz
a8624a9
Igor Gnatenko 06911e8
BuildRequires:  cmake
Igor Gnatenko 06911e8
BuildRequires:  gcc-c++
88c7552
BuildRequires:  ninja-build
Igor Gnatenko 06911e8
BuildRequires:  pkgconfig(rpm)
Igor Gnatenko 06911e8
BuildRequires:  zlib-devel
394695c
# -DWITH_LIBXML2=ON
394695c
BuildRequires:  libxml2-devel
Igor Gnatenko 06911e8
# -DENABLE_LZMA_COMPRESSION=ON
Igor Gnatenko 06911e8
BuildRequires:  xz-devel
Igor Gnatenko 06911e8
# -DENABLE_BZIP2_COMPRESSION=ON
Igor Gnatenko 06911e8
BuildRequires:  bzip2-devel
7d109bb
%if %{with zstd}
652640a
# -DENABLE_ZSTD_COMPRESSION=ON
652640a
BuildRequires:  libzstd-devel
7d109bb
%endif
a51205b
%if %{with zchunk}
a51205b
# -DENABLE_ZCHUNK_COMPRESSION=ON
a51205b
BuildRequires:  pkgconfig(zck)
a51205b
%endif
Igor Gnatenko 06911e8
Karel Klic 732335e
%description
Karel Klic 732335e
A free package dependency solver using a satisfiability algorithm. The
Karel Klic 732335e
library is based on two major, but independent, blocks:
Karel Klic 732335e
Karel Klic 732335e
- Using a dictionary approach to store and retrieve package
Karel Klic 732335e
  and dependency information.
Karel Klic 732335e
Karel Klic 732335e
- Using satisfiability, a well known and researched topic, for
Karel Klic 732335e
  resolving package dependencies.
Karel Klic 732335e
Karel Klic 732335e
%package devel
Igor Gnatenko 06911e8
Summary:        Development files for %{name}
Igor Gnatenko 06911e8
Requires:       %{name}%{?_isa} = %{version}-%{release}
Igor Gnatenko 06911e8
Requires:       rpm-devel%{?_isa}
Karel Klic 732335e
Karel Klic 732335e
%description devel
Igor Gnatenko 06911e8
Development files for %{name}.
Karel Klic 732335e
Karel Klic 732335e
%package tools
Igor Gnatenko 06911e8
Summary:        Package dependency solver tools
Igor Gnatenko 06911e8
Requires:       %{name}%{?_isa} = %{version}-%{release}
a51205b
# repo2solv dependencies. Used as execl()
6b483d9
Requires:       /usr/bin/find
Karel Klic 732335e
Karel Klic 732335e
%description tools
Karel Klic 732335e
Package dependency solver tools.
Karel Klic 732335e
Karel Klic 732335e
%package demo
Igor Gnatenko 06911e8
Summary:        Applications demoing the %{name} library
Igor Gnatenko 06911e8
Requires:       %{name}%{?_isa} = %{version}-%{release}
Igor Gnatenko 06911e8
# solv dependencies. Used as execlp() and system()
6b483d9
Requires:       /usr/bin/curl
6b483d9
Requires:       /usr/bin/gpg2
Karel Klic 732335e
Karel Klic 732335e
%description demo
Igor Gnatenko 06911e8
Applications demoing the %{name} library.
Karel Klic 732335e
Igor Gnatenko 06911e8
%if %{with perl_bindings}
Igor Gnatenko 06911e8
%package -n perl-%{libname}
Igor Gnatenko 06911e8
Summary:        Perl bindings for the %{name} library
Igor Gnatenko 06911e8
BuildRequires:  swig
Igor Gnatenko 06911e8
BuildRequires:  perl-devel
1f12cdd
BuildRequires:  perl-generators
Igor Gnatenko 06911e8
Requires:       %{name}%{?_isa} = %{version}-%{release}
Karel Klic 732335e
Igor Gnatenko 06911e8
%description -n perl-%{libname}
Igor Gnatenko 06911e8
Perl bindings for the %{name} library.
Colin Walters e1ce97e
%endif
Karel Klic 732335e
Igor Gnatenko 06911e8
%if %{with ruby_bindings}
Igor Gnatenko 06911e8
%package -n ruby-%{libname}
Igor Gnatenko 06911e8
Summary:        Ruby bindings for the %{name} library
Igor Gnatenko 06911e8
BuildRequires:  swig
Igor Gnatenko 06911e8
BuildRequires:  ruby-devel
Igor Gnatenko 06911e8
Requires:       %{name}%{?_isa} = %{version}-%{release}
Karel Klic 732335e
Igor Gnatenko 06911e8
%description -n ruby-%{libname}
Igor Gnatenko 06911e8
Ruby bindings for the %{name} library.
Colin Walters e1ce97e
%endif
Karel Klic 732335e
6fff0c1
%if %{with python_bindings}
Igor Gnatenko 06911e8
%package -n python3-%{libname}
Igor Gnatenko 06911e8
Summary:        Python bindings for the %{name} library
94e3540
%{?python_provide:%python_provide python3-%{libname}}
Igor Gnatenko 06911e8
BuildRequires:  swig
Igor Gnatenko 06911e8
BuildRequires:  python3-devel
Igor Gnatenko 06911e8
Requires:       %{name}%{?_isa} = %{version}-%{release}
Igor Gnatenko 06911e8
Igor Gnatenko 06911e8
%description -n python3-%{libname}
Igor Gnatenko 06911e8
Python bindings for the %{name} library.
Karel Klic 732335e
Igor Gnatenko 06911e8
Python 3 version.
Igor Gnatenko 06911e8
%endif
Karel Klic 732335e
Karel Klic 732335e
%prep
7f08702
%autosetup -p1
Ales Kozumplik b532c3f
Karel Klic 732335e
%build
6fff0c1
%cmake -GNinja                                            \
6fff0c1
  -DFEDORA=1                                              \
6fff0c1
  -DENABLE_RPMDB=ON                                       \
6fff0c1
  -DENABLE_RPMDB_BYRPMHEADER=ON                           \
6fff0c1
  -DENABLE_RPMDB_LIBRPM=ON                                \
6fff0c1
  -DENABLE_RPMPKG_LIBRPM=ON                               \
6fff0c1
  -DENABLE_RPMMD=ON                                       \
6fff0c1
  -DENABLE_COMPS=%{__cmake_switch -b comps}               \
6fff0c1
  -DENABLE_APPDATA=%{__cmake_switch -b appdata}           \
6fff0c1
  -DUSE_VENDORDIRS=ON                                     \
6fff0c1
  -DWITH_LIBXML2=ON                                       \
6fff0c1
  -DENABLE_LZMA_COMPRESSION=ON                            \
6fff0c1
  -DENABLE_BZIP2_COMPRESSION=ON                           \
6fff0c1
  -DENABLE_ZSTD_COMPRESSION=%{__cmake_switch -b zstd}     \
6fff0c1
  -DENABLE_ZCHUNK_COMPRESSION=%{__cmake_switch -b zchunk} \
a51205b
%if %{with zchunk}
6fff0c1
  -DWITH_SYSTEM_ZCHUNK=ON                                 \
fa07070
%endif
6fff0c1
  -DENABLE_HELIXREPO=%{__cmake_switch -b helix_repo}      \
6fff0c1
  -DENABLE_SUSEREPO=%{__cmake_switch -b suse_repo}        \
6fff0c1
  -DENABLE_DEBIAN=%{__cmake_switch -b debian_repo}        \
6fff0c1
  -DENABLE_ARCHREPO=%{__cmake_switch -b arch_repo}        \
6fff0c1
  -DMULTI_SEMANTICS=%{__cmake_switch -b multi_semantics}  \
6fff0c1
  -DENABLE_COMPLEX_DEPS=%{__cmake_switch -b complex_deps} \
4ba5788
  -DENABLE_CONDA=%{__cmake_switch -b conda}               \
6fff0c1
  -DENABLE_PERL=%{__cmake_switch -b perl_bindings}        \
6fff0c1
  -DENABLE_RUBY=%{__cmake_switch -b ruby_bindings}        \
6fff0c1
  -DENABLE_PYTHON=%{__cmake_switch -b python_bindings}    \
6fff0c1
%if %{with python_bindings}
6fff0c1
  -DPYTHON_EXECUTABLE=%{python3}                          \
fa07070
%endif
c4491bc
  %{nil}
6fff0c1
%cmake_build
Karel Klic 732335e
Karel Klic 732335e
%install
6fff0c1
%cmake_install
Igor Gnatenko 06911e8
e3d3a9e
%check
6fff0c1
%ctest
Karel Klic 732335e
09550df
# Python smoke test (not tested in %%ctest):
09550df
export PYTHONPATH=%{buildroot}%{python3_sitearch}
09550df
export LD_LIBRARY_PATH=%{buildroot}%{_libdir}
6b483d9
%python3 -c 'import solv'
09550df
Karel Klic 732335e
%files
Igor Gnatenko 06911e8
%license LICENSE*
Igor Gnatenko 06911e8
%doc README
Igor Gnatenko 06911e8
%{_libdir}/%{name}.so.*
Igor Gnatenko 06911e8
%{_libdir}/%{name}ext.so.*
Karel Klic 732335e
Karel Klic 732335e
%files devel
Igor Gnatenko 06911e8
%{_libdir}/%{name}.so
Igor Gnatenko 06911e8
%{_libdir}/%{name}ext.so
Igor Gnatenko 06911e8
%{_includedir}/%{libname}/
ac50906
%{_libdir}/pkgconfig/%{name}.pc
f19d643
%{_libdir}/pkgconfig/%{name}ext.pc
Igor Gnatenko 06911e8
# Own directory because we don't want to depend on cmake
Igor Gnatenko 06911e8
%dir %{_datadir}/cmake/Modules/
Igor Gnatenko 06911e8
%{_datadir}/cmake/Modules/FindLibSolv.cmake
Igor Gnatenko 06911e8
%{_mandir}/man3/%{name}*.3*
Karel Klic 732335e
Igor Gnatenko 06911e8
# Some small macro to list tools with mans
Igor Gnatenko 06911e8
%global solv_tool() \
Igor Gnatenko 06911e8
%{_bindir}/%{1}\
Igor Gnatenko 06911e8
%{_mandir}/man1/%{1}.1*
Karel Klic 732335e
Igor Gnatenko 06911e8
%files tools
Igor Gnatenko 06911e8
%solv_tool deltainfoxml2solv
Igor Gnatenko 06911e8
%solv_tool dumpsolv
Igor Gnatenko 06911e8
%solv_tool installcheck
Igor Gnatenko 06911e8
%solv_tool mergesolv
Igor Gnatenko 06911e8
%solv_tool repomdxml2solv
Igor Gnatenko 06911e8
%solv_tool rpmdb2solv
Igor Gnatenko 06911e8
%solv_tool rpmmd2solv
Igor Gnatenko 06911e8
%solv_tool rpms2solv
Igor Gnatenko 06911e8
%solv_tool testsolv
Igor Gnatenko 06911e8
%solv_tool updateinfoxml2solv
652640a
%solv_tool repo2solv
Igor Gnatenko 06911e8
%if %{with comps}
Igor Gnatenko 06911e8
  %solv_tool comps2solv
Igor Gnatenko 06911e8
%endif
Igor Gnatenko 06911e8
%if %{with appdata}
Igor Gnatenko 06911e8
  %solv_tool appdata2solv
Igor Gnatenko 06911e8
%endif
Igor Gnatenko 06911e8
%if %{with debian_repo}
Igor Gnatenko 06911e8
  %solv_tool deb2solv
Igor Gnatenko 06911e8
%endif
Igor Gnatenko 06911e8
%if %{with arch_repo}
Igor Gnatenko 06911e8
  %solv_tool archpkgs2solv
Igor Gnatenko 06911e8
  %solv_tool archrepo2solv
Igor Gnatenko 06911e8
%endif
Igor Gnatenko 06911e8
%if %{with helix_repo}
Igor Gnatenko 06911e8
  %solv_tool helix2solv
Igor Gnatenko 06911e8
%endif
c68db57
%if %{with suse_repo}
c68db57
  %solv_tool susetags2solv
c68db57
%endif
4ba5788
%if %{with conda}
4ba5788
  %{_bindir}/conda2solv
4ba5788
%endif
c68db57
Igor Gnatenko 06911e8
%files demo
652640a
%solv_tool solv
Karel Klic 732335e
Igor Gnatenko 06911e8
%if %{with perl_bindings}
Igor Gnatenko 06911e8
%files -n perl-%{libname}
Igor Gnatenko 06911e8
%{perl_vendorarch}/%{libname}.pm
Igor Gnatenko 06911e8
%{perl_vendorarch}/%{libname}.so
Colin Walters e1ce97e
%endif
e3d3a9e
Igor Gnatenko 06911e8
%if %{with ruby_bindings}
Igor Gnatenko 06911e8
%files -n ruby-%{libname}
Igor Gnatenko 06911e8
%{ruby_vendorarchdir}/%{libname}.so
Igor Gnatenko 06911e8
%endif
Igor Gnatenko 06911e8
6fff0c1
%if %{with python_bindings}
Igor Gnatenko 06911e8
%files -n python3-%{libname}
Igor Gnatenko 06911e8
%{python3_sitearch}/_%{libname}.so
Igor Gnatenko 06911e8
%{python3_sitearch}/%{libname}.py
Igor Gnatenko 06911e8
%{python3_sitearch}/__pycache__/%{libname}.*
Igor Gnatenko 06911e8
%endif
Karel Klic 732335e
Karel Klic 732335e
%changelog
6b483d9
%autochangelog