aboutsummaryrefslogtreecommitdiffstats
path: root/main/qemu/APKBUILD
blob: 99b60bf9cc35c86bd13043fadc4509a2b212e9b8 (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
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=qemu
pkgver=1.0
pkgrel=3
pkgdesc="QEMU is a generic machine emulator and virtualizer"
url="http://www.nongnu.org/qemu/"
arch="all"
license="GPL-2 LGPL-2"
makedepends="zlib-dev sdl-dev alsa-lib-dev gnutls-dev ncurses-dev glib-dev
	jpeg-dev libpng-dev vde2-dev spice-dev paxctl"
depends=
install="qemu.pre-install"
subpackages="
$pkgname-alpha
$pkgname-arm
$pkgname-cris
$pkgname-i386
$pkgname-lm32
$pkgname-m68k
$pkgname-microblaze
$pkgname-microblazeel
$pkgname-mips
$pkgname-mips64
$pkgname-mips64el
$pkgname-mipsel
$pkgname-ppc
$pkgname-ppc64
$pkgname-ppcemb
$pkgname-sh4
$pkgname-s390x
$pkgname-sh4eb
$pkgname-sparc
$pkgname-sparc64
$pkgname-x86_64
$pkgname-xtensa
$pkgname-xtensaeb
$pkgname-img
"
source="http://wiki.qemu.org/download/qemu-$pkgver.tar.gz
	80-kvm.rules
	configure-libm.patch
	librt.patch
	"

prepare() {
	cd "$srcdir"/$pkgname-$pkgver
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	done

	# avoid fdt till an updated release appears
	sed -i -e 's:fdt="yes":fdt="no":' configure
	# prevent docs to get automatically installed
	sed -i '/$(DESTDIR)$(docdir)/d' Makefile
	# Alter target makefiles to accept CFLAGS
	sed -i 's/^\(C\|OP_C\|HELPER_C\)FLAGS=/\1FLAGS+=/' \
		Makefile Makefile.target tests/Makefile
	sed -i 's/^VL_LDFLAGS=$/VL_LDFLAGS=-Wl,-z,execheap/' \
		Makefile.target
}

build() {
	cd "$srcdir"/$pkgname-$pkgver
	./configure --prefix=/usr \
		--audio-drv-list=oss,alsa,sdl \
		--audio-card-list=ac97,sb16,es1370,adlib \
		--enable-vde \
		--enable-spice \
		--disable-darwin-user \
		--disable-bsd-user \
		--disable-linux-user \
		--disable-werror \
		--cc="${CC:-gcc}" \
		|| return 1

	make V=1 || return 1
}

package() {
	cd "$srcdir"/$pkgname-$pkgver
	make DESTDIR="$pkgdir" install || return 1
	install -Dm644 "$srcdir"/80-kvm.rules \
		"$pkgdir"/lib/udev/rules.d/80-kvm.rules || return 1
	paxctl -c -m "$pkgdir"/usr/bin/qemu-system-* || return 1
}

_subsys() {
	pkgdesc="Qemu $1 system emulator"
	depend="qemu"
	mkdir -p "$subpkgdir"/usr/bin
	mv "$pkgdir"/usr/bin/qemu-system-$1 "$subpkgdir"/usr/bin/
}

alpha() { _subsys alpha; }
arm() { _subsys arm; }
cris() { _subsys cris; }
i386() { _subsys i386; }
lm32() { _subsys lm32; }
m68k() { _subsys m68k; }
microblaze() { _subsys microblaze; }
microblazeel() { _subsys microblazeel; }
mips() { _subsys mips; }
mips64() { _subsys mips64; }
mips64el() { _subsys mips64el; }
mipsel() { _subsys mipsel; }
ppc() { _subsys ppc; }
ppc64() { _subsys ppc64; }
ppcemb() { _subsys ppcemb; }
s390x() { _subsys s390x; }
sh4() { _subsys sh4; }
sh4eb() { _subsys sh4eb; }
sparc() { _subsys sparc; }
sparc64() { _subsys sparc64; }
x86_64() { _subsys x86_64; }
xtensa() { _subsys xtensa; }
xtensaeb() { _subsys xtensaeb; }

img() {
	pkgdesc="QEMU command line tool for manipulating disk images"
	replaces="qemu"
	mkdir -p "$subpkgdir"/usr/bin
	mv "$pkgdir"/usr/bin/qemu-img \
		"$pkgdir"/usr/bin/qemu-io \
		"$subpkgdir"/usr/bin/

	# we exploit the fact that -img subpackage are craeted last
	# and check that we done have new systems that belongs in
	# subpackage
	local _bins= _ret=0
	for i in "$pkgdir"/usr/bin/qemu-system-*; do
		if [ -r "$i" ]; then
			error "Please create a subpackage for ${i##*/}"
			_ret=1
		fi
	done
	return $_err
}

md5sums="a64b36067a191451323b0d34ebb44954  qemu-1.0.tar.gz
66660f143235201249dc0648b39b86ee  80-kvm.rules
a69fe6ff552b61606c5550cac4294abc  configure-libm.patch
9f6c3143d61748eedc8cf8d0e53aee2c  librt.patch"