lirc/lirc.spec

273 lines
7.4 KiB
RPMSpec

#
# spec file for package lirc
#
# Copyright (c) 2011 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/
#
Name: lirc
BuildRequires: alsa-devel libtool xorg-x11-devel
# for hw_atilibusb driver
%if 0%suse_version > 1020
BuildRequires: libusb-devel
%else
BuildRequires: libusb
%endif
%ifnarch s390 s390x
# for hw_i2cuser driver
%if 0%suse_version > 1010
BuildRequires: linux-kernel-headers
%if 0%suse_version > 1030
# i2c-dev.h now moved to that package
BuildRequires: i2c-tools
%endif
%endif
%endif
%if 0%suse_version > 1020
BuildRequires: fdupes
%endif
%if 0%{?snapshot:1}
BuildRequires: help2man
%endif
Url: http://www.lirc.org/
License: GPLv2+
Group: Hardware/Other
# bug437293
%ifarch ppc64
Obsoletes: lirc-64bit
%endif
#
Version: 0.8.7
Release: 3
PreReq: %fillup_prereq %insserv_prereq
Summary: Tools for Infrared Receivers
Source0: http://downloads.sourceforge.net/project/lirc/LIRC/%version/lirc-%version%{?snapshot:-%snapshot}.tar.bz2
Source1: baselibs.conf
Source4: rc.lirc
Source5: sysconfig.lirc
Source6: fix-remote-keys.pl
Source8: README.SUSE
Source9: 51-lirc.rules
Patch0: lirc-0.8.7-lirc_h.diff
Patch1: lirc-0.8.7-lirc_h_2.diff
Patch90: imon2_conf.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Requires: udev
Suggests: lirc-kmp
Supplements: lirc-kmp
Recommends: lirc-remotes
%description
LIRC is a package that supports receiving and sending IR signals with
the most common IR remote controls. It contains a daemon that decodes
and sends IR signals, a mouse daemon that translates IR signals to
mouse movements, and a couple of user programs that allow you to
control your computer with a remote control.
%package devel
License: GPLv2+
Summary: LIRC development files
Group: Development/Libraries/C and C++
Requires: %{name} = %{version}
# files were in lirc package previously
Conflicts: lirc <= 0.8.4
%description devel
LIRC is a package that supports receiving and sending IR signals with
the most common IR remote controls. It contains a daemon that decodes
and sends IR signals, a mouse daemon that translates IR signals to
mouse movements, and a couple of user programs that allow you to
control your computer with a remote control.
%package remotes
License: GPLv2+
Summary: LIRC remote definitions
Group: Hardware/Other
# files were in lirc package previously
Conflicts: lirc <= 0.8.4
%description remotes
Collection of LIRC configuration files for various remotes.
%package -n liblirc_client0
License: GPLv2+
Summary: LIRC client library
Group: Hardware/Other
Recommends: lirc = %{version}
# files were in lirc package previously
Conflicts: lirc <= 0.8.4
%description -n liblirc_client0
The LIRC client library. To actually use LIRC the lircd daemon from
the 'lirc' package has to be configured and started.
%prep
%setup -q -n %{name}-%{version}%{?snapshot:-%snapshot}
%patch0 -p1
%patch1 -p1
%patch90 -p1
cp %{SOURCE8} .
#find . -type d -name CVS -print0 | xargs -0 -- rm -rf
#find . -name .cvsignore -print0 | xargs -0 -- rm -rf
%build
%if 0%suse_version < 1020
# XXX: hw_i2cuser doesn't build on sles10
sed -i -e 's/linux\/i2c-dev\.h/foobarblah.h/' configure.ac
%endif
%{?suse_update_config:%{suse_update_config -fl}}
autoreconf -vfi
PYTHON=/usr/bin/python \
CFLAGS="%{optflags}" ./configure \
--disable-static \
--disable-dependency-tracking \
--prefix=%{_prefix} \
--mandir=%{_mandir} \
--libdir=%{_libdir} \
--sysconfdir=/etc \
--with-driver=userspace \
--with-port=0x3f8 \
--with-irq=4 \
--with-syslog
make -C daemons
make -C tools
make -C doc
chmod -R u+w remotes
chmod -R +r remotes
rm -rf remotes/*/.xvpics/
perl %{SOURCE6} remotes
%if 0%{?snapshot:1}
if [ ! -e doc/lirc.hwdb ]; then
make -C doc release
fi
%endif
%install
# lirc
make -C daemons DESTDIR=%{buildroot} install
make -C tools DESTDIR=%{buildroot} install
make -C doc DESTDIR=%{buildroot} install
mkdir -p %{buildroot}/usr/share/lirc
cp -a remotes %{buildroot}/usr/share/lirc
install -d -m 755 %{buildroot}/dev
mkdir -p %{buildroot}/var/run/lirc
touch %{buildroot}/var/run/lirc/lircd
chmod 600 %{buildroot}/var/run/lirc/*
# lircd init scripts
install -d -m 755 %{buildroot}/etc/init.d \
%{buildroot}/usr/sbin \
%{buildroot}/var/adm/fillup-templates
install -m 0755 %{SOURCE4} %{buildroot}/etc/init.d/lirc
ln -sf ../../etc/init.d/lirc %{buildroot}/usr/sbin/rclirc
install -m 0644 %{SOURCE5} %{buildroot}/var/adm/fillup-templates
#
# udev stuff
install -d -m 755 %{buildroot}/etc/udev/rules.d
install -d -m 755 %{buildroot}/sbin
install -m 644 %{SOURCE9} %{buildroot}/etc/udev/rules.d
find %{buildroot}/usr/share/lirc -perm +111 -type f -print0 | xargs -r -0 chmod a-x
#
# get rid of libtool file
rm -f %{buildroot}%{_libdir}/liblirc_client.la
#
# get rid of useless contrib stuff
rm contrib/lirc.*
#
# ghost files
install -D -m 644 /dev/null %{buildroot}/etc/lirc/lircd.conf
install -D -m 644 /dev/null %{buildroot}/etc/lirc/lircmd.conf
install -D -m 644 /dev/null %{buildroot}/etc/lirc/lircrc
# hide python dependency
chmod 644 %{buildroot}%{_bindir}/pronto2lirc
#
#
%if 0%suse_version > 1020
%fdupes $RPM_BUILD_ROOT
%endif
%files
%defattr (-,root,root)
%doc ANNOUNCE AUTHORS COPYING ChangeLog NEWS README TODO
%doc README.SUSE
%doc doc/html doc/images doc/lirc.hwdb doc/lirc.css doc/irxevent.keys
%doc contrib
%dir %ghost /var/run/lirc
%ghost /var/run/lirc/lircm
%ghost /var/run/lirc/lircd
%attr(0755,root,root)/usr/bin/*
/usr/sbin/*
/etc/init.d/lirc
/var/adm/fillup-templates/sysconfig.lirc
%dir /etc/udev
%dir /etc/udev/rules.d
%config /etc/udev/rules.d/51-lirc.rules
%doc %_mandir/man1/*
%doc %_mandir/man8/*
%dir /etc/lirc
%ghost %verify(not md5 size mtime) %config(noreplace,missingok) /etc/lirc/lircd.conf
%ghost %verify(not md5 size mtime) %config(noreplace,missingok) /etc/lirc/lircmd.conf
%ghost %verify(not md5 size mtime) %config(noreplace,missingok) /etc/lirc/lircrc
%files devel
%defattr (-,root,root)
%dir %{_includedir}/lirc
%{_includedir}/lirc/lirc_client.h
%{_libdir}/liblirc_client.so
%files remotes
%defattr (-,root,root)
%{_datadir}/lirc
%files -n liblirc_client0
%defattr (-,root,root)
%{_libdir}/liblirc_client.so.*
%preun
%stop_on_removal lirc
%post
%{fillup_and_insserv lirc}
# config files moved to /etc/lirc in 0.8.6
for file in lircd.conf lircmd.conf lircrc; do
if [ -e /etc/$file -a ! -L /etc/$file ]; then
if [ ! -e /etc/lirc/$file ]; then
mv /etc/$file /etc/lirc/$file || true
ln -s lirc/$file /etc/$file || true
else
echo "Warning: lirc ignores /etc/$file, use /etc/lirc/$file instead" >&2
fi
fi
done
%post -n liblirc_client0 -p /sbin/ldconfig
%postun -n liblirc_client0 -p /sbin/ldconfig
%postun
%restart_on_update lirc
%{insserv_cleanup}
%clean
rm -rf %{buildroot}
%changelog