|
| 1 | +# Copyright 1999-2023 Gentoo Authors |
| 2 | +# Distributed under the terms of the GNU General Public License v2 |
| 3 | + |
| 4 | +EAPI=8 |
| 5 | + |
| 6 | +VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/libsodium.minisig |
| 7 | +VERIFY_SIG_METHOD=minisig |
| 8 | +inherit autotools multilib-minimal verify-sig |
| 9 | + |
| 10 | +DESCRIPTION="Portable fork of NaCl, a higher-level cryptographic library" |
| 11 | +HOMEPAGE="https://libsodium.org" |
| 12 | + |
| 13 | +if [[ ${PV} == *_p* ]] ; then |
| 14 | + MY_P=${PN}-$(ver_cut 1-3)-stable-$(ver_cut 5-) |
| 15 | + |
| 16 | + # We use _pN to represent 'stable releases' |
| 17 | + # These are backports from upstream to the last release branch |
| 18 | + # See https://download.libsodium.org/libsodium/releases/README.html |
| 19 | + SRC_URI=" |
| 20 | + https://dev.gentoo.org/~sam/distfiles/${CATEGORY}/${PN}/${MY_P}.tar.gz -> ${P}.tar.gz |
| 21 | + verify-sig? ( https://dev.gentoo.org/~sam/distfiles/dev-libs/libsodium/${MY_P}.tar.gz.minisig -> ${P}.tar.gz.minisig ) |
| 22 | + " |
| 23 | +else |
| 24 | + SRC_URI=" |
| 25 | + https://download.libsodium.org/${PN}/releases/${P}.tar.gz |
| 26 | + verify-sig? ( https://download.libsodium.org/${PN}/releases/${P}.tar.gz.minisig ) |
| 27 | + " |
| 28 | +fi |
| 29 | + |
| 30 | +S="${WORKDIR}"/${PN}-stable |
| 31 | + |
| 32 | +LICENSE="ISC" |
| 33 | +SLOT="0/23" |
| 34 | +KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~arm64-macos ~x64-macos" |
| 35 | +IUSE="+asm minimal static-libs +urandom" |
| 36 | + |
| 37 | +CPU_USE=( cpu_flags_x86_{aes,sse4_1} ) |
| 38 | +IUSE+=" ${CPU_USE[@]}" |
| 39 | + |
| 40 | +BDEPEND=" verify-sig? ( sec-keys/minisig-keys-libsodium )" |
| 41 | + |
| 42 | +PATCHES=( |
| 43 | + "${FILESDIR}"/${PN}-1.0.10-cpuflags.patch |
| 44 | +) |
| 45 | + |
| 46 | +src_prepare() { |
| 47 | + default |
| 48 | + |
| 49 | + eautoreconf |
| 50 | +} |
| 51 | + |
| 52 | +multilib_src_configure() { |
| 53 | + local myeconfargs=( |
| 54 | + $(use_enable asm) |
| 55 | + $(use_enable cpu_flags_x86_aes aesni) |
| 56 | + $(use_enable cpu_flags_x86_sse4_1 sse4_1) |
| 57 | + $(use_enable minimal) |
| 58 | + $(use_enable static-libs static) |
| 59 | + $(use_enable !urandom blocking-random) |
| 60 | + ) |
| 61 | + |
| 62 | + # --disable-pie is needed on x86, see bug #512734 |
| 63 | + # TODO: Check if still needed? |
| 64 | + if [[ ${ABI} == x86 ]] ; then |
| 65 | + myeconfargs+=( --disable-pie ) |
| 66 | + fi |
| 67 | + |
| 68 | + ECONF_SOURCE="${S}" econf "${myeconfargs[@]}" |
| 69 | +} |
| 70 | + |
| 71 | +multilib_src_install_all() { |
| 72 | + default |
| 73 | + find "${ED}" -type f -name "*.la" -delete || die |
| 74 | +} |
0 commit comments