dev-libs/opencryptoki: readd s390 keyword
[gentoo.git] / dev-libs / opencryptoki / opencryptoki-3.4.1.ebuild
1 # Copyright 1999-2018 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI="5"
5
6 inherit autotools multilib flag-o-matic user
7
8 DESCRIPTION="PKCS#11 provider cryptographic hardware"
9 HOMEPAGE="https://sourceforge.net/projects/opencryptoki"
10 SRC_URI="mirror://sourceforge/opencryptoki/${PV}/${PN}-v${PV}.tgz"
11
12 # Upstream is looking into relicensing it into CPL-1.0 entirely; the CCA
13 # token sources are under CPL-1.0 already.
14 LICENSE="CPL-0.5"
15 SLOT="0"
16 KEYWORDS="~amd64 ~arm ~s390 ~x86"
17 IUSE="debug libressl +tpm"
18
19 RDEPEND="tpm? ( app-crypt/trousers )
20         !libressl? ( dev-libs/openssl:0= )
21         libressl? ( dev-libs/libressl:0= )"
22 DEPEND="${RDEPEND}"
23
24 S="${WORKDIR}/${PN}"
25
26 # tests right now basically don't exist; the only available thing would
27 # test against an installed copy and would kill a running pcscd, all
28 # things that we're not interested to.
29 RESTRICT=test
30
31 pkg_setup() {
32         enewgroup pkcs11
33 }
34
35 src_prepare() {
36         mv configure.in configure.ac || die
37         eautoreconf
38 }
39
40 src_configure() {
41         # package uses ${localstatedir}/lib as the default path, so if we
42         # leave it to econf, it'll create /var/lib/lib.
43
44         # Since upstream by default seem to enable any possible token, even
45         # when they don't seem to be used, we limit ourselves to the
46         # software emulation token (swtok) and if the user enabled the tpm
47         # USE flag, tpmtok.  The rest of the tokens seem to be hardware- or
48         # software-dependent even when they build fine without their
49         # requirements, but until somebody asks for those, I'd rather not
50         # enable them.
51
52         # We don't use --enable-debug because that tinkers with the CFLAGS
53         # and we don't want that. Instead we append -DDEBUG which enables
54         # debug information.
55         use debug && append-flags -DDEBUG
56
57         econf \
58                 --localstatedir=/var \
59                 --enable-fast-install \
60                 --disable-dependency-tracking \
61                 --disable-debug \
62                 --enable-daemon \
63                 --enable-library \
64                 --disable-icatok \
65                 --enable-swtok \
66                 $(use_enable tpm tpmtok) \
67                 --disable-ccatok
68 }
69
70 src_install() {
71         emake install DESTDIR="${ED}"
72
73         # Install libopencryptoki in the standard directory for libraries.
74         mv "${D}"/usr/$(get_libdir)/opencryptoki/libopencryptoki.so* "${D}"/usr/$(get_libdir) || die
75         rm "${D}"/usr/$(get_libdir)/pkcs11/libopencryptoki.so
76         dosym ../libopencryptoki.so /usr/$(get_libdir)/pkcs11/libopencryptoki.so
77
78         # Remove compatibility symlinks as we _never_ required those and
79         # they seem unused even upstream.
80         find "${D}" -name 'PKCS11_*' -delete
81
82         # doesn't use libltdl; only dlopen()-based interfaces
83         find "${D}" -name '*.la' -delete
84
85         # We replace their ld.so and init files (mostly designed for RedHat
86         # as far as I can tell) with our own replacements.
87         rm -rf "${D}"/etc/ld.so.conf.d "${D}"/etc/rc.d
88
89         # make sure that we don't modify the init script if the USE flags
90         # are enabled for the needed services.
91         cp "${FILESDIR}"/pkcsslotd.init.2 "${T}"/pkcsslotd.init
92         use tpm || sed -i -e '/use tcsd/d' "${T}"/pkcsslotd.init
93         newinitd "${T}/pkcsslotd.init" pkcsslotd
94
95         # We create /var dirs at runtime as needed, so don't bother installing
96         # our own.
97         rm -r "${D}"/var/{lib,lock} || die
98
99         dodoc README AUTHORS FAQ TODO doc/openCryptoki-HOWTO.pdf
100 }