From dfc8a8e99e1ec1bc8b09d23c57786aef4a242ca4 Mon Sep 17 00:00:00 2001 From: Laszlo Valko Date: Fri, 31 Dec 2021 15:05:04 +0100 Subject: [PATCH] Added xen-tools-4.14.3. --- app-emulation/xen-tools/Manifest | 26 + .../xen-tools/files/gentoo-patches.conf | 120 ++++ app-emulation/xen-tools/files/stubs-32.h | 20 + .../xen-tools/files/xen-consoles.logrotate | 5 + .../files/xen-tools-4.14.3-brotli.patch | 62 ++ .../xen-tools/files/xen-watchdog.initd | 6 + .../xen-tools/files/xencommons.confd | 4 + .../xen-tools/files/xencommons.initd | 79 +++ .../xen-tools/files/xenconsoled.confd | 2 + .../xen-tools/files/xenconsoled.initd | 33 ++ .../xen-tools/files/xendomains-screen.confd | 25 + .../xen-tools/files/xendomains.confd | 9 + .../xen-tools/files/xendomains.initd-r2 | 117 ++++ .../xen-tools/files/xenqemudev.confd | 7 + .../xen-tools/files/xenqemudev.initd | 84 +++ app-emulation/xen-tools/files/xenstored.confd | 2 + .../xen-tools/files/xenstored.initd-r1 | 42 ++ app-emulation/xen-tools/metadata.xml | 30 + .../xen-tools/xen-tools-4.14.3.ebuild | 534 ++++++++++++++++++ 19 files changed, 1207 insertions(+) create mode 100644 app-emulation/xen-tools/Manifest create mode 100644 app-emulation/xen-tools/files/gentoo-patches.conf create mode 100644 app-emulation/xen-tools/files/stubs-32.h create mode 100644 app-emulation/xen-tools/files/xen-consoles.logrotate create mode 100644 app-emulation/xen-tools/files/xen-tools-4.14.3-brotli.patch create mode 100644 app-emulation/xen-tools/files/xen-watchdog.initd create mode 100644 app-emulation/xen-tools/files/xencommons.confd create mode 100644 app-emulation/xen-tools/files/xencommons.initd create mode 100644 app-emulation/xen-tools/files/xenconsoled.confd create mode 100644 app-emulation/xen-tools/files/xenconsoled.initd create mode 100644 app-emulation/xen-tools/files/xendomains-screen.confd create mode 100644 app-emulation/xen-tools/files/xendomains.confd create mode 100644 app-emulation/xen-tools/files/xendomains.initd-r2 create mode 100644 app-emulation/xen-tools/files/xenqemudev.confd create mode 100644 app-emulation/xen-tools/files/xenqemudev.initd create mode 100644 app-emulation/xen-tools/files/xenstored.confd create mode 100644 app-emulation/xen-tools/files/xenstored.initd-r1 create mode 100644 app-emulation/xen-tools/metadata.xml create mode 100644 app-emulation/xen-tools/xen-tools-4.14.3.ebuild diff --git a/app-emulation/xen-tools/Manifest b/app-emulation/xen-tools/Manifest new file mode 100644 index 0000000..b847340 --- /dev/null +++ b/app-emulation/xen-tools/Manifest @@ -0,0 +1,26 @@ +AUX gentoo-patches.conf 3599 BLAKE2B bde110cce9707136b4c0ab4ffa51115a01557945b37d943115460b243aa6b9627411ea8498fec71479b8aaa12e0d6a830b097ed3b5a2275b9e581e7022ecd878 SHA512 d06853b6bd602e7e313e2433526898b316c7d138e81fb9bbbf175e275b59114e544305fec130d462fb99288a5b998eb6ed376830786e6b807743566982b47839 +AUX stubs-32.h 537 BLAKE2B 456f57c4a4ba574c737f1b84b62a085d0290ebc8981a5f96fdebc16b6c86c801c5ca8dde135e803f46c5ec875fdd74770f6ed754880bc7af930b8ce1ce972fb7 SHA512 55308dbedaa91909a2213940f7a7b574cabe6b5a3104761a2a6f28d6aed00164544488c00cbf9d66a9a370a14c6b6d3a00434efd3ff0228cc8e4d81af19c0e68 +AUX xen-consoles.logrotate 63 BLAKE2B 4ae650876035d2815dbcacc6ed618c58cc61d9cfd9cde1b6c2f792cbf51898c577ef979443ad827fc82ced4d21ae24836883160b20d697965ef5377d50c2973c SHA512 ab2105c75cfe01768aecd5bcbb56269d63666e8a44e42b6a83aee87df6c84ee2f9ab249171c21b2e09f8fec2cae8318f6e87d160989398a3e7dd68db8d52c426 +AUX xen-tools-4.14.3-brotli.patch 3956 BLAKE2B d7ed1d251720d45f5125fb4cf3a618b6e2877d8fc46b972649d9b647eb899058c4334f211837f946c6fb6641747a8eeb2a9bff550483d226d09b655e2bbb4c69 SHA512 ad320e1e69b2e715e610447efbc88b1a7c8848bd472b3798dd793f5408a9a439aa11129a3ebe14c72b7187e961d76d02200de1032d40039b44c7cbd7976b2426 +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-r1 916 BLAKE2B 5acda60c3d1c8aaf91d14d980a0b68f3d5ff803b617431c87f46b5c2c6f4c87548fa8db32ebd554e8aad4928d7ec0b16598bf8dfb0aa7e3642caa96eb164a292 SHA512 1404c9c454f5359389a2e9588317f10412dafdbdeb1de5da945c10f8e6efd09007e96d35b75d04a4c3d5c59baa9c3bbee4192240cacee128b0adf9066d3efc10 +DIST OpenSSL_1_1_1g.tar.gz 9975550 BLAKE2B 22efa4ffe5d56a861bc4e2e1bc9a558e79265a3789acd9ca65d0a1162a1808a089a92a234e88c951f2a3cdabd3b1908ac7fe6d5f2b5fe554f229a22c11ab185b SHA512 bc8d24d7fc93542a8d77e13a57768de242ef679ef4db93c1b6b981a15a60646a5c5d869d066248448f3eb1ab2012e3ddc80bf301f486c0574d469a3f7db7b8d4 +DIST berkeley-softfloat-b64af41c3276f97f0e181920400ee056b9c88037.tar.gz 148741 BLAKE2B 72014022926b636147e202d74c42df2ce9cfed00b91c275d5b2e0afbc5c68765445cbe7ac6389d7c2512bd1d45b0e16e999936552d09bbc733ab66c92968bd31 SHA512 8420c29faa7ff57e06d6758b03e81ca0630c59946bc031e8611f1449e23634cf901b502161f2c1423c0cff949b5481445e36a3aa53dc885b61ca2c673b3ba567 +DIST brotli-666c3280cc11dc433c303d79a83d4ffbdd12cc8d.tar.gz 23855739 BLAKE2B 7406ec5b29ac66afbcd7c1376bb3208f298d19b6592b2869c52173aa64947d58bd443f9a61c67deaf046be910a0e31c0b843e5508e97e0e1f5e7bce100d86904 SHA512 df8e90562c4fd7f0e787949df6bc4f5a165b39bd333f442d27874fe65640fbba268f9350d7113e6761a5acceb66d78e75f1a296e5a89b94574edf28109cdc812 +DIST edk2-06dc822d045c2bb42e497487935485302486e151.tar.gz 13192042 BLAKE2B 81afa7fd5f6f14fff35baa3c6c64583fa21c7b793ed847a3362fd05a926bb4402db911f9f78f4ffd76a6de9b815171dfa245ae41afac3b022cd108597e8c1ac3 SHA512 a032a1496db7ddc32a7d6d1a7d5fe4122ab43b13547ec019855166d785f162268ad82ceb3c41efafe1687e73fc72599ee6852741652451e1cb329fd655c69b6c +DIST ipxe-git-988d2c13cdf0f0b4140685af35ced70ac5b3283c.tar.gz 3931642 BLAKE2B bf0b5d9ea1d44803bc5c4aa0bf9188636e292b226ab759f32e3c2bfa3f80dd3f546526b9a11c1f67193793ede5309bfa67bdce80aba62ccca54597dc6e7e4ba4 SHA512 0a63f83c9135d05c6bfe7c4d12da3ff76271e35305a4d5654bd5aefa9ee59f5363546c65820c42133deb0fb5a0a0bcaa9b1c48396f9f996acea0d492a5f03f33 +DIST seabios-1.14.0.tar.gz 628985 BLAKE2B cc1126925dab1551a655680d20d06ebf28c12c386500d1ee4df9e1a99403b4c5bc6a66c2cc5ef58b4c3d6d7226f35007506a6a1855c2cf2742469dcb7aba05bb SHA512 215c42f59425f8abd062be7b11fc0e39c977cee5001a2381551b0f851ac337d0dd53c065267e6dee0e710ffd700fa635f9007b89da8dfce0f47122c984ee8146 +DIST xen-4.14.3.tar.gz 39982036 BLAKE2B 927fd2937f451567238702430cea3a6e5d2db70d5eef10f029bb1d6d030681573c851eb8076c8bad89c97c115f81a19ac8e46e78ca3f0e642565f7300c264ca1 SHA512 b462fcc1549f6e57f7f2a4fd10ce1e957a25a6a7c0319672b62699468f6c4330b9cd0cf2b0231b5cce94f4bb142a957eb8aa58aa0ffb5c85b37211d6b34ccf16 +DIST xen-gentoo-patches-23.tar.xz 20536 BLAKE2B 0064f79f8794a21ab13047a4ee296e37efa616e16ca6cd65b31fdafeb458fd9b80f0443758343c8328b1901d7169618346becfe75f16dcaeff08fc975f1d08d5 SHA512 09248e17ff7865feb2a505169d62ee5c8c60bd672fa8c4c7c4e3a2e4af58bfad0379d37b395bab3e3393af8d53d882f56749dfeb560edeea6b7ab56c902a3c49 +EBUILD xen-tools-4.14.3.ebuild 17138 BLAKE2B db6e9c9a9665fc26b9db3aa1973ae74d33619398aaddde7c483fe3238f451742b9205421aa89fcd074865392394814021aed3ba7b87c17df4c6188bbf5fa6544 SHA512 c403226563fbd2886e15a03d77827f544ba3f93fe37d2442841f464eba3a9cd922c32e0537d40b5c94faa6c63825f402d581b1d8aa5b3c46ce9acb73021d2ef9 +MISC metadata.xml 1562 BLAKE2B a619e34e6fec4c6ffc00fd098dc040c5bb464ed7f2032db2e933fada0614e82c21269175f37720a123404551474e2aeeb2728b405ff93f9b4d9d092d027e0839 SHA512 f45c793a4b4819f0e50501ddc85acdaf99e4d675530712f8dccfb5166d071ae8ed07917a61d56037d6ba3a54123f72f4512d8c11643ea8c6e507feb9d29594e7 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 0000000..fc52db6 --- /dev/null +++ b/app-emulation/xen-tools/files/gentoo-patches.conf @@ -0,0 +1,120 @@ +# Bug 496708 +_gx045=" xen-tools-4.10.1-unbundle-ipxe.patch" +_gx054=" xen-tools-4.12.0-unbundle-ipxe.patch" + +# Bug 379537 +_gx017=" fix-gold-ld.patch" + +# Bug 477676 +_gx038=" xen-tools-4.8-ar-cc.patch" +_gx039=" xen-tools-4.14-ar-cc.patch" + +# Prevent file collision with qemu package Bug 478064 +_gx043=" xen-4.10-qemu-bridge.patch" +_gx051=" xen-4.12-qemu-bridge.patch" +_gx052=" xen-tools-4.14-qemu-bridge.patch" +#mv tools/qemu-xen/qemu-bridge-helper.c tools/qemu-xen/xen-bridge-helper.c || die + +# 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" + +# 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 missing makedev(), major(), minor() +_gx042=" xen-tools-4.8.2-makedev.patch" + +# Disable failing shim +_gx046=" xen-tools-4.10.1-shim.patch" +_gx050=" xen-tools-4.12.0-shim.patch" + +# Fix building with gcc 8, bug #657388 +_gx048=" xen-tools-4.11.1-gcc8.patch" +_gx053=" xen-tools-4.12.0-gcc8.patch" + +# Fix building with gcc 9, bug #689082 +_gx055=" xen-tools-4.11.2-gcc9.patch" + +# Fix pdf document generation, bug #650396 +_gx049=" xen-tools-4.10.1-pdfdoc.patch" + +# Add xenstat python-binding, Gento Bug #711066 +_gx056=" xen-tools-4.12.2-libxenstat-makefile.patch" + +# Fix building with gcc 10, bug #722930 +_gx060=" xen-tools-4.13.0-gcc10.patch" + +# xen-tools-4.14.2 patches set +_gpv_xen_tools_4142_0=" + xen-tools-4.12.0-gcc8.patch + xen-tools-4.12.0-shim.patch + xen-tools-4.12.0-unbundle-ipxe.patch + xen-tools-4.12.2-libxenstat-makefile.patch + xen-tools-4.14-ar-cc.patch + xen-tools-4.14-qemu-bridge.patch + xen-tools-4.15.0-disable-werror.patch + xen-tools-4.15.0-gcc11.patch + xen-tools-4.4.1-tinfo.patch + xen-tools-4.6-increase-stack-size.patch + xen-tools-4-anti-ovmf-download.patch + xen-tools-4-qemu-fix-po-collision.patch +" + +# xen-tools-4.14.3 patches set +_gpv_xen_tools_4143_0=" + xen-tools-4.12.0-gcc8.patch + xen-tools-4.12.0-shim.patch + xen-tools-4.12.0-unbundle-ipxe.patch + xen-tools-4.12.2-libxenstat-makefile.patch + xen-tools-4.14-ar-cc.patch + xen-tools-4.14-qemu-bridge.patch + xen-tools-4.15.0-disable-werror.patch + xen-tools-4.4.1-tinfo.patch + xen-tools-4.6-increase-stack-size.patch + xen-tools-4-anti-ovmf-download.patch + xen-tools-4-qemu-fix-po-collision.patch +" + +# xen-tools-4.15.0 patches set +_gpv_xen_tools_4150_0=" + xen-tools-4.14-ar-cc.patch + xen-tools-4.15.0-disable-werror.patch + xen-tools-4.15.0-gcc11.patch + xen-tools-4.15.0-libxenstat-makefile.patch + xen-tools-4.15.0-no-ld-no-pie.patch + xen-tools-4.15.0-qemu-bridge.patch + xen-tools-4.15.0-unbundle-ipxe.patch + xen-tools-4.4.1-tinfo.patch + xen-tools-4-anti-ovmf-download.patch + xen-tools-4-qemu-fix-po-collision.patch +" + +# xen-tools-4.15.1 patches set +_gpv_xen_tools_4151_0=" + xen-tools-4.14-ar-cc.patch + xen-tools-4.15.0-disable-werror.patch + xen-tools-4.15.0-libxenstat-makefile.patch + xen-tools-4.15.0-qemu-bridge.patch + xen-tools-4.15.0-unbundle-ipxe.patch + xen-tools-4.4.1-tinfo.patch + xen-tools-4-anti-ovmf-download.patch + xen-tools-4-qemu-fix-po-collision.patch +" + +# xen-tools-4.16.0 patches set +_gpv_xen_tools_4160_0=" + xen-tools-4.14-ar-cc.patch + xen-tools-4.15.0-disable-werror.patch + xen-tools-4.15.0-unbundle-ipxe.patch + xen-tools-4.16.0-qemu-bridge.patch + xen-tools-4.16.0-xenstat.patch + xen-tools-4.4.1-tinfo.patch + xen-tools-4-anti-ovmf-download.patch +" 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 0000000..a421528 --- /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 0000000..c644523 --- /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-tools-4.14.3-brotli.patch b/app-emulation/xen-tools/files/xen-tools-4.14.3-brotli.patch new file mode 100644 index 0000000..4dd394d --- /dev/null +++ b/app-emulation/xen-tools/files/xen-tools-4.14.3-brotli.patch @@ -0,0 +1,62 @@ +diff -Naur xen-4.14.3.orig/tools/firmware/ovmf-dir-remote/BaseTools/Source/C/BrotliCompress/brotli/c/dec/decode.c xen-4.14.3/tools/firmware/ovmf-dir-remote/BaseTools/Source/C/BrotliCompress/brotli/c/dec/decode.c +--- xen-4.14.3.orig/tools/firmware/ovmf-dir-remote/BaseTools/Source/C/BrotliCompress/brotli/c/dec/decode.c 2021-12-31 14:45:31.309585049 +0100 ++++ xen-4.14.3/tools/firmware/ovmf-dir-remote/BaseTools/Source/C/BrotliCompress/brotli/c/dec/decode.c 2021-12-31 14:47:10.678532132 +0100 +@@ -2030,8 +2030,10 @@ + } + + BrotliDecoderResult BrotliDecoderDecompress( +- size_t encoded_size, const uint8_t* encoded_buffer, size_t* decoded_size, +- uint8_t* decoded_buffer) { ++ size_t encoded_size, ++ const uint8_t encoded_buffer[BROTLI_ARRAY_PARAM(encoded_size)], ++ size_t* decoded_size, ++ uint8_t decoded_buffer[BROTLI_ARRAY_PARAM(*decoded_size)]) { + BrotliDecoderState s; + BrotliDecoderResult result; + size_t total_out = 0; +diff -Naur xen-4.14.3.orig/tools/firmware/ovmf-dir-remote/BaseTools/Source/C/BrotliCompress/brotli/c/enc/encode.c xen-4.14.3/tools/firmware/ovmf-dir-remote/BaseTools/Source/C/BrotliCompress/brotli/c/enc/encode.c +--- xen-4.14.3.orig/tools/firmware/ovmf-dir-remote/BaseTools/Source/C/BrotliCompress/brotli/c/enc/encode.c 2021-12-31 14:45:31.309585049 +0100 ++++ xen-4.14.3/tools/firmware/ovmf-dir-remote/BaseTools/Source/C/BrotliCompress/brotli/c/enc/encode.c 2021-12-31 14:47:10.678532132 +0100 +@@ -1470,8 +1470,9 @@ + + BROTLI_BOOL BrotliEncoderCompress( + int quality, int lgwin, BrotliEncoderMode mode, size_t input_size, +- const uint8_t* input_buffer, size_t* encoded_size, +- uint8_t* encoded_buffer) { ++ const uint8_t input_buffer[BROTLI_ARRAY_PARAM(input_size)], ++ size_t* encoded_size, ++ uint8_t encoded_buffer[BROTLI_ARRAY_PARAM(*encoded_size)]) { + BrotliEncoderState* s; + size_t out_size = *encoded_size; + const uint8_t* input_start = input_buffer; +diff -Naur xen-4.14.3.orig/tools/firmware/ovmf-dir-remote/MdeModulePkg/Library/BrotliCustomDecompressLib/brotli/c/dec/decode.c xen-4.14.3/tools/firmware/ovmf-dir-remote/MdeModulePkg/Library/BrotliCustomDecompressLib/brotli/c/dec/decode.c +--- xen-4.14.3.orig/tools/firmware/ovmf-dir-remote/MdeModulePkg/Library/BrotliCustomDecompressLib/brotli/c/dec/decode.c 2021-12-31 14:45:09.670249908 +0100 ++++ xen-4.14.3/tools/firmware/ovmf-dir-remote/MdeModulePkg/Library/BrotliCustomDecompressLib/brotli/c/dec/decode.c 2021-12-31 14:46:51.199130581 +0100 +@@ -2030,8 +2030,10 @@ + } + + BrotliDecoderResult BrotliDecoderDecompress( +- size_t encoded_size, const uint8_t* encoded_buffer, size_t* decoded_size, +- uint8_t* decoded_buffer) { ++ size_t encoded_size, ++ const uint8_t encoded_buffer[BROTLI_ARRAY_PARAM(encoded_size)], ++ size_t* decoded_size, ++ uint8_t decoded_buffer[BROTLI_ARRAY_PARAM(*decoded_size)]) { + BrotliDecoderState s; + BrotliDecoderResult result; + size_t total_out = 0; +diff -Naur xen-4.14.3.orig/tools/firmware/ovmf-dir-remote/MdeModulePkg/Library/BrotliCustomDecompressLib/brotli/c/enc/encode.c xen-4.14.3/tools/firmware/ovmf-dir-remote/MdeModulePkg/Library/BrotliCustomDecompressLib/brotli/c/enc/encode.c +--- xen-4.14.3.orig/tools/firmware/ovmf-dir-remote/MdeModulePkg/Library/BrotliCustomDecompressLib/brotli/c/enc/encode.c 2021-12-31 14:45:09.670249908 +0100 ++++ xen-4.14.3/tools/firmware/ovmf-dir-remote/MdeModulePkg/Library/BrotliCustomDecompressLib/brotli/c/enc/encode.c 2021-12-31 14:46:51.199130581 +0100 +@@ -1470,8 +1470,9 @@ + + BROTLI_BOOL BrotliEncoderCompress( + int quality, int lgwin, BrotliEncoderMode mode, size_t input_size, +- const uint8_t* input_buffer, size_t* encoded_size, +- uint8_t* encoded_buffer) { ++ const uint8_t input_buffer[BROTLI_ARRAY_PARAM(input_size)], ++ size_t* encoded_size, ++ uint8_t encoded_buffer[BROTLI_ARRAY_PARAM(*encoded_size)]) { + BrotliEncoderState* s; + size_t out_size = *encoded_size; + const uint8_t* input_start = input_buffer; 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 0000000..6fbc54d --- /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 0000000..b9e2248 --- /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 0000000..a7c1efe --- /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 0000000..b2e194b --- /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 0000000..094871c --- /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 0000000..e75e19d --- /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 0000000..90c1f52 --- /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 0000000..0926498 --- /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 0000000..5b49520 --- /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 0000000..9dcbb3f --- /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 0000000..31b9293 --- /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-r1 b/app-emulation/xen-tools/files/xenstored.initd-r1 new file mode 100644 index 0000000..88d3ad7 --- /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 0000000..fb98e4a --- /dev/null +++ b/app-emulation/xen-tools/metadata.xml @@ -0,0 +1,30 @@ + + + + + hydrapolic@gmail.com + Tomáš Mózes + + + proxy-maint@gentoo.org + Proxy Maintainers + + + xen@gentoo.org + Gentoo Xen Project + + + Build the C libxenapi bindings + Enable support for hardware based virtualization (VT-x,AMD-v) + Enable ipxe support + Enable support to boot UEFI guest vm, needed by hvm + Install the pygrub boot loader + Enable IOEMU support via the use of qemu-dm + Build the old qemu traditional device model (useful only if you cannot change to the new device model e.g. Windows VMs) + Enable rombios support, needed by ipxe + Enable support for running domain U console in an app-misc/screen session + Using sys-firmware/ipxe instead of the bundled one + Using app-emulation/qemu instead of the bundled one + Using sys-firmware/seabios instead of the bundled one + + diff --git a/app-emulation/xen-tools/xen-tools-4.14.3.ebuild b/app-emulation/xen-tools/xen-tools-4.14.3.ebuild new file mode 100644 index 0000000..da0169a --- /dev/null +++ b/app-emulation/xen-tools/xen-tools-4.14.3.ebuild @@ -0,0 +1,534 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +PYTHON_COMPAT=( python3_{8..9} ) +PYTHON_REQ_USE='ncurses,xml,threads(+)' + +inherit bash-completion-r1 flag-o-matic multilib python-single-r1 toolchain-funcs + +MY_PV=${PV/_/-} + +if [[ ${PV} == *9999 ]]; then + inherit git-r3 + REPO="xen.git" + EGIT_REPO_URI="git://xenbits.xen.org/${REPO}" + S="${WORKDIR}/${REPO}" +else + KEYWORDS="amd64 ~arm ~arm64 x86" + UPSTREAM_VER= + SECURITY_VER= + # xen-tools's gentoo patches tarball + GENTOO_VER=23 + # xen-tools's gentoo patches version which apply to this specific ebuild + GENTOO_GPV=0 + # xen-tools ovmf's patches + OVMF_VER= + + SEABIOS_VER="1.14.0" + EDK2_COMMIT="06dc822d045c2bb42e497487935485302486e151" + EDK2_OPENSSL_VERSION="1_1_1g" + EDK2_SOFTFLOAT_COMMIT="b64af41c3276f97f0e181920400ee056b9c88037" + EDK2_BROTLI_COMMIT="666c3280cc11dc433c303d79a83d4ffbdd12cc8d" + IPXE_COMMIT="988d2c13cdf0f0b4140685af35ced70ac5b3283c" + + [[ -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 + https://github.com/hydrapolic/gentoo-dist/raw/master/xen/${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 + https://www.seabios.org/downloads/seabios-${SEABIOS_VER}.tar.gz + ipxe? ( http://xenbits.xen.org/xen-extfiles/ipxe-git-${IPXE_COMMIT}.tar.gz ) + ovmf? ( https://github.com/tianocore/edk2/archive/${EDK2_COMMIT}.tar.gz -> edk2-${EDK2_COMMIT}.tar.gz + https://github.com/openssl/openssl/archive/OpenSSL_${EDK2_OPENSSL_VERSION}.tar.gz + https://github.com/ucb-bar/berkeley-softfloat-3/archive/${EDK2_SOFTFLOAT_COMMIT}.tar.gz -> berkeley-softfloat-${EDK2_SOFTFLOAT_COMMIT}.tar.gz + https://github.com/google/brotli/archive/${EDK2_BROTLI_COMMIT}.tar.gz -> brotli-${EDK2_BROTLI_COMMIT}.tar.gz + ${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 ) + +LICENSE="GPL-2" +SLOT="0/$(ver_cut 1-2)" +# 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 debug doc +hvm +ipxe ocaml ovmf +pam pygrub python +qemu +qemu-traditional +rombios screen selinux sdl static-libs system-ipxe system-qemu system-seabios" + +REQUIRED_USE=" + ${PYTHON_REQUIRED_USE} + ipxe? ( rombios ) + ovmf? ( hvm ) + pygrub? ( python ) + rombios? ( hvm ) + system-ipxe? ( rombios ) + ?? ( ipxe system-ipxe ) + ?? ( 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} +" + +RDEPEND="${COMMON_DEPEND} + sys-apps/iproute2[-minimal] + net-misc/bridge-utils + screen? ( + app-misc/screen + app-admin/logrotate + ) + selinux? ( sec-policy/selinux-xen )" + +DEPEND="${COMMON_DEPEND} + app-misc/pax-utils + >=sys-kernel/linux-headers-4.11 + x11-libs/pixman + $(python_gen_cond_dep ' + dev-python/lxml[${PYTHON_USEDEP}] + pam? ( dev-python/pypam[${PYTHON_USEDEP}] ) + ') + x86? ( sys-devel/dev86 + system-ipxe? ( sys-firmware/ipxe[qemu] ) + sys-power/iasl ) + 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-power/iasl + system-seabios? ( sys-firmware/seabios ) + system-ipxe? ( sys-firmware/ipxe[qemu] ) + rombios? ( sys-devel/bin86 sys-devel/dev86 ) ) + doc? ( + app-text/ghostscript-gpl + app-text/pandoc + $(python_gen_cond_dep ' + dev-python/markdown[${PYTHON_USEDEP}] + ') + dev-texlive/texlive-latexextra + media-gfx/transfig + ) + hvm? ( x11-base/xorg-proto ) + qemu? ( + app-arch/snappy:= + sdl? ( + media-libs/libsdl[X] + media-libs/libsdl2[X] + ) + ) + system-qemu? ( app-emulation/qemu[xen] ) + ocaml? ( dev-ml/findlib + dev-lang/ocaml[ocamlopt] ) + python? ( >=dev-lang/swig-4.0.0 )" + +BDEPEND="dev-lang/perl + sys-devel/bison + sys-devel/gettext" + +# 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/hppa-firmware.img + usr/share/qemu-xen/qemu/s390-ccw.img + usr/share/qemu-xen/qemu/u-boot.e500 +" + +QA_PREBUILT=" + usr/libexec/xen/bin/elf2dmp + usr/libexec/xen/bin/ivshmem-client + usr/libexec/xen/bin/ivshmem-server + usr/libexec/xen/bin/qemu-edid + usr/libexec/xen/bin/qemu-img + usr/libexec/xen/bin/qemu-io + usr/libexec/xen/bin/qemu-keymap + usr/libexec/xen/bin/qemu-nbd + usr/libexec/xen/bin/qemu-pr-helper + 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/s390-netboot.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}"/edk2-*/ > /dev/null + eapply "${WORKDIR}"/patches-ovmf + popd > /dev/null + fi + mv ../edk2-${EDK2_COMMIT} tools/firmware/ovmf-dir-remote || die + rm -r tools/firmware/ovmf-dir-remote/CryptoPkg/Library/OpensslLib/openssl || die + rm -r tools/firmware/ovmf-dir-remote/ArmPkg/Library/ArmSoftFloatLib/berkeley-softfloat-3 || die + rm -r tools/firmware/ovmf-dir-remote/BaseTools/Source/C/BrotliCompress/brotli || die + rm -r tools/firmware/ovmf-dir-remote/MdeModulePkg/Library/BrotliCustomDecompressLib/brotli || die + mv ../openssl-OpenSSL_${EDK2_OPENSSL_VERSION} tools/firmware/ovmf-dir-remote/CryptoPkg/Library/OpensslLib/openssl || die + mv ../berkeley-softfloat-3-${EDK2_SOFTFLOAT_COMMIT} tools/firmware/ovmf-dir-remote/ArmPkg/Library/ArmSoftFloatLib/berkeley-softfloat-3 || die + cp -r ../brotli-${EDK2_BROTLI_COMMIT} tools/firmware/ovmf-dir-remote/BaseTools/Source/C/BrotliCompress/brotli || die + cp -r ../brotli-${EDK2_BROTLI_COMMIT} tools/firmware/ovmf-dir-remote/MdeModulePkg/Library/BrotliCustomDecompressLib/brotli || die + cp tools/firmware/ovmf-makefile tools/firmware/ovmf-dir-remote/Makefile || die + eapply "${FILESDIR}"/xen-tools-4.14.3-brotli.patch + fi + + # ipxe + if use ipxe; then + cp "${DISTDIR}/ipxe-git-${IPXE_COMMIT}.tar.gz" tools/firmware/etherboot/_ipxe.tar.gz || die + + # gcc 11 + cp "${WORKDIR}/patches-gentoo/${PN}-4.15.0-ipxe-gcc11.patch" tools/firmware/etherboot/patches/ipxe-gcc11.patch || die + echo ipxe-gcc11.patch >> tools/firmware/etherboot/patches/series || 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" + + # drop flags + unset CFLAGS + unset LDFLAGS + unset ASFLAGS + unset CPPFLAGS + + 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 -i '/SUBDIRS-$(CONFIG_QEMU_XEN)/s/^/#/g' tools/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 + + # disable capstone (Bug #673474) + sed -e "s:\$\$source/configure:\0 --disable-capstone:" \ + -i tools/Makefile || die + + # disable glusterfs + sed -e "s:\$\$source/configure:\0 --disable-glusterfs:" \ + -i tools/Makefile || die + + # disable jpeg automagic + sed -e "s:\$\$source/configure:\0 --disable-vnc-jpeg:" \ + -i tools/Makefile || die + + # disable png automagic + sed -e "s:\$\$source/configure:\0 --disable-vnc-png:" \ + -i tools/Makefile || die + + # disable docker (Bug #732970) + sed -e "s:\$\$source/configure:\0 --disable-containers:" \ + -i tools/Makefile || die + + # disable abi-dumper (Bug #791172) + sed -e 's/$(ABI_DUMPER) /echo /g' \ + -i tools/libs/libs.mk || die + + default +} + +src_configure() { + local myconf="--prefix=${PREFIX}/usr \ + --libdir=${PREFIX}/usr/$(get_libdir) \ + --libexecdir=${PREFIX}/usr/libexec \ + --localstatedir=${EPREFIX}/var \ + --disable-golang \ + --disable-werror \ + --disable-xen \ + --enable-tools \ + --enable-docs \ + $(use_enable api xenapi) \ + $(use_enable ipxe) \ + $(usex system-ipxe '--with-system-ipxe=/usr/share/ipxe' '') \ + $(use_enable ocaml ocamltools) \ + $(use_enable ovmf) \ + $(use_enable pam) \ + $(use_enable rombios) \ + --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)" + tc-ld-disable-gold # Bug 669570 + econf ${myconf} +} + +src_compile() { + local myopt + use debug && myopt="${myopt} debug=y" + use python && myopt="${myopt} XENSTAT_PYTHON_BINDINGS=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 + + if use doc; then + emake DESTDIR="${D}" DOCDIR="/usr/share/doc/${PF}" install-docs + dodoc -r docs/{pdf,txt} + else + emake -C docs DESTDIR="${D}" DOCDIR="/usr/share/doc/${PF}" install-man-pages # Bug 668032 + fi + 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 + + keepdir /var/lib/xen/dump + keepdir /var/lib/xen/xenpaging + keepdir /var/lib/xenstored + keepdir /var/log/xen + + if use python; then + python_domodule "${S}/tools/xenstat/libxenstat/bindings/swig/python/xenstat.py" + python_domodule "${S}/tools/xenstat/libxenstat/bindings/swig/python/_xenstat.so" + fi + + python_optimize +} + +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 system 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 +}