Summary:	Apple laptops hotkey event handler / LCD backlight adjuster
Summary(ja):	Apple 社製ノート PC 用ホットキー / バックライト調整プログラム

Name:		pommed
Version:	1.39
Release:	3%{?_dist_release}

License:	GPLv2
Group:		System Environment/Daemons
URL:		http://alioth.debian.org/projects/pommed/

Source0:	%{name}-%{version}.tar.gz

Source10:	%{name}.init.vine
Patch10:	%{name}-1.39-rpmoptflags.patch
Patch20:	%{name}-1.39-mba2011.patch

BuildRoot:	%{_tmppath}/%{name}-%{version}-root
BuildRequires:	alsa-lib-devel, audiofile-devel, pciutils-devel
BuildRequires:	dbus-devel, libconfuse-devel, zlib-devel
BuildRequires:	dbus-glib-devel, gtk2-devel
BuildRequires:	libX11-devel, libXext-devel, libXt-devel, libXpm-devel
Requires:	eject
Requires(post): chkconfig
Requires(preun): chkconfig
Requires(preun): initscripts
Requires(postun): initscripts

ExclusiveArch:	%{ix86} x86_64 ppc ppc64

Vendor: Project Vine
Distribution: Vine Linux
Packager: shaolin

%description
pommed handles the hotkeys found on the Apple MacBook, MacBook Pro,
PowerBook and iBook laptops and adjusts the LCD/Keyboard backlight,
sound volume or ejects the CD / DVD drive accordingly.

%description -l ja
pommed は、Apple MacBook / MacBook Pro / PowerBook / iBook といった
ノート PC のホットキーを扱うデーモンで、液晶/キーボードのバックライト、
音量、 CD / DVD ドライブのイジェクトなどを行います。


%package -n gpomme
Summary:	Graphical client for pommed
Summary(ja):	pommed の グラフィカルクライアント
Group:		User Interface/Desktops
Requires:	pommed = %{version}-%{release}
Requires:	dbus

%description -n gpomme
graphical client for pommed

%description -n gpomme -l ja
pommed のグラフィカルクライアント


%package -n wmpomme
Summary:	WindowMaker dockapp client for pommed
Summary(ja):	pommed の WindowMaker dockapp クライアント
Group:		User Interface/Desktops
Requires:	pommed = %{version}-%{release}
Requires:	dbus

%description -n wmpomme
WindowMaker dockapp client for pommed

%description -n wmpomme -l ja
pommed の WindowMaker dockapp クライアント


%prep
%setup -q
%patch10 -p1
%patch20 -p1


%build
%ifarch ppc ppc64
make OFLIB=1
%else
make
%endif


%install
[ "%{buildroot}" != "/" ] && rm -rf %{buildroot}

mkdir -p %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{_sbindir}
mkdir -p %{buildroot}%{_sysconfdir}/init.d
mkdir -p %{buildroot}%{_sysconfdir}/dbus-1/system.d
mkdir -p %{buildroot}%{_datadir}/applications
mkdir -p %{buildroot}%{_datadir}/icons
mkdir -p %{buildroot}%{_datadir}/pixmaps
mkdir -p %{buildroot}%{_datadir}/pommed
mkdir -p %{buildroot}%{_datadir}/gpomme
mkdir -p %{buildroot}%{_localedir}
mkdir -p %{buildroot}%{_mandir}/man1

install -m 755 pommed/pommed	%{buildroot}%{_sbindir}/
install -m 755 %{SOURCE10}	%{buildroot}%{_sysconfdir}/init.d/pommed
install -m 644 pommed/data/*	%{buildroot}%{_datadir}/pommed/
%ifarch ppc ppc64
install -m 644 pommed.conf.pmac		%{buildroot}%{_sysconfdir}/pommed.conf
%else
install -m 644 pommed.conf.mactel	%{buildroot}%{_sysconfdir}/pommed.conf
%endif
install -m 644 dbus-policy.conf \
	%{buildroot}%{_sysconfdir}/dbus-1/system.d/pommed.conf
install -m 644 pommed.1	%{buildroot}%{_mandir}/man1/

install -m 755 gpomme/gpomme 	%{buildroot}%{_bindir}
install -m 644 gpomme/gpomme.1	%{buildroot}%{_mandir}/man1/
install -m 644 gpomme/*.desktop	%{buildroot}%{_datadir}/applications/
install -m 644 icons/gpomme*	%{buildroot}%{_datadir}/icons/
install -m 644 icons/gpomme_32x32.xpm \
	%{buildroot}%{_datadir}/pixmaps/gpomme.xpm
cp -a gpomme/themes			%{buildroot}%{_datadir}/gpomme/
for X in gpomme/po/*.mo ; do
    lang=`basename $X .mo`
    filename="gpomme.mo"
    install -d %{buildroot}%{_localedir}/${lang}/LC_MESSAGES
    install -m 644 $X %{buildroot}%{_localedir}/${lang}/LC_MESSAGES/$filename
done

install -m 755 wmpomme/wmpomme		%{buildroot}%{_bindir}
install -m 644 wmpomme/wmpomme.1	%{buildroot}%{_mandir}/man1/
install -m 644 icons/gpomme_32x32.xpm \
	%{buildroot}%{_datadir}/icons/wmpomme.xpm

%find_lang gpomme


%clean
[ "${buildroot}" != "/" ] && rm -rf ${buildroot}


%post
/sbin/chkconfig --add pommed


%preun
if [ $1 = 0 ] ; then
    service pommed stop > /dev/null 2>&1
    /sbin/chkconfig --del pommed
fi


%postun
if [ "$1" -ge "1" ] ; then
    service pommed condrestart > /dev/null 2>&1
fi


%files
%defattr(-,root,root)
%doc AUTHORS COPYING ChangeLog INSTALL README TODO
%config(noreplace) %{_sysconfdir}/pommed.conf
%config(noreplace) %{_sysconfdir}/dbus-1/system.d/pommed.conf
%{_sysconfdir}/init.d/pommed
%{_sbindir}/pommed
%{_mandir}/man1/pommed*
%{_datadir}/pommed


%files -n gpomme -f gpomme.lang
%defattr(-,root,root)
%{_bindir}/gpomme
%{_datadir}/applications/*.desktop
%{_datadir}/icons/gpomme*
%{_datadir}/pixmaps/gpomme*
%{_datadir}/gpomme
%{_mandir}/man1/gpomme*


%files -n wmpomme
%defattr(-,root,root)
%{_bindir}/wmpomme
%{_datadir}/icons/wmpomme*
%{_mandir}/man1/wmpomme*


%changelog
* Tue Dec 30 2014 Ryoichi INAGAKI <ryo1@toki.waseda.jp> 1.39-3
- rebuilt on current VineSeed

* Sun Sep 18 2011 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 1.39-2
- add Patch20 to support MBA Mid2011
  (based on the patch found at http://almostsure.com/mba42/)

* Fri Aug 12 2011 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 1.39-1
- new upstream release 1.39

* Tue Jul 27 2010 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 1.33-1
- new upstream release 1.33

* Thu Oct  8 2009 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 1.28-1
- new upstream release 1.28

* Wed Jun  3 2009 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 1.26-1
- new upstream release 1.26

* Thu Jul 24 2008 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 1.21-1
- updated to 1.21 release (equals to svn r503)

* Mon Jun 30 2008 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 1.20-1
- updated to 1.20 release (equals to svn r498)

* Mon May 26 2008 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 1.18-1
- initial build for Vine Linux
- 1.19 prerelease (svn r473)
- add Source10 for customized initscript
  (checks if the machine is either of MacBooks/PowerBooks/iBooks)
