portage-overlay

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

gnupg-2.5.13-r1.ebuild (5501B)


      1 # Copyright 1999-2025 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 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-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 # Note: On each bump, update dep bounds on each version from configure.ac!
     33 DEPEND="
     34 	>=dev-libs/libassuan-3.0.0:=
     35 	>=dev-libs/libgcrypt-1.11.0:=
     36 	>=dev-libs/libgpg-error-1.56
     37 	>=dev-libs/libksba-1.6.3
     38 	>=dev-libs/npth-1.2
     39 	sys-libs/zlib
     40 	bzip2? ( app-arch/bzip2 )
     41 	ldap? ( net-nds/openldap:= )
     42 	readline? ( sys-libs/readline:0= )
     43 	smartcard? ( usb? ( virtual/libusb:1 ) )
     44 	tofu? ( >=dev-db/sqlite-3.27 )
     45 	tpm? ( >=app-crypt/tpm2-tss-2.4.0:= )
     46 	ssl? ( >=net-libs/gnutls-3.2:0= )
     47 "
     48 RDEPEND="
     49 	${DEPEND}
     50 	nls? ( virtual/libintl )
     51 	selinux? ( sec-policy/selinux-gpg )
     52 	wks-server? ( virtual/mta )
     53 "
     54 PDEPEND="
     55 	|| (
     56 		app-crypt/pinentry
     57 		app-crypt/pinentry-dmenu
     58 	)
     59 	alternatives? (
     60 		app-alternatives/gpg[-freepg(-)]
     61 	)
     62 "
     63 BDEPEND="
     64 	virtual/pkgconfig
     65 	doc? ( sys-apps/texinfo )
     66 	nls? ( sys-devel/gettext )
     67 	verify-sig? ( sec-keys/openpgp-keys-gnupg )
     68 "
     69 
     70 DOCS=(
     71 	ChangeLog NEWS README THANKS TODO VERSION
     72 	doc/FAQ doc/DETAILS doc/HACKING doc/TRANSLATE doc/OpenPGP doc/KEYSERVER
     73 )
     74 
     75 PATCHES=(
     76 	"${FILESDIR}"/${PN}-2.1.20-gpgscm-Use-shorter-socket-path-lengts-to-improve-tes.patch
     77 )
     78 
     79 src_prepare() {
     80 	default
     81 }
     82 
     83 my_src_configure() {
     84 	# Upstream don't support LTO, bug #854222.
     85 	filter-lto
     86 
     87 	local myconf=(
     88 		$(use_enable bzip2)
     89 		$(use_enable nls)
     90 		$(use_enable smartcard scdaemon)
     91 		$(use_enable ssl gnutls)
     92 		$(use_enable test all-tests)
     93 		$(use_enable test tests)
     94 		$(use_enable tofu)
     95 		$(use_enable tofu keyboxd)
     96 		$(use_enable tofu sqlite)
     97 		$(usex tpm '--with-tss=intel' '--disable-tpm2d')
     98 		$(use smartcard && use_enable usb ccid-driver || echo '--disable-ccid-driver')
     99 		$(use_enable wks-server wks-tools)
    100 		$(use_with ldap)
    101 		$(use_with readline)
    102 
    103 		# Hardcode mailprog to /usr/libexec/sendmail even if it does not exist.
    104 		# As of GnuPG 2.3, the mailprog substitution is used for the binary called
    105 		# by wks-client & wks-server; and if it's autodetected but not not exist at
    106 		# build time, then then 'gpg-wks-client --send' functionality will not
    107 		# work. This has an unwanted side-effect in stage3 builds: there was a
    108 		# [R]DEPEND on virtual/mta, which also brought in virtual/logger, bloating
    109 		# the build where the install guide previously make the user chose the
    110 		# logger & mta early in the install.
    111 		--with-mailprog=/usr/libexec/sendmail
    112 
    113 		--disable-ntbtls
    114 		--enable-gpgsm
    115 		--enable-large-secmem
    116 
    117 		CC_FOR_BUILD="$(tc-getBUILD_CC)"
    118 		GPGRT_CONFIG="${ESYSROOT}/usr/bin/${CHOST}-gpgrt-config"
    119 
    120 		$("${S}/configure" --help | grep -o -- '--without-.*-prefix')
    121 	)
    122 
    123 	if use prefix && use usb; then
    124 		# bug #649598
    125 		append-cppflags -I"${ESYSROOT}/usr/include/libusb-1.0"
    126 	fi
    127 
    128 	if [[ ${CHOST} == *-solaris* ]] ; then
    129 		# https://dev.gnupg.org/T7368
    130 		export ac_cv_should_define__xopen_source=yes
    131 	fi
    132 
    133 	# bug #663142
    134 	if use user-socket; then
    135 		myconf+=( --enable-run-gnupg-user-socket )
    136 	fi
    137 
    138 	# glib fails and picks up clang's internal stdint.h causing weird errors
    139 	tc-is-clang && export gl_cv_absolute_stdint_h="${ESYSROOT}"/usr/include/stdint.h
    140 
    141 	econf "${myconf[@]}"
    142 }
    143 
    144 my_src_compile() {
    145 	default
    146 
    147 	use doc && emake -C doc html
    148 }
    149 
    150 my_src_test() {
    151 	export TESTFLAGS="--parallel=$(makeopts_jobs)"
    152 
    153 	default
    154 }
    155 
    156 my_src_install() {
    157 	emake DESTDIR="${D}" install
    158 
    159 	use tools && dobin tools/{gpgconf,gpgsplit,gpg-check-pattern} tools/make-dns-cert
    160 
    161 	if use alternatives; then
    162 		# rename for app-alternatives/gpg
    163 		mv "${ED}"/usr/bin/gpg{,-reference} || die
    164 		mv "${ED}"/usr/bin/gpgv{,-reference} || die
    165 	else
    166 		dosym gpg /usr/bin/gpg2
    167 		dosym gpgv /usr/bin/gpgv2
    168 	fi
    169 
    170 	echo ".so man1/gpg.1" > "${ED}"/usr/share/man/man1/gpg2.1 || die
    171 	echo ".so man1/gpgv.1" > "${ED}"/usr/share/man/man1/gpgv2.1 || die
    172 
    173 	dodir /etc/env.d
    174 	echo "CONFIG_PROTECT=/usr/share/gnupg/qualified.txt" >> "${ED}"/etc/env.d/30gnupg || die
    175 
    176 	use doc && dodoc doc/gnupg.html/*
    177 }
    178 
    179 my_src_install_all() {
    180 	einstalldocs
    181 
    182 	use tools && dobin tools/{convert-from-106,mail-signed-keys,lspgpot}
    183 	use doc && dodoc doc/*.png
    184 }
    185 
    186 pkg_postinst() {
    187 	# If /usr/bin/gpg and /usr/bin/gpgv do not exist, provide them.
    188 	if [[ ! -e ${EROOT}/usr/bin/gpg ]]; then
    189 		ln -sf -- gpg-reference "${EROOT}"/usr/bin/gpg || die
    190 	fi
    191 
    192 	if [[ ! -e ${EROOT}/usr/bin/gpgv ]]; then
    193 		ln -sf -- gpgv-reference "${EROOT}"/usr/bin/gpgv || die
    194 	fi
    195 }