[BACK]Return to Makefile CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / pkgsrc / emulators / qemu

File: [cvs.NetBSD.org] / pkgsrc / emulators / qemu / Makefile (download)

Revision 1.291, Thu Dec 16 12:59:43 2021 UTC (5 months, 1 week ago) by tnn
Branch: MAIN
CVS Tags: pkgsrc-2021Q4-base, pkgsrc-2021Q4
Changes since 1.290: +5 -5 lines

qemu: update to 6.2.0

Tested on NetBSD-current/amd64 w/nvmm and macOS/aarch64 w/hvf.

pkgsrc note: Recent upstream changes seem to have unintentionally broken the
NetBSD usermode emulation. User-mode emulation is thus disabled until someone
fixes this. Hint: see qemu/bsd-user/freebsd commits by M. Warner Losh.

Changes:

m68k
  Improved support for Apple's Nubus, including the ability to load
    declaration ROMs and slot IRQ support
  The macfb framebuffer device now supports the same video modes found
  on a real Quadra 800
Arm
  On macOS hosts with Apple Silicon CPUs we now support the 'hvf'
    accelerator for running AArch64 guests
  M-profile CPUs now emulate trapping on division by zero via CCR.DIV_0_TRP
  The pl011 UART model now supports sending 'break'
  The Fujitsu A64FX processor model is now supported in TCG ('-cpu a64fx')
  The M-profile MVE extension is now supported, and enabled in the Cortex-M55
  The deprecated machine names 'raspi2' and 'raspi3' have been removed;
    use 'raspi2b' and 'raspi3b' instead
  The 'virt' machine now supports an emulated ITS
  New machine type: kudo-bmc
  The xlnx-zcu102 and xlnx-versal-virt machines now support
    BBRAM and eFUSE devices
  The 'virt' machine now supports more than 123 CPUs in TCG emulation mode
  The pl031 real-time clock device now supports sending RTC_CHANGE QMP events
PowerPC
  Improved POWER10 support for the 'powernv' machine
  Initial support for POWER10 DD2.0 CPU added
  Added support for FORM2 PAPR NUMA descriptions in the "pseries" machine type
RISC-V
  Add Zb[abcs] instruction support
  Remove RVB support
  Fixup virt flash node
  Don't override users supplied ISA version
  Fixup some CSR accesses
  Fix an overflow in the SiFive CLINT
  ePMP CSR address updates
  SiFive PWM support
  Support for RISC-V ACLINT
  Support vhost-user and numa mem options on all boards
  mstatus.SD bug fix for hypervisor extensions
  OpenTitan fix for USB dev address
  OpenTitan update to latest bitstream build
  Remove the Ibex PLIC
  Bug fix of setting mstatus_hs.[SD|FS] bits
  Fixes for sifive PDMA
  Mark shakti_c as not user creatable
  Add support for the experimental J extension
  Update the fmin/fmax handling
s390x
  Improved storage key emulation
  New gen16 CPU features are now enabled automatically
SPARC
  Fix for booting sun4m machines with more than 1 CPU
x86
  New Snowridge-v4 CPU model, with split-lock-detect feature disabled
KVM
  Support for SGX in the virtual machine
  New "hv-apicv" CPU property (aliased to "hv-avic")
AMD SEV
  Measured launch with direct kernel boot is now possible
virtio
  QEMU now fully supports guest memory dumps with virtio-mem.
  QEMU now cleanly supports precopy/postcopy migration & background snapshots
9pfs
  Fixed an occasional crash when handling 'Twalk' requests
  Fixed sub-optimal I/O performance on guest
QMP
  New event DEVICE_UNPLUG_GUEST_ERROR
Block device backends and tools
  qemu-nbd now defaults to writeback caching
  qemu-nbd now has a --selinux-label option for Unix socket label
TCG
  plugins now have a bool arg parsing helper and cleaned up argument syntax
  the cache plugin is now multi-core aware

# $NetBSD: Makefile,v 1.291 2021/12/16 12:59:43 tnn Exp $

DISTNAME=	qemu-6.2.0
CATEGORIES=	emulators
MASTER_SITES=	https://download.qemu.org/
EXTRACT_SUFX=	.tar.xz

MAINTAINER=	pkgsrc-users@NetBSD.org
HOMEPAGE=	http://www.qemu-project.org/
COMMENT=	CPU emulator using dynamic translation
LICENSE=	gnu-gpl-v2 AND gnu-lgpl-v2.1 AND mit AND modified-bsd

TOOL_DEPENDS+=	ninja-build-[0-9]*:../../devel/ninja-build

USE_CURSES=		resize_term wide
USE_LANGUAGES+=		c c++
USE_TOOLS+=		bison flex makeinfo perl:build pod2man pkg-config
UNLIMIT_RESOURCES=	datasize
HAS_CONFIGURE=		yes

# https://github.com/qemu/qemu/commit/56208a0d473c6db263cc333c787ca48b502d72ab
GCC_REQD+=		7

PYTHON_VERSIONED_DEPENDENCIES=	sphinx:tool
BUILD_DEPENDS+=		${PYPKGPREFIX}-sphinx-rtd-theme>=0.4.3:../../textproc/py-sphinx-rtd-theme

SUBST_CLASSES+=			sphinx-build
SUBST_STAGE.sphinx-build=	pre-configure
SUBST_MESSAGE.sphinx-build=	Fix hardcoded sphinx-build
SUBST_FILES.sphinx-build+=	configure
SUBST_FILES.sphinx-build+=	docs/meson.build
SUBST_FILES.sphinx-build+=	roms/skiboot/doc/Makefile
SUBST_FILES.sphinx-build+=	roms/u-boot/doc/Makefile
SUBST_SED.sphinx-build+=	-e 's/sphinx-build/sphinx-build-${PYVERSSUFFIX}/g'

.include "options.mk"

.include "../../mk/bsd.prefs.mk"

# When upgrading Qemu, you need to determine if this PALcode binary for
# the Alpha emulator needs to be re-built.  If it does not, then you do
# not need to bump the version of this PALcode binary blob (which is
# supplied as a separate distfile).  Contact thorpej@ for details.
PALCODE_CLIPPER=	palcode-clipper-qemu-5.2.0nb8

DISTFILES=		${DEFAULT_DISTFILES}
DISTFILES+=		${PALCODE_CLIPPER}
SITES.${PALCODE_CLIPPER}= http://ftp.NetBSD.org/pub/NetBSD/arch/alpha/qemu/

CONFIGURE_ARGS+=	--prefix=${PREFIX}
CONFIGURE_ARGS+=	--interp-prefix=${PREFIX}/share/qemu
CONFIGURE_ARGS+=	--sysconfdir=${PKG_SYSCONFDIR}
CONFIGURE_ARGS+=	--python=${PYTHONBIN}
CONFIGURE_ARGS+=	--smbd=${PREFIX}/sbin/smbd
CONFIGURE_ARGS+=	--mandir=${PREFIX}/${PKGMANDIR}
CONFIGURE_ARGS+=	--enable-curses
CONFIGURE_ARGS+=	--enable-docs
CONFIGURE_ARGS+=	--enable-jemalloc
CONFIGURE_ENV+=		mansuffix=/${PKGMANDIR}

.if defined(PKGSRC_USE_SSP)
# do not add flags to everything
PKGSRC_USE_SSP=		no
CONFIGURE_ARGS+=	--enable-stack-protector
.endif

NOT_PAX_MPROTECT_SAFE+=	bin/qemu-system-aarch64
NOT_PAX_MPROTECT_SAFE+=	bin/qemu-system-alpha
NOT_PAX_MPROTECT_SAFE+=	bin/qemu-system-arm
NOT_PAX_MPROTECT_SAFE+=	bin/qemu-system-cris
NOT_PAX_MPROTECT_SAFE+=	bin/qemu-system-hppa
NOT_PAX_MPROTECT_SAFE+=	bin/qemu-system-i386
NOT_PAX_MPROTECT_SAFE+=	bin/qemu-system-m68k
NOT_PAX_MPROTECT_SAFE+=	bin/qemu-system-microblaze
NOT_PAX_MPROTECT_SAFE+=	bin/qemu-system-microblazeel
NOT_PAX_MPROTECT_SAFE+=	bin/qemu-system-mips
NOT_PAX_MPROTECT_SAFE+=	bin/qemu-system-mips64
NOT_PAX_MPROTECT_SAFE+=	bin/qemu-system-mips64el
NOT_PAX_MPROTECT_SAFE+=	bin/qemu-system-mipsel
NOT_PAX_MPROTECT_SAFE+=	bin/qemu-system-nios2
NOT_PAX_MPROTECT_SAFE+=	bin/qemu-system-or1k
NOT_PAX_MPROTECT_SAFE+=	bin/qemu-system-ppc
NOT_PAX_MPROTECT_SAFE+=	bin/qemu-system-ppc64
NOT_PAX_MPROTECT_SAFE+=	bin/qemu-system-riscv32
NOT_PAX_MPROTECT_SAFE+=	bin/qemu-system-riscv64
NOT_PAX_MPROTECT_SAFE+=	bin/qemu-system-s390x
NOT_PAX_MPROTECT_SAFE+=	bin/qemu-system-sh4
NOT_PAX_MPROTECT_SAFE+=	bin/qemu-system-sh4eb
NOT_PAX_MPROTECT_SAFE+=	bin/qemu-system-sparc
NOT_PAX_MPROTECT_SAFE+=	bin/qemu-system-sparc64
NOT_PAX_MPROTECT_SAFE+=	bin/qemu-system-tricore
NOT_PAX_MPROTECT_SAFE+=	bin/qemu-system-x86_64
NOT_PAX_MPROTECT_SAFE+=	bin/qemu-system-xtensa
NOT_PAX_MPROTECT_SAFE+=	bin/qemu-system-xtensaeb

PKG_SYSCONFSUBDIR=	qemu

INSTALLATION_DIRS=	${PKGMANDIR}/man1 share/doc/qemu

.include "../../mk/oss.buildlink3.mk"

.if ${OSS_TYPE} != "none"
SUBST_CLASSES+=		oss
SUBST_STAGE.oss=	pre-configure
SUBST_MESSAGE.oss=	Correcting the path to the OSS device.
SUBST_FILES.oss+=	audio/ossaudio.c
SUBST_SED.oss+=		-e "s,/dev/dsp,${DEVOSSAUDIO},g"
.endif

UE_ARCHS+=		aarch64 aarch64_be
UE_ARCHS+=		alpha arm armeb cris
UE_ARCHS+=		hexagon hppa
UE_ARCHS+=		i386
UE_ARCHS+=		m68k microblaze microblazeel
UE_ARCHS+=		mips mips64 mips64el mipsel mipsn32 mipsn32el
UE_ARCHS+=		nios2
UE_ARCHS+=		or1k ppc ppc64 ppc64le
UE_ARCHS+=		riscv32 riscv64
UE_ARCHS+=		s390x sh4 sh4eb sparc sparc32plus sparc64
UE_ARCHS+=		x86_64 xtensa xtensaeb

.if ${OPSYS} == "NetBSD"
PLIST.nbd=			yes
.  if !exists(/usr/include/machine/trap.h)	\
	|| "1"=="1"	# XXX usermode emulation is broken
CONFIGURE_ARGS+=		--disable-bsd-user
.  else
CONFIGURE_ARGS+=		--enable-bsd-user
USER_EMUL=			i386 x86_64
.  endif
.elif !empty(OPSYS:M*BSD) || ${OPSYS} == "DragonFly"
USER_EMUL=			i386 x86_64
PLIST.nbd=			yes
.elif ${OPSYS} == "Darwin"
USER_EMUL=
CONFIGURE_ARGS+=		--disable-bsd-user
PLIST.nbd=			yes
.elif ${OPSYS} == "Linux"
USER_EMUL=			${UE_ARCHS}
PLIST.bridge-helper=		yes
PLIST.nbd=			yes
PLIST.pr-helper=		yes
.elif !empty(MACHINE_PLATFORM:MSunOS-5.11-*)
PLIST.nbd=			yes
CONFIGURE_ARGS+=		--disable-coroutine-pool
.endif

PLIST_VARS+=		${UE_ARCHS} bridge-helper keymap nbd pr-helper
.for pvar in ${USER_EMUL}
PLIST.${pvar}=		yes
.endfor

# different versions of Sphinx generate different static files
PLIST_SRC=	PLIST ${WRKDIR}/PLIST.STATIC

PRINT_PLIST_AWK+=	/\/_static\// { next; }

TEST_TARGET=		check

PYTHON_FOR_BUILD_ONLY=	tool

post-extract:
	cp ${WRKDIR}/${PALCODE_CLIPPER} ${WRKSRC}/pc-bios/palcode-clipper
	cp ${FILESDIR}/hw-mips-mipssim_virtio.c ${WRKSRC}/hw/mips/mipssim_virtio.c

do-build:
	cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} \
		ninja -j ${_MAKE_JOBS_N:U1} -C build

do-install:
	cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${INSTALL_ENV} \
		ninja -j ${_MAKE_JOBS_N:U1} -C build install

# Some dependencies aren't correct and this tries to be re-made on install,
# failing due to configure bugs.
post-build:
	${TOUCH} ${WRKSRC}/config-host.mak

post-install:
	${INSTALL_DATA} ${FILESDIR}/Makefile.multinode-NetBSD \
		${DESTDIR}${PREFIX}/share/doc/qemu/
	${RM} -f ${DESTDIR}${PREFIX}/share/doc/qemu/interop/.buildinfo
	${RM} -f ${DESTDIR}${PREFIX}/share/doc/qemu/specs/.buildinfo
	${RM} -f ${WRKDIR}/PLIST.STATIC
	cd ${DESTDIR}${PREFIX} && \
	${FIND} share/doc/qemu -path '*/_static/*' -type f -print > ${WRKDIR}/PLIST.STATIC

.include "../../archivers/lzo/buildlink3.mk"
.include "../../archivers/zstd/buildlink3.mk"
.include "../../devel/glib2/buildlink3.mk"
.include "../../devel/jemalloc/buildlink3.mk"
.include "../../devel/snappy/buildlink3.mk"
.include "../../devel/zlib/buildlink3.mk"
.include "../../graphics/hicolor-icon-theme/buildlink3.mk"
.include "../../graphics/png/buildlink3.mk"
.include "../../lang/python/tool.mk"
.include "../../lang/python/versioned_dependencies.mk"
.include "../../security/libgcrypt/buildlink3.mk"
.include "../../www/curl/buildlink3.mk"
.include "../../x11/pixman/buildlink3.mk"
.include "../../mk/curses.buildlink3.mk"
.include "../../mk/jpeg.buildlink3.mk"
.include "../../mk/pthread.buildlink3.mk"
.include "../../mk/bsd.pkg.mk"