sys-apps/irqbalance: arm64 keyworded (bug #721536)
[gentoo.git] / sys-apps / rng-tools / rng-tools-6.7-r1.ebuild
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 inherit autotools systemd readme.gentoo-r1 toolchain-funcs
7
8 DESCRIPTION="Daemon to use hardware random number generators"
9 HOMEPAGE="https://github.com/nhorman/rng-tools"
10 SRC_URI="https://github.com/nhorman/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
11
12 LICENSE="GPL-2"
13 SLOT="0"
14 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~ia64 ~mips ~ppc ~ppc64 ~riscv ~x86"
15 IUSE="jitterentropy nistbeacon pkcs11 selinux"
16
17 DEPEND="dev-libs/libgcrypt:0
18         dev-libs/libgpg-error
19         sys-fs/sysfsutils
20         jitterentropy? (
21                 app-crypt/jitterentropy:=
22         )
23         nistbeacon? (
24                 net-misc/curl[ssl]
25                 dev-libs/libxml2:2=
26                 dev-libs/openssl:0=
27         )
28         pkcs11? (
29                 dev-libs/libp11:=
30         )
31         elibc_musl? ( sys-libs/argp-standalone )
32 "
33 RDEPEND="${DEPEND}
34         selinux? ( sec-policy/selinux-rngd )"
35 DEPEND="${DEPEND}
36         nistbeacon? (
37                 virtual/pkgconfig
38         )
39 "
40
41 PATCHES=(
42         "${FILESDIR}"/test-for-argp.patch
43         "${FILESDIR}"/${PN}-5-fix-textrels-on-PIC-x86.patch #469962
44 )
45
46 src_prepare() {
47         echo 'bin_PROGRAMS = randstat' >> contrib/Makefile.am || die
48
49         # rngd_pkcs11.c needs to be linked against -lcrypto #684228
50         # See: https://github.com/nhorman/rng-tools/pull/61
51         if use pkcs11; then
52                 sed -e '/rngd_pkcs11.c$/ a rngd_LDADD\t+= -lcrypto' \
53                         -i Makefile.am || die
54         fi
55
56         default
57
58         mv README.md README || die
59
60         eautoreconf
61
62         sed -i '/^AR /d' Makefile.in || die
63         tc-export AR
64 }
65
66 src_configure() {
67         local myeconfargs=(
68                 $(use_enable jitterentropy)
69                 $(use_with nistbeacon)
70                 $(use_with pkcs11)
71         )
72
73         econf "${myeconfargs[@]}"
74 }
75
76 src_install() {
77         default
78         newinitd "${FILESDIR}"/rngd-initd-6.7-r1 rngd
79         newconfd "${FILESDIR}"/rngd-confd-6.7 rngd
80         systemd_dounit "${FILESDIR}"/rngd.service
81
82         if use pkcs11; then
83                 local DISABLE_AUTOFORMATTING=1
84                 local DOC_CONTENTS="
85 The PKCS11 entropy source may require extra packages (e.g. 'dev-libs/opensc')
86 to support various smartcard readers. Make sure 'PKCS11_OPTIONS' in:
87         '${EROOT%/}/etc/conf.d/rngd'
88 reflects the correct PKCS11 engine path to be used by rngd.
89 "
90                 readme.gentoo_create_doc
91         fi
92
93 }
94
95 pkg_postinst() {
96         use pkcs11 && readme.gentoo_print_elog
97 }