-# TODO
-# - static package
-Summary: The talloc library
-Name: libtalloc
-Version: 2.0.1
-Release: 5
+Summary: The talloc library - a hierarchical pool based memory system
+Summary(pl.UTF-8): Biblioteka talloc - system przydzielania pamięci oparty na hierarchicznej puli
+Name: talloc
+Version: 2.3.2
+Release: 1
Epoch: 2
License: LGPL v3+
-Group: Daemons
-URL: http://talloc.samba.org/
-Source0: http://samba.org/ftp/talloc/talloc-%{version}.tar.gz
-# Source0-md5: c6e736540145ca58cb3dcb42f91cf57b
-BuildRequires: autoconf
+Group: Libraries
+Source0: https://download.samba.org/pub/talloc/%{name}-%{version}.tar.gz
+# Source0-md5: 3376a86bdf9dd4abc6b8d8d645390902
+URL: https://talloc.samba.org/
+BuildRequires: docbook-dtd42-xml
BuildRequires: docbook-style-xsl
-BuildRequires: libxslt
+BuildRequires: libbsd-devel
+BuildRequires: libxslt-progs
+BuildRequires: python3 >= 1:3.2
+BuildRequires: python3-devel >= 1:3.2
+BuildRequires: python3-modules >= 1:3.2
+BuildRequires: rpm-pythonprov
+Provides: libtalloc = 2:%{version}-%{release}
+Obsoletes: libtalloc < 2:2.0.7-2
+# talloc 2.2+ dropped python2 support
+Obsoletes: python-talloc < 2:2.2
+Obsoletes: python-talloc-devel < 2:2.2
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%description
-A library that implements a hierarchical allocator with destructors.
+The talloc library implements a hierarchical allocator with
+destructors.
+
+%description -l pl.UTF-8
+Biblioteka talloc jest implementacją systemu zarządzania pamięcią
+opartego na hierarchicznej puli wraz z destruktorami.
%package devel
-Summary: Developer tools for the Talloc library
+Summary: Development files for the talloc library
+Summary(pl.UTF-8): Pliki programistyczne biblioteki talloc
Group: Development/Libraries
-Requires: libtalloc = %{epoch}:%{version}-%{release}
-Provides: pkgconfig(talloc)
+Requires: %{name} = %{epoch}:%{version}-%{release}
+Provides: libtalloc-devel = 2:%{version}-%{release}
+Obsoletes: libtalloc-devel < 2:2.0.7-2
+Obsoletes: libtalloc-static < 2:2.0.5
%description devel
-Header files needed to develop programs that link against the Talloc
-library.
+Development files needed to create programs that link against the
+talloc library.
+
+%description devel -l pl.UTF-8
+Pliki programistyczne potrzebne do tworzenia programów używających
+biblioteki talloc.
+
+%package -n python3-talloc
+Summary: Python 3 binding for talloc library
+Summary(pl.UTF-8): Wiązanie Pythona 3 do biblioteki talloc
+Group: Libraries/Python
+Requires: %{name} = %{epoch}:%{version}-%{release}
+Requires: python3-libs >= 1:3.2
+
+%description -n python3-talloc
+Python 2 binding for talloc library.
+
+%description -n python3-talloc -l pl.UTF-8
+Wiązanie Pythona 3 do biblioteki talloc.
+
+%package -n python3-talloc-devel
+Summary: Development files for Python 3 pytalloc-util library
+Summary(pl.UTF-8): Pliki programistyczne biblioteki pytalloc-util dla Pythona 3
+Group: Development/Libraries
+Requires: %{name}-devel = %{epoch}:%{version}-%{release}
+Requires: python3-devel >= 1:3.2
+Requires: python3-talloc = %{epoch}:%{version}-%{release}
+
+%description -n python3-talloc-devel
+Development files for Python 3 pytalloc-util library.
+
+%description -n python3-talloc-devel -l pl.UTF-8
+Pliki programistyczne biblioteki pytalloc-util dla Pythona 3.
%prep
-%setup -q -n talloc-%{version}
+%setup -q
%build
-./autogen.sh
-%configure
-%{__make}
+# threading breaks waf
+export JOBS=1
+
+CC="%{__cc}" \
+CFLAGS="%{rpmcflags}" \
+%{__python3} buildtools/bin/waf configure \
+ --prefix=%{_prefix} \
+ --libdir=%{_libdir} \
+ --disable-rpath
+
+%{__make} \
+ V=1
%install
rm -rf $RPM_BUILD_ROOT
%{__make} install \
DESTDIR=$RPM_BUILD_ROOT
-ln -s libtalloc.so.%{version} $RPM_BUILD_ROOT%{_libdir}/libtalloc.so
-ln -s libtalloc.so.%{version} $RPM_BUILD_ROOT%{_libdir}/libtalloc.so.2
-
-rm -f $RPM_BUILD_ROOT%{_libdir}/libtalloc.a
-rm -f $RPM_BUILD_ROOT%{_datadir}/swig/*/talloc.i
-
%clean
rm -rf $RPM_BUILD_ROOT
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
-%triggerpostun -p /sbin/postshell -- %{name} < 2:2.0.1-5
+%triggerpostun -p /sbin/postshell -- libtalloc < 2:2.0.1-5
-rm -f %{_libdir}/libtalloc.so.2
/sbin/ldconfig
+%post -n python3-talloc -p /sbin/ldconfig
+%postun -n python3-talloc -p /sbin/ldconfig
+
%files
%defattr(644,root,root,755)
%attr(755,root,root) %{_libdir}/libtalloc.so.*.*.*
%files devel
%defattr(644,root,root,755)
-%{_includedir}/talloc.h
+%doc talloc_guide.txt
%attr(755,root,root) %{_libdir}/libtalloc.so
+%{_includedir}/talloc.h
%{_pkgconfigdir}/talloc.pc
%{_mandir}/man3/talloc.3*
+
+%files -n python3-talloc
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_libdir}/libpytalloc-util.cpython-3*.so.*.*.*
+%attr(755,root,root) %ghost %{_libdir}/libpytalloc-util.cpython-3*.so.2
+%attr(755,root,root) %{py3_sitedir}/talloc.cpython-3*.so
+
+%files -n python3-talloc-devel
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_libdir}/libpytalloc-util.cpython-3*.so
+%{_includedir}/pytalloc.h
+%{_pkgconfigdir}/pytalloc-util.cpython-3*.pc