1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 PYTHON_COMPAT=( python3_{5,6,7} )
8 inherit eutils flag-o-matic linux-info python-single-r1 systemd xdg-utils
10 DESCRIPTION="decode and send infra-red signals of many commonly used remote controls"
11 HOMEPAGE="http://www.lirc.org/"
13 LIRC_DRIVER_DEVICE="/dev/lirc0"
17 if [[ "${PV/_pre/}" = "${PV}" ]]; then
18 SRC_URI="mirror://sourceforge/lirc/${MY_P}.tar.bz2"
20 SRC_URI="http://www.lirc.org/software/snapshots/${MY_P}.tar.bz2"
25 KEYWORDS="~amd64 ~arm64 ~ppc ~ppc64 x86"
26 IUSE="audio +devinput doc ftdi gtk inputlirc static-libs systemd +uinput usb X"
29 ${PYTHON_REQUIRED_USE}
33 S="${WORKDIR}/${MY_P}"
38 >media-libs/portaudio-18
41 dev-python/pyyaml[${PYTHON_USEDEP}]
42 ftdi? ( dev-embedded/libftdi:0 )
43 systemd? ( sys-apps/systemd )
44 usb? ( virtual/libusb:0 )
55 dev-python/setuptools[${PYTHON_USEDEP}]
56 doc? ( app-doc/doxygen )
58 sys-kernel/linux-headers
64 x11-libs/vte[introspection]
65 dev-python/pygobject[${PYTHON_USEDEP}]
67 inputlirc? ( app-misc/inputlircd )
71 "${FILESDIR}/${P}-unsafe-load.patch"
77 use uinput && CONFIG_CHECK="~INPUT_UINPUT"
78 python-single-r1_pkg_setup
85 --localstatedir="${EPREFIX}/var" \
86 $(use_enable static-libs static) \
87 $(use_enable devinput) \
88 $(use_enable uinput) \
96 # lirc-setup requires gtk
97 rm "${ED%/}"/usr/bin/lirc-setup || die
100 newinitd "${FILESDIR}"/lircd-0.8.6-r2 lircd
101 newinitd "${FILESDIR}"/lircmd-0.9.4a-r2 lircmd
102 newconfd "${FILESDIR}"/lircd.conf.4 lircd
103 newconfd "${FILESDIR}"/lircmd-0.10.0.conf lircmd
105 insinto /etc/modprobe.d/
106 newins "${FILESDIR}"/modprobed.lirc lirc.conf
108 newinitd "${FILESDIR}"/irexec-initd-0.9.4a-r2 irexec
109 newconfd "${FILESDIR}"/irexec-confd irexec
112 if [[ -e "${ED%/}"/etc/lirc/lircd.conf ]]; then
113 newdoc "${ED%/}"/etc/lirc/lircd.conf lircd.conf.example
116 find "${ED}" -name '*.la' -delete || die
119 rm -d "${ED%/}"/var/run/lirc || die
120 rm -d "${ED%/}"/var/run || die
124 local dir="${EROOT%/}/etc/modprobe.d"
125 if [[ -a "${dir}"/lirc && ! -a "${dir}"/lirc.conf ]]; then
126 elog "Renaming ${dir}/lirc to lirc.conf"
127 mv -f "${dir}/lirc" "${dir}/lirc.conf" || die
130 # copy the first file that can be found
131 if [[ -f "${EROOT%/}"/etc/lirc/lircd.conf ]]; then
132 cp "${EROOT%/}"/etc/lirc/lircd.conf "${T}"/lircd.conf || die
133 elif [[ -f "${EROOT%/}"/etc/lircd.conf ]]; then
134 cp "${EROOT%/}"/etc/lircd.conf "${T}"/lircd.conf || die
135 MOVE_OLD_LIRCD_CONF=1
136 elif [[ -f "${ED%/}"/etc/lirc/lircd.conf ]]; then
137 cp "${ED%/}"/etc/lirc/lircd.conf "${T}"/lircd.conf || die
140 # stop portage from touching the config file
141 if [[ -e "${ED%/}"/etc/lirc/lircd.conf ]]; then
142 rm -f "${ED%/}"/etc/lirc/lircd.conf || die
147 # copy config file to new location
148 # without portage knowing about it
149 # so it will not delete it on unmerge or ever touch it again
150 if [[ -e "${T}"/lircd.conf ]]; then
151 cp "${T}"/lircd.conf "${EROOT%/}"/etc/lirc/lircd.conf || die
152 if [[ "$MOVE_OLD_LIRCD_CONF" = "1" ]]; then
153 elog "Moved /etc/lircd.conf to /etc/lirc/lircd.conf"
154 rm -f "${EROOT%/}"/etc/lircd.conf || die
158 einfo "The new default location for lircd.conf is inside of"
159 einfo "${EROOT%/}/etc/lirc/ directory"