APKBUILD 18.1 KB
Newer Older
Natanael Copa's avatar
Natanael Copa committed
1
# Contributor: Roger Pau Monne <roger.pau@entel.upc.edu>
2
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
Ariadne Conill's avatar
Ariadne Conill committed
3
pkgname=xen
omni's avatar
omni committed
4
5
pkgver=4.16.1
pkgrel=0
Ariadne Conill's avatar
Ariadne Conill committed
6
pkgdesc="Xen hypervisor"
J0WI's avatar
J0WI committed
7
url="https://www.xenproject.org/"
Natanael Copa's avatar
Natanael Copa committed
8
arch="x86_64 armv7 aarch64" # enable armv7 when builds with gcc8
J0WI's avatar
J0WI committed
9
license="GPL-2.0-only"
Natanael Copa's avatar
Natanael Copa committed
10
depends="bash iproute2 logrotate"
Henrik Riomar's avatar
Henrik Riomar committed
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
depends_dev="
	argp-standalone
	attr-dev
	bison
	curl-dev
	dev86
	e2fsprogs-dev
	flex
	gettext
	glib-dev
	gnutls-dev
	libaio-dev
	libcap-ng-dev
	libnl3-dev
	linux-headers
	lzo-dev
	ncurses-dev
28
	openssl1.1-compat-dev
Henrik Riomar's avatar
Henrik Riomar committed
29
30
31
32
33
34
35
36
37
38
	pciutils-dev
	perl
	perl-dev
	python3-dev
	spice-dev
	texinfo
	util-linux-dev
	xz-dev
	yajl-dev
	zlib-dev
Henrik Riomar's avatar
Henrik Riomar committed
39
	zstd-dev
Henrik Riomar's avatar
Henrik Riomar committed
40
	"
omni's avatar
omni committed
41
makedepends="$depends_dev autoconf automake libtool dnsmasq samurai"
42
options="!strip"
Natanael Copa's avatar
Natanael Copa committed
43

Leo's avatar
Leo committed
44
45
# Follow security issues on: https://xenbits.xen.org/xsa/

46
# secfixes:
47
48
49
#   0:
#     - CVE-2020-29568 XSA-349
#     - CVE-2020-29569 XSA-350
50
51
52
53
#   4.7.0-r0:
#     - CVE-2016-6258 XSA-182
#     - CVE-2016-6259 XSA-183
#     - CVE-2016-5403 XSA-184
54
55
56
57
#   4.7.0-r1:
#     - CVE-2016-7092 XSA-185
#     - CVE-2016-7093 XSA-186
#     - CVE-2016-7094 XSA-187
58
59
#   4.7.0-r5:
#     - CVE-2016-7777 XSA-190
60
61
62
63
64
65
66
67
68
69
70
#   4.7.1-r1:
#     - CVE-2016-9386 XSA-191
#     - CVE-2016-9382 XSA-192
#     - CVE-2016-9385 XSA-193
#     - CVE-2016-9384 XSA-194
#     - CVE-2016-9383 XSA-195
#     - CVE-2016-9377 XSA-196
#     - CVE-2016-9378 XSA-196
#     - CVE-2016-9381 XSA-197
#     - CVE-2016-9379 XSA-198
#     - CVE-2016-9380 XSA-198
71
#   4.7.1-r3:
72
#     - CVE-2016-9932 XSA-200
Natanael Copa's avatar
Natanael Copa committed
73
74
75
76
#     - CVE-2016-9815 XSA-201
#     - CVE-2016-9816 XSA-201
#     - CVE-2016-9817 XSA-201
#     - CVE-2016-9818 XSA-201
Natanael Copa's avatar
Natanael Copa committed
77
78
79
80
#   4.7.1-r4:
#     - CVE-2016-10024 XSA-202
#     - CVE-2016-10025 XSA-203
#     - CVE-2016-10013 XSA-204
81
82
83
84
85
#   4.7.1-r5:
#     - XSA-207
#     - CVE-2017-2615 XSA-208
#     - CVE-2017-2620 XSA-209
#     - XSA-210
86
87
88
#   4.7.2-r0:
#     - CVE-2016-9603 XSA-211
#     - CVE-2017-7228 XSA-212
89
90
91
#   4.8.1-r2:
#     - CVE-2017-8903 XSA-213
#     - CVE-2017-8904 XSA-214
Daniel Sabogal's avatar
Daniel Sabogal committed
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#   4.9.0-r0:
#     - CVE-2017-10911 XSA-216
#     - CVE-2017-10912 XSA-217
#     - CVE-2017-10913 XSA-218
#     - CVE-2017-10914 XSA-218
#     - CVE-2017-10915 XSA-219
#     - CVE-2017-10916 XSA-220
#     - CVE-2017-10917 XSA-221
#     - CVE-2017-10918 XSA-222
#     - CVE-2017-10919 XSA-223
#     - CVE-2017-10920 XSA-224
#     - CVE-2017-10921 XSA-224
#     - CVE-2017-10922 XSA-224
#     - CVE-2017-10923 XSA-225
Daniel Sabogal's avatar
Daniel Sabogal committed
106
107
108
109
110
#   4.9.0-r1:
#     - CVE-2017-12135 XSA-226
#     - CVE-2017-12137 XSA-227
#     - CVE-2017-12136 XSA-228
#     - CVE-2017-12855 XSA-230
111
112
#   4.9.0-r2:
#     - XSA-235
113
114
115
116
117
#   4.9.0-r4:
#     - CVE-2017-14316 XSA-231
#     - CVE-2017-14318 XSA-232
#     - CVE-2017-14317 XSA-233
#     - CVE-2017-14319 XSA-234
118
119
#   4.9.0-r5:
#     - XSA-245
120
121
122
123
124
125
126
127
128
#   4.9.0-r6:
#     - CVE-2017-15590 XSA-237
#     - XSA-238
#     - CVE-2017-15589 XSA-239
#     - CVE-2017-15595 XSA-240
#     - CVE-2017-15588 XSA-241
#     - CVE-2017-15593 XSA-242
#     - CVE-2017-15592 XSA-243
#     - CVE-2017-15594 XSA-244
129
130
#   4.9.0-r7:
#     - CVE-2017-15597 XSA-236
131
132
133
#   4.9.1-r1:
#     - XSA-246
#     - XSA-247
Elizabeth Myers's avatar
Elizabeth Myers committed
134
#   4.10.0-r1:
135
136
137
138
#     - XSA-248
#     - XSA-249
#     - XSA-250
#     - XSA-251
139
#     - CVE-2018-5244 XSA-253
Elizabeth Myers's avatar
Elizabeth Myers committed
140
#     - XSA-254
141
142
143
144
#   4.10.0-r2:
#     - CVE-2018-7540 XSA-252
#     - CVE-2018-7541 XSA-255
#     - CVE-2018-7542 XSA-256
Daniel Sabogal's avatar
Daniel Sabogal committed
145
146
147
#   4.10.1-r0:
#     - CVE-2018-10472 XSA-258
#     - CVE-2018-10471 XSA-259
Kevin Daudt's avatar
Kevin Daudt committed
148
#   4.10.1-r1:
Leonardo Arena's avatar
Leonardo Arena committed
149
150
151
#     - CVE-2018-8897 XSA-260
#     - CVE-2018-10982 XSA-261
#     - CVE-2018-10981 XSA-262
Henrik Riomar's avatar
Henrik Riomar committed
152
#   4.11.0-r0:
Kevin Daudt's avatar
Kevin Daudt committed
153
154
155
156
157
#     - CVE-2018-3639 XSA-263
#     - CVE-2018-12891 XSA-264
#     - CVE-2018-12893 XSA-265
#     - CVE-2018-12892 XSA-266
#     - CVE-2018-3665 XSA-267
Henrik Riomar's avatar
Henrik Riomar committed
158
#   4.11.1-r0:
Kevin Daudt's avatar
Kevin Daudt committed
159
160
161
162
163
164
165
166
167
168
169
170
171
#     - CVE-2018-15469 XSA-268
#     - CVE-2018-15468 XSA-269
#     - CVE-2018-15470 XSA-272
#     - CVE-2018-3620 XSA-273
#     - CVE-2018-3646 XSA-273
#     - CVE-2018-19961 XSA-275
#     - CVE-2018-19962 XSA-275
#     - CVE-2018-19963 XSA-276
#     - CVE-2018-19964 XSA-277
#     - CVE-2018-18883 XSA-278
#     - CVE-2018-19965 XSA-279
#     - CVE-2018-19966 XSA-280
#     - CVE-2018-19967 XSA-282
Henrik Riomar's avatar
Henrik Riomar committed
172
#   4.12.0-r2:
Kevin Daudt's avatar
Kevin Daudt committed
173
174
175
176
#     - CVE-2018-12126 XSA-297
#     - CVE-2018-12127 XSA-297
#     - CVE-2018-12130 XSA-297
#     - CVE-2019-11091 XSA-297
177
#   4.12.1-r0:
Leo's avatar
Leo committed
178
#     - CVE-2019-17349 CVE-2019-17350 XSA-295
Leonardo Arena's avatar
Leonardo Arena committed
179
180
181
182
183
184
185
186
#   4.13.0-r0:
#     - CVE-2019-18425 XSA-298
#     - CVE-2019-18421 XSA-299
#     - CVE-2019-18423 XSA-301
#     - CVE-2019-18424 XSA-302
#     - CVE-2019-18422 XSA-303
#     - CVE-2018-12207 XSA-304
#     - CVE-2019-11135 XSA-305
Leonardo Arena's avatar
Leonardo Arena committed
187
188
189
190
191
192
#     - CVE-2019-19579 XSA-306
#     - CVE-2019-19582 XSA-307
#     - CVE-2019-19583 XSA-308
#     - CVE-2019-19578 XSA-309
#     - CVE-2019-19580 XSA-310
#     - CVE-2019-19577 XSA-311
Leo's avatar
Leo committed
193
194
195
196
197
#   4.13.0-r3:
#     - CVE-2020-11740 CVE-2020-11741 XSA-313
#     - CVE-2020-11739 XSA-314
#     - CVE-2020-11743 XSA-316
#     - CVE-2020-11742 XSA-318
198
#   4.13.1-r0:
Kevin Daudt's avatar
Kevin Daudt committed
199
#     - XSA-312
Henrik Riomar's avatar
Henrik Riomar committed
200
#   4.13.1-r3:
Kevin Daudt's avatar
Kevin Daudt committed
201
#     - CVE-2020-0543 XSA-320
202
203
204
205
206
207
#   4.13.1-r4:
#     - CVE-2020-15566 XSA-317
#     - CVE-2020-15563 XSA-319
#     - CVE-2020-15565 XSA-321
#     - CVE-2020-15564 XSA-327
#     - CVE-2020-15567 XSA-328
208
209
#   4.13.1-r5:
#     - CVE-2020-14364 XSA-335
210
211
212
213
214
215
216
217
218
219
220
#   4.14.0-r1:
#     - CVE-2020-25602 XSA-333
#     - CVE-2020-25598 XSA-334
#     - CVE-2020-25604 XSA-336
#     - CVE-2020-25595 XSA-337
#     - CVE-2020-25597 XSA-338
#     - CVE-2020-25596 XSA-339
#     - CVE-2020-25603 XSA-340
#     - CVE-2020-25600 XSA-342
#     - CVE-2020-25599 XSA-343
#     - CVE-2020-25601 XSA-344
221
#   4.14.0-r2:
Henrik Riomar's avatar
Henrik Riomar committed
222
223
224
225
#     - CVE-2020-27674 XSA-286
#     - CVE-2020-27672 XSA-345
#     - CVE-2020-27671 XSA-346
#     - CVE-2020-27670 XSA-347
226
#     - CVE-2020-28368 XSA-351
227
#   4.14.0-r3:
Henrik Riomar's avatar
Henrik Riomar committed
228
#     - CVE-2020-29040 XSA-355
229
230
231
232
233
234
235
236
237
238
239
240
241
#   4.14.1-r0:
#     - CVE-2020-29480 XSA-115
#     - CVE-2020-29481 XSA-322
#     - CVE-2020-29482 XSA-323
#     - CVE-2020-29484 XSA-324
#     - CVE-2020-29483 XSA-325
#     - CVE-2020-29485 XSA-330
#     - CVE-2020-29566 XSA-348
#     - CVE-2020-29486 XSA-352
#     - CVE-2020-29479 XSA-353
#     - CVE-2020-29567 XSA-356
#     - CVE-2020-29570 XSA-358
#     - CVE-2020-29571 XSA-359
Daniel Néri's avatar
Daniel Néri committed
242
#   4.14.1-r2:
Kevin Daudt's avatar
Kevin Daudt committed
243
#     - CVE-2021-3308 XSA-360
244
245
#   4.14.1-r3:
#     - CVE-2021-26933 XSA-364
Henrik Riomar's avatar
Henrik Riomar committed
246
247
#   4.15.0-r0:
#     - CVE-2021-28687 XSA-368
Henrik Riomar's avatar
Henrik Riomar committed
248
249
#   4.15.0-r1:
#     - CVE-2021-28693 XSA-372
Henrik Riomar's avatar
Henrik Riomar committed
250
#     - CVE-2021-28692 XSA-373
Kevin Daudt's avatar
Kevin Daudt committed
251
#     - CVE-2021-0089 XSA-375
Henrik Riomar's avatar
Henrik Riomar committed
252
#     - CVE-2021-28690 XSA-377
253
254
255
256
#   4.15.0-r2:
#     - CVE-2021-28694 XSA-378
#     - CVE-2021-28695 XSA-378
#     - CVE-2021-28696 XSA-378
257
#     - CVE-2021-28697 XSA-379
258
259
260
#     - CVE-2021-28698 XSA-380
#     - CVE-2021-28699 XSA-382
#     - CVE-2021-28700 XSA-383
261
262
#   4.15.0-r3:
#     - CVE-2021-28701 XSA-384
263
264
265
#   4.15.1-r1:
#     - CVE-2021-28702 XSA-386
#     - CVE-2021-28710 XSA-390
266
267
268
269
270
271
#   4.15.1-r2:
#     - CVE-2021-28704 XSA-388
#     - CVE-2021-28707 XSA-388
#     - CVE-2021-28708 XSA-388
#     - CVE-2021-28705 XSA-389
#     - CVE-2021-28709 XSA-389
omni's avatar
omni committed
272
273
274
275
276
277
278
279
280
281
282
#   4.16.1-r0:
#     - CVE-2022-23033 XSA-393
#     - CVE-2022-23034 XSA-394
#     - CVE-2022-23035 XSA-395
#     - CVE-2022-26356 XSA-397
#     - XSA-398
#     - CVE-2022-26357 XSA-399
#     - CVE-2022-26358 XSA-400
#     - CVE-2022-26359 XSA-400
#     - CVE-2022-26360 XSA-400
#     - CVE-2022-26361 XSA-400
283

Natanael Copa's avatar
Natanael Copa committed
284
285
case "$CARCH" in
x86*)
Henrik Riomar's avatar
Henrik Riomar committed
286
	makedepends="$makedepends iasl seabios-bin"
Natanael Copa's avatar
Natanael Copa committed
287
288
289
290
	;;
arm*)
	makedepends="$makedepends dtc-dev"
	;;
Daniel Sabogal's avatar
Daniel Sabogal committed
291
292
293
aarch64)
	makedepends="$makedepends dtc-dev iasl"
	;;
Natanael Copa's avatar
Natanael Copa committed
294
295
esac

296
297
298
#if [ "$CARCH" != "armhf" ]; then
#	subpackages="$pkgname-dbg"
#fi
299
subpackages="$subpackages $pkgname-doc $pkgname-dev $pkgname-libs
Henrik Riomar's avatar
Henrik Riomar committed
300
	$pkgname-hypervisor $pkgname-bridge $pkgname-qemu"
301
302
303
304
305
306
307
308
309
310
311
312

# grep _VERSION= stubdom/configure
_ZLIB_VERSION="1.2.3"
_LIBPCI_VERSION="2.2.9"
_NEWLIB_VERSION="1.16.0"
_LWIP_VERSION="1.3.0"
_GRUB_VERSION="0.97"
_GMP_VERSION="4.3.2"
_POLARSSL_VERSION="1.1.4"
_TPMEMU_VERSION="0.7.4"

# grep ^IPXE_GIT_TAG tools/firmware/etherboot/Makefile
omni's avatar
omni committed
313
_IPXE_GIT_TAG=3c040ad387099483102708bb1839110bc788cefb
314

315

Leo's avatar
Leo committed
316
source="https://downloads.xenproject.org/release/xen/$pkgver/xen-$pkgver.tar.gz
317
318
319
320
321
322
323
324
325
	https://xenbits.xen.org/xen-extfiles/gmp-$_GMP_VERSION.tar.bz2
	https://xenbits.xen.org/xen-extfiles/grub-$_GRUB_VERSION.tar.gz
	https://xenbits.xen.org/xen-extfiles/lwip-$_LWIP_VERSION.tar.gz
	https://xenbits.xen.org/xen-extfiles/newlib-$_NEWLIB_VERSION.tar.gz
	https://xenbits.xen.org/xen-extfiles/pciutils-$_LIBPCI_VERSION.tar.bz2
	https://xenbits.xen.org/xen-extfiles/polarssl-$_POLARSSL_VERSION-gpl.tgz
	https://xenbits.xen.org/xen-extfiles/tpm_emulator-$_TPMEMU_VERSION.tar.gz
	https://xenbits.xen.org/xen-extfiles/zlib-$_ZLIB_VERSION.tar.gz
	https://xenbits.xen.org/xen-extfiles/ipxe-git-$_IPXE_GIT_TAG.tar.gz
326

327
	mini-os-__divmoddi4.patch
328
	qemu-xen_paths.patch
Ariadne Conill's avatar
Ariadne Conill committed
329

330
	hotplug-vif-vtrill.patch
331

332
333
	hotplug-Linux-iscsi-block-handle-lun-1.patch

334
335
	stubdom-hack.patch

336
337
338
339
340
341
342
	xenstored.initd
	xenstored.confd
	xenconsoled.initd
	xenconsoled.confd
	xendomains.initd
	xendomains.confd
	xen-consoles.logrotate
Roger Pau Monne's avatar
Roger Pau Monne committed
343
344
	xenqemu.confd
	xenqemu.initd
345
	xendriverdomain.initd
346
347
	xen-pci.initd
	xen-pci.confd
348
	"
Ariadne Conill's avatar
Ariadne Conill committed
349

350
_seabios=/usr/share/seabios/bios-256k.bin
Jakub Jirutka's avatar
Jakub Jirutka committed
351
352
353

# Override wrong arch detection from xen-$pkgver/Config.mk.
case "$CARCH" in
Natanael Copa's avatar
Natanael Copa committed
354
armv7) export XEN_TARGET_ARCH="arm32";;
Daniel Sabogal's avatar
Daniel Sabogal committed
355
aarch64) export XEN_TARGET_ARCH="arm64";;
Jakub Jirutka's avatar
Jakub Jirutka committed
356
357
esac

Ariadne Conill's avatar
Ariadne Conill committed
358
prepare() {
Daniel Néri's avatar
Daniel Néri committed
359
	local i _failed=''
Roger Pau Monne's avatar
Roger Pau Monne committed
360

Ariadne Conill's avatar
Ariadne Conill committed
361
362
	for i in $source; do
		case $i in
363
364
365
366
367
368
369
		*-etherboot-*)
			p=${i%%::*}
			p=${p##*/}
			msg "adding to ipxe: $p"
			cp "$srcdir"/$p tools/firmware/etherboot/patches/
			echo "$p" >> tools/firmware/etherboot/patches/series
			;;
Natanael Copa's avatar
Natanael Copa committed
370
371
		*.patch) msg $i; patch -s -N -p1 -i "$srcdir"/$i \
				|| _failed="$_failed $i"
372
373
374
			;;
		*/ipxe-git-*)
			ln -s "$srcdir"/${i##*/} \
Henrik Riomar's avatar
Henrik Riomar committed
375
				tools/firmware/etherboot/ipxe.tar.gz
376
377
			;;
		*/xen-extfiles/*)
Henrik Riomar's avatar
Henrik Riomar committed
378
			ln -s "$srcdir"/${i##*/} stubdom/
379
			;;
Ariadne Conill's avatar
Ariadne Conill committed
380
381
		esac
	done
Natanael Copa's avatar
Natanael Copa committed
382
383
384
385
386
387
388
	if [ -n "$_failed" ]; then
		error "Patches failed:"
		for i in $_failed; do
			echo $i
		done
		return 1
	fi
Ariadne Conill's avatar
Ariadne Conill committed
389

Natanael Copa's avatar
Natanael Copa committed
390
	# remove all -Werror
Ariadne Conill's avatar
Ariadne Conill committed
391
	msg "Eradicating -Werror..."
Daniel Néri's avatar
Daniel Néri committed
392
	find . \( -name '*.mk' -o -name 'Make*' \) -exec sed -i -e 's/-Werror//g' {} +
Natanael Copa's avatar
Natanael Copa committed
393

Henrik Riomar's avatar
Henrik Riomar committed
394
395
	sed -e 's,^#include <sys/signal.h>$,#include <signal.h>,g' -i tools/qemu-xen/include/qemu/osdep.h

Ariadne Conill's avatar
Ariadne Conill committed
396
	msg "Updating config.sub..."
Henrik Riomar's avatar
Henrik Riomar committed
397
	update_config_sub
Ariadne Conill's avatar
Ariadne Conill committed
398

399
	msg "Autoreconf..."
Henrik Riomar's avatar
Henrik Riomar committed
400
	autoreconf --install
401

Roger Pau Monne's avatar
Roger Pau Monne committed
402
	unset CFLAGS
Natanael Copa's avatar
Natanael Copa committed
403
	unset LDFLAGS
Ariadne Conill's avatar
Ariadne Conill committed
404
405
}

406
407
408
409
410
411
412
413
414
415
# Unset CFLAGS and LDFLAGS because the xen build system
# doesn't support them. Instead use .config in xen root
# folder if necessary.
munge_cflags() {
	msg "Munging CFLAGS..."

	unset CFLAGS
	unset LDFLAGS
	unset LANG
	unset LC_ALL
Natanael Copa's avatar
Natanael Copa committed
416
417

	case "$CARCH" in
Natanael Copa's avatar
Natanael Copa committed
418
	arm*) export CFLAGS="-mcpu=cortex-a15";;
Daniel Sabogal's avatar
Daniel Sabogal committed
419
	aarch64) export CFLAGS="-mcpu=cortex-a53";;
Natanael Copa's avatar
Natanael Copa committed
420
	esac
421
422
423
424
425
426
}

# These tasks are added as separate tasks to enable a packager
# to invoke specific tasks like building the hypervisor.  i.e.
#    $ abuild configure build_tools
configure() {
omni's avatar
omni committed
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
	case "$CARCH" in
	x86*)
		msg "Running configure..."
		./configure --prefix=/usr \
			--build=$CBUILD \
			--host=$CHOST \
			--with-system-seabios=$_seabios \
			--enable-9pfs \
			--enable-qemu-traditional \
			--enable-pv-grub \
			--disable-golang
		;;
	*)
		msg "Running configure..."
		./configure --prefix=/usr \
			--build=$CBUILD \
			--host=$CHOST \
			--with-system-seabios=$_seabios \
			--enable-9pfs \
			--disable-golang
		;;
	esac
449
}
Ariadne Conill's avatar
Ariadne Conill committed
450

451
452
build_hypervisor() {
	munge_cflags
Ariadne Conill's avatar
Ariadne Conill committed
453

Ariadne Conill's avatar
Ariadne Conill committed
454
	msg "Building hypervisor..."
Henrik Riomar's avatar
Henrik Riomar committed
455
	make xen
456
457
458
459
}

build_tools() {
	munge_cflags
Ariadne Conill's avatar
Ariadne Conill committed
460
461

	msg "Building tools..."
Henrik Riomar's avatar
Henrik Riomar committed
462
	make tools
463
464
465
466
}

build_docs() {
	munge_cflags
Ariadne Conill's avatar
Ariadne Conill committed
467

Roger Pau Monne's avatar
Roger Pau Monne committed
468
	msg "Building documentation..."
469
	make docs
470
471
472
473
}

build_stubdom() {
	munge_cflags
Roger Pau Monne's avatar
Roger Pau Monne committed
474

Ariadne Conill's avatar
Ariadne Conill committed
475
	msg "Building stub domains..."
Henrik Riomar's avatar
Henrik Riomar committed
476
	make stubdom
Ariadne Conill's avatar
Ariadne Conill committed
477
478
}

479
build() {
Henrik Riomar's avatar
Henrik Riomar committed
480
481
482
483
	configure
	build_hypervisor
	build_tools
	build_docs
Natanael Copa's avatar
Natanael Copa committed
484
	case "$CARCH" in
Henrik Riomar's avatar
Henrik Riomar committed
485
	x86*) build_stubdom;;
Natanael Copa's avatar
Natanael Copa committed
486
	esac
487
488
}

Ariadne Conill's avatar
Ariadne Conill committed
489
package() {
Natanael Copa's avatar
Natanael Copa committed
490
	munge_cflags
Ariadne Conill's avatar
Ariadne Conill committed
491

Natanael Copa's avatar
Natanael Copa committed
492
	local _studom=
Natanael Copa's avatar
Natanael Copa committed
493
	case "$CARCH" in
Natanael Copa's avatar
Natanael Copa committed
494
		x86*) _stubdom=install-stubdom;;
Natanael Copa's avatar
Natanael Copa committed
495
	esac
496

Natanael Copa's avatar
Natanael Copa committed
497
498
	make DESTDIR="$pkgdir" EFI_DIR=/usr/lib/efi install-xen install-tools install-docs $_stubdom

499
500
	# remove default xencommons
	rm -rf "$pkgdir"/etc/init.d/xencommons
501
502
	# remove default xendriverdomain
	rm -rf "$pkgdir"/etc/init.d/xendriverdomain
503

504
505
506
507
508
509
510
511
512
513
	for i in $source; do
		case $i in
		*.initd) install -Dm755 "$srcdir"/$i \
				"$pkgdir"/etc/init.d/${i%.*};;
		*.confd) install -Dm644 "$srcdir"/$i \
				"$pkgdir"/etc/conf.d/${i%.*};;
		esac
	done
	install -Dm644 "$srcdir"/xen-consoles.logrotate \
		"$pkgdir"/etc/xen/xen-consoles.logrotate
514

515
	# we need to exclude /usr/share when stripping
J0WI's avatar
J0WI committed
516
	msg "Stripping binaries"
517
518
519
	scanelf --recursive --nobanner --etype "ET_DYN,ET_EXEC" "$pkgdir"/usr/lib \
		"$pkgdir"/usr/bin \
		"$pkgdir"/usr/sbin \
J0WI's avatar
J0WI committed
520
521
		| sed -e 's:^ET_DYN ::' -e 's:^ET_EXEC ::' \
		| xargs strip
Ariadne Conill's avatar
Ariadne Conill committed
522
523
}

Natanael Copa's avatar
Natanael Copa committed
524
525
526
527
check() {
	make test
}

528
529
530
libs() {
	pkgdesc="Libraries for Xen tools"
	replaces="xen"
531
	depends=
532
533
	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/*.so.* \
Henrik Riomar's avatar
Henrik Riomar committed
534
		"$pkgdir"/usr/lib/xenfsimage \
535
536
537
538
539
		"$subpkgdir"/usr/lib/
}

hypervisor() {
	pkgdesc="Xen hypervisor"
540
	depends=
Daniel Néri's avatar
Daniel Néri committed
541
	mkdir -p "$subpkgdir"
542
	mv "$pkgdir"/boot "$subpkgdir"/
Daniel Néri's avatar
Daniel Néri committed
543
544
545
546
	if [ -d "$pkgdir"/usr/lib/efi ]; then
		mkdir -p "$subpkgdir"/usr/lib
		mv "$pkgdir"/usr/lib/efi "$subpkgdir"/usr/lib/
	fi
547
548
}

549
bridge() {
Henrik Riomar's avatar
Henrik Riomar committed
550
	depends="dnsmasq"
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
	pkgdesc="Bridge interface for XEN with dhcp"
	mkdir -p "$subpkgdir"/etc/conf.d \
		"$subpkgdir"/etc/init.d \
		"$subpkgdir"/etc/xen

	ln -s dnsmasq "$subpkgdir"/etc/init.d/dnsmasq.xenbr0
	cat ->>"$subpkgdir"/etc/conf.d/dnsmasq.xenbr0 <<EOF
		BRIDGE_ADDR="10.0.4.1"
		BRIDGE_NETMASK="255.255.255.0"
		BRIDGE_NETWORK="10.0.4.0/24"
		BRIDGE_DHCP_RANGE="10.0.4.2,10.0.4.254"
		BRIDGE_DHCP_MAX="253"
		BRIDGE_MAC="00:16:3f:00:00:00"
		DNSMASQ_CONFFILE="/etc/xen/dnsmasq.conf"
EOF
	cat ->>"$subpkgdir"/etc/xen/dnsmasq.conf <<EOF
		#dhcp-host=somehost,10.0.4.3
		#dhcp-host=otherhost,10.0.4.4
EOF

}

Henrik Riomar's avatar
Henrik Riomar committed
573
574
575
576
577
578
579
580
581
qemu() {
	pkgdesc="QEMU for XEN"
	case "$CARCH" in
	x86*)
		depends="$depends seabios-bin"
		;;
	esac
	mkdir -p "$subpkgdir"/etc/conf.d \
		"$subpkgdir"/etc/init.d \
omni's avatar
omni committed
582
583
		"$subpkgdir"/usr/lib/xen/bin \
		"$subpkgdir"/usr/share/applications
Henrik Riomar's avatar
Henrik Riomar committed
584

omni's avatar
omni committed
585
586
587
588
589
590
	amove etc/conf.d/xenqemu
	amove etc/init.d/xenqemu
	amove usr/lib/xen/bin/qemu*
	mv "$pkgdir"/usr/share/qemu-xen/applications/qemu.desktop \
		"$subpkgdir"/usr/share/applications/qemu-xen.desktop
	amove usr/share/qemu-xen
Henrik Riomar's avatar
Henrik Riomar committed
591
592
593
594

	case "$CARCH" in
	x86*)
		# these files are only in the x86* builds
Natanael Copa's avatar
Natanael Copa committed
595
		amove usr/lib/xen/libexec/qemu-bridge-helper
omni's avatar
omni committed
596
597
598
599
600
601
602
603
604
605
		# qemu-traditional files not caught above
		mkdir -p "$subpkgdir"/usr/lib/xen/bin "$subpkgdir"/usr/lib/xen/boot
		amove usr/share/xen/qemu
		amove usr/bin/qemu-img-xen
		amove usr/bin/qemu-nbd-xen
		amove etc/xen/scripts/qemu-ifup
		amove usr/lib/xen/bin/stubdom-dm
		amove usr/lib/xen/bin/stubdompath.sh
		amove usr/lib/xen/boot/ioemu-stubdom.gz
		amove usr/lib/xen/boot/ipxe.bin
Henrik Riomar's avatar
Henrik Riomar committed
606
607
608
609
		;;
	esac
}

Henrik Riomar's avatar
Henrik Riomar committed
610
sha512sums="
omni's avatar
omni committed
611
eeabba9c263cd2425bca083e32b5ebfc6c716c00553759c144fd4b6f64a89836b260787fa25ba22c1f5c4ea65aaad7c95b8c2c1070d3377b1c43c9517aa7032a  xen-4.16.1.tar.gz
612
613
614
615
616
617
618
619
2e0b0fd23e6f10742a5517981e5171c6e88b0a93c83da701b296f5c0861d72c19782daab589a7eac3f9032152a0fc7eff7f5362db8fccc4859564a9aa82329cf  gmp-4.3.2.tar.bz2
c2bc9ffc8583aeae71cee9ddcc4418969768d4e3764d47307da54f93981c0109fb07d84b061b3a3628bd00ba4d14a54742bc04848110eb3ae8ca25dbfbaabadb  grub-0.97.tar.gz
1465b58279af1647f909450e394fe002ca165f0ff4a0254bfa9fe0e64316f50facdde2729d79a4e632565b4500cf4d6c74192ac0dd3bc9fe09129bbd67ba089d  lwip-1.3.0.tar.gz
40eb96bbc6736a16b6399e0cdb73e853d0d90b685c967e77899183446664d64570277a633fdafdefc351b46ce210a99115769a1d9f47ac749d7e82837d4d1ac3  newlib-1.16.0.tar.gz
2b3d98d027e46d8c08037366dde6f0781ca03c610ef2b380984639e4ef39899ed8d8b8e4cd9c9dc54df101279b95879bd66bfd4d04ad07fef41e847ea7ae32b5  pciutils-2.2.9.tar.bz2
88da614e4d3f4409c4fd3bb3e44c7587ba051e3fed4e33d526069a67e8180212e1ea22da984656f50e290049f60ddca65383e5983c0f8884f648d71f698303ad  polarssl-1.1.4-gpl.tgz
4928b5b82f57645be9408362706ff2c4d9baa635b21b0d41b1c82930e8c60a759b1ea4fa74d7e6c7cae1b7692d006aa5cb72df0c3b88bf049779aa2b566f9d35  tpm_emulator-0.7.4.tar.gz
021b958fcd0d346c4ba761bcf0cc40f3522de6186cf5a0a6ea34a70504ce9622b1c2626fce40675bc8282cf5f5ade18473656abc38050f72f5d6480507a2106e  zlib-1.2.3.tar.gz
omni's avatar
omni committed
620
4ac1d07ce879a3a8c6c260380258c37f5e4ecddc880b27fb59afc38fbf3718e81b04a4dda2b58fe7a438a23175e00b6179fc067acbc4a75e33d93c4b85ff5d68  ipxe-git-3c040ad387099483102708bb1839110bc788cefb.tar.gz
621
b9c754220187955d01ffbb6e030dace9d9aaae755db1765d07e407858c71a2cb0de04e0ab2099cd121d9e1bc1978af06c7dbd2fd805e06eca12ac5d527f15a52  mini-os-__divmoddi4.patch
omni's avatar
omni committed
622
fe3c253d03e1962ca4dd6bccd2e51817075450f51aa66e8ab9673bdd5a530dc08f1ed7817a1271ada028b0c34162f37cd6b24d84334403767caacd8206284cbb  qemu-xen_paths.patch
Henrik Riomar's avatar
Henrik Riomar committed
623
1c9cb24bf67a2e84466572198315d5501627addf1ccd55d8d83df8d77d269a6696cd45e4a55601495168284e3bff58fb39853f56c46aaddd14f6191821678cf6  hotplug-vif-vtrill.patch
624
8c9cfc6afca325df1d8026e21ed03fa8cd2c7e1a21a56cc1968301c5ab634bfe849951899e75d328951d7a41273d1e49a2448edbadec0029ed410c43c0549812  hotplug-Linux-iscsi-block-handle-lun-1.patch
625
6c28470dab368ce94d94db9e66954e4d915394ea730f6d4abb198ae122dbd7412453d6d8054f0a348d43d7f807fb13294363162f8b19f47311e802ffa9a40a90  stubdom-hack.patch
626
a8dda349cab62febf2ef506eb26d2ba494a649b1c37206519ae23f02a36f600b19996bb8a148e5f21a240ec53ecfcf971a07686b9ddcdad417563fdf39b2215f  xenstored.initd
627
093f7fbd43faf0a16a226486a0776bade5dc1681d281c5946a3191c32d74f9699c6bf5d0ab8de9d1195a2461165d1660788e92a3156c9b3c7054d7b2d52d7ff0  xenstored.confd
Natanael Copa's avatar
Natanael Copa committed
628
1dd04f4bf1890771aa7eef0b6e46f7139487da0907d28dcdbef9fbe335dcf731ca391cfcb175dd82924f637a308de00a69ae981f67348c34f04489ec5e5dc3b7  xenconsoled.initd
629
30df69cc38d0bed26bc4d6e08a2b62cbdc654d5f663009a05cb3b83b3e3dc5e206362d3fd59abbb753ceb8d6d79eaa6e15d079bb8f4f35dc74667103faf4e85d  xenconsoled.confd
Natanael Copa's avatar
Natanael Copa committed
630
71d464464130fbac0ffe6ce06337d8032b4a03a9da5fbb313b26538946d122f2531ef91e258faaff2636b29514cbb65ec0f62615a48437a8383f24f7e59df685  xendomains.initd
631
c7c0eecd5f454d903b57a710902da27dcb2c6b200f88d4eadfab33a447be6b41454109d482aab849a690446ea5c928e619dfc6cf95b7955f00a476f2317bb82b  xendomains.confd
632
633
ab2105c75cfe01768aecd5bcbb56269d63666e8a44e42b6a83aee87df6c84ee2f9ab249171c21b2e09f8fec2cae8318f6e87d160989398a3e7dd68db8d52c426  xen-consoles.logrotate
bdbe15c924071cdc2d0f23e53ba8e3f837d4b5369bfb218abd3405f9bef25d105269aaf0784baeb69c073a5786b8c82ffdfd414e86874da34293cfdc2c497928  xenqemu.confd
Natanael Copa's avatar
Natanael Copa committed
634
635
b833ed7334d912b519f317caefcf278274964838ca5588a0d58d9e91817e6c5519eab42521b78f7fc307ad24f25934e4f5d5d1097f783a847fc22d2cc38b27b5  xenqemu.initd
bc40f7c0548162ce2181b34ea39064c0e1c529af95e0a282c78879916036cf7ac3c2cb7c433f8702a9fffe6e9257707d25fdccb6f8d045aef78b5e251a476309  xendriverdomain.initd
636
a46337bebce24337f00adbe08095b9f5128c1f440e2033329e5ace9fd817a31fb772d75c0ecc7cc06f34b1522ebf8b21874ee4d0881a0f29851b1c1235f29cf3  xen-pci.initd
Henrik Riomar's avatar
Henrik Riomar committed
637
638
2db5fa6edeeb028236460029b976a849f22b3a15d3929acc3911dc41f365b471c2b815eb111639bc230a69528b1571f3c2e9e8e1e81a6679e55387e39355aa99  xen-pci.confd
"