sys-apps/fd: bump to 8.1.1
[gentoo.git] / sys-apps / pcsc-lite / pcsc-lite-1.8.26.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="doc embedded 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                 $(use_enable doc documentation) \
60                 $(multilib_native_use_enable embedded) \
61                 $(multilib_native_use_enable systemd  libsystemd) \
62                 $(multilib_native_use_enable udev libudev) \
63                 $(multilib_native_use_enable libusb) \
64                 $(multilib_native_use_enable policykit polkit)
65 }
66
67 multilib_src_install_all() {
68         einstalldocs
69
70         newinitd "${FILESDIR}"/pcscd-init.7 pcscd
71
72         if use udev; then
73                 exeinto "$(get_udevdir)"
74                 newexe "${FILESDIR}"/pcscd-udev pcscd.sh
75
76                 insinto "$(get_udevdir)"/rules.d
77                 newins "${FILESDIR}"/99-pcscd-hotplug-r1.rules 99-pcscd-hotplug.rules
78         fi
79
80         python_fix_shebang "${ED}"/usr/bin/pcsc-spy
81 }
82
83 pkg_postinst() {
84         elog "Starting from version 1.6.5, pcsc-lite will start as user nobody in"
85         elog "the pcscd group, to avoid running as root."
86         elog ""
87         elog "This also means you need the newest drivers available so that the"
88         elog "devices get the proper owner."
89         elog ""
90         elog "Furthermore, a conf.d file is no longer installed by default, as"
91         elog "the default configuration does not require one. If you need to"
92         elog "pass further options to pcscd, create a file and set the"
93         elog "EXTRA_OPTS variable."
94         elog ""
95         if use udev; then
96                 elog "Hotplug support is provided by udev rules."
97                 elog "When using OpenRC you additionally need to tell it to hotplug"
98                 elog "pcscd by setting this variable in /etc/rc.conf:"
99                 elog ""
100                 elog "    rc_hotplug=\"pcscd\""
101         fi
102 }