sys-apps/fd: bump to 8.1.1
[gentoo.git] / sys-apps / pcsc-lite / pcsc-lite-1.8.25-r1.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5
6 PYTHON_COMPAT=( python{3_6,3_7,3_8} )
7
8 inherit python-single-r1 systemd udev multilib-minimal
9
10 DESCRIPTION="PC/SC Architecture smartcard middleware library"
11 HOMEPAGE="https://pcsclite.apdu.fr https://github.com/LudovicRousseau/PCSC"
12
13 SRC_URI="https://pcsclite.apdu.fr/files/${P}.tar.bz2"
14
15 # GPL-2 is there for the init script; everything else comes from
16 # upstream.
17 LICENSE="BSD ISC MIT GPL-3+ GPL-2"
18 SLOT="0"
19 KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ppc ppc64 s390 sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos"
20
21 # This is called libusb so that it doesn't fool people in thinking that
22 # it is _required_ for USB support. Otherwise they'll disable udev and
23 # that's going to be worse.
24 IUSE="libusb policykit selinux systemd +udev"
25
26 REQUIRED_USE="^^ ( udev libusb ) ${PYTHON_REQUIRED_USE}"
27
28 # No dependencies need the MULTILIB_DEPS because the libraries are actually
29 # standalone, the deps are only needed for the daemon itself.
30 DEPEND="libusb? ( virtual/libusb:1 )
31         udev? ( virtual/udev )
32         policykit? ( >=sys-auth/polkit-0.111 )
33         acct-group/openct
34         acct-group/pcscd
35         acct-user/pcscd
36         ${PYTHON_DEPS}"
37
38 RDEPEND="${DEPEND}
39         selinux? ( sec-policy/selinux-pcscd )"
40
41 BDEPEND="virtual/pkgconfig"
42
43 PATCHES=(
44         "${FILESDIR}"/${PN}-1.8.11-polkit-pcscd.patch
45 )
46
47 DOCS=( AUTHORS HELP README SECURITY ChangeLog )
48
49 pkg_setup() {
50         python-single-r1_pkg_setup
51 }
52
53 multilib_src_configure() {
54         ECONF_SOURCE="${S}" econf \
55                 --disable-maintainer-mode \
56                 --enable-usbdropdir="${EPREFIX}/usr/$(get_libdir)/readers/usb" \
57                 --enable-ipcdir=/run/pcscd \
58                 --with-systemdsystemunitdir="$(systemd_get_systemunitdir)" \
59                 $(multilib_native_use_enable systemd  libsystemd) \
60                 $(multilib_native_use_enable udev libudev) \
61                 $(multilib_native_use_enable libusb) \
62                 $(multilib_native_use_enable policykit polkit)
63 }
64
65 multilib_src_install_all() {
66         einstalldocs
67
68         newinitd "${FILESDIR}"/pcscd-init.7 pcscd
69
70         if use udev; then
71                 exeinto "$(get_udevdir)"
72                 newexe "${FILESDIR}"/pcscd-udev pcscd.sh
73
74                 insinto "$(get_udevdir)"/rules.d
75                 newins "${FILESDIR}"/99-pcscd-hotplug-r1.rules 99-pcscd-hotplug.rules
76         fi
77
78         python_fix_shebang "${ED}"/usr/bin/pcsc-spy
79 }
80
81 pkg_postinst() {
82         elog "Starting from version 1.6.5, pcsc-lite will start as user nobody in"
83         elog "the pcscd group, to avoid running as root."
84         elog ""
85         elog "This also means you need the newest drivers available so that the"
86         elog "devices get the proper owner."
87         elog ""
88         elog "Furthermore, a conf.d file is no longer installed by default, as"
89         elog "the default configuration does not require one. If you need to"
90         elog "pass further options to pcscd, create a file and set the"
91         elog "EXTRA_OPTS variable."
92         elog ""
93         if use udev; then
94                 elog "Hotplug support is provided by udev rules."
95                 elog "When using OpenRC you additionally need to tell it to hotplug"
96                 elog "pcscd by setting this variable in /etc/rc.conf:"
97                 elog ""
98                 elog "    rc_hotplug=\"pcscd\""
99         fi
100 }