From d68c34dd81596413313464b6c6e6b8c0874b9861 Mon Sep 17 00:00:00 2001 From: Ruowen Qin Date: Sun, 10 Mar 2024 10:51:22 +0800 Subject: [PATCH] app-emulation/vmware-modules: bump to 17.5.1 Signed-off-by: Ruowen Qin --- .../vmware-modules-17.5.1.ebuild | 127 ++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 app-emulation/vmware-modules/vmware-modules-17.5.1.ebuild diff --git a/app-emulation/vmware-modules/vmware-modules-17.5.1.ebuild b/app-emulation/vmware-modules/vmware-modules-17.5.1.ebuild new file mode 100644 index 0000000..474408d --- /dev/null +++ b/app-emulation/vmware-modules/vmware-modules-17.5.1.ebuild @@ -0,0 +1,127 @@ +# Copyright 1999-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit flag-o-matic linux-mod-r1 udev + +DESCRIPTION="VMware kernel modules" +HOMEPAGE="https://github.com/mkubecek/vmware-host-modules" + +# Highest kernel version known to work: +MY_KERNEL_VERSION="6.7" + +# Upstream does not want to tag versions or anything that looks like properly +# releasing the software, so we need to just pick a commit from +# https://github.com/mkubecek/vmware-host-modules/commits/workstation-${PV} +# and test it ourselves. +# +# Details: https://github.com/mkubecek/vmware-host-modules/issues/158#issuecomment-1228341760 +MY_COMMIT="2c6d66f3f1947384038b765c897b102ecdb18298" + +SRC_URI=" https://github.com/mkubecek/vmware-host-modules/archive/${MY_COMMIT}.tar.gz -> ${P}-${MY_COMMIT}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64" + +RESTRICT="mirror" + +RDEPEND=" + acct-group/vmware +" + +S="${WORKDIR}/vmware-host-modules-${MY_COMMIT}" + +pkg_setup() { + CONFIG_CHECK="~HIGH_RES_TIMERS" + if kernel_is -ge 5 5; then + CONFIG_CHECK="${CONFIG_CHECK} X86_IOPL_IOPERM" + fi + if kernel_is -ge 2 6 37 && kernel_is -lt 2 6 39; then + CONFIG_CHECK="${CONFIG_CHECK} BKL" + fi + CONFIG_CHECK="${CONFIG_CHECK} VMWARE_VMCI ~VMWARE_VMCI_VSOCKETS" + + linux-info_pkg_setup + linux-mod-r1_pkg_setup + + if kernel_is gt ${MY_KERNEL_VERSION//./ }; then + ewarn + ewarn "Warning: this version of the modules is only known to work with kernels up to ${MY_KERNEL_VERSION}, while you are building them for a ${KV_FULL} kernel." + ewarn + fi + + if linux_chkconfig_present CC_IS_CLANG; then + : "${KERNEL_CC:=${CHOST}-clang}" + if linux_chkconfig_present LD_IS_LLD; then + : "${KERNEL_LD:=ld.lld}" + if linux_chkconfig_present LTO_CLANG_THIN; then + BUILD_PARAMS+=" ldflags-y=--thinlto-cache-dir= LDFLAGS_MODULE=--thinlto-cache-dir=" + fi + fi + fi + + BUILD_TARGETS="auto-build KERNEL_DIR=${KERNEL_DIR} KBUILD_OUTPUT=${KV_OUT_DIR}" + + filter-flags -mfpmath=sse -mavx -mpclmul -maes + append-cflags -mno-sse # Found a problem similar to bug #492964 +} + +src_prepare() { + # decouple the kernel include dir from the running kernel version: https://github.com/stefantalpalaru/gentoo-overlay/issues/17 + sed -i \ + -e "s%HEADER_DIR = /lib/modules/\$(VM_UNAME)/build/include%HEADER_DIR = ${KERNEL_DIR}/include%" \ + -e "s%VM_UNAME = .*\$%VM_UNAME = ${KV_FULL}%" \ + */Makefile || die "sed failed" + + # Allow user patches so they can support RC kernels and whatever else + default +} + +src_compile() { + for mod in vmmon vmnet; do + local modlist+=( ${mod}=misc:"${S}"/${mod}-only ) + done + + linux-mod-r1_src_compile +} + +src_install() { + linux-mod-r1_src_install + local udevrules="${T}/60-vmware.rules" + cat > "${udevrules}" <<-EOF + KERNEL=="vmci", GROUP="vmware", MODE="660" + KERNEL=="vmw_vmci", GROUP="vmware", MODE="660" + KERNEL=="vmmon", GROUP="vmware", MODE="660" + KERNEL=="vsock", GROUP="vmware", MODE="660" + EOF + udev_dorules "${udevrules}" + + dodir /etc/modprobe.d/ + + cat > "${D}"/etc/modprobe.d/vmware.conf <<-EOF + # Support for vmware vmci in kernel module + alias vmci vmw_vmci + EOF + + export installed_modprobe_conf=1 + dodir /etc/modprobe.d/ + cat >> "${D}"/etc/modprobe.d/vmware.conf <<-EOF + # Support for vmware vsock in kernel module + alias vsock vmw_vsock_vmci_transport + EOF + + export installed_modprobe_conf=1 +} + +pkg_postinst() { + linux-mod-r1_pkg_postinst + udev_reload + ewarn "Don't forget to run '/etc/init.d/vmware restart' to use the new kernel modules." +} + +pkg_postrm() { + linux-mod-r1_pkg_postrm + udev_reload +}