%bcond_with python2

%define build_compat32 %{?_with_compat32:1}%{!?_with_compat32:0}

Summary: The tdb library
Summary(ja): TDB ライブラリ
Name: libtdb
Version: 1.4.8
Release: 1%{?_dist_release}
Group: system
Vendor: Project Vine
Distribution: Vine Linux

License: LGPLv3+
URL: https://tdb.samba.org/
Source: https://samba.org/ftp/tdb/tdb-%{version}.tar.gz

BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
BuildRequires: autoconf
BuildRequires: libxslt
BuildRequires: docbook-style-xsl
%if %{with python2}
BuildRequires: python-devel python-rpm-macros
%endif
BuildRequires: python3-devel python3-rpm-macros
BuildRequires: libtirpc-devel

%description
A library that implements a trivial database.


%package devel
Summary: Header files need to link the Tdb library
Group: programming
Requires: libtdb = %{version}-%{release}
Requires: pkgconfig

%description devel
Header files needed to develop programs that link against the Tdb library.


%package -n tdb-tools
Summary: Tools to manipulate tdb files
Summary(ja): TDB ファイルを処理するためのツール集
Group: admin-tools
Requires: libtdb = %{version}-%{release}

%description -n tdb-tools
Tools to manage Tdb files


%if %{with python2}
%package -n python-tdb
Summary: Python bindings for the Tdb library
Summary(ja): TDB ライブラリの python バインディング
Group: programming
Requires: libtdb = %{version}-%{release}

%description -n python-tdb
Python bindings for libtdb
%endif


%package -n python3-tdb
Summary: Python3 bindings for the Tdb library
Group: programming
Requires: libtdb = %{version}-%{release}
%{?python_provide:%python_provide python3-tdb}
%if %{without python2}
Obsoletes: python-tdb < %{version}
%endif

%description -n python3-tdb
Python3 bindings for libtdb


%if %{build_compat32}
%package -n compat32-libtdb
Summary: The TDB library
Summary(ja): TDB ライブラリ
Group: system
Requires: libtdb = %{version}-%{release}

%description -n compat32-libtdb
A library that implements a trivial database.
%endif


%debug_package


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


%build
#./autogen.sh
%if %{without python2}
export PYTHON=%{__python3}
%endif
%configure --disable-rpath \
%if %{with python2}
	--extra-python=%{__python3} \
%endif
	--bundled-libraries=NONE \
	--builtin-libraries=replace
make %{?_smp_mflags} V=1


%install
rm -rf $RPM_BUILD_ROOT

make install DESTDIR=$RPM_BUILD_ROOT

# Shared libraries need to be marked executable for
# rpmbuild to strip them and include them in debuginfo
find $RPM_BUILD_ROOT -name "*.so*" -exec chmod -c +x {} \;

rm -f $RPM_BUILD_ROOT%{_libdir}/libtdb.a


%clean
rm -rf $RPM_BUILD_ROOT


%files
%defattr(-,root,root,-)
%{_libdir}/libtdb.so.*

%files devel
%defattr(-,root,root)
%{_includedir}/tdb.h
%{_libdir}/libtdb.so
%{_libdir}/pkgconfig/tdb.pc

%files -n tdb-tools
%defattr(-,root,root,-)
%{_bindir}/tdbbackup
%{_bindir}/tdbdump
%{_bindir}/tdbtool
%{_bindir}/tdbrestore
%{_mandir}/man8/tdbbackup.8*
%{_mandir}/man8/tdbdump.8*
%{_mandir}/man8/tdbtool.8*
%{_mandir}/man8/tdbrestore.8*

%if %{with python2}
%files -n python-tdb
%defattr(-,root,root,-)
%{python_sitearch}/*
%endif

%files -n python3-tdb
%{python3_sitearch}/*

%if %{build_compat32}
%files -n compat32-libtdb
%attr(755,root,root) %{_libdir}/libtdb.so.*
%endif


%changelog
* Fri Apr 21 2023 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.4.8-1
- new upstream release.

* Fri Oct 28 2022 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.4.7-2
- rebuilt with python-3.11.

* Wed Jul 27 2022 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.4.7-1
- new upstream release.

* Tue Aug 24 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.4.5-1
- new upstream release.
- dropped ldconfig scriptlets.

* Sun Aug 16 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.4.3-2
- rebuilt with python-3.8.

* Tue Mar 31 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.4.3-1
- new upstream release.

* Sat May 11 2019 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.3.18-1
- new upstream release.
- disabled python2.
- added BR:libtirpc-devel.

* Fri Nov 30 2018 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.3.16-1
- new upstream release.

* Tue Feb 27 2018 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.3.15-1
- new upstream release.
- dropped Patch1.
- enabled python3 modules.

* Sat Jul 15 2017 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.3.14-1
- new upstream release.

* Mon May  1 2017 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.3.13-1
- new upstream release.

* Sun Dec 11 2016 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.3.12-1
- new upstream release.

* Wed Apr 13 2016 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.3.9-1
- new upstream release.

* Wed Dec  2 2015 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.3.8-1
- new upstream release.

* Fri Jul 24 2015 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.3.7-1
- new upstream release.

* Sat Jun 13 2015 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.3.6-1
- new upstream release.

* Mon Jan 12 2015 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.3.4-1
- new upstream release.

* Wed Dec  3 2014 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.3.3-1
- new upstream release.

* Sat Oct  4 2014 Ryoichi INAGAKI <ryo1@toki.waseda.jp> 1.3.0-2
- moved python-tdb to System Environment/Libraries Group
- moved tdb-tool to Applications/System Group

* Tue Aug 19 2014 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.3.0-1
- new upstream release.

* Wed Jan 08 2014 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.2.12-2
- rebuilt with current environment.

* Tue Oct 08 2013 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.2.12-1
- new upstream release.

* Mon Dec 17 2012 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.2.11-1
- new upstream release.

* Sat Apr 14 2012 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.2.10-1
- new upstream release.
- updated Patch0001.

* Thu Feb 16 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.2.9-11
- rebuild with python-2.7.2

* Thu Mar 24 2011 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.2.9-10
- initial build for Vine Linux.

* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.9-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Fri Jan 14 2011 Stephen Gallagher <sgallagh@redhat.com> - 1.2.9-8
- Actually fix the verbosity

* Fri Jan 14 2011 Stephen Gallagher <sgallagh@redhat.com> - 1.2.9-7
- Let rpmbuild strip binaries, make build more verbose.
- Original patch by Ville Skyttä <ville.skytta@iki.fi>

* Wed Jan 12 2011 Stephen Gallagher <sgallagh@redhat.com> - 1.2.9-6
- Install python bindings into the correct location

* Tue Jan 11 2011 Stephen Gallagher <sgallagh@redhat.com> - 1.2.9-5
- Run ldconfig on python-tdb

* Tue Jan 11 2011 Stephen Gallagher <sgallagh@redhat.com> - 1.2.9-4
- Do not delete a necessary file during %%install

* Tue Jan 11 2011 Stephen Gallagher <sgallagh@redhat.com> - 1.2.9-3
- Bump release to rebuild with the correct sources in place

* Tue Jan 11 2011 Stephen Gallagher <sgallagh@redhat.com> - 1.2.9-2
- Bump build to rebuild with sources in place

* Tue Jan 11 2011 Stephen Gallagher <sgallagh@redhat.com> - 1.2.9-1
- New upstream bugfix release
- Adds a new tdbrestore utility
- Convert to new WAF build-system
- Add python bindings in new python-tdb subpackage

* Wed Feb 24 2010 Simo Sorce <ssorce@redhat.com> - 1.2.1-3
- add missing build require

* Wed Feb 24 2010 Simo Sorce <ssorce@redhat.com> - 1.2.1-2
- Fix spec file
- Package manpages too

* Wed Feb 24 2010 Simo Sorce <ssorce@redhat.com> - 1.2.1-1
- New upstream bugfix release

* Tue Dec 15 2009 Simo Sorce <ssorce@redhat.com> - 1.2.0-1
- New upstream release

* Sat Jul 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1.5-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Wed Jun 17 2009 Simo Sorce <ssorce@redhat.com> - 1.1.5-1
- Original tarballs had a screw-up, rebuild with new fixed tarballs from
  upstream.

* Tue Jun 16 2009 Simo Sorce <ssorce@redhat.com> - 1.1.5-0
- New upstream release

* Wed May 6 2009 Simo Sorce <ssorce@redhat.com> - 1.1.3-15
- First public independent release from upstream