actions.py 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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. ppcemb-softmmu 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. # disable fdt until dtc is in repo
  50. # pisitools.dosed("configure", 'fdt="yes"', 'fdt="no"')
  51. shelltools.export("CFLAGS", cflags)
  52. shelltools.export("LDFLAGS", extraldflags)
  53. # different build dir setups are not supported yet, so we build kvm by hand for now
  54. printfancy("configuring kvm")
  55. autotools.rawConfigure('%s \
  56. --target-list="%s" \
  57. ' % (cfgParamsCommon, targetListKvm))
  58. printfancy("building kvm")
  59. autotools.make("V=1 -j1 config-host.h %s" % buildldflags)
  60. autotools.make("V=1 %s" % buildldflags)
  61. shelltools.copy("x86_64-softmmu/qemu-system-x86_64", "qemu-kvm")
  62. autotools.make("clean")
  63. # kvmtest stuff is not in upstream tarball anymore, but they may put it back, be ready
  64. #printfancy("configuring kvmtest")
  65. #shelltools.cd(builddirkvmtest)
  66. #autotools.rawConfigure("--prefix=/usr \
  67. # --kerneldir=../../kernel")
  68. #shelltools.cd("../..")
  69. printfancy("configuring qemu")
  70. autotools.rawConfigure('%s \
  71. --target-list="%s" \
  72. --disable-kvm \
  73. ' % (cfgParamsCommon, targetList))
  74. #--interp-prefix=%{_prefix}/qemu-%%M \
  75. #--enable-system \
  76. #--enable-linux-user \
  77. def build():
  78. shelltools.export("CFLAGS", cflags)
  79. shelltools.export("LDFLAGS", extraldflags)
  80. printfancy("building qemu")
  81. autotools.make("V=1 -j1 config-host.h %s" % buildldflags)
  82. autotools.make("V=1 %s" % buildldflags)
  83. #printfancy("building kvmtest")
  84. #autotools.make("-C %s V=1 kvmtrace" % builddirkvmtest)
  85. def install():
  86. autotools.rawInstall('DESTDIR="%s"' % get.installDIR())
  87. # Install kvm-tools
  88. #pisitools.dobin("kvm/test/kvmtrace")
  89. #pisitools.dobin("kvm/test/kvmtrace_format")
  90. #pisitools.dobin("kvm/kvm_stat")
  91. pisitools.dobin("qemu-kvm")
  92. shelltools.system("chmod u+s %s/usr/lib/qemu/qemu-bridge-helper" % get.installDIR())
  93. pisitools.insinto("/etc/sasl2/", "qemu.sasl", "qemu.conf")
  94. for i in ["pc-bios/README", "LICENSE", "README", "COPYING*"]:
  95. pisitools.dodoc(i)