libvirt.mk 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  1. ################################################################################
  2. #
  3. # libvirt
  4. #
  5. ################################################################################
  6. LIBVIRT_VERSION = 7.10.0
  7. LIBVIRT_SITE = https://libvirt.org/sources
  8. LIBVIRT_SOURCE = libvirt-$(LIBVIRT_VERSION).tar.xz
  9. LIBVIRT_LICENSE = LGPL-2.1+
  10. LIBVIRT_LICENSE_FILES = COPYING
  11. LIBVIRT_CPE_ID_VENDOR = redhat
  12. LIBVIRT_INSTALL_STAGING = YES
  13. LIBVIRT_DEPENDENCIES = \
  14. host-libxslt \
  15. host-nfs-utils \
  16. host-pkgconf \
  17. host-python-docutils \
  18. gnutls \
  19. libglib2 \
  20. libpciaccess \
  21. libtirpc \
  22. libxml2 \
  23. udev \
  24. zlib \
  25. $(TARGET_NLS_DEPENDENCIES)
  26. LIBVIRT_LDFLAGS = $(TARGET_LDFLAGS) $(TARGET_NLS_LIBS)
  27. LIBVIRT_CONF_ENV += \
  28. CFLAGS="$(TARGET_CFLAGS) `$(PKG_CONFIG_HOST_BINARY) --cflags libtirpc`" \
  29. LIBS="`$(PKG_CONFIG_HOST_BINARY) --libs libtirpc`"
  30. LIBVIRT_CONF_OPTS = \
  31. -Drpath=disabled \
  32. -Dapparmor=disabled \
  33. -Ddocs=disabled \
  34. -Ddriver_bhyve=disabled \
  35. -Ddriver_ch=disabled \
  36. -Ddriver_esx=disabled \
  37. -Ddriver_hyperv=disabled \
  38. -Ddriver_libxl=disabled \
  39. -Ddriver_openvz=disabled \
  40. -Ddriver_remote=enabled \
  41. -Ddriver_secrets=enabled \
  42. -Ddriver_test=disabled \
  43. -Ddriver_vbox=disabled \
  44. -Ddriver_vmware=disabled \
  45. -Ddriver_vz=disabled \
  46. -Ddtrace=disabled \
  47. -Dexpensive_tests=disabled \
  48. -Dfirewalld=disabled \
  49. -Dfirewalld_zone=disabled \
  50. -Dglusterfs=disabled \
  51. -Dhost_validate=enabled \
  52. -Dinit_script=$(if $(BR2_INIT_SYSTEMD),systemd,none) \
  53. -Dlogin_shell=disabled \
  54. -Dnetcf=disabled \
  55. -Dnls=$(if $(BR2_SYSTEM_ENABLE_NLS),enabled,disabled) \
  56. -Dnumad=disabled \
  57. -Dopenwsman=disabled \
  58. -Dpciaccess=enabled \
  59. -Dpm_utils=disabled \
  60. -Dsanlock=disabled \
  61. -Dsasl=disabled \
  62. -Dsecdriver_apparmor=disabled \
  63. -Dstorage_iscsi=disabled \
  64. -Dstorage_iscsi_direct=disabled \
  65. -Dstorage_mpath=disabled \
  66. -Dsysctl_config=enabled \
  67. -Dtest_coverage=false \
  68. -Dtests=disabled \
  69. -Dudev=enabled \
  70. -Dwireshark_dissector=disabled
  71. # warning_level should only drive the level of warnings during the
  72. # compilation of C code. However, libvirt misuses that to also
  73. # enable SSP when warning_level == 2
  74. # Force warning_level=1 to disable SSP, and let our toolchain wrapper
  75. # handle it.
  76. LIBVIRT_CONF_OPTS += -Dwarning_level=1
  77. ifeq ($(BR2_PACKAGE_ATTR),y)
  78. LIBVIRT_CONF_OPTS += -Dattr=enabled
  79. LIBVIRT_DEPENDENCIES += attr
  80. else
  81. LIBVIRT_CONF_OPTS += -Dattr=disabled
  82. endif
  83. ifeq ($(BR2_PACKAGE_AUDIT),y)
  84. LIBVIRT_CONF_OPTS += -Daudit=enabled
  85. LIBVIRT_DEPENDENCIES += audit
  86. else
  87. LIBVIRT_CONF_OPTS += -Daudit=disabled
  88. endif
  89. ifeq ($(BR2_PACKAGE_BASH_COMPLETION),y)
  90. LIBVIRT_CONF_OPTS += -Dbash_completion=enabled
  91. LIBVIRT_DEPENDENCIES += bash-completion
  92. else
  93. LIBVIRT_CONF_OPTS += -Dbash_completion=disabled
  94. endif
  95. ifeq ($(BR2_PACKAGE_UTIL_LINUX_LIBBLKID),y)
  96. LIBVIRT_CONF_OPTS += -Dblkid=enabled
  97. LIBVIRT_DEPENDENCIES += util-linux
  98. else
  99. LIBVIRT_CONF_OPTS += -Dblkid=disabled
  100. endif
  101. ifeq ($(BR2_PACKAGE_LIBCAP_NG),y)
  102. LIBVIRT_CONF_OPTS += -Dcapng=enabled
  103. LIBVIRT_DEPENDENCIES += libcap-ng
  104. else
  105. LIBVIRT_CONF_OPTS += -Dcapng=disabled
  106. endif
  107. ifeq ($(BR2_PACKAGE_LIBCURL),y)
  108. LIBVIRT_CONF_OPTS += -Dcurl=enabled
  109. LIBVIRT_DEPENDENCIES += libcurl
  110. else
  111. LIBVIRT_CONF_OPTS += -Dcurl=disabled
  112. endif
  113. ifeq ($(BR2_PACKAGE_LIBFUSE),y)
  114. LIBVIRT_CONF_OPTS += -Dfuse=enabled
  115. LIBVIRT_DEPENDENCIES += libfuse
  116. else
  117. LIBVIRT_CONF_OPTS += -Dfuse=disabled
  118. endif
  119. ifeq ($(BR2_PACKAGE_LIBISCSI),y)
  120. LIBVIRT_CONF_OPTS += -Dlibiscsi=enabled
  121. LIBVIRT_DEPENDENCIES += libiscsi
  122. else
  123. LIBVIRT_CONF_OPTS += -Dlibiscsi=disabled
  124. endif
  125. ifeq ($(BR2_PACKAGE_LIBNL),y)
  126. LIBVIRT_CONF_OPTS += -Dlibnl=enabled
  127. LIBVIRT_DEPENDENCIES += libnl
  128. else
  129. LIBVIRT_CONF_OPTS += -Dlibnl=disabled
  130. endif
  131. ifeq ($(BR2_PACKAGE_LIBPCAP),y)
  132. LIBVIRT_CONF_OPTS += -Dlibpcap=enabled
  133. LIBVIRT_DEPENDENCIES += libpcap
  134. else
  135. LIBVIRT_CONF_OPTS += -Dlibpcap=disabled
  136. endif
  137. ifeq ($(BR2_PACKAGE_NUMACTL),y)
  138. LIBVIRT_CONF_OPTS += -Dnumactl=enabled
  139. LIBVIRT_DEPENDENCIES += numactl
  140. else
  141. LIBVIRT_CONF_OPTS += -Dnumactl=disabled
  142. endif
  143. ifeq ($(BR2_PACKAGE_POLKIT),y)
  144. LIBVIRT_CONF_OPTS += -Dpolkit=enabled
  145. LIBVIRT_DEPENDENCIES += polkit
  146. else
  147. LIBVIRT_CONF_OPTS += -Dpolkit=disabled
  148. endif
  149. ifeq ($(BR2_PACKAGE_READLINE),y)
  150. LIBVIRT_CONF_OPTS += -Dreadline=enabled
  151. LIBVIRT_DEPENDENCIES += readline
  152. else
  153. LIBVIRT_CONF_OPTS += -Dreadline=disabled
  154. endif
  155. ifeq ($(BR2_PACKAGE_LIBSELINUX),y)
  156. LIBVIRT_CONF_OPTS += -Dselinux=enabled -Dsecdriver_selinux=enabled \
  157. -Dselinux_mount=/sys/fs/selinux
  158. LIBVIRT_DEPENDENCIES += libselinux
  159. else
  160. LIBVIRT_CONF_OPTS += -Dselinux=disabled -Dsecdriver_selinux=disabled
  161. endif
  162. ifeq ($(BR2_PACKAGE_LVM2_STANDARD_INSTALL),y)
  163. LIBVIRT_CONF_OPTS += -Dstorage_lvm=enabled
  164. LIBVIRT_DEPENDENCIES += host-lvm2 lvm2
  165. else
  166. LIBVIRT_CONF_OPTS += -Dstorage_lvm=disabled
  167. endif
  168. ifeq ($(BR2_PACKAGE_YAJL),y)
  169. LIBVIRT_CONF_OPTS += -Dyajl=enabled
  170. LIBVIRT_DEPENDENCIES += yajl
  171. else
  172. LIBVIRT_CONF_OPTS += -Dyajl=disabled
  173. endif
  174. ifeq ($(BR2_PACKAGE_LIBVIRT_DAEMON),y)
  175. # Network is used by daemon, only
  176. LIBVIRT_CONF_OPTS += \
  177. -Ddriver_interface=enabled \
  178. -Ddriver_libvirtd=enabled \
  179. -Ddriver_network=enabled
  180. ifeq ($(BR2_PACKAGE_LIBSSH),y)
  181. LIBVIRT_CONF_OPTS += -Dlibssh=enabled
  182. LIBVIRT_DEPENDENCIES += libssh
  183. else
  184. LIBVIRT_CONF_OPTS += -Dlibssh=disabled
  185. endif
  186. # Can't build nss plugin without network or yajl
  187. ifeq ($(BR2_PACKAGE_LIBNSS)$(BR2_PACKAGE_YAJL),yy)
  188. LIBVIRT_CONF_OPTS += -Dnss=enabled
  189. LIBVIRT_DEPENDENCIES += libnss
  190. else
  191. LIBVIRT_CONF_OPTS += -Dnss=disabled
  192. endif
  193. ifeq ($(BR2_PACKAGE_LIBSSH2),y)
  194. LIBVIRT_CONF_OPTS += -Dlibssh2=enabled
  195. LIBVIRT_DEPENDENCIES += libssh2
  196. else
  197. LIBVIRT_CONF_OPTS += -Dlibssh2=disabled
  198. endif
  199. ifeq ($(BR2_PACKAGE_LIBVIRT_LXC),y)
  200. LIBVIRT_CONF_OPTS += -Dlogin_shell=enabled -Ddriver_lxc=enabled
  201. LIBVIRT_DEPENDENCIES += lxc
  202. else
  203. LIBVIRT_CONF_OPTS += -Dlogin_shell=disabled -Ddriver_lxc=disabled
  204. endif
  205. ifeq ($(BR2_PACKAGE_LIBVIRT_QEMU),y)
  206. LIBVIRT_CONF_OPTS += -Ddriver_qemu=enabled -Dqemu_user=qemu -Dqemu_group=kvm
  207. else
  208. LIBVIRT_CONF_OPTS += -Ddriver_qemu=disabled -Dqemu_user=no -Dqemu_group=no
  209. endif
  210. else # BR2_PACKAGE_LIBVIRT_DAEMON
  211. LIBVIRT_CONF_OPTS += \
  212. -Ddriver_interface=disabled \
  213. -Ddriver_libvirtd=disabled \
  214. -Ddriver_network=disabled
  215. endif
  216. define LIBVIRT_INSTALL_UDEV_RULES
  217. $(INSTALL) -D -m 644 package/libvirt/90-kvm.rules \
  218. $(TARGET_DIR)/etc/udev/rules.d/90-kvm.rules
  219. endef
  220. LIBVIRT_POST_INSTALL_TARGET_HOOKS += LIBVIRT_INSTALL_UDEV_RULES
  221. ifeq ($(BR2_PACKAGE_LIBVIRT_QEMU),y)
  222. define LIBVIRT_USERS_QEMU
  223. qemu -1 kvm -1 * - - - Libvirt qemu/kvm daemon
  224. endef
  225. define LIBVIRT_PERMISSIONS_QEMU
  226. /var/cache/libvirt/qemu d 750 qemu kvm - - - - -
  227. /var/cache/libvirt/qemu/capabilities d 755 root root - - - - -
  228. /var/lib/libvirt/qemu d 751 qemu kvm - - - - -
  229. /var/lib/libvirt/qemu/autostart d 700 root root - - - - -
  230. /var/lib/libvirt/qemu/channel d 755 qemu kvm - - - - -
  231. /var/lib/libvirt/qemu/channel/target d 755 qemu kvm - - - - -
  232. /var/lib/libvirt/qemu/dump d 755 qemu kvm - - - - -
  233. /var/lib/libvirt/qemu/networks d 700 root root - - - - -
  234. /var/lib/libvirt/qemu/networks/autostart d 700 root root - - - - -
  235. /var/lib/libvirt/qemu/nvram d 755 qemu kvm - - - - -
  236. /var/lib/libvirt/qemu/save d 755 qemu kvm - - - - -
  237. /var/lib/libvirt/qemu/snapshot d 755 qemu kvm - - - - -
  238. /var/log/libvirt/qemu d 750 root root - - - - -
  239. /var/log/swtpm/libvirt/qemu d 711 root root - - - - -
  240. endef
  241. define LIBVIRT_CREATE_SYMLINKS_QEMU
  242. $(INSTALL) -m 751 -d $(TARGET_DIR)/var/lib/libvirt/qemu
  243. ln -s -f ../../var/lib/libvirt/qemu $(TARGET_DIR)/etc/libvirt/
  244. endef
  245. endif
  246. define LIBVIRT_USERS
  247. $(LIBVIRT_USERS_QEMU)
  248. endef
  249. # Adjust directory ownerships and permissions. Notice /var/log is a symlink to
  250. # /tmp in the default sysvinit skeleton, so some directories may disappear at
  251. # run-time. Set the permissions anyway, since they are valid for the default
  252. # systemd skeleton.
  253. define LIBVIRT_PERMISSIONS
  254. /etc/libvirt d 700 root root - - - - -
  255. /etc/libvirt/nwfilter d 700 root root - - - - -
  256. /var/lib/libvirt d 755 root root - - - - -
  257. /var/lib/libvirt/boot d 711 root root - - - - -
  258. /var/lib/libvirt/dnsmasq d 755 root root - - - - -
  259. /var/lib/libvirt/filesystems d 711 root root - - - - -
  260. /var/lib/libvirt/images d 711 root root - - - - -
  261. /var/lib/libvirt/network d 700 root root - - - - -
  262. /var/lib/libvirt/secrets d 700 root root - - - - -
  263. /var/lib/libvirt/storage d 755 root root - - - - -
  264. /var/lib/libvirt/storage/autostart d 755 root root - - - - -
  265. /var/cache/libvirt d 711 root root - - - - -
  266. /var/cache/libvirt/lxc d 750 root root - - - - -
  267. /var/log/libvirt d 700 root root - - - - -
  268. /var/log/libvirt/lxc d 750 root root - - - - -
  269. /var/log/swtpm d 755 root root - - - - -
  270. /var/log/swtpm/libvirt d 755 root root - - - - -
  271. $(LIBVIRT_PERMISSIONS_QEMU)
  272. endef
  273. # libvirt may need to create persistent files (e.g. VM definitions) in these
  274. # directories. Move them to /var/lib because /etc may be on a read-only or
  275. # volatile (initramfs) filesystem. We could tweak the code to change these
  276. # paths but the patch would be large and would break compatibility with
  277. # ordinary installations and with the documentation.
  278. define LIBVIRT_CREATE_SYMLINKS
  279. $(INSTALL) -m 700 -d $(TARGET_DIR)/etc/libvirt
  280. $(INSTALL) -m 755 -d $(TARGET_DIR)/var/lib/libvirt
  281. $(INSTALL) -m 700 -d $(TARGET_DIR)/var/lib/libvirt/secrets
  282. $(INSTALL) -m 755 -d $(TARGET_DIR)/var/lib/libvirt/storage
  283. ln -s -f ../../var/lib/libvirt/secrets $(TARGET_DIR)/etc/libvirt/
  284. ln -s -f ../../var/lib/libvirt/storage $(TARGET_DIR)/etc/libvirt/
  285. $(LIBVIRT_CREATE_SYMLINKS_QEMU)
  286. endef
  287. LIBVIRT_PRE_INSTALL_TARGET_HOOKS += LIBVIRT_CREATE_SYMLINKS
  288. ifeq ($(BR2_PACKAGE_LIBVIRT_DAEMON),y)
  289. define LIBVIRT_INSTALL_INIT_SYSV
  290. $(INSTALL) -D -m 0755 package/libvirt/S91virtlogd $(TARGET_DIR)/etc/init.d/S91virtlogd
  291. $(INSTALL) -D -m 0755 package/libvirt/S92libvirtd $(TARGET_DIR)/etc/init.d/S92libvirtd
  292. endef
  293. endif
  294. $(eval $(meson-package))