File talloc.spec of Package talloc

#
# spec file for package talloc
#
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


%{!?python_sitearch:  %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}

Name:           talloc
%if 0%{?suse_version} == 0 || 0%{?suse_version} > 1140
%define	build_make_smp_mflags %{?_smp_mflags}
%else
%define	build_make_smp_mflags %{?jobs:-j%jobs}
%endif
BuildRequires:  autoconf
BuildRequires:  docbook-xsl-stylesheets
BuildRequires:  libxslt
%if 0%{?suse_version} > 1020
BuildRequires:  pkg-config
%else
BuildRequires:  pkgconfig
%endif
BuildRequires:  python-devel
%if 0%{?suse_version} > 1100
#!BuildIgnore:  python
%endif
Url:            http://talloc.samba.org/
Version:        2.1.1
Release:        2.5
PreReq:         /sbin/ldconfig
Summary:        Samba talloc Library
License:        LGPL-3.0+
Group:          System/Libraries
# Unfortunately upstream is mindboggingly stupid here by gpg signing the
# uncompressed tarball, but not publishing the uncompressed tarball but
# only a compressed one. so we need to unpack it manually so that
# gpg verification works, but then we can't have download verification

# http://download.samba.org/pub/talloc/talloc-%{version}.tar
Source:         talloc-%{version}.tar
Source1:        http://download.samba.org/pub/talloc/talloc-%{version}.tar.asc
Source4:        baselibs.conf
Source50:       %name.keyring
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Talloc is a hierarchical, reference counted memory pool system with
destructors.

It is the core memory allocator used in Samba.


%define libtalloc_name libtalloc2
%package -n %{libtalloc_name}
Summary:        Libraries and Header Files to Develop Programs with talloc2 Support
Group:          System/Libraries
Provides:       bundled(libreplace)

%description -n %{libtalloc_name}
Talloc is a hierarchical, reference counted memory pool system with
destructors.

It is the core memory allocator used in Samba.

This package includes the talloc2 library.


%package -n libtalloc-devel
Summary:        Libraries and Header Files to Develop Programs with talloc2 Support
Group:          Development/Libraries/C and C++
Requires:       %{libtalloc_name} = %{version}
%if 0%{?suse_version} > 1020
Requires:       pkg-config
%else
Requires:       pkgconfig
%endif

%description -n libtalloc-devel
Talloc is a hierarchical, reference counted memory pool system with
destructors.

It is the core memory allocator used in Samba.

Libraries and Header Files to Develop Programs with talloc2 Support


%package -n pytalloc
Summary:        Python bindings for the Talloc library
Group:          Development/Libraries/Python
Requires:       %{libtalloc_name} = %{version}
PreReq:         /sbin/ldconfig

%description -n pytalloc
This package contains the python bindings for the Talloc library.


%package -n pytalloc-devel
Summary:        Developer tools for the Talloc library
Group:          Development/Libraries/Python
Requires:       pytalloc = %{version}
%if 0%{?suse_version} > 1020
Requires:       pkg-config
%else
Requires:       pkgconfig
%endif

%description -n pytalloc-devel
Libraries and Header Files to Develop Programs with pytalloc Support


%prep
%setup -n talloc-%{version} -q

%build
%if 0%{?suse_version} && 0%{?suse_version} < 911
	OPTIMIZATION="-O"
%else
	# use the default optimization
	unset OPTIMIZATION
%endif
export CFLAGS="${RPM_OPT_FLAGS} -D_GNU_SOURCE ${OPTIMIZATION} -D_LARGEFILE64_SOURCE -DIDMAP_RID_SUPPORT_TRUSTED_DOMAINS"
CONFIGURE_OPTIONS="\
	--prefix=%{_prefix} \
	--libdir=%{_libdir} \
	--disable-rpath \
	--bundled-libraries=NONE \
	--builtin-libraries=replace \
"
./configure ${CONFIGURE_OPTIONS}
%{__make} %{build_make_smp_mflags} \
	all

%check
# make test doesn't work with --disable-rpath
#%{__make} test

%install
DESTDIR=${RPM_BUILD_ROOT} make install

%post -n %{libtalloc_name} -p /sbin/ldconfig

%postun -n %{libtalloc_name} -p /sbin/ldconfig

%post -n pytalloc -p /sbin/ldconfig

%postun -n pytalloc -p /sbin/ldconfig

%files -n %{libtalloc_name}
%defattr(-,root,root)
%{_libdir}/libtalloc.so.*

%files -n libtalloc-devel
%defattr(-,root,root)
%{_includedir}/talloc.h
%{_libdir}/libtalloc.so
%{_libdir}/pkgconfig/talloc.pc
%if 0%{?suse_version} == 0 || 0%{?suse_version} > 1100
%{_mandir}/man3/talloc.3*
%endif

%files -n pytalloc
%defattr(-,root,root)
%{_libdir}/libpytalloc-util.so.*
%{python_sitearch}/talloc.so

%files -n pytalloc-devel
%defattr(-,root,root,-)
%{_includedir}/pytalloc.h
%{_libdir}/pkgconfig/pytalloc-util.pc
%{_libdir}/libpytalloc-util.so

%changelog
* Fri May 23 2014 lmuelle@suse.com
- Require pkg-config from the devel packages.
* Thu May 22 2014 lmuelle@suse.com
- Update to 2.1.1.
  + documentation updates
  + a fix for pytalloc-util.pc
  + performance improvements here and there
  + fixed compiler warnings
* Tue May 20 2014 dmueller@suse.com
- Remove dependency on doxygen. Doxygen is only used for generating
  the html documentation, but the html documentation was not
  actually packaged, so there is no point in running it.
* Wed Apr 23 2014 dmueller@suse.com
- Remove dependency on gpg-offline to reduce rebuild times; signature checking
  is implemented already in the source validator.
* Fri Dec  6 2013 lmuelle@suse.com
- Update to 2.1.0.
  + Add talloc_pooled_object and test it
  + Allow nested pools
  + Add a separate pool size
  + Put pool-specific data before the chunk
  + Introduce __talloc_with_prefix
  + Decouple the dual use of chunk->pool
  + Only provide the --enable-talloc-compat1 in standalone build
  + Simplify _talloc_free_poolmem a bit
* Fri Dec  6 2013 lmuelle@suse.com
- Verify source tar ball gpg signature.
* Thu Aug 29 2013 lmuelle@suse.com
- PreReq /sbin/ldconfig from pytalloc.
* Wed Aug 28 2013 lmuelle@suse.com
- Add pytalloc to baselibs.conf.
* Mon Jul 22 2013 lmuelle@suse.com
- BuildIgnore python for post-11.0 systems only.
- Package the talloc man page only on post-11.0 systems.
* Sun Jul  7 2013 coolo@suse.com
- BuildIgnore python to avoid build cycle
* Sun Dec  2 2012 lmuelle@suse.com
- Update to 2.0.8.
  + Convert error cecking macros into fns
  + don't allow a talloc_pool inside a talloc_pool.
  + use a struct for pool headers.
  + remove unused variables
  + Update doxygen config.
  + Slightly simplify talloc_unlink
  + Only check for pkg-config file when checking for system talloc.
  + fix a comment typo
  + simplifiy the logic to build talloc_testsuite in the standalone build
* Thu Jun 28 2012 lmuelle@suse.com
- Disable rpath while configure.
* Tue Jun 12 2012 lmuelle@suse.com
- Add missing group field to the library subpackage.
* Sun Jun  3 2012 lmuelle@suse.com
- Define library name and use it instead of libtalloc2.
* Sat Jun  2 2012 lmuelle@suse.com
- Rename package to talloc and add an independent libtalloc2 subpackage.
- Enhance and polish the package descriptions and summaries.
* Thu May 31 2012 lmuelle@suse.com
- BuildRequire pkg-config for post-10.2 systems and else pkgconfig.
* Thu May 31 2012 lmuelle@suse.com
- Rename libtalloc2-devel to libtalloc-devel.
* Wed May 30 2012 lmuelle@suse.com
- Define python_sitearch if undefined.
* Wed May 30 2012 lmuelle@suse.com
- Remove superfluous AutoReqProv on line.
* Wed May 16 2012 lmuelle@suse.com
- Require libtalloc2 from libtalloc2-devel.
* Wed May 16 2012 lmuelle@suse.com
- Cleanup BuildRequires and spec file in general.
- Add new pytalloc and pytalloc-devel sub packages.
* Wed Sep  7 2011 lars@samba.org
- Initial independent libtalloc2 package.