summaryrefslogtreecommitdiff
path: root/libre/qemu-static/PKGBUILD
blob: f281baa5f0668a08b3152ceaf9f08972670320db (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# Maintainer: Márcio Silva <coadde@hyperbola.info>
# based of qemu

pkgbase=qemu
pkgname=(qemu-static binfmt-qemu-static)
pkgver=2.8.0
pkgrel=1
arch=(i686 x86_64 armv7h)
license=(GPL2 LGPL2.1)
url="http://wiki.qemu.org/"
makedepends=(pixman-static glib2-static pcre-static python2)
source=("$url/download/${pkgbase}-${pkgver}.tar.bz2"{,.sig}
        qemu-{extra,aarch64,arm,i386,mips,mips64,x86_64}-static.conf)
sha256sums=('dafd5d7f649907b6b617b822692f4c82e60cf29bc0fc58bc2036219b591e5e62'
            'SKIP'
            '2e87f745595f779df820b32dddbba6af634918134c311ae634b88453dc0b7861'
            'e91ff2371250137cca405645c8a8d0647d5229f3c38e28c3c1ef0511747ab73d'
            '40a6b6a330e7f624516232be85ac814a24464eeff1097e037f75ed4f16319e74'
            'c7374b6c643971af382e873fbb7c6f5e549bfdfeaad5a22d4a21d99918e779aa'
            'e36af2cc4238b953a0fabb5bf032dfbd584bbf8bb0836e71621006ec0fa170af'
            '2f8eadb0adc7bcd67b21e898fbbc808300094a584e5e28f45024d8016110e066'
            '6c69ddc9ce44827e55e54cf78a2632292a440b5c222e6e4e904d962a7af39ff2')
validpgpkeys=('CEACC9E15534EBABB82D3FA03353C9CEF108B584')

prepare() {
  mkdir build-static
  mkdir -p extra-arch-static/usr/{bin,share/qemu}

  cd ${pkgbase}-${pkgver}
  sed -i 's/vte-2\.90/vte-2.91/g' configure
}

build() {
  _build static \
    --audio-drv-list= \
    --disable-bluez \
    --disable-sdl \
    --disable-gtk \
    --disable-vte \
    --disable-opengl \
    --disable-virglrenderer \
    --disable-brlapi \
    --disable-docs \
    --disable-linux-aio \
    --disable-seccomp \
    --disable-spice \
    --disable-{rbd,glusterfs,libiscsi,curl} \
    --disable-system \
    --static \
    --disable-vnc \
    --disable-attr \
    --disable-blobs \
    --disable-vhost-net \
    --disable-bzip2 \
    --disable-libssh2 \
    --disable-gcrypt \
    --disable-nettle \
    --disable-curses \
    --disable-kvm \
    --disable-guest-agent
}

_build() {
  cd build-$1

  # qemu vs. make 4 == bad
  export ARFLAGS=rv

  # http://permalink.gmane.org/gmane.comp.emulators.qemu/238740
  export CFLAGS+=" -fPIC"

  ../${pkgbase}-${pkgver}/configure \
    --prefix=/usr \
    --sysconfdir=/etc \
    --localstatedir=/var \
    --libexecdir=/usr/lib/qemu \
    --python=/usr/bin/python2 \
    --smbd=/usr/bin/smbd \
    --disable-modules \
    --disable-jemalloc \
    "${@:2}"

  make
}

_package() {
  options=(!strip)

  make -C build-$1 DESTDIR="$pkgdir" install "${@:2}"

  cd "$pkgdir"/usr/bin
  tidy_strip

  # remove extra arch
  for _bin in qemu-*; do
    [[ -f $_bin ]] || continue

    case ${_bin#qemu-} in
      # tools
      img|io|nbd) rm "$_bin"; continue ;;
    esac

    mv "$_bin"{,-static}
  done

  # remove conflicting files
  rm -vr ../{lib,share}
  rm -v ivshmem-{client,server}
}

package_qemu-static() {
  pkgdesc="QEMU for foreign architectures (static binaries only)"
  replaces=(qemu-{static-arch-extra,arch-extra-static})
  conflicts=(qemu-{static-arch-extra,arch-extra-static})
  options=(!strip)

  _package static
}

package_binfmt-qemu-static() {
  pkgdesc='Register qemu-static interpreters for various binary formats'
  depends=(qemu-static)

  install -dm755 "${pkgdir}"/usr/lib/binfmt.d

  if [[ $CARCH = x86_64 ]]; then
    install -m644 "${srcdir}"/qemu-x86_64-static.conf "${pkgdir}"/usr/lib/binfmt.d/qemu-static.conf
  elif [[ $CARCH = i686 ]]; then
    install -m644 "${srcdir}"/qemu-i386-static.conf "${pkgdir}"/usr/lib/binfmt.d/qemu-static.conf
  elif [[ $CARCH = armv7h ]]; then
    install -m644 "${srcdir}"/qemu-arm-static.conf "${pkgdir}"/usr/lib/binfmt.d/qemu-static.conf
  elif [[ $CARCH = mips64el ]]; then
    install -m644 "${srcdir}"/qemu-mips64-static.conf "${pkgdir}"/usr/lib/binfmt.d/qemu-static.conf
  fi
  install -m644 "${srcdir}"/qemu-extra-static.conf "${pkgdir}"/usr/lib/binfmt.d/qemu-extra-static.conf
}