summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 70f17d152073c64d1cb1eb13668a363739a01438 (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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
# Maintainer: Frederic Bezies <fredbezies@gmail.com>
# Contributor: ajs124 < aur at ajs124 dot de>
# Contributor: Devin Cofer <ranguvar{AT]archlinux[DOT}us>
# Contributor: Tobias Powalowski <tpowa@archlinux.org>
# Contributor: David Runge <dvzrv@archlinux.org>
# Contributor: S├ębastien "Seblu" Luttringer <seblu@seblu.net>

pkgbase=qemu-git
_gitname=qemu
pkgname=(
  qemu-git
  qemu-headless-git
  qemu-arch-extra-git
  qemu-headless-arch-extra-git
  qemu-block-{iscsi,rbd,gluster}-git
  qemu-guest-agent-git
)
pkgdesc="A generic and open source machine emulator and virtualizer. Git version."
pkgver=6.2.0.rc3.r0.g682aa69b1f
pkgrel=1
epoch=14
arch=(i686 x86_64)
license=(GPL2 LGPL2.1)
url="https://wiki.qemu.org/"
# TODO: consider providing rdma-core
# TODO: consider providing lzfse
makedepends=(
  alsa-lib
  brltty
  bzip2
  cairo
  ceph
  curl
  cdrtools
  dtc
  fuse3
  gcc-libs
  gdk-pixbuf2
  git
  glib2
  glusterfs
  gnutls
  gtk3
  jack
  libaio
  libbpf
  libcacard
  libcap-ng
  libepoxy
  libiscsi
  libnfs
  libpng
  libpulse
  libsasl
  libseccomp
  libslirp
  libssh
  liburing
  libusb
  libx11
  libxkbcommon
  lzo
  mesa
  meson
  ncurses
  ndctl
  numactl
  pam
  python
  python-sphinx
  python-sphinx_rtd_theme
  sdl2
  sdl2_image
  seabios
  snappy
  spice-protocol
  spice
  systemd
  usbredir
  vde2
  virglrenderer
  vte3
  xfsprogs
  zlib
  zstd
)
source=(git://git.qemu.org/qemu.git
        qemu-guest-agent.service
        65-kvm.rules)
sha256sums=('SKIP'
            'c39bcde4a09165e64419fd2033b3532378bba84d509d39e2d51694d44c1f8d88'
            'a66f0e791b16b03b91049aac61a25950d93e962e1b2ba64a38c6ad7f609b532c')

case $CARCH in
  i?86) _corearch=i386 ;;
  x86_64) _corearch=x86_64 ;;
esac

pkgver() {
  cd "${srcdir}/${_gitname}"
  git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g' | cut -c2-47
}

prepare() {
  cd "${srcdir}/${_gitname}"
  mkdir build-{full,headless}
  mkdir -p extra-arch-{full,headless}/usr/{bin,share/qemu}
}

build() {
  _build full \
    --audio-drv-list="pa,alsa,sdl,jack"

  _build headless \
    --audio-drv-list= \
    --disable-sdl \
    --disable-gtk \
    --disable-vte \
    --disable-brlapi \
    --disable-opengl \
    --disable-virglrenderer
}

_build() (
  cd ${srcdir}/${_gitname}/build-$1

  ../configure \
    --prefix=/usr \
    --sysconfdir=/etc \
    --localstatedir=/var \
    --libexecdir=/usr/lib/qemu \
    --smbd=/usr/bin/smbd \
    --enable-modules \
    --enable-sdl \
    --disable-werror \
    --enable-vhost-user \
    --enable-slirp=system \
    --enable-xfsctl \
    "${@:2}"

  ninja
)

package_qemu-git() {
  pkgdesc="QEMU Git version."
  depends=(
    alsa-lib libasound.so
    bzip2 libbz2.so
    cairo
    curl libcurl.so
    dtc
    fuse3
    gcc-libs
    gdk-pixbuf2 libgdk_pixbuf-2.0.so
    glib2 libgio-2.0.so libglib-2.0.so libgmodule-2.0.so libgobject-2.0.so
    gnutls
    gtk3 libgdk-3.so libgtk-3.so
    jack libjack.so
    libaio
    libbpf libbpf.so
    libcacard
    libcap-ng libcap-ng.so
    libepoxy
    libjpeg libjpeg.so
    libnfs
    libpng
    libpulse libpulse.so
    libsasl
    libseccomp libseccomp.so
    libslirp libslirp.so
    libssh libssh.so
    libusb libusb-1.0.so
    liburing liburing.so
    libx11
    libxkbcommon libxkbcommon.so
    lzo
    mesa
    ncurses libncursesw.so
    ndctl
    numactl libnuma.so
    pam libpam.so
    pixman libpixman-1.so
    seabios
    sdl2
    sdl2_image
    snappy
    spice libspice-server.so
    systemd-libs libudev.so
    usbredir
    virglrenderer
    vde2
    vte3 libvte-2.91.so
    zlib
    zstd libzstd.so
  )
  optdepends=(
    'brltty: for braille device support'
    'qemu-arch-extra-git: extra architectures support'
  )
  conflicts=('qemu-headless' 'qemu')
  provides=('qemu-headless' 'qemu')
  replaces=(qemu-kvm)

  _package full
}

package_qemu-headless-git() {
  pkgdesc="QEMU without GUI. Git version."
  depends=(
    bzip2 libbz2.so
    curl libcurl.so
    dtc
    fuse3
    gcc-libs
    glib2 libgio-2.0.so libglib-2.0.so libgmodule-2.0.so libgobject-2.0.so
    gnutls
    libaio
    libbpf libbpf.so
    libcacard
    libcap-ng libcap-ng.so
    libjpeg libjpeg.so
    libnfs
    libpng
    libsasl
    libseccomp libseccomp.so
    libslirp libslirp.so
    libssh libssh.so
    libusb libusb-1.0.so
    liburing liburing.so
    libxkbcommon libxkbcommon.so
    lzo
    ndctl
    numactl libnuma.so
    ncurses libncursesw.so
    pam libpam.so
    pixman libpixman-1.so
    seabios
    snappy
    spice libspice-server.so
    systemd-libs libudev.so
    usbredir
    vde2
    zlib
    zstd libzstd.so
  )
  optdepends=('qemu-headless-arch-extra-git: extra architectures support')
  conflicts=('qemu-headless' 'qemu')
  provides=('qemu-headless' 'qemu')
  replaces=(qemu-kvm)

  _package headless
}

_package() {
  optdepends+=('ovmf: Tianocore UEFI firmware for qemu'
               'samba: SMB/CIFS server support'
               'qemu-block-iscsi-git: iSCSI block support'
               'qemu-block-rbd-git: RBD block support'
               'qemu-block-gluster-git: glusterfs block support')
  install=qemu.install
  options=(!strip !emptydirs)

  DESTDIR="$pkgdir" ninja -C "${srcdir}/${_gitname}/build-$1" install "${@:2}"

  # systemd stuff
  install -Dm644 65-kvm.rules "$pkgdir/usr/lib/udev/rules.d/65-kvm.rules"

  # remove conflicting /var/run directory
  cd "$pkgdir"
  rm -r var

  cd usr/lib

  # bridge_helper needs suid
  # https://bugs.archlinux.org/task/32565
  chmod u+s qemu/qemu-bridge-helper

  # remove split block modules
  rm qemu/block-{iscsi,rbd,gluster}.so

  cd ../bin

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

    case ${_bin#qemu-} in
      # guest agent
      ga) rm "$_bin"; continue ;;

      # tools
      edid|img|io|keymap|nbd|pr-helper|storage-daemon) continue ;;

      # core emu
      system-${_corearch}) continue ;;
    esac

    mv "$_bin" "$srcdir/$_gitname/extra-arch-$1/usr/bin"
  done

  cd ../share/qemu
  for _blob in *; do
    [[ -f $_blob ]] || continue

    case $_blob in
      # provided by seabios package
      bios.bin|bios-256k.bin|vgabios-cirrus.bin|vgabios-qxl.bin|\
      vgabios-stdvga.bin|vgabios-vmware.bin|vgabios-virtio.bin|vgabios-bochs-display.bin|\
      vgabios-ramfb.bin) rm "$_blob"; continue ;;

      # provided by edk2-ovmf package
      edk2-*) rm "$_blob"; continue ;;

      # iPXE ROMs
      efi-*|pxe-*) continue ;;

      # core blobs
      bios-microvm.bin|kvmvapic.bin|linuxboot*|multiboot.bin|sgabios.bin|vgabios*) continue ;;

      # Trace events definitions
      trace-events*) continue ;;
    esac

    mv "$_blob" "$srcdir/$_gitname/extra-arch-$1/usr/share/qemu"
  done

  # provided by edk2-ovmf package
  rm -r firmware

  cd ..
  if [ "$1" = headless ]; then rm -r {applications,icons}; fi
}

package_qemu-arch-extra-git() {
  pkgdesc="QEMU for foreign architectures. Git version."
  depends=(
    dtc
    fuse3
    gcc-libs
    gnutls
    libaio
    libbpf libbpf.so
    glib2 libgio-2.0.so libglib-2.0.so libgobject-2.0.so libgmodule-2.0.so
    libjpeg libjpeg.so
    libpng
    libsasl
    libseccomp libseccomp.so
    libslirp libslirp.so
    liburing liburing.so
    lzo
    ndctl
    numactl libnuma.so
    pam libpam.so
    pixman libpixman-1.so
    snappy
    systemd-libs
    libudev.so
    qemu-git
    vde2
    zlib
    zstd
    libzstd.so
  )
  optdepends=(
    'edk2-armvirt: for aarch64 UEFI support'
    'edk2-ovmf: for ia32 and x64 UEFI support'
  )
  options=(!strip)
  provides=(qemu-arch-extra)
  conflicts=(qemu-arch-extra)

  mv -v "$srcdir/$_gitname/extra-arch-full/usr" "$pkgdir"
}

package_qemu-headless-arch-extra-git() {
  pkgdesc="QEMU without GUI, for foreign architectures. Git version."
  depends=(
    dtc
    fuse3
    gcc-libs
    gnutls
    libaio
    libbpf libbpf.so
    glib2 libgio-2.0.so libglib-2.0.so libgobject-2.0.so libgmodule-2.0.so
    libjpeg libjpeg.so
    libpng
    libsasl
    libseccomp libseccomp.so
    libslirp libslirp.so
    liburing liburing.so
    lzo
    ndctl
    numactl libnuma.so
    pam libpam.so
    pixman libpixman-1.so
    snappy
    qemu-headless-git
    systemd-libs libudev.so
    vde2
    zlib
    zstd libzstd.so
  )
  optdepends=(
    'edk2-armvirt: for aarch64 UEFI support'
    'edk2-ovmf: for ia32 and x64 UEFI support'
  )
  options=(!strip)
  conflicts=(qemu-headless-arch-extra)
  provides=(qemu-headless-arch-extra)

  mv -v "$srcdir/$_gitname/extra-arch-headless/usr" "$pkgdir"
}

package_qemu-block-iscsi-git() {
  pkgdesc="QEMU iSCSI block module. Git version."
  depends=(glibc libiscsi)
  conflicts=(qemu-block-iscsi)
  provides=(qemu-block-iscsi)

  install -vDm 755 "$srcdir/$_gitname/build-full/block-iscsi.so" -t "$pkgdir/usr/lib/qemu/"
}

package_qemu-block-rbd-git() {
  pkgdesc="QEMU RBD block module. Git version."
  depends=(glibc ceph-libs)
  conflicts=(qemu-block-rbd)
  provides=(qemu-block-rbd)

  install -vDm 755 "$srcdir/$_gitname/build-full/block-rbd.so" -t "$pkgdir/usr/lib/qemu/"
}

package_qemu-block-gluster-git() {
  pkgdesc="QEMU GlusterFS block module. Git version."
  depends=(glibc glusterfs)
  conflicts=(qemu-block-gluster)
  provides=(qemu-block-gluster)

  install -vDm 755 "$srcdir/$_gitname/build-full/block-gluster.so" -t "$pkgdir/usr/lib/qemu/"
}

package_qemu-guest-agent-git() {
  pkgdesc="QEMU Guest Agent. Git version."
  depends=(gcc-libs glib2 libudev.so liburing)
  conflicts=(qemu-guest-agent)
  provides=(qemu-guest-agent)
  install=qemu-guest-agent.install

  install -vDm 755 "$srcdir/$_gitname/build-full/qga/qemu-ga" -t "$pkgdir/usr/bin/"
  install -vDm 644 "$srcdir/qemu-guest-agent.service" -t "$pkgdir/usr/lib/systemd/system/"
  install -vDm 755 "$srcdir/$_gitname/scripts/qemu-guest-agent/fsfreeze-hook" -t "$pkgdir/etc/qemu/"
}

# vim:set ts=2 sw=2 et: