Build python3 bindings just for fedora

It simplify backporting to epel/rhel
This commit is contained in:
Lukas Slebodnik 2016-12-03 18:19:27 +01:00
parent 7c2b5b274a
commit 4b0bf94082

View File

@ -1,3 +1,9 @@
%if 0%{?fedora}
%global with_python3 1
%else
%global with_python3 0
%endif
Name: libtalloc
Version: 2.1.8
Release: 3%{?dist}
@ -12,7 +18,9 @@ BuildRequires: autoconf
BuildRequires: libxslt
BuildRequires: docbook-style-xsl
BuildRequires: python2-devel
%if 0%{?with_python3}
BuildRequires: python3-devel
%endif
BuildRequires: doxygen
Provides: bundled(libreplace)
@ -52,6 +60,7 @@ Obsoletes: pytalloc-devel < 2.1.3
%description -n python-talloc-devel
Development libraries for python-talloc
%if 0%{?with_python3}
%package -n python3-talloc
Group: Development/Libraries
Summary: Python bindings for the Talloc library
@ -67,17 +76,25 @@ Requires: python3-talloc = %{version}-%{release}
%description -n python3-talloc-devel
Development libraries for python3-talloc
%endif
%prep
%setup -q -n talloc-%{version}
%build
%if 0%{?with_python3}
PY3_CONFIG_FLAGS=--extra-python=%{__python3}
%else
PY3_CONFIG_FLAGS=""
%endif
%configure --disable-rpath \
--disable-rpath-install \
--bundled-libraries=NONE \
--builtin-libraries=replace \
--disable-silent-rules \
--extra-python=%{__python3}
$PY3_CONFIG_FLAGS
make %{?_smp_mflags} V=1
doxygen doxy.config
@ -123,6 +140,7 @@ rm -rf $RPM_BUILD_ROOT
%{_libdir}/pkgconfig/pytalloc-util.pc
%{_libdir}/libpytalloc-util.so
%if 0%{?with_python3}
%files -n python3-talloc
%defattr(-,root,root,-)
%{_libdir}/libpytalloc-util.cpython*.so.*
@ -133,6 +151,7 @@ rm -rf $RPM_BUILD_ROOT
%{_includedir}/pytalloc.h
%{_libdir}/pkgconfig/pytalloc-util.pc
%{_libdir}/libpytalloc-util.cpython*.so
%endif
%post -p /sbin/ldconfig
@ -141,8 +160,10 @@ rm -rf $RPM_BUILD_ROOT
%post -n python-talloc -p /sbin/ldconfig
%postun -n python-talloc -p /sbin/ldconfig
%if 0%{?with_python3}
%post -n python3-talloc -p /sbin/ldconfig
%postun -n python3-talloc -p /sbin/ldconfig
%endif
%changelog
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.1.8-3