actions.py 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. # -*- coding: utf-8 -*-
  2. #
  3. # Licensed under the GNU General Public License, version 3.
  4. # See the file http://www.gnu.org/licenses/gpl.txt
  5. from pisi.actionsapi import get
  6. from pisi.actionsapi import autotools
  7. from pisi.actionsapi import pisitools
  8. from pisi.actionsapi import shelltools
  9. from pisi.actionsapi import pythonmodules
  10. from pisi.actionsapi import kerneltools
  11. VBoxLibDir = "/usr/lib/virtualbox"
  12. VBoxDataDir = "/usr/share/virtualbox"
  13. KDIR = kerneltools.getKernelVersion()
  14. def setup():
  15. # shelltools.system("sed -i -e 's|pkg-config Qt6Core Qt6Gui|pkg-config Qt6Core|' configure")
  16. pisitools.dosed("LocalConfig.kmk", "__VBOXLIBDIR__", VBoxLibDir)
  17. pisitools.dosed("LocalConfig.kmk", "__VBOXDATADIR__", VBoxDataDir)
  18. shelltools.echo("vbox.cfg", "INSTALL_DIR=%s" % VBoxLibDir)
  19. # TODO: Enable web service when we have soapcpp2
  20. autotools.rawConfigure("\
  21. --with-makeself=/bin/echo \
  22. --disable-docs \
  23. --enable-vde \
  24. --enable-vnc \
  25. --enable-webservice \
  26. --with-linux=/usr/src/linux-headers-%s \
  27. --with-gcc=%s \
  28. --with-g++=%s \
  29. " % (KDIR, get.CC(), get.CXX()))
  30. def build():
  31. shelltools.system("source %s/env.sh && kmk" % get.curDIR())
  32. def install():
  33. # dkms packages
  34. with open("env.sh") as f:
  35. for l in f.readlines():
  36. if l.startswith("KBUILD_HOST_ARCH"):
  37. a = l.split("=")[1].strip()[1:-1]
  38. break
  39. pisitools.dosed("dkms.conf", "@VERSION@", get.srcVERSION())
  40. pisitools.dosed("dkms-guest.conf", "@VERSION@", get.srcVERSION())
  41. pisitools.insinto("/usr/src/%s-%s" % (get.srcNAME(), get.srcVERSION()), "out/linux.%s/release/bin/src/*" % a)
  42. pisitools.insinto("/usr/src/%s-%s" % (get.srcNAME(), get.srcVERSION()), "include")
  43. pisitools.insinto("/usr/src/%s-%s" % (get.srcNAME(), get.srcVERSION()), "dkms.conf")
  44. pisitools.insinto("/usr/src/%s-guest-%s" % (get.srcNAME(), get.srcVERSION()), "out/linux.%s/release/bin/additions/src/*" % a)
  45. pisitools.insinto("/usr/src/%s-guest-%s" % (get.srcNAME(), get.srcVERSION()), "dkms-guest.conf", "dkms.conf")
  46. shelltools.system("awk '$1 ~ /Version:/ { print gensub(/([0-9]+)\.([0-9]+).*/, \"\\\\1\\\\2\", \"g\", $2) }' /usr/lib/pkgconfig/xorg-server.pc > XorgVersion")
  47. with open("XorgVersion", "r") as f:
  48. XorgVersion = f.readline().strip()
  49. pisitools.insinto("/etc/vbox", "vbox.cfg")
  50. shelltools.chmod("src/VBox/Additions/x11/Installer/98vboxadd-xclient", 0755)
  51. pisitools.insinto("/usr/bin", "src/VBox/Additions/x11/Installer/98vboxadd-xclient", "VBoxClient-all")
  52. #pisitools.insinto("/etc/xdg/autostart", "src/VBox/Additions/x11/Installer/vboxclient.desktop")
  53. #pisitools.insinto("/lib/udev/rules.d", "src/VBox/Additions/linux/installer/70-xorg-vboxmouse.rules")
  54. pisitools.insinto("/usr/share/X11/pci", "src/VBox/Additions/x11/Installer/vboxvideo.ids")
  55. #pisitools.insinto("/usr/share/X11/xorg.conf.d", "src/VBox/Additions/x11/Installer/50-vboxmouse.conf")
  56. arch = "amd64" if get.ARCH() == "x86_64" else "x86"
  57. shelltools.cd("out/linux.%s/release/bin" % arch)
  58. # libraries installation. The files below are unnecessary files.
  59. # TODO: change loop and make it more discrete (i.e copying each single file)
  60. exclude = ("additions", "icons", "nls", "scm", "sdk", "src", "SUP", "vboxkeyboard",
  61. "VBox.sh", "VBoxSysInfo.sh", "VBoxCreateUSBNode.sh", "VBoxTunctl", "testcase", "tst", "xpidl")
  62. for _file in shelltools.ls("."):
  63. if _file.startswith(exclude):
  64. continue
  65. print "Installing %s ..." % _file
  66. pisitools.insinto(VBoxLibDir, _file)
  67. pisitools.dobin("VBox*.sh", VBoxDataDir)
  68. pisitools.insinto(VBoxDataDir, "nls")
  69. # TODO: Add vboxwebsrv when ready
  70. # Binaries and Wrapper with Launchers
  71. apps = ("VBoxHeadless", "VBoxManage", "VBoxSDL", "VBoxVRDP", "VirtualBox", "VBoxBalloonCtrl")
  72. for link in apps:
  73. pisitools.dosym("../share/virtualbox/VBox.sh", "/usr/bin/%s" % link)
  74. # pisitools.dobin("VBoxTunctl")
  75. # Desktop file, mimetype file for xml and icon
  76. pisitools.domove("%s/*.desktop" % VBoxLibDir, "/usr/share/applications")
  77. pisitools.domove("%s/*.png" % VBoxLibDir, "/usr/share/pixmaps")
  78. pisitools.domove("%s/*.xml" % VBoxLibDir, "/usr/share/mime/packages")
  79. # Mimetypes icons
  80. for size in ["16", "20", "24", "32", "48", "64", "72", "96", "128", "256"]:
  81. pisitools.insinto("/usr/share/icons/hicolor/%sx%s/mimetypes" % (size, size),
  82. "icons/%sx%s/*.png" % (size, size))
  83. # Guest additions
  84. pisitools.dobin("additions/VBoxClient")
  85. pisitools.dobin("additions/VBoxControl")
  86. pisitools.dobin("additions/VBoxDRMClient")
  87. pisitools.dobin("additions/vboxwl")
  88. pisitools.dosbin("additions/VBoxService")
  89. pisitools.dosbin("additions/mount.vboxsf", "/sbin")
  90. pisitools.insinto("/lib/security", "additions/pam_vbox.so")
  91. #pisitools.dolib("additions/VBoxOGL*")
  92. #pisitools.dosym("../../../VBoxOGL.so", "/usr/lib/xorg/modules/dri/vboxvideo_dri.so")
  93. #pisitools.insinto("/usr/lib/xorg/modules/drivers", "additions/vboxvideo_drv_system.so", "vboxvideo.so")
  94. #pisitools.insinto("/usr/lib/xorg/modules/input", "additions/vboxmouse_drv_%s.so" % XorgVersion, "vboxmouse_drv.so")
  95. # Python bindings
  96. pisitools.insinto("%s/sdk/bindings/xpcom" % VBoxLibDir, "sdk/bindings/xpcom/python")
  97. shelltools.cd("sdk/installer/python/vboxapi")
  98. # shelltools.copy("vboxapisetup.py", "setup.py")
  99. shelltools.export("VBOX_INSTALL_PATH", VBoxLibDir)
  100. pythonmodules.install()
  101. shelltools.cd("../../../..")
  102. mvb_name = "module-virtualbox-%s" % get.srcVERSION()
  103. mvbg_name = "module-virtualbox-guest-%s" % get.srcVERSION()
  104. shelltools.copy("src", "%s/%s" % (get.workDIR(), mvb_name))
  105. shelltools.copy("additions/src", "%s/%s" % (get.workDIR(), mvbg_name))
  106. shelltools.cd(get.workDIR())
  107. shelltools.system("tar c %s | xz -9 > %s.tar.xz" % ((mvb_name, )*2))
  108. shelltools.unlinkDir(mvb_name)
  109. shelltools.system("tar c %s | xz -9 > %s.tar.xz" % ((mvbg_name, )*2))
  110. shelltools.unlinkDir(mvbg_name)