%global libsolv_version 0.7.21 %global libmodulemd_version 2.13.0 %global librepo_version 1.15.0 %global dnf_conflict 4.11.0 %global swig_version 3.0.12 %global libdnf_major_version 0 %global libdnf_minor_version 73 %global libdnf_micro_version 4 # Keep valgrind tests switched off for now %bcond_with valgrind %if 0%{?rhel} && ! 0%{?centos} %bcond_without rhsm %elif 0%{?mageia} %bcond_with rhsm %else %bcond_with rhsm %endif %if 0%{?rhel} %bcond_with zchunk %elif 0%{?mageia} %bcond_without zchunk %else %bcond_without zchunk %endif %bcond_with sanitizers %global _cmake_opts \\\ -DENABLE_RHSM_SUPPORT=%{?with_rhsm:ON}%{!?with_rhsm:OFF} \\\ %{nil} # The naming scheme in non-Mandriva-based distros %if 0%{!?mklibname:1} %define mklibname(ds) lib%{1}%{?2:%{2}}%{-s:-static}%{-d:-devel} %endif %if 0%{!?mkrel:1} %define mkrel(c) %{1}%{?dist} %endif %define somajor 2 %define libname %mklibname dnf %{somajor} %define devname %mklibname dnf -d Name: libdnf Version: %{libdnf_major_version}.%{libdnf_minor_version}.%{libdnf_micro_version} Release: %mkrel 1 Summary: Library providing simplified C and Python API to libsolv Group: System/Packaging License: LGPL-2.1-or-later URL: https://github.com/rpm-software-management/libdnf Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz BuildRequires: cmake BuildRequires: gcc BuildRequires: gcc-c++ BuildRequires: libsolv-devel >= %{libsolv_version} BuildRequires: pkgconfig(librepo) >= %{librepo_version} BuildRequires: pkgconfig(check) %if %{with valgrind} BuildRequires: valgrind %endif BuildRequires: pkgconfig(gio-unix-2.0) >= 2.46.0 BuildRequires: pkgconfig(gtk-doc) BuildRequires: rpm-devel >= 4.15.0 %if %{with rhsm} BuildRequires: pkgconfig(librhsm) >= 0.0.3 %endif %if %{with zchunk} BuildRequires: pkgconfig(zck) >= 0.9.11 %endif BuildRequires: pkgconfig(sqlite3) BuildRequires: pkgconfig(json-c) BuildRequires: pkgconfig(cppunit) BuildRequires: pkgconfig(modulemd-2.0) >= %{libmodulemd_version} BuildRequires: pkgconfig(smartcols) BuildRequires: gettext %if %{with sanitizers} BuildRequires: libasan BuildRequires: liblsan BuildRequires: libubsan %endif %description A Library providing simplified C and Python API to libsolv. %package -n %{libname} Summary: Package library providing simplified interface to libsolv Group: System/Libraries Provides: %{name} = %{version}-%{release} Provides: %{name}%{?_isa} = %{version}-%{release} Provides: %{name}%{somajor} = %{version}-%{release} Provides: %{name}%{somajor}%{?_isa} = %{version}-%{release} Requires: %{name}-i18n = %{version}-%{release} %description -n %{libname} A Library providing simplified C and Python API to libsolv. %package -n %{devname} Summary: Development files for %{name} Group: Development/C Provides: %{name}-devel%{?_isa} = %{version}-%{release} Provides: %{name}-devel = %{version}-%{release} Requires: %{name}%{?_isa} = %{version}-%{release} %description -n %{devname} Development files for %{name}. %package i18n Summary: Translations for the libdnf library Group: System/Internationalization Obsoletes: %{name}-lang < 072.0 BuildArch: noarch %description i18n Translation data for the libdnf library. %package -n python3-%{name} Summary: Python 3 bindings for the libdnf library Group: Development/Python %{?python_provide:%python_provide python3-%{name}} Requires: %{name}%{?_isa} = %{version}-%{release} BuildRequires: python3-devel BuildRequires: python3-sphinx BuildRequires: swig >= %{swig_version} %description -n python3-%{name} Python 3 bindings for the libdnf library. %package -n python3-hawkey Summary: Python 3 bindings for the hawkey library Group: Development/Python %{?python_provide:%python_provide python3-hawkey} BuildRequires: python3-devel Requires: %{name}%{?_isa} = %{version}-%{release} Requires: python3-%{name} = %{version}-%{release} Obsoletes: hawkey-man < %{version}-%{release} # Fix problem with hawkey - dnf version incompatibility # Can be deleted for distros where only python3-dnf >= 2.0.0 Conflicts: python3-dnf < %{dnf_conflict} %description -n python3-hawkey Python 3 bindings for the hawkey library. %prep %autosetup -p1 %build %cmake -DPYTHON_DESIRED:FILEPATH=%{__python3} -DWITH_GIR=0 -DWITH_MAN=0 -Dgtkdoc=0 %{!?with_zchunk:-DWITH_ZCHUNK=OFF} %{!?with_valgrind:-DDISABLE_VALGRIND=1} %{_cmake_opts} -DLIBDNF_MAJOR_VERSION=%{libdnf_major_version} -DLIBDNF_MINOR_VERSION=%{libdnf_minor_version} -DLIBDNF_MICRO_VERSION=%{libdnf_micro_version} \ -DWITH_SANITIZERS=%{?with_sanitizers:ON}%{!?with_sanitizers:OFF} %cmake_build %check %ctest %install %cmake_install %find_lang %{name} %files -n %{libname} %license COPYING %doc README.md AUTHORS %{_libdir}/%{name}.so.%{somajor} # Plugins are compiled against the library itself %dir %{_libdir}/libdnf %dir %{_libdir}/libdnf/plugins %{_libdir}/libdnf/plugins/README %if %{with sanitizers} %{_sysconfdir}/profile.d/dnf-sanitizers.sh %endif %files -n %{devname} %doc %{_datadir}/gtk-doc/html/%{name}/ %{_libdir}/%{name}.so %{_libdir}/pkgconfig/%{name}.pc %{_includedir}/%{name}/ %files i18n -f %{name}.lang %license COPYING %files -n python3-%{name} %{python3_sitearch}/%{name}-*.dist-info %{python3_sitearch}/%{name}/ %files -n python3-hawkey %{python3_sitearch}/hawkey/