Thu Jan 25 15:15:13 2024 UTC (123d)
emulators/qemu: deactivate user mode on too-old Linux

This checks if MAP_FIXED_NOREPLACE is available in libc headers and only
enables linux-user targets if there, avoiding inevitable build failure.

This is relevant for CentOS 7.9, ubuntu 18. May be phased out in some years,
I presume, or once the main qemu targets also stop working.


(thor)
diff -r1.332 -r1.333 pkgsrc/emulators/qemu/Makefile
diff -r0 -r1.1 pkgsrc/emulators/qemu/files/linux-user-test.h

cvs diff -r1.332 -r1.333 pkgsrc/emulators/qemu/Makefile (expand / switch to unified diff)

--- pkgsrc/emulators/qemu/Makefile 2023/12/28 17:15:39 1.332
+++ pkgsrc/emulators/qemu/Makefile 2024/01/25 15:15:13 1.333
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: Makefile,v 1.332 2023/12/28 17:15:39 adam Exp $ 1# $NetBSD: Makefile,v 1.333 2024/01/25 15:15:13 thor Exp $
2 2
3DISTNAME= qemu-8.2.0 3DISTNAME= qemu-8.2.0
4CATEGORIES= emulators 4CATEGORIES= emulators
5MASTER_SITES= https://download.qemu.org/ 5MASTER_SITES= https://download.qemu.org/
6EXTRACT_SUFX= .tar.xz 6EXTRACT_SUFX= .tar.xz
7 7
8MAINTAINER= pkgsrc-users@NetBSD.org 8MAINTAINER= pkgsrc-users@NetBSD.org
9HOMEPAGE= https://www.qemu.org/ 9HOMEPAGE= https://www.qemu.org/
10COMMENT= CPU emulator using dynamic translation 10COMMENT= CPU emulator using dynamic translation
11LICENSE= gnu-gpl-v2 AND gnu-lgpl-v2.1 AND mit AND modified-bsd 11LICENSE= gnu-gpl-v2 AND gnu-lgpl-v2.1 AND mit AND modified-bsd
12 12
13TOOL_DEPENDS+= meson-[0-9]*:../../devel/meson 13TOOL_DEPENDS+= meson-[0-9]*:../../devel/meson
14TOOL_DEPENDS+= ninja-build-[0-9]*:../../devel/ninja-build 14TOOL_DEPENDS+= ninja-build-[0-9]*:../../devel/ninja-build
@@ -122,27 +122,34 @@ CONFIGURE_ARGS+= --disable-bsd-user @@ -122,27 +122,34 @@ CONFIGURE_ARGS+= --disable-bsd-user
122. else 122. else
123CONFIGURE_ARGS+= --enable-bsd-user 123CONFIGURE_ARGS+= --enable-bsd-user
124USER_EMUL= i386 x86_64 124USER_EMUL= i386 x86_64
125. endif 125. endif
126.elif ${OPSYS:M*BSD} || ${OPSYS} == "DragonFly" 126.elif ${OPSYS:M*BSD} || ${OPSYS} == "DragonFly"
127USER_EMUL= i386 x86_64 127USER_EMUL= i386 x86_64
128PLIST.ga= yes 128PLIST.ga= yes
129PLIST.nbd= yes 129PLIST.nbd= yes
130.elif ${OPSYS} == "Darwin" 130.elif ${OPSYS} == "Darwin"
131USER_EMUL= 131USER_EMUL=
132CONFIGURE_ARGS+= --disable-bsd-user 132CONFIGURE_ARGS+= --disable-bsd-user
133PLIST.nbd= yes 133PLIST.nbd= yes
134.elif ${OPSYS} == "Linux" 134.elif ${OPSYS} == "Linux"
 135# Help this package to build on systems too old for user-mode code.
 136HAVE_LINUX_USER!= ${CPP} ${CPPFLAGS} ${FILESDIR}/linux-user-test.h \
 137 >/dev/null 2>&1 && echo yes || echo no
 138. if ${HAVE_LINUX_USER} != "yes"
 139CONFIGURE_ARGS+= --disable-linux-user
 140. else
135USER_EMUL= ${UE_ARCHS} 141USER_EMUL= ${UE_ARCHS}
 142. endif
136PLIST.bridge-helper= yes 143PLIST.bridge-helper= yes
137PLIST.ga= yes 144PLIST.ga= yes
138PLIST.nbd= yes 145PLIST.nbd= yes
139PLIST.pr-helper= yes 146PLIST.pr-helper= yes
140.elif ${MACHINE_PLATFORM:MSunOS-5.11-*} 147.elif ${MACHINE_PLATFORM:MSunOS-5.11-*}
141PLIST.ga= yes 148PLIST.ga= yes
142PLIST.nbd= yes 149PLIST.nbd= yes
143CONFIGURE_ARGS+= --disable-coroutine-pool 150CONFIGURE_ARGS+= --disable-coroutine-pool
144.endif 151.endif
145 152
146PLIST_VARS+= plugins 153PLIST_VARS+= plugins
147.if ${OPSYS} != "SunOS" 154.if ${OPSYS} != "SunOS"
148PLIST.plugins= yes 155PLIST.plugins= yes

File Added: pkgsrc/emulators/qemu/files/linux-user-test.h
/* Qemu 8+ needs MAP_FIXED_NOREPLACE for linux user-mode emulation.
   They offically do not support systems that are too old (glibc
   version), but we're trying to build the rest, anyway. */
#include <sys/mman.h>
#ifndef MAP_FIXED_NOREPLACE
#error "Your libc is too old."
#endif