diff --git a/emulators/qemu-devel/Makefile b/emulators/qemu-devel/Makefile index 16bd4f7a9ad3..58c4617a073f 100644 --- a/emulators/qemu-devel/Makefile +++ b/emulators/qemu-devel/Makefile @@ -1,173 +1,176 @@ PORTNAME= qemu DISTVERSION= 10.1.20251130 PORTREVISION= 1 CATEGORIES= emulators PKGNAMESUFFIX= -devel DIST_SUBDIR= qemu/${PORTVERSION} MAINTAINER= bofh@FreeBSD.org COMMENT= QEMU CPU Emulator - development version WWW= https://www.qemu.org/ LICENSE= GPLv2 ONLY_FOR_ARCHS= amd64 powerpc powerpc64 powerpc64 powerpc64le BUILD_DEPENDS= sphinx-build:textproc/py-sphinx \ ${PYTHON_PKGNAMEPREFIX}sphinx_rtd_theme>0:textproc/py-sphinx_rtd_theme@${PY_FLAVOR} \ bash:shells/bash LIB_DEPENDS= libepoxy.so:graphics/libepoxy \ libinotify.so:devel/libinotify \ liblzo2.so:archivers/lzo2 \ libzstd.so:archivers/zstd \ libslirp.so:net/libslirp USES= bison compiler:c11 cpe gmake gnome iconv:wchar_t localbase:ldflags \ - ninja perl5 pkgconfig python:build shebangfix tar:xz xorg + ninja:build perl5 pkgconfig python:build shebangfix tar:xz xorg USE_GITLAB= yes GL_ACCOUNT= qemu-project GL_TAGNAME= 9ef49528b5286f078061b52ac41e0ca19fa10e36 GL_TUPLE= qemu-project:keycodemapdb:f5772a62ec52591ff6870b7e8ef32482371f22c6:keycodemapdb/subprojects/keycodemapdb \ qemu-project:dtc:b6910bec11614980a21e46fbccc35934b671bd81:dtc/subprojects/dtc \ qemu-project:libvfio-user:0b28d205572c80b568a1003db2c8f37ca333e4d7:libvfio/subprojects/libvfio-user \ qemu-project:meson:29fa2050bc8f0e19a7079a7c8c7da40c5e1b7b8e:meson/meson \ qemu-project:berkeley-softfloat-3:b64af41c3276f97f0e181920400ee056b9c88037:berkeleysoftfloat3/subprojects/berkeley-softfloat-3 \ qemu-project:berkeley-testfloat-3:e7af9751d9f9fd3b47911f51a5cfd08af256a9ab:berkeleytestfloat3/subprojects/berkeley-testfloat-3 USE_GNOME= cairo glib20 USE_PERL5= build -USE_PYTHON= distutils noflavors USE_XORG= pixman SHEBANG_FILES= scripts/xml-preprocess.py HAS_CONFIGURE= yes CONFIGURE_ARGS= --localstatedir=/var --mandir=share/man --extra-ldflags=-L\"/usr/lib\" \ --extra-ldflags=-L\"${LOCALBASE}/lib\" --enable-debug \ --prefix=${PREFIX} --cc=${CC} --enable-netmap --disable-kvm \ --disable-linux-user --disable-linux-aio --disable-xen \ --enable-debug-info --python=${PYTHON_CMD} --disable-guest-agent \ --extra-cflags=-I${WRKSRC}\ -I${LOCALBASE}/include\ -DPREFIX=\\\"\"${PREFIX}\\\"\" CFLAGS:= ${CFLAGS:C/-fno-tree-vrp//} WITHOUT_CPU_CFLAGS=yes #to avoid problems with register allocation BINARY_ALIAS= python3=${PYTHON_VERSION} PORTDOCS= .buildinfo _static/* about/* dbus-dbusindex.html devel/* \ docs genindex.html glossary.html index.html interop/* \ objects.inv qapi-qga-index.html qapi-qmp-index.html \ qapi-qsd-index.html search.html searchindex.js specs/* system/* \ tools/* user/* OPTIONS_DEFINE= SAMBA X11 GTK3 OPENGL GNUTLS SASL JPEG PNG CURL VDE \ CDROM_DMA USBREDIR X86_TARGETS STATIC_LINK DOCS CAPSTONE OPTIONS_DEFAULT=X11 GTK3 OPENGL GNUTLS SASL JPEG PNG CDROM_DMA CURL NCURSES_DEFAULT VDE \ CAPSTONE OPTIONS_SINGLE= NCURSES OPTIONS_SINGLE_NCURSES= NCURSES_DEFAULT NCURSES_BASE NCURSES_PORT OPTIONS_SUB= yes CAPSTONE_DESC= Disassembly framework support CDROM_DMA_DESC= IDE CDROM DMA GNUTLS_DESC= gnutls dependency (vnc encryption) JPEG_DESC= jpeg dependency (vnc lossy compression) NCURSES_BASE_DESC= Depend on ncurses in base NCURSES_DEFAULT_DESC= Depend on ncurses (ports if installed, otherwise base) NCURSES_PORT_DESC= Depend on devel/ncurses in ports PNG_DESC= png dependency (vnc compression) SAMBA_DESC= samba dependency (for -smb) SASL_DESC= cyrus-sasl dependency (vnc encryption) STATIC_LINK_DESC= Statically link the executables USBREDIR_DESC= usb device network redirection (experimental!) VDE_DESC= vde dependency (for vde networking) X86_TARGETS_DESC= Build only x86 system targets CAPSTONE_LIB_DEPENDS= libcapstone.so:devel/capstone CAPSTONE_CONFIGURE_ON= --enable-capstone --extra-cflags=-I${LOCALBASE}/include/capstone CAPSTONE_CONFIGURE_OFF= --disable-capstone CURL_LIB_DEPENDS= libcurl.so:ftp/curl CURL_CONFIGURE_OFF= --disable-curl DOCS_USES= makeinfo DOCS_CONFIGURE_ENABLE= docs GNUTLS_LIB_DEPENDS= libgnutls.so:security/gnutls GNUTLS_CONFIGURE_OFF= --disable-gnutls GTK3_LIB_DEPENDS= libxkbcommon.so:x11/libxkbcommon GTK3_USES= gettext gl GTK3_USE= GNOME=gdkpixbuf,vte3 XORG=x11,xext GTK3_CONFIGURE_OFF= --disable-gtk --disable-vte JPEG_USES= jpeg JPEG_CONFIGURE_OFF= --disable-vnc-jpeg NCURSES_BASE_USES= ncurses:base NCURSES_DEFAULT_USES= ncurses NCURSES_PORT_USES= ncurses:port OPENGL_USES= gl OPENGL_USE= GL=gbm OPENGL_CONFIGURE_OFF= --disable-opengl PNG_LIB_DEPENDS= libpng16.so:graphics/png PNG_CONFIGURE_OFF= --disable-vnc-png SAMBA_USES= samba:run # smbd SAMBA_CONFIGURE_ON= --smbd=${LOCALBASE}/sbin/smbd SASL_CONFIGURE_OFF= --disable-vnc-sasl STATIC_LINK_PREVENTS= GTK3 X11 STATIC_LINK_PREVENTS_MSG= X11 ui cannot be built static STATIC_LINK_CONFIGURE_ON= --static USBREDIR_BUILD_DEPENDS= usbredir>=0.6:net/usbredir USBREDIR_RUN_DEPENDS= usbredir>=0.6:net/usbredir USBREDIR_CONFIGURE_OFF= --disable-usb-redir VDE_CONFIGURE_OFF= --disable-vde X11_USES= sdl X11_USE= SDL=sdl2 XORG=x11,xext GNOME=gdkpixbuf X11_CONFIGURE_ENABLE= sdl .include .if !defined(STRIP) || ${STRIP} == "" CONFIGURE_ARGS+=--disable-strip .endif .if ${ARCH} == "amd64" MAKE_ARGS+= ARCH=x86_64 .endif .if ${ARCH} == "powerpc" CFLAGS+= -D_CALL_SYSV MAKE_ARGS+= ARCH=ppc USE_GCC= yes .endif .if ${ARCH:Mpowerpc64*} CONFIGURE_ARGS+= --disable-bsd-user MAKE_ARGS+= ARCH=ppc64 PLIST_SUB+= BSDUSER="@comment " .else PLIST_SUB+= BSDUSER="" .endif PLIST_SUB+= LINUXBOOT_DMA="" post-extract: ${CP} ${WRKSRC}/subprojects/packagefiles/berkeley-softfloat-3/* \ ${WRKSRC}/subprojects/berkeley-softfloat-3/ ${CP} ${WRKSRC}/subprojects/packagefiles/berkeley-testfloat-3/* \ ${WRKSRC}/subprojects/berkeley-testfloat-3/ post-patch-CDROM_DMA-off: @${REINPLACE_CMD} -e '/USE_DMA_CDROM/d' ${WRKSRC}/include/hw/ide/internal.h do-build: - cd ${WRKSRC} && ${GMAKE} +# Don't build with -j, because the development branch of QEMU regresses from time to time + cd ${WRKSRC} && ${SETENVI} ${WRK_ENV} ${GMAKE} do-install: - cd ${WRKSRC} && ${SETENV} DESTDIR=${STAGEDIR} ${GMAKE} install + cd ${WRKSRC} && ${SETENVI} ${WRK_ENV} DESTDIR=${STAGEDIR} ${GMAKE} install .if !target(post-install) post-install: ${INSTALL_SCRIPT} ${FILESDIR}/qemu-ifup.sample ${STAGEDIR}${PREFIX}/etc ${INSTALL_SCRIPT} ${FILESDIR}/qemu-ifdown.sample ${STAGEDIR}${PREFIX}/etc @${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/qemu-* post-install-DOCS-on: @(cd ${WRKSRC} && ${COPYTREE_SHARE} docs ${STAGEDIR}${DOCSDIR}/) .endif +do-test: + cd ${WRKSRC} && ${SETENVI} ${WRK_ENV} ${GMAKE} test + .include diff --git a/emulators/qemu-devel/files/patch-tests_functional_qemu__test_____init____.py b/emulators/qemu-devel/files/patch-tests_functional_qemu__test_____init____.py new file mode 100644 index 000000000000..ece7c08f4235 --- /dev/null +++ b/emulators/qemu-devel/files/patch-tests_functional_qemu__test_____init____.py @@ -0,0 +1,11 @@ +--- tests/functional/qemu_test/__init__.py.orig 2025-11-25 22:22:39 UTC ++++ tests/functional/qemu_test/__init__.py +@@ -16,7 +16,7 @@ from .decorators import skipIfMissingCommands, skipIfN + from .decorators import skipIfMissingCommands, skipIfNotMachine, \ + skipFlakyTest, skipUntrustedTest, skipBigDataTest, skipSlowTest, \ + skipIfMissingImports, skipIfOperatingSystem, skipLockedMemoryTest, \ +- skipIfMissingEnv ++ skipIfMissingEnv, skipIfInsideFreeBSDJail + from .archive import archive_extract + from .uncompress import uncompress + from .gdb import GDB diff --git a/emulators/qemu-devel/files/patch-tests_functional_qemu__test_decorators.py b/emulators/qemu-devel/files/patch-tests_functional_qemu__test_decorators.py new file mode 100644 index 000000000000..d5901a0da1a2 --- /dev/null +++ b/emulators/qemu-devel/files/patch-tests_functional_qemu__test_decorators.py @@ -0,0 +1,35 @@ +--- tests/functional/qemu_test/decorators.py.orig 2025-11-25 22:22:39 UTC ++++ tests/functional/qemu_test/decorators.py +@@ -6,6 +6,7 @@ import resource + import os + import platform + import resource ++import subprocess + from unittest import skipIf, skipUnless + + from .cmd import which +@@ -165,3 +166,24 @@ def skipLockedMemoryTest(locked_memory): + ulimit_memory == resource.RLIM_INFINITY or ulimit_memory >= locked_memory * 1024, + f'Test required {locked_memory} kB of available locked memory', + ) ++ ++def skipIfInsideFreeBSDJail(): ++ ''' ++ Decorator to skip execution in a FreeBSD jail ++ ++ @skipIfInsideFreeBSDJail() ++ ''' ++ jailed = False ++ try: ++ result = subprocess.run( ++ ['sysctl', '-n', 'security.jail.jailed'], ++ capture_output=True, ++ text=True, ++ check=True ++ ) ++ jailed = result.stdout.strip() == '1' ++ except Exception: ++ pass ++ ++ return skipIf(platform.system() == 'FreeBSD' and jailed, ++ 'running inside the FreeBSD jail') diff --git a/emulators/qemu-devel/files/patch-tests_functional_x86__64_test__memlock.py b/emulators/qemu-devel/files/patch-tests_functional_x86__64_test__memlock.py new file mode 100644 index 000000000000..135f238fa18c --- /dev/null +++ b/emulators/qemu-devel/files/patch-tests_functional_x86__64_test__memlock.py @@ -0,0 +1,18 @@ +--- tests/functional/x86_64/test_memlock.py.orig 2025-11-25 22:22:39 UTC ++++ tests/functional/x86_64/test_memlock.py +@@ -14,13 +14,14 @@ from qemu_test import QemuSystemTest + from typing import Dict + + from qemu_test import QemuSystemTest +-from qemu_test import skipLockedMemoryTest ++from qemu_test import skipLockedMemoryTest, skipIfInsideFreeBSDJail + + + STATUS_VALUE_PATTERN = re.compile(r'^(\w+):\s+(\d+) kB', re.MULTILINE) + + + @skipLockedMemoryTest(2_097_152) # 2GB ++@skipIfInsideFreeBSDJail() + class MemlockTest(QemuSystemTest): + """ + Runs a guest with memlock options.