Gentoo Archives: gentoo-commits

From: Yixun Lan <dlan@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-emulation/xen-pvgrub/
Date: Sat, 03 Dec 2016 04:07:39
Message-Id: 1480738040.35edaa0ed636d7d163ee7d8036b7e6849d26b780.dlan@gentoo
1 commit: 35edaa0ed636d7d163ee7d8036b7e6849d26b780
2 Author: Yixun Lan <dlan <AT> gentoo <DOT> org>
3 AuthorDate: Sat Dec 3 04:05:05 2016 +0000
4 Commit: Yixun Lan <dlan <AT> gentoo <DOT> org>
5 CommitDate: Sat Dec 3 04:07:20 2016 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=35edaa0e
7
8 app-emulation/xen-pvgrub: fix boot certain guest kernel
9
10 Gentoo-Bug: 601488
11
12 Package-Manager: portage-2.3.2
13
14 .../xen-pvgrub/xen-pvgrub-4.7.1-r1.ebuild | 164 +++++++++++++++++++++
15 1 file changed, 164 insertions(+)
16
17 diff --git a/app-emulation/xen-pvgrub/xen-pvgrub-4.7.1-r1.ebuild b/app-emulation/xen-pvgrub/xen-pvgrub-4.7.1-r1.ebuild
18 new file mode 100644
19 index 00000000..e3894d6
20 --- /dev/null
21 +++ b/app-emulation/xen-pvgrub/xen-pvgrub-4.7.1-r1.ebuild
22 @@ -0,0 +1,164 @@
23 +# Copyright 1999-2016 Gentoo Foundation
24 +# Distributed under the terms of the GNU General Public License v2
25 +# $Id$
26 +
27 +EAPI=5
28 +
29 +PYTHON_COMPAT=( python2_7 )
30 +PYTHON_REQ_USE='xml,threads'
31 +
32 +inherit flag-o-matic eutils multilib python-single-r1 toolchain-funcs
33 +
34 +XEN_EXTFILES_URL="http://xenbits.xensource.com/xen-extfiles"
35 +LIBPCI_URL=ftp://atrey.karlin.mff.cuni.cz/pub/linux/pci
36 +GRUB_URL=mirror://gnu-alpha/grub
37 +
38 +UPSTREAM_VER=
39 +[[ -n ${UPSTREAM_VER} ]] && \
40 + UPSTREAM_PATCHSET_URI="https://dev.gentoo.org/~dlan/distfiles/${P/-tools/}-upstream-patches-${UPSTREAM_VER}.tar.xz"
41 +
42 +SRC_URI="
43 + http://bits.xensource.com/oss-xen/release/${PV}/xen-${PV}.tar.gz
44 + $GRUB_URL/grub-0.97.tar.gz
45 + $XEN_EXTFILES_URL/zlib-1.2.3.tar.gz
46 + $LIBPCI_URL/pciutils-2.2.9.tar.bz2
47 + $XEN_EXTFILES_URL/lwip-1.3.0.tar.gz
48 + $XEN_EXTFILES_URL/newlib/newlib-1.16.0.tar.gz
49 + $XEN_EXTFILES_URL/polarssl-1.1.4-gpl.tgz
50 + ${UPSTREAM_PATCHSET_URI}"
51 +
52 +S="${WORKDIR}/xen-${PV}"
53 +
54 +DESCRIPTION="allows to boot Xen domU kernels from a menu.lst laying inside guest filesystem"
55 +HOMEPAGE="http://xen.org/"
56 +LICENSE="GPL-2"
57 +SLOT="0"
58 +KEYWORDS="~amd64 ~x86"
59 +IUSE="custom-cflags"
60 +
61 +REQUIRED_USE="${PYTHON_REQUIRED_USE}"
62 +
63 +DEPEND="sys-devel/gettext
64 + sys-devel/bin86
65 + sys-apps/texinfo
66 + x11-libs/pixman"
67 +
68 +RDEPEND=">=app-emulation/xen-tools-${PV}"
69 +
70 +pkg_setup() {
71 + python-single-r1_pkg_setup
72 +}
73 +
74 +retar-externals() {
75 + # Purely to unclutter src_prepare
76 + local set="grub-0.97.tar.gz lwip-1.3.0.tar.gz newlib-1.16.0.tar.gz polarssl-1.1.4-gpl.tgz zlib-1.2.3.tar.gz"
77 +
78 + # epatch can't patch in $WORKDIR, requires a sed; Bug #455194. Patchable, but sed informative
79 + sed -e s':AR=${AR-"ar rc"}:AR=${AR-"ar"}:' \
80 + -i "${WORKDIR}"/zlib-1.2.3/configure
81 + sed -e 's:^AR=ar rc:AR=ar:' \
82 + -e s':$(AR) $@:$(AR) rc $@:' \
83 + -i "${WORKDIR}"/zlib-1.2.3/{Makefile,Makefile.in}
84 + einfo "zlib Makefile edited"
85 +
86 + cd "${WORKDIR}"
87 + tar czp zlib-1.2.3 -f zlib-1.2.3.tar.gz
88 + tar czp grub-0.97 -f grub-0.97.tar.gz
89 + tar czp lwip -f lwip-1.3.0.tar.gz
90 + tar czp newlib-1.16.0 -f newlib-1.16.0.tar.gz
91 + tar czp polarssl-1.1.4 -f polarssl-1.1.4-gpl.tgz
92 + mv $set "${S}"/stubdom/
93 + einfo "tarballs moved to source"
94 +}
95 +
96 +src_prepare() {
97 + # Upstream's patchset
98 + if [[ -n ${UPSTREAM_VER} ]]; then
99 + einfo "Try to apply Xen Upstream patch set"
100 + EPATCH_SUFFIX="patch" \
101 + EPATCH_FORCE="yes" \
102 + EPATCH_OPTS="-p1" \
103 + epatch "${WORKDIR}"/patches-upstream
104 + fi
105 +
106 + # if the user *really* wants to use their own custom-cflags, let them
107 + if use custom-cflags; then
108 + einfo "User wants their own CFLAGS - removing defaults"
109 + # try and remove all the default custom-cflags
110 + find "${S}" -name Makefile -o -name Rules.mk -o -name Config.mk -exec sed \
111 + -e 's/CFLAGS\(.*\)=\(.*\)-O3\(.*\)/CFLAGS\1=\2\3/' \
112 + -e 's/CFLAGS\(.*\)=\(.*\)-march=i686\(.*\)/CFLAGS\1=\2\3/' \
113 + -e 's/CFLAGS\(.*\)=\(.*\)-fomit-frame-pointer\(.*\)/CFLAGS\1=\2\3/' \
114 + -e 's/CFLAGS\(.*\)=\(.*\)-g3*\s\(.*\)/CFLAGS\1=\2 \3/' \
115 + -e 's/CFLAGS\(.*\)=\(.*\)-O2\(.*\)/CFLAGS\1=\2\3/' \
116 + -i {} \;
117 + fi
118 +
119 + # Patch the unmergeable newlib, fix most of the leftover gcc QA issues
120 + cp "${FILESDIR}"/newlib-implicits.patch stubdom || die
121 +
122 + # Patch stubdom/Makefile to patch insource newlib & prevent internal downloading
123 + epatch "${FILESDIR}"/${PN/-pvgrub/}-4.3-externals.patch
124 +
125 + # fix jobserver in Makefile
126 + epatch "${FILESDIR}"/${PN}-4.2-jserver.patch
127 +
128 + # bug 595354
129 + epatch "${FILESDIR}"/${PN}-4.7.0-fix-boot-p2m.patch
130 +
131 + #Substitute for internal downloading. pciutils copied only due to the only .bz2
132 + cp "${DISTDIR}"/pciutils-2.2.9.tar.bz2 ./stubdom/ || die "pciutils not copied to stubdom"
133 + retar-externals || die "re-tar procedure failed"
134 +
135 + epatch_user
136 +}
137 +
138 +src_configure() {
139 + local myconf="--prefix=${PREFIX}/usr \
140 + --libdir=${PREFIX}/usr/$(get_libdir) \
141 + --libexecdir=${PREFIX}/usr/libexec \
142 + --disable-werror \
143 + --disable-xen"
144 +
145 + econf ${myconf}
146 +}
147 +
148 +src_compile() {
149 + use custom-cflags || unset CFLAGS
150 + if test-flag-CC -fno-strict-overflow; then
151 + append-flags -fno-strict-overflow
152 + fi
153 +
154 + emake CC="$(tc-getCC)" LD="$(tc-getLD)" AR="$(tc-getAR)" -C tools/include
155 +
156 + if use x86; then
157 + emake CC="$(tc-getCC)" LD="$(tc-getLD)" AR="$(tc-getAR)" \
158 + XEN_TARGET_ARCH="x86_32" -C stubdom pv-grub
159 + elif use amd64; then
160 + emake CC="$(tc-getCC)" LD="$(tc-getLD)" AR="$(tc-getAR)" \
161 + XEN_TARGET_ARCH="x86_64" -C stubdom pv-grub
162 + if has_multilib_profile; then
163 + multilib_toolchain_setup x86
164 + emake CC="$(tc-getCC)" AR="$(tc-getAR)" \
165 + XEN_TARGET_ARCH="x86_32" -C stubdom pv-grub
166 + fi
167 + fi
168 +}
169 +
170 +src_install() {
171 + if use x86; then
172 + emake XEN_TARGET_ARCH="x86_32" DESTDIR="${D}" -C stubdom install-grub
173 + fi
174 + if use amd64; then
175 + emake XEN_TARGET_ARCH="x86_64" DESTDIR="${D}" -C stubdom install-grub
176 + if has_multilib_profile; then
177 + emake XEN_TARGET_ARCH="x86_32" DESTDIR="${D}" -C stubdom install-grub
178 + fi
179 + fi
180 +}
181 +
182 +pkg_postinst() {
183 + elog "Official Xen Guide and the offical wiki page:"
184 + elog "https://wiki.gentoo.org/wiki/Xen"
185 + elog "http://wiki.xen.org/wiki/Main_Page"
186 +}