Gentoo Archives: gentoo-commits

From: Mike Gilbert <floppym@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-libs/libgcrypt/
Date: Thu, 03 Nov 2022 17:15:36
Message-Id: 1667495727.de066d5fb12b05d52a21734b41cb07ed7cf64966.floppym@gentoo
1 commit: de066d5fb12b05d52a21734b41cb07ed7cf64966
2 Author: Mike Gilbert <floppym <AT> gentoo <DOT> org>
3 AuthorDate: Thu Nov 3 17:14:24 2022 +0000
4 Commit: Mike Gilbert <floppym <AT> gentoo <DOT> org>
5 CommitDate: Thu Nov 3 17:15:27 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=de066d5f
7
8 dev-libs/libgcrypt: pass --enable-random=auto to configure
9
10 This allows should provide support for old kernels that do not support
11 the getrandom syscall.
12
13 Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>
14
15 dev-libs/libgcrypt/libgcrypt-1.10.1-r3.ebuild | 132 ++++++++++++++++++++++++++
16 1 file changed, 132 insertions(+)
17
18 diff --git a/dev-libs/libgcrypt/libgcrypt-1.10.1-r3.ebuild b/dev-libs/libgcrypt/libgcrypt-1.10.1-r3.ebuild
19 new file mode 100644
20 index 000000000000..7f0ecf84ac1b
21 --- /dev/null
22 +++ b/dev-libs/libgcrypt/libgcrypt-1.10.1-r3.ebuild
23 @@ -0,0 +1,132 @@
24 +# Copyright 1999-2022 Gentoo Authors
25 +# Distributed under the terms of the GNU General Public License v2
26 +
27 +EAPI=7
28 +
29 +VERIFY_SIG_OPENPGP_KEY_PATH="${BROOT}"/usr/share/openpgp-keys/gnupg.asc
30 +inherit autotools flag-o-matic multilib-minimal toolchain-funcs verify-sig
31 +
32 +DESCRIPTION="General purpose crypto library based on the code used in GnuPG"
33 +HOMEPAGE="https://www.gnupg.org/"
34 +SRC_URI="mirror://gnupg/${PN}/${P}.tar.bz2"
35 +SRC_URI+=" verify-sig? ( mirror://gnupg/${PN}/${P}.tar.bz2.sig )"
36 +
37 +LICENSE="LGPL-2.1 MIT"
38 +SLOT="0/20" # subslot = soname major version
39 +KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
40 +IUSE="+asm cpu_flags_arm_neon cpu_flags_arm_aes cpu_flags_arm_sha1 cpu_flags_arm_sha2 cpu_flags_ppc_altivec cpu_flags_ppc_vsx2 cpu_flags_ppc_vsx3 cpu_flags_x86_aes cpu_flags_x86_avx cpu_flags_x86_avx2 cpu_flags_x86_padlock cpu_flags_x86_sha cpu_flags_x86_sse4_1 doc static-libs"
41 +
42 +# Build system only has --disable-arm-crypto-support right now
43 +# If changing this, update src_configure logic too.
44 +# ARM CPUs seem to, right now, support all-or-nothing for crypto extensions,
45 +# but this looks like it might change in future. This is just a safety check
46 +# in case people somehow do have a CPU which only supports some. They must
47 +# for now disable them all if that's the case.
48 +REQUIRED_USE="
49 + cpu_flags_arm_aes? ( cpu_flags_arm_sha1 cpu_flags_arm_sha2 )
50 + cpu_flags_arm_sha1? ( cpu_flags_arm_aes cpu_flags_arm_sha2 )
51 + cpu_flags_arm_sha2? ( cpu_flags_arm_aes cpu_flags_arm_sha1 )
52 + cpu_flags_ppc_vsx3? ( cpu_flags_ppc_altivec cpu_flags_ppc_vsx2 )
53 + cpu_flags_ppc_vsx2? ( cpu_flags_ppc_altivec )
54 +"
55 +
56 +RDEPEND=">=dev-libs/libgpg-error-1.25[${MULTILIB_USEDEP}]"
57 +DEPEND="${RDEPEND}"
58 +BDEPEND="doc? ( virtual/texi2dvi )
59 + verify-sig? ( sec-keys/openpgp-keys-gnupg )"
60 +
61 +PATCHES=(
62 + "${FILESDIR}"/${PN}-multilib-syspath.patch
63 + "${FILESDIR}"/${PN}-powerpc-darwin.patch
64 + "${FILESDIR}"/${PN}-1.10.1-fix-no-asm-hppa.patch
65 + "${FILESDIR}"/${PN}-1.9.4-no-fgrep-libgcrypt-config.patch
66 +)
67 +
68 +MULTILIB_CHOST_TOOLS=(
69 + /usr/bin/libgcrypt-config
70 +)
71 +
72 +src_prepare() {
73 + default
74 + eautoreconf
75 +}
76 +
77 +multilib_src_configure() {
78 + if [[ ${CHOST} == *86*-solaris* ]] ; then
79 + # ASM code uses GNU ELF syntax, divide in particular, we need to
80 + # allow this via ASFLAGS, since we don't have a flag-o-matic
81 + # function for that, we'll have to abuse cflags for this
82 + append-cflags -Wa,--divide
83 + fi
84 +
85 + if [[ ${CHOST} == powerpc* ]] ; then
86 + # ./configure does a lot of automagic, prevent that
87 + # generic ppc32+ppc64 altivec
88 + use cpu_flags_ppc_altivec || local -x gcry_cv_cc_ppc_altivec=no
89 + use cpu_flags_ppc_altivec || local -x gcry_cv_cc_ppc_altivec_cflags=no
90 + # power8 vector extension, aka arch 2.07 ISA, also checked below via ppc-crypto-support
91 + use cpu_flags_ppc_vsx2 || local -x gcry_cv_gcc_inline_asm_ppc_altivec=no
92 + # power9 vector extension, aka arch 3.00 ISA
93 + use cpu_flags_ppc_vsx3 || local -x gcry_cv_gcc_inline_asm_ppc_arch_3_00=no
94 + fi
95 +
96 + # Workaround for GCC < 11.3 bug
97 + # https://git.gnupg.org/cgi-bin/gitweb.cgi?p=libgcrypt.git;a=commitdiff;h=0b399721ce9709ae25f9d2050360c5ab2115ae29
98 + # https://dev.gnupg.org/T5581
99 + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102124
100 + if use arm64 && tc-is-gcc && (($(gcc-major-version) == 11)) && (($(gcc-minor-version) <= 2)) && (($(gcc-micro-version) == 0)) ; then
101 + append-flags -fno-tree-loop-vectorize
102 + fi
103 +
104 + local myeconfargs=(
105 + CC_FOR_BUILD="$(tc-getBUILD_CC)"
106 +
107 + --enable-noexecstack
108 + $(use_enable cpu_flags_arm_neon neon-support)
109 + # See REQUIRED_USE comment above
110 + $(use_enable cpu_flags_arm_aes arm-crypto-support)
111 + $(use_enable cpu_flags_ppc_vsx2 ppc-crypto-support)
112 + $(use_enable cpu_flags_x86_aes aesni-support)
113 + $(use_enable cpu_flags_x86_avx avx-support)
114 + $(use_enable cpu_flags_x86_avx2 avx2-support)
115 + $(use_enable cpu_flags_x86_padlock padlock-support)
116 + $(use_enable cpu_flags_x86_sha shaext-support)
117 + $(use_enable cpu_flags_x86_sse4_1 sse41-support)
118 + # required for sys-power/suspend[crypt], bug 751568
119 + $(use_enable static-libs static)
120 +
121 + # Build all "random" modules, allow selection at runtime.
122 + --enable-random=auto
123 +
124 + # disabled due to various applications requiring privileges
125 + # after libgcrypt drops them (bug #468616)
126 + --without-capabilities
127 +
128 + # http://trac.videolan.org/vlc/ticket/620
129 + $([[ ${CHOST} == *86*-darwin* ]] && echo "--disable-asm")
130 + # causes bus-errors on sparc64-solaris
131 + $([[ ${CHOST} == sparcv9-*-solaris* ]] && echo "--disable-asm")
132 +
133 + $(use asm || echo "--disable-asm")
134 +
135 + GPG_ERROR_CONFIG="${ESYSROOT}/usr/bin/${CHOST}-gpg-error-config"
136 + )
137 +
138 + ECONF_SOURCE="${S}" econf "${myeconfargs[@]}" \
139 + $("${S}/configure" --help | grep -o -- '--without-.*-prefix')
140 +}
141 +
142 +multilib_src_compile() {
143 + default
144 + multilib_is_native_abi && use doc && VARTEXFONTS="${T}/fonts" emake -C doc gcrypt.pdf
145 +}
146 +
147 +multilib_src_install() {
148 + emake DESTDIR="${D}" install
149 + multilib_is_native_abi && use doc && dodoc doc/gcrypt.pdf
150 +}
151 +
152 +multilib_src_install_all() {
153 + default
154 + find "${ED}" -type f -name '*.la' -delete || die
155 +}