File lirc.spec of Package lirc

#
# spec file for package lirc (Version 0.8.5MACRO)
#
# Copyright (c) 2009 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/
#

# norootforbuild


Name:           lirc
BuildRequires:  alsa-devel 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
Url:            http://www.lirc.org/
License:        GPL v2 or later
Group:          Hardware/Other
AutoReqProv:    on
# bug437293
%ifarch ppc64
Obsoletes:      lirc-64bit
%endif
#
Version:        0.8.5%{?snapshot:_%snapshot}
Release:        1
PreReq:         %fillup_prereq %insserv_prereq
Summary:        LIRC remote definitions
Source0:        lirc-%{?snapshot}%{!?snapshot:%version}.tar.bz2
Source4:        rc.lirc
Source5:        sysconfig.lirc
Source6:        fix-remote-keys.pl
Source8:        README.SUSE
Source9:        51-lirc.rules
#Patch0:       lirc-hw.diff
Patch1:         lirc-sockets-in-var.diff
Patch2:         imon2_conf.patch
Patch3:         lirc-0.8.5-ftdi.diff
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.

This package contains a collection of configuration files for various
remotes.



%package        devel
License:        GPL v2 or later
Summary:        LIRC development files
Group:          Hardware/Other
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:        GPL v2 or later
Summary:        Tools for Infrared Receivers
Group:          Hardware/Other
# files were in lirc package previously
Conflicts:      lirc <= 0.8.4

%description    remotes
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 -n liblirc_client0
License:        GPL v2 or later
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
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.

This package only contains the client library. To actually use LIRC the
lircd daemon from the 'lirc' package has to be configured and started.



%prep
%setup -q -n %{name}-%{?snapshot}%{!?snapshot:%version}
#%patch0 -p1 -b .hw
%patch1 -p1 -b .var
%patch2 -p1
%patch3 -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

%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
mkfifo %{buildroot}/var/run/lirc/lircm
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 file
install -D -m 644 /dev/null %{buildroot}/etc/lircd.conf
# 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
#%attr (600,root,root) %dev(c,61,0) /dev/lirc	# => udev
%dir /var/run/lirc
/var/run/lirc/lircm
%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/*
%ghost %verify(not md5 size mtime) %config(noreplace,missingok) /etc/lircd.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

%files -n liblirc_client0
%defattr (-,root,root)
%{_libdir}/liblirc_client.so.*

%preun
%stop_on_removal lirc

%post
%{fillup_and_insserv lirc}

%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
openSUSE Build Service is sponsored by