void-packages/srcpkgs/xen/template

238 lines
7.6 KiB
Bash

# Template file for 'xen'
pkgname=xen
version=4.14.1
revision=6
# grep -R IPXE_GIT_TAG src/xen-*/tools/firmware/etherboot
_git_tag_ipxe=4bd064de239dab2426b31c9789a1f4d78087dc63
# TODO: arm / aarch64
archs="x86_64*"
build_style=gnu-configure
configure_args="$(vopt_enable stubdom) --disable-systemd
--with-system-seabios=/usr/share/seabios/bios.bin
--with-sysconfig-leaf-dir=conf.d --with-rundir=/run"
hostmakedepends="acpica-utils automake bin86 bison fig2dev flex gettext
ghostscript git ocaml ocaml-findlib pandoc pkg-config python3-Markdown tar
texinfo wget"
makedepends="SDL-devel dev86 dtc-devel e2fsprogs-devel gnutls-devel libaio-devel
libbluetooth-devel libglib-devel liblzma-devel libnl3-devel openssl-devel
netpbm pciutils-devel pixman-devel python3-devel seabios yajl-devel
ncurses-devel"
depends="bridge-utils perl xen-hypervisor"
short_desc="Xen hypervisor utilities"
maintainer="Chris Brannon <chris@the-brannons.com>"
license="GPL-2.0-or-later"
homepage="https://www.xenproject.org/"
distfiles="
https://downloads.xenproject.org/release/xen/${version}/${pkgname}-${version}.tar.gz
https://github.com/ipxe/ipxe/archive/${_git_tag_ipxe}.tar.gz"
checksum="cf0d7316ad674491f49b7ef0518cb1d906a2e3bfad639deef0ef2343b119ac0c
4850691d6f196eaf4d6210f2de01383251b3ea1b928141da9ce28c0b06a90938"
skip_extraction="${_git_tag_ipxe}.tar.gz"
nopie=yes
ignore_elf_dirs="/usr/share/xen/qemu /usr/share/qemu-xen/qemu"
nostrip_files="
hppa-firmware.img
u-boot.e500
openbios-ppc
openbios-sparc32
openbios-sparc64
palcode-clipper
s390-ccw.img
s390-netboot.img"
build_options="stubdom"
build_options_default="stubdom"
desc_option_stubdom="Build xen with stubdom"
if [ "$build_option_stubdom" ]; then
_gmp_version=4.3.2
_grub_version=0.97
_zlib_version=1.2.3
_lwip_version=1.3.0
_polarssl_version=1.1.4
_newlib_version=1.16.0
_libpci_version=2.2.9
_tpmemu_version=0.7.4
_ocaml_version=4.02.0
distfiles+="
http://xenbits.xen.org/xen-extfiles/gmp-${_gmp_version}.tar.bz2
http://xenbits.xen.org/xen-extfiles/grub-${_grub_version}.tar.gz
http://xenbits.xen.org/xen-extfiles/zlib-${_zlib_version}.tar.gz
http://xenbits.xen.org/xen-extfiles/lwip-${_lwip_version}.tar.gz
http://xenbits.xen.org/xen-extfiles/polarssl-${_polarssl_version}-gpl.tgz
http://xenbits.xen.org/xen-extfiles/newlib-${_newlib_version}.tar.gz
http://xenbits.xen.org/xen-extfiles/pciutils-${_libpci_version}.tar.bz2
http://xenbits.xen.org/xen-extfiles/tpm_emulator-${_tpmemu_version}.tar.gz
http://caml.inria.fr/pub/distrib/ocaml-${_ocaml_version%.*}/ocaml-${_ocaml_version}.tar.gz"
checksum+="
936162c0312886c21581002b79932829aa048cfaf9937c6265aeaa14f1cd1775
4e1d15d12dbd3e9208111d6b806ad5a9857ca8850c47877d36575b904559260b
1795c7d067a43174113fdf03447532f373e1c6c57c08d61d9e4e9be5e244b05e
772e4d550e07826665ed0528c071dd5404ef7dbe1825a38c8adbc2a00bca948f
2d29fd04a0d0ba29dae6bd29fb418944c08d3916665dcca74afb297ef37584b6
db426394965c48c1d29023e1cc6d965ea6b9a9035d8a849be2750ca4659a3d07
f60ae61cfbd5da1d849d0beaa21f593c38dac9359f0b3ddc612f447408265b24
4e48ea0d83dd9441cc1af04ab18cd6c961b9fa54d5cbf2c2feee038988dea459
dbbcbd72a29a51206677a606ea09dfec83ae25cbbf52dee90306bc04812cd034"
skip_extraction+="
gmp-${_gmp_version}.tar.bz2
grub-${_grub_version}.tar.gz
zlib-${_zlib_version}.tar.gz
lwip-${_lwip_version}.tar.gz
polarssl-${_polarssl_version}-gpl.tgz
newlib-${_newlib_version}.tar.gz
pciutils-${_libpci_version}.tar.bz2
tpm_emulator-${_tpmemu_version}.tar.gz
ocaml-${_ocaml_version}.tar.gz"
fi
if [ "$XBPS_TARGET_LIBC" = musl ]; then
makedepends+=" argp-standalone"
export ac_cv_lib_argp_argp_usage=yes
else
makedepends+=" gcc-multilib"
fi
make_dirs="
/var/lib/xenstored 755 root root
/var/lib/xen/xenpaging 755 root root
/var/xen/dump 755 root root
/etc/xen/auto 755 root root"
conf_files="
/etc/conf.d/xendomains
/etc/conf.d/xencommons
/etc/xen/xl.conf"
post_extract() {
local _src="${XBPS_SRCDISTDIR}/${pkgname}-${version}"
msg_normal "Extracting etherboot ipxe files ...\n"
mkdir tools/firmware/etherboot/ipxe
tar --strip-components=1 -x \
-f ${_src}/${_git_tag_ipxe}.tar.gz \
-C tools/firmware/etherboot/ipxe/
# Create a tarball w/o the git tag
tar -czf tools/firmware/etherboot/ipxe.tar.gz \
-C tools/firmware/etherboot/ ipxe
if [ "$build_option_stubdom" ]; then
# Patch a patch
vsed -i stubdom/grub.patches/99minios \
-e"/RAW_ADDR/s/(int) grub_scratch_mem/(long) grub_scratch_mem/"
mkdir -p stubdom/mini-os-x86_64-grub/{arch/x86,console,lib,xenbus}
msg_normal "Copying stubdom files ...\n"
cp -pv \
${_src}/grub-${_grub_version}.tar.gz \
${_src}/gmp-${_gmp_version}.tar.bz2 \
${_src}/zlib-${_zlib_version}.tar.gz \
${_src}/lwip-${_lwip_version}.tar.gz \
${_src}/polarssl-${_polarssl_version}-gpl.tgz \
${_src}/newlib-${_newlib_version}.tar.gz \
${_src}/pciutils-${_libpci_version}.tar.bz2 \
${_src}/tpm_emulator-${_tpmemu_version}.tar.gz \
${_src}/ocaml-${_ocaml_version}.tar.gz \
stubdom/
fi
}
do_configure() {
unset AR OBJCOPY RANLIB CC LD CFLAGS LDFLAGS
find \( -name "Makefile*" -o -name "*.mk" -o -name "common.make" \) \
-exec sed -i "{}" -e "s; *-Werror *; ;g" \;
vsed -i tools/python/setup.py -e 's;, "-Werror";;g'
# Silence a stream edit for dependencies
vsed -i Config.mk -e 's;sed ";@&;'
cp -a ${FILESDIR}/*.h ${wrksrc}/tools/firmware
cp -a ${FILESDIR}/stdint_local.h ${wrksrc}/tools/libxl/
rm -f ${XBPS_WRAPPERDIR}/strip
./autogen.sh
./configure ${configure_args}
}
do_build() {
unset AR OBJCOPY RANLIB CC LD CFLAGS LDFLAGS
rm -f ${XBPS_WRAPPERDIR}/strip
make ${makejobs} dist
}
do_install() {
unset AR OBJCOPY RANLIB CC LD CFLAGS LDFLAGS
make ${makejobs} DESTDIR=${DESTDIR} install install-docs
# Move example config files into correct directory.
vmkdir usr/share/examples/xen
mv ${DESTDIR}/etc/xen/x*example* ${DESTDIR}/usr/share/examples/xen
mv ${DESTDIR}/etc/xen/cpupool ${DESTDIR}/usr/share/examples/xen
mv ${DESTDIR}/etc/init.d/xendomains ${DESTDIR}/etc/xen/scripts
# Remove useless stuff.
rm -rf ${DESTDIR}/etc/init.d ${DESTDIR}/usr/local
rm -f ${DESTDIR}/install.sh
rm -rf ${DESTDIR}/usr/lib64
rm -rf ${DESTDIR}/usr/bin/qemu-*-xen
rm -f ${DESTDIR}/boot/xen{,-4,-4.3}.gz
rm -f ${DESTDIR}/usr/sbin/xen-python-path
rm -f ${DESTDIR}/{install,COPYING,README,usr/lib/lib}
rm -rf ${DESTDIR}/etc/udev
rm -f ${DESTDIR}//usr/libexec/qemu-bridge-helper
rm -rf ${DESTDIR}/usr/etc
# Move bash-completion to the correct dir.
vmkdir usr/share/bash-completion/completions
mv ${DESTDIR}/etc/bash_completion.d/* \
${DESTDIR}/usr/share/bash-completion/completions
vmkdir usr/lib/modules-load.d
install -m644 ${FILESDIR}/xen.conf ${DESTDIR}/usr/lib/modules-load.d
# Drop xen/xm stuff (obsolete).
rm -f ${DESTDIR}/usr/bin/{xm,xend}
rm -f ${DESTDIR}/etc/xen/*.{sxp,xml}
rm -f ${DESTDIR}/usr/share/man/man5/{xmdomain.cfg,xend-config.sxp}.5
rm -f ${DESTDIR}/usr/share/man/man1/xm.1
rm -f ${DESTDIR}/usr/share/doc/xen/html/man/xm.1.html
rm -f ${DESTDIR}/usr/share/doc/xen/html/man/{xmdomain.cfg,xend-config.sxp}.5.html
rm -f ${DESTDIR}/usr/share/examples/xen/xmexample*
# runit services
vsv xen
vsv xenconsoled
vsv xenstored
rm -f ${DESTDIR}/boot/xen-${version%.*}.gz
}
xen-hypervisor_package() {
short_desc="Xen Hypervisor"
nostrip_files="xen-syms-${version}"
pkg_install() {
vmove "boot/*"
vmove usr/lib/efi
}
}
xen-devel_package() {
short_desc+=" - development files"
depends="xen-libs>=${version}_${revision}"
pkg_install() {
vmove usr/include
vmove "usr/lib/*.a"
vmove "usr/lib/*.so"
vmove usr/lib/pkgconfig
}
}
xen-libs_package() {
short_desc+=" - runtime libraries"
pkg_install() {
vmove "usr/lib/*.so.*"
}
}
xen-doc_package() {
short_desc+=" - documentation"
pkg_install() {
vmove usr/share/doc
}
}