PKGBUILD 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. # Maintainer (Arch:qemu): Tobias Powalowski <tpowa@archlinux.org>
  2. # Contributor (Arch:qemu): Sébastien "Seblu" Luttringer <seblu@seblu.net>
  3. # Maintainer: Luke Shumaker <lukeshu@parabola.nu>
  4. # Contributor: Márcio Silva <coadde@hyperbola.info>
  5. # "Do I need to rebuild?" : A flowchart
  6. #
  7. # ,--> pixman-static ------------------------------------,
  8. # | 0.34.0-1.static2 |
  9. # qemu-user-static --+------------------------+----> pcre-static -----------+--> glibc
  10. # 2.12.0-1.static1 | | 8.42-1.static1 | 2.27-3
  11. # `--> glib2-static -------+----> libffi-static ---------+
  12. # 2.56.1-1.static1 | 3.2.1-2.static2 |
  13. # +----> libutil-linux-static --+
  14. # | 2.32-3.static1 |
  15. # `----> zlib ------------------'
  16. # 1:1.2.11-2
  17. _pkgbase=qemu
  18. pkgname=(qemu-user-static qemu-user-static-binfmt)
  19. pkgdesc="A generic and open source machine emulator and virtualizer"
  20. pkgver=3.1.0
  21. pkgrel=1
  22. pkgrel+=.static1
  23. arch=(x86_64)
  24. arch+=(i686 armv7h)
  25. license=(GPL2 LGPL2.1)
  26. url="http://wiki.qemu.org/"
  27. depends=()
  28. makedepends=(pixman-static python glib2-static pcre-static)
  29. source=(https://download.qemu.org/qemu-$pkgver.tar.xz{,.sig}
  30. allow_elf64.patch)
  31. sha512sums=('7e8dae823937cfac2f0c60406bd3bdcb89df40313dab2a4bed327d5198f7fcc68ac8b31e44692caa09299cc71256ee0b8c17e4f49f78ada8043d424f5daf82fe'
  32. 'SKIP'
  33. 'b450625ff1e705f8c7eed9e2c0c4fe2179ca061df88a1a777c861c11d543c151cd0160f7f7227babdfe8b36000de084cbcb6fd7bf0f93d2f936c2e65082c82bf')
  34. validpgpkeys=('CEACC9E15534EBABB82D3FA03353C9CEF108B584')
  35. case $CARCH in
  36. i?86) _corearch=i386 ;;
  37. x86_64) _corearch=x86_64 ;;
  38. esac
  39. prepare() {
  40. mkdir build-static
  41. mkdir -p extra-arch-static/usr/{bin,share/qemu}
  42. cd ${_pkgbase}-${pkgver}
  43. sed -i 's/vte-2\.90/vte-2.91/g' configure
  44. patch -p1 < ../allow_elf64.patch
  45. }
  46. build() {
  47. local flags=(
  48. --static
  49. --disable-system # disable building qemu-system-$CPU, we only want qemu-$CPU
  50. --enable-linux-user
  51. --disable-modules
  52. --disable-guest-agent # disable building qemu-ga
  53. --disable-guest-agent-msi
  54. --disable-tools # disable building the qemu-{io,nbd,img} tools
  55. --disable-blobs # disable installing firmware files used by system
  56. --disable-docs
  57. # jemalloc-static isn't packaged
  58. --disable-jemalloc
  59. # These libraries are only used for system or tools, but even
  60. # though that's disabled, libqemuutil.a still tries to link
  61. # against them unless we specifically tell it not to (the linkage
  62. # would be removed at the final linker's tree-shaking).
  63. --disable-gcrypt
  64. --disable-nettle
  65. )
  66. _build static "${flags[@]}" \
  67. --audio-drv-list= \
  68. --disable-bluez \
  69. --disable-sdl \
  70. --disable-gtk \
  71. --disable-vte \
  72. --disable-opengl \
  73. --disable-virglrenderer
  74. }
  75. _build() (
  76. cd build-$1
  77. # qemu vs. make 4 == bad
  78. export ARFLAGS=rv
  79. # http://permalink.gmane.org/gmane.comp.emulators.qemu/238740
  80. export CFLAGS+=" -fPIC"
  81. ../${_pkgbase}-${pkgver}/configure \
  82. --prefix=/usr \
  83. --sysconfdir=/etc \
  84. --localstatedir=/var \
  85. --libexecdir=/usr/lib/qemu \
  86. --python=/usr/bin/python3 \
  87. --smbd=/usr/bin/smbd \
  88. --with-sdlabi=2.0 \
  89. --enable-modules \
  90. --enable-jemalloc \
  91. "${@:2}"
  92. make V=1
  93. )
  94. package_qemu-user-static() {
  95. pkgdesc="QEMU user-mode emulation (static binaries)"
  96. make -C build-static DESTDIR="$pkgdir" install "${@:2}"
  97. rm -fvr -- "$pkgdir"/{var,usr/lib,usr/share}
  98. local prog
  99. for prog in "$pkgdir"/usr/bin/*; do
  100. mv -vnT -- "$prog" "${prog%-static}-static"
  101. done
  102. }
  103. package_qemu-user-static-binfmt() {
  104. pkgdesc="binfmt registration for QEMU user-mode emulation"
  105. depends=("qemu-user-static=$pkgver")
  106. cd ${_pkgbase}-${pkgver}
  107. install -d "$pkgdir"/usr/lib/binfmt.d
  108. ./scripts/qemu-binfmt-conf.sh \
  109. --qemu-path /usr/bin \
  110. --systemd ALL \
  111. --exportdir "$pkgdir"/usr/lib/binfmt.d \
  112. --credential yes
  113. # add the "-static" suffix
  114. sed -i 's/:[^:]*$/-static&/' -- "$pkgdir"/usr/lib/binfmt.d/*.conf
  115. }