Gentoo Archives: gentoo-commits

From: Florian Schmaus <flow@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-emulation/xen/
Date: Tue, 05 Jul 2022 16:23:12
Message-Id: 1657038147.7c7d3fbce66cc7e528ba2d937561febaea5584b4.flow@gentoo
1 commit: 7c7d3fbce66cc7e528ba2d937561febaea5584b4
2 Author: Florian Schmaus <flow <AT> gentoo <DOT> org>
3 AuthorDate: Mon Jul 4 10:52:32 2022 +0000
4 Commit: Florian Schmaus <flow <AT> gentoo <DOT> org>
5 CommitDate: Tue Jul 5 16:22:27 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7c7d3fbc
7
8 app-emulation/xen: add 4.15.3
9
10 Bug: https://bugs.gentoo.org/850802
11 Signed-off-by: Florian Schmaus <flow <AT> gentoo.org>
12 Closes: https://github.com/gentoo/gentoo/pull/26217
13 Closes: https://github.com/gentoo/gentoo/pull/25839
14
15 app-emulation/xen/xen-4.15.3.ebuild | 183 ++++++++++++++++++++++++++++++++++++
16 1 file changed, 183 insertions(+)
17
18 diff --git a/app-emulation/xen/xen-4.15.3.ebuild b/app-emulation/xen/xen-4.15.3.ebuild
19 new file mode 100644
20 index 000000000000..be0c811dcf7f
21 --- /dev/null
22 +++ b/app-emulation/xen/xen-4.15.3.ebuild
23 @@ -0,0 +1,183 @@
24 +# Copyright 1999-2022 Gentoo Authors
25 +# Distributed under the terms of the GNU General Public License v2
26 +
27 +EAPI=8
28 +
29 +PYTHON_COMPAT=( python3_{8..10} )
30 +
31 +inherit flag-o-matic mount-boot python-any-r1 toolchain-funcs
32 +
33 +if [[ ${PV} == *9999 ]]; then
34 + inherit git-r3
35 + EGIT_REPO_URI="git://xenbits.xen.org/xen.git"
36 + SRC_URI=""
37 +else
38 + KEYWORDS="~amd64 ~arm -x86"
39 +
40 + XEN_PRE_PATCHSET_NUM=
41 + XEN_GENTOO_PATCHSET_NUM=
42 + XEN_PRE_VERSION_BASE=
43 +
44 + XEN_BASE_PV="${PV}"
45 + if [[ -n "${XEN_PRE_VERSION_BASE}" ]]; then
46 + XEN_BASE_PV="${XEN_PRE_VERSION_BASE}"
47 + fi
48 +
49 + SRC_URI="https://downloads.xenproject.org/release/xen/${XEN_BASE_PV}/xen-${XEN_BASE_PV}.tar.gz"
50 +
51 + if [[ -n "${XEN_PRE_PATCHSET_NUM}" ]]; then
52 + XEN_UPSTREAM_PATCHES_TAG="$(ver_cut 1-3)-pre-patchset-${XEN_PRE_PATCHSET_NUM}"
53 + XEN_UPSTREAM_PATCHES_NAME="xen-upstream-patches-${XEN_UPSTREAM_PATCHES_TAG}"
54 + SRC_URI+=" https://github.com/Flowdalic/xen-upstream-patches/archive/refs/tags/${XEN_UPSTREAM_PATCHES_TAG}.tar.gz -> ${XEN_UPSTREAM_PATCHES_NAME}.tar.gz"
55 + XEN_UPSTREAM_PATCHES_DIR="${WORKDIR}/${XEN_UPSTREAM_PATCHES_NAME}"
56 + fi
57 + if [[ -n "${XEN_GENTOO_PATCHSET_NUM}" ]]; then
58 + XEN_GENTOO_PATCHES_TAG="4.16.1-gentoo-patchset-${XEN_GENTOO_PATCHSET_NUM}"
59 + XEN_GENTOO_PATCHES_NAME="xen-gentoo-patches-${XEN_GENTOO_PATCHES_TAG}"
60 + SRC_URI+=" https://github.com/Flowdalic/xen-gentoo-patches/archive/refs/tags/${XEN_GENTOO_PATCHES_TAG}.tar.gz -> ${XEN_GENTOO_PATCHES_NAME}.tar.gz"
61 + XEN_GENTOO_PATCHES_DIR="${WORKDIR}/${XEN_GENTOO_PATCHES_NAME}"
62 + fi
63 +fi
64 +
65 +DESCRIPTION="The Xen virtual machine monitor"
66 +HOMEPAGE="https://xenproject.org"
67 +
68 +S="${WORKDIR}/xen-$(ver_cut 1-3 ${XEN_BASE_PV})"
69 +
70 +LICENSE="GPL-2"
71 +SLOT="0"
72 +IUSE="debug efi flask"
73 +REQUIRED_USE="arm? ( debug )"
74 +
75 +DEPEND="${PYTHON_DEPS}
76 + efi? ( >=sys-devel/binutils-2.22[multitarget] )
77 + !efi? ( >=sys-devel/binutils-2.22 )
78 + flask? ( sys-apps/checkpolicy )"
79 +RDEPEND=""
80 +PDEPEND="~app-emulation/xen-tools-${PV}"
81 +
82 +# no tests are available for the hypervisor
83 +# prevent the silliness of /usr/lib/debug/usr/lib/debug files
84 +# prevent stripping of the debug info from the /usr/lib/debug/xen-syms
85 +RESTRICT="test splitdebug strip"
86 +
87 +# Approved by QA team in bug #144032
88 +QA_WX_LOAD="boot/xen-syms-${PV}"
89 +
90 +pkg_setup() {
91 + python-any-r1_pkg_setup
92 + if [[ -z ${XEN_TARGET_ARCH} ]]; then
93 + if use amd64; then
94 + export XEN_TARGET_ARCH="x86_64"
95 + elif use arm; then
96 + export XEN_TARGET_ARCH="arm32"
97 + elif use arm64; then
98 + export XEN_TARGET_ARCH="arm64"
99 + else
100 + die "Unsupported architecture!"
101 + fi
102 + fi
103 +}
104 +
105 +src_prepare() {
106 + if [[ -v XEN_UPSTREAM_PATCHES_DIR ]]; then
107 + eapply "${XEN_UPSTREAM_PATCHES_DIR}"
108 + fi
109 +
110 + if [[ -v XEN_GENTOO_PATCHES_DIR ]]; then
111 + eapply "${XEN_GENTOO_PATCHES_DIR}"
112 + fi
113 +
114 + eapply "${FILESDIR}"/${PN}-4.15-efi.patch
115 +
116 + # Enable XSM-FLASK
117 + use flask && eapply "${FILESDIR}"/${PN}-4.15-flask.patch
118 +
119 + # Workaround new gcc-11 options
120 + sed -e '/^CFLAGS/s/-Werror//g' -i xen/Makefile || die
121 +
122 + # Drop .config
123 + sed -e '/-include $(XEN_ROOT)\/.config/d' -i Config.mk || die "Couldn't drop"
124 +
125 + if use efi; then
126 + export EFI_VENDOR="gentoo"
127 + export EFI_MOUNTPOINT="/boot"
128 + fi
129 +
130 + default
131 +}
132 +
133 +xen_make() {
134 + # Setting clang to either 'y' or 'n' tells Xen's build system
135 + # whether or not clang is used.
136 + local clang=n
137 + if tc-is-clang; then
138 + clang=y
139 + fi
140 +
141 + # Send raw LDFLAGS so that --as-needed works
142 + emake \
143 + V=1 \
144 + LDFLAGS="$(raw-ldflags)" \
145 + HOSTCC="$(tc-getBUILD_CC)" \
146 + HOSTCXX="$(tc-getBUILD_CXX)" \
147 + clang="${clang}" \
148 + "$@"
149 +}
150 +
151 +src_configure() {
152 + cd xen || die
153 +
154 + touch gentoo-config || die
155 + if use arm; then
156 + echo "CONFIG_EARLY_PRINTK=sun7i" >> gentoo-config || die
157 + fi
158 + if use debug; then
159 + cat <<-EOF >> gentoo-config || die
160 + CONFIG_DEBUG=y
161 + CONFIG_CRASH_DEBUG=y
162 +EOF
163 + fi
164 + if use flask; then
165 + echo "CONFIG_XSM=y" >> gentoo-config || die
166 + fi
167 +
168 + # remove flags
169 + unset CFLAGS
170 +
171 + tc-ld-disable-gold # Bug 700374
172 +
173 + xen_make KCONFIG_ALLCONFIG=gentoo-config alldefconfig
174 +}
175 +
176 +src_compile() {
177 + xen_make -C xen
178 +}
179 +
180 +src_install() {
181 + # The 'make install' doesn't 'mkdir -p' the subdirs
182 + if use efi; then
183 + mkdir -p "${D}"${EFI_MOUNTPOINT}/efi/${EFI_VENDOR} || die
184 + fi
185 +
186 + xen_make DESTDIR="${D}" -C xen install
187 +
188 + # make install likes to throw in some extra EFI bits if it built
189 + use efi || rm -rf "${D}/usr/$(get_libdir)/efi"
190 +}
191 +
192 +pkg_postinst() {
193 + elog "Official Xen Guide:"
194 + elog " https://wiki.gentoo.org/wiki/Xen"
195 +
196 + use efi && einfo "The efi executable is installed in /boot/efi/gentoo"
197 +
198 + ewarn
199 + ewarn "Xen 4.12+ changed the default scheduler to credit2 which can cause"
200 + ewarn "domU lockups on multi-cpu systems. The legacy credit scheduler seems"
201 + ewarn "to work fine."
202 + ewarn
203 + ewarn "Add sched=credit to xen command line options to use the legacy scheduler."
204 + ewarn
205 + ewarn "https://wiki.gentoo.org/wiki/Xen#Xen_domU_hanging_with_Xen_4.12.2B"
206 +}