mirror of
https://dev.lirent.ru/Vatrog/vm-automation-signaling.git
synced 2026-06-25 20:36:36 +03:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
6fea392d46
|
|||
|
0289817821
|
+31
-21
@@ -1,5 +1,8 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
project(vmsig VERSION 0.3.3 LANGUAGES C)
|
||||
# Single source of truth for the version: CI passes -DVMSIG_VERSION=${TAG#v}, so the project
|
||||
# version (-> libvgpu-perception SONAME/.so version) and the .deb version come from one tag.
|
||||
set(VMSIG_VERSION "0.3.4" CACHE STRING "Release version (MAJOR.MINOR.PATCH); CI passes the tag")
|
||||
project(vmsig VERSION ${VMSIG_VERSION} LANGUAGES C)
|
||||
|
||||
set(CMAKE_C_STANDARD 17)
|
||||
set(CMAKE_C_STANDARD_REQUIRED ON)
|
||||
@@ -117,16 +120,18 @@ add_executable(vmsig_cli src/cli.c)
|
||||
target_link_libraries(vmsig_cli PRIVATE vmsig)
|
||||
target_compile_options(vmsig_cli PRIVATE -Wall -Wextra)
|
||||
|
||||
# ---- vgpu-perception: host-side vgpu Sensor S-lib (absorbed in-tree) ---------
|
||||
# A SEPARATE shipped library (NOT fused into libvmsig — it is consumed by the shell, not the
|
||||
# signaling core). Host-only: reads the vgpu shared region from its own RO vmie_mem. Built
|
||||
# only when armed (needs vmie). The in-guest Windows producer (vgpu-streamer.exe) stays in a
|
||||
# separate repo and is NOT part of this delivery.
|
||||
# ---- vgpu-perception: host-side vgpu Sensor S-lib ---------------------------
|
||||
# Packaged SEPARATELY from the daemon (libvgpu-perception0 + -dev), NOT fused into libvmsig —
|
||||
# a Sensor lib consumed by a control/shell, not the signaling core. Host-only: reads the vgpu
|
||||
# shared region from its own RO vmie_mem. Built only when armed (needs vmie). The in-guest
|
||||
# Windows producer is the vgpu-streamer cross-target above (same tree, shared ABI vgpu_stream.h).
|
||||
if(VMSIG_WITH_VMIE)
|
||||
add_library(vgpu-perception SHARED
|
||||
src/si/vgpu-perception/discover.c
|
||||
src/si/vgpu-perception/sample.c
|
||||
src/si/vgpu-perception/control.c)
|
||||
set_target_properties(vgpu-perception PROPERTIES
|
||||
VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR}) # libvgpu-perception.so.0
|
||||
target_include_directories(vgpu-perception
|
||||
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include
|
||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/si/vgpu-perception/include)
|
||||
@@ -265,25 +270,30 @@ add_test(NAME memwrite COMMAND vmsig_memwritetest)
|
||||
add_test(NAME cli COMMAND vmsig_cli)
|
||||
|
||||
# ---- install rules (for the .deb stage) -------------------------------------
|
||||
option(VMSIG_INSTALL "Generate install() rules (daemon/lib/headers/unit/config)" OFF)
|
||||
option(VMSIG_INSTALL "Generate install() rules (per-component, for the .deb stages)" OFF)
|
||||
if(VMSIG_INSTALL)
|
||||
include(GNUInstallDirs)
|
||||
install(TARGETS vmsigd RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR})
|
||||
install(TARGETS vmsig LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
if(TARGET vgpu-perception) # armed builds ship the host vgpu S-lib alongside
|
||||
install(TARGETS vgpu-perception LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||
endif()
|
||||
# public contracts (signaling + absorbed SI host headers) under include/vmsig/
|
||||
# --- component `daemon`: the signaling delivery (package: vmsig). NO gpu lib here. ---
|
||||
install(TARGETS vmsigd RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR} COMPONENT daemon)
|
||||
install(TARGETS vmsig LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT daemon)
|
||||
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/vmsig
|
||||
FILES_MATCHING PATTERN "vmsig*.h"
|
||||
PATTERN "vmctl.h"
|
||||
PATTERN "vgpu_stream.h"
|
||||
PATTERN "vgpu_perception.h")
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/vmsig COMPONENT daemon
|
||||
FILES_MATCHING PATTERN "vmsig*.h" PATTERN "vmctl.h")
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/packaging/systemd/vmsigd.service
|
||||
DESTINATION lib/systemd/system)
|
||||
DESTINATION lib/systemd/system COMPONENT daemon)
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/packaging/tmpfiles/vmsig.conf
|
||||
DESTINATION lib/tmpfiles.d)
|
||||
DESTINATION lib/tmpfiles.d COMPONENT daemon)
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/packaging/config/vmsigd.conf
|
||||
DESTINATION /etc/vmsig)
|
||||
DESTINATION /etc/vmsig COMPONENT daemon)
|
||||
# --- the host vgpu perception S-lib, SEPARATE from the daemon: runtime (versioned .so,
|
||||
# package libvgpu-perception0) vs dev (namelink + headers, package libvgpu-perception-dev) ---
|
||||
if(TARGET vgpu-perception)
|
||||
install(TARGETS vgpu-perception
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
COMPONENT vgpu_runtime
|
||||
NAMELINK_COMPONENT vgpu_dev)
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/vgpu_perception.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/include/vgpu_stream.h
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/vmsig COMPONENT vgpu_dev)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -1,46 +1,60 @@
|
||||
# vmsig packaging — `make deb` builds the .deb over a `cmake --install` stage.
|
||||
# Private values are NOT baked into the tree: pass them via the variables below (the
|
||||
# defaults are neutral placeholders; CI overrides them from vars/secrets).
|
||||
# vmsig packaging — `make deb` builds TWO Debian packages from per-component install stages:
|
||||
# vmsig — the signaling daemon + library + headers + systemd unit
|
||||
# libvgpu-perception — the host-side vgpu perception S-lib (SEPARATE: not in vmsig)
|
||||
# Private values are NOT baked in: pass them via the variables below (CI overrides them).
|
||||
#
|
||||
# make deb LIBVMIE_PATH=/path/to/vmie VERSION=1.2.3 \
|
||||
# MAINTAINER="Name <addr>" DEPENDS="libc6, libvmie0"
|
||||
# make deb LIBVMIE_PATH=/path/to/vmie VERSION=1.2.3 MAINTAINER="Name <addr>"
|
||||
|
||||
VERSION ?= 0.0.0
|
||||
MAINTAINER ?= vmsig packaging <root@localhost>
|
||||
# libvmie0 is vmie's own runtime package (SONAME libvmie.so.0): libvmsig.so and
|
||||
# libvgpu-perception.so dynamically link it, so it is a HARD runtime dependency.
|
||||
DEPENDS ?= libc6, libvmie0
|
||||
ARCH ?= amd64
|
||||
VERSION ?= 0.0.0
|
||||
MAINTAINER ?= vmsig packaging <root@localhost>
|
||||
# libvmie0 is vmie's runtime package (SONAME libvmie.so.0): both libvmsig.so and
|
||||
# libvgpu-perception.so dynamically link it — a hard runtime dependency of each package.
|
||||
DEPENDS ?= libc6, libvmie0
|
||||
ARCH ?= amd64
|
||||
LIBVMIE_PATH ?=
|
||||
|
||||
BUILD_DIR ?= .build-pkg
|
||||
STAGE ?= $(CURDIR)/dist/stage
|
||||
DIST ?= $(CURDIR)/dist
|
||||
BUILD_DIR ?= .build-pkg
|
||||
DIST ?= $(CURDIR)/dist
|
||||
|
||||
.PHONY: deb clean
|
||||
|
||||
# Armed package: the shipped daemon needs vmie for memctx. vmie stays an external dependency
|
||||
# (package Depends on its runtime). vmie is found from a source tree (LIBVMIE_PATH) or, when
|
||||
# that is empty, from the installed libvmie-dev (system / CMAKE_PREFIX_PATH) — the CI path.
|
||||
# vmie is found from a source tree (LIBVMIE_PATH) or, when empty, the installed libvmie-dev
|
||||
# (system / CMAKE_PREFIX_PATH) — the CI path.
|
||||
deb:
|
||||
rm -rf $(STAGE)
|
||||
cmake -S . -B $(BUILD_DIR) -DCMAKE_BUILD_TYPE=Release -DVMSIG_INSTALL=ON -DVMSIG_WITH_VMIE=ON \
|
||||
$(if $(LIBVMIE_PATH),-DLIBVMIE_PATH=$(LIBVMIE_PATH),)
|
||||
-DVMSIG_VERSION=$(VERSION) $(if $(LIBVMIE_PATH),-DLIBVMIE_PATH=$(LIBVMIE_PATH),)
|
||||
cmake --build $(BUILD_DIR) -j
|
||||
DESTDIR=$(STAGE) cmake --install $(BUILD_DIR) --prefix /usr
|
||||
mkdir -p $(STAGE)/DEBIAN
|
||||
sed -e 's/@VERSION@/$(VERSION)/' \
|
||||
-e 's|@MAINTAINER@|$(MAINTAINER)|' \
|
||||
-e 's/@DEPENDS@/$(DEPENDS)/' \
|
||||
packaging/deb/control.in > $(STAGE)/DEBIAN/control
|
||||
cp packaging/deb/conffiles $(STAGE)/DEBIAN/conffiles
|
||||
install -m 0755 packaging/deb/postinst $(STAGE)/DEBIAN/postinst
|
||||
install -m 0755 packaging/deb/prerm $(STAGE)/DEBIAN/prerm
|
||||
# strip inherited setgid from staged dirs (a setgid build tree => dpkg-deb rejects DEBIAN)
|
||||
find $(STAGE) -type d -exec chmod g-s {} +
|
||||
mkdir -p $(DIST)
|
||||
dpkg-deb --root-owner-group --build $(STAGE) $(DIST)/vmsig_$(VERSION)_$(ARCH).deb
|
||||
@echo "built: $(DIST)/vmsig_$(VERSION)_$(ARCH).deb"
|
||||
# ---- package: vmsig (component `daemon`) ----
|
||||
rm -rf $(DIST)/stage-daemon
|
||||
DESTDIR=$(DIST)/stage-daemon cmake --install $(BUILD_DIR) --prefix /usr --component daemon
|
||||
mkdir -p $(DIST)/stage-daemon/DEBIAN
|
||||
sed -e 's/@VERSION@/$(VERSION)/' -e 's|@MAINTAINER@|$(MAINTAINER)|' -e 's/@DEPENDS@/$(DEPENDS)/' \
|
||||
packaging/deb/vmsig/control.in > $(DIST)/stage-daemon/DEBIAN/control
|
||||
cp packaging/deb/vmsig/conffiles $(DIST)/stage-daemon/DEBIAN/conffiles
|
||||
install -m 0755 packaging/deb/vmsig/postinst $(DIST)/stage-daemon/DEBIAN/postinst
|
||||
install -m 0755 packaging/deb/vmsig/prerm $(DIST)/stage-daemon/DEBIAN/prerm
|
||||
find $(DIST)/stage-daemon -type d -exec chmod g-s {} +
|
||||
dpkg-deb --root-owner-group --build $(DIST)/stage-daemon $(DIST)/vmsig_$(VERSION)_$(ARCH).deb
|
||||
# ---- package: libvgpu-perception0 (component `vgpu_runtime` — versioned .so) ----
|
||||
rm -rf $(DIST)/stage-vgpu0
|
||||
DESTDIR=$(DIST)/stage-vgpu0 cmake --install $(BUILD_DIR) --prefix /usr --component vgpu_runtime
|
||||
mkdir -p $(DIST)/stage-vgpu0/DEBIAN
|
||||
sed -e 's/@VERSION@/$(VERSION)/' -e 's|@MAINTAINER@|$(MAINTAINER)|' -e 's/@DEPENDS@/$(DEPENDS)/' \
|
||||
packaging/deb/vgpu0/control.in > $(DIST)/stage-vgpu0/DEBIAN/control
|
||||
install -m 0755 packaging/deb/vgpu0/postinst $(DIST)/stage-vgpu0/DEBIAN/postinst
|
||||
find $(DIST)/stage-vgpu0 -type d -exec chmod g-s {} +
|
||||
dpkg-deb --root-owner-group --build $(DIST)/stage-vgpu0 $(DIST)/libvgpu-perception0_$(VERSION)_$(ARCH).deb
|
||||
# ---- package: libvgpu-perception-dev (component `vgpu_dev` — namelink + headers) ----
|
||||
rm -rf $(DIST)/stage-vgpu-dev
|
||||
DESTDIR=$(DIST)/stage-vgpu-dev cmake --install $(BUILD_DIR) --prefix /usr --component vgpu_dev
|
||||
mkdir -p $(DIST)/stage-vgpu-dev/DEBIAN
|
||||
sed -e 's/@VERSION@/$(VERSION)/' -e 's|@MAINTAINER@|$(MAINTAINER)|' \
|
||||
-e 's/@DEPENDS@/libvgpu-perception0 (= $(VERSION))/' \
|
||||
packaging/deb/vgpu-dev/control.in > $(DIST)/stage-vgpu-dev/DEBIAN/control
|
||||
find $(DIST)/stage-vgpu-dev -type d -exec chmod g-s {} +
|
||||
dpkg-deb --root-owner-group --build $(DIST)/stage-vgpu-dev $(DIST)/libvgpu-perception-dev_$(VERSION)_$(ARCH).deb
|
||||
@echo "built: vmsig + libvgpu-perception0 + libvgpu-perception-dev ($(VERSION))"
|
||||
|
||||
clean:
|
||||
rm -rf $(BUILD_DIR) $(DIST)
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
Package: libvgpu-perception-dev
|
||||
Version: @VERSION@
|
||||
Section: libdevel
|
||||
Priority: optional
|
||||
Architecture: amd64
|
||||
Depends: @DEPENDS@
|
||||
Maintainer: @MAINTAINER@
|
||||
Description: Host-side vgpu perception library (development files)
|
||||
Headers (vgpu_perception.h, vgpu_stream.h) and the linker namelink for
|
||||
libvgpu-perception. Install this to build a control/shell against the perception API.
|
||||
@@ -0,0 +1,12 @@
|
||||
Package: libvgpu-perception0
|
||||
Version: @VERSION@
|
||||
Section: libs
|
||||
Priority: optional
|
||||
Architecture: amd64
|
||||
Depends: @DEPENDS@
|
||||
Maintainer: @MAINTAINER@
|
||||
Description: Host-side vgpu perception library
|
||||
Reads the in-guest vgpu shared region (frames, cursor, geometry) from the host over a
|
||||
read-only guest-RAM handle and exposes a perception API. A Sensor-layer library consumed
|
||||
by a control/shell, independent of the signaling daemon. This package ships the runtime
|
||||
shared object (libvgpu-perception.so.0).
|
||||
Executable
+10
@@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
case "$1" in
|
||||
configure)
|
||||
ldconfig || true
|
||||
;;
|
||||
abort-upgrade|abort-remove|abort-deconfigure)
|
||||
;;
|
||||
esac
|
||||
exit 0
|
||||
@@ -5,9 +5,9 @@ Priority: optional
|
||||
Architecture: amd64
|
||||
Depends: @DEPENDS@
|
||||
Maintainer: @MAINTAINER@
|
||||
Description: VM signaling coherence daemon and host SI libraries
|
||||
Description: VM signaling coherence daemon
|
||||
vmsig serves a unix-socket control plane over the signaling layer for the VMs it
|
||||
discovers: lifecycle/state, coherent guest address-space context handoff, and arbitrated
|
||||
input and memory-write actuation. Ships the daemon (vmsigd), the signaling library, the
|
||||
host-side vgpu perception library, and a systemd unit. Configured via
|
||||
/etc/vmsig/vmsigd.conf.
|
||||
input and memory-write actuation. Ships the daemon (vmsigd), the signaling library, and a
|
||||
systemd unit. Configured via /etc/vmsig/vmsigd.conf. The host-side vgpu perception library
|
||||
is a separate package (libvgpu-perception).
|
||||
Reference in New Issue
Block a user