diff --git a/.cvsignore b/.cvsignore
index 08b1a75..1a88123 100644
--- a/.cvsignore
+++ b/.cvsignore
@@ -1 +1 @@
-lirc-0.6.6.tar.bz2
+lirc-0.7.0.tar.bz2
diff --git a/lirc.init b/lirc.init
new file mode 100644
index 0000000..77799d6
--- /dev/null
+++ b/lirc.init
@@ -0,0 +1,94 @@
+#!/bin/sh
+#
+# lirc Startup script for the Linux Infrared Remote Control daemons
+#
+# chkconfig: - 90 10
+# description: Enables infrared controls through LIRC.
+# processname: lircd
+# processname: lircmd
+# config: /etc/lircd.conf
+# config: /etc/lircmd.conf
+# pidfile: /var/run/lircd.pid
+
+# Source function library.
+. /etc/init.d/functions
+
+exec="/usr/sbin/lircd"
+exec2="/usr/sbin/lircmd"
+prog=$(basename $exec)
+prog2=$(basename $exec2)
+
+[ -e /etc/sysconfig/lirc ] && . /etc/sysconfig/lirc
+
+lockfile=/var/lock/subsys/lirc
+
+start() {
+ echo -n $"Starting infrared remote control daemon ($prog): "
+ daemon $exec $LIRCD_OPTIONS
+ retval=$?
+ echo
+ status $prog >/dev/null 2>&1
+ if [ $? -eq 0 -a "$ENABLE_LIRCMD" = "yes" ] ; then
+ echo -n $"Starting infrared remote control mouse daemon ($prog2): "
+ daemon $exec2 $LIRCMD_OPTIONS
+ retval=$?
+ echo
+ fi
+ [ $retval -eq 0 ] && touch $lockfile
+ return $retval
+}
+
+stop() {
+ retval=0
+ if status $prog2 >/dev/null 2>&1 ; then
+ echo -n $"Stopping infrared remote control mouse daemon ($prog2): "
+ killproc $prog2
+ retval=$?
+ echo
+ fi
+ if [ $retval -eq 0 ] ; then
+ echo -n $"Stopping infrared remote control daemon ($prog): "
+ killproc $prog
+ retval=$?
+ echo
+ fi
+ [ $retval -eq 0 ] && rm -f $lockfile
+ return $retval
+}
+
+restart() {
+ stop
+ start
+}
+
+reload() {
+ # lircmd doesn't apparently respond to HUP, so if it's running, restart.
+ if status $prog2 >/dev/null 2>&1 ; then
+ restart
+ else
+ echo -n $"Reloading infrared remote control daemon ($prog): "
+ killproc $prog -HUP
+ retval=$?
+ echo
+ return $retval
+ fi
+}
+
+case "$1" in
+ start|stop|restart|reload)
+ $1
+ ;;
+ force-reload)
+ reload || restart
+ ;;
+ status)
+ status $prog2
+ status $prog
+ ;;
+ try-restart|condrestart)
+ [ ! -f $lockfile ] || restart
+ ;;
+ *)
+ echo $"Usage: $0 {start|stop|status|restart|try-restart|reload|force-reload}"
+ exit 2
+esac
diff --git a/lirc.makedev b/lirc.makedev
new file mode 100644
index 0000000..87586d4
--- /dev/null
+++ b/lirc.makedev
@@ -0,0 +1,3 @@
+# LIRC,
+
+c $ALLREAD 61 0 1 1 lirc
diff --git a/lirc.spec b/lirc.spec
index 6a6ce9c..bd1c932 100644
--- a/lirc.spec
+++ b/lirc.spec
@@ -1,119 +1,232 @@
-# $Id: lirc.spec 2135 2004-08-30 13:51:15Z dude $
-# Authority: matthias
-
-# The driver(s) you want to compile in, e.g. "pctv", "serial", "any"
-%define driver "pctv"
-
-# Are we compiling drivers that will need a kernel module too
-# (you'll still need to recompile an entire kernel, keep the sources, then
-# recompile lirc to get the modules...)
-%define kmodule 0
-
-#%%if %{kmodule}
-#%%define kunamer %%(uname -r)
-#%%define kver %%(echo $(uname -r) | sed -e s/smp// -)
-#%%define karch %%(rpm -q --qf '%%%{arch}' kernel-%%{kversion})
-#%%define krelver %%(echo %%{kunamer} | tr -s '-' '_')
-#%%endif
-
-Summary: The Linux Infrared Remote Control package
-Name: lirc
-Version: 0.6.6
-#%%if %{kmodule}
-#Release: fr1_%{krelver}
-#%%else
-Release: 4
-#%%endif
-License: GPL
-Group: System Environment/Daemons
-URL: http://www.lirc.org/
-Source0: http://dl.sf.net/lirc/%{name}-%{version}.tar.bz2
-Source1: lircd.init
-Source2: lircd.logrotate
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
-PreReq: /sbin/chkconfig, /sbin/service
-BuildRequires: perl
-#%%if %{kmodule}
-#Requires: kernel = %{kver}
-#BuildRequires: kernel-source = %{kver}
-#%%endif
+# Driver TODO, sometime maybe:
+# - audio (req: portaudio)
+# - caraca (req: caraca_client)
+# - irman: (req: libirman)
+# - drivers that need drivers/media/video/bttv*.h (not in kernel-module-devel)
+# - gpio: flyvideo avermedia avermedia98
+# - i2c: hauppauge
+# Other TODO:
+# - move to -devel (?): irw, *mode2, others?
+# - don't run as root and/or create dedicated group, reduce fifo permissions?
+# - Fixup /etc/lirc(m)d.conf %%ghost'ification, existence after erase etc.
+# - kernel modules: Figure out sane permissions for /dev/lirc, use
+# console.perms/udev, general FC3 adjustments.
+
+%{!?kernel: %{expand: %%define kernel %(uname -r)}}
+%define ksrc %{_libdir}/kernel-module-devel/%{kernel}-%{_target_cpu}
+# Kernel module drivers
+%define drivers sir_com3 it87 tekram_bt829 com1 atiusb mceusb lpt1
+
+Name: lirc
+Version: 0.7.0
+Release: 1
+Summary: The Linux Infrared Remote Control package
+
+Group: System Environment/Daemons
+License: GPL
+URL: http://www.lirc.org/
+Source0: http://download.sourceforge.net/lirc/%{name}-%{version}.tar.bz2
+Source1: %{name}.init
+Source2: %{name}.sysconfig
+Source3: %{name}.makedev
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+
+BuildRequires: %{__perl}
+%if 0%{!?_with_kmod:1}
+BuildRequires: alsa-lib-devel XFree86-devel libusb-devel
+BuildConflicts: svgalib-devel
+%endif
+Requires(post): /sbin/chkconfig /sbin/ldconfig
+Requires(preun): /sbin/chkconfig
+Requires(postun): /sbin/ldconfig
%description
LIRC is the Linux Infrared Remote Control package.
-This package features a clean lircd initscript and a logrotate config file.
-The default binary build of this package will only work with the Pinnacle
-PCTV serial remote, if you have a different device, you will probably need
-to recompile the source RPM changing the "--with-driver=" configure option
-to your device.
+%package devel
+Summary: Development files for LIRC
+Group: Development/Libraries
+Requires: %{name} = %{version}-%{release}
+
+%description devel
+%{summary}.
+
+%package -n kernel-module-%{name}-%{kernel}
+Summary: Kernel modules for LIRC
+Group: System Environment/Kernel
+Provides: kernel-module
+Provides: kernel-module-%{name} = %{version}
+%if 0%{?_with_kmod:1}
+BuildRequires: %{ksrc} MAKEDEV
+%endif
+Requires: modutils %{name} = %{version}
+Requires: /boot/vmlinuz-%{kernel}
-If your remote requires special kernel modules to run, I guess you're stuck
-having to recompile a kernel and recompile lirc manually to get the modules!
+%description -n kernel-module-%{name}-%{kernel}
+LIRC kernel modules built for kernel
+%{kernel} (%{_target_cpu}).
%prep
-%setup
+%setup -q
+%{__perl} -pi -e 's|^CFLAGS="-O2 -g -Wall"|CFLAGS="\$CFLAGS -Wall"|' configure
+chmod 644 contrib/*
%build
+%if 0%{?_with_kmod:1}
+for driver in %{drivers} ; do
+ # lpt1 is not smp safe @@@ TODO: verify this?
+ test $driver = lpt1 && grep -q '^CONFIG_SMP=y' %{ksrc}/.config && continue
+ mkdir -p buildroot/"$driver"
+ %configure \
+ --enable-sandboxed \
+ --enable-debug \
+ --disable-dependency-tracking \
+ --with-kerneldir=%{ksrc} \
+ --with-moduledir=/tmp \
+ --with-driver=$driver
+ make %{?_smp_mflags} -C drivers
+ make -C drivers install DESTDIR=$PWD/buildroot/$driver
+done
+%else
%configure \
- --with-driver=%{driver} \
- --disable-manage-devices
-%{__make} %{?_smp_mflags}
+ --with-syslog=LOG_DAEMON \
+ --enable-sandboxed \
+ --enable-debug \
+ --disable-dependency-tracking \
+ --with-driver=any
+make %{?_smp_mflags}
+%endif
%install
-%{__rm} -rf %{buildroot}
-%{__make} install DESTDIR=%{buildroot}
-%{__install} -m 755 -D %{SOURCE1} %{buildroot}/etc/init.d/lircd
-%{__install} -m 644 -D %{SOURCE2} %{buildroot}/etc/logrotate.d/lircd
-%{__perl} -pi -e 's|\@SBINDIR\@|%{_sbindir}|g' %{buildroot}/etc/init.d/lircd
-%{__rm} -f doc/Makefile*
-%{__mkdir_p} %{buildroot}/dev
-%{__ln_s} -f ttyS0 %{buildroot}/dev/lirc
-touch %{buildroot}/etc/lircd.conf
-touch %{buildroot}/etc/lircmd.conf
+rm -rf $RPM_BUILD_ROOT __docs
+
+%if 0%{?_with_kmod:1}
+for driver in %{drivers} ; do
+ # lpt1 is not SMP safe @@@ TODO: verify this?
+ test $driver = lpt1 && grep -q '^CONFIG_SMP=y' %{ksrc}/.config && continue
+ install -dm 755 $RPM_BUILD_ROOT/lib/modules/%{kernel}/updates/lirc
+ # 0755 here to allow stripping, fixed later in %%files
+ install -pm 755 buildroot/$driver/tmp/* \
+ $RPM_BUILD_ROOT/lib/modules/%{kernel}/updates/lirc
+done
+install -Dpm 644 %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/makedev.d/lirc
+cp -p %{_sysconfdir}/makedev.d/00macros $RPM_BUILD_ROOT%{_sysconfdir}/makedev.d
+/dev/MAKEDEV -M \
+ -c $RPM_BUILD_ROOT%{_sysconfdir}/makedev.d \
+ -d $RPM_BUILD_ROOT/dev lirc \
+ | sed "s|$RPM_BUILD_ROOT||g" \
+ | grep -v ' /dev$' \
+ > devices.list
+rm -f $RPM_BUILD_ROOT%{_sysconfdir}/makedev.d/00macros
+
+%else
+make install DESTDIR=$RPM_BUILD_ROOT
+rm -f $RPM_BUILD_ROOT%{_mandir}/man1/smode2.1* # if no svgalib
+install -Dpm 755 %{SOURCE1} $RPM_BUILD_ROOT%{_initrddir}/lirc
+%{__perl} -pi -e \
+ 's|/etc/|%{_sysconfdir}/|g ;
+ s|/var/|%{_localstatedir}/|g ;
+ s|/usr/sbin/|%{_sbindir}/|g' \
+ $RPM_BUILD_ROOT%{_initrddir}/lirc
+install -Dpm 644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/lirc
+mkdir __docs
+cp -pR doc contrib __docs
+cd __docs
+rm -rf doc/Makefile* doc/.libs doc/man* contrib/lirc.* contrib/sendxevent.c
+cd ..
+touch $RPM_BUILD_ROOT%{_sysconfdir}/lirc{d,md}.conf
+install -dm 755 $RPM_BUILD_ROOT/dev
+touch $RPM_BUILD_ROOT/dev/lirc{d,m}
+%endif
+
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
%post
/sbin/ldconfig
-/sbin/chkconfig --add lircd
+/sbin/chkconfig --add lirc
+# Backwards compatibility (init script lircd -> lirc rename):
+if [ $1 -gt 0 -a -x %{_initrddir}/lircd ] ; then
+ %{_initrddir}/lircd status >/dev/null 2>&1
+ ret=$?
+ %{_initrddir}/lircd stop >/dev/null || :
+ /sbin/chkconfig --del lircd || :
+ if [ $ret -eq 0 ] ; then
+ %{_initrddir}/lirc start >/dev/null || :
+ fi
+fi
+
+%post -n kernel-module-%{name}-%{kernel}
+depmod -ae -F /boot/System.map-%{kernel} %{kernel} >/dev/null || :
%preun
-if [ $1 = 0 ]; then
- /sbin/service lircd stop > /dev/null 2>&1 || :
- /sbin/chkconfig --del lircd
+if [ $1 -eq 0 ] ; then
+ %{_initrddir}/lirc stop >/dev/null || :
+ /sbin/chkconfig --del lirc || :
fi
%postun
/sbin/ldconfig
-if [ "$1" -ge "1" ]; then
- /sbin/service lircd condrestart >/dev/null 2>&1 || :
+if [ $1 -gt 0 ] ; then
+ %{_initrddir}/lirc try-restart >/dev/null || :
fi
-%clean
-%{__rm} -rf %{buildroot}
+%postun -n kernel-module-%{name}-%{kernel}
+depmod -ae -F /boot/System.map-%{kernel} %{kernel} >/dev/null || :
+
+%if 0%{!?_with_kmod:1}
%files
-%defattr(-, root, root, 0755)
-%doc ANNOUNCE AUTHORS ChangeLog COPYING NEWS README TODO doc remotes
-%doc contrib/*.conf contrib/irman2lirc contrib/lircrc contrib/lircs
-/etc/init.d/lircd
-/etc/logrotate.d/lircd
-%ghost %config(noreplace) /etc/lircd.conf
-%ghost %config(noreplace) /etc/lircmd.conf
-%{_bindir}/*
-%{_sbindir}/*
+%defattr(-,root,root,-)
+%doc ANNOUNCE AUTHORS ChangeLog COPYING NEWS README TODO remotes __docs/*
+%ghost %config(noreplace) %{_sysconfdir}/lirc*d.conf
+%config(noreplace) %{_sysconfdir}/sysconfig/lirc
+%config %{_initrddir}/lirc
+%{_bindir}/ir*
+%{_bindir}/*mode2
+%{_sbindir}/lirc*d
+%{_libdir}/liblirc_client.so.*
+%{_mandir}/man1/ir*.1*
+%{_mandir}/man1/*mode2*.1*
+%{_mandir}/man8/lirc*d.8*
+%ghost /dev/lirc*
+
+%files devel
+%defattr(-,root,root,-)
%{_includedir}/lirc
-%{_libdir}/liblirc_*
-%{_mandir}/man?/*
-%if %{kmodule}
-#/lib/modules/%{kver}/misc/*
-%attr(0644, root, root) %dev(c, 61, 0) /dev/lirc
-%else
-/dev/lirc
+%{_libdir}/liblirc_client.a
+%{_libdir}/liblirc_client.so
+%exclude %{_libdir}/liblirc_client.la
%endif
+%if 0%{?_with_kmod:1}
+%files -n kernel-module-%{name}-%{kernel} -f devices.list
+%defattr(644,root,root,755)
+%config %{_sysconfdir}/makedev.d
+/lib/modules/%{kernel}/updates
+%endif
+
+
%changelog
+* Sun Dec 5 2004 Ville Skyttä - 0.7.0-1
+- Update to 0.7.0; major rework of the package:
+- Change default driver to "any".
+- Add -devel subpackage.
+- Improve init script, add %%{_sysconfdir}/sysconfig/lirc for options.
+- Rename init script to "lirc" to follow upstream; the script is not only
+ for lircd, but lircmd as well.
+- Log to syslog instead of separate log file.
+- %%ghost'ify /dev/lirc*.
+- Build kernel modules when rebuilt with "--with kmod". This stuff was mostly
+ borrowed from Axel Thimm's packages, and is not really ready for FC3+ yet.
+- Enable debugging features.
+- Specfile cleanups.
+
* Mon Aug 30 2004 Matthias Saou 0.6.6-3
- Added missing /sbin/ldconfig calls.
diff --git a/lirc.sysconfig b/lirc.sysconfig
new file mode 100644
index 0000000..049e13f
--- /dev/null
+++ b/lirc.sysconfig
@@ -0,0 +1,13 @@
+# Note: in addition to these parameters, you need to have working -*- sh -*-
+# configuration file for lircd (and lircmd if enabled).
+
+# Options to lircd(8). Typically, at least a remote controller driver
+# ("-H foo") needs to be specified here. Run "/usr/sbin/lircd -H help" to get
+# a listing of supported drivers.
+LIRCD_OPTIONS=""
+
+# If "yes", the init script will try to start lircmd(8) too.
+ENABLE_LIRCMD="no"
+
+# Options to lircmd(8).
+LIRCMD_OPTIONS=""
diff --git a/lircd.init b/lircd.init
deleted file mode 100755
index f3aa6ac..0000000
--- a/lircd.init
+++ /dev/null
@@ -1,81 +0,0 @@
-#!/bin/sh
-#
-# $Id: lircd.init,v 1.1 2004/02/26 17:54:30 thias Exp $
-# Startup script for the Linux Infrared Remote Control.
-#
-# chkconfig: - 90 10
-# description: Enables infrared controls through LIRC.
-#
-# config: /etc/lircd.conf
-
-# Source 'em up
-. /etc/init.d/functions
-
-[ -x @SBINDIR@/lircd ] || exit 1
-[ -x @SBINDIR@/lircmd ] || exit 1
-[ -f /etc/lircd.conf ] || [ -f /etc/lircmd.conf ] || exit 1
-
-RETVAL=0
-
-start(){
- if [ -f /etc/lircd.conf ]; then
- echo -n $"Starting infrared remote control daemon: "
- daemon lircd
- RETVAL=$?
- echo
- fi
- if [ -f /etc/lircmd.conf ]; then
- echo -n $"Starting infrared remote control mouse daemon: "
- daemon lircmd
- RETVAL=$?
- echo
- fi
- touch /var/lock/subsys/lircd
- return $RETVAL
-}
-
-stop(){
- if [ -f /etc/lircmd.conf ]; then
- echo -n $"Stopping infrared remote control mouse daemon: "
- killproc lircmd
- echo
- fi
- if [ -f /etc/lircd.conf ]; then
- echo -n $"Stopping infrared remote control daemon: "
- killproc lircd
- echo
- fi
- RETVAL=$?
- rm -f /var/lock/subsys/lircd
- return $RETVAL
-}
-
-restart(){
- stop
- start
-}
-
-
-# See how we were called.
-case "$1" in
- start)
- start
- ;;
- stop)
- stop
- ;;
- restart)
- restart
- ;;
- status)
- status lircd
- ;;
- condrestart)
- [ -e /var/lock/subsys/lircd ] && restart
- ;;
- *)
- echo $"Usage: $0 {start|stop|status|restart|condrestart}"
- RETVAL=1
-esac
-
-exit $RETVAL
diff --git a/lircd.logrotate b/lircd.logrotate
deleted file mode 100644
index 05ade79..0000000
--- a/lircd.logrotate
+++ /dev/null
@@ -1,8 +0,0 @@
-# $Id: lircd.logrotate,v 1.1 2004/11/08 04:49:37 cvsextras Exp $
-
-/var/log/lircd {
- missingok
- postrotate
- [ -e /var/lock/subsys/lircd ] && /bin/kill -HUP `/bin/cat /var/run/lircd.pid` || /bin/true
- endscript
-}
diff --git a/sources b/sources
index 4ce285c..e3734a3 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-6e7b5ba2fd479961d067730e16df7c54 lirc-0.6.6.tar.bz2
+4fbcc8b0d69ca5ecbdda40576964573f lirc-0.7.0.tar.bz2