void-packages/srcpkgs/xen/template

233 lines
7.6 KiB
Bash

# Template file for 'xen'
pkgname=xen
version=4.10.3
revision=2
# grep -R IPXE_GIT_TAG src/xen-*/tools/firmware/etherboot
_git_tag_ipxe=356f6c1b64d7a97746d1816cef8ca22bdd8d0b5d
archs="x86_64*"
configure_args="$(vopt_enable stubdom) --with-system-seabios=/usr/share/seabios/bios.bin"
hostmakedepends="acpica-utils automake bison fig2dev ghostscript git ocaml
ocaml-findlib pandoc pkg-config python-Markdown texinfo wget"
makedepends="SDL-devel dtc-devel e2fsprogs-devel gnutls-devel libaio-devel
libbluetooth-devel libglib-devel liblzma-devel libnl3-devel libressl-devel
netpbm pciutils-devel pixman-devel python-devel seabios yajl-devel"
depends="bridge-utils perl xen-hypervisor"
short_desc="Xen hypervisor utilities"
maintainer="Juan RP <xtraeme@voidlinux.org>"
license="GPL-2.0-or-later"
homepage="https://www.xenproject.org/"
distfiles="
https://downloads.xenproject.org/release/xen/${version}/${pkgname}-${version}.tar.gz
http://xenbits.xen.org/xen-extfiles/ipxe-git-${_git_tag_ipxe}.tar.gz"
checksum="
cb46b53664a692b3d55c6c0052c0afd53b7ad3ba979bd8b4dfdfe435c202f408
251e5516d7de470c434ae5c393aacca2b61fb24d93770592a4a20add60b785c4"
skip_extraction="ipxe-git-${_git_tag_ipxe}.tar.gz"
nopie=yes
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=3.11.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
ecdd4f8473ab0dee5d3acb5c0a31a4c1dd6aa12179895cf1903dd0f455c43a4f"
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
case "$XBPS_TARGET_MACHINE" in
x86_64-musl) makedepends+=" argp-standalone dev86";;
x86_64) makedepends+=" gcc-multilib dev86";;
esac
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/default/xendomains
/etc/default/xencommons
/etc/xen/xl.conf"
nostrip_files="
u-boot.e500
openbios-ppc
openbios-sparc32
openbios-sparc64
palcode-clipper
s390-ccw.img
s390-netboot.img"
pycompile_module="xen grub"
CFLAGS="-fno-pie -Wno-format-truncation"
post_extract() {
local _src="${XBPS_SRCDISTDIR}/${pkgname}-${version}"
msg_normal "Copying etherboot ipxe file ...\n"
cp -v "${_src}/ipxe-git-${_git_tag_ipxe}.tar.gz" \
tools/firmware/etherboot/ipxe.tar.gz
if [ "$build_option_stubdom" ]; then
msg_normal "Copying stubdom files ...\n"
mkdir -p stubdom
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
}
pre_configure() {
find \( -name "Makefile*" -o -name "*.mk" -o -name "common.make" \) \
-exec sed -i "{}" -e "s; *-Werror *; ;g" \;
sed -i tools/python/setup.py -e 's;, "-Werror";;g'
}
do_configure() {
rm -f ${XBPS_WRAPPERDIR}/strip
cp ${FILESDIR}/*.h ${wrksrc}/tools/firmware
NOCONFIGURE=1 autoreconf -fi
# Get rid of -Werror
find . -name '*.mk' -o -name 'Make*' | xargs sed -i -e 's/-Werror/-Wno-error/g'
unset CC LD AR AS RANLIB CPP CFLAGS CXXFLAGS CPPFLAGS LDFLAGS
./configure ${configure_args}
}
do_build() {
rm -f ${XBPS_WRAPPERDIR}/strip
unset CC LD AR AS RANLIB CPP CFLAGS CXXFLAGS CPPFLAGS LDFLAGS
mkdir -p ${wrksrc}/distdir-${version}
# oxenstore build fails due to warnings - ignore
make ${makejobs} DISTDIR=${wrksrc}/distdir-${version} NO_WERROR=1 || true
}
do_install() {
rm -f ${XBPS_WRAPPERDIR}/strip
unset CC LD AR AS RANLIB CPP CFLAGS CXXFLAGS CPPFLAGS LDFLAGS
make DESTDIR=${DESTDIR} NO_WERROR=1 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
if [ -d ${DESTDIR}/usr/lib64/efi ]; then
mv -v ${DESTDIR}/usr/lib64/efi ${DESTDIR}/usr/lib/
fi
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*
# Move usr/share/qemu-xen/qemu to usr/libexec/qemu-xen/qemu
mkdir -p ${DESTDIR}/usr/libexec/qemu-xen
mv -v ${DESTDIR}/usr/{share,libexec}/qemu-xen/qemu
# 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"
}
}
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
}
}