1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 PYTHON_COMPAT=( python3_{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-5[${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 )
73 use uinput && CONFIG_CHECK="~INPUT_UINPUT"
74 python-single-r1_pkg_setup
81 --localstatedir="${EPREFIX}/var" \
82 $(use_enable static-libs static) \
83 $(use_enable devinput) \
84 $(use_enable uinput) \
92 # lirc-setup requires gtk
93 rm "${ED%/}"/usr/bin/lirc-setup || die
96 newinitd "${FILESDIR}"/lircd-0.8.6-r2 lircd
97 newinitd "${FILESDIR}"/lircmd-0.9.4a-r2 lircmd
98 newconfd "${FILESDIR}"/lircd.conf.4 lircd
99 newconfd "${FILESDIR}"/lircmd-0.10.0.conf lircmd
101 insinto /etc/modprobe.d/
102 newins "${FILESDIR}"/modprobed.lirc lirc.conf
104 newinitd "${FILESDIR}"/irexec-initd-0.9.4a-r2 irexec
105 newconfd "${FILESDIR}"/irexec-confd irexec
108 if [[ -e "${ED%/}"/etc/lirc/lircd.conf ]]; then
109 newdoc "${ED%/}"/etc/lirc/lircd.conf lircd.conf.example
112 find "${ED}" -name '*.la' -delete || die
115 rm -d "${ED%/}"/var/run/lirc || die
116 rm -d "${ED%/}"/var/run || die
120 local dir="${EROOT%/}/etc/modprobe.d"
121 if [[ -a "${dir}"/lirc && ! -a "${dir}"/lirc.conf ]]; then
122 elog "Renaming ${dir}/lirc to lirc.conf"
123 mv -f "${dir}/lirc" "${dir}/lirc.conf" || die
126 # copy the first file that can be found
127 if [[ -f "${EROOT%/}"/etc/lirc/lircd.conf ]]; then
128 cp "${EROOT%/}"/etc/lirc/lircd.conf "${T}"/lircd.conf || die
129 elif [[ -f "${EROOT%/}"/etc/lircd.conf ]]; then
130 cp "${EROOT%/}"/etc/lircd.conf "${T}"/lircd.conf || die
131 MOVE_OLD_LIRCD_CONF=1
132 elif [[ -f "${ED%/}"/etc/lirc/lircd.conf ]]; then
133 cp "${ED%/}"/etc/lirc/lircd.conf "${T}"/lircd.conf || die
136 # stop portage from touching the config file
137 if [[ -e "${ED%/}"/etc/lirc/lircd.conf ]]; then
138 rm -f "${ED%/}"/etc/lirc/lircd.conf || die
143 # copy config file to new location
144 # without portage knowing about it
145 # so it will not delete it on unmerge or ever touch it again
146 if [[ -e "${T}"/lircd.conf ]]; then
147 cp "${T}"/lircd.conf "${EROOT%/}"/etc/lirc/lircd.conf || die
148 if [[ "$MOVE_OLD_LIRCD_CONF" = "1" ]]; then
149 elog "Moved /etc/lircd.conf to /etc/lirc/lircd.conf"
150 rm -f "${EROOT%/}"/etc/lircd.conf || die
154 einfo "The new default location for lircd.conf is inside of"
155 einfo "${EROOT%/}/etc/lirc/ directory"