1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 PYTHON_COMPAT=( python2_7 )
8 inherit flag-o-matic mount-boot multilib python-any-r1 toolchain-funcs
13 if [[ $PV == *9999 ]]; then
15 EGIT_REPO_URI="git://xenbits.xen.org/xen.git"
18 #KEYWORDS="~amd64 ~arm -x86"
24 [[ -n ${UPSTREAM_VER} ]] && \
25 UPSTREAM_PATCHSET_URI="https://dev.gentoo.org/~dlan/distfiles/${P}-upstream-patches-${UPSTREAM_VER}.tar.xz
26 https://github.com/hydrapolic/gentoo-dist/raw/master/xen/${P}-upstream-patches-${UPSTREAM_VER}.tar.xz"
27 [[ -n ${SECURITY_VER} ]] && \
28 SECURITY_PATCHSET_URI="https://dev.gentoo.org/~dlan/distfiles/${PN}-security-patches-${SECURITY_VER}.tar.xz"
29 [[ -n ${GENTOO_VER} ]] && \
30 GENTOO_PATCHSET_URI="https://dev.gentoo.org/~dlan/distfiles/${PN}-gentoo-patches-${GENTOO_VER}.tar.xz"
31 SRC_URI="https://downloads.xenproject.org/release/xen/${MY_PV}/${MY_P}.tar.gz
32 ${UPSTREAM_PATCHSET_URI}
33 ${SECURITY_PATCHSET_URI}
34 ${GENTOO_PATCHSET_URI}"
37 DESCRIPTION="The Xen virtual machine monitor"
38 HOMEPAGE="https://www.xenproject.org"
41 IUSE="debug efi flask"
43 DEPEND="${PYTHON_DEPS}
44 efi? ( >=sys-devel/binutils-2.22[multitarget] )
45 !efi? ( >=sys-devel/binutils-2.22 )"
47 PDEPEND="~app-emulation/xen-tools-${PV}"
49 # no tests are available for the hypervisor
50 # prevent the silliness of /usr/lib/debug/usr/lib/debug files
51 # prevent stripping of the debug info from the /usr/lib/debug/xen-syms
52 RESTRICT="test splitdebug strip"
54 # Approved by QA team in bug #144032
55 QA_WX_LOAD="boot/xen-syms-${PV}"
57 REQUIRED_USE="arm? ( debug )"
59 S="${WORKDIR}/${MY_P}"
62 python-any-r1_pkg_setup
63 if [[ -z ${XEN_TARGET_ARCH} ]]; then
65 export XEN_TARGET_ARCH="x86_64"
67 export XEN_TARGET_ARCH="arm32"
69 export XEN_TARGET_ARCH="arm64"
71 die "Unsupported architecture!"
77 export "FLASK_ENABLE=y"
83 [[ -n ${UPSTREAM_VER} ]] && eapply "${WORKDIR}"/patches-upstream
86 if [[ -n ${SECURITY_VER} ]]; then
87 einfo "Try to apply Xen Security patch set"
88 # apply main xen patches
89 # Two parallel systems, both work side by side
90 # Over time they may concdense into one. This will suffice for now
91 source "${WORKDIR}"/patches-security/${PV}.conf
94 for i in ${XEN_SECURITY_MAIN}; do
95 eapply "${WORKDIR}"/patches-security/xen/$i
100 [[ -n ${GENTOO_VER} ]] && eapply "${WORKDIR}"/patches-gentoo
102 eapply "${FILESDIR}"/${PN}-4.6-efi.patch
105 sed -e '/-include $(XEN_ROOT)\/.config/d' -i Config.mk || die "Couldn't drop"
108 export EFI_VENDOR="gentoo"
109 export EFI_MOUNTPOINT="/boot"
116 use arm && myopt="${myopt} CONFIG_EARLY_PRINTK=sun7i"
118 use debug && myopt="${myopt} debug=y"
127 # Send raw LDFLAGS so that --as-needed works
128 emake V=1 CC="$(tc-getCC)" LDFLAGS="$(raw-ldflags)" LD="$(tc-getLD)" -C xen ${myopt}
133 use debug && myopt="${myopt} debug=y"
135 # The 'make install' doesn't 'mkdir -p' the subdirs
137 mkdir -p "${D}"${EFI_MOUNTPOINT}/efi/${EFI_VENDOR} || die
140 emake LDFLAGS="$(raw-ldflags)" DESTDIR="${D}" -C xen ${myopt} install
142 # make install likes to throw in some extra EFI bits if it built
143 use efi || rm -rf "${D}/usr/$(get_libdir)/efi"
147 elog "Official Xen Guide:"
148 elog " https://wiki.gentoo.org/wiki/Xen"
150 use efi && einfo "The efi executable is installed in /boot/efi/gentoo"
152 elog "You can optionally block the installation of /boot/xen-syms by an entry"
153 elog "in folder /etc/portage/env using the portage's feature INSTALL_MASK"
154 elog "e.g. echo ${msg} > /etc/portage/env/xen.conf"