qemu: fix a build race condition

qemu will depend on pam if libpam is present. However, there is a
time-of-check to time-of-use issue in meson, qemu's build system. Meson
will hardcode the exact location and version of libpam at configure
time. If libpam is reinstalled sometime after configure and before
build, the recorded location and version of libpam may be invalid at
build time and the qemu build will fail. We can address this by listing
pam as a dependency of qemu, meaning that pam will be installed before
qemu if they appear in the same depgraph.

This change is already upstream:
https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4da484b352e21676d7e0b13c5aa54db2a69c8271
so we will not regress when we upgrade qemu.

BUG=b/177367546
TEST=presubmit
RELEASE_NOTE=None

Change-Id: Ic5931c666cb0e5f00bb6f91632c1dd55857db4a9
Reviewed-on: https://cos-review.googlesource.com/c/third_party/overlays/portage-stable/+/29881
Tested-by: Cusky Presubmit Bot <presubmit@cos-infra-prod.iam.gserviceaccount.com>
Reviewed-by: Dexter Rivera <riverade@google.com>
diff --git a/app-emulation/qemu/qemu-5.2.0-r51.ebuild b/app-emulation/qemu/qemu-5.2.0-r51.ebuild
index db31eb7..fc8fb2c 100644
--- a/app-emulation/qemu/qemu-5.2.0-r51.ebuild
+++ b/app-emulation/qemu/qemu-5.2.0-r51.ebuild
@@ -37,7 +37,7 @@
 	+fdt glusterfs gnutls gtk infiniband iscsi io-uring
 	jack jemalloc +jpeg kernel_linux
 	kernel_FreeBSD lzo multipath
-	ncurses nfs nls numa opengl +oss +pin-upstream-blobs
+	ncurses nfs nls numa opengl +oss pam +pin-upstream-blobs
 	plugins +png pulseaudio python rbd sasl +seccomp sdl sdl-image selinux
 	+slirp
 	smartcard snappy spice ssh static static-user systemtap test udev usb
@@ -141,6 +141,7 @@
 		media-libs/mesa[static-libs(+)]
 		media-libs/mesa[egl,gbm]
 	)
+	pam? ( sys-libs/pam )
 	png? ( media-libs/libpng:0=[static-libs(+)] )
 	pulseaudio? ( media-sound/pulseaudio )
 	rbd? ( sys-cluster/ceph )
@@ -432,6 +433,7 @@
 		$(use_enable debug debug-tcg)
 		$(use_enable doc docs)
 		$(use_enable nls gettext)
+		$(use_enable pam auth-pam)
 		$(use_enable plugins)
 		$(use_enable xattr attr)
 	)