portage-overlay

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

gnupg-2.2.41.ebuild (5602B)


      1 # Copyright 1999-2023 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="${BROOT}"/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 ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
     27 IUSE="bzip2 doc ldap nls readline selinux +smartcard ssl test tofu tools usb user-socket wks-server"
     28 RESTRICT="!test? ( test )"
     29 
     30 # Existence of executables is checked during configuration.
     31 # Note: On each bump, update dep bounds on each version from configure.ac!
     32 DEPEND="
     33 	>=dev-libs/libassuan-2.5.0
     34 	>=dev-libs/libgcrypt-1.8.0:=
     35 	>=dev-libs/libgpg-error-1.29
     36 	>=dev-libs/libksba-1.3.5
     37 	>=dev-libs/npth-1.2
     38 	>=net-misc/curl-7.10
     39 	sys-libs/zlib
     40 	bzip2? ( app-arch/bzip2 )
     41 	ldap? ( net-nds/openldap:= )
     42 	readline? ( sys-libs/readline:= )
     43 	smartcard? ( usb? ( virtual/libusb:1 ) )
     44 	ssl? ( >=net-libs/gnutls-3.0:= )
     45 	tofu? ( >=dev-db/sqlite-3.7 )
     46 "
     47 RDEPEND="
     48 	${DEPEND}
     49 	|| (
     50 		app-crypt/pinentry
     51 		app-crypt/pinentry-dmenu
     52 	)
     53 	nls? ( virtual/libintl )
     54 	selinux? ( sec-policy/selinux-gpg )
     55 	wks-server? ( virtual/mta )
     56 "
     57 BDEPEND="
     58 	virtual/pkgconfig
     59 	doc? ( sys-apps/texinfo )
     60 	nls? ( sys-devel/gettext )
     61 	verify-sig? ( sec-keys/openpgp-keys-gnupg )
     62 "
     63 
     64 DOCS=(
     65 	ChangeLog NEWS README THANKS TODO VERSION
     66 	doc/FAQ doc/DETAILS doc/HACKING doc/TRANSLATE doc/OpenPGP doc/KEYSERVER
     67 )
     68 
     69 PATCHES=(
     70 	"${FILESDIR}"/${PN}-2.1.20-gpgscm-Use-shorter-socket-path-lengts-to-improve-tes.patch
     71 )
     72 
     73 src_prepare() {
     74 	default
     75 
     76 	# Inject SSH_AUTH_SOCK into user's sessions after enabling gpg-agent-ssh.socket in systemctl --user mode,
     77 	# idea borrowed from libdbus, see
     78 	#   https://gitlab.freedesktop.org/dbus/dbus/-/blob/master/bus/systemd-user/dbus.socket.in#L6
     79 	#
     80 	# This cannot be upstreamed, as it requires determining the exact prefix of 'systemctl',
     81 	# which in turn requires discovery in Autoconf, something that upstream deeply resents.
     82 	sed -e "/DirectoryMode=/a ExecStartPost=-${EPREFIX}/bin/systemctl --user set-environment SSH_AUTH_SOCK=%t/gnupg/S.gpg-agent.ssh" \
     83 		-i doc/examples/systemd-user/gpg-agent-ssh.socket || die
     84 }
     85 
     86 my_src_configure() {
     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 smartcard && use_enable usb ccid-driver || echo '--disable-ccid-driver')
     96 		$(use_enable wks-server wks-tools)
     97 		$(use_with ldap)
     98 		$(use_with readline)
     99 
    100 		# Hardcode mailprog to /usr/libexec/sendmail even if it does not exist.
    101 		# As of GnuPG 2.3, the mailprog substitution is used for the binary called
    102 		# by wks-client & wks-server; and if it's autodetected but not not exist at
    103 		# build time, then then 'gpg-wks-client --send' functionality will not
    104 		# work. This has an unwanted side-effect in stage3 builds: there was a
    105 		# [R]DEPEND on virtual/mta, which also brought in virtual/logger, bloating
    106 		# the build where the install guide previously make the user chose the
    107 		# logger & mta early in the install.
    108 		--with-mailprog=/usr/libexec/sendmail
    109 
    110 		--disable-ntbtls
    111 		--enable-gpg
    112 		--enable-gpgsm
    113 		--enable-large-secmem
    114 
    115 		CC_FOR_BUILD="$(tc-getBUILD_CC)"
    116 		GPG_ERROR_CONFIG="${ESYSROOT}/usr/bin/${CHOST}-gpg-error-config"
    117 		KSBA_CONFIG="${ESYSROOT}/usr/bin/ksba-config"
    118 		LIBASSUAN_CONFIG="${ESYSROOT}/usr/bin/libassuan-config"
    119 		LIBGCRYPT_CONFIG="${ESYSROOT}/usr/bin/${CHOST}-libgcrypt-config"
    120 		NPTH_CONFIG="${ESYSROOT}/usr/bin/npth-config"
    121 
    122 		$("${S}/configure" --help | grep -o -- '--without-.*-prefix')
    123 	)
    124 
    125 	if use prefix && use usb; then
    126 		# bug #649598
    127 		append-cppflags -I"${ESYSROOT}/usr/include/libusb-1.0"
    128 	fi
    129 
    130 	# bug #663142
    131 	if use user-socket; then
    132 		myconf+=( --enable-run-gnupg-user-socket )
    133 	fi
    134 
    135 	# glib fails and picks up clang's internal stdint.h causing weird errors
    136 	tc-is-clang && export gl_cv_absolute_stdint_h="${ESYSROOT}"/usr/include/stdint.h
    137 
    138 	econf "${myconf[@]}"
    139 }
    140 
    141 my_src_compile() {
    142 	default
    143 
    144 	use doc && emake -C doc html
    145 }
    146 
    147 my_src_test() {
    148 	export TESTFLAGS="--parallel=$(makeopts_jobs)"
    149 
    150 	default
    151 }
    152 
    153 my_src_install() {
    154 	emake DESTDIR="${D}" install
    155 
    156 	use tools && dobin \
    157 		tools/{gpg-zip,gpgconf,gpgsplit,gpg-check-pattern} \
    158 		tools/make-dns-cert
    159 
    160 	dosym gpg /usr/bin/gpg2
    161 	dosym gpgv /usr/bin/gpgv2
    162 	echo ".so man1/gpg.1" > "${ED}"/usr/share/man/man1/gpg2.1 || die
    163 	echo ".so man1/gpgv.1" > "${ED}"/usr/share/man/man1/gpgv2.1 || die
    164 
    165 	dodir /etc/env.d
    166 	echo "CONFIG_PROTECT=/usr/share/gnupg/qualified.txt" >> "${ED}"/etc/env.d/30gnupg || die
    167 
    168 	use doc && dodoc doc/gnupg.html/*
    169 }
    170 
    171 my_src_install_all() {
    172 	einstalldocs
    173 
    174 	use tools && dobin tools/{convert-from-106,mail-signed-keys,lspgpot}
    175 
    176 	use doc && dodoc doc/*.png
    177 
    178 	systemd_douserunit doc/examples/systemd-user/*.{service,socket}
    179 }