libvirt: add recipe

This commit is contained in:
Sergei Reznikov
2022-07-31 00:44:28 +03:00
parent a44abc87f1
commit 3bd46f1603
2 changed files with 394 additions and 0 deletions

View File

@@ -0,0 +1,149 @@
SUMMARY="An API for virtualization"
DESCRIPTION="Libvirt provides a portable, long term stable C API for managing \
the virtualization technologies provided by many operating systems. It \
includes support for QEMU, KVM, Xen, LXC, bhyve, Virtuozzo, VMware vCenter \
and ESX, VMware Desktop, Hyper-V, VirtualBox and the POWER Hypervisor.
For some of these hypervisors, it provides a stateful management daemon which \
runs on the virtualization host allowing access to the API both by \
non-privileged local users and remote users.
Layered packages provide bindings of the libvirt C API into other languages \
including Python, Perl, PHP, Go, Java, OCaml, as well as mappings into object \
systems such as GObject, CIM and SNMP."
HOMEPAGE="https://libvirt.org/"
COPYRIGHT="2005-2022 Daniel Veillard"
LICENSE="GNU GPL v2"
REVISION="1"
SOURCE_URI="https://github.com/libvirt/libvirt/archive/refs/tags/v$portVersion.tar.gz"
CHECKSUM_SHA256="fc617fe65749470f4be724367aaa020f7b2f19717e6119810da8b9973f6a8f52"
SOURCE_DIR="$portVersionedName"
SOURCE_URI_2="https://github.com/qemu/keycodemapdb/archive/e15649b83a78f89f57205927022115536d2c1698.zip"
CHECKSUM_SHA256_2="4169fe15b9b493925398f0efe2acd9d2cb23dc238275b298882d3130e8bff613"
PATCHES="libvirt-$portVersion.patchset"
ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86_gcc2 x86"
GLOBAL_WRITABLE_FILES="
settings/libvirt/libvirt-admin.conf auto-merge
settings/libvirt/libvirt.conf auto-merge
settings/libvirt/libvirtd.conf auto-merge
settings/libvirt/qemu/networks/autostart/default.xml auto-merge
settings/libvirt/qemu/networks/default.xml auto-merge
settings/libvirt/qemu-lockd.conf auto-merge
settings/libvirt/qemu.conf auto-merge
settings/libvirt/virtlockd.conf auto-merge
settings/libvirt/virtlogd.conf auto-merge
settings/libvirt/virtnetworkd.conf auto-merge
settings/libvirt/virtproxyd.conf auto-merge
settings/libvirt/virtqemud.conf auto-merge
settings/libvirt/virtsecretd.conf auto-merge
settings/libvirt/virtstoraged.conf auto-merge
settings/libvirt/virtvboxd.conf auto-merge
settings/logrotate.d/libvirtd auto-merge
settings/logrotate.d/libvirtd.libxl auto-merge
settings/logrotate.d/libvirtd.lxc auto-merge
settings/logrotate.d/libvirtd.qemu auto-merge
"
PROVIDES="
libvirt$secondaryArchSuffix = $portVersion
lib:libvirt$secondaryArchSuffix = $portVersion
cmd:libvirtd$secondaryArchSuffix
cmd:virsh$secondaryArchSuffix
cmd:virt_admin$secondaryArchSuffix
cmd:virt_qemu_run$secondaryArchSuffix
cmd:virt_host_validate$secondaryArchSuffix
cmd:virt_pki_query_dn$secondaryArchSuffix
cmd:virt_pki_validate$secondaryArchSuffix
cmd:virt_ssh_helper$secondaryArchSuffix
cmd:virt_xml_validate$secondaryArchSuffix
cmd:virtlockd$secondaryArchSuffix
cmd:virtlogd$secondaryArchSuffix
cmd:virtnetworkd$secondaryArchSuffix
cmd:virtproxyd$secondaryArchSuffix
cmd:virtqemud$secondaryArchSuffix
cmd:virtsecretd$secondaryArchSuffix
cmd:virtstoraged$secondaryArchSuffix
cmd:virtvboxd$secondaryArchSuffix
lib:libvirt_admin$secondaryArchSuffix
lib:libvirt_lxc$secondaryArchSuffix
lib:libvirt_qemu$secondaryArchSuffix
"
REQUIRES="
haiku$secondaryArchSuffix
lib:libcurl$secondaryArchSuffix
lib:libintl$secondaryArchSuffix
lib:libgio_2.0$secondaryArchSuffix
lib:libgobject_2.0$secondaryArchSuffix
lib:libglib_2.0$secondaryArchSuffix
lib:libgnutls$secondaryArchSuffix
lib:libreadline$secondaryArchSuffix
lib:libssh2$secondaryArchSuffix
lib:libtirpc$secondaryArchSuffix
lib:libxml2$secondaryArchSuffix
lib:libyajl$secondaryArchSuffix
"
PROVIDES_devel="
libvirt${secondaryArchSuffix}_devel = $portVersion
devel:libvirt$secondaryArchSuffix = $portVersion
"
REQUIRES_devel="
libvirt$secondaryArchSuffix == $portVersion base
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
devel:libcurl$secondaryArchSuffix
devel:libglib_2.0$secondaryArchSuffix
devel:libgnutls$secondaryArchSuffix
devel:libreadline$secondaryArchSuffix
devel:libssh2$secondaryArchSuffix
devel:libtasn1$secondaryArchSuffix
devel:libtirpc$secondaryArchSuffix
devel:libxml2$secondaryArchSuffix
devel:libyajl$secondaryArchSuffix
"
BUILD_PREREQUIRES="
cmd:awk
cmd:gcc$secondaryArchSuffix
cmd:git
cmd:make
cmd:meson
cmd:ninja
cmd:pkg_config$secondaryArchSuffix
cmd:rpcgen
cmd:xsltproc
"
BUILD()
{
ln -sf /sources-2/keycodemapdb* src/keycodemapdb
chmod +x src/keycodemapdb/tools/keymap-gen
export CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS -D_BSD_SOURCE"
export LDFLAGS="-lposix_error_mapper -lnetwork -lbsd"
meson build --buildtype=release $jobArgs \
--prefix=$prefix --libdir=$libDir --datadir=$dataDir --bindir=$binDir\
--includedir=$includeDir --sysconfdir=$settingsDir --sbindir=$binDir \
--libexecdir=$libDir --localedir=$dataDir/locale \
-Dwerror=false -Dgit_werror=disabled -Ddocs=disabled -Dtests=disabled
}
INSTALL()
{
ninja -C build install
prepareInstalledDevelLibs \
libvirt
packageEntries devel \
$developDir
}
TEST()
{
cd build
meson test
}

View File

@@ -0,0 +1,245 @@
From 3fbe37b2dbf7cd6569dad94bde723b57a83a87c0 Mon Sep 17 00:00:00 2001
From: Sergei Reznikov <diver@gelios.net>
Date: Sat, 30 Jul 2022 15:08:57 +0300
Subject: Haiku fixes
diff --git a/meson.build b/meson.build
index e03f330..231572c 100644
--- a/meson.build
+++ b/meson.build
@@ -853,7 +853,7 @@ if not get_option('driver_remote').disabled()
# use extra library as it's provided by libc directly.
if host_machine.system() == 'windows'
xdr_dep = cc.find_library('portablexdr', required: get_option('driver_remote'))
- elif host_machine.system() == 'linux'
+ elif host_machine.system() in [ 'linux', 'haiku' ]
xdr_dep = dependency('libtirpc', required: get_option('driver_remote'))
elif host_machine.system() in [ 'freebsd', 'darwin' ]
xdr_dep = cc.find_library('c', required: get_option('driver_remote'))
@@ -939,7 +939,7 @@ if devmapper_dep.found()
endif
dlopen_use = host_machine.system() != 'windows'
-dlopen_dep = cc.find_library('dl', required: dlopen_use)
+dlopen_dep = cc.find_library('root', required: dlopen_use)
if dlopen_dep.found()
if not cc.has_header('dlfcn.h')
error('Unable to find dlfcn.h')
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 709ca53..250dcc7 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -31073,13 +31073,13 @@ virDomainNetNotifyActualDevice(virConnectPtr conn,
* so there is no point in trying to learn the actualMTU
* (final arg to virNetDevTapReattachBridge())
*/
- ignore_value(virNetDevTapReattachBridge(iface->ifname,
+/* ignore_value(virNetDevTapReattachBridge(iface->ifname,
virDomainNetGetActualBridgeName(iface),
&iface->mac, dom->uuid,
virDomainNetGetActualVirtPortProfile(iface),
virDomainNetGetActualVlan(iface),
virDomainNetGetActualPortOptionsIsolated(iface),
- iface->mtu, NULL));
+ iface->mtu, NULL));*/
}
}
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 11696a9..d3b7515 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -2108,12 +2108,12 @@ networkShutdownNetworkVirtual(virNetworkObj *obj)
* from old libvirt, we still need to delete any dummy NIC
* that might exist. Keep this logic around for a while...
*/
- if (def->mac_specified) {
+/* if (def->mac_specified) {
g_autofree char *macTapIfName = networkBridgeDummyNicName(def->bridge);
if (macTapIfName && virNetDevExists(macTapIfName))
ignore_value(virNetDevTapDelete(macTapIfName, NULL));
}
-
+*/
ignore_value(virNetDevSetOnline(def->bridge, false));
if (def->forward.type != VIR_NETWORK_FORWARD_OPEN)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 3b5c3db..082e5e5 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -10359,11 +10359,11 @@ qemuDomainInterfaceStats(virDomainPtr dom,
if (virNetDevVFInterfaceStats(vfAddr, stats) < 0)
goto cleanup;
- } else {
+/* } else {
if (virNetDevTapInterfaceStats(net->ifname, stats,
!virDomainNetTypeSharesHostView(net)) < 0)
goto cleanup;
- }
+*/ }
ret = 0;
cleanup:
@@ -18282,12 +18282,12 @@ qemuDomainGetStatsInterface(virQEMUDriver *driver G_GNUC_UNUSED,
continue;
}
} else {
- if (virNetDevTapInterfaceStats(net->ifname, &tmp,
+/* if (virNetDevTapInterfaceStats(net->ifname, &tmp,
!virDomainNetTypeSharesHostView(net)) < 0) {
virResetLastError();
continue;
}
- }
+*/ }
QEMU_ADD_NET_PARAM(params, i,
"rx.bytes", tmp.rx_bytes);
diff --git a/src/qemu/qemu_interface.c b/src/qemu/qemu_interface.c
index cf8117d..72cdab9 100644
--- a/src/qemu/qemu_interface.c
+++ b/src/qemu/qemu_interface.c
@@ -377,12 +377,12 @@ qemuCreateInBridgePortWithHelper(virQEMUDriverConfig *cfg,
goto cleanup;
}
- if (virNetDevTapGetName(*tapfd, ifname) < 0 ||
+/* if (virNetDevTapGetName(*tapfd, ifname) < 0 ||
virCommandWait(cmd, NULL) < 0) {
VIR_FORCE_CLOSE(*tapfd);
*tapfd = -1;
}
-
+*/
cleanup:
VIR_FREE(cmdstr);
VIR_FREE(errbuf);
@@ -448,20 +448,20 @@ qemuInterfaceEthernetConnect(virDomainDef *def,
goto cleanup;
}
} else {
- if (virNetDevTapCreate(&net->ifname, tunpath, tapfd, tapfdSize,
+/* if (virNetDevTapCreate(&net->ifname, tunpath, tapfd, tapfdSize,
tap_create_flags) < 0)
goto cleanup;
- }
+*/ }
} else {
if (!net->ifname)
template_ifname = true;
-
+/*
if (virNetDevTapCreate(&net->ifname, tunpath, tapfd, tapfdSize,
tap_create_flags) < 0) {
goto cleanup;
}
-
+*/
/* The tap device's MAC address cannot match the MAC address
* used by the guest. This results in "received packet on
* vnetX with own address as source address" error logs from
@@ -560,7 +560,7 @@ qemuInterfaceBridgeConnect(virDomainDef *def,
tap_create_flags |= VIR_NETDEV_TAP_CREATE_VNET_HDR;
if (driver->privileged) {
- if (virNetDevTapCreateInBridgePort(brname, &net->ifname, &net->mac,
+/* if (virNetDevTapCreateInBridgePort(brname, &net->ifname, &net->mac,
def->uuid, tunpath, tapfd, *tapfdSize,
virDomainNetGetActualVirtPortProfile(net),
virDomainNetGetActualVlan(net),
@@ -570,7 +570,7 @@ qemuInterfaceBridgeConnect(virDomainDef *def,
virDomainAuditNetDevice(def, net, tunpath, false);
goto cleanup;
}
- if (virDomainNetGetActualBridgeMACTableManager(net)
+*/ if (virDomainNetGetActualBridgeMACTableManager(net)
== VIR_NETWORK_BRIDGE_MAC_TABLE_MANAGER_LIBVIRT) {
/* libvirt is managing the FDB of the bridge this device
* is attaching to, so we need to turn off learning and
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 771a623..86a940e 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -8327,13 +8327,13 @@ void qemuProcessStop(virQEMUDriver *driver,
virDomainNetGetActualVirtPortProfile(net),
cfg->stateDir));
break;
- case VIR_DOMAIN_NET_TYPE_ETHERNET:
+/* case VIR_DOMAIN_NET_TYPE_ETHERNET:
if (net->managed_tap != VIR_TRISTATE_BOOL_NO && net->ifname) {
ignore_value(virNetDevTapDelete(net->ifname, net->backend.tap));
VIR_FREE(net->ifname);
}
break;
- case VIR_DOMAIN_NET_TYPE_BRIDGE:
+*/ case VIR_DOMAIN_NET_TYPE_BRIDGE:
case VIR_DOMAIN_NET_TYPE_NETWORK:
#ifdef VIR_NETDEV_TAP_REQUIRE_MANUAL_CLEANUP
if (!(vport && vport->virtPortType == VIR_NETDEV_VPORT_PROFILE_OPENVSWITCH))
diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c
index 6ed2078..133abcd 100644
--- a/src/storage/storage_util.c
+++ b/src/storage/storage_util.c
@@ -1917,7 +1917,7 @@ virStorageBackendUpdateVolTargetInfoFD(virStorageSource *target,
# ifdef __linux__
target->timestamps->btime = (struct timespec){0, 0};
# else /* ! __linux__ */
- target->timestamps->btime = sb->st_birthtim;
+ target->timestamps->btime = sb->st_crtim;
# endif /* ! __linux__ */
target->timestamps->ctime = sb->st_ctim;
target->timestamps->mtime = sb->st_mtim;
diff --git a/src/util/meson.build b/src/util/meson.build
index 07ae946..b8d040e 100644
--- a/src/util/meson.build
+++ b/src/util/meson.build
@@ -64,7 +64,6 @@ util_sources = [
'virnetdevmacvlan.c',
'virnetdevmidonet.c',
'virnetdevopenvswitch.c',
- 'virnetdevtap.c',
'virnetdevveth.c',
'virnetdevvlan.c',
'virnetdevvportprofile.c',
diff --git a/src/util/virfile.c b/src/util/virfile.c
index 99da058..fbdf779 100644
--- a/src/util/virfile.c
+++ b/src/util/virfile.c
@@ -3107,7 +3107,7 @@ virFileBuildPath(const char *dir, const char *name, const char *ext)
/* Open a non-blocking primary side of a pty. If ttyName is not NULL,
* then populate it with the name of the secondary peer. If rawmode is
* set, also put the primary side into raw mode before returning. */
-#ifndef WIN32
+#if !defined(WIN32) && !defined(__HAIKU__)
int
virFileOpenTty(int *ttyprimary, char **ttyName, int rawmode)
{
@@ -4479,7 +4479,7 @@ virFileGetXAttr(const char *path,
int
virFileDataSync(int fd)
{
-#if defined(__APPLE__) || defined(WIN32)
+#if defined(__APPLE__) || defined(WIN32) || defined(__HAIKU__)
return g_fsync(fd);
#else
return fdatasync(fd);
diff --git a/src/vbox/vbox_XPCOMCGlue.c b/src/vbox/vbox_XPCOMCGlue.c
index 77a3041..b3f2c39 100644
--- a/src/vbox/vbox_XPCOMCGlue.c
+++ b/src/vbox/vbox_XPCOMCGlue.c
@@ -42,7 +42,7 @@
VIR_LOG_INIT("vbox.vbox_XPCOMCGlue");
#if defined(__linux__) || defined(__linux_gnu__) || defined(__sun__) || \
- defined(__FreeBSD__) || defined(__OpenBSD__) || \
+ defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__HAIKU__) || \
defined(__FreeBSD_kernel__)
# define DYNLIB_NAME "VBoxXPCOMC.so"
#elif defined(__APPLE__)
--
2.36.1