%define _unpackaged_files_terminate_build 1

# Basic Information
Name:		PackageKit
Version:	1.1.12
Release:	1%{?_dist_release}
License:	GPLv2
Group:		Applications/System
Source0:	http://www.packagekit.org/releases/%{name}-%{version}.tar.xz
Source100:	filter-requires-%{name}.sh
# from autoconf-archive-2018.03.13
# https://www.gnu.org/software/autoconf-archive/
Source1000: ax_cxx_compile_stdcxx.m4
Source1001: ax_cxx_compile_stdcxx_11.m4
Source1002: ax_cxx_compile_stdcxx_14.m4


# for VineLinux
Patch100:	PackageKit-0.7.1-backend-aptcc-vine.patch

Vendor:		Project Vine
Distribution:	Vine Linux
Packager:	yasumichi, Takemikaduchi

Summary:	A DBUS packaging abstraction layer
Summary(ja):	DBUS のパッケージング抽象レイヤ

BuildRoot:	%{_tmppath}/%{name}-%{version}-root

# Dependency
BuildRequires:	glib2-devel
BuildRequires:	dbus-devel
BuildRequires:	dbus-glib-devel
BuildRequires:	libgudev1-devel
BuildRequires:	pm-utils-devel
BuildRequires:	polkit-devel
BuildRequires:	NetworkManager-devel
BuildRequires:	sqlite3-devel
BuildRequires:	gtk3-devel
BuildRequires:	gtk2-devel
BuildRequires:  gobject-introspection-devel
BuildRequires:	gstreamer1-devel
BuildRequires:	gstreamer1-plugins-base-devel
BuildRequires:	apt-devel
BuildRequires:	gtk-doc
BuildRequires:	python
BuildRequires:	bash-completion

# Don't depend on Debconf::Client::ConfModule
%define __perl_requires %{SOURCE100}

%description
PackageKit is a DBUS abstraction layer that allows the session user to
manage packages in a secure way using a cross-distro, cross-architecture
API.

For more information, please see http://www.packagekit.org

%description -l ja
PackageKit は、安全な方法でセッションのユーザーにパッケージ管理を許可する
DBUS の抽象レイヤです。ディストリビューションやアーキテクチャーをまたいだ
API を利用しています。

より詳しい情報は、 http://www.packagekit.org をご覧ください。

%package devel
Summary:	Development enviroment for PackageKit
Summary(ja):	PackageKit の開発環境
Group:          Development/Libraries
Requires:       %{name} = %{version}-%{release}
Requires:       glib2-devel
Requires:       dbus-devel
Requires:       sqlite3-devel
Requires:       pkgconfig

%description devel
Header file and libraries for developping PackageKit.

%description -l ja devel
PackageKit で開発を行うためのヘッダファイルとライブラリ

%package doc
Summary:	Documants of PackageKit
Summary(ja):	PackageKit のドキュメント
Group:		Applications/Documentation

%description doc
HTML documents of PackageKit

%description -l ja doc
PackageKit の HTML ドキュメント

%prep
%setup -q
#%patch100 -p1 -b .vine

cp -f \
  %{SOURCE1000} \
  %{SOURCE1001} \
  %{SOURCE1002} \
  m4/

%build
autoreconf -if
%configure \
	--disable-static \
	--disable-systemd \
	--disable-qt \
	--disable-systemd \
	--disable-systemd-updates 
#	--enable-aptcc \
#	--with-default-backend=aptcc
%{__make} %{?_smp_mflags}

%install
%{__rm} -rf ${RPM_BUILD_ROOT}
%{__make} install DESTDIR=${RPM_BUILD_ROOT}

%find_lang %{name}

find $RPM_BUILD_ROOT -name '*.a' -exec rm -f {} \;
find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} \;

mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/cache/app-info/{icons,xmls}

touch $RPM_BUILD_ROOT%{_localstatedir}/cache/PackageKit/groups.sqlite

# create a link that GStreamer will recognise
pushd ${RPM_BUILD_ROOT}%{_libexecdir} > /dev/null
ln -s pk-gstreamer-install gst-install-plugins-helper
popd > /dev/null

# create a link that from the comps icons to PK, as PackageKit frontends
# cannot add /usr/share/pixmaps/comps to the icon search path as some distros
# do not use comps. Patching this in the frontend is not a good idea, as there
# are multiple frontends in multiple programming languages.
pushd ${RPM_BUILD_ROOT}%{_datadir}/PackageKit > /dev/null
ln -s ../pixmaps/comps icons
popd > /dev/null

%find_lang %name

%clean
%{__rm} -rf ${RPM_BUILD_ROOT}

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig


%files -f %{name}.lang
%defattr(-,root,root)
%license COPYING
%doc AUTHORS COPYING HACKING MAINTAINERS NEWS README
%dir %{_datadir}/PackageKit
%dir %{_datadir}/PackageKit/helpers
%dir %{_sysconfdir}/PackageKit
%dir %{_localstatedir}/lib/PackageKit
%dir %{_localstatedir}/cache/app-info
%dir %{_localstatedir}/cache/app-info/icons
%dir %{_localstatedir}/cache/app-info/xmls
%dir %{_localstatedir}/cache/PackageKit
%ghost %verify(not md5 size mtime) %{_localstatedir}/cache/PackageKit/groups.sqlite
%{_datadir}/bash-completion/completions/pkcon
%dir %{_libdir}/packagekit-backend
%config(noreplace) %{_sysconfdir}/PackageKit/PackageKit.conf
%config(noreplace) %{_sysconfdir}/PackageKit/Vendor.conf
%config %{_sysconfdir}/dbus-1/system.d/*
%dir %{_datadir}/PackageKit/helpers/test_spawn
%{_datadir}/PackageKit/icons
%{_datadir}/PackageKit/helpers/test_spawn/*
%{_datadir}/man/man1/pkcon.1.gz
%{_datadir}/man/man1/pkmon.1.gz
%{_datadir}/polkit-1/actions/*.policy
%{_datadir}/polkit-1/rules.d/*
%{_datadir}/PackageKit/pk-upgrade-distro.sh
%{_libexecdir}/packagekitd
%{_libexecdir}/packagekit-direct
%{_bindir}/pkmon
%{_bindir}/pkcon
%{_libdir}/packagekit-backend/libpk_backend_dummy.so
%{_libdir}/packagekit-backend/libpk_backend_test_*.so
%if 0%{?bundled_libdnf}
%{_libdir}/PackageKit/
%endif
%ghost %verify(not md5 size mtime) %{_localstatedir}/lib/PackageKit/transactions.db
%{_datadir}/dbus-1/system-services/*.service
%{_datadir}/dbus-1/interfaces/*.xml
#%{_unitdir}/packagekit-offline-update.service
#%{_unitdir}/packagekit.service
#%{_unitdir}/system-update.target.wants/
#%{_libexecdir}/pk-*offline-update
#%{_libdir}/packagekit-backend/libpk_backend_dnf.so
#
%{_libdir}/*packagekit-glib2.so.*
%{_libdir}/girepository-1.0/PackageKitGlib-1.0.typelib
#
%config %{_sysconfdir}/cron.daily/packagekit-background.cron
%config(noreplace) %{_sysconfdir}/sysconfig/packagekit-background
#
%{_libexecdir}/pk-gstreamer-install
%{_libexecdir}/gst-install-plugins-helper
#
%{_libdir}/gtk-2.0/modules/*.so
%{_libdir}/gtk-3.0/modules/*.so
%{_libdir}/gnome-settings-daemon-3.0/gtk-modules/*.desktop
#
%{_sysconfdir}/profile.d/*
%{_libexecdir}/pk-command-not-found
%config(noreplace) %{_sysconfdir}/PackageKit/CommandNotFound.conf

%files devel
%defattr(-, root, root)
%{_libdir}/libpackagekit-glib2.so
%{_libdir}/pkgconfig/packagekit-glib2.pc
%dir %{_includedir}/PackageKit
%dir %{_includedir}/PackageKit/packagekit-glib2
%{_includedir}/PackageKit/packagekit-glib*/*.h
%{_datadir}/gir-1.0/PackageKitGlib-1.0.gir
%{_datadir}/gtk-doc/html/PackageKit
%{_datadir}/vala/vapi/packagekit-glib2.vapi

%files doc
%defattr(-, root, root)
%{_datadir}/gtk-doc/html/PackageKit

%changelog
* Mon Dec 10 2018 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.1.12-1
- new upstream release.

* Sun Apr 13 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.8.17-1
- new upstream release

* Sun Jan 12 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.8.15-1
- new upstream release
- add configure option (--disable-systemd, --disable-systemd-updates)

* Sun May 19 2013 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.8.8-1
- new upstream release
- add BuildRequires: bash-completion

* Wed Jan 09 2013 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.8.6-1
- new upstream release

* Wed Nov 14 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.8.5-1
- new upstream release

* Sun Sep 30 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.8.3-1
- new upstream release
- drop Patch100
- add BuildRequires: gtk2-devel

* Sun Feb 19 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.7.1-3
- rebuild with python-2.7.2

* Mon Jan 09 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.7.1-2
- add Patch100 (PackageKit-0.7.1-backend-aptcc-vine.patch)
- add Source100 (filter-requires-PackageKit.sh)
- add BuildRequires: apt-devel

* Tue Jan 03 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.7.1-1
- new upstream release
- add BuildRequires libgudev1-devel, pm-utils-devel

* Sat Sep 17 2011 Yasumichi Akahoshi <yasumichi@vinelinux.org> 0.7.0-1
- initial build for Vine Linux
