Advertisement
Guest User

PKGBUILD

a guest
Sep 28th, 2014
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.82 KB | None | 0 0
  1.  
  2. pkgname=qemu-user-static
  3. pkgver=2.1
  4. pkgrel=1
  5. pkgdesc="A generic and open source processor emulator which achieves a good emulation speed by using dynamic translation, statically linked."
  6. arch=('i686' 'x86_64')
  7. license=('GPL2' 'LGPL2.1')
  8. url="http://wiki.qemu.org/Index.html"
  9. depends=()
  10. optdepends=('binfmt-support: to allow handling foreign ELF binaries and executing them via qemu')
  11. conflicts=()
  12. _arch=i386
  13. [ "$CARCH" = 'x86_64' ] && _arch=amd64
  14. _debsrc=${pkgname}_${pkgver}+dfsg-5_${_arch}.deb
  15. source=(http://ftp.debian.org/debian/pool/main/q/qemu/${_debsrc})
  16. sha1sums=('2e90fac99ad4545840a6a762f96b7f9c73448c6c')
  17. [ "$CARCH" = 'i686' ] && sha1sums=('b9d74a745e09fa7188a9c27e710ced87f5888224')
  18.  
  19. prepare() {
  20. cd "$srcdir"
  21. ar p ${_debsrc} data.tar.xz | bsdtar xf -
  22. }
  23.  
  24. package() {
  25. cd "$pkgdir"
  26. mkdir -p "$pkgdir"/usr/bin/
  27. mkdir -p "$pkgdir"/usr/share/man/
  28. mkdir -p "$pkgdir"/var/lib/binfmts/
  29.  
  30. cp "$srcdir"/usr/bin/* "$pkgdir"/usr/bin/
  31. cp "$srcdir"/usr/share/man/man1 "$pkgdir"/usr/share/man/ -r
  32.  
  33. create_binfmts
  34. }
  35.  
  36. create_binfmts() {
  37. aarch64_magic='\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xb7'
  38. aarch64_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
  39. alpha_magic='\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x26\x90'
  40. alpha_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff'
  41. arm_magic='\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00'
  42. arm_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff'
  43. armeb_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28'
  44. armeb_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
  45. cris_magic='\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x4c\x00'
  46. cris_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff'
  47. m68k_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x04'
  48. m68k_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
  49. microblaze_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\xba\xab'
  50. microblaze_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
  51. mips_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08'
  52. mips_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
  53. mipsel_magic='\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00'
  54. mipsel_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xfe\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff'
  55. ppc_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x14'
  56. ppc_mask='\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
  57. ppc64_magic='\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x15'
  58. ppc64_mask='\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
  59. ppc64abi32_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x15'
  60. ppc64abi32_mask='\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
  61. s390x_magic='\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x16'
  62. s390x_mask='\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
  63. sh4_magic='\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x2a\x00'
  64. sh4_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff'
  65. sh4eb_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x2a'
  66. sh4eb_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
  67. sparc_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x02'
  68. sparc_mask='\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
  69. sparc32plus_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x12'
  70. sparc32plus_mask='\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
  71. sparc64_magic='\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x2b'
  72. sparc64_mask='\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
  73.  
  74. # Drop support for emulating amd64 on i386, http://bugs.debian.org/604712
  75. fmts="aarch64 alpha arm armeb cris m68k microblaze mips mipsel ppc ppc64 ppc64abi32 s390x sh4 sh4eb sparc sparc32plus sparc64"
  76.  
  77. for fmt in $fmts ; do
  78. eval "magic=\"\$${fmt}_magic\" mask=\"\$${fmt}_mask\""
  79. cat >> "${pkgdir}/var/lib/binfmts/qemu-$fmt" << EOF
  80. package qemu-user-static
  81. interpreter /usr/bin/qemu-$fmt-static
  82. credentials yes
  83. offset 0
  84. magic $magic
  85. mask $mask
  86. EOF
  87. done
  88. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement