summaryrefslogtreecommitdiff
path: root/app-emulation/xen-tools
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2018-07-14 21:03:06 +0100
committerV3n3RiX <venerix@redcorelinux.org>2018-07-14 21:03:06 +0100
commit8376ef56580626e9c0f796d5b85b53a0a1c7d5f5 (patch)
tree7681bbd4e8b05407772df40a4bf04cbbc8afc3fa /app-emulation/xen-tools
parent30a9caf154332f12ca60756e1b75d2f0e3e1822d (diff)
gentoo resync : 14.07.2018
Diffstat (limited to 'app-emulation/xen-tools')
-rw-r--r--app-emulation/xen-tools/Manifest33
-rw-r--r--app-emulation/xen-tools/files/gentoo-patches.conf162
-rw-r--r--app-emulation/xen-tools/files/stubs-32.h20
-rw-r--r--app-emulation/xen-tools/files/xen-consoles.logrotate5
-rw-r--r--app-emulation/xen-tools/files/xen-watchdog.initd6
-rw-r--r--app-emulation/xen-tools/files/xencommons.confd4
-rw-r--r--app-emulation/xen-tools/files/xencommons.initd79
-rw-r--r--app-emulation/xen-tools/files/xenconsoled.confd2
-rw-r--r--app-emulation/xen-tools/files/xenconsoled.initd33
-rw-r--r--app-emulation/xen-tools/files/xendomains-screen.confd25
-rw-r--r--app-emulation/xen-tools/files/xendomains.confd9
-rw-r--r--app-emulation/xen-tools/files/xendomains.initd-r2117
-rw-r--r--app-emulation/xen-tools/files/xenqemudev.confd7
-rw-r--r--app-emulation/xen-tools/files/xenqemudev.initd84
-rw-r--r--app-emulation/xen-tools/files/xenstored.confd2
-rw-r--r--app-emulation/xen-tools/files/xenstored.initd44
-rw-r--r--app-emulation/xen-tools/files/xenstored.initd-r142
-rw-r--r--app-emulation/xen-tools/metadata.xml22
-rw-r--r--app-emulation/xen-tools/xen-tools-4.10.0.ebuild456
-rw-r--r--app-emulation/xen-tools/xen-tools-4.9.1-r1.ebuild454
-rw-r--r--app-emulation/xen-tools/xen-tools-4.9.1-r2.ebuild455
-rw-r--r--app-emulation/xen-tools/xen-tools-4.9.2-r1.ebuild454
22 files changed, 2515 insertions, 0 deletions
diff --git a/app-emulation/xen-tools/Manifest b/app-emulation/xen-tools/Manifest
new file mode 100644
index 000000000000..4ea03bb9ac56
--- /dev/null
+++ b/app-emulation/xen-tools/Manifest
@@ -0,0 +1,33 @@
+AUX gentoo-patches.conf 4233 BLAKE2B 206bd90a74dd61d83982f5af1fc737e7de4dabb1771eda63465b890e42652b2c6be241e8723e9f96ff50af63564177d22b8d1a2801468943b4c3063b0c51e9a9 SHA512 17ab3716093e8e94e75bd0288b00e143debae10261554713e59d790710c9cdd8618a0935c15ab8c55a3f7795c66afc4cf458d326becf97e203f788e09bb2acf3
+AUX stubs-32.h 537 BLAKE2B 456f57c4a4ba574c737f1b84b62a085d0290ebc8981a5f96fdebc16b6c86c801c5ca8dde135e803f46c5ec875fdd74770f6ed754880bc7af930b8ce1ce972fb7 SHA512 55308dbedaa91909a2213940f7a7b574cabe6b5a3104761a2a6f28d6aed00164544488c00cbf9d66a9a370a14c6b6d3a00434efd3ff0228cc8e4d81af19c0e68
+AUX xen-consoles.logrotate 63 BLAKE2B 4ae650876035d2815dbcacc6ed618c58cc61d9cfd9cde1b6c2f792cbf51898c577ef979443ad827fc82ced4d21ae24836883160b20d697965ef5377d50c2973c SHA512 ab2105c75cfe01768aecd5bcbb56269d63666e8a44e42b6a83aee87df6c84ee2f9ab249171c21b2e09f8fec2cae8318f6e87d160989398a3e7dd68db8d52c426
+AUX xen-watchdog.initd 181 BLAKE2B b8529db36016b6f71520c1e4119a2ea5c4d3f52f2c77ccb5603efb67bcdd88b8273a359f6ae0df61763ea31a50bd8a0be775df5aabbd17c90e7928c8ed5b7c0e SHA512 5f6da91c0067b93f1b9f1a2f181caf34034896944ab26f5820e860336e3b3159a65e8a7f39ea273927d64d58a2fe4d918d2c3234f2b03ab0770e0c15d6dfe84b
+AUX xencommons.confd 109 BLAKE2B 6a2023a95cd1e411abe57c321e1c5f13096b51299817ce547e8ff042cbdbf859a5c1f50135e946fe650e0ec9221db3389ff50bc23f6d88d0c0fd1805b64786be SHA512 f0bbc9647cecc6cf806e3059960fbe39b23304d9ca0955fb261e1d320b9b9ce59e5b28cc4b5a9922295b31221f0cd8f0cccb405520e097a7b12dc6ddb3294c17
+AUX xencommons.initd 1451 BLAKE2B ef0cfa4fc7c4071b7a5822f4ad8983b9f7c386505e8b6967139c8921b002ff03a0a2be235060160d00d3890cffd15300b588c2b06a67a839df110c3737bbaee5 SHA512 1d25ae65ff073a5fc00aed2011af9e38f53d179dfadd06f791a4599c070a5ddbbf75d80b37e219b6de5d09e3466510c241311cbb018ef22cd3c97ce3b7c15b3c
+AUX xenconsoled.confd 44 BLAKE2B 865edf537c1a935cb78b682be805a8284c05e6c53e4a779bdabb4f43fcb1cfd5224b03f8c1febf8e5d49181ee08099c33970e39ff01028478a038feb7a061522 SHA512 30df69cc38d0bed26bc4d6e08a2b62cbdc654d5f663009a05cb3b83b3e3dc5e206362d3fd59abbb753ceb8d6d79eaa6e15d079bb8f4f35dc74667103faf4e85d
+AUX xenconsoled.initd 783 BLAKE2B 1903532f7e6cea87e0154e752d8263d1d6df29e4722dccca330185012de7f443950fe165d009466b138be378ec19c80c45c0b0a5cde7add94707aac5e67c23d3 SHA512 90f3bdb9d670c039d34fcd082769cb2cf90d4b0f6a46e409bd098795839e63fef11ef856bec99cd712ab36ecf7f2a43db2ca8454daa1a19feddf2e18b92e7824
+AUX xendomains-screen.confd 890 BLAKE2B 91eb128682e7d81436cc3c82e7ae873bac4fbcc5d5f70e70c0ed16eb5af3f4cb61799f39ab275bc30b3d5686f5cbfac8c09aba6937f827ab6afdfe7ed995f352 SHA512 fb7bfc1806608c6e30bb7db367afe9cf75d44e809556c3ba2794cb3ce0c9f35bcfd7f2bfc4a15a8d805f3d57ff082fe9a525cbac3306e64cbbd0ee5cef554505
+AUX xendomains.confd 291 BLAKE2B 8784abad4db4b4b649c4e57a3a1f818cb431e5eaa2277da65e6272f36e421230bfe7feb52b9cade50050c73eac379acd1684d5307fb89ced073345a213b4c56e SHA512 8ad255d39fc0b390c854a64ed82333b6a3041e1247b7a3934cd8274710c168c0017ef2dddbe32c120268d7ea946f8c1b148d7d06a3a4bf415a77eeec36dce2da
+AUX xendomains.initd-r2 2805 BLAKE2B 6f5e0cd4a9e3e0e2b4f6ad9b9f9fd9e399f04462e120bb1bf68f63d2afe73689522f3dd127867751e8055a735a2764393aaa6ea5aa10f8191fd5c503f01cee04 SHA512 cbfb37302b0930f608def30dad8942a0c52e1ad8c3f9068a1b125428777e9b8f4d2f41b0cbb1f26cd78d569a196946ff58e21cc8a87f8e955dc1a485f4769185
+AUX xenqemudev.confd 156 BLAKE2B 566dbe6e3a3d3bbbfd1b3cded7b0677b8b94ee3382226f4e8bf30e9e60771bfdca68c5448c63abf94be41c28082f2cbab6f9ea21335b41d24ba7b7e0347769af SHA512 d3cdeaed625e65e60fb22128baf24dceb45143ddf494d7db26464497abc42dbba0c0c9878f1e3908e2910557f4c4d600939824e944938aa251609ec5a1a86ee4
+AUX xenqemudev.initd 1828 BLAKE2B 695090fca31cff426c8434fe7a766c491725bcc91975b8338a8bd7d69bd51409bc8b586597866f7dc570e93693c87961e327c720cf44e7e941e1b83a157076e3 SHA512 d9ef6c0446cd2510f79d2117f0ad9ea3605854d1f5f601526706d9563abc72b71b4777c773e39ea1a9a77772e6ac70f6111109696a2621bc4b98c4518c7b589f
+AUX xenstored.confd 42 BLAKE2B 61153f1bb17c78614e215f25f59642f35185f7f7a2e911e04285a7f589c6a69856f914096621eded787b0c23a3f8994076ee15d2dd3e2a36589a65cd585c7946 SHA512 0906cbcdc84935d07cf53bc4447a1f9a9dc4e4fb9fda9a7163f6982f1d8a3ada1f0650fcd254fb6f715a54f7971daf0a5e61c3de6db70dfd156156fd55b59fe4
+AUX xenstored.initd 1058 BLAKE2B ef28c6f9f1f91dd46d5d431a70736d76a9a72b215b6b8f7955e5cc11abcbadb796d464a3a084b26afbfbe315617e929c207c66126bf5845520a0d9ef1ee75bab SHA512 f07febb0436d65dfab03e2125380b25dc2bcd7512a533879a152ab939a12b1a954b70babb69fc854b37bcb039a8897c2dc84a3988df426946f1e4af310dc1392
+AUX xenstored.initd-r1 916 BLAKE2B 5acda60c3d1c8aaf91d14d980a0b68f3d5ff803b617431c87f46b5c2c6f4c87548fa8db32ebd554e8aad4928d7ec0b16598bf8dfb0aa7e3642caa96eb164a292 SHA512 1404c9c454f5359389a2e9588317f10412dafdbdeb1de5da945c10f8e6efd09007e96d35b75d04a4c3d5c59baa9c3bbee4192240cacee128b0adf9066d3efc10
+DIST ovmf-20170321.tar.xz 22141096 BLAKE2B 79e991c8f9deb297865c319e88b6e6d46b1d08067d3fd639c83f2a379670779ecc60c74c2671ea4eb4a6659fe08ac2d7d4ff337b010b42a908a50829a2d18eeb SHA512 f65dabde3df967224e2072817211786ee4fc3994ee31f8f9d6f67fd74e3479e1da459c720169dd81020cdc1777e4600e531bb124b4625c2ded42c6005bdc802a
+DIST seabios-1.10.0.tar.gz 588213 BLAKE2B 254eb4572a1dac06020a545820efb53a130a027aaab035cd916009b424475f89bd151f82f1bc5103c01c4657d09da3219d2fbcc7728add473011dcfc7bff7410 SHA512 f1b83ce37b59070b488e19f98c95ca9f413cf4969663331b631c3ccb884c90b2db793d32a779ef05cead538c2fd123be4b73391ad2fa20c900a1f14237178d8c
+DIST xen-4.10.0-upstream-patches-0.tar.xz 70884 BLAKE2B 9a27e7989486ba3ba59548de356384527cc5b78e63b6ed042506e6534e488272369f021cd2daa516820313c3fe18625a5864794ae0806e7018b8ad28b0a294b1 SHA512 e64bf1d30d24e922c60c3b518a4de7874b43cc695134b4cdd65f6d95ae9ae579c521fab13ca82409fde55e43815d072c3194997e2bda106204cbf329e93a0a00
+DIST xen-4.10.0.tar.gz 24618123 BLAKE2B 009faa980f9734525c137d525e626bfa3443c285aeb6b4af91bb2c32a2e98376ded0b1114b541d11e2d4353f4f588d58e8add5b1e0d7de2fe3399d4687c5bfae SHA512 5a37935c382f9cfe3641a35c3be0ba11689bca10c7d3c2401963513e3a834ee8d0c8a0ddcf3716dbf0a795aea1bab78caf19acf1272e5e054bf012cfa06a4690
+DIST xen-4.9.1-upstream-patches-1.tar.xz 24592 BLAKE2B 774c5219d6c14d729358e790d880a1a31fb4cda741e54e71879bff164e79bafbd8492eb8bccb7becdf7a2f9605e71266bb4fc15848deff8f9028ed7f8844f915 SHA512 edbc7cad2f6f8a5c7e8aac8efd5454428aa25e0e13018438f78c7f401cfb9173345267e16c7a5dfa78066a952980b172976409a0c63162094b7f507058e712ed
+DIST xen-4.9.1-upstream-patches-2.tar.xz 84228 BLAKE2B 3b98cdb1202d4c9817dd1919b9dc5d4c06510d3be2c077b2e41334928bca07c65a9d8a421fc2a1ae3b806e69f7b61334f7c54d48952c98192ece4b5826539df8 SHA512 673520bff88fa401e1d1c7accc8d3650d4d74a9e52bc7195cfcb5335226c69ef0230e7db719fd97ce6df2f5198646ae0fbccc6f812d7e9ccd38a6eef359d287c
+DIST xen-4.9.1.tar.gz 23368303 BLAKE2B 4cfddb351c9a4aa08227138dc1afa921f3d1880048f897428226da38eff9470cd81ae9896f174583048dad0ba8d5c1426df58b029115ba1623366d1980630c0d SHA512 9d22f0aa5dcd01a1c105d17c14bce570cc597e884ddb9b4a46b80a72f647625b76ae5213cede423d0458c14e1906983595a9269bb6e6ff2e9e7e4dea840f4274
+DIST xen-4.9.2-upstream-patches-2.tar.xz 16100 BLAKE2B 469b5ab7c5514a4974ba6370136d3b0b8da66a137e57ea2d8ba4341582ecc65e9131340cfc854b2e4991de778802726479176bf3a54a59660cef7337c31958e5 SHA512 900ed3a63986ad6add07fa4f2c2596c48f7e9aac18d0876229c3a0b076a6417488e0d7bd1bdbe9886e6900bbece35c378b7f8735778b4bdfa115a9662d43108b
+DIST xen-4.9.2.tar.gz 23392753 BLAKE2B 5f96f0e5062eff8ac2971eef85ea2bae0e94e7542151237937a1cf7e74690bb0ce1c952e830d2fc13b3277f70b9ed1de511afe4f780ad7b3be0c58742ece39b2 SHA512 e06aec25439abcc548c174ba8e271c23031ea704bcc2480905140aa68490064fbb1c58d9c4174f6617b4f7bbcddfda284317df6f480a6e5b5b5a2c71fbe0ac93
+DIST xen-gentoo-patches-10.tar.xz 27876 BLAKE2B 8efece8548a046b47c04e5b9354ca8bdff55affd6c6bc67315ac7536778fbaa183d346e0ff83e365030df2433bddf845188a1c3fb8feaea2e93d5ba0dd1c779a SHA512 2033f4cb671971c73841cfaa7eb46623c37778c5746b47302eee252c4af287ccbeb8d1884ffdf32cd97a38cd7785257d56f13ef20d4c03dc0fb1cb196dc04ece
+DIST xen-gentoo-patches-12.tar.xz 28188 BLAKE2B 75f565d52e75d4f68d7a1be88a79e7cefe82350ca1f4852ecdb79137549d73ef1ffb665bac998956a6f180cde6faeb9a11ec1f5442c8ae53c7cbd869318ef315 SHA512 4e1ebbd244670d3a4171fd93eda7eb14deae3e3ad45b3a85c015696ff0a86b69156f24ee428d6c92b7be426938997cec2fab031ecb5b03ad26a38451523882de
+DIST xen-ovmf-patches-3.tar.xz 4208 BLAKE2B 0df8f85667a33c91cbfd86c59aec2ae65eca892b45d66eed76f793a52e2748989bc2785861f8bfdf94235ef7a6c0be6572c6e6cce9695469e40f0facd0ce3947 SHA512 abe001053ca702138bbcdd6bea14e2daae5c785f862d6a15001ca894c8ed8617f0c5dc439c6f54a41433b988acf57c71911af1db074aa76732c39d98622a3b5b
+EBUILD xen-tools-4.10.0.ebuild 13965 BLAKE2B 18a2ed460d43c66aa133fdbb9f628b46778899a570b6a16000abc2567264b3f9566b2dd1761654d2d7fe7ad88536ee82c6dd83349c32db0e1a94ebcfc07e4af5 SHA512 cc335e72707d171fcd5f197d230bf1ca5995da953371622ed9d3cef791e2e12234f7ceb2a335917547f30828aed6d3ed7b185836b7a2bbf48d3a20fc1436cc43
+EBUILD xen-tools-4.9.1-r1.ebuild 13751 BLAKE2B 324842ae54e6b973fcc71671b033e1e9845b30815538a7a8f47c74ca964b07cabdabbb4d8b5a34bd53b71c15fd47dac381700f33b32ecb3e1fbdcd9cfde7019e SHA512 17996a45a45d4af9139e06a72a574b2eee4d843bf8beb790485990559654801db5fc287e1cb25545d94d22803db6848c4c317ed95bd816d1dce19aec0ae62bbb
+EBUILD xen-tools-4.9.1-r2.ebuild 13853 BLAKE2B ef9227169434140233fa79299ef15463fb15a7aa04d887728394c19238d5914547f5c2fc6342acdb0a5d3764872fbe031912602fa8ebc479ce24f7ecaf25df45 SHA512 9a72c0bbedcc60ee4f145c1b42bf90e2cb79e0262de70d4f4ed7c99c311852d2ced336b85d626afbf0ff43c4f7e28d716ba06d654a428cf320a9be9d779fd10d
+EBUILD xen-tools-4.9.2-r1.ebuild 13748 BLAKE2B 0847bfa1075f2d4e3d6502914987d52325c35c1c3efe2c87cf0ae4b2a70d3e2f0ab7fd92712f9e8a72406e59b139694b60561509d99648c90030652f407e8297 SHA512 fccb2bf63a6672503237cdef15382387a8d2331b8e040aae0adbf46c0f91d4994839ec4c9288e39072ddd8d33e4a0ef82add13d31dea7a10e600e790eaa22f06
+MISC metadata.xml 1267 BLAKE2B 8b9111b781201a51e373b606c888440fe42630f9cb08a43a4bb5a512456f57e7bb4e4f2af0a23d4cbf75489ba01efbc38820a6881317f16a459c96f8717d2b52 SHA512 c4e947a8cff20e4c5e77f5764fe26ee86a5674cc24ba2eedb7867476f9805ca47b895fcee92e8f353bb4bce877d32832318f8f7fd9514103fb2a963d6ea74647
diff --git a/app-emulation/xen-tools/files/gentoo-patches.conf b/app-emulation/xen-tools/files/gentoo-patches.conf
new file mode 100644
index 000000000000..84b56bc7313c
--- /dev/null
+++ b/app-emulation/xen-tools/files/gentoo-patches.conf
@@ -0,0 +1,162 @@
+# Drop .config, fixes to gcc-4.6
+_gx001=" xen-4-fix_dotconfig-gcc.patch"
+_gx020=" xen-4.3-fix_dotconfig-gcc.patch"
+
+# Fix texi2html build error with new texi2html, qemu.doc.html
+_gx002=" xen-tools-4-docfix.patch"
+_gx003=" xen-tools-4-qemu-xen-doc.patch"
+
+_gx004=" xen-tools-4.2-pod-utf8-chars.patch"
+_gx005=" xen-tools-4.2-pod-docs.patch"
+_gx006=" xen-tools-4.2-pod-xl.patch"
+
+# Fix network broadcast on bridged networks
+_gx007=" xen-tools-3.4.0-network-bridge-broadcast.patch"
+
+# Bug 496708
+_gx008=" xen-tools-4-unbundle-ipxe.patch"
+#use system-seabios && epatch "${FILESDIR}"/${PN}-4-unbundle-seabios.patch
+
+# Fix bridge by idella4, bug #362575
+_gx009=" xen-tools-4.1.1-bridge.patch"
+
+# Conditional patch, fix in ebuild
+# Don't build ipxe with pie on hardened, Bug #360805
+#if gcc-specs-pie; then
+# epatch "${FILESDIR}"/ipxe-nopie.patch
+#fi
+
+# Prevent double stripping of files at install
+_gx010=" xen-4.2.0-nostrip.patch"
+_gx024+=" xen-4.4-nostrip.patch"
+
+# fix jobserver in Makefile
+_gx011=" xen-4.2.0-jserver.patch"
+_gx021=" xen-4.3-jserver.patch"
+
+# add missing header, Bug #467200
+_gx012=" xen-4-ulong.patch"
+_gx013=" xen-tools-4.2-xen_disk_leak.patch"
+
+# Set dom0-min-mem to kb; Bug #472982
+_gx014=" xen-4.2-configsxp.patch"
+
+# Bug 463840
+_gx015=" xen-tools-4.2.2-install.patch"
+_gx016=" xen-tools-4.2.2-rt-link.patch"
+
+# Bug 379537
+_gx017=" fix-gold-ld.patch"
+
+# Bug 510976
+_gx018=" xen-tools-4.2.4-udev-rules.patch"
+
+# bundled seabios
+_gx019=" xen-tools-4-anti-seabios-download.patch"
+_gx032=" xen-tools-4.5-anti-seabios-download.patch"
+
+# Bug 477676
+_gx022=" xen-tools-4.3-ar-cc.patch"
+_gx038=" xen-tools-4.8-ar-cc.patch"
+
+# Prevent file collision with qemu package Bug 478064
+_gx023=" qemu-bridge.patch"
+_gx025=" xen-4.4-qemu-bridge.patch"
+_gx031=" xen-4.5-qemu-bridge.patch"
+_gx039=" xen-4.8-qemu-bridge.patch"
+_gx043=" xen-4.10-qemu-bridge.patch"
+#mv tools/qemu-xen/qemu-bridge-helper.c tools/qemu-xen/xen-bridge-helper.c || die
+
+_gx026=" xen-tools-4.4-api-fix.patch"
+
+# Fix po file collision with app-emulation/qemu, while USE=qemu is enabled, Bug 508302
+_gx027=" xen-tools-4-qemu-fix-po-collision.patch"
+
+# Fix build failure with ncurses[tinfo], bug 526526
+_gx028=" xen-tools-4.4.1-tinfo.patch"
+
+# Don't download ovmf, use pre-released
+_gx029=" xen-tools-4-anti-ovmf-download.patch"
+
+# fix build err while using gcc-4.5.x, c99
+_gx033=" xen-tools-4.4.2-gcc99.patch"
+_gx034=" xen-tools-4.5.0-gcc99.patch"
+
+_gx035=" xen-tools-4.2-pod-docs-r1.patch"
+# disable stackcheck for hardened system, bug 569810
+_gx036=" xen-tools-4.6-no-stackcheck.patch"
+
+# increase stack to fix xenqemu err
+# https://lists.gnu.org/archive/html/qemu-devel/2016-09/msg03961.html
+_gx037=" xen-tools-4.6-increase-stack-size.patch"
+
+
+#Fix issues with zero-length records in migration v2"
+#https://xenbits.xen.org/gitweb/?p=people/andrewcoop/xen.git;a=shortlog;h=refs/heads/tools-fix-zero-length-records
+_gx040=" 0001-docs-Clarify-the-expected-behaviour-of-zero-length-r.patch
+ 0003-tools-libxc-Avoid-generating-inappropriate-zero-leng.patch
+ 0004-tools-python-Adjust-migration-v2-library-to-warn-abo.patch"
+
+_gx041=" 0002-tools-libxc-Tolerate-zero-length-records-in-migratio.patch"
+
+#Fix missing makedev(), major(), minor()
+_gx042=" xen-tools-4.8.2-makedev.patch"
+
+# Fix building with glibc 2.27, bug #648182
+_gx044=" xen-tools-4.9-glibc-memfd.patch"
+
+# xen-tools-4.8.2 patches set
+_gpv_xen_tools_482_0="
+${_gx008}
+${_gx038} ${_gx017} ${_gx039}
+${_gx027} ${_gx032}
+${_gx028} ${_gx029}
+${_gx037} ${_gx040} ${_gx042}
+"
+
+# xen-tools-4.9.0 patches set
+_gpv_xen_tools_490_0="
+${_gx008}
+${_gx038} ${_gx017} ${_gx039}
+${_gx027}
+${_gx028} ${_gx029}
+${_gx037} ${_gx042}
+"
+
+# xen-tools-4.9.1 patches set
+_gpv_xen_tools_491_0="
+${_gx008}
+${_gx038} ${_gx017} ${_gx039}
+${_gx027}
+${_gx028} ${_gx029}
+${_gx037} ${_gx042}
+"
+
+_gpv_xen_tools_491_1="
+${_gx008}
+${_gx038} ${_gx017} ${_gx039}
+${_gx027}
+${_gx028} ${_gx029}
+${_gx037} ${_gx042}
+${_gx044}
+"
+
+# xen-tools-4.9.2 patches set
+_gpv_xen_tools_492_0="
+${_gx008}
+${_gx038} ${_gx017} ${_gx039}
+${_gx027}
+${_gx028} ${_gx029}
+${_gx037} ${_gx042}
+${_gx044}
+"
+
+# xen-tools-4.10.0 patches set
+_gpv_xen_tools_4100_0="
+${_gx008}
+${_gx038} ${_gx017} ${_gx043}
+${_gx027}
+${_gx028} ${_gx029}
+${_gx037} ${_gx042}
+${_gx044}
+"
diff --git a/app-emulation/xen-tools/files/stubs-32.h b/app-emulation/xen-tools/files/stubs-32.h
new file mode 100644
index 000000000000..a421528deb74
--- /dev/null
+++ b/app-emulation/xen-tools/files/stubs-32.h
@@ -0,0 +1,20 @@
+/* This file is automatically generated.
+ It defines a symbol `__stub_FUNCTION' for each function
+ in the C library which is a stub, meaning it will fail
+ every time called, usually setting errno to ENOSYS. */
+
+#ifdef _LIBC
+ #error Applications may not define the macro _LIBC
+#endif
+
+#define __stub_chflags
+#define __stub_fattach
+#define __stub_fchflags
+#define __stub_fdetach
+#define __stub_gtty
+#define __stub_lchmod
+#define __stub_revoke
+#define __stub_setlogin
+#define __stub_sigreturn
+#define __stub_sstk
+#define __stub_stty
diff --git a/app-emulation/xen-tools/files/xen-consoles.logrotate b/app-emulation/xen-tools/files/xen-consoles.logrotate
new file mode 100644
index 000000000000..c6445239b42f
--- /dev/null
+++ b/app-emulation/xen-tools/files/xen-consoles.logrotate
@@ -0,0 +1,5 @@
+/var/log/xen-consoles/*.log {
+ rotate 7
+ missingok
+ compress
+}
diff --git a/app-emulation/xen-tools/files/xen-watchdog.initd b/app-emulation/xen-tools/files/xen-watchdog.initd
new file mode 100644
index 000000000000..6fbc54dfb2fa
--- /dev/null
+++ b/app-emulation/xen-tools/files/xen-watchdog.initd
@@ -0,0 +1,6 @@
+#!/sbin/openrc-run
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+command="/usr/sbin/xenwatchdogd"
+command_args="30 15"
diff --git a/app-emulation/xen-tools/files/xencommons.confd b/app-emulation/xen-tools/files/xencommons.confd
new file mode 100644
index 000000000000..b9e22482966f
--- /dev/null
+++ b/app-emulation/xen-tools/files/xencommons.confd
@@ -0,0 +1,4 @@
+# /etc/conf.d/xencommons
+
+# Load xen's kernel modules, and this will override defaults
+XEN_KERNEL_MODULES=""
diff --git a/app-emulation/xen-tools/files/xencommons.initd b/app-emulation/xen-tools/files/xencommons.initd
new file mode 100644
index 000000000000..a7c1efed9abe
--- /dev/null
+++ b/app-emulation/xen-tools/files/xencommons.initd
@@ -0,0 +1,79 @@
+#!/sbin/openrc-run
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+ before xenstored
+}
+
+is_privileged_domain() {
+ grep -qsE '^control_d$' /proc/xen/capabilities
+ return $?
+}
+
+handle_kernel_modules() {
+ local XEN_DEFAULT_KERNEL_MODULES="
+ xen-evtchn
+ xen-gntdev
+ xen-gntalloc
+ xen-blkback
+ xen-netback
+ xen-pciback
+ gntdev
+ netbk
+ blkbk
+ xen-scsibk
+ usbbk
+ pciback
+ xen-acpi-processor
+ blktap2
+ blktap
+ "
+
+ [ "$1" = "remove" ] && OPTS="-r"
+
+ XEN_KERNEL_MODULES="${XEN_KERNEL_MODULES:-${XEN_DEFAULT_KERNEL_MODULES}}"
+ for i in ${XEN_KERNEL_MODULES}; do
+ modprobe ${OPTS} $i 2>/dev/null
+ done
+ return 0
+}
+
+start() {
+ ebegin "Starting xencommons daemon"
+
+ # not running in Xen dom0 or domU
+ if [ ! -d /proc/xen ]; then
+ eend 1 "Not running in Xen mode"
+ return 1
+ fi
+
+ # mount xenfs in dom0 or domU with a pv_ops kernel
+ if ! test -f /proc/xen/capabilities && \
+ ! grep '^xenfs ' /proc/mounts >/dev/null;
+ then
+ mount -t xenfs xenfs /proc/xen
+ fi
+
+ if ! is_privileged_domain; then
+ eend 1 "Not running on a privileged domain. xencommons not started"
+ return 1
+ fi
+
+ handle_kernel_modules
+
+ eend $? "Failed to start xencommons"
+}
+
+stop () {
+ ebegin "Stopping xencommons"
+ if ! is_privileged_domain; then
+ eend 1 "Not running on a privileged domain. xencommons not started"
+ return 1
+ fi
+
+ handle_kernel_modules remove
+
+ eend $? "Failed to stop xencommons"
+}
+
diff --git a/app-emulation/xen-tools/files/xenconsoled.confd b/app-emulation/xen-tools/files/xenconsoled.confd
new file mode 100644
index 000000000000..b2e194bde46f
--- /dev/null
+++ b/app-emulation/xen-tools/files/xenconsoled.confd
@@ -0,0 +1,2 @@
+# /etc/conf.d/xenstored
+XENCONSOLED_OPTS=""
diff --git a/app-emulation/xen-tools/files/xenconsoled.initd b/app-emulation/xen-tools/files/xenconsoled.initd
new file mode 100644
index 000000000000..094871cd0478
--- /dev/null
+++ b/app-emulation/xen-tools/files/xenconsoled.initd
@@ -0,0 +1,33 @@
+#!/sbin/openrc-run
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+ need xenstored
+ after lvm
+}
+
+# bug #498720
+shutdown_all_domU() {
+ # Note: shutdown all domU, including manually started ones
+ local V=$(xl info| awk "/xen_minor/ { print \$3 }")
+ # 4.2.2 do not support "-a" option
+ [ $V -gt 2 ] && xl shutdown -a -w >/dev/null
+}
+
+start() {
+ ebegin "Starting xenconsoled daemon"
+ start-stop-daemon --start --exec /usr/sbin/xenconsoled \
+ --pidfile /run/xenconsoled.pid \
+ -- --pid-file=/run/xenconsoled.pid \
+ ${XENCONSOLED_OPTS}
+ eend $*
+}
+
+stop() {
+ ebegin "Stopping xenconsoled daemon"
+ shutdown_all_domU
+ start-stop-daemon --stop --exec /usr/sbin/xenconsoled \
+ --pidfile /run/xenconsoled.pid
+ eend $*
+}
diff --git a/app-emulation/xen-tools/files/xendomains-screen.confd b/app-emulation/xen-tools/files/xendomains-screen.confd
new file mode 100644
index 000000000000..e75e19d3be74
--- /dev/null
+++ b/app-emulation/xen-tools/files/xendomains-screen.confd
@@ -0,0 +1,25 @@
+# /etc/conf.d/xendomains
+
+# Directory of domains to boot. AUTODIR should contain one or more symlinks
+# to domain config files in /etc/xen
+# AUTODIR=/etc/xen/auto
+
+# Send shutdown commands to all domains in parallel instead of waiting for
+# each to shutdown individually
+# PARALLEL_SHUTDOWN=yes
+
+# When SCREEN="yes", domains in AUTODIR have their consoles connected to a
+# screen session named SCREEN_NAME, with output logged to individual files
+# named after each domain and written to /var/log/xen-consoles/ . These files
+# are rotated (using app-admin/logrotate) every time xendomains is started.
+
+SCREEN="yes"
+SCREEN_NAME="xen"
+
+# Number of seconds between writes to screen's logfiles.
+#
+# Lower values mean more disk activity and hence a possible performance
+# impact, but higher values mean a greater chance of loosing some output
+# in the event of a crash.
+
+SCREEN_LOG_INTERVAL="1"
diff --git a/app-emulation/xen-tools/files/xendomains.confd b/app-emulation/xen-tools/files/xendomains.confd
new file mode 100644
index 000000000000..90c1f5256c62
--- /dev/null
+++ b/app-emulation/xen-tools/files/xendomains.confd
@@ -0,0 +1,9 @@
+# /etc/conf.d/xendomains
+
+# Directory of domains to boot. AUTODIR should contain one or more symlinks
+# to domain config files in /etc/xen
+AUTODIR=/etc/xen/auto
+
+# Send shutdown commands to all domains in parallel instead of waiting for
+# each to shutdown individually
+PARALLEL_SHUTDOWN=yes
diff --git a/app-emulation/xen-tools/files/xendomains.initd-r2 b/app-emulation/xen-tools/files/xendomains.initd-r2
new file mode 100644
index 000000000000..0926498ceac4
--- /dev/null
+++ b/app-emulation/xen-tools/files/xendomains.initd-r2
@@ -0,0 +1,117 @@
+#!/sbin/openrc-run
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+extra_commands="status"
+
+depend() {
+ need xenstored
+ after dhcp xend xenconsoled
+}
+
+get_domname() {
+ local name_from_file=$(sed -rn 's/^name\W*=\W*\"?([[:alnum:]_\.-]+)\"?\W*;?/\1/p' "${1}" | tail -n 1)
+
+ if [ -z ${name_from_file} ] ; then
+ basename "${1}"
+ else
+ echo ${name_from_file}
+ fi
+}
+
+is_running() {
+ /usr/sbin/xl list "${1}" >/dev/null 2>&1
+}
+
+using_screen() {
+ [ "${SCREEN}" = "yes" -o "${SCREEN}" = "YES" ]
+}
+
+set_screen_cmd() {
+ screen_cmd="screen -c ${SCREENRC:-/dev/null} -q -r ${SCREEN_NAME:=xen} -X"
+}
+
+start() {
+ set_screen_cmd
+
+ einfo "Starting Xen domains from ${AUTODIR:=/etc/xen/auto}"
+ if using_screen ; then
+ ebegin "Creating screen session to hold domain consoles"
+ ( screen -c ${SCREENRC:-/dev/null} -d -m -S ${SCREEN_NAME} -t dom0 \
+ && sleep 5 \
+ && ${screen_cmd} zombie dr \
+ && logrotate -f /etc/xen/xen-consoles.logrotate \
+ && ${screen_cmd} logfile /var/log/xen-consoles/%t.log \
+ && ${screen_cmd} logfile flush ${SCREEN_LOG_INTERVAL:-1} \
+ && ${screen_cmd} log on \
+ && ${screen_cmd} deflog on ) >/dev/null
+ if [ $? -ne 0 ] ; then
+ eend 1
+ return 1
+ else
+ eend
+ fi
+ fi
+ # Create all domains with config files in AUTODIR.
+ for dom in $(ls "${AUTODIR:=/etc/xen/auto}/"* 2>/dev/null | sort); do
+ name=$(get_domname ${dom})
+ if ! is_running ${name} ; then
+ ebegin " Starting domain ${name}"
+ if using_screen ; then
+ ${screen_cmd} screen -t ${name} xl create ${dom} -c
+ else
+ xl create --quiet ${dom}
+ fi
+ eend $?
+ else
+ einfo " Not starting domain ${name} - already running"
+ fi
+ done
+}
+
+stop() {
+ set_screen_cmd
+
+ einfo "Shutting down Xen domains from ${AUTODIR:=/etc/xen/auto}"
+ # Stop all domains with config files in AUTODIR.
+ DOMAINS="$(ls "${AUTODIR:=/etc/xen/auto}/"* 2>/dev/null | sort -r)"
+
+ if [ "$PARALLEL_SHUTDOWN" = "yes" ] ; then
+ for dom in $DOMAINS ; do
+ name=$(get_domname ${dom})
+ if is_running ${name} ; then
+ ebegin " Asking domain ${name} to shutdown in the background..."
+ xl shutdown -w ${name} >/dev/null &
+ else
+ einfo " Not stopping domain ${name} - not running"
+ fi
+ done
+ einfo " Waiting for shutdown of domains that are still running"
+ wait
+ eend $?
+ else
+ for dom in $DOMAINS ; do
+ name=$(get_domname ${dom})
+ if is_running ${name} ; then
+ ebegin " Waiting for domain ${name} to shutdown"
+ xl shutdown -w ${name} >/dev/null
+ eend $?
+ else
+ einfo " Not stopping domain ${name} - not running"
+ fi
+ done
+ fi
+ if using_screen ; then
+ if ${screen_cmd} sleep 0 >/dev/null 2>&1 ; then
+ ebegin "Closing screen session ${SCREEN_NAME}"
+ ${screen_cmd} quit
+ eend $?
+ else
+ eend 0
+ fi
+ fi
+}
+
+status() {
+ /usr/sbin/xl list
+}
diff --git a/app-emulation/xen-tools/files/xenqemudev.confd b/app-emulation/xen-tools/files/xenqemudev.confd
new file mode 100644
index 000000000000..5b49520aa0ee
--- /dev/null
+++ b/app-emulation/xen-tools/files/xenqemudev.confd
@@ -0,0 +1,7 @@
+# /etc/conf.d/xenqemudev
+
+# To enable QEMU file backend, set to 'yes'
+XENQEMUDEV_FILE_BACKEND_ENABLE=""
+
+# Common options for xenqemudev
+XENQEMUDEV_OPTS=""
diff --git a/app-emulation/xen-tools/files/xenqemudev.initd b/app-emulation/xen-tools/files/xenqemudev.initd
new file mode 100644
index 000000000000..9dcbb3f2244e
--- /dev/null
+++ b/app-emulation/xen-tools/files/xenqemudev.initd
@@ -0,0 +1,84 @@
+#!/sbin/openrc-run
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+ need xencommons xenstored xenconsoled
+}
+
+is_privileged_domain() {
+ grep -qsE '^control_d$' /proc/xen/capabilities
+ return $?
+}
+
+xen_setvars() {
+ . /etc/xen/scripts/hotplugpath.sh
+
+ XENQEMUDEV_PIDFILE=/run/xenqemudev.pid
+
+ # xen-4.5 change the path
+ XEN_QEMU="${LIBEXEC}/qemu-system-i386"
+ [ -e ${XEN_QEMU} ] && return
+ XEN_QEMU="${LIBEXEC_BIN}/qemu-system-i386"
+}
+
+xen_qemu_start() {
+ if [ -z "${XENQEMUDEV_FILE_BACKEND_ENABLE}" ]; then
+ ewarn " QEMU disk backend not enabled"
+ ewarn " enable XENQEMUDEV_FILE_BACKEND_ENABLE in /etc/conf.d/xenqemudev"
+ return 1
+ fi
+
+ xen_setvars
+
+ if [ ! -c /dev/xen/gntdev ]; then
+ einfo " Xen gntdev driver not loaded"
+ return 1
+ fi
+
+ if [ -e "${XEN_QEMU}" ]; then
+ einfo " Starting QEMU as disk backend for dom0"
+
+ XENQEMUDEV_DEFAULT_OPTS="-xen-domid 0 -xen-attach -name dom0 \
+ -nographic -M xenpv -daemonize \
+ -monitor /dev/null -serial /dev/null -parallel /dev/null"
+
+ XENQEMUDEV_OPTS=${XENQEMUDEV_OPTS:-${XENQEMUDEV_DEFAULT_OPTS}}
+
+ start-stop-daemon --start --exec ${XEN_QEMU} \
+ --pidfile ${XENQEMUDEV_PIDFILE} \
+ -- -pidfile ${XENQEMUDEV_PIDFILE} \
+ ${XENQEMUDEV_OPTS}
+ return $?
+ fi
+}
+
+start() {
+ ebegin "Starting xenqemudev daemon"
+
+ # not running in Xen dom0 or domU
+ if [ ! -d /proc/xen ]; then
+ eend 1 "Not running in Xen mode"
+ return 1
+ fi
+
+ if ! is_privileged_domain; then
+ eend 1 "Not running on a privileged domain. xenqemudev not started"
+ return 1
+ fi
+
+ xen_qemu_start
+
+ eend $? "Failed to start xenqemudev"
+}
+
+stop () {
+ ebegin "Stopping xenqemudev"
+
+ xen_setvars
+
+ start-stop-daemon --stop --exec ${XEN_QEMU} \
+ --pidfile ${XENQEMUDEV_PIDFILE}
+
+ eend $? "Stopping xenqemudev, as it cannot be restarted."
+}
diff --git a/app-emulation/xen-tools/files/xenstored.confd b/app-emulation/xen-tools/files/xenstored.confd
new file mode 100644
index 000000000000..31b9293aa328
--- /dev/null
+++ b/app-emulation/xen-tools/files/xenstored.confd
@@ -0,0 +1,2 @@
+# /etc/conf.d/xenstored
+XENSTORED_OPTS=""
diff --git a/app-emulation/xen-tools/files/xenstored.initd b/app-emulation/xen-tools/files/xenstored.initd
new file mode 100644
index 000000000000..1b7eec92658a
--- /dev/null
+++ b/app-emulation/xen-tools/files/xenstored.initd
@@ -0,0 +1,44 @@
+#!/sbin/openrc-run
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+ before xendomains xend sshd ntp-client ntpd nfs nfsmount rsyncd portmap dhcp
+ need xencommons
+}
+
+xenstored_dir_check() {
+ # create dir dynamically
+ local i
+ for i in /var/lock/subsys /run/xen /run/xend/boot /run/xenstored; do
+ [ -x $i ] || mkdir -p $i
+ done
+}
+
+start() {
+ ebegin "Starting xenstored daemon"
+ xenstored_dir_check
+ start-stop-daemon --start --exec /usr/sbin/xenstored \
+ --pidfile /run/xenstored.pid \
+ -- --pid-file=/run/xenstored.pid \
+ $XENSTORED_OPTS
+ until xenstore-exists / || $((15 < ++i))
+ do
+ echo -n .
+ sleep 1
+ done
+ einfo "Setting domain0 name record"
+ /usr/bin/xenstore-write "/local/domain/0/name" "Domain-0"
+ local V=$(xl info| awk "/xen_minor/ { print \$3 }")
+ [ $V -ge 4 ] && /usr/bin/xenstore-write "/local/domain/0/domid" 0
+
+ eend $*
+}
+
+stop() {
+ ebegin "Stopping xenstored daemon"
+ start-stop-daemon --stop --exec /usr/sbin/xenstored \
+ --pidfile /run/xenstored.pid
+ eend $?
+}
+
diff --git a/app-emulation/xen-tools/files/xenstored.initd-r1 b/app-emulation/xen-tools/files/xenstored.initd-r1
new file mode 100644
index 000000000000..88d3ad7ba890
--- /dev/null
+++ b/app-emulation/xen-tools/files/xenstored.initd-r1
@@ -0,0 +1,42 @@
+#!/sbin/openrc-run
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+ before xendomains xend sshd ntp-client ntpd nfs nfsmount rsyncd portmap dhcp
+ need xencommons
+}
+
+xenstored_dir_check() {
+ # create dir dynamically
+ local i
+ for i in /var/lock/subsys /run/xen /run/xend/boot /run/xenstored; do
+ [ -x $i ] || mkdir -p $i
+ done
+}
+
+start() {
+ ebegin "Starting xenstored daemon"
+ xenstored_dir_check
+ start-stop-daemon --start --exec /usr/sbin/xenstored \
+ --pidfile /run/xenstored.pid \
+ -- --pid-file=/run/xenstored.pid \
+ $XENSTORED_OPTS
+ until xenstore-exists / || $((15 < ++i))
+ do
+ printf "."
+ sleep 1
+ done
+ einfo "Setting domain0 name record"
+ /usr/libexec/xen/bin/xen-init-dom0
+
+ eend $*
+}
+
+stop() {
+ ebegin "Stopping xenstored daemon"
+ start-stop-daemon --stop --exec /usr/sbin/xenstored \
+ --pidfile /run/xenstored.pid
+ eend $?
+}
+
diff --git a/app-emulation/xen-tools/metadata.xml b/app-emulation/xen-tools/metadata.xml
new file mode 100644
index 000000000000..5009c6f323e3
--- /dev/null
+++ b/app-emulation/xen-tools/metadata.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="project">
+ <email>xen@gentoo.org</email>
+ <name>Gentoo Xen Project</name>
+ </maintainer>
+ <use>
+ <flag name="api">Build the C libxenapi bindings</flag>
+ <flag name="flask">Enable the Flask XSM module from NSA</flag>
+ <flag name="hvm">Enable support for hardware based virtualization (VT-x,AMD-v)</flag>
+ <flag name="qemu">Enable IOEMU support via the use of qemu-dm</flag>
+ <flag name="qemu-traditional">Build the old qemu traditional device model (useful only if you cannot change to the new device model e.g. Windows VMs)</flag>
+ <flag name="pygrub">Install the pygrub boot loader</flag>
+ <flag name="screen">Enable support for running domain U console in an <pkg>app-misc/screen</pkg> session</flag>
+ <flag name="system-qemu">Using <pkg>app-emulation/qemu</pkg> instead of the bundled one</flag>
+ <flag name="system-seabios">Using <pkg>sys-firmware/seabios</pkg> instead of the bundled one</flag>
+ <flag name="ocaml">Enable support for the ocaml language</flag>
+ <flag name="ovmf">Enable support to boot UEFI guest vm, needed by hvm</flag>
+ <flag name="pam">Enable pam support</flag>
+ </use>
+</pkgmetadata>
diff --git a/app-emulation/xen-tools/xen-tools-4.10.0.ebuild b/app-emulation/xen-tools/xen-tools-4.10.0.ebuild
new file mode 100644
index 000000000000..1d2b4deba3b0
--- /dev/null
+++ b/app-emulation/xen-tools/xen-tools-4.10.0.ebuild
@@ -0,0 +1,456 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PYTHON_COMPAT=( python2_7 )
+PYTHON_REQ_USE='ncurses,xml,threads'
+
+inherit bash-completion-r1 eutils flag-o-matic multilib python-single-r1 toolchain-funcs versionator
+
+MY_PV=${PV/_/-}
+MAJOR_V="$(get_version_component_range 1-2)"
+
+if [[ $PV == *9999 ]]; then
+ inherit git-r3
+ KEYWORDS=""
+ REPO="xen.git"
+ EGIT_REPO_URI="git://xenbits.xen.org/${REPO}"
+ S="${WORKDIR}/${REPO}"
+else
+ KEYWORDS="~amd64 ~arm ~arm64 ~x86"
+ UPSTREAM_VER=0
+ SECURITY_VER=
+ # xen-tools's gentoo patches tarball
+ GENTOO_VER=12
+ # xen-tools's gentoo patches version which apply to this specific ebuild
+ GENTOO_GPV=0
+ # xen-tools ovmf's patches
+ OVMF_VER=3
+
+ SEABIOS_VER=1.10.0
+ # OVMF upstream 5920a9d16b1ab887c2858224316a98e961d71b05
+ OVMF_PV=20170321
+
+ [[ -n ${UPSTREAM_VER} ]] && \
+ UPSTREAM_PATCHSET_URI="https://dev.gentoo.org/~dlan/distfiles/${P/-tools/}-upstream-patches-${UPSTREAM_VER}.tar.xz
+ https://github.com/hydrapolic/gentoo-dist/raw/master/xen/${P/-tools/}-upstream-patches-${UPSTREAM_VER}.tar.xz"
+ [[ -n ${SECURITY_VER} ]] && \
+ SECURITY_PATCHSET_URI="https://dev.gentoo.org/~dlan/distfiles/${PN/-tools}-security-patches-${SECURITY_VER}.tar.xz"
+ [[ -n ${GENTOO_VER} ]] && \
+ GENTOO_PATCHSET_URI="https://dev.gentoo.org/~dlan/distfiles/${PN/-tools}-gentoo-patches-${GENTOO_VER}.tar.xz
+ https://github.com/hydrapolic/gentoo-dist/raw/master/xen/${PN/-tools/}-gentoo-patches-${GENTOO_VER}.tar.xz"
+ [[ -n ${OVMF_VER} ]] && \
+ OVMF_PATCHSET_URI="https://dev.gentoo.org/~dlan/distfiles/${PN/-tools}-ovmf-patches-${OVMF_VER}.tar.xz"
+
+ SRC_URI="https://downloads.xenproject.org/release/xen/${MY_PV}/xen-${MY_PV}.tar.gz
+ http://code.coreboot.org/p/seabios/downloads/get/seabios-${SEABIOS_VER}.tar.gz
+ https://dev.gentoo.org/~dlan/distfiles/seabios-${SEABIOS_VER}.tar.gz
+ ovmf? ( https://dev.gentoo.org/~dlan/distfiles/ovmf-${OVMF_PV}.tar.xz
+ ${OVMF_PATCHSET_URI} )
+ ${UPSTREAM_PATCHSET_URI}
+ ${SECURITY_PATCHSET_URI}
+ ${GENTOO_PATCHSET_URI}"
+
+ S="${WORKDIR}/xen-${MY_PV}"
+fi
+
+DESCRIPTION="Xen tools including QEMU and xl"
+HOMEPAGE="https://www.xenproject.org"
+DOCS=( README docs/README.xen-bugtool )
+
+LICENSE="GPL-2"
+SLOT="0/${MAJOR_V}"
+# Inclusion of IUSE ocaml on stabalizing requires maintainer of ocaml to (get off his hands and) make
+# >=dev-lang/ocaml-4 stable
+# Masked in profiles/eapi-5-files instead
+IUSE="api custom-cflags debug doc flask hvm ocaml ovmf +pam pygrub python +qemu +qemu-traditional screen sdl static-libs system-qemu system-seabios"
+
+REQUIRED_USE="
+ ${PYTHON_REQUIRED_USE}
+ pygrub? ( python )
+ ovmf? ( hvm )
+ ^^ ( qemu system-qemu )"
+
+COMMON_DEPEND="
+ sys-apps/pciutils
+ dev-libs/lzo:2
+ dev-libs/glib:2
+ dev-libs/yajl
+ dev-libs/libaio
+ dev-libs/libgcrypt:0
+ sys-libs/zlib
+ ${PYTHON_DEPS}
+"
+
+DEPEND="${COMMON_DEPEND}
+ >=sys-kernel/linux-headers-4.11
+ dev-python/lxml[${PYTHON_USEDEP}]
+ x86? ( sys-devel/dev86
+ sys-power/iasl )
+ pam? ( dev-python/pypam[${PYTHON_USEDEP}] )
+ api? ( dev-libs/libxml2
+ net-misc/curl )
+ ovmf? (
+ !arm? ( !arm64? ( dev-lang/nasm ) )
+ $(python_gen_impl_dep sqlite)
+ )
+ !amd64? ( >=sys-apps/dtc-1.4.0 )
+ amd64? ( sys-devel/bin86
+ system-seabios? ( sys-firmware/seabios )
+ sys-firmware/ipxe
+ sys-devel/dev86
+ sys-power/iasl )
+ dev-lang/perl
+ app-misc/pax-utils
+ doc? (
+ app-text/ghostscript-gpl
+ app-text/pandoc
+ dev-python/markdown[${PYTHON_USEDEP}]
+ dev-texlive/texlive-latexextra
+ media-gfx/transfig
+ )
+ hvm? ( x11-base/xorg-proto
+ !net-libs/libiscsi )
+ qemu? (
+ app-arch/snappy:=
+ x11-libs/pixman
+ sdl? ( media-libs/libsdl[X] )
+ )
+ system-qemu? ( app-emulation/qemu[xen] )
+ ocaml? ( dev-ml/findlib
+ >=dev-lang/ocaml-4 )"
+
+RDEPEND="${COMMON_DEPEND}
+ sys-apps/iproute2[-minimal]
+ net-misc/bridge-utils
+ screen? (
+ app-misc/screen
+ app-admin/logrotate
+ )"
+
+# hvmloader is used to bootstrap a fully virtualized kernel
+# Approved by QA team in bug #144032
+QA_WX_LOAD="
+ usr/libexec/xen/boot/hvmloader
+ usr/share/qemu-xen/qemu/s390-ccw.img
+ usr/share/qemu-xen/qemu/u-boot.e500
+"
+
+QA_PREBUILT="
+ usr/libexec/xen/bin/ivshmem-client
+ usr/libexec/xen/bin/ivshmem-server
+ usr/libexec/xen/bin/qemu-img
+ usr/libexec/xen/bin/qemu-io
+ usr/libexec/xen/bin/qemu-nbd
+ usr/libexec/xen/bin/qemu-system-i386
+ usr/libexec/xen/bin/virtfs-proxy-helper
+ usr/libexec/xen/libexec/xen-bridge-helper
+ usr/share/qemu-xen/qemu/s390-ccw.img
+ usr/share/qemu-xen/qemu/u-boot.e500
+"
+
+RESTRICT="test"
+
+pkg_setup() {
+ python_setup
+ export "CONFIG_LOMOUNT=y"
+
+ #bug 522642, disable compile tools/tests
+ export "CONFIG_TESTS=n"
+
+ if [[ -z ${XEN_TARGET_ARCH} ]] ; then
+ if use x86 && use amd64; then
+ die "Confusion! Both x86 and amd64 are set in your use flags!"
+ elif use x86; then
+ export XEN_TARGET_ARCH="x86_32"
+ elif use amd64 ; then
+ export XEN_TARGET_ARCH="x86_64"
+ elif use arm; then
+ export XEN_TARGET_ARCH="arm32"
+ elif use arm64; then
+ export XEN_TARGET_ARCH="arm64"
+ else
+ die "Unsupported architecture!"
+ fi
+ fi
+}
+
+src_prepare() {
+ local i
+
+ # Upstream's patchset
+ if [[ -n ${UPSTREAM_VER} ]]; then
+ einfo "Try to apply Xen Upstream patch set"
+ eapply "${WORKDIR}"/patches-upstream
+ fi
+
+ # Security patchset
+ if [[ -n ${SECURITY_VER} ]]; then
+ einfo "Try to apply Xen Security patch set"
+ # apply main xen patches
+ # Two parallel systems, both work side by side
+ # Over time they may concdense into one. This will suffice for now
+ EPATCH_SUFFIX="patch"
+ EPATCH_FORCE="yes"
+
+ source "${WORKDIR}"/patches-security/${PV}.conf || die
+
+ for i in ${XEN_SECURITY_MAIN}; do
+ eapply "${WORKDIR}"/patches-security/xen/$i
+ done
+
+ # apply qemu-xen/upstream patches
+ pushd "${S}"/tools/qemu-xen/ > /dev/null
+ for i in ${XEN_SECURITY_QEMUU}; do
+ eapply "${WORKDIR}"/patches-security/qemuu/$i
+ done
+ popd > /dev/null
+
+ # apply qemu-traditional patches
+ pushd "${S}"/tools/qemu-xen-traditional/ > /dev/null
+ for i in ${XEN_SECURITY_QEMUT}; do
+ eapply "${WORKDIR}"/patches-security/qemut/$i
+ done
+ popd > /dev/null
+ fi
+
+ # move before Gentoo patch, one patch should apply to seabios, to fix gcc-4.5.x build err
+ mv ../seabios-${SEABIOS_VER} tools/firmware/seabios-dir-remote || die
+ pushd tools/firmware/ > /dev/null
+ ln -s seabios-dir-remote seabios-dir || die
+ popd > /dev/null
+
+ # Gentoo's patchset
+ if [[ -n ${GENTOO_VER} && -n ${GENTOO_GPV} ]]; then
+ einfo "Try to apply Gentoo specific patch set"
+ source "${FILESDIR}"/gentoo-patches.conf || die
+ _gpv=_gpv_${PN/-/_}_${PV//./}_${GENTOO_GPV}
+ for i in ${!_gpv}; do
+ eapply "${WORKDIR}"/patches-gentoo/$i
+ done
+ fi
+
+ # Ovmf's patchset
+ if use ovmf; then
+ if [[ -n ${OVMF_VER} ]];then
+ einfo "Try to apply Ovmf patch set"
+ pushd "${WORKDIR}"/ovmf-*/ > /dev/null
+ eapply "${WORKDIR}"/patches-ovmf
+ popd > /dev/null
+ fi
+ mv ../ovmf-${OVMF_PV} tools/firmware/ovmf-dir-remote || die
+ fi
+
+ mv tools/qemu-xen/qemu-bridge-helper.c tools/qemu-xen/xen-bridge-helper.c || die
+
+ # Fix texi2html build error with new texi2html, qemu.doc.html
+ sed -i -e "/texi2html -monolithic/s/-number//" tools/qemu-xen-traditional/Makefile || die
+
+ use api || sed -e "/SUBDIRS-\$(LIBXENAPI_BINDINGS) += libxen/d" -i tools/Makefile || die
+ sed -e 's:$(MAKE) PYTHON=$(PYTHON) subdirs-$@:LC_ALL=C "$(MAKE)" PYTHON=$(PYTHON) subdirs-$@:' \
+ -i tools/firmware/Makefile || die
+
+ # Drop .config, fixes to gcc-4.6
+ sed -e '/-include $(XEN_ROOT)\/.config/d' -i Config.mk || die "Couldn't drop"
+
+ # if the user *really* wants to use their own custom-cflags, let them
+ if use custom-cflags; then
+ einfo "User wants their own CFLAGS - removing defaults"
+
+ # try and remove all the default cflags
+ find "${S}" \( -name Makefile -o -name Rules.mk -o -name Config.mk \) \
+ -exec sed \
+ -e 's/CFLAGS\(.*\)=\(.*\)-O3\(.*\)/CFLAGS\1=\2\3/' \
+ -e 's/CFLAGS\(.*\)=\(.*\)-march=i686\(.*\)/CFLAGS\1=\2\3/' \
+ -e 's/CFLAGS\(.*\)=\(.*\)-fomit-frame-pointer\(.*\)/CFLAGS\1=\2\3/' \
+ -e 's/CFLAGS\(.*\)=\(.*\)-g3*\s\(.*\)/CFLAGS\1=\2 \3/' \
+ -e 's/CFLAGS\(.*\)=\(.*\)-O2\(.*\)/CFLAGS\1=\2\3/' \
+ -i {} + || die "failed to re-set custom-cflags"
+ else
+ unset CFLAGS
+ unset LDFLAGS
+ unset ASFLAGS
+ unset CPPFLAGS
+ fi
+
+ if ! use pygrub; then
+ sed -e '/^SUBDIRS-y += pygrub/d' -i tools/Makefile || die
+ fi
+
+ if ! use python; then
+ sed -e '/^SUBDIRS-y += python$/d' -i tools/Makefile || die
+ fi
+
+ if ! use hvm; then
+ sed -e '/SUBDIRS-$(CONFIG_X86) += firmware/d' -i tools/Makefile || die
+ # Bug 351648
+ elif ! use x86 && ! has x86 $(get_all_abis); then
+ mkdir -p "${WORKDIR}"/extra-headers/gnu || die
+ touch "${WORKDIR}"/extra-headers/gnu/stubs-32.h || die
+ export CPATH="${WORKDIR}"/extra-headers
+ fi
+
+ if use qemu; then
+ if use sdl; then
+ sed -i -e "s:\$\$source/configure:\0 --enable-sdl:" \
+ tools/Makefile || die
+ else
+ sed -i -e "s:\${QEMU_ROOT\:\-\.}/configure:\0 --disable-sdl:" \
+ tools/qemu-xen-traditional/xen-setup || die
+ sed -i -e "s:\$\$source/configure:\0 --disable-sdl:" \
+ tools/Makefile || die
+ fi
+ else
+ # Don't bother with qemu, only needed for fully virtualised guests
+ sed -e "s:install-tools\: tools/qemu-xen-traditional-dir:install-tools\: :g" -i Makefile || die
+ fi
+
+ # Reset bash completion dir; Bug 472438
+ sed -e "s:^BASH_COMPLETION_DIR ?= \$(CONFIG_DIR)/bash_completion.d:BASH_COMPLETION_DIR ?= $(get_bashcompdir):" \
+ -i Config.mk || die
+ sed -i -e "/bash-completion/s/xl\.sh/xl/g" tools/libxl/Makefile || die
+
+ # xencommons, Bug #492332, sed lighter weight than patching
+ sed -e 's:\$QEMU_XEN -xen-domid:test -e "\$QEMU_XEN" \&\& &:' \
+ -i tools/hotplug/Linux/init.d/xencommons.in || die
+
+ # fix bashishm
+ sed -e '/Usage/s/\$//g' \
+ -i tools/hotplug/Linux/init.d/xendriverdomain.in || die
+
+ # respect multilib, usr/lib/libcacard.so.0.0.0
+ sed -e "/^libdir=/s/\/lib/\/$(get_libdir)/" \
+ -i tools/qemu-xen/configure || die
+
+ #bug 518136, don't build 32bit exactuable for nomultilib profile
+ if [[ "${ARCH}" == 'amd64' ]] && ! has_multilib_profile; then
+ sed -i -e "/x86_emulator/d" tools/tests/Makefile || die
+ fi
+
+ # uncomment lines in xl.conf
+ sed -e 's:^#autoballoon=:autoballoon=:' \
+ -e 's:^#lockfile=:lockfile=:' \
+ -e 's:^#vif.default.script=:vif.default.script=:' \
+ -i tools/examples/xl.conf || die
+
+ default
+}
+
+src_configure() {
+ local myconf="--prefix=${PREFIX}/usr \
+ --libdir=${PREFIX}/usr/$(get_libdir) \
+ --libexecdir=${PREFIX}/usr/libexec \
+ --localstatedir=${EPREFIX}/var \
+ --disable-werror \
+ --disable-xen \
+ --enable-tools \
+ --enable-docs \
+ $(use_enable pam) \
+ $(use_enable api xenapi) \
+ $(use_enable ovmf) \
+ $(use_enable ocaml ocamltools) \
+ --with-xenstored=$(usex ocaml 'oxenstored' 'xenstored') \
+ "
+
+ use system-seabios && myconf+=" --with-system-seabios=/usr/share/seabios/bios.bin"
+ use system-qemu && myconf+=" --with-system-qemu=/usr/bin/qemu-system-x86_64"
+ use amd64 && myconf+=" $(use_enable qemu-traditional)"
+ econf ${myconf}
+}
+
+src_compile() {
+ local myopt
+ use debug && myopt="${myopt} debug=y"
+
+ if test-flag-CC -fno-strict-overflow; then
+ append-flags -fno-strict-overflow
+ fi
+
+ emake CC="$(tc-getCC)" LD="$(tc-getLD)" AR="$(tc-getAR)" RANLIB="$(tc-getRANLIB)" build-tools ${myopt}
+
+ if use doc; then
+ emake -C docs build
+ else
+ emake -C docs man-pages
+ fi
+}
+
+src_install() {
+ # Override auto-detection in the build system, bug #382573
+ export INITD_DIR=/tmp/init.d
+ export CONFIG_LEAF_DIR=../tmp/default
+
+ # Let the build system compile installed Python modules.
+ local PYTHONDONTWRITEBYTECODE
+ export PYTHONDONTWRITEBYTECODE
+
+ emake DESTDIR="${ED}" DOCDIR="/usr/share/doc/${PF}" \
+ XEN_PYTHON_NATIVE_INSTALL=y install-tools
+
+ # Created at runtime
+ rm -rv "${ED%/}/var/run" || die
+
+ # Fix the remaining Python shebangs.
+ python_fix_shebang "${D}"
+
+ # Remove RedHat-specific stuff
+ rm -rf "${D}"tmp || die
+
+ emake DESTDIR="${D}" DOCDIR="/usr/share/doc/${PF}" install-docs
+ use doc && dodoc -r docs/{pdf,txt}
+ dodoc ${DOCS[@]}
+
+ newconfd "${FILESDIR}"/xendomains.confd xendomains
+ newconfd "${FILESDIR}"/xenstored.confd xenstored
+ newconfd "${FILESDIR}"/xenconsoled.confd xenconsoled
+ newinitd "${FILESDIR}"/xendomains.initd-r2 xendomains
+ newinitd "${FILESDIR}"/xenstored.initd-r1 xenstored
+ newinitd "${FILESDIR}"/xenconsoled.initd xenconsoled
+ newinitd "${FILESDIR}"/xencommons.initd xencommons
+ newconfd "${FILESDIR}"/xencommons.confd xencommons
+ newinitd "${FILESDIR}"/xenqemudev.initd xenqemudev
+ newconfd "${FILESDIR}"/xenqemudev.confd xenqemudev
+ newinitd "${FILESDIR}"/xen-watchdog.initd xen-watchdog
+
+ if use screen; then
+ cat "${FILESDIR}"/xendomains-screen.confd >> "${D}"/etc/conf.d/xendomains || die
+ cp "${FILESDIR}"/xen-consoles.logrotate "${D}"/etc/xen/ || die
+ keepdir /var/log/xen-consoles
+ fi
+
+ # For -static-libs wrt Bug 384355
+ if ! use static-libs; then
+ rm -f "${D}"usr/$(get_libdir)/*.a "${D}"usr/$(get_libdir)/ocaml/*/*.a
+ fi
+
+ # for xendomains
+ keepdir /etc/xen/auto
+
+ # Remove files failing QA AFTER emake installs them, avoiding seeking absent files
+ find "${D}" \( -name openbios-sparc32 -o -name openbios-sparc64 \
+ -o -name openbios-ppc -o -name palcode-clipper \) -delete || die
+}
+
+pkg_postinst() {
+ elog "Official Xen Guide and the offical wiki page:"
+ elog "https://wiki.gentoo.org/wiki/Xen"
+ elog "https://wiki.xen.org/wiki/Main_Page"
+ elog ""
+ elog "Recommended to utilise the xencommons script to config sytem At boot"
+ elog "Add by use of rc-update on completion of the install"
+
+ if ! use hvm; then
+ echo
+ elog "HVM (VT-x and AMD-V) support has been disabled. If you need hvm"
+ elog "support enable the hvm use flag."
+ elog "An x86 or amd64 system is required to build HVM support."
+ fi
+
+ if use qemu; then
+ elog "The qemu-bridge-helper is renamed to the xen-bridge-helper in the in source"
+ elog "build of qemu. This allows for app-emulation/qemu to be emerged concurrently"
+ elog "with the qemu capable xen. It is up to the user to distinguish between and utilise"
+ elog "the qemu-bridge-helper and the xen-bridge-helper. File bugs of any issues that arise"
+ fi
+}
diff --git a/app-emulation/xen-tools/xen-tools-4.9.1-r1.ebuild b/app-emulation/xen-tools/xen-tools-4.9.1-r1.ebuild
new file mode 100644
index 000000000000..f18cfce1271b
--- /dev/null
+++ b/app-emulation/xen-tools/xen-tools-4.9.1-r1.ebuild
@@ -0,0 +1,454 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PYTHON_COMPAT=( python2_7 )
+PYTHON_REQ_USE='ncurses,xml,threads'
+
+inherit bash-completion-r1 eutils flag-o-matic multilib python-single-r1 toolchain-funcs versionator
+
+MY_PV=${PV/_/-}
+MAJOR_V="$(get_version_component_range 1-2)"
+
+if [[ $PV == *9999 ]]; then
+ inherit git-r3
+ KEYWORDS="amd64 x86"
+ REPO="xen.git"
+ EGIT_REPO_URI="git://xenbits.xen.org/${REPO}"
+ S="${WORKDIR}/${REPO}"
+else
+ KEYWORDS="amd64 ~arm ~arm64 x86"
+ UPSTREAM_VER=1
+ SECURITY_VER=
+ # xen-tools's gentoo patches tarball
+ GENTOO_VER=10
+ # xen-tools's gentoo patches version which apply to this specific ebuild
+ GENTOO_GPV=0
+ # xen-tools ovmf's patches
+ OVMF_VER=3
+
+ SEABIOS_VER=1.10.0
+ # OVMF upstream 5920a9d16b1ab887c2858224316a98e961d71b05
+ OVMF_PV=20170321
+
+ [[ -n ${UPSTREAM_VER} ]] && \
+ UPSTREAM_PATCHSET_URI="https://dev.gentoo.org/~dlan/distfiles/${P/-tools/}-upstream-patches-${UPSTREAM_VER}.tar.xz"
+ [[ -n ${SECURITY_VER} ]] && \
+ SECURITY_PATCHSET_URI="https://dev.gentoo.org/~dlan/distfiles/${PN/-tools}-security-patches-${SECURITY_VER}.tar.xz"
+ [[ -n ${GENTOO_VER} ]] && \
+ GENTOO_PATCHSET_URI="https://dev.gentoo.org/~dlan/distfiles/${PN/-tools}-gentoo-patches-${GENTOO_VER}.tar.xz"
+ [[ -n ${OVMF_VER} ]] && \
+ OVMF_PATCHSET_URI="https://dev.gentoo.org/~dlan/distfiles/${PN/-tools}-ovmf-patches-${OVMF_VER}.tar.xz"
+
+ SRC_URI="https://downloads.xenproject.org/release/xen/${MY_PV}/xen-${MY_PV}.tar.gz
+ http://code.coreboot.org/p/seabios/downloads/get/seabios-${SEABIOS_VER}.tar.gz
+ https://dev.gentoo.org/~dlan/distfiles/seabios-${SEABIOS_VER}.tar.gz
+ ovmf? ( https://dev.gentoo.org/~dlan/distfiles/ovmf-${OVMF_PV}.tar.xz
+ ${OVMF_PATCHSET_URI} )
+ ${UPSTREAM_PATCHSET_URI}
+ ${SECURITY_PATCHSET_URI}
+ ${GENTOO_PATCHSET_URI}"
+
+ S="${WORKDIR}/xen-${MY_PV}"
+fi
+
+DESCRIPTION="Xen tools including QEMU and xl"
+HOMEPAGE="https://www.xenproject.org"
+DOCS=( README docs/README.xen-bugtool )
+
+LICENSE="GPL-2"
+SLOT="0/${MAJOR_V}"
+# Inclusion of IUSE ocaml on stabalizing requires maintainer of ocaml to (get off his hands and) make
+# >=dev-lang/ocaml-4 stable
+# Masked in profiles/eapi-5-files instead
+IUSE="api custom-cflags debug doc flask hvm ocaml ovmf +pam pygrub python +qemu +qemu-traditional screen sdl static-libs system-qemu system-seabios"
+
+REQUIRED_USE="
+ ${PYTHON_REQUIRED_USE}
+ pygrub? ( python )
+ ovmf? ( hvm )
+ ^^ ( qemu system-qemu )"
+
+COMMON_DEPEND="
+ sys-apps/pciutils
+ dev-libs/lzo:2
+ dev-libs/glib:2
+ dev-libs/yajl
+ dev-libs/libaio
+ dev-libs/libgcrypt:0
+ sys-libs/zlib
+ ${PYTHON_DEPS}
+"
+
+DEPEND="${COMMON_DEPEND}
+ >=sys-kernel/linux-headers-4.11
+ dev-python/lxml[${PYTHON_USEDEP}]
+ x86? ( sys-devel/dev86
+ sys-power/iasl )
+ pam? ( dev-python/pypam[${PYTHON_USEDEP}] )
+ api? ( dev-libs/libxml2
+ net-misc/curl )
+ ovmf? (
+ !arm? ( !arm64? ( dev-lang/nasm ) )
+ $(python_gen_impl_dep sqlite)
+ )
+ !amd64? ( >=sys-apps/dtc-1.4.0 )
+ amd64? ( sys-devel/bin86
+ system-seabios? ( sys-firmware/seabios )
+ sys-firmware/ipxe
+ sys-devel/dev86
+ sys-power/iasl )
+ dev-lang/perl
+ app-misc/pax-utils
+ doc? (
+ app-text/ghostscript-gpl
+ app-text/pandoc
+ dev-python/markdown[${PYTHON_USEDEP}]
+ dev-texlive/texlive-latexextra
+ media-gfx/transfig
+ )
+ hvm? ( x11-base/xorg-proto
+ !net-libs/libiscsi )
+ qemu? (
+ app-arch/snappy:=
+ x11-libs/pixman
+ sdl? ( media-libs/libsdl[X] )
+ )
+ system-qemu? ( app-emulation/qemu[xen] )
+ ocaml? ( dev-ml/findlib
+ >=dev-lang/ocaml-4 )"
+
+RDEPEND="${COMMON_DEPEND}
+ sys-apps/iproute2[-minimal]
+ net-misc/bridge-utils
+ screen? (
+ app-misc/screen
+ app-admin/logrotate
+ )"
+
+# hvmloader is used to bootstrap a fully virtualized kernel
+# Approved by QA team in bug #144032
+QA_WX_LOAD="
+ usr/libexec/xen/boot/hvmloader
+ usr/share/qemu-xen/qemu/s390-ccw.img
+ usr/share/qemu-xen/qemu/u-boot.e500
+"
+
+QA_PREBUILT="
+ usr/libexec/xen/bin/ivshmem-client
+ usr/libexec/xen/bin/ivshmem-server
+ usr/libexec/xen/bin/qemu-img
+ usr/libexec/xen/bin/qemu-io
+ usr/libexec/xen/bin/qemu-nbd
+ usr/libexec/xen/bin/qemu-system-i386
+ usr/libexec/xen/bin/virtfs-proxy-helper
+ usr/libexec/xen/libexec/xen-bridge-helper
+ usr/share/qemu-xen/qemu/s390-ccw.img
+ usr/share/qemu-xen/qemu/u-boot.e500
+"
+
+RESTRICT="test"
+
+pkg_setup() {
+ python_setup
+ export "CONFIG_LOMOUNT=y"
+
+ #bug 522642, disable compile tools/tests
+ export "CONFIG_TESTS=n"
+
+ if [[ -z ${XEN_TARGET_ARCH} ]] ; then
+ if use x86 && use amd64; then
+ die "Confusion! Both x86 and amd64 are set in your use flags!"
+ elif use x86; then
+ export XEN_TARGET_ARCH="x86_32"
+ elif use amd64 ; then
+ export XEN_TARGET_ARCH="x86_64"
+ elif use arm; then
+ export XEN_TARGET_ARCH="arm32"
+ elif use arm64; then
+ export XEN_TARGET_ARCH="arm64"
+ else
+ die "Unsupported architecture!"
+ fi
+ fi
+}
+
+src_prepare() {
+ local i
+
+ # Upstream's patchset
+ if [[ -n ${UPSTREAM_VER} ]]; then
+ einfo "Try to apply Xen Upstream patch set"
+ eapply "${WORKDIR}"/patches-upstream
+ fi
+
+ # Security patchset
+ if [[ -n ${SECURITY_VER} ]]; then
+ einfo "Try to apply Xen Security patch set"
+ # apply main xen patches
+ # Two parallel systems, both work side by side
+ # Over time they may concdense into one. This will suffice for now
+ EPATCH_SUFFIX="patch"
+ EPATCH_FORCE="yes"
+
+ source "${WORKDIR}"/patches-security/${PV}.conf || die
+
+ for i in ${XEN_SECURITY_MAIN}; do
+ eapply "${WORKDIR}"/patches-security/xen/$i
+ done
+
+ # apply qemu-xen/upstream patches
+ pushd "${S}"/tools/qemu-xen/ > /dev/null
+ for i in ${XEN_SECURITY_QEMUU}; do
+ eapply "${WORKDIR}"/patches-security/qemuu/$i
+ done
+ popd > /dev/null
+
+ # apply qemu-traditional patches
+ pushd "${S}"/tools/qemu-xen-traditional/ > /dev/null
+ for i in ${XEN_SECURITY_QEMUT}; do
+ eapply "${WORKDIR}"/patches-security/qemut/$i
+ done
+ popd > /dev/null
+ fi
+
+ # move before Gentoo patch, one patch should apply to seabios, to fix gcc-4.5.x build err
+ mv ../seabios-${SEABIOS_VER} tools/firmware/seabios-dir-remote || die
+ pushd tools/firmware/ > /dev/null
+ ln -s seabios-dir-remote seabios-dir || die
+ popd > /dev/null
+
+ # Gentoo's patchset
+ if [[ -n ${GENTOO_VER} && -n ${GENTOO_GPV} ]]; then
+ einfo "Try to apply Gentoo specific patch set"
+ source "${FILESDIR}"/gentoo-patches.conf || die
+ _gpv=_gpv_${PN/-/_}_${PV//./}_${GENTOO_GPV}
+ for i in ${!_gpv}; do
+ eapply "${WORKDIR}"/patches-gentoo/$i
+ done
+ fi
+
+ # Ovmf's patchset
+ if use ovmf; then
+ if [[ -n ${OVMF_VER} ]];then
+ einfo "Try to apply Ovmf patch set"
+ pushd "${WORKDIR}"/ovmf-*/ > /dev/null
+ eapply "${WORKDIR}"/patches-ovmf
+ popd > /dev/null
+ fi
+ mv ../ovmf-${OVMF_PV} tools/firmware/ovmf-dir-remote || die
+ fi
+
+ mv tools/qemu-xen/qemu-bridge-helper.c tools/qemu-xen/xen-bridge-helper.c || die
+
+ # Fix texi2html build error with new texi2html, qemu.doc.html
+ sed -i -e "/texi2html -monolithic/s/-number//" tools/qemu-xen-traditional/Makefile || die
+
+ use api || sed -e "/SUBDIRS-\$(LIBXENAPI_BINDINGS) += libxen/d" -i tools/Makefile || die
+ sed -e 's:$(MAKE) PYTHON=$(PYTHON) subdirs-$@:LC_ALL=C "$(MAKE)" PYTHON=$(PYTHON) subdirs-$@:' \
+ -i tools/firmware/Makefile || die
+
+ # Drop .config, fixes to gcc-4.6
+ sed -e '/-include $(XEN_ROOT)\/.config/d' -i Config.mk || die "Couldn't drop"
+
+ # if the user *really* wants to use their own custom-cflags, let them
+ if use custom-cflags; then
+ einfo "User wants their own CFLAGS - removing defaults"
+
+ # try and remove all the default cflags
+ find "${S}" \( -name Makefile -o -name Rules.mk -o -name Config.mk \) \
+ -exec sed \
+ -e 's/CFLAGS\(.*\)=\(.*\)-O3\(.*\)/CFLAGS\1=\2\3/' \
+ -e 's/CFLAGS\(.*\)=\(.*\)-march=i686\(.*\)/CFLAGS\1=\2\3/' \
+ -e 's/CFLAGS\(.*\)=\(.*\)-fomit-frame-pointer\(.*\)/CFLAGS\1=\2\3/' \
+ -e 's/CFLAGS\(.*\)=\(.*\)-g3*\s\(.*\)/CFLAGS\1=\2 \3/' \
+ -e 's/CFLAGS\(.*\)=\(.*\)-O2\(.*\)/CFLAGS\1=\2\3/' \
+ -i {} + || die "failed to re-set custom-cflags"
+ else
+ unset CFLAGS
+ unset LDFLAGS
+ unset ASFLAGS
+ unset CPPFLAGS
+ fi
+
+ if ! use pygrub; then
+ sed -e '/^SUBDIRS-y += pygrub/d' -i tools/Makefile || die
+ fi
+
+ if ! use python; then
+ sed -e '/^SUBDIRS-y += python$/d' -i tools/Makefile || die
+ fi
+
+ if ! use hvm; then
+ sed -e '/SUBDIRS-$(CONFIG_X86) += firmware/d' -i tools/Makefile || die
+ # Bug 351648
+ elif ! use x86 && ! has x86 $(get_all_abis); then
+ mkdir -p "${WORKDIR}"/extra-headers/gnu || die
+ touch "${WORKDIR}"/extra-headers/gnu/stubs-32.h || die
+ export CPATH="${WORKDIR}"/extra-headers
+ fi
+
+ if use qemu; then
+ if use sdl; then
+ sed -i -e "s:\$\$source/configure:\0 --enable-sdl:" \
+ tools/Makefile || die
+ else
+ sed -i -e "s:\${QEMU_ROOT\:\-\.}/configure:\0 --disable-sdl:" \
+ tools/qemu-xen-traditional/xen-setup || die
+ sed -i -e "s:\$\$source/configure:\0 --disable-sdl:" \
+ tools/Makefile || die
+ fi
+ else
+ # Don't bother with qemu, only needed for fully virtualised guests
+ sed -e "s:install-tools\: tools/qemu-xen-traditional-dir:install-tools\: :g" -i Makefile || die
+ fi
+
+ # Reset bash completion dir; Bug 472438
+ sed -e "s:^BASH_COMPLETION_DIR ?= \$(CONFIG_DIR)/bash_completion.d:BASH_COMPLETION_DIR ?= $(get_bashcompdir):" \
+ -i Config.mk || die
+ sed -i -e "/bash-completion/s/xl\.sh/xl/g" tools/libxl/Makefile || die
+
+ # xencommons, Bug #492332, sed lighter weight than patching
+ sed -e 's:\$QEMU_XEN -xen-domid:test -e "\$QEMU_XEN" \&\& &:' \
+ -i tools/hotplug/Linux/init.d/xencommons.in || die
+
+ # fix bashishm
+ sed -e '/Usage/s/\$//g' \
+ -i tools/hotplug/Linux/init.d/xendriverdomain.in || die
+
+ # respect multilib, usr/lib/libcacard.so.0.0.0
+ sed -e "/^libdir=/s/\/lib/\/$(get_libdir)/" \
+ -i tools/qemu-xen/configure || die
+
+ #bug 518136, don't build 32bit exactuable for nomultilib profile
+ if [[ "${ARCH}" == 'amd64' ]] && ! has_multilib_profile; then
+ sed -i -e "/x86_emulator/d" tools/tests/Makefile || die
+ fi
+
+ # uncomment lines in xl.conf
+ sed -e 's:^#autoballoon=:autoballoon=:' \
+ -e 's:^#lockfile=:lockfile=:' \
+ -e 's:^#vif.default.script=:vif.default.script=:' \
+ -i tools/examples/xl.conf || die
+
+ default
+}
+
+src_configure() {
+ local myconf="--prefix=${PREFIX}/usr \
+ --libdir=${PREFIX}/usr/$(get_libdir) \
+ --libexecdir=${PREFIX}/usr/libexec \
+ --localstatedir=${EPREFIX}/var \
+ --disable-werror \
+ --disable-xen \
+ --enable-tools \
+ --enable-docs \
+ $(use_enable pam) \
+ $(use_enable api xenapi) \
+ $(use_enable ovmf) \
+ $(use_enable ocaml ocamltools) \
+ --with-xenstored=$(usex ocaml 'oxenstored' 'xenstored') \
+ "
+
+ use system-seabios && myconf+=" --with-system-seabios=/usr/share/seabios/bios.bin"
+ use system-qemu && myconf+=" --with-system-qemu=/usr/bin/qemu-system-x86_64"
+ use amd64 && myconf+=" $(use_enable qemu-traditional)"
+ econf ${myconf}
+}
+
+src_compile() {
+ local myopt
+ use debug && myopt="${myopt} debug=y"
+
+ if test-flag-CC -fno-strict-overflow; then
+ append-flags -fno-strict-overflow
+ fi
+
+ emake CC="$(tc-getCC)" LD="$(tc-getLD)" AR="$(tc-getAR)" RANLIB="$(tc-getRANLIB)" build-tools ${myopt}
+
+ if use doc; then
+ emake -C docs build
+ else
+ emake -C docs man-pages
+ fi
+}
+
+src_install() {
+ # Override auto-detection in the build system, bug #382573
+ export INITD_DIR=/tmp/init.d
+ export CONFIG_LEAF_DIR=../tmp/default
+
+ # Let the build system compile installed Python modules.
+ local PYTHONDONTWRITEBYTECODE
+ export PYTHONDONTWRITEBYTECODE
+
+ emake DESTDIR="${ED}" DOCDIR="/usr/share/doc/${PF}" \
+ XEN_PYTHON_NATIVE_INSTALL=y install-tools
+
+ # Created at runtime
+ rm -rv "${ED%/}/var/run" || die
+
+ # Fix the remaining Python shebangs.
+ python_fix_shebang "${D}"
+
+ # Remove RedHat-specific stuff
+ rm -rf "${D}"tmp || die
+
+ emake DESTDIR="${D}" DOCDIR="/usr/share/doc/${PF}" install-docs
+ use doc && dodoc -r docs/{pdf,txt}
+ dodoc ${DOCS[@]}
+
+ newconfd "${FILESDIR}"/xendomains.confd xendomains
+ newconfd "${FILESDIR}"/xenstored.confd xenstored
+ newconfd "${FILESDIR}"/xenconsoled.confd xenconsoled
+ newinitd "${FILESDIR}"/xendomains.initd-r2 xendomains
+ newinitd "${FILESDIR}"/xenstored.initd-r1 xenstored
+ newinitd "${FILESDIR}"/xenconsoled.initd xenconsoled
+ newinitd "${FILESDIR}"/xencommons.initd xencommons
+ newconfd "${FILESDIR}"/xencommons.confd xencommons
+ newinitd "${FILESDIR}"/xenqemudev.initd xenqemudev
+ newconfd "${FILESDIR}"/xenqemudev.confd xenqemudev
+ newinitd "${FILESDIR}"/xen-watchdog.initd xen-watchdog
+
+ if use screen; then
+ cat "${FILESDIR}"/xendomains-screen.confd >> "${D}"/etc/conf.d/xendomains || die
+ cp "${FILESDIR}"/xen-consoles.logrotate "${D}"/etc/xen/ || die
+ keepdir /var/log/xen-consoles
+ fi
+
+ # For -static-libs wrt Bug 384355
+ if ! use static-libs; then
+ rm -f "${D}"usr/$(get_libdir)/*.a "${D}"usr/$(get_libdir)/ocaml/*/*.a
+ fi
+
+ # for xendomains
+ keepdir /etc/xen/auto
+
+ # Remove files failing QA AFTER emake installs them, avoiding seeking absent files
+ find "${D}" \( -name openbios-sparc32 -o -name openbios-sparc64 \
+ -o -name openbios-ppc -o -name palcode-clipper \) -delete || die
+}
+
+pkg_postinst() {
+ elog "Official Xen Guide and the offical wiki page:"
+ elog "https://wiki.gentoo.org/wiki/Xen"
+ elog "https://wiki.xen.org/wiki/Main_Page"
+ elog ""
+ elog "Recommended to utilise the xencommons script to config sytem At boot"
+ elog "Add by use of rc-update on completion of the install"
+
+ if ! use hvm; then
+ echo
+ elog "HVM (VT-x and AMD-V) support has been disabled. If you need hvm"
+ elog "support enable the hvm use flag."
+ elog "An x86 or amd64 system is required to build HVM support."
+ fi
+
+ if use qemu; then
+ elog "The qemu-bridge-helper is renamed to the xen-bridge-helper in the in source"
+ elog "build of qemu. This allows for app-emulation/qemu to be emerged concurrently"
+ elog "with the qemu capable xen. It is up to the user to distinguish between and utilise"
+ elog "the qemu-bridge-helper and the xen-bridge-helper. File bugs of any issues that arise"
+ fi
+}
diff --git a/app-emulation/xen-tools/xen-tools-4.9.1-r2.ebuild b/app-emulation/xen-tools/xen-tools-4.9.1-r2.ebuild
new file mode 100644
index 000000000000..191c3222dbe1
--- /dev/null
+++ b/app-emulation/xen-tools/xen-tools-4.9.1-r2.ebuild
@@ -0,0 +1,455 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PYTHON_COMPAT=( python2_7 )
+PYTHON_REQ_USE='ncurses,xml,threads'
+
+inherit bash-completion-r1 eutils flag-o-matic multilib python-single-r1 toolchain-funcs versionator
+
+MY_PV=${PV/_/-}
+MAJOR_V="$(get_version_component_range 1-2)"
+
+if [[ $PV == *9999 ]]; then
+ inherit git-r3
+ KEYWORDS=""
+ REPO="xen.git"
+ EGIT_REPO_URI="git://xenbits.xen.org/${REPO}"
+ S="${WORKDIR}/${REPO}"
+else
+ KEYWORDS="~amd64 ~arm ~arm64 ~x86"
+ UPSTREAM_VER=2
+ SECURITY_VER=
+ # xen-tools's gentoo patches tarball
+ GENTOO_VER=12
+ # xen-tools's gentoo patches version which apply to this specific ebuild
+ GENTOO_GPV=1
+ # xen-tools ovmf's patches
+ OVMF_VER=3
+
+ SEABIOS_VER=1.10.0
+ # OVMF upstream 5920a9d16b1ab887c2858224316a98e961d71b05
+ OVMF_PV=20170321
+
+ [[ -n ${UPSTREAM_VER} ]] && \
+ UPSTREAM_PATCHSET_URI="https://dev.gentoo.org/~dlan/distfiles/${P/-tools/}-upstream-patches-${UPSTREAM_VER}.tar.xz"
+ [[ -n ${SECURITY_VER} ]] && \
+ SECURITY_PATCHSET_URI="https://dev.gentoo.org/~dlan/distfiles/${PN/-tools}-security-patches-${SECURITY_VER}.tar.xz"
+ [[ -n ${GENTOO_VER} ]] && \
+ GENTOO_PATCHSET_URI="https://dev.gentoo.org/~dlan/distfiles/${PN/-tools}-gentoo-patches-${GENTOO_VER}.tar.xz
+ https://github.com/hydrapolic/gentoo-dist/raw/master/xen/${PN/-tools/}-gentoo-patches-${GENTOO_VER}.tar.xz"
+ [[ -n ${OVMF_VER} ]] && \
+ OVMF_PATCHSET_URI="https://dev.gentoo.org/~dlan/distfiles/${PN/-tools}-ovmf-patches-${OVMF_VER}.tar.xz"
+
+ SRC_URI="https://downloads.xenproject.org/release/xen/${MY_PV}/xen-${MY_PV}.tar.gz
+ http://code.coreboot.org/p/seabios/downloads/get/seabios-${SEABIOS_VER}.tar.gz
+ https://dev.gentoo.org/~dlan/distfiles/seabios-${SEABIOS_VER}.tar.gz
+ ovmf? ( https://dev.gentoo.org/~dlan/distfiles/ovmf-${OVMF_PV}.tar.xz
+ ${OVMF_PATCHSET_URI} )
+ ${UPSTREAM_PATCHSET_URI}
+ ${SECURITY_PATCHSET_URI}
+ ${GENTOO_PATCHSET_URI}"
+
+ S="${WORKDIR}/xen-${MY_PV}"
+fi
+
+DESCRIPTION="Xen tools including QEMU and xl"
+HOMEPAGE="https://www.xenproject.org"
+DOCS=( README docs/README.xen-bugtool )
+
+LICENSE="GPL-2"
+SLOT="0/${MAJOR_V}"
+# Inclusion of IUSE ocaml on stabalizing requires maintainer of ocaml to (get off his hands and) make
+# >=dev-lang/ocaml-4 stable
+# Masked in profiles/eapi-5-files instead
+IUSE="api custom-cflags debug doc flask hvm ocaml ovmf +pam pygrub python +qemu +qemu-traditional screen sdl static-libs system-qemu system-seabios"
+
+REQUIRED_USE="
+ ${PYTHON_REQUIRED_USE}
+ pygrub? ( python )
+ ovmf? ( hvm )
+ ^^ ( qemu system-qemu )"
+
+COMMON_DEPEND="
+ sys-apps/pciutils
+ dev-libs/lzo:2
+ dev-libs/glib:2
+ dev-libs/yajl
+ dev-libs/libaio
+ dev-libs/libgcrypt:0
+ sys-libs/zlib
+ ${PYTHON_DEPS}
+"
+
+DEPEND="${COMMON_DEPEND}
+ >=sys-kernel/linux-headers-4.11
+ dev-python/lxml[${PYTHON_USEDEP}]
+ x86? ( sys-devel/dev86
+ sys-power/iasl )
+ pam? ( dev-python/pypam[${PYTHON_USEDEP}] )
+ api? ( dev-libs/libxml2
+ net-misc/curl )
+ ovmf? (
+ !arm? ( !arm64? ( dev-lang/nasm ) )
+ $(python_gen_impl_dep sqlite)
+ )
+ !amd64? ( >=sys-apps/dtc-1.4.0 )
+ amd64? ( sys-devel/bin86
+ system-seabios? ( sys-firmware/seabios )
+ sys-firmware/ipxe
+ sys-devel/dev86
+ sys-power/iasl )
+ dev-lang/perl
+ app-misc/pax-utils
+ doc? (
+ app-text/ghostscript-gpl
+ app-text/pandoc
+ dev-python/markdown[${PYTHON_USEDEP}]
+ dev-texlive/texlive-latexextra
+ media-gfx/transfig
+ )
+ hvm? ( x11-base/xorg-proto
+ !net-libs/libiscsi )
+ qemu? (
+ app-arch/snappy:=
+ x11-libs/pixman
+ sdl? ( media-libs/libsdl[X] )
+ )
+ system-qemu? ( app-emulation/qemu[xen] )
+ ocaml? ( dev-ml/findlib
+ >=dev-lang/ocaml-4 )"
+
+RDEPEND="${COMMON_DEPEND}
+ sys-apps/iproute2[-minimal]
+ net-misc/bridge-utils
+ screen? (
+ app-misc/screen
+ app-admin/logrotate
+ )"
+
+# hvmloader is used to bootstrap a fully virtualized kernel
+# Approved by QA team in bug #144032
+QA_WX_LOAD="
+ usr/libexec/xen/boot/hvmloader
+ usr/share/qemu-xen/qemu/s390-ccw.img
+ usr/share/qemu-xen/qemu/u-boot.e500
+"
+
+QA_PREBUILT="
+ usr/libexec/xen/bin/ivshmem-client
+ usr/libexec/xen/bin/ivshmem-server
+ usr/libexec/xen/bin/qemu-img
+ usr/libexec/xen/bin/qemu-io
+ usr/libexec/xen/bin/qemu-nbd
+ usr/libexec/xen/bin/qemu-system-i386
+ usr/libexec/xen/bin/virtfs-proxy-helper
+ usr/libexec/xen/libexec/xen-bridge-helper
+ usr/share/qemu-xen/qemu/s390-ccw.img
+ usr/share/qemu-xen/qemu/u-boot.e500
+"
+
+RESTRICT="test"
+
+pkg_setup() {
+ python_setup
+ export "CONFIG_LOMOUNT=y"
+
+ #bug 522642, disable compile tools/tests
+ export "CONFIG_TESTS=n"
+
+ if [[ -z ${XEN_TARGET_ARCH} ]] ; then
+ if use x86 && use amd64; then
+ die "Confusion! Both x86 and amd64 are set in your use flags!"
+ elif use x86; then
+ export XEN_TARGET_ARCH="x86_32"
+ elif use amd64 ; then
+ export XEN_TARGET_ARCH="x86_64"
+ elif use arm; then
+ export XEN_TARGET_ARCH="arm32"
+ elif use arm64; then
+ export XEN_TARGET_ARCH="arm64"
+ else
+ die "Unsupported architecture!"
+ fi
+ fi
+}
+
+src_prepare() {
+ local i
+
+ # Upstream's patchset
+ if [[ -n ${UPSTREAM_VER} ]]; then
+ einfo "Try to apply Xen Upstream patch set"
+ eapply "${WORKDIR}"/patches-upstream
+ fi
+
+ # Security patchset
+ if [[ -n ${SECURITY_VER} ]]; then
+ einfo "Try to apply Xen Security patch set"
+ # apply main xen patches
+ # Two parallel systems, both work side by side
+ # Over time they may concdense into one. This will suffice for now
+ EPATCH_SUFFIX="patch"
+ EPATCH_FORCE="yes"
+
+ source "${WORKDIR}"/patches-security/${PV}.conf || die
+
+ for i in ${XEN_SECURITY_MAIN}; do
+ eapply "${WORKDIR}"/patches-security/xen/$i
+ done
+
+ # apply qemu-xen/upstream patches
+ pushd "${S}"/tools/qemu-xen/ > /dev/null
+ for i in ${XEN_SECURITY_QEMUU}; do
+ eapply "${WORKDIR}"/patches-security/qemuu/$i
+ done
+ popd > /dev/null
+
+ # apply qemu-traditional patches
+ pushd "${S}"/tools/qemu-xen-traditional/ > /dev/null
+ for i in ${XEN_SECURITY_QEMUT}; do
+ eapply "${WORKDIR}"/patches-security/qemut/$i
+ done
+ popd > /dev/null
+ fi
+
+ # move before Gentoo patch, one patch should apply to seabios, to fix gcc-4.5.x build err
+ mv ../seabios-${SEABIOS_VER} tools/firmware/seabios-dir-remote || die
+ pushd tools/firmware/ > /dev/null
+ ln -s seabios-dir-remote seabios-dir || die
+ popd > /dev/null
+
+ # Gentoo's patchset
+ if [[ -n ${GENTOO_VER} && -n ${GENTOO_GPV} ]]; then
+ einfo "Try to apply Gentoo specific patch set"
+ source "${FILESDIR}"/gentoo-patches.conf || die
+ _gpv=_gpv_${PN/-/_}_${PV//./}_${GENTOO_GPV}
+ for i in ${!_gpv}; do
+ eapply "${WORKDIR}"/patches-gentoo/$i
+ done
+ fi
+
+ # Ovmf's patchset
+ if use ovmf; then
+ if [[ -n ${OVMF_VER} ]];then
+ einfo "Try to apply Ovmf patch set"
+ pushd "${WORKDIR}"/ovmf-*/ > /dev/null
+ eapply "${WORKDIR}"/patches-ovmf
+ popd > /dev/null
+ fi
+ mv ../ovmf-${OVMF_PV} tools/firmware/ovmf-dir-remote || die
+ fi
+
+ mv tools/qemu-xen/qemu-bridge-helper.c tools/qemu-xen/xen-bridge-helper.c || die
+
+ # Fix texi2html build error with new texi2html, qemu.doc.html
+ sed -i -e "/texi2html -monolithic/s/-number//" tools/qemu-xen-traditional/Makefile || die
+
+ use api || sed -e "/SUBDIRS-\$(LIBXENAPI_BINDINGS) += libxen/d" -i tools/Makefile || die
+ sed -e 's:$(MAKE) PYTHON=$(PYTHON) subdirs-$@:LC_ALL=C "$(MAKE)" PYTHON=$(PYTHON) subdirs-$@:' \
+ -i tools/firmware/Makefile || die
+
+ # Drop .config, fixes to gcc-4.6
+ sed -e '/-include $(XEN_ROOT)\/.config/d' -i Config.mk || die "Couldn't drop"
+
+ # if the user *really* wants to use their own custom-cflags, let them
+ if use custom-cflags; then
+ einfo "User wants their own CFLAGS - removing defaults"
+
+ # try and remove all the default cflags
+ find "${S}" \( -name Makefile -o -name Rules.mk -o -name Config.mk \) \
+ -exec sed \
+ -e 's/CFLAGS\(.*\)=\(.*\)-O3\(.*\)/CFLAGS\1=\2\3/' \
+ -e 's/CFLAGS\(.*\)=\(.*\)-march=i686\(.*\)/CFLAGS\1=\2\3/' \
+ -e 's/CFLAGS\(.*\)=\(.*\)-fomit-frame-pointer\(.*\)/CFLAGS\1=\2\3/' \
+ -e 's/CFLAGS\(.*\)=\(.*\)-g3*\s\(.*\)/CFLAGS\1=\2 \3/' \
+ -e 's/CFLAGS\(.*\)=\(.*\)-O2\(.*\)/CFLAGS\1=\2\3/' \
+ -i {} + || die "failed to re-set custom-cflags"
+ else
+ unset CFLAGS
+ unset LDFLAGS
+ unset ASFLAGS
+ unset CPPFLAGS
+ fi
+
+ if ! use pygrub; then
+ sed -e '/^SUBDIRS-y += pygrub/d' -i tools/Makefile || die
+ fi
+
+ if ! use python; then
+ sed -e '/^SUBDIRS-y += python$/d' -i tools/Makefile || die
+ fi
+
+ if ! use hvm; then
+ sed -e '/SUBDIRS-$(CONFIG_X86) += firmware/d' -i tools/Makefile || die
+ # Bug 351648
+ elif ! use x86 && ! has x86 $(get_all_abis); then
+ mkdir -p "${WORKDIR}"/extra-headers/gnu || die
+ touch "${WORKDIR}"/extra-headers/gnu/stubs-32.h || die
+ export CPATH="${WORKDIR}"/extra-headers
+ fi
+
+ if use qemu; then
+ if use sdl; then
+ sed -i -e "s:\$\$source/configure:\0 --enable-sdl:" \
+ tools/Makefile || die
+ else
+ sed -i -e "s:\${QEMU_ROOT\:\-\.}/configure:\0 --disable-sdl:" \
+ tools/qemu-xen-traditional/xen-setup || die
+ sed -i -e "s:\$\$source/configure:\0 --disable-sdl:" \
+ tools/Makefile || die
+ fi
+ else
+ # Don't bother with qemu, only needed for fully virtualised guests
+ sed -e "s:install-tools\: tools/qemu-xen-traditional-dir:install-tools\: :g" -i Makefile || die
+ fi
+
+ # Reset bash completion dir; Bug 472438
+ sed -e "s:^BASH_COMPLETION_DIR ?= \$(CONFIG_DIR)/bash_completion.d:BASH_COMPLETION_DIR ?= $(get_bashcompdir):" \
+ -i Config.mk || die
+ sed -i -e "/bash-completion/s/xl\.sh/xl/g" tools/libxl/Makefile || die
+
+ # xencommons, Bug #492332, sed lighter weight than patching
+ sed -e 's:\$QEMU_XEN -xen-domid:test -e "\$QEMU_XEN" \&\& &:' \
+ -i tools/hotplug/Linux/init.d/xencommons.in || die
+
+ # fix bashishm
+ sed -e '/Usage/s/\$//g' \
+ -i tools/hotplug/Linux/init.d/xendriverdomain.in || die
+
+ # respect multilib, usr/lib/libcacard.so.0.0.0
+ sed -e "/^libdir=/s/\/lib/\/$(get_libdir)/" \
+ -i tools/qemu-xen/configure || die
+
+ #bug 518136, don't build 32bit exactuable for nomultilib profile
+ if [[ "${ARCH}" == 'amd64' ]] && ! has_multilib_profile; then
+ sed -i -e "/x86_emulator/d" tools/tests/Makefile || die
+ fi
+
+ # uncomment lines in xl.conf
+ sed -e 's:^#autoballoon=:autoballoon=:' \
+ -e 's:^#lockfile=:lockfile=:' \
+ -e 's:^#vif.default.script=:vif.default.script=:' \
+ -i tools/examples/xl.conf || die
+
+ default
+}
+
+src_configure() {
+ local myconf="--prefix=${PREFIX}/usr \
+ --libdir=${PREFIX}/usr/$(get_libdir) \
+ --libexecdir=${PREFIX}/usr/libexec \
+ --localstatedir=${EPREFIX}/var \
+ --disable-werror \
+ --disable-xen \
+ --enable-tools \
+ --enable-docs \
+ $(use_enable pam) \
+ $(use_enable api xenapi) \
+ $(use_enable ovmf) \
+ $(use_enable ocaml ocamltools) \
+ --with-xenstored=$(usex ocaml 'oxenstored' 'xenstored') \
+ "
+
+ use system-seabios && myconf+=" --with-system-seabios=/usr/share/seabios/bios.bin"
+ use system-qemu && myconf+=" --with-system-qemu=/usr/bin/qemu-system-x86_64"
+ use amd64 && myconf+=" $(use_enable qemu-traditional)"
+ econf ${myconf}
+}
+
+src_compile() {
+ local myopt
+ use debug && myopt="${myopt} debug=y"
+
+ if test-flag-CC -fno-strict-overflow; then
+ append-flags -fno-strict-overflow
+ fi
+
+ emake CC="$(tc-getCC)" LD="$(tc-getLD)" AR="$(tc-getAR)" RANLIB="$(tc-getRANLIB)" build-tools ${myopt}
+
+ if use doc; then
+ emake -C docs build
+ else
+ emake -C docs man-pages
+ fi
+}
+
+src_install() {
+ # Override auto-detection in the build system, bug #382573
+ export INITD_DIR=/tmp/init.d
+ export CONFIG_LEAF_DIR=../tmp/default
+
+ # Let the build system compile installed Python modules.
+ local PYTHONDONTWRITEBYTECODE
+ export PYTHONDONTWRITEBYTECODE
+
+ emake DESTDIR="${ED}" DOCDIR="/usr/share/doc/${PF}" \
+ XEN_PYTHON_NATIVE_INSTALL=y install-tools
+
+ # Created at runtime
+ rm -rv "${ED%/}/var/run" || die
+
+ # Fix the remaining Python shebangs.
+ python_fix_shebang "${D}"
+
+ # Remove RedHat-specific stuff
+ rm -rf "${D}"tmp || die
+
+ emake DESTDIR="${D}" DOCDIR="/usr/share/doc/${PF}" install-docs
+ use doc && dodoc -r docs/{pdf,txt}
+ dodoc ${DOCS[@]}
+
+ newconfd "${FILESDIR}"/xendomains.confd xendomains
+ newconfd "${FILESDIR}"/xenstored.confd xenstored
+ newconfd "${FILESDIR}"/xenconsoled.confd xenconsoled
+ newinitd "${FILESDIR}"/xendomains.initd-r2 xendomains
+ newinitd "${FILESDIR}"/xenstored.initd-r1 xenstored
+ newinitd "${FILESDIR}"/xenconsoled.initd xenconsoled
+ newinitd "${FILESDIR}"/xencommons.initd xencommons
+ newconfd "${FILESDIR}"/xencommons.confd xencommons
+ newinitd "${FILESDIR}"/xenqemudev.initd xenqemudev
+ newconfd "${FILESDIR}"/xenqemudev.confd xenqemudev
+ newinitd "${FILESDIR}"/xen-watchdog.initd xen-watchdog
+
+ if use screen; then
+ cat "${FILESDIR}"/xendomains-screen.confd >> "${D}"/etc/conf.d/xendomains || die
+ cp "${FILESDIR}"/xen-consoles.logrotate "${D}"/etc/xen/ || die
+ keepdir /var/log/xen-consoles
+ fi
+
+ # For -static-libs wrt Bug 384355
+ if ! use static-libs; then
+ rm -f "${D}"usr/$(get_libdir)/*.a "${D}"usr/$(get_libdir)/ocaml/*/*.a
+ fi
+
+ # for xendomains
+ keepdir /etc/xen/auto
+
+ # Remove files failing QA AFTER emake installs them, avoiding seeking absent files
+ find "${D}" \( -name openbios-sparc32 -o -name openbios-sparc64 \
+ -o -name openbios-ppc -o -name palcode-clipper \) -delete || die
+}
+
+pkg_postinst() {
+ elog "Official Xen Guide and the offical wiki page:"
+ elog "https://wiki.gentoo.org/wiki/Xen"
+ elog "https://wiki.xen.org/wiki/Main_Page"
+ elog ""
+ elog "Recommended to utilise the xencommons script to config sytem At boot"
+ elog "Add by use of rc-update on completion of the install"
+
+ if ! use hvm; then
+ echo
+ elog "HVM (VT-x and AMD-V) support has been disabled. If you need hvm"
+ elog "support enable the hvm use flag."
+ elog "An x86 or amd64 system is required to build HVM support."
+ fi
+
+ if use qemu; then
+ elog "The qemu-bridge-helper is renamed to the xen-bridge-helper in the in source"
+ elog "build of qemu. This allows for app-emulation/qemu to be emerged concurrently"
+ elog "with the qemu capable xen. It is up to the user to distinguish between and utilise"
+ elog "the qemu-bridge-helper and the xen-bridge-helper. File bugs of any issues that arise"
+ fi
+}
diff --git a/app-emulation/xen-tools/xen-tools-4.9.2-r1.ebuild b/app-emulation/xen-tools/xen-tools-4.9.2-r1.ebuild
new file mode 100644
index 000000000000..723cc4fdf1d4
--- /dev/null
+++ b/app-emulation/xen-tools/xen-tools-4.9.2-r1.ebuild
@@ -0,0 +1,454 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PYTHON_COMPAT=( python2_7 )
+PYTHON_REQ_USE='ncurses,xml,threads'
+
+inherit bash-completion-r1 eutils flag-o-matic multilib python-single-r1 toolchain-funcs versionator
+
+MY_PV=${PV/_/-}
+MAJOR_V="$(get_version_component_range 1-2)"
+
+if [[ $PV == *9999 ]]; then
+ inherit git-r3
+ KEYWORDS="amd64"
+ REPO="xen.git"
+ EGIT_REPO_URI="git://xenbits.xen.org/${REPO}"
+ S="${WORKDIR}/${REPO}"
+else
+ KEYWORDS="amd64 ~arm ~arm64 ~x86"
+ UPSTREAM_VER=2
+ SECURITY_VER=
+ # xen-tools's gentoo patches tarball
+ GENTOO_VER=12
+ # xen-tools's gentoo patches version which apply to this specific ebuild
+ GENTOO_GPV=0
+ # xen-tools ovmf's patches
+ OVMF_VER=3
+
+ SEABIOS_VER=1.10.0
+ # OVMF upstream 5920a9d16b1ab887c2858224316a98e961d71b05
+ OVMF_PV=20170321
+
+ [[ -n ${UPSTREAM_VER} ]] && \
+ UPSTREAM_PATCHSET_URI="https://dev.gentoo.org/~dlan/distfiles/${P/-tools/}-upstream-patches-${UPSTREAM_VER}.tar.xz"
+ [[ -n ${SECURITY_VER} ]] && \
+ SECURITY_PATCHSET_URI="https://dev.gentoo.org/~dlan/distfiles/${PN/-tools}-security-patches-${SECURITY_VER}.tar.xz"
+ [[ -n ${GENTOO_VER} ]] && \
+ GENTOO_PATCHSET_URI="https://dev.gentoo.org/~dlan/distfiles/${PN/-tools}-gentoo-patches-${GENTOO_VER}.tar.xz"
+ [[ -n ${OVMF_VER} ]] && \
+ OVMF_PATCHSET_URI="https://dev.gentoo.org/~dlan/distfiles/${PN/-tools}-ovmf-patches-${OVMF_VER}.tar.xz"
+
+ SRC_URI="https://downloads.xenproject.org/release/xen/${MY_PV}/xen-${MY_PV}.tar.gz
+ http://code.coreboot.org/p/seabios/downloads/get/seabios-${SEABIOS_VER}.tar.gz
+ https://dev.gentoo.org/~dlan/distfiles/seabios-${SEABIOS_VER}.tar.gz
+ ovmf? ( https://dev.gentoo.org/~dlan/distfiles/ovmf-${OVMF_PV}.tar.xz
+ ${OVMF_PATCHSET_URI} )
+ ${UPSTREAM_PATCHSET_URI}
+ ${SECURITY_PATCHSET_URI}
+ ${GENTOO_PATCHSET_URI}"
+
+ S="${WORKDIR}/xen-${MY_PV}"
+fi
+
+DESCRIPTION="Xen tools including QEMU and xl"
+HOMEPAGE="https://www.xenproject.org"
+DOCS=( README docs/README.xen-bugtool )
+
+LICENSE="GPL-2"
+SLOT="0/${MAJOR_V}"
+# Inclusion of IUSE ocaml on stabalizing requires maintainer of ocaml to (get off his hands and) make
+# >=dev-lang/ocaml-4 stable
+# Masked in profiles/eapi-5-files instead
+IUSE="api custom-cflags debug doc flask hvm ocaml ovmf +pam pygrub python +qemu +qemu-traditional screen sdl static-libs system-qemu system-seabios"
+
+REQUIRED_USE="
+ ${PYTHON_REQUIRED_USE}
+ pygrub? ( python )
+ ovmf? ( hvm )
+ ^^ ( qemu system-qemu )"
+
+COMMON_DEPEND="
+ sys-apps/pciutils
+ dev-libs/lzo:2
+ dev-libs/glib:2
+ dev-libs/yajl
+ dev-libs/libaio
+ dev-libs/libgcrypt:0
+ sys-libs/zlib
+ ${PYTHON_DEPS}
+"
+
+DEPEND="${COMMON_DEPEND}
+ >=sys-kernel/linux-headers-4.11
+ dev-python/lxml[${PYTHON_USEDEP}]
+ x86? ( sys-devel/dev86
+ sys-power/iasl )
+ pam? ( dev-python/pypam[${PYTHON_USEDEP}] )
+ api? ( dev-libs/libxml2
+ net-misc/curl )
+ ovmf? (
+ !arm? ( !arm64? ( dev-lang/nasm ) )
+ $(python_gen_impl_dep sqlite)
+ )
+ !amd64? ( >=sys-apps/dtc-1.4.0 )
+ amd64? ( sys-devel/bin86
+ system-seabios? ( sys-firmware/seabios )
+ sys-firmware/ipxe
+ sys-devel/dev86
+ sys-power/iasl )
+ dev-lang/perl
+ app-misc/pax-utils
+ doc? (
+ app-text/ghostscript-gpl
+ app-text/pandoc
+ dev-python/markdown[${PYTHON_USEDEP}]
+ dev-texlive/texlive-latexextra
+ media-gfx/transfig
+ )
+ hvm? ( x11-base/xorg-proto
+ !net-libs/libiscsi )
+ qemu? (
+ app-arch/snappy:=
+ x11-libs/pixman
+ sdl? ( media-libs/libsdl[X] )
+ )
+ system-qemu? ( app-emulation/qemu[xen] )
+ ocaml? ( dev-ml/findlib
+ >=dev-lang/ocaml-4 )"
+
+RDEPEND="${COMMON_DEPEND}
+ sys-apps/iproute2[-minimal]
+ net-misc/bridge-utils
+ screen? (
+ app-misc/screen
+ app-admin/logrotate
+ )"
+
+# hvmloader is used to bootstrap a fully virtualized kernel
+# Approved by QA team in bug #144032
+QA_WX_LOAD="
+ usr/libexec/xen/boot/hvmloader
+ usr/share/qemu-xen/qemu/s390-ccw.img
+ usr/share/qemu-xen/qemu/u-boot.e500
+"
+
+QA_PREBUILT="
+ usr/libexec/xen/bin/ivshmem-client
+ usr/libexec/xen/bin/ivshmem-server
+ usr/libexec/xen/bin/qemu-img
+ usr/libexec/xen/bin/qemu-io
+ usr/libexec/xen/bin/qemu-nbd
+ usr/libexec/xen/bin/qemu-system-i386
+ usr/libexec/xen/bin/virtfs-proxy-helper
+ usr/libexec/xen/libexec/xen-bridge-helper
+ usr/share/qemu-xen/qemu/s390-ccw.img
+ usr/share/qemu-xen/qemu/u-boot.e500
+"
+
+RESTRICT="test"
+
+pkg_setup() {
+ python_setup
+ export "CONFIG_LOMOUNT=y"
+
+ #bug 522642, disable compile tools/tests
+ export "CONFIG_TESTS=n"
+
+ if [[ -z ${XEN_TARGET_ARCH} ]] ; then
+ if use x86 && use amd64; then
+ die "Confusion! Both x86 and amd64 are set in your use flags!"
+ elif use x86; then
+ export XEN_TARGET_ARCH="x86_32"
+ elif use amd64 ; then
+ export XEN_TARGET_ARCH="x86_64"
+ elif use arm; then
+ export XEN_TARGET_ARCH="arm32"
+ elif use arm64; then
+ export XEN_TARGET_ARCH="arm64"
+ else
+ die "Unsupported architecture!"
+ fi
+ fi
+}
+
+src_prepare() {
+ local i
+
+ # Upstream's patchset
+ if [[ -n ${UPSTREAM_VER} ]]; then
+ einfo "Try to apply Xen Upstream patch set"
+ eapply "${WORKDIR}"/patches-upstream
+ fi
+
+ # Security patchset
+ if [[ -n ${SECURITY_VER} ]]; then
+ einfo "Try to apply Xen Security patch set"
+ # apply main xen patches
+ # Two parallel systems, both work side by side
+ # Over time they may concdense into one. This will suffice for now
+ EPATCH_SUFFIX="patch"
+ EPATCH_FORCE="yes"
+
+ source "${WORKDIR}"/patches-security/${PV}.conf || die
+
+ for i in ${XEN_SECURITY_MAIN}; do
+ eapply "${WORKDIR}"/patches-security/xen/$i
+ done
+
+ # apply qemu-xen/upstream patches
+ pushd "${S}"/tools/qemu-xen/ > /dev/null
+ for i in ${XEN_SECURITY_QEMUU}; do
+ eapply "${WORKDIR}"/patches-security/qemuu/$i
+ done
+ popd > /dev/null
+
+ # apply qemu-traditional patches
+ pushd "${S}"/tools/qemu-xen-traditional/ > /dev/null
+ for i in ${XEN_SECURITY_QEMUT}; do
+ eapply "${WORKDIR}"/patches-security/qemut/$i
+ done
+ popd > /dev/null
+ fi
+
+ # move before Gentoo patch, one patch should apply to seabios, to fix gcc-4.5.x build err
+ mv ../seabios-${SEABIOS_VER} tools/firmware/seabios-dir-remote || die
+ pushd tools/firmware/ > /dev/null
+ ln -s seabios-dir-remote seabios-dir || die
+ popd > /dev/null
+
+ # Gentoo's patchset
+ if [[ -n ${GENTOO_VER} && -n ${GENTOO_GPV} ]]; then
+ einfo "Try to apply Gentoo specific patch set"
+ source "${FILESDIR}"/gentoo-patches.conf || die
+ _gpv=_gpv_${PN/-/_}_${PV//./}_${GENTOO_GPV}
+ for i in ${!_gpv}; do
+ eapply "${WORKDIR}"/patches-gentoo/$i
+ done
+ fi
+
+ # Ovmf's patchset
+ if use ovmf; then
+ if [[ -n ${OVMF_VER} ]];then
+ einfo "Try to apply Ovmf patch set"
+ pushd "${WORKDIR}"/ovmf-*/ > /dev/null
+ eapply "${WORKDIR}"/patches-ovmf
+ popd > /dev/null
+ fi
+ mv ../ovmf-${OVMF_PV} tools/firmware/ovmf-dir-remote || die
+ fi
+
+ mv tools/qemu-xen/qemu-bridge-helper.c tools/qemu-xen/xen-bridge-helper.c || die
+
+ # Fix texi2html build error with new texi2html, qemu.doc.html
+ sed -i -e "/texi2html -monolithic/s/-number//" tools/qemu-xen-traditional/Makefile || die
+
+ use api || sed -e "/SUBDIRS-\$(LIBXENAPI_BINDINGS) += libxen/d" -i tools/Makefile || die
+ sed -e 's:$(MAKE) PYTHON=$(PYTHON) subdirs-$@:LC_ALL=C "$(MAKE)" PYTHON=$(PYTHON) subdirs-$@:' \
+ -i tools/firmware/Makefile || die
+
+ # Drop .config, fixes to gcc-4.6
+ sed -e '/-include $(XEN_ROOT)\/.config/d' -i Config.mk || die "Couldn't drop"
+
+ # if the user *really* wants to use their own custom-cflags, let them
+ if use custom-cflags; then
+ einfo "User wants their own CFLAGS - removing defaults"
+
+ # try and remove all the default cflags
+ find "${S}" \( -name Makefile -o -name Rules.mk -o -name Config.mk \) \
+ -exec sed \
+ -e 's/CFLAGS\(.*\)=\(.*\)-O3\(.*\)/CFLAGS\1=\2\3/' \
+ -e 's/CFLAGS\(.*\)=\(.*\)-march=i686\(.*\)/CFLAGS\1=\2\3/' \
+ -e 's/CFLAGS\(.*\)=\(.*\)-fomit-frame-pointer\(.*\)/CFLAGS\1=\2\3/' \
+ -e 's/CFLAGS\(.*\)=\(.*\)-g3*\s\(.*\)/CFLAGS\1=\2 \3/' \
+ -e 's/CFLAGS\(.*\)=\(.*\)-O2\(.*\)/CFLAGS\1=\2\3/' \
+ -i {} + || die "failed to re-set custom-cflags"
+ else
+ unset CFLAGS
+ unset LDFLAGS
+ unset ASFLAGS
+ unset CPPFLAGS
+ fi
+
+ if ! use pygrub; then
+ sed -e '/^SUBDIRS-y += pygrub/d' -i tools/Makefile || die
+ fi
+
+ if ! use python; then
+ sed -e '/^SUBDIRS-y += python$/d' -i tools/Makefile || die
+ fi
+
+ if ! use hvm; then
+ sed -e '/SUBDIRS-$(CONFIG_X86) += firmware/d' -i tools/Makefile || die
+ # Bug 351648
+ elif ! use x86 && ! has x86 $(get_all_abis); then
+ mkdir -p "${WORKDIR}"/extra-headers/gnu || die
+ touch "${WORKDIR}"/extra-headers/gnu/stubs-32.h || die
+ export CPATH="${WORKDIR}"/extra-headers
+ fi
+
+ if use qemu; then
+ if use sdl; then
+ sed -i -e "s:\$\$source/configure:\0 --enable-sdl:" \
+ tools/Makefile || die
+ else
+ sed -i -e "s:\${QEMU_ROOT\:\-\.}/configure:\0 --disable-sdl:" \
+ tools/qemu-xen-traditional/xen-setup || die
+ sed -i -e "s:\$\$source/configure:\0 --disable-sdl:" \
+ tools/Makefile || die
+ fi
+ else
+ # Don't bother with qemu, only needed for fully virtualised guests
+ sed -e "s:install-tools\: tools/qemu-xen-traditional-dir:install-tools\: :g" -i Makefile || die
+ fi
+
+ # Reset bash completion dir; Bug 472438
+ sed -e "s:^BASH_COMPLETION_DIR ?= \$(CONFIG_DIR)/bash_completion.d:BASH_COMPLETION_DIR ?= $(get_bashcompdir):" \
+ -i Config.mk || die
+ sed -i -e "/bash-completion/s/xl\.sh/xl/g" tools/libxl/Makefile || die
+
+ # xencommons, Bug #492332, sed lighter weight than patching
+ sed -e 's:\$QEMU_XEN -xen-domid:test -e "\$QEMU_XEN" \&\& &:' \
+ -i tools/hotplug/Linux/init.d/xencommons.in || die
+
+ # fix bashishm
+ sed -e '/Usage/s/\$//g' \
+ -i tools/hotplug/Linux/init.d/xendriverdomain.in || die
+
+ # respect multilib, usr/lib/libcacard.so.0.0.0
+ sed -e "/^libdir=/s/\/lib/\/$(get_libdir)/" \
+ -i tools/qemu-xen/configure || die
+
+ #bug 518136, don't build 32bit exactuable for nomultilib profile
+ if [[ "${ARCH}" == 'amd64' ]] && ! has_multilib_profile; then
+ sed -i -e "/x86_emulator/d" tools/tests/Makefile || die
+ fi
+
+ # uncomment lines in xl.conf
+ sed -e 's:^#autoballoon=:autoballoon=:' \
+ -e 's:^#lockfile=:lockfile=:' \
+ -e 's:^#vif.default.script=:vif.default.script=:' \
+ -i tools/examples/xl.conf || die
+
+ default
+}
+
+src_configure() {
+ local myconf="--prefix=${PREFIX}/usr \
+ --libdir=${PREFIX}/usr/$(get_libdir) \
+ --libexecdir=${PREFIX}/usr/libexec \
+ --localstatedir=${EPREFIX}/var \
+ --disable-werror \
+ --disable-xen \
+ --enable-tools \
+ --enable-docs \
+ $(use_enable pam) \
+ $(use_enable api xenapi) \
+ $(use_enable ovmf) \
+ $(use_enable ocaml ocamltools) \
+ --with-xenstored=$(usex ocaml 'oxenstored' 'xenstored') \
+ "
+
+ use system-seabios && myconf+=" --with-system-seabios=/usr/share/seabios/bios.bin"
+ use system-qemu && myconf+=" --with-system-qemu=/usr/bin/qemu-system-x86_64"
+ use amd64 && myconf+=" $(use_enable qemu-traditional)"
+ econf ${myconf}
+}
+
+src_compile() {
+ local myopt
+ use debug && myopt="${myopt} debug=y"
+
+ if test-flag-CC -fno-strict-overflow; then
+ append-flags -fno-strict-overflow
+ fi
+
+ emake CC="$(tc-getCC)" LD="$(tc-getLD)" AR="$(tc-getAR)" RANLIB="$(tc-getRANLIB)" build-tools ${myopt}
+
+ if use doc; then
+ emake -C docs build
+ else
+ emake -C docs man-pages
+ fi
+}
+
+src_install() {
+ # Override auto-detection in the build system, bug #382573
+ export INITD_DIR=/tmp/init.d
+ export CONFIG_LEAF_DIR=../tmp/default
+
+ # Let the build system compile installed Python modules.
+ local PYTHONDONTWRITEBYTECODE
+ export PYTHONDONTWRITEBYTECODE
+
+ emake DESTDIR="${ED}" DOCDIR="/usr/share/doc/${PF}" \
+ XEN_PYTHON_NATIVE_INSTALL=y install-tools
+
+ # Created at runtime
+ rm -rv "${ED%/}/var/run" || die
+
+ # Fix the remaining Python shebangs.
+ python_fix_shebang "${D}"
+
+ # Remove RedHat-specific stuff
+ rm -rf "${D}"tmp || die
+
+ emake DESTDIR="${D}" DOCDIR="/usr/share/doc/${PF}" install-docs
+ use doc && dodoc -r docs/{pdf,txt}
+ dodoc ${DOCS[@]}
+
+ newconfd "${FILESDIR}"/xendomains.confd xendomains
+ newconfd "${FILESDIR}"/xenstored.confd xenstored
+ newconfd "${FILESDIR}"/xenconsoled.confd xenconsoled
+ newinitd "${FILESDIR}"/xendomains.initd-r2 xendomains
+ newinitd "${FILESDIR}"/xenstored.initd-r1 xenstored
+ newinitd "${FILESDIR}"/xenconsoled.initd xenconsoled
+ newinitd "${FILESDIR}"/xencommons.initd xencommons
+ newconfd "${FILESDIR}"/xencommons.confd xencommons
+ newinitd "${FILESDIR}"/xenqemudev.initd xenqemudev
+ newconfd "${FILESDIR}"/xenqemudev.confd xenqemudev
+ newinitd "${FILESDIR}"/xen-watchdog.initd xen-watchdog
+
+ if use screen; then
+ cat "${FILESDIR}"/xendomains-screen.confd >> "${D}"/etc/conf.d/xendomains || die
+ cp "${FILESDIR}"/xen-consoles.logrotate "${D}"/etc/xen/ || die
+ keepdir /var/log/xen-consoles
+ fi
+
+ # For -static-libs wrt Bug 384355
+ if ! use static-libs; then
+ rm -f "${D}"usr/$(get_libdir)/*.a "${D}"usr/$(get_libdir)/ocaml/*/*.a
+ fi
+
+ # for xendomains
+ keepdir /etc/xen/auto
+
+ # Remove files failing QA AFTER emake installs them, avoiding seeking absent files
+ find "${D}" \( -name openbios-sparc32 -o -name openbios-sparc64 \
+ -o -name openbios-ppc -o -name palcode-clipper \) -delete || die
+}
+
+pkg_postinst() {
+ elog "Official Xen Guide and the offical wiki page:"
+ elog "https://wiki.gentoo.org/wiki/Xen"
+ elog "https://wiki.xen.org/wiki/Main_Page"
+ elog ""
+ elog "Recommended to utilise the xencommons script to config sytem At boot"
+ elog "Add by use of rc-update on completion of the install"
+
+ if ! use hvm; then
+ echo
+ elog "HVM (VT-x and AMD-V) support has been disabled. If you need hvm"
+ elog "support enable the hvm use flag."
+ elog "An x86 or amd64 system is required to build HVM support."
+ fi
+
+ if use qemu; then
+ elog "The qemu-bridge-helper is renamed to the xen-bridge-helper in the in source"
+ elog "build of qemu. This allows for app-emulation/qemu to be emerged concurrently"
+ elog "with the qemu capable xen. It is up to the user to distinguish between and utilise"
+ elog "the qemu-bridge-helper and the xen-bridge-helper. File bugs of any issues that arise"
+ fi
+}