Blob Blame History Raw
Name:           iguanaIR
Version:        1.0.3
Release:        2%{?dist}
Summary:        Driver for Iguanaworks USB IR transceiver

Group:          System Environment/Daemons

# Following files are LGPL2.1, remaining GPLv2:
# ./support.h ./iguanaIR.h ./support.c ./pipes.c ./compat.h ./pipes.h
# ./iguanaIR.c ./dataPackets.h ./compat-unix.c ./dataPackets.c
License:        GPLv2 and LGPLv2
URL:            http://iguanaworks.net/ir
Source0:        http://iguanaworks.net/downloads/iguanaIR-%{version}.tar.bz2
Source1:        iguanaIR.service
Source2:        iguanaIR-rescan
Source3:        iguanaIR.logrotate
Patch1:         0001-Remove-trailing-whitespace.patch
# http://iguanaworks.net/projects/IguanaIR/ticket/279
Patch2:         0002-Don-t-hardcode-iguanair-UID.patch
# http://iguanaworks.net/projects/IguanaIR/ticket/280
Patch3:         0003-Use-platform-specific-python-extension-dir.patch
# http://iguanaworks.net/projects/IguanaIR/ticket/281
Patch4:         0004-Don-t-exit-3-in-library-calls.patch
# http://iguanaworks.net/projects/IguanaIR/ticket/282
Patch5:         0005-Improve-driver-dir-detection.patch
# http://iguanaworks.net/projects/IguanaIR/ticket/283
Patch6:         0006-make-options-file-work-w-systemd.patch
# http://iguanaworks.net/projects/IguanaIR/ticket/284
Patch7:         0007-Use-fedora-specific-default-socket-directory.patch
# Fedora only, not acceptable upstream.
Patch8:         0008-udev-invoke-systemd-support-not-sysV-init-file.patch

Requires:       lirc
Requires:       logrotate
Requires:       udev

BuildRequires:  libusb1-devel
BuildRequires:  libusb-devel
BuildRequires:  popt-devel
BuildRequires:  python2-devel
BuildRequires:  systemd-units

Requires(pre):     shadow-utils
Requires(post):    systemd-units
Requires(post):    systemd-sysv
Requires(preun):   systemd-units
Requires(postun):  systemd-units


# some features can be disabled during the rpm build
%{?_without_clock_gettime: %global _disable_clock_gettime --disable-clock_gettime}

# Don't add provides for python .so and private lib so-files
%global __provides_exclude _iguanaIR.so
%global __provides_exclude_from %{_libdir}/iguanaIR/.*[.]so

# Don't require private libs in /usr/lib[64]/iguanaIR
%global __requires_exclude libusbpre1.so|libusb.so


%description
This package provides igdaemon and igclient, the programs necessary to
control the Iguanaworks USB IR transceiver.

%package devel
Summary: Library and header files for iguanaIR
Group: Development/Libraries
Requires: %{name}%{?_isa} = %{version}-%{release}

%description devel
The development files needed to interact with the iguanaIR igdaemon are
included in this package.

%package -n  python-iguanaIR
Group: System Environment/Daemons
Summary: Python module for Iguanaworks USB IR transceiver
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: python
BuildRequires: python2-devel swig

%description -n python-iguanaIR
This package provides the swig-generated Python module for interfacing
with the Iguanaworks USB IR transceiver.

%package firmware
Group: System Environment/Daemons
Summary: Firmware and reflasher for Iguanaworks USB IR transceiver
Requires: %{name} = %{version}-%{release}
BuildArch: noarch

%description firmware
This package provides the reflasher/testing script and assorted firmware
versions for the Iguanaworks USB IR transceiver.  If you have no idea
what this means, you don't need it.

%prep
%setup -q -n iguanaIR-%{version}
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1

# docs: bad EOL, remove script, fix /dev/iguanaIR -> /var/run/iguanaIR
sed -i 's/\r//' docs/*
rm docs/pullDocs
sed -i 's|/dev/iguanaIR|/var/run/iguanaIR|g' \
    docs/TroubleShooting docs/driver docs/lirc

# Noarch data wrongly in libdir.
# http://iguanaworks.net/projects/IguanaIR/ticket/286
sed -i 's|$(LIBDIR)|%{_datadir}|g' reflasher/Makefile

# Force proper compile flags usage.
sed -i '/^CFLAGS/s|$| -DFEDORA=1 -fpic %{optflags}|' Makefile.in

# Remove foreign packaging
rm -rf osx packaging


%build
%configure %{?_disable_clock_gettime}
make %{?_smp_mflags}


%install
make install PREFIX=$RPM_BUILD_ROOT/usr DESTDIR=$RPM_BUILD_ROOT INLIBDIR=$RPM_BUILD_ROOT%{_libdir}

# Use /etc/sysconfig instead of /etc/default
mkdir $RPM_BUILD_ROOT/etc/sysconfig
mv  $RPM_BUILD_ROOT/etc/default/iguanaIR \
    $RPM_BUILD_ROOT/etc/sysconfig

# Fix up some stray file permissions issues
chmod -x $RPM_BUILD_ROOT%{python_sitearch}/*.py \
         $RPM_BUILD_ROOT%{_includedir}/iguanaIR.h \
         $RPM_BUILD_ROOT%{_datadir}/iguanaIR-reflasher/hex/*

# Remove the installed initfile and install the systemd support instead.
rm -rf $RPM_BUILD_ROOT/etc/init.d/
install -m644 -pD %{SOURCE1} $RPM_BUILD_ROOT%{_unitdir}/iguanaIR.service
install -m755 -pD %{SOURCE2} $RPM_BUILD_ROOT%{_datadir}/iguanaIR/rescan

# Install private log dir.
install -m755 -pd $RPM_BUILD_ROOT/var/log/iguanaIR
install -m644 -pD %SOURCE3 $RPM_BUILD_ROOT/etc/logrotate.d/%name

# Handle the tempfiles.d and /var/run stuff.
install -m755 -pd $RPM_BUILD_ROOT/run/iguanaIR
install -m755 -pd $RPM_BUILD_ROOT/etc/tmpfiles.d
cat > $RPM_BUILD_ROOT/etc/tmpfiles.d/iguanaIR.conf <<EOF
d   /run/iguanaIR    0755    iguanair   iguanair
EOF

# Blacklist the kernel driver, just to be sure ATM.
mkdir -p $RPM_BUILD_ROOT/etc/modprobe.d
cat > $RPM_BUILD_ROOT/etc/modprobe.d/blacklist-iguanair.conf << EOF
# iguanaIR user space driver blacklisting the kernel driver
blacklist iguanair
EOF


%pre
getent group iguanair >/dev/null || groupadd -r iguanair
getent passwd iguanair >/dev/null || \
    useradd -r -g iguanair -d /var/run/iguanaIR -s /sbin/nologin \
    -c "Iguanaworks IR Daemon" iguanair
exit 0

%post
if [ $1 -eq 1 ] ; then
    # Initial installation
    /bin/systemctl daemon-reload >/dev/null 2>&1 || :
fi
/sbin/ldconfig

%preun
if [ $1 -eq 0 ] ; then
    # Package removal, not upgrade
    /bin/systemctl --no-reload disable iguanaIR.service > /dev/null 2>&1 || :
    /bin/systemctl stop iguanaIR.service > /dev/null 2>&1 || :
fi

%postun
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
if [ $1 -ge 1 ] ; then
    # Package upgrade, not uninstall
    /bin/systemctl try-restart iguanaIR.service >/dev/null 2>&1 || :
fi
/sbin/ldconfig


%files
%doc AUTHORS LICENSE LICENSE-LGPL WHY protocols.txt README.txt notes.txt ChangeLog
%doc docs
%{_bindir}/igdaemon
%{_bindir}/igclient
%{_libdir}/libiguanaIR.so.*
%{_libdir}/iguanaIR/
%{_datadir}/iguanaIR/
%{_unitdir}/iguanaIR.service
/lib/udev/rules.d/80-iguanaIR.rules
%config(noreplace) /etc/modprobe.d/blacklist-iguanair.conf
%config(noreplace) /etc/sysconfig/iguanaIR
%config(noreplace) /etc/tmpfiles.d/iguanaIR.conf
%config(noreplace) /etc/logrotate.d/iguanaIR
%attr(755, iguanair, iguanair) /lib/udev/devices/iguanaIR
%attr(755, iguanair, iguanair) /run/iguanaIR
%attr(755, iguanair, iguanair) /var/log/iguanaIR

%files devel
%doc examples
%{_includedir}/iguanaIR.h
%{_libdir}/libiguanaIR.so

%files -n python-iguanaIR
%{python_sitearch}/*

%files firmware
%{_bindir}/iguanaIR-reflasher
%{_datadir}/iguanaIR-reflasher/


%changelog
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild

* Tue Jan 15 2013 Alec Leamas <leamas.alec@gmail.com> - 1.0.3-1
- Handle review  remarks:
-   Revert license to GPLv2 + LGPLv2,
-   Preserve timestamps, unowned dirs, missing Requires.

* Wed Jan 2 2013 Alec Leamas <leamas.alec@gmail.com> - 1.0.3-1
- Initial release based on work by Joseph Dunn, Jarod Wilson and
  Jason Tibbits in bug 642773
- Set license to GPLv2, can't find any LGPL files.