actions.py 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. #!/usr/bin/python
  2. # -*- coding: utf-8 -*-
  3. #
  4. # Licensed under the GNU General Public License, version 3.
  5. # See the file http://www.gnu.org/licenses/gpl.txt
  6. from pisi.actionsapi import autotools
  7. from pisi.actionsapi import pisitools
  8. from pisi.actionsapi import shelltools
  9. from pisi.actionsapi import get
  10. NoStrip = ["/usr/share/qemu"]
  11. shelltools.export("LC_ALL", "C")
  12. # disable debug to prevent memory exhaustion by linker
  13. # cflags = get.CFLAGS().replace("-fpie", "").replace("-fstack-protector", "").replace("-ggdb3 -funwind-tables -fasynchronous-unwind-tables", "")
  14. cflags = get.CFLAGS().replace("-fpie", "").replace("-fstack-protector", "")
  15. #extraldflags="-Wl,--build-id"
  16. #buildldflags="VL_LDFLAGS=-Wl,--build-id"
  17. extraldflags=""
  18. buildldflags=""
  19. soundDrivers = "pa,sdl,alsa"
  20. builddirkvmtest = "kvm/test"
  21. #targetKvmList = "i386-softmmu x86_64-softmmu i386-linux-user x86_64-linux-user"
  22. targetListKvm = "x86_64-softmmu"
  23. targetList = "i386-softmmu x86_64-softmmu arm-softmmu cris-softmmu m68k-softmmu \
  24. mips-softmmu mipsel-softmmu mips64-softmmu mips64el-softmmu ppc-softmmu \
  25. ppc64-softmmu sh4-softmmu sh4eb-softmmu sparc-softmmu \
  26. i386-linux-user x86_64-linux-user alpha-linux-user arm-linux-user \
  27. armeb-linux-user cris-linux-user m68k-linux-user mips-linux-user \
  28. mipsel-linux-user ppc-linux-user ppc64-linux-user ppc64abi32-linux-user \
  29. sh4-linux-user sh4eb-linux-user sparc-linux-user sparc64-linux-user \
  30. sparc32plus-linux-user"
  31. cfgParamsCommon = '--prefix=/usr \
  32. --sysconfdir=/etc \
  33. --mandir=/usr/share/man \
  34. --cc="%s" \
  35. --host-cc="%s" \
  36. --extra-cflags="%s" \
  37. --extra-ldflags="%s" \
  38. --audio-drv-list="%s" \
  39. --libexecdir=/usr/lib/qemu \
  40. --disable-xen \
  41. --disable-werror \
  42. --localstatedir=/ \
  43. --disable-strip' % (get.CC(), get.CC(), cflags, extraldflags, soundDrivers)
  44. def printfancy(msg):
  45. print
  46. print "===== %s =====" % msg
  47. print
  48. def setup():
  49. #shelltools.system("sed -i 's/ memfd_create/ qemu_memfd_create/' util/memfd.c")
  50. # disable fdt until dtc is in repo
  51. # pisitools.dosed("configure", 'fdt="yes"', 'fdt="no"')
  52. shelltools.export("CFLAGS", cflags)
  53. shelltools.export("LDFLAGS", extraldflags)
  54. # different build dir setups are not supported yet, so we build kvm by hand for now
  55. printfancy("configuring kvm")
  56. autotools.rawConfigure('%s \
  57. --target-list="%s" \
  58. ' % (cfgParamsCommon, targetListKvm))
  59. printfancy("building kvm")
  60. autotools.make("V=1 -j1 config-host.h %s" % buildldflags)
  61. autotools.make("V=1 %s" % buildldflags)
  62. shelltools.copy("x86_64-softmmu/qemu-system-x86_64", "qemu-kvm")
  63. autotools.make("clean")
  64. # kvmtest stuff is not in upstream tarball anymore, but they may put it back, be ready
  65. #printfancy("configuring kvmtest")
  66. #shelltools.cd(builddirkvmtest)
  67. #autotools.rawConfigure("--prefix=/usr \
  68. # --kerneldir=../../kernel")
  69. #shelltools.cd("../..")
  70. printfancy("configuring qemu")
  71. autotools.rawConfigure('%s \
  72. --target-list="%s" \
  73. --disable-kvm \
  74. ' % (cfgParamsCommon, targetList))
  75. #--interp-prefix=%{_prefix}/qemu-%%M \
  76. #--enable-system \
  77. #--enable-linux-user \
  78. def build():
  79. shelltools.export("CFLAGS", cflags)
  80. shelltools.export("LDFLAGS", extraldflags)
  81. printfancy("building qemu")
  82. autotools.make("V=1 -j1 config-host.h %s" % buildldflags)
  83. autotools.make("V=1 %s" % buildldflags)
  84. #printfancy("building kvmtest")
  85. #autotools.make("-C %s V=1 kvmtrace" % builddirkvmtest)
  86. def install():
  87. autotools.rawInstall('DESTDIR="%s"' % get.installDIR())
  88. # Install kvm-tools
  89. #pisitools.dobin("kvm/test/kvmtrace")
  90. #pisitools.dobin("kvm/test/kvmtrace_format")
  91. #pisitools.dobin("kvm/kvm_stat")
  92. pisitools.dobin("qemu-kvm")
  93. shelltools.system("chmod u+s %s/usr/lib/qemu/qemu-bridge-helper" % get.installDIR())
  94. pisitools.insinto("/etc/sasl2/", "qemu.sasl", "qemu.conf")
  95. for i in ["pc-bios/README", "LICENSE", "README*", "COPYING*"]:
  96. pisitools.dodoc(i)