lirc/lirc.spec

263 lines
8.3 KiB
RPMSpec
Raw Normal View History

#
# spec file for package lirc
#
# 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/
#
%define _udevdir %(pkg-config --variable udevdir udev)
%if ! %{defined _rundir}
%define _rundir %{_localstatedir}/run
%endif
Name: lirc
#
Version: 0.9.1a
Release: 0
Summary: Tools for Infrared Receivers
License: GPL-2.0+
Group: Hardware/Other
Url: http://www.lirc.org/
Source0: http://downloads.sourceforge.net/project/lirc/LIRC/%{version}/lirc-%{version}.tar.bz2
Source1: baselibs.conf
Source6: fix-remote-keys.pl
Source8: README.SUSE
Source9: 51-lirc.rules
# PATCH-FEATURE-UPSTREAM 0001-Fix-segfault-when-starting-lircd-AUR-41581.patch --lircd fails to start ending in a segfault
Patch0: 0001-Fix-segfault-when-starting-lircd-AUR-41581.patch
# PATCH-FEATURE-UPSTREAM 0002-lircd-Fix-bad-default-for-lircdfile.patch -- Fix bad default for lircdfile
Patch1: 0002-lircd-Fix-bad-default-for-lircdfile.patch
# PATCH-FEATURE-UPSTREAM 0003-0.9.1a-Bugfix-segfault-when-parsing-connect-in-confi.patch --segfault when parsing
# --connect in config file
Patch2: 0003-0.9.1a-Bugfix-segfault-when-parsing-connect-in-confi.patch
# PATCH-FEATURE-UPSTREAM 0004-lircd-fix-compiler-error-format-security-error.patch --fix compiler error=format-security error
Patch3: 0004-lircd-fix-compiler-error-format-security-error.patch
# PATCH-FEATURE-UPSTREAM -- lirc config for iMON-PAD remote
Patch90: imon2_conf.patch
BuildRequires: fdupes
BuildRequires: help2man
BuildRequires: libtool
# for hw_atilibusb driver
BuildRequires: libusb-devel
BuildRequires: pkgconfig
BuildRequires: pkgconfig(alsa)
BuildRequires: pkgconfig(systemd)
BuildRequires: pkgconfig(udev)
BuildRequires: pkgconfig(x11)
Requires: udev
Recommends: lirc-remotes
Suggests: lirc-kmp
Supplements: lirc-kmp
%{?systemd_requires}
%ifnarch s390 s390x
# i2c-dev.h now moved to that package
BuildRequires: i2c-tools
# for hw_i2cuser driver
BuildRequires: linux-kernel-headers
%endif
# bug437293
%ifarch ppc64
Obsoletes: lirc-64bit
%endif
%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
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
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
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.
%package disable-kernel-rc
Summary: Disable kernel ir device handling in favor of lirc
Group: Hardware/Other
Requires: %{name} = %{version}-%{release}
Recommends: lirc = %{version}
%description disable-kernel-rc
Udev rule which disables the kernel built-in handling of infrared devices
(i. e., rc* ones) by making lirc the only used protocol.
# Don't provide or require anything from _docdir, per policy.
%global __provides_exclude_from ^%{_docdir}/.*$
%global __requires_exclude_from ^%{_docdir}/.*$
%prep
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch90 -p1
cp %{SOURCE8} .
%if %{defined _rundir}
# Fix rundir for openSUSE > 13.1
sed -i 's|${localstatedir}/run|run|g' configure
%else
# But fix systemd unit files for openSUSE <= 13.1
sed -i 's|run|%{_localstatedir}/run|g' systemd/lircd.socket
%endif
%build
PYTHON=%{_bindir}/python \
CFLAGS="%{optflags} -fno-strict-aliasing" %configure \
--with-igor \
--with-transmitter \
--with-driver=userspace \
--with-port=0x3f8 \
--with-irq=4 \
--with-syslog
# make %%{?_smp_mflags}
# parallel makes are currently busted, do single-threaded for now
make
chmod -R u+w remotes
chmod -R +r remotes
rm -rf remotes/*/.xvpics/
perl %{SOURCE6} remotes
%install
make DESTDIR=%{buildroot} install %{?_smp_mflags}
# Put remote definitions in place
cp -ar remotes %{buildroot}%{_datadir}/lirc-remotes
# Create backward compatibility symlink
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}
mkdir -p %{buildroot}%{_tmpfilesdir}
echo "d %{_localstatedir}/run/lirc 0755 root root 10d" \
> %{buildroot}/%{_tmpfilesdir}/lirc.conf
#
# udev stuff
install -d -m 755 %{buildroot}/%{_udevdir}/rules.d
install -m 644 %{SOURCE9} %{buildroot}/%{_udevdir}/rules.d
#
install -Dpm 644 contrib/99-remote-control-lirc.rules \
%{buildroot}%{_udevrulesdir}/99-remote-control-lirc.rules
# get rid of libtool file
rm -f %{buildroot}%{_libdir}/liblirc_client.la
#
# get rid of useless contrib stuff
rm contrib/lirc.*
#
# Don't install documentation in a non standard directory
rm -rf %{buildroot}%{_datadir}/doc
# hide python dependency
chmod 644 %{buildroot}%{_bindir}/pronto2lirc
mkdir -p %{buildroot}%{_rundir}
# Remove old %{_rundir}; depreciated but still installed by lirc, which is not looking for it
rm -rf %{buildroot}%{_localstatedir}
#
#
%fdupes -s %{buildroot}
%fdupes -s .
%post -n liblirc_client0 -p /sbin/ldconfig
%postun -n liblirc_client0 -p /sbin/ldconfig
%pre
%service_add_pre lircd.service lircmd.service lircd.socket
%post
%service_add_post lircd.service lircmd.service lircd.socket
systemd-tmpfiles --create %{_tmpfilesdir}/lirc.conf
# config files moved to /etc/lirc in 0.8.6
for file in lircd.conf lircmd.conf lircrc; do
if [ -e %{_sysconfdir}/$file -a ! -L %{_sysconfdir}/$file ]; then
if [ ! -e %{_sysconfdir}/lirc/$file ]; then
mv %{_sysconfdir}/$file %{_sysconfdir}/lirc/$file || true
ln -s lirc/$file %{_sysconfdir}/$file || true
else
echo "Warning: lirc ignores %{_sysconfdir}/$file, use %{_sysconfdir}/lirc/$file instead" >&2
fi
fi
done
%preun
%service_del_preun lircd.service lircmd.service lircd.socket
%postun
%service_del_postun lircd.service lircmd.service lircd.socket
%files
%defattr (-,root,root)
%doc 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 %{_rundir}/lirc
%ghost %{_rundir}/lirc/lircm
%ghost %{_rundir}/lirc/lircd
%attr(0755,root,root)%{_bindir}/*
%{_sbindir}/*
%{_udevdir}/rules.d/51-lirc.rules
%{_mandir}/man1/*
%{_mandir}/man8/*
%dir %{_sysconfdir}/lirc
%config(noreplace,missingok) %{_sysconfdir}/lirc/lircd.conf
%config(noreplace,missingok) %{_sysconfdir}/lirc/lircmd.conf
%config(noreplace,missingok) %{_sysconfdir}/lirc/lirc_options.conf
%{_unitdir}/lirc*
%{_tmpfilesdir}/lirc.conf
%files devel
%defattr (-,root,root)
%dir %{_includedir}/lirc
%{_includedir}/lirc/lirc_client.h
%{_libdir}/liblirc_client.so
%files remotes
%defattr (-,root,root)
%{_datadir}/lirc-remotes
%files -n liblirc_client0
%defattr (-,root,root)
%{_libdir}/liblirc_client.so.*
%files disable-kernel-rc
%defattr (-,root,root)
%{_udevrulesdir}/99-remote-control-lirc.rules
%changelog