portage-overlay

personal portage ebuild repository
git clone anongit@rnpnr.xyz:portage-overlay.git
Log | Files | Refs | Feed | README

gnupg-2.5.20.ebuild (5512B)


      1 # Copyright 1999-2026 Gentoo Authors
      2 # Distributed under the terms of the GNU General Public License v2
      3 
      4 EAPI=8
      5 
      6 # Maintainers should:
      7 # 1. Join the "Gentoo" project at https://dev.gnupg.org/project/view/27/
      8 # 2. Subscribe to release tasks like https://dev.gnupg.org/T6159
      9 # (find the one for the current release then subscribe to it +
     10 # any subsequent ones linked within so you're covered for a while.)
     11 
     12 VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/gnupg.asc
     13 # in-source builds are not supported: https://dev.gnupg.org/T6313#166339
     14 inherit flag-o-matic out-of-source multiprocessing systemd toolchain-funcs verify-sig
     15 
     16 MY_P="${P/_/-}"
     17 
     18 DESCRIPTION="The GNU Privacy Guard, a GPL OpenPGP implementation"
     19 HOMEPAGE="https://gnupg.org/"
     20 SRC_URI="mirror://gnupg/gnupg/${MY_P}.tar.bz2"
     21 SRC_URI+=" verify-sig? ( mirror://gnupg/gnupg/${P}.tar.bz2.sig )"
     22 S="${WORKDIR}/${MY_P}"
     23 
     24 LICENSE="GPL-3+"
     25 SLOT="0"
     26 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~arm64-macos ~x64-macos ~x64-solaris"
     27 IUSE="+alternatives bzip2 doc ldap nls readline selinux +smartcard ssl test +tofu tpm tools usb user-socket wks-server"
     28 RESTRICT="!test? ( test )"
     29 REQUIRED_USE="test? ( tofu )"
     30 
     31 # Existence of executables is checked during configuration
     32 DEPEND="
     33 	>=dev-libs/libassuan-3.0.0-r1:=
     34 	>=dev-libs/libgcrypt-1.11.0:=
     35 	>=dev-libs/libgpg-error-1.56
     36 	>=dev-libs/libksba-1.6.3
     37 	>=dev-libs/npth-1.2
     38 	virtual/zlib:=
     39 	bzip2? ( app-arch/bzip2 )
     40 	ldap? ( net-nds/openldap:= )
     41 	readline? ( sys-libs/readline:0= )
     42 	smartcard? ( usb? ( virtual/libusb:1 ) )
     43 	tofu? ( >=dev-db/sqlite-3.27 )
     44 	tpm? ( >=app-crypt/tpm2-tss-2.4.0:= )
     45 	ssl? ( >=net-libs/gnutls-3.2:0= )
     46 "
     47 RDEPEND="
     48 	${DEPEND}
     49 	nls? ( virtual/libintl )
     50 	selinux? ( sec-policy/selinux-gpg )
     51 	wks-server? ( virtual/mta )
     52 "
     53 PDEPEND="
     54 	|| (
     55 		app-crypt/pinentry
     56 		app-crypt/pinentry-dmenu
     57 	)
     58 	alternatives? (
     59 		app-alternatives/gpg[-freepg(-)]
     60 	)
     61 "
     62 BDEPEND="
     63 	virtual/pkgconfig
     64 	doc? ( sys-apps/texinfo )
     65 	nls? ( sys-devel/gettext )
     66 	verify-sig? ( sec-keys/openpgp-keys-gnupg )
     67 "
     68 
     69 DOCS=(
     70 	ChangeLog NEWS README THANKS TODO VERSION
     71 	doc/FAQ doc/DETAILS doc/HACKING doc/TRANSLATE doc/OpenPGP doc/KEYSERVER
     72 )
     73 
     74 PATCHES=(
     75 	"${FILESDIR}"/${PN}-2.1.20-gpgscm-Use-shorter-socket-path-lengts-to-improve-tes.patch
     76 	"${FILESDIR}"/0002-Fix-stub-functions-to-avoid-LTO-linking-bugs-followup.patch
     77 )
     78 
     79 my_src_configure() {
     80 	local myconf=(
     81 		$(use_enable bzip2)
     82 		$(use_enable nls)
     83 		$(use_enable smartcard scdaemon)
     84 		$(use_enable ssl gnutls)
     85 		$(use_enable test all-tests)
     86 		$(use_enable test tests)
     87 		$(use_enable tofu)
     88 		$(use_enable tofu keyboxd)
     89 		$(use_enable tofu sqlite)
     90 		$(usex tpm '--with-tss=intel' '--disable-tpm2d')
     91 		$(use smartcard && use_enable usb ccid-driver || echo '--disable-ccid-driver')
     92 		$(use_enable wks-server wks-tools)
     93 		$(use_with ldap)
     94 		$(use_with readline)
     95 
     96 		# Hardcode mailprog to /usr/libexec/sendmail even if it does not exist.
     97 		# As of GnuPG 2.3, the mailprog substitution is used for the binary called
     98 		# by wks-client & wks-server; and if it's autodetected but not not exist at
     99 		# build time, then then 'gpg-wks-client --send' functionality will not
    100 		# work. This has an unwanted side-effect in stage3 builds: there was a
    101 		# [R]DEPEND on virtual/mta, which also brought in virtual/logger, bloating
    102 		# the build where the install guide previously make the user chose the
    103 		# logger & mta early in the install.
    104 		--with-mailprog=/usr/libexec/sendmail
    105 
    106 		--disable-ntbtls
    107 		--enable-gpgsm
    108 		--enable-large-secmem
    109 
    110 		CC_FOR_BUILD="$(tc-getBUILD_CC)"
    111 		GPGRT_CONFIG="${ESYSROOT}/usr/bin/${CHOST}-gpgrt-config"
    112 
    113 		$("${S}/configure" --help | grep -o -- '--without-.*-prefix')
    114 	)
    115 
    116 	if use prefix && use usb; then
    117 		# bug #649598
    118 		append-cppflags -I"${ESYSROOT}/usr/include/libusb-1.0"
    119 	fi
    120 
    121 	if [[ ${CHOST} == *-solaris* ]] ; then
    122 		# these somehow are treated as fatal, but Solaris has different
    123 		# types for getpeername with socket_t
    124 		append-flags -Wno-incompatible-pointer-types
    125 		append-flags -Wno-unused-label
    126 	fi
    127 
    128 	# bug #663142
    129 	if use user-socket; then
    130 		myconf+=( --enable-run-gnupg-user-socket )
    131 	fi
    132 
    133 	# glib fails and picks up clang's internal stdint.h causing weird errors
    134 	tc-is-clang && export gl_cv_absolute_stdint_h="${ESYSROOT}"/usr/include/stdint.h
    135 
    136 	econf "${myconf[@]}"
    137 }
    138 
    139 my_src_compile() {
    140 	default
    141 
    142 	use doc && emake -C doc html
    143 }
    144 
    145 my_src_test() {
    146 	export TESTFLAGS="--parallel=$(get_makeopts_jobs)"
    147 
    148 	default
    149 }
    150 
    151 my_src_install() {
    152 	emake DESTDIR="${D}" install
    153 
    154 	use tools && dobin tools/{gpgconf,gpgsplit,gpg-check-pattern} tools/make-dns-cert
    155 
    156 	if use alternatives; then
    157 		# rename for app-alternatives/gpg
    158 		mv "${ED}"/usr/bin/gpg{,-reference} || die
    159 		mv "${ED}"/usr/bin/gpgv{,-reference} || die
    160 		mv "${ED}"/usr/share/man/man1/gpg{,-reference}.1 || die
    161 		mv "${ED}"/usr/share/man/man1/gpgv{,-reference}.1 || die
    162 	else
    163 		dosym gpg /usr/bin/gpg2
    164 		dosym gpgv /usr/bin/gpgv2
    165 		echo ".so man1/gpg.1" > "${ED}"/usr/share/man/man1/gpg2.1 || die
    166 		echo ".so man1/gpgv.1" > "${ED}"/usr/share/man/man1/gpgv2.1 || die
    167 	fi
    168 
    169 	use doc && dodoc doc/gnupg.html/*
    170 }
    171 
    172 my_src_install_all() {
    173 	einstalldocs
    174 
    175 	use tools && dobin tools/{convert-from-106,mail-signed-keys,lspgpot}
    176 	use doc && dodoc doc/*.png
    177 }
    178 
    179 pkg_postinst() {
    180 	# If /usr/bin/gpg and /usr/bin/gpgv do not exist, provide them.
    181 	if [[ ! -e ${EROOT}/usr/bin/gpg ]]; then
    182 		ln -sf -- gpg-reference "${EROOT}"/usr/bin/gpg || die
    183 	fi
    184 
    185 	if [[ ! -e ${EROOT}/usr/bin/gpgv ]]; then
    186 		ln -sf -- gpgv-reference "${EROOT}"/usr/bin/gpgv || die
    187 	fi
    188 }