diff options
author | Robin H. Johnson <robbat2@gentoo.org> | 2015-08-08 13:49:04 -0700 |
---|---|---|
committer | Robin H. Johnson <robbat2@gentoo.org> | 2015-08-08 17:38:18 -0700 |
commit | 56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch) | |
tree | 3f91093cdb475e565ae857f1c5a7fd339e2d781e /sys-devel/llvm | |
download | gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2 gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip |
proj/gentoo: Initial commit
This commit represents a new era for Gentoo:
Storing the gentoo-x86 tree in Git, as converted from CVS.
This commit is the start of the NEW history.
Any historical data is intended to be grafted onto this point.
Creation process:
1. Take final CVS checkout snapshot
2. Remove ALL ChangeLog* files
3. Transform all Manifests to thin
4. Remove empty Manifests
5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$
5.1. Do not touch files with -kb/-ko keyword flags.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests
X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project
X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration
X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn
X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts
X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration
X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging
X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'sys-devel/llvm')
66 files changed, 8033 insertions, 0 deletions
diff --git a/sys-devel/llvm/Manifest b/sys-devel/llvm/Manifest new file mode 100644 index 000000000000..3a4091767129 --- /dev/null +++ b/sys-devel/llvm/Manifest @@ -0,0 +1,42 @@ +DIST cfe-3.3.src.tar.gz 9425539 SHA256 b1b55de4ab3a57d3e0331a83e0284610191c77d924e3446498d9113d08dfb996 SHA512 06773f43f7d3529f06edb029f7de398f06a700a0f2476e00c4727e70c291028221bfac23625dfd2c220d6ac91a21670848187a934b99a21801c695127371afcc WHIRLPOOL 8b97b527f19015dd3283b9e174615170e639793f64c635ccc4ee4d8216f8de759fd0121a8ef3513fa1c6ad19b31aa3529091ffb44a01ee858edfef400881596a +DIST cfe-3.4.2.src.tar.gz 10612313 SHA256 5ba6f5772f8d00f445209356a7daf83c5bca2da5acd10de517ad2359ae95bc10 SHA512 e01fa8e312e9b3b7b3cb572ac21349161aaa50078ecfe7bded273b75db4a0c44acde524f8fdfcbeec54c61eeeb8339e9917d1f205a8fda18e34fe7ccbe89c36d WHIRLPOOL 153208b1a60bb5fbe92a7162cb26bbe70d591e7db9dcf06fcd54efc539bbff0403ec88e64236969c9f256e5586bc333840bd6178fd158577d6fe228d9edd4dcd +DIST cfe-3.5.0.src.tar.xz 8233432 SHA256 fc80992e004b06f6c7afb612de1cdaa9ac9d25811c55f94fcf7331d9b81cdb8b SHA512 b26a5e2cd81c150607c23b22fafc0d9c7f12b83b45e476b8e75bf5e99d42be7c98ffeac7349df664f01b00900864a01429860b298e48961861377a4b2daf3e49 WHIRLPOOL 5dd8b6fe97933b74f1668b1d753c16cd3bcd05ccf72aac1283aa449caf93f5ba88ae79e7668f7e79b554e1421549a87af21c86cf92657c1b4d77744165718ce7 +DIST cfe-3.5.1.src.tar.xz 8268140 SHA256 6773f3f9cf815631cc7e779ec134ddd228dc8e9a250e1ea3a910610c59eb8f5c SHA512 bd904586f6155c05d2f7ddd05b86c28feae883cdc60e2cb3b48d4ae0ce55916064bcea414a46518d0fb73618f18a3f3fca6cc4cad81083428a2221299f5c5c7f WHIRLPOOL eca619b84ae6dfbca4b3d46601419d2c5a0cd77d643336c560d4bc358f4a2b0f7123d3e87248119c3e447143859da20b9b2e94721ebb14053627f0a158d843f5 +DIST cfe-3.5.2.src.tar.xz 8268008 SHA256 4feb575f74fb3a74b6245400460230141bf610f235ef3a25008cfe6137828620 SHA512 2ad9a7daa8e62cdbf47b001aa6b937a06ae7e6396dcd1832797e2d98036522443ccfca9f1253e16d531a99d1edf237fcd2b457c55491ff68ca4534a2396ca52f WHIRLPOOL 51789ba2a3193d404b26d26b999fc47f1bc4b56b45048078cc51e4ff5c31d834d360ee0c2d16096c060f85acab6de9055dc375569348ae3307e4b280406f2d9e +DIST cfe-3.6.0.src.tar.xz 8640776 SHA256 be0e69378119fe26f0f2f74cffe82b7c26da840c9733fe522ed3c1b66b11082d SHA512 dc137bdf9c2c5adb25498c995f0b944016699267156a595cc1fe6127f6961d45162275023d194db42691d80fa8fc74f56abad9c145ef1ff492881f547ca76cfe WHIRLPOOL 0df122c9d32dba5a00a97bec4a54b7b7bd8241ef625357bcf9997e3670e7c4775becec971f572073f3ffad86c7ccf616a94c06926ef9b0528248e34958e9b43f +DIST cfe-3.6.1.src.tar.xz 8616132 SHA256 74f92d0c93b86678b015e87655f59474b2f657769680efdeb3c0524ffbd2dad7 SHA512 a96944bccfd9341be7adafdcc40367d458e85e7e74b0d2f3a7ea18edf1454d04a232c2d0003d6449c52f81d1e235b434acc1bb63eb5f7d16f8f4a43b70826743 WHIRLPOOL 1b4b8bb33fc7dbaeb03f32ba3544580bf0424889705b9d5130127be4d514c6d2aae5e224d71e20595a31441fc4bdd7bbf647e99e57d2c1e17fff3cff9022faa1 +DIST cfe-3.6.2.src.tar.xz 8617576 SHA256 ae9180466a23acb426d12444d866b266ff2289b266064d362462e44f8d4699f3 SHA512 ed837c48f38d8998efd675b56477c8681dcedfcf3f71bba65930f145501289bebb6fe6a6d9de336548f94c381d016b99f10c58e046b885449755d44ac782de03 WHIRLPOOL a17419cea329999c8662c0008dbd0391ed5f52045d0175488979e7620f6a9a21b08e451a5e21d3bf944597bb37934a8228fa89c09d773882359822d59bd447a8 +DIST clang-tools-extra-3.4.src.tar.gz 230729 SHA256 ba85187551ae97fe1c8ab569903beae5ff0900e21233e5eb5389f6ceab1028b4 SHA512 9656678acea490fd5674b2d47ad30ec69e5aedb450924e566a90418c94ce6483faa254e7dde0d5163cb0643153113d27b6b000fea7bba08f0ba55741b35873b1 WHIRLPOOL c41ec11d0b88678c56d77d285c4383a39cabab16aae8a4457666014e0927aa4b04cf77e73af0275e6bfc603a9531598eca98ab61d5d81288e2920682088d9eaf +DIST clang-tools-extra-3.5.0.src.tar.xz 216256 SHA256 2981beb378afb5aa5c50ed017720a42a33e77e902c7086ad2d412ef4fa931f69 SHA512 5ff2cc5d143b78fbe6645486f02e50f738a92aaf6b8e85cfc6f91e659684686b12e61fc8f00b814b4372c5ed2c2b1be5eca61ea696fbe074b815877b799534ee WHIRLPOOL 10b5afc550fa6a8c33739fbf9268e934732b2892842d398152676e66ab90aed3c6e1bae02bc1b8aa0a9a917b6b450f60950317a9eda3f9e377971cbe00164b11 +DIST clang-tools-extra-3.5.1.src.tar.xz 215776 SHA256 e8d011250389cfc36eb51557ca25ae66ab08173e8d53536a0747356105d72906 SHA512 eefacd6857584c9a3186815a7d015a595f32cd926f6c221245d388b8cb9266c52e0980a8e94f01f49c452510fdd42e659b02f116619d3d0e35170566f0704712 WHIRLPOOL a3d14e21f201cc02649833edd67ba04f17c88486fbf399327dbb76d21e151b956a4f58cd7446b8563f72fa1cee06a8bd4abbc53234761a3a69fc1afc99ced87d +DIST clang-tools-extra-3.5.2.src.tar.xz 215804 SHA256 f21a374d74b194d8c984546266491b518859b5f12ed9abd49337b8060d3fc004 SHA512 6a8e662d2704147296c13626fbc5885911c646c67404f12eacc67ee2995221445bf4f6122b271b9cb3a56b716f550a651024822f72358d400b9052bf50423669 WHIRLPOOL 088d2725a88a439a1a2c4048e0eaf540587078078bd1c9823a4804200265cab4d32606abf5e72be76da45ea4aa6e7a7201a2bdbddc78d5f9e0024b0d7b59e222 +DIST clang-tools-extra-3.6.0.src.tar.xz 248688 SHA256 3aa949ba82913490a75697287d9ee8598c619fae0aa6bb8fddf0095ff51bc812 SHA512 52e0cd3cce3047bb98d52e5c03ac4a8c549fcdc628f57492727f3e7659b2d4bd29ad98ab4ebab387233911fbb098861ec020b28c051e6b2c17d73dd490beebf3 WHIRLPOOL 423f018a2943d16ac605d36bece61046423974c2ffbcc7e4a9aebc5efbb2444ecead70e46bc05f51f4fedbfef338d177b5b16969e8fb0df0bbc911200ce483ae +DIST clang-tools-extra-3.6.1.src.tar.xz 248592 SHA256 f4ee70d870d550a9147ac6a548ce7daf7d9e6897348bf411f43c572966fb92b6 SHA512 3273f8c1fa1683de231d0c0b9371d4b7537381e939fe38996e70a8005a1e6185da459ace2f260fad41df4840b459448ed1498c2fd576dd560005117a54e2ccb9 WHIRLPOOL b35c2118efff758358ed9945384218327767a48ae18acdaf2233a5b97e1dc5a682023ddf78d989d1278119c277aecec596c37c5dab8ea2b16a1c9348eb40d9e6 +DIST clang-tools-extra-3.6.2.src.tar.xz 248624 SHA256 6a0ec627d398f501ddf347060f7a2ccea4802b2494f1d4fd7bda3e0442d04feb SHA512 1b7710a7deee30cefb6a3b4edb026a96d8935a0c6f3056ccdb7a45564d10baf01a4f6722ae853ad9a3bad17e8de32a3c0ec99c5cf6144647a5e182809d403f7a WHIRLPOOL 3dc8888c302bac84f53b673784dec092a2c59ea2985d9983e87f057b9aa7b5d3e34cf13d2b0f1f60ea44f342b8167377204a510036872a087037cf02335c19cd +DIST compiler-rt-3.3.src.tar.gz 1568034 SHA256 0e2f3180d6316e6c43f064fdd406c5c6515e682c5f31c57c28335b68c7525423 SHA512 3e86aa8ab9810b4fbac54a40fc93a717a55c642520858c0db215a5324c1e495b4d8fcec9620251cca8e4e5f9afa34bc14364d7f785880a0700469d0201827929 WHIRLPOOL fcfd06bc860dfd901a7576cd4309f863e9d4363e36ab4c67e9e08fe3c8a37d627ee95eb96b9ed53eb6047dec06e73181b3c3e1555b1b49f1e893e6382f21ddc1 +DIST compiler-rt-3.4.src.tar.gz 1858593 SHA256 f37c89b1383ce462d47537a0245ac798600887a9be9f63073e16b79ed536ab5c SHA512 70efffaf12ff7c15befa87ce808489c6f6b6eb421d0ab5d8ecd525239efc8aab850c7ed34b31a993ff5e499657b72598619945cc4461fe3e5359e9a94aaac0c8 WHIRLPOOL ad558b5877a01e476d30d2757959ab04be0c385b2fe3442bcc578bf36c6f3214cd78b4adda24fcb1f3b2b84353db213b82e8d7d4c40e66c3f57aed3a49322dbc +DIST compiler-rt-3.5.0.src.tar.xz 1088352 SHA256 a4b3e655832bf8d9a357ea2c771db347237460e131988cbb96cda40ff39a8136 SHA512 862cce2d6b398bd1a8399496a547e6ab976a31f676528beebfbea5fd7dc54aa72e1c25deefa12f6167096521eba74090565b0168806451da02ddac04e922fc48 WHIRLPOOL 248acf997d70d7904aa79bf83e0c02ba4e5f8c2812c03f44a8e1e31b845a654f250c09ec6a123f9245d0db8713e8cc5a4087b9ce785af4f5eb7e55d9dbd362a2 +DIST compiler-rt-3.5.1.src.tar.xz 1092452 SHA256 adf4b526f33e681aff5961f0821f5b514d3fc375410008842640b56a2e6a837a SHA512 3a4f093972b080f439c81c8b08793c311cea71afeda7ba7b4e32f19378b1cb420da7b594fa9f6a6f7826570438f67d42d3243c4b3503e1cf8a7dcedf52e8e590 WHIRLPOOL edbf11837139b48207fc6f82ecad39fbc6983cf5bd1441cbe6d50e5e484566b63c5afa2fc64cd29fb8560f07015a98c00b58c926ca7e9af47b7eea92133d0db4 +DIST compiler-rt-3.5.2.src.tar.xz 1093000 SHA256 542d7aadd21e7fe35bea0a7912bc965f08a1a566746cebcca76f96dcfeb74dc3 SHA512 319a8a1dbe07eb4f1fcccfe79a1fa445f348fb854a441500e89fa0a128e45716b65d06347f19a63de32e9294cd2331e914ae0d5fe8224f0b2452c39b79ac96ff WHIRLPOOL 6e9286c56a60a515006c8232ca01622ae844185a5f31fb49bce632868862c5e560619f1c45da66878b5322a764f91a284cd296e9f13105d6f74e055a17321d93 +DIST compiler-rt-3.6.0.src.tar.xz 1140616 SHA256 7f49fb79e5adcdce7dddaf973f1db130228dfb19e37a99a7f5365a6948b26b11 SHA512 2758bc2b78dcfb9b6509b83ebc4ebc86907ca3dc2a5f151f580771c674b934432cae055e342ed73096a08331b2f7b129ff65629b27932458b1877aeb554b6328 WHIRLPOOL 1836b59c2369457aac79dc113b9a76623da30195a460afd0e25997aa21855991cdee78d5aec12b45d05d7d14e42d5fc7678f1c169b5a7fd500681a34d02d4468 +DIST compiler-rt-3.6.1.src.tar.xz 1128460 SHA256 fcbf610c77be6047f11ca10c4725610417beba832565115a9e2fcfe2897b649f SHA512 121c048fe60bccccd4a188a18613c94e1e1d9abd8fbae6405d23418f0c9b3562fff72fe77aea9bc0f8632ec9ad89503b9c67fcab5bf378001f90ad7492a1845a WHIRLPOOL fabbf5a63734f879d1698cd65846beb1cfa8559009b37bf5b5f4e239e62c9a9014d484233674cf357fb7aabb04ac8df840e832c764caf4b4a3b662ff0a51115e +DIST compiler-rt-3.6.2.src.tar.xz 1128080 SHA256 0f2ff37d80a64575fecd8cf0d5c50f7ac1f837ddf700d1855412bb7547431d87 SHA512 7dafcc5bd4822475de649d8a84ae51af3c4ed4d0958f76b1b55ba79219638f3e78eb94a1986c6e9ba0e7f1ccf3ec834d546b5ca60e8b08083fea5880ecdf17a3 WHIRLPOOL dd77e7df43c9028a6873ed903da67560fdb04968013016a7f0ad2d2e9a81b3a3d890b95e4f49a6bdef349806d6507defcd80a0a9fb50c1c9f778e7eff42dbc5d +DIST llvm-2.8-r1.tgz 9112527 SHA256 25addb742f1c6cc12877ed0ee924dda962d848368ee095be8e48342ae613d43b SHA512 8688d5cf415e8aef74cca6a14587af36234a6347e2238ac2c0d66805c42926b9399f36390e1a58a4081e902b0904adb818c1a360d5df572dfa893d6f79f5e35a WHIRLPOOL 0da9250e31242b55586c9138089e742aab5d414d5f3412ebf917ae8b9506f984c6134a932be93ec7e4c01c79f6c21d508cb0b2e0ec283419bd4ae4db745430ae +DIST llvm-2.9.tgz 9574781 SHA256 661236cfa17428b48cfa9cbb9909f7569c64b8ecd219fd91dbc00e3b557b3779 SHA512 9cb0fa0bb8ac02661fd6f926001a15e0ad4a9660683421dc86b03f1cf5184142c5815f9f9283ee7cdf8d474e01177f83406122253342e0e95ddc878821660070 WHIRLPOOL f7b445b6b5d455f29ca68c342511b8b5e6eedec525af1cc60440c4de544df2332aa241bffca29eda5d2428a3f518e093a626bd45c7f8a9e0656d0f68aef5d9d1 +DIST llvm-3.0.tar.gz 10350539 SHA256 519eb11d3499ce99c6ffdb8718651fc91425ed7690eac91c8d6853474f7c0477 SHA512 602bb5590b70cb9138bc19d8c630c62bbabdcb2132215c921fe4bce4e3f74dfc66440b9dcd458ff55a86047cc9cc0417c6563715c133e0db222e4b88f07c13bb WHIRLPOOL 6f4ece3ec747352cd78b08d25c5b1cda91140eb6957d509161e45395e47c074f8d2102bfcaeabcdef8c1f6672f2cf06d88e290667666122da029391b3528d440 +DIST llvm-3.1.src.tar.gz 11077429 SHA256 1ea05135197b5400c1f88d00ff280d775ce778f8f9ea042e25a1e1e734a4b9ab SHA512 fb941094601043e405ccc57473414ef92437b09c200e71614f93d8e93b2a58cca8d78c385be037e064b0711cd6268802c774ce4a40fc0ea17bf576305304d2aa WHIRLPOOL c5c72e139296e1c186131f991010f52f958063a4fcfcb1f8527b53a2aaa7edcaca70ab6cf86c25d08640dcf6d720a865fda7dc7eb06cf1ce9c23fd37b5d597ef +DIST llvm-3.2-manpages.tar.bz2 25962 SHA256 159eaaaf59a2cee66f6aa0bbc93ca4c9fa37a9a25d4116f085556cdbc32f75ca SHA512 75ce41827f99b9e08f0c3e374c49f8a231653bca28bea158ece551e5934bc61ae21bfaf158490f83b05c1a7926b95c8832c0eb023280dcafa671e7d551efa17e WHIRLPOOL 58382b3e92b2ef8b1f5a7ebf2d893852253976b781b2b2acd11dfd914fad9776f59ddc5559d3986832a00fde88539db6a5882aa69a6f3ceca90337a59420acc1 +DIST llvm-3.2.src.tar.gz 12275252 SHA256 125090c4d26740f1d5e9838477c931ed7d9ad70d599ba265f46f3a42cb066343 SHA512 cc66171322dbbe40bcac0e0ea5b09df8ff52df63ded304f841f32f702270d6ab1512216413ee52498c3ebee8cd39c4cd23e3855d591944bc2ac0ae76f5be62cc WHIRLPOOL c3a39b2426293d0251b7769607ade873bb6bf8d54e7c8055773a9b75742bc8e39049fb71409a258c6f3d98775b78c280d4bfe4223ba91e5ed6ecae0eddf910e5 +DIST llvm-3.3-manpages.tar.bz2 27098 SHA256 46bb22d63d5fe7dd04e1a7bb7e16c03d93f2ed51d31540cfb9d97ed70059aa77 SHA512 6f24b66b13025d0606908f91ad9b4fc6de1b4aac2d97d261f6b989065476cf153d2f84792f8dd4972b95fb1a45a3931c328df3bcf8ce5ab21170a7a912a39783 WHIRLPOOL 31b9c3635b698f404b75b87c7891b4b6be9cbeb6062bcb6fba5476b0b3069a486ba60c27ab2b12b8a2da9404f666617162041860f023951050a9fc4c7d27748a +DIST llvm-3.3.src.tar.gz 13602421 SHA256 68766b1e70d05a25e2f502e997a3cb3937187a3296595cf6e0977d5cd6727578 SHA512 1b7f7c5e907a68f642dcbe48fdff9585cb1504022bc9d386f310ebe5d25103d0d5f7cf0abf19e0e3fd666970160a98c90033754e2b79b2fac0cf866c984f8038 WHIRLPOOL a89c0b470fde562a3402e7878b91bc0573d433ca0a60e62c9c46946d7948a4fb657b116b6bac032555e29c70d82c751876adb398fe240f5c8d0a9a2378ce1866 +DIST llvm-3.4-manpages.tar.bz2 33753 SHA256 dc2616104cf333dd9ef56b2d31f9a36e81303e2c5756ff8bc221e05b46f7e1cb SHA512 8e438a9392c9b896ccb2b1460a8f57ffa01633e3a6bba61e2bf2f718d970ff96c17d63b0bc0d4da1162e1d1dc4cb9b2a9e9a14a722e8a5b5d2f205f037ae665d WHIRLPOOL 1c037a9972442937f84bc3147d77d4bbc6d6c0812c3025f3107c2ee5f6259afab990f6e1bca564237fdca8089e2372df4b7ca45cbdea686fbf891f92d1bfbbe6 +DIST llvm-3.4.2.src.tar.gz 15938155 SHA256 17038d47069ad0700c063caed76f0c7259628b0e79651ce2b540d506f2f1efd7 SHA512 6c1453f7d9d9110257db3574cc4f6227fed8938705cbb09851ac09a868089b48f1556a1b6e758aff6d97520b08b5605d3ed20411ad9dd22cdc573d62176905f0 WHIRLPOOL f8b4d5167469e6f350ec41aede04e7b756e18f3d8e78b3270beb5791310a7b9b13c69e57c8bcfefbd0a78efc0c40e3b75a9a158eac72c025b7c77146e8dfaf7c +DIST llvm-3.5.0-manpages.tar.bz2 35314 SHA256 724e752a60016dce8cc536658906d3646c600e977374e0ea692a5d0fe2d4a021 SHA512 d99d6096d7f21a81923297584fe5eeb23e0d83d4538fe376615c92fffc8aff3189999f7ab3c537b5aa5d6bc2c22c53eb05717d48c7ab99c42315b8665bac62c3 WHIRLPOOL 68ced06ee6678c5333c662eb1cc0da744c5a184b12dd059c1b77ec200b1d3cc231f270b9d9b6e177d728776894277b3f9061338aa55620c90474eb97915b7819 +DIST llvm-3.5.0.src.tar.xz 11735940 SHA256 28e199f368ef0a4666708f31c7991ad3bcc3a578342b0306526dd35f07595c03 SHA512 b4d0f325dbdb0a8f10e5fd031954ef4b1971d8f99f4e4b53834801a2b74a7acde3f77c655c8355b407424b363edfb10f71d85fc370356dc52af5c636a1bba197 WHIRLPOOL 561520823468b61c63df8e13f876b7ac586eb1e52c256e9a36370e5d46e8cef3937655c36fbb51eebd3680fab67412e7c777479477fc728e7a8f35420e573ef1 +DIST llvm-3.5.1.src.tar.xz 11869356 SHA256 bf3275d2d7890015c8d8f5e6f4f882f8cf3bf51967297ebe74111d6d8b53be15 SHA512 a643ff173627e813b26077829b1af801b75daa5dcea540c4f05366ed57ef6aeafaf8b3fe4208d4c1b303a048a90ddac48a23488480c165637ae9218de140ae55 WHIRLPOOL 798ad46bc21570d8e5b0caadf2c0b434382fd78bfea5a08097fa001019b749b828e56ffe330435e5f3556700e8b0bee29e4139a7ff6b2824bb83dcc8caba2606 +DIST llvm-3.5.2.src.tar.xz 11876128 SHA256 44196156d5749eb4b4224fe471a29cc3984df92570a4a89fa859f7394fc0c575 SHA512 0f6a83cc61a385387e7baf8fb8f0d9f18e3fd00d2d389a3c7e2c3792be7d82ed095506cac52c24e65ae3c1f94456a441d39440feef6125e25ef18447ec9dd406 WHIRLPOOL b41de51907d6d2c2d04a4c498b44f0ed560cc710e6e2d8678f5ef93a9009d140bc7c2406f4b25d5b901fd026689d48edce77a2e435687b489b835156a512e256 +DIST llvm-3.6.0-manpages.tar.bz2 35140 SHA256 53b14a7896f6db547fa692b43fb5b08898b251699ec505a2b9d9c9c3b632eed7 SHA512 2efe21ecaf10ced3e078e7675918f5b7fe6cfa3ba6371906f832690858024c57f4868a3af54b6de18c980d6008992d08ae21bc2a678ef12652a0a0eabad52a15 WHIRLPOOL f6bfc9ec0432566b70ab16aa99628a64e0d9f325db72a37cb1b04d6a3521625b37b858770ac1c9e313612d9475d7832f683fbbc2c3acad97c99daeb39383df45 +DIST llvm-3.6.0.src.tar.xz 12750908 SHA256 b39a69e501b49e8f73ff75c9ad72313681ee58d6f430bfad4d81846fe92eb9ce SHA512 ca492b7d86333f05930dc849c7a8beff981da51ca174cd844650b516d0a592a2c3837d5a8a9b62713c0f29292b845f27ef0ec361809e325c6b60cbbcd3f20357 WHIRLPOOL 4f9de6b8dd2514e7b55e8c6e6af2ab9d355ebf49f1bd113a652f71809d74060792a95f6cee5b8b3bd64d92586b46e7778f616027702c98eb726ee84375e4eea6 +DIST llvm-3.6.1-manpages.tar.bz2 38338 SHA256 b27c6198e09b11421841a7184d4e8a0f8878d4f1313405da28d643134a55688a SHA512 a47aeb0b4632329eaaa1d6c774446fea5822d7692d81533a9a5c5de1c6a3b37fdd6b7c1fc6433339649f4d3a53a753065e73afb30fd84f253ad31d5fb3d48662 WHIRLPOOL 022b214b6340365490915b5c873e515bf16be90d04cd32f09024a3607c23edc2c2e241d295102f045bd08a442c4e5aaf134ac89f7e59a027ec1633330a95989b +DIST llvm-3.6.1.src.tar.xz 12798852 SHA256 2f00c615913aa0b56607ee1548936e60ad2aa89e6d56f23fb032a4463366fc7a SHA512 fa07d0fe6c527d86c0b91b1b62597f949d777e3609e4e8ca2ea5e07931e1ebc7a363273cc705cf4a13b45e7ab00716b76de26688d077c1b51341d9dd2972de3f WHIRLPOOL c6340956e9935c0e4a986f1a8da9458ca3b3a7bdff376d33c7a3c60bc5154fb5820bfaf43fb4118f28ab9b0f356f436672fd2f984bc629eeee01233b703030fb +DIST llvm-3.6.2.src.tar.xz 12802380 SHA256 f60dc158bfda6822de167e87275848969f0558b3134892ff54fced87e4667b94 SHA512 42b44ce69cfb96e2dc12dc2246f0de8ff983a99741206e2c46ccf074b3248aaab9c0f22c6baad802de851d06f202f40db9dd62fe38aab4479b3f70026c936b36 WHIRLPOOL 1a15e16793fe4120f1c14a5334362c36db26745c493e7289281351b7c18c523d781ff9425dddfe1a2add9ea1e8aebb92f2313787da5f286259b55b0884b3039f diff --git a/sys-devel/llvm/files/cl-patches/0001-r600-Add-some-intrinsic-definitions.patch b/sys-devel/llvm/files/cl-patches/0001-r600-Add-some-intrinsic-definitions.patch new file mode 100644 index 000000000000..9d99c9cff350 --- /dev/null +++ b/sys-devel/llvm/files/cl-patches/0001-r600-Add-some-intrinsic-definitions.patch @@ -0,0 +1,64 @@ +From e25389b66b5ced3a2b5461077dcc9a505d334e3d Mon Sep 17 00:00:00 2001 +From: Tom Stellard <thomas.stellard@amd.com> +Date: Tue, 13 Mar 2012 14:12:21 -0400 +Subject: [PATCH 1/2] r600: Add some intrinsic definitions + +--- + include/llvm/Intrinsics.td | 1 + + include/llvm/IntrinsicsR600.td | 35 +++++++++++++++++++++++++++++++++++ + 2 files changed, 36 insertions(+), 0 deletions(-) + create mode 100644 include/llvm/IntrinsicsR600.td + +diff --git a/include/llvm/Intrinsics.td b/include/llvm/Intrinsics.td +index 069f907..e90dd85 100644 +--- a/include/llvm/Intrinsics.td ++++ b/include/llvm/Intrinsics.td +@@ -441,3 +441,4 @@ include "llvm/IntrinsicsCellSPU.td" + include "llvm/IntrinsicsXCore.td" + include "llvm/IntrinsicsPTX.td" + include "llvm/IntrinsicsHexagon.td" ++include "llvm/IntrinsicsR600.td" +diff --git a/include/llvm/IntrinsicsR600.td b/include/llvm/IntrinsicsR600.td +new file mode 100644 +index 0000000..789fecb +--- /dev/null ++++ b/include/llvm/IntrinsicsR600.td +@@ -0,0 +1,35 @@ ++//===- IntrinsicsR600.td - Defines R600 intrinsics ---------*- tablegen -*-===// ++// ++// The LLVM Compiler Infrastructure ++// ++// This file is distributed under the University of Illinois Open Source ++// License. See LICENSE.TXT for details. ++// ++//===----------------------------------------------------------------------===// ++// ++// This file defines all of the R600-specific intrinsics. ++// ++//===----------------------------------------------------------------------===// ++// ++// Authors: Tom Stellard <thomas.stellard@amd.com> ++// ++ ++let TargetPrefix = "r600" in { ++ ++class R600ReadPreloadRegisterIntrinsic<string name> ++ : Intrinsic<[llvm_i32_ty], [], [IntrNoMem]>, ++ GCCBuiltin<name>; ++ ++multiclass R600ReadPreloadRegisterIntrinsic_xyz<string prefix> { ++ def _x : R600ReadPreloadRegisterIntrinsic<!strconcat(prefix, "_x")>; ++ def _y : R600ReadPreloadRegisterIntrinsic<!strconcat(prefix, "_y")>; ++ def _z : R600ReadPreloadRegisterIntrinsic<!strconcat(prefix, "_z")>; ++} ++ ++defm int_r600_read_ngroups : R600ReadPreloadRegisterIntrinsic_xyz < ++ "__builtin_r600_read_ngroups">; ++defm int_r600_read_tgid : R600ReadPreloadRegisterIntrinsic_xyz < ++ "__builtin_r600_read_tgid">; ++defm int_r600_read_tidig : R600ReadPreloadRegisterIntrinsic_xyz < ++ "__builtin_r600_read_tidig">; ++} // End TargetPrefix = "r600" +-- +1.7.7.6 + diff --git a/sys-devel/llvm/files/cl-patches/0002-r600-Add-get_global_size-and-get_local_size-intrinsi.patch b/sys-devel/llvm/files/cl-patches/0002-r600-Add-get_global_size-and-get_local_size-intrinsi.patch new file mode 100644 index 000000000000..db176dd56a1b --- /dev/null +++ b/sys-devel/llvm/files/cl-patches/0002-r600-Add-get_global_size-and-get_local_size-intrinsi.patch @@ -0,0 +1,27 @@ +From 17667fa3450470f7c89fc2ba4631d908cf510749 Mon Sep 17 00:00:00 2001 +From: Tom Stellard <thomas.stellard@amd.com> +Date: Wed, 14 Mar 2012 11:19:35 -0400 +Subject: [PATCH 2/2] r600: Add get_global_size and get_local_size intrinsics + +--- + include/llvm/IntrinsicsR600.td | 4 ++++ + 1 files changed, 4 insertions(+), 0 deletions(-) + +diff --git a/include/llvm/IntrinsicsR600.td b/include/llvm/IntrinsicsR600.td +index 789fecb..0473acb 100644 +--- a/include/llvm/IntrinsicsR600.td ++++ b/include/llvm/IntrinsicsR600.td +@@ -26,6 +26,10 @@ multiclass R600ReadPreloadRegisterIntrinsic_xyz<string prefix> { + def _z : R600ReadPreloadRegisterIntrinsic<!strconcat(prefix, "_z")>; + } + ++defm int_r600_read_global_size : R600ReadPreloadRegisterIntrinsic_xyz < ++ "__builtin_r600_read_global_size">; ++defm int_r600_read_local_size : R600ReadPreloadRegisterIntrinsic_xyz < ++ "__builtin_r600_read_local_size">; + defm int_r600_read_ngroups : R600ReadPreloadRegisterIntrinsic_xyz < + "__builtin_r600_read_ngroups">; + defm int_r600_read_tgid : R600ReadPreloadRegisterIntrinsic_xyz < +-- +1.7.7.6 + diff --git a/sys-devel/llvm/files/clang-3.1-gentoo-runtime-gcc-detection-v3.patch b/sys-devel/llvm/files/clang-3.1-gentoo-runtime-gcc-detection-v3.patch new file mode 100644 index 000000000000..49f108533404 --- /dev/null +++ b/sys-devel/llvm/files/clang-3.1-gentoo-runtime-gcc-detection-v3.patch @@ -0,0 +1,29 @@ +diff -upNr a/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp b/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp +--- a/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp 2012-05-24 03:32:31.593191000 -0400 ++++ b/llvm-3.1.src/tools/clang/lib/Driver/ToolChains.cpp 2012-05-24 03:38:31.733163513 -0400 +@@ -1145,6 +1145,25 @@ Generic_GCC::GCCInstallationDetector::GC + Prefixes.push_back(D.InstalledDir + "/.."); + } + ++ llvm::OwningPtr<llvm::MemoryBuffer> File; ++ for (unsigned k = 0, ke = CandidateTripleAliases.size(); k < ke; ++k) { ++ if (!llvm::MemoryBuffer::getFile(D.SysRoot + "/etc/env.d/gcc/config-" + CandidateTripleAliases[k].str(), File)) ++ { ++ bool Exists; ++ const std::string VersionText = File.get()->getBuffer().rsplit('-').second.substr(0,5).str(); ++ const std::string GentooPath = D.SysRoot + "/usr/lib/gcc/" + CandidateTripleAliases[k].str() + "/" + VersionText; ++ if (!llvm::sys::fs::exists(GentooPath + "/crtbegin.o", Exists) && Exists) ++ { ++ Version = GCCVersion::Parse(VersionText); ++ GCCInstallPath = GentooPath; ++ GCCParentLibPath = GCCInstallPath + "/../../.."; ++ GCCTriple.setTriple(CandidateTripleAliases[k]); ++ IsValid = true; ++ return; ++ } ++ } ++ } ++ + // Loop over the various components which exist and select the best GCC + // installation available. GCC installs are ranked by version number. + Version = GCCVersion::Parse("0.0.0"); diff --git a/sys-devel/llvm/files/clang-3.3-gcc-header-path.patch b/sys-devel/llvm/files/clang-3.3-gcc-header-path.patch new file mode 100644 index 000000000000..dc9a4f7bb79c --- /dev/null +++ b/sys-devel/llvm/files/clang-3.3-gcc-header-path.patch @@ -0,0 +1,90 @@ +Backport handling of 'g++-vX.Y' header location. + +Fixes: https://bugs.gentoo.org/show_bug.cgi?id=487584 +--- + tools/clang/lib/Driver/ToolChains.cpp | 20 ++++++++++++-------- + tools/clang/lib/Driver/ToolChains.h | 3 +++ + 2 files changed, 15 insertions(+), 8 deletions(-) + +diff --git a/tools/clang/lib/Driver/ToolChains.cpp b/tools/clang/lib/Driver/ToolChains.cpp +index 7c9e9c0..e38d42d 100644 +--- a/tools/clang/lib/Driver/ToolChains.cpp ++++ b/tools/clang/lib/Driver/ToolChains.cpp +@@ -917,17 +917,19 @@ Darwin_Generic_GCC::ComputeEffectiveClangTriple(const ArgList &Args, + /// This is the primary means of forming GCCVersion objects. + /*static*/ + Generic_GCC::GCCVersion Linux::GCCVersion::Parse(StringRef VersionText) { +- const GCCVersion BadVersion = { VersionText.str(), -1, -1, -1, "" }; ++ const GCCVersion BadVersion = { VersionText.str(), -1, -1, -1, "", "", "" }; + std::pair<StringRef, StringRef> First = VersionText.split('.'); + std::pair<StringRef, StringRef> Second = First.second.split('.'); + +- GCCVersion GoodVersion = { VersionText.str(), -1, -1, -1, "" }; ++ GCCVersion GoodVersion = { VersionText.str(), -1, -1, -1, "", "", "" }; + if (First.first.getAsInteger(10, GoodVersion.Major) || + GoodVersion.Major < 0) + return BadVersion; ++ GoodVersion.MajorStr = First.first.str(); + if (Second.first.getAsInteger(10, GoodVersion.Minor) || + GoodVersion.Minor < 0) + return BadVersion; ++ GoodVersion.MinorStr = Second.first.str(); + + // First look for a number prefix and parse that if present. Otherwise just + // stash the entire patch string in the suffix, and leave the number +@@ -945,7 +947,7 @@ Generic_GCC::GCCVersion Linux::GCCVersion::Parse(StringRef VersionText) { + if (PatchText.slice(0, EndNumber).getAsInteger(10, GoodVersion.Patch) || + GoodVersion.Patch < 0) + return BadVersion; +- GoodVersion.PatchSuffix = PatchText.substr(EndNumber).str(); ++ GoodVersion.PatchSuffix = PatchText.substr(EndNumber); + } + } + +@@ -2590,11 +2592,11 @@ void Linux::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs, + // equivalent to '/usr/include/c++/X.Y' in almost all cases. + StringRef LibDir = GCCInstallation.getParentLibPath(); + StringRef InstallDir = GCCInstallation.getInstallPath(); +- StringRef Version = GCCInstallation.getVersion().Text; + StringRef TripleStr = GCCInstallation.getTriple().str(); ++ const GCCVersion &Version = GCCInstallation.getVersion(); + + if (addLibStdCXXIncludePaths(LibDir.str() + "/../include", +- "/c++/" + Version.str(), ++ "/c++/" + Version.Text, + TripleStr, + GCCInstallation.getMultiarchSuffix(), + DriverArgs, CC1Args)) +@@ -2602,10 +2604,12 @@ void Linux::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs, + + const std::string IncludePathCandidates[] = { + // Gentoo is weird and places its headers inside the GCC install, so if the +- // first attempt to find the headers fails, try this pattern. +- InstallDir.str() + "/include/g++-v4", ++ // first attempt to find the headers fails, try these patterns. ++ InstallDir.str() + "/include/g++-v" + Version.MajorStr + "." + ++ Version.MinorStr, ++ InstallDir.str() + "/include/g++-v" + Version.MajorStr, + // Android standalone toolchain has C++ headers in yet another place. +- LibDir.str() + "/../" + TripleStr.str() + "/include/c++/" + Version.str(), ++ LibDir.str() + "/../" + TripleStr.str() + "/include/c++/" + Version.Text, + // Freescale SDK C++ headers are directly in <sysroot>/usr/include/c++, + // without a subdirectory corresponding to the gcc version. + LibDir.str() + "/../include/c++", +diff --git a/tools/clang/lib/Driver/ToolChains.h b/tools/clang/lib/Driver/ToolChains.h +index 3afd8dd..04cf467 100644 +--- a/tools/clang/lib/Driver/ToolChains.h ++++ b/tools/clang/lib/Driver/ToolChains.h +@@ -48,6 +48,9 @@ protected: + /// \brief The parsed major, minor, and patch numbers. + int Major, Minor, Patch; + ++ /// \brief The text of the parsed major, and major+minor versions. ++ std::string MajorStr, MinorStr; ++ + /// \brief Any textual suffix on the patch number. + std::string PatchSuffix; + +-- +1.8.3.2 + diff --git a/sys-devel/llvm/files/clang-3.3-gentoo-install.patch b/sys-devel/llvm/files/clang-3.3-gentoo-install.patch new file mode 100644 index 000000000000..5519fbc9132b --- /dev/null +++ b/sys-devel/llvm/files/clang-3.3-gentoo-install.patch @@ -0,0 +1,71 @@ +From 1a539a8868070e49966c6b5f5e4b9f1257acd7dc Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <gentoo@mgorny.alt.pl> +Date: Fri, 19 Jul 2013 10:23:57 +0200 +Subject: [PATCH] clang gentoo install + +--- + tools/clang/lib/Driver/Tools.cpp | 4 ++-- + tools/clang/tools/scan-build/scan-build | 4 ++-- + tools/clang/tools/scan-view/scan-view | 2 +- + 3 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/tools/clang/lib/Driver/Tools.cpp b/tools/clang/lib/Driver/Tools.cpp +index e014980..6e60513 100644 +--- a/tools/clang/lib/Driver/Tools.cpp ++++ b/tools/clang/lib/Driver/Tools.cpp +@@ -219,7 +219,7 @@ static void addProfileRT(const ToolChain &TC, const ArgList &Args, + // libprofile_rt.so. We used to use the -l:libprofile_rt.a syntax, but that is + // not supported by old linkers. + std::string ProfileRT = +- std::string(TC.getDriver().Dir) + "/../lib/libprofile_rt.a"; ++ "-l:libprofile_rt.a"; + + CmdArgs.push_back(Args.MakeArgString(ProfileRT)); + } +@@ -6177,7 +6177,7 @@ void gnutools::Link::ConstructJob(Compilation &C, const JobAction &JA, + // forward. + if (D.IsUsingLTO(Args) || Args.hasArg(options::OPT_use_gold_plugin)) { + CmdArgs.push_back("-plugin"); +- std::string Plugin = ToolChain.getDriver().Dir + "/../lib/LLVMgold.so"; ++ std::string Plugin = ToolChain.getDriver().Dir + "/../@libdir@/LLVMgold.so"; + CmdArgs.push_back(Args.MakeArgString(Plugin)); + + // Try to pass driver level flags relevant to LTO code generation down to +diff --git a/tools/clang/tools/scan-build/scan-build b/tools/clang/tools/scan-build/scan-build +index 22d5289..dcb4822 100755 +--- a/tools/clang/tools/scan-build/scan-build ++++ b/tools/clang/tools/scan-build/scan-build +@@ -410,7 +410,7 @@ sub CopyFiles { + + my $Dir = shift; + +- my $JS = Cwd::realpath("$RealBin/sorttable.js"); ++ my $JS = Cwd::realpath("@EPREFIX@/usr/share/llvm/sorttable.js"); + + DieDiag("Cannot find 'sorttable.js'.\n") + if (! -r $JS); +@@ -420,7 +420,7 @@ sub CopyFiles { + DieDiag("Could not copy 'sorttable.js' to '$Dir'.\n") + if (! -r "$Dir/sorttable.js"); + +- my $CSS = Cwd::realpath("$RealBin/scanview.css"); ++ my $CSS = Cwd::realpath("@EPREFIX@/usr/share/llvm/scanview.css"); + + DieDiag("Cannot find 'scanview.css'.\n") + if (! -r $CSS); +diff --git a/tools/clang/tools/scan-view/scan-view b/tools/clang/tools/scan-view/scan-view +index fb27da6..1f8ddb8 100755 +--- a/tools/clang/tools/scan-view/scan-view ++++ b/tools/clang/tools/scan-view/scan-view +@@ -54,7 +54,7 @@ def start_browser(port, options): + webbrowser.open(url) + + def run(port, options, root): +- import ScanView ++ from clang import ScanView + try: + print 'Starting scan-view at: http://%s:%d'%(options.host, + port) +-- +1.8.3.2 + diff --git a/sys-devel/llvm/files/clang-3.4-darwin_build_fix.patch b/sys-devel/llvm/files/clang-3.4-darwin_build_fix.patch new file mode 100644 index 000000000000..113b04bc6637 --- /dev/null +++ b/sys-devel/llvm/files/clang-3.4-darwin_build_fix.patch @@ -0,0 +1,47 @@ +Our (gcc/binutils) toolchain doesn't do ARM targets, hence we will get +"unable to interface with target machine" errors while building if we +attempt to. Disable those targets. + +Patch by Reza Jelveh from +https://github.com/fishman/timebomb-gentoo-osx-overlay/blob/master/sys-devel/llvm/files/llvm-3.4-fix_darwin_build.patch + +--- a/projects/compiler-rt/make/platform/clang_darwin_embedded.mk ++++ b/projects/compiler-rt/make/platform/clang_darwin_embedded.mk +@@ -27,20 +27,20 @@ UniversalArchs := + # Soft-float version of the runtime. No floating-point instructions will be used + # and the ABI (out of necessity) passes floating values in normal registers: + # non-VFP variant of the AAPCS. +-Configs += soft_static +-UniversalArchs.soft_static := armv6m armv7m armv7em armv7 ++# Configs += soft_static ++# UniversalArchs.soft_static := armv6m armv7m armv7em armv7 + + # Hard-float version of the runtime. On ARM VFP instructions and registers are + # allowed, and floating point values get passed in them. VFP variant of the + # AAPCS. + Configs += hard_static +-UniversalArchs.hard_static := armv7em armv7 i386 x86_64 ++UniversalArchs.hard_static := i386 x86_64 + +-Configs += soft_pic +-UniversalArchs.soft_pic := armv6m armv7m armv7em armv7 ++# Configs += soft_pic ++# UniversalArchs.soft_pic := armv6m armv7m armv7em armv7 + + Configs += hard_pic +-UniversalArchs.hard_pic := armv7em armv7 i386 x86_64 ++UniversalArchs.hard_pic := i386 x86_64 + + CFLAGS := -Wall -Werror -Oz -fomit-frame-pointer -ffreestanding + +--- a/tools/clang/runtime/compiler-rt/Makefile ++++ b/tools/clang/runtime/compiler-rt/Makefile +@@ -85,7 +85,7 @@ RuntimeLibrary.darwin.Configs := \ + profile_osx.a profile_ios.a \ + ubsan_osx.a + RuntimeLibrary.darwin_embedded.Configs := \ +- soft_static.a hard_static.a soft_pic.a hard_pic.a ++ hard_static.a hard_pic.a + + # Support building compiler-rt with relocatable SDKs. + # diff --git a/sys-devel/llvm/files/clang-3.4-darwin_prefix-include-paths.patch b/sys-devel/llvm/files/clang-3.4-darwin_prefix-include-paths.patch new file mode 100644 index 000000000000..f5f1d9e387e9 --- /dev/null +++ b/sys-devel/llvm/files/clang-3.4-darwin_prefix-include-paths.patch @@ -0,0 +1,18 @@ +--- tools/clang/lib/Frontend/InitHeaderSearch.cpp ++++ tools/clang/lib/Frontend/InitHeaderSearch.cpp +@@ -233,6 +233,7 @@ + case llvm::Triple::Bitrig: + break; + default: ++ AddPath("@GENTOO_PORTAGE_EPREFIX@/usr/include", System, false); + // FIXME: temporary hack: hard-coded paths. + AddPath("/usr/local/include", System, false); + break; +@@ -505,6 +506,7 @@ + // Add the default framework include paths on Darwin. + if (HSOpts.UseStandardSystemIncludes) { + if (triple.isOSDarwin()) { ++ AddPath("@GENTOO_PORTAGE_EPREFIX@/Frameworks", System, true); + AddPath("/System/Library/Frameworks", System, true); + AddPath("/Library/Frameworks", System, true); + } diff --git a/sys-devel/llvm/files/clang-3.4-gentoo-install.patch b/sys-devel/llvm/files/clang-3.4-gentoo-install.patch new file mode 100644 index 000000000000..0a1d9eb3c353 --- /dev/null +++ b/sys-devel/llvm/files/clang-3.4-gentoo-install.patch @@ -0,0 +1,80 @@ +From a12fc090b3b43fe25c7de50c09782611e3834aeb Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org> +Date: Sat, 14 Jun 2014 19:35:33 +0200 +Subject: [PATCH] clang gentoo fixes + +--- + tools/clang/lib/Driver/Tools.cpp | 6 +++--- + tools/clang/tools/scan-build/scan-build | 4 ++-- + tools/clang/tools/scan-view/scan-view | 2 +- + 3 files changed, 6 insertions(+), 6 deletions(-) + +diff --git a/tools/clang/lib/Driver/Tools.cpp b/tools/clang/lib/Driver/Tools.cpp +index b013eb5..dbbcacb 100644 +--- a/tools/clang/lib/Driver/Tools.cpp ++++ b/tools/clang/lib/Driver/Tools.cpp +@@ -222,7 +222,7 @@ static void addProfileRT(const ToolChain &TC, const ArgList &Args, + // libprofile_rt.so. We used to use the -l:libprofile_rt.a syntax, but that is + // not supported by old linkers. + std::string ProfileRT = +- std::string(TC.getDriver().Dir) + "/../lib/libprofile_rt.a"; ++ "-l:libprofile_rt.a"; + + CmdArgs.push_back(Args.MakeArgString(ProfileRT)); + } +@@ -5911,7 +5911,7 @@ void freebsd::Link::ConstructJob(Compilation &C, const JobAction &JA, + // forward. + if (D.IsUsingLTO(Args)) { + CmdArgs.push_back("-plugin"); +- std::string Plugin = ToolChain.getDriver().Dir + "/../lib/LLVMgold.so"; ++ std::string Plugin = ToolChain.getDriver().Dir + "/../@libdir@/LLVMgold.so"; + CmdArgs.push_back(Args.MakeArgString(Plugin)); + + // Try to pass driver level flags relevant to LTO code generation down to +@@ -6534,7 +6534,7 @@ void gnutools::Link::ConstructJob(Compilation &C, const JobAction &JA, + // forward. + if (D.IsUsingLTO(Args)) { + CmdArgs.push_back("-plugin"); +- std::string Plugin = ToolChain.getDriver().Dir + "/../lib/LLVMgold.so"; ++ std::string Plugin = ToolChain.getDriver().Dir + "/../@libdir@/LLVMgold.so"; + CmdArgs.push_back(Args.MakeArgString(Plugin)); + + // Try to pass driver level flags relevant to LTO code generation down to +diff --git a/tools/clang/tools/scan-build/scan-build b/tools/clang/tools/scan-build/scan-build +index 0f119f6..58f78d9 100755 +--- a/tools/clang/tools/scan-build/scan-build ++++ b/tools/clang/tools/scan-build/scan-build +@@ -419,7 +419,7 @@ sub CopyFiles { + + my $Dir = shift; + +- my $JS = Cwd::realpath("$RealBin/sorttable.js"); ++ my $JS = Cwd::realpath("@EPREFIX@/usr/share/llvm/sorttable.js"); + + DieDiag("Cannot find 'sorttable.js'.\n") + if (! -r $JS); +@@ -429,7 +429,7 @@ sub CopyFiles { + DieDiag("Could not copy 'sorttable.js' to '$Dir'.\n") + if (! -r "$Dir/sorttable.js"); + +- my $CSS = Cwd::realpath("$RealBin/scanview.css"); ++ my $CSS = Cwd::realpath("@EPREFIX@/usr/share/llvm/scanview.css"); + + DieDiag("Cannot find 'scanview.css'.\n") + if (! -r $CSS); +diff --git a/tools/clang/tools/scan-view/scan-view b/tools/clang/tools/scan-view/scan-view +index fb27da6..1f8ddb8 100755 +--- a/tools/clang/tools/scan-view/scan-view ++++ b/tools/clang/tools/scan-view/scan-view +@@ -54,7 +54,7 @@ def start_browser(port, options): + webbrowser.open(url) + + def run(port, options, root): +- import ScanView ++ from clang import ScanView + try: + print 'Starting scan-view at: http://%s:%d'%(options.host, + port) +-- +2.0.0 + diff --git a/sys-devel/llvm/files/clang-3.5-gentoo-install.patch b/sys-devel/llvm/files/clang-3.5-gentoo-install.patch new file mode 100644 index 000000000000..5d4261d0b48b --- /dev/null +++ b/sys-devel/llvm/files/clang-3.5-gentoo-install.patch @@ -0,0 +1,57 @@ +--- + tools/clang/lib/Driver/Tools.cpp | 2 +- + tools/clang/tools/scan-build/scan-build | 4 ++-- + tools/clang/tools/scan-view/scan-view | 2 +- + 3 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/tools/clang/lib/Driver/Tools.cpp b/tools/clang/lib/Driver/Tools.cpp +index 187ed38..55bcd99 100644 +--- a/tools/clang/lib/Driver/Tools.cpp ++++ b/tools/clang/lib/Driver/Tools.cpp +@@ -1404,7 +1404,7 @@ static void AddGoldPlugin(const ToolChain &ToolChain, const ArgList &Args, + // as gold requires -plugin to come before any -plugin-opt that -Wl might + // forward. + CmdArgs.push_back("-plugin"); +- std::string Plugin = ToolChain.getDriver().Dir + "/../lib/LLVMgold.so"; ++ std::string Plugin = ToolChain.getDriver().Dir + "/../@libdir@/LLVMgold.so"; + CmdArgs.push_back(Args.MakeArgString(Plugin)); + + // Try to pass driver level flags relevant to LTO code generation down to +diff --git a/tools/clang/tools/scan-build/scan-build b/tools/clang/tools/scan-build/scan-build +index 0f119f6..58f78d9 100755 +--- a/tools/clang/tools/scan-build/scan-build ++++ b/tools/clang/tools/scan-build/scan-build +@@ -419,7 +419,7 @@ + + my $Dir = shift; + +- my $JS = Cwd::realpath("$RealBin/sorttable.js"); ++ my $JS = Cwd::realpath("@EPREFIX@/usr/share/llvm/sorttable.js"); + + DieDiag("Cannot find 'sorttable.js'.\n") + if (! -r $JS); +@@ -429,7 +429,7 @@ + DieDiag("Could not copy 'sorttable.js' to '$Dir'.\n") + if (! -r "$Dir/sorttable.js"); + +- my $CSS = Cwd::realpath("$RealBin/scanview.css"); ++ my $CSS = Cwd::realpath("@EPREFIX@/usr/share/llvm/scanview.css"); + + DieDiag("Cannot find 'scanview.css'.\n") + if (! -r $CSS); +diff --git a/tools/clang/tools/scan-view/scan-view b/tools/clang/tools/scan-view/scan-view +index fb27da6..1f8ddb8 100755 +--- a/tools/clang/tools/scan-view/scan-view ++++ b/tools/clang/tools/scan-view/scan-view +@@ -54,7 +54,7 @@ def start_browser(port, options): + webbrowser.open(url) + + def run(port, options, root): +- import ScanView ++ from clang import ScanView + try: + print 'Starting scan-view at: http://%s:%d'%(options.host, + port) +-- +1.8.4.4 + diff --git a/sys-devel/llvm/files/clang-3.5-gentoo-runtime-gcc-detection-v3.patch b/sys-devel/llvm/files/clang-3.5-gentoo-runtime-gcc-detection-v3.patch new file mode 100644 index 000000000000..1f81af0b7ff0 --- /dev/null +++ b/sys-devel/llvm/files/clang-3.5-gentoo-runtime-gcc-detection-v3.patch @@ -0,0 +1,42 @@ +From 916572e1243633ddf913c8f32771a3a7f70fd853 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org> +Date: Fri, 5 Sep 2014 16:49:35 +0200 +Subject: [PATCH] Support obtaining active toolchain from gcc-config. + +--- + tools/clang/lib/Driver/ToolChains.cpp | 19 +++++++++++++++++++ + 1 file changed, 19 insertions(+) + +diff --git a/tools/clang/lib/Driver/ToolChains.cpp b/tools/clang/lib/Driver/ToolChains.cpp +index b46f69d..2d4374d 100644 +--- a/tools/clang/lib/Driver/ToolChains.cpp ++++ b/tools/clang/lib/Driver/ToolChains.cpp +@@ -1253,6 +1253,25 @@ Generic_GCC::GCCInstallationDetector::init( + Prefixes.push_back("/usr"); + } + ++ for (unsigned k = 0, ke = CandidateTripleAliases.size(); k < ke; ++k) { ++ llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> File = ++ llvm::MemoryBuffer::getFile(D.SysRoot + "/etc/env.d/gcc/config-" + CandidateTripleAliases[k].str()); ++ if (File) ++ { ++ const std::string VersionText = File.get()->getBuffer().rsplit('-').second.substr(0,5).str(); ++ const std::string GentooPath = D.SysRoot + "/usr/lib/gcc/" + CandidateTripleAliases[k].str() + "/" + VersionText; ++ if (llvm::sys::fs::exists(GentooPath + "/crtbegin.o")) ++ { ++ Version = GCCVersion::Parse(VersionText); ++ GCCInstallPath = GentooPath; ++ GCCParentLibPath = GCCInstallPath + "/../../.."; ++ GCCTriple.setTriple(CandidateTripleAliases[k]); ++ IsValid = true; ++ return; ++ } ++ } ++ } ++ + // Loop over the various components which exist and select the best GCC + // installation available. GCC installs are ranked by version number. + Version = GCCVersion::Parse("0.0.0"); +-- +2.1.0 + diff --git a/sys-devel/llvm/files/clang-3.6-fbsd-gcc49.patch b/sys-devel/llvm/files/clang-3.6-fbsd-gcc49.patch new file mode 100644 index 000000000000..31f5fc2b7f99 --- /dev/null +++ b/sys-devel/llvm/files/clang-3.6-fbsd-gcc49.patch @@ -0,0 +1,25 @@ +Fix build fails with using gcc-4.9 on Gentoo/FreeBSD +https://bugs.gentoo.org/show_bug.cgi?id=548444 + +diff --git a/llvm-3.6.0.src/tools/clang/lib/Driver/MSVCToolChain.cpp b/llvm-3.6.0.src/tools/clang/lib/Driver/MSVCToolChain.cpp +index d6bd5c3..372f76f 100644 +--- a/llvm-3.6.0.src/tools/clang/lib/Driver/MSVCToolChain.cpp ++++ b/llvm-3.6.0.src/tools/clang/lib/Driver/MSVCToolChain.cpp +@@ -22,6 +22,8 @@ + #include "llvm/Support/FileSystem.h" + #include "llvm/Support/Process.h" + ++#include <cstdio> ++ + // Include the necessary headers to interface with the Windows registry and + // environment. + #if defined(LLVM_ON_WIN32) +@@ -212,7 +214,7 @@ bool MSVCToolChain::getWindowsSDKDir(std::string &path, int &major, + "SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\$VERSION", + "InstallationFolder", path, &sdkVersion); + if (!sdkVersion.empty()) +- ::sscanf(sdkVersion.c_str(), "v%d.%d", &major, &minor); ++ std::sscanf(sdkVersion.c_str(), "v%d.%d", &major, &minor); + return hasSDKDir && !path.empty(); + } + diff --git a/sys-devel/llvm/files/clang-3.6-gentoo-install.patch b/sys-devel/llvm/files/clang-3.6-gentoo-install.patch new file mode 100644 index 000000000000..6d76ba9660ce --- /dev/null +++ b/sys-devel/llvm/files/clang-3.6-gentoo-install.patch @@ -0,0 +1,48 @@ +--- + tools/clang/lib/Driver/Tools.cpp | 2 +- + tools/clang/tools/scan-build/scan-build | 4 ++-- + tools/clang/tools/scan-view/scan-view | 2 +- + 3 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/tools/clang/lib/Driver/Tools.cpp b/tools/clang/lib/Driver/Tools.cpp +index 187ed38..55bcd99 100644 +--- a/tools/clang/lib/Driver/Tools.cpp ++++ b/tools/clang/lib/Driver/Tools.cpp +diff --git a/tools/clang/tools/scan-build/scan-build b/tools/clang/tools/scan-build/scan-build +index 0f119f6..58f78d9 100755 +--- a/tools/clang/tools/scan-build/scan-build ++++ b/tools/clang/tools/scan-build/scan-build +@@ -419,7 +419,7 @@ + + my $Dir = shift; + +- my $JS = Cwd::realpath("$RealBin/sorttable.js"); ++ my $JS = Cwd::realpath("@EPREFIX@/usr/share/llvm/sorttable.js"); + + DieDiag("Cannot find 'sorttable.js'.\n") + if (! -r $JS); +@@ -429,7 +429,7 @@ + DieDiag("Could not copy 'sorttable.js' to '$Dir'.\n") + if (! -r "$Dir/sorttable.js"); + +- my $CSS = Cwd::realpath("$RealBin/scanview.css"); ++ my $CSS = Cwd::realpath("@EPREFIX@/usr/share/llvm/scanview.css"); + + DieDiag("Cannot find 'scanview.css'.\n") + if (! -r $CSS); +diff --git a/tools/clang/tools/scan-view/scan-view b/tools/clang/tools/scan-view/scan-view +index fb27da6..1f8ddb8 100755 +--- a/tools/clang/tools/scan-view/scan-view ++++ b/tools/clang/tools/scan-view/scan-view +@@ -54,7 +54,7 @@ def start_browser(port, options): + webbrowser.open(url) + + def run(port, options, root): +- import ScanView ++ from clang import ScanView + try: + print 'Starting scan-view at: http://%s:%d'%(options.host, + port) +-- +1.8.4.4 + diff --git a/sys-devel/llvm/files/cmake/0002-cmake-Support-overriding-Sphinx-HTML-doc-install-dir.patch b/sys-devel/llvm/files/cmake/0002-cmake-Support-overriding-Sphinx-HTML-doc-install-dir.patch new file mode 100644 index 000000000000..3e57f0dcaa68 --- /dev/null +++ b/sys-devel/llvm/files/cmake/0002-cmake-Support-overriding-Sphinx-HTML-doc-install-dir.patch @@ -0,0 +1,36 @@ +From 2ec240a76253839cd1c5dc2e964f55698ae468fc Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org> +Date: Mon, 8 Jun 2015 06:43:00 +0200 +Subject: [PATCH 2/4] cmake: Support overriding Sphinx HTML doc install + directory + +Provide ${PROJECT}_INSTALL_HTML variables (e.g. LLVM_INSTALL_HTML) to +override Sphinx HTML doc install directory. + +Fixes: https://llvm.org/bugs/show_bug.cgi?id=23780 +--- + cmake/modules/AddSphinxTarget.cmake | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/cmake/modules/AddSphinxTarget.cmake b/cmake/modules/AddSphinxTarget.cmake +index 045dc23..9c9c444 100644 +--- a/cmake/modules/AddSphinxTarget.cmake ++++ b/cmake/modules/AddSphinxTarget.cmake +@@ -53,8 +53,12 @@ function (add_sphinx_target builder project) + DESTINATION share/man/man1) + + elseif (builder STREQUAL html) +- install(DIRECTORY "${SPHINX_BUILD_DIR}" +- DESTINATION "share/doc/${project}") ++ string(TOUPPER "${project}" project_upper) ++ set(${project_upper}_INSTALL_HTML "share/doc/${project}/html" ++ CACHE STRING "HTML documentation install directory for ${project}") ++ ++ install(DIRECTORY "${SPHINX_BUILD_DIR}/" ++ DESTINATION "${${project_upper}_INSTALL_HTML}") + else() + message(WARNING Installation of ${builder} not supported) + endif() +-- +2.4.3 + diff --git a/sys-devel/llvm/files/cmake/0003-cmake-Add-an-ordering-dep-between-HTML-man-Sphinx-ta.patch b/sys-devel/llvm/files/cmake/0003-cmake-Add-an-ordering-dep-between-HTML-man-Sphinx-ta.patch new file mode 100644 index 000000000000..b1c74c69443f --- /dev/null +++ b/sys-devel/llvm/files/cmake/0003-cmake-Add-an-ordering-dep-between-HTML-man-Sphinx-ta.patch @@ -0,0 +1,32 @@ +From 4f7092ba05cccfeea7d26177d93f3d7a57d9bce2 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org> +Date: Mon, 8 Jun 2015 14:29:03 +0200 +Subject: [PATCH 3/4] cmake: Add an ordering dep between HTML & man Sphinx + targets + +Add a dependency between HTML & manpage Sphinx targets to prevent two +instances of Sphinx from running in parallel, and therefore solves race +conditions reusing the same doctree directory. + +Fixes: https://llvm.org/bugs/show_bug.cgi?id=23781 +--- + docs/CMakeLists.txt | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt +index da27627..63309a6 100644 +--- a/docs/CMakeLists.txt ++++ b/docs/CMakeLists.txt +@@ -100,6 +100,9 @@ if (LLVM_ENABLE_SPHINX) + + if (${SPHINX_OUTPUT_MAN}) + add_sphinx_target(man llvm) ++ if (${SPHINX_OUTPUT_HTML}) ++ add_dependencies(docs-llvm-html docs-llvm-man) ++ endif() + endif() + + endif() +-- +2.4.3 + diff --git a/sys-devel/llvm/files/cmake/0004-cmake-Do-not-install-libgtest.patch b/sys-devel/llvm/files/cmake/0004-cmake-Do-not-install-libgtest.patch new file mode 100644 index 000000000000..92ca2e47e81b --- /dev/null +++ b/sys-devel/llvm/files/cmake/0004-cmake-Do-not-install-libgtest.patch @@ -0,0 +1,28 @@ +From d9f80393cfd4e586242ac3efd4e6ba6b49ce39ae Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org> +Date: Tue, 9 Jun 2015 11:58:52 +0200 +Subject: [PATCH 4/4] cmake: Do not install libgtest + +libgtest is an internal test dependency, and should not be installed to +the live system as a part of LLVM. +--- + utils/unittest/CMakeLists.txt | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/utils/unittest/CMakeLists.txt b/utils/unittest/CMakeLists.txt +index b34e22a..3fe5884 100644 +--- a/utils/unittest/CMakeLists.txt ++++ b/utils/unittest/CMakeLists.txt +@@ -41,6 +41,9 @@ if (PTHREAD_LIBRARY_PATH) + list(APPEND LIBS pthread) + endif() + ++# Delay building until the tests pull it in, and avoid installing it ++set(EXCLUDE_FROM_ALL ON) ++ + add_llvm_library(gtest + googletest/src/gtest-all.cc + +-- +2.4.3 + diff --git a/sys-devel/llvm/files/cmake/clang-0001-Install-clang-runtime-into-usr-lib-without-suffix.patch b/sys-devel/llvm/files/cmake/clang-0001-Install-clang-runtime-into-usr-lib-without-suffix.patch new file mode 100644 index 000000000000..904a72a358a9 --- /dev/null +++ b/sys-devel/llvm/files/cmake/clang-0001-Install-clang-runtime-into-usr-lib-without-suffix.patch @@ -0,0 +1,52 @@ +From b28503def986bcbc388a04be0d51cbe80bc59506 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org> +Date: Tue, 9 Jun 2015 12:11:50 +0200 +Subject: [PATCH] Install clang runtime into /usr/lib (without suffix) + +--- + lib/Driver/Driver.cpp | 3 +-- + lib/Frontend/CompilerInvocation.cpp | 3 +-- + lib/Headers/CMakeLists.txt | 2 +- + 3 files changed, 3 insertions(+), 5 deletions(-) + +diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp +index a04a1f8..418d46a 100644 +--- a/tools/clang/lib/Driver/Driver.cpp ++++ b/tools/clang//lib/Driver/Driver.cpp +@@ -66,8 +66,7 @@ Driver::Driver(StringRef ClangExecutable, StringRef DefaultTargetTriple, + if (ClangResourceDir != "") { + llvm::sys::path::append(P, ClangResourceDir); + } else { +- StringRef ClangLibdirSuffix(CLANG_LIBDIR_SUFFIX); +- llvm::sys::path::append(P, "..", Twine("lib") + ClangLibdirSuffix, "clang", ++ llvm::sys::path::append(P, "..", "lib", "clang", + CLANG_VERSION_STRING); + } + ResourceDir = P.str(); +diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp +index 9485767..0b9ecbd 100644 +--- a/tools/clang/lib/Frontend/CompilerInvocation.cpp ++++ b/tools/clang/lib/Frontend/CompilerInvocation.cpp +@@ -1053,8 +1053,7 @@ std::string CompilerInvocation::GetResourcesPath(const char *Argv0, + if (ClangResourceDir != "") { + llvm::sys::path::append(P, ClangResourceDir); + } else { +- StringRef ClangLibdirSuffix(CLANG_LIBDIR_SUFFIX); +- llvm::sys::path::append(P, "..", Twine("lib") + ClangLibdirSuffix, "clang", ++ llvm::sys::path::append(P, "..", "lib", "clang", + CLANG_VERSION_STRING); + } + +diff --git a/lib/Headers/CMakeLists.txt b/lib/Headers/CMakeLists.txt +index 29a738e..3769d23 100644 +--- a/tools/clang/lib/Headers/CMakeLists.txt ++++ b/tools/clang/lib/Headers/CMakeLists.txt +@@ -93,4 +93,4 @@ set_target_properties(clang-headers PROPERTIES FOLDER "Misc") + install( + FILES ${files} ${CMAKE_CURRENT_BINARY_DIR}/arm_neon.h + PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ +- DESTINATION lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}/include) ++ DESTINATION lib/clang/${CLANG_VERSION}/include) +-- +2.4.3 + diff --git a/sys-devel/llvm/files/cmake/clang-0002-cmake-Make-CLANG_LIBDIR_SUFFIX-overridable.patch b/sys-devel/llvm/files/cmake/clang-0002-cmake-Make-CLANG_LIBDIR_SUFFIX-overridable.patch new file mode 100644 index 000000000000..0b93deba0b58 --- /dev/null +++ b/sys-devel/llvm/files/cmake/clang-0002-cmake-Make-CLANG_LIBDIR_SUFFIX-overridable.patch @@ -0,0 +1,28 @@ +From d07632abe23d55eec2aae303a142a97765a77d32 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org> +Date: Tue, 9 Jun 2015 12:20:06 +0200 +Subject: [PATCH 2/2] cmake: Make CLANG_LIBDIR_SUFFIX overridable + +Make CLANG_LIBDIR_SUFFIX a cache variable so that it can be explicitly +overriden. It is used purely to find the LLVMgold.so plugin, so we want +to set it to native suffix. +--- + CMakeLists.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 357286b..647f976 100644 +--- a/tools/clang/CMakeLists.txt ++++ b/tools/clang/CMakeLists.txt +@@ -203,7 +203,7 @@ set(CLANG_VENDOR_UTI "org.llvm.clang" CACHE STRING + "Vendor-specific uti.") + + # The libdir suffix must exactly match whatever LLVM's configuration used. +-set(CLANG_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}") ++set(CLANG_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}" CACHE STRING "") + + set(CLANG_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) + set(CLANG_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) +-- +2.4.3 + diff --git a/sys-devel/llvm/files/cmake/compiler-rt-0001-cmake-Install-compiler-rt-into-usr-lib-without-suffi.patch b/sys-devel/llvm/files/cmake/compiler-rt-0001-cmake-Install-compiler-rt-into-usr-lib-without-suffi.patch new file mode 100644 index 000000000000..93538009d291 --- /dev/null +++ b/sys-devel/llvm/files/cmake/compiler-rt-0001-cmake-Install-compiler-rt-into-usr-lib-without-suffi.patch @@ -0,0 +1,25 @@ +From 8bd62a681744d3c31a0837c0f84f99ea4987e017 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org> +Date: Tue, 9 Jun 2015 12:17:57 +0200 +Subject: [PATCH] cmake: Install compiler-rt into /usr/lib (without suffix) + +--- + CMakeLists.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 0d8a880..5ae98a9 100644 +--- a/projects/compiler-rt/CMakeLists.txt ++++ b/projects/compiler-rt/CMakeLists.txt +@@ -52,7 +52,7 @@ if (NOT COMPILER_RT_STANDALONE_BUILD) + # Setup the paths where compiler-rt runtimes and headers should be stored. + set(COMPILER_RT_OUTPUT_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/clang/${CLANG_VERSION}) + set(COMPILER_RT_EXEC_OUTPUT_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR}) +- set(COMPILER_RT_INSTALL_PATH lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION}) ++ set(COMPILER_RT_INSTALL_PATH lib/clang/${CLANG_VERSION}) + option(COMPILER_RT_INCLUDE_TESTS "Generate and build compiler-rt unit tests." + ${LLVM_INCLUDE_TESTS}) + option(COMPILER_RT_ENABLE_WERROR "Fail and stop if warning is triggered" +-- +2.4.3 + diff --git a/sys-devel/llvm/files/llvm-2.6-commandguide-nops.patch b/sys-devel/llvm/files/llvm-2.6-commandguide-nops.patch new file mode 100644 index 000000000000..583fdf95f952 --- /dev/null +++ b/sys-devel/llvm/files/llvm-2.6-commandguide-nops.patch @@ -0,0 +1,30 @@ +--- docs/CommandGuide/Makefile.orig 2009-10-26 16:54:33.000000000 +0100 ++++ docs/CommandGuide/Makefile 2009-10-26 17:32:03.000000000 +0100 +@@ -19,7 +19,7 @@ + DST_PS_DIR=ps/ + + # If we are in BUILD_FOR_WEBSITE mode, default to the all target. +-all:: html man ps ++all:: html man + + clean: + rm -f pod2htm*.*~~ $(HTML) $(MAN) $(PS) +@@ -81,7 +81,7 @@ + MAN_DIR := $(PROJ_mandir)/man1 + PS_DIR := $(PROJ_docsdir)/ps + +-install-local:: $(HTML) $(INSTALL_MANS) $(PS) ++install-local:: $(HTML) $(INSTALL_MANS) + $(Echo) Installing HTML CommandGuide Documentation + $(Verb) $(MKDIR) $(HTML_DIR) + $(Verb) $(DataInstall) $(HTML) $(HTML_DIR) +@@ -90,9 +90,6 @@ + $(Echo) Installing MAN CommandGuide Documentation + $(Verb) $(MKDIR) $(MAN_DIR) + $(Verb) $(DataInstall) $(INSTALL_MANS) $(MAN_DIR) +- $(Echo) Installing PS CommandGuide Documentation +- $(Verb) $(MKDIR) $(PS_DIR) +- $(Verb) $(DataInstall) $(PS) $(PS_DIR) + + uninstall-local:: + $(Echo) Uninstalling CommandGuide Documentation diff --git a/sys-devel/llvm/files/llvm-2.7-nodoctargz.patch b/sys-devel/llvm/files/llvm-2.7-nodoctargz.patch new file mode 100644 index 000000000000..cce09eb20fc8 --- /dev/null +++ b/sys-devel/llvm/files/llvm-2.7-nodoctargz.patch @@ -0,0 +1,47 @@ +--- docs/Makefile.orig 2010-04-26 15:00:58.000000000 +0200 ++++ docs/Makefile 2010-04-26 15:03:12.000000000 +0200 +@@ -46,13 +46,12 @@ + # 'make generated BUILD_FOR_WEBSITE=1' + generated:: doxygen ocamldoc + +-install-html: $(PROJ_OBJ_DIR)/html.tar.gz ++install-html: + $(Echo) Installing HTML documentation + $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/html + $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/html/img + $(Verb) $(DataInstall) $(HTML) $(DESTDIR)$(PROJ_docsdir)/html + $(Verb) $(DataInstall) $(IMAGES) $(DESTDIR)$(PROJ_docsdir)/html/img +- $(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/html.tar.gz $(DESTDIR)$(PROJ_docsdir) + + $(PROJ_OBJ_DIR)/html.tar.gz: $(HTML) + $(Echo) Packaging HTML documentation +@@ -64,12 +63,11 @@ + install-doxygen: doxygen + $(Echo) Installing doxygen documentation + $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/html/doxygen +- $(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/doxygen.tar.gz $(DESTDIR)$(PROJ_docsdir) + $(Verb) cd $(PROJ_OBJ_DIR)/doxygen && \ + $(FIND) . -type f -exec \ + $(DataInstall) {} $(DESTDIR)$(PROJ_docsdir)/html/doxygen \; + +-doxygen: regendoc $(PROJ_OBJ_DIR)/doxygen.tar.gz ++doxygen: regendoc + + regendoc: + $(Echo) Building doxygen documentation +@@ -95,7 +93,6 @@ + install-ocamldoc: ocamldoc + $(Echo) Installing ocamldoc documentation + $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/ocamldoc/html +- $(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/ocamldoc.tar.gz $(DESTDIR)$(PROJ_docsdir) + $(Verb) cd $(PROJ_OBJ_DIR)/ocamldoc && \ + $(FIND) . -type f -exec \ + $(DataInstall) {} $(DESTDIR)$(PROJ_docsdir)/ocamldoc/html \; +@@ -105,7 +102,6 @@ + $(Verb) $(RM) -rf $(PROJ_OBJ_DIR)/ocamldoc.tar* + $(Verb) $(TAR) cf $(PROJ_OBJ_DIR)/ocamldoc.tar ocamldoc + $(Verb) $(GZIP) $(PROJ_OBJ_DIR)/ocamldoc.tar +- $(Verb) $(CP) $(PROJ_OBJ_DIR)/ocamldoc.tar.gz $(PROJ_OBJ_DIR)/ocamldoc/html/ + + regen-ocamldoc: + $(Echo) Building ocamldoc documentation diff --git a/sys-devel/llvm/files/llvm-2.8-alignof.patch b/sys-devel/llvm/files/llvm-2.8-alignof.patch new file mode 100644 index 000000000000..ae7f314d2d26 --- /dev/null +++ b/sys-devel/llvm/files/llvm-2.8-alignof.patch @@ -0,0 +1,59 @@ +Index: include/llvm/ADT/StringMap.h +=================================================================== +--- include/llvm/ADT/StringMap.h (révision 117773) ++++ include/llvm/ADT/StringMap.h (révision 117774) +@@ -167,7 +167,7 @@ + + unsigned AllocSize = static_cast<unsigned>(sizeof(StringMapEntry))+ + KeyLength+1; +- unsigned Alignment = alignof<StringMapEntry>(); ++ unsigned Alignment = alignOf<StringMapEntry>(); + + StringMapEntry *NewItem = + static_cast<StringMapEntry*>(Allocator.Allocate(AllocSize,Alignment)); +Index: include/llvm/Support/AlignOf.h +=================================================================== +--- include/llvm/Support/AlignOf.h (révision 117773) ++++ include/llvm/Support/AlignOf.h (révision 117774) +@@ -49,12 +49,12 @@ + + }; + +-/// alignof - A templated function that returns the mininum alignment of ++/// alignOf - A templated function that returns the mininum alignment of + /// of a type. This provides no extra functionality beyond the AlignOf + /// class besides some cosmetic cleanliness. Example usage: +-/// alignof<int>() returns the alignment of an int. ++/// alignOf<int>() returns the alignment of an int. + template <typename T> +-static inline unsigned alignof() { return AlignOf<T>::Alignment; } ++static inline unsigned alignOf() { return AlignOf<T>::Alignment; } + + } // end namespace llvm + #endif +Index: include/llvm/Support/Allocator.h +=================================================================== +--- include/llvm/Support/Allocator.h (révision 117773) ++++ include/llvm/Support/Allocator.h (révision 117774) +@@ -201,7 +201,7 @@ + char *End = Slab == Allocator.CurSlab ? Allocator.CurPtr : + (char *)Slab + Slab->Size; + for (char *Ptr = (char*)(Slab+1); Ptr < End; Ptr += sizeof(T)) { +- Ptr = Allocator.AlignPtr(Ptr, alignof<T>()); ++ Ptr = Allocator.AlignPtr(Ptr, alignOf<T>()); + if (Ptr + sizeof(T) <= End) + reinterpret_cast<T*>(Ptr)->~T(); + } +Index: include/llvm/CodeGen/SlotIndexes.h +=================================================================== +--- include/llvm/CodeGen/SlotIndexes.h (révision 117773) ++++ include/llvm/CodeGen/SlotIndexes.h (révision 117774) +@@ -393,7 +393,7 @@ + IndexListEntry *entry = + static_cast<IndexListEntry*>( + ileAllocator.Allocate(sizeof(IndexListEntry), +- alignof<IndexListEntry>())); ++ alignOf<IndexListEntry>())); + + new (entry) IndexListEntry(mi, index); + diff --git a/sys-devel/llvm/files/llvm-2.8-darwin8.patch b/sys-devel/llvm/files/llvm-2.8-darwin8.patch new file mode 100644 index 000000000000..284ab47c805a --- /dev/null +++ b/sys-devel/llvm/files/llvm-2.8-darwin8.patch @@ -0,0 +1,15 @@ +Avoid like in Makefile.rules +ld: -rpath can only be used when targeting Mac OS X 10.5 or later + +--- unittests/Makefile.unittest ++++ unittests/Makefile.unittest +@@ -37,7 +37,9 @@ + ifeq ($(ENABLE_SHARED), 1) + # Add the absolute path to the dynamic library. This is ok because + # we'll never install unittests. ++ifneq ($(DARWIN_MAJVERS),4) + LD.Flags += $(RPATH) -Wl,$(SharedLibDir) ++endif + # Also set {DYLD,LD}_LIBRARY_PATH because OSX ignores the rpath most + # of the time. + Run.Shared := $(SHLIBPATH_VAR)="$(SharedLibDir)$${$(SHLIBPATH_VAR):+:}$$$(SHLIBPATH_VAR)" diff --git a/sys-devel/llvm/files/llvm-2.9-Operator.h-c++0x.patch b/sys-devel/llvm/files/llvm-2.9-Operator.h-c++0x.patch new file mode 100644 index 000000000000..b95d7d772ace --- /dev/null +++ b/sys-devel/llvm/files/llvm-2.9-Operator.h-c++0x.patch @@ -0,0 +1,57 @@ +--- llvm/trunk/include/llvm/Operator.h 2011/02/07 16:40:21 125006 ++++ llvm/trunk/include/llvm/Operator.h 2011/05/08 01:59:22 131062 +@@ -186,28 +186,46 @@ + }; + + class AddOperator +- : public ConcreteOperator<OverflowingBinaryOperator, Instruction::Add> {}; ++ : public ConcreteOperator<OverflowingBinaryOperator, Instruction::Add> { ++ ~AddOperator(); // DO NOT IMPLEMENT ++}; + class SubOperator +- : public ConcreteOperator<OverflowingBinaryOperator, Instruction::Sub> {}; ++ : public ConcreteOperator<OverflowingBinaryOperator, Instruction::Sub> { ++ ~SubOperator(); // DO NOT IMPLEMENT ++}; + class MulOperator +- : public ConcreteOperator<OverflowingBinaryOperator, Instruction::Mul> {}; ++ : public ConcreteOperator<OverflowingBinaryOperator, Instruction::Mul> { ++ ~MulOperator(); // DO NOT IMPLEMENT ++}; + class ShlOperator +- : public ConcreteOperator<OverflowingBinaryOperator, Instruction::Shl> {}; ++ : public ConcreteOperator<OverflowingBinaryOperator, Instruction::Shl> { ++ ~ShlOperator(); // DO NOT IMPLEMENT ++}; + + + class SDivOperator +- : public ConcreteOperator<PossiblyExactOperator, Instruction::SDiv> {}; ++ : public ConcreteOperator<PossiblyExactOperator, Instruction::SDiv> { ++ ~SDivOperator(); // DO NOT IMPLEMENT ++}; + class UDivOperator +- : public ConcreteOperator<PossiblyExactOperator, Instruction::UDiv> {}; ++ : public ConcreteOperator<PossiblyExactOperator, Instruction::UDiv> { ++ ~UDivOperator(); // DO NOT IMPLEMENT ++}; + class AShrOperator +- : public ConcreteOperator<PossiblyExactOperator, Instruction::AShr> {}; ++ : public ConcreteOperator<PossiblyExactOperator, Instruction::AShr> { ++ ~AShrOperator(); // DO NOT IMPLEMENT ++}; + class LShrOperator +- : public ConcreteOperator<PossiblyExactOperator, Instruction::LShr> {}; ++ : public ConcreteOperator<PossiblyExactOperator, Instruction::LShr> { ++ ~LShrOperator(); // DO NOT IMPLEMENT ++}; + + + + class GEPOperator + : public ConcreteOperator<Operator, Instruction::GetElementPtr> { ++ ~GEPOperator(); // DO NOT IMPLEMENT ++ + enum { + IsInBounds = (1 << 0) + }; diff --git a/sys-devel/llvm/files/llvm-2.9-gcc4.7.patch b/sys-devel/llvm/files/llvm-2.9-gcc4.7.patch new file mode 100644 index 000000000000..a48ad961c9be --- /dev/null +++ b/sys-devel/llvm/files/llvm-2.9-gcc4.7.patch @@ -0,0 +1,14 @@ +--- + Intercept.cpp | 1 + + 1 file changed, 1 insertion(+) + +--- a/lib/ExecutionEngine/JIT/Intercept.cpp 2012-05-17 16:11:46.956180361 +0200 ++++ b/lib/ExecutionEngine/JIT/Intercept.cpp 2012-05-17 16:14:35.256184996 +0200 +@@ -52,6 +52,7 @@ + #include <sys/stat.h> + #endif + #include <fcntl.h> ++#include <unistd.h> + /* stat functions are redirecting to __xstat with a version number. On x86-64 + * linking with libc_nonshared.a and -Wl,--export-dynamic doesn't make 'stat' + * available as an exported symbol, so we have to add it explicitly. diff --git a/sys-devel/llvm/files/llvm-2.9-nodoctargz.patch b/sys-devel/llvm/files/llvm-2.9-nodoctargz.patch new file mode 100644 index 000000000000..9507817b45e8 --- /dev/null +++ b/sys-devel/llvm/files/llvm-2.9-nodoctargz.patch @@ -0,0 +1,39 @@ +--- docs/Makefile.orig 2011-02-28 21:30:46.000000000 +0100 ++++ docs/Makefile 2011-02-28 21:35:22.000000000 +0100 +@@ -53,13 +53,12 @@ + # 'make generated BUILD_FOR_WEBSITE=1' + generated:: $(generated_targets) + +-install-html: $(PROJ_OBJ_DIR)/html.tar.gz ++install-html: + $(Echo) Installing HTML documentation + $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/html + $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/html/img + $(Verb) $(DataInstall) $(HTML) $(DESTDIR)$(PROJ_docsdir)/html + $(Verb) $(DataInstall) $(IMAGES) $(DESTDIR)$(PROJ_docsdir)/html/img +- $(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/html.tar.gz $(DESTDIR)$(PROJ_docsdir) + + $(PROJ_OBJ_DIR)/html.tar.gz: $(HTML) + $(Echo) Packaging HTML documentation +@@ -71,12 +70,11 @@ + install-doxygen: doxygen + $(Echo) Installing doxygen documentation + $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/html/doxygen +- $(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/doxygen.tar.gz $(DESTDIR)$(PROJ_docsdir) + $(Verb) cd $(PROJ_OBJ_DIR)/doxygen && \ + $(FIND) . -type f -exec \ + $(DataInstall) {} $(DESTDIR)$(PROJ_docsdir)/html/doxygen \; + +-doxygen: regendoc $(PROJ_OBJ_DIR)/doxygen.tar.gz ++doxygen: regendoc + + regendoc: + $(Echo) Building doxygen documentation +@@ -102,7 +100,6 @@ + install-ocamldoc: ocamldoc + $(Echo) Installing ocamldoc documentation + $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/ocamldoc/html +- $(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/ocamldoc.tar.gz $(DESTDIR)$(PROJ_docsdir) + $(Verb) cd $(PROJ_OBJ_DIR)/ocamldoc && \ + $(FIND) . -type f -exec \ + $(DataInstall) {} $(DESTDIR)$(PROJ_docsdir)/ocamldoc/html \; diff --git a/sys-devel/llvm/files/llvm-3.0-PPCCompilationCallbackC_static.patch b/sys-devel/llvm/files/llvm-3.0-PPCCompilationCallbackC_static.patch new file mode 100644 index 000000000000..04e40245c671 --- /dev/null +++ b/sys-devel/llvm/files/llvm-3.0-PPCCompilationCallbackC_static.patch @@ -0,0 +1,27 @@ +https://bugs.gentoo.org/show_bug.cgi?id=403519 +http://llvm.org/viewvc/llvm-project?view=rev&revision=153938 + +--- llvm/trunk/lib/Target/PowerPC/PPCJITInfo.cpp 2011/06/15 15:29:47 133059 ++++ llvm/trunk/lib/Target/PowerPC/PPCJITInfo.cpp 2012/04/03 06:59:28 153938 +@@ -291,9 +291,10 @@ + } + #endif + +-extern "C" void *PPCCompilationCallbackC(unsigned *StubCallAddrPlus4, +- unsigned *OrigCallAddrPlus4, +- bool is64Bit) { ++extern "C" { ++static void* LLVM_ATTRIBUTE_USED PPCCompilationCallbackC(unsigned *StubCallAddrPlus4, ++ unsigned *OrigCallAddrPlus4, ++ bool is64Bit) { + // Adjust the pointer to the address of the call instruction in the stub + // emitted by emitFunctionStub, rather than the instruction after it. + unsigned *StubCallAddr = StubCallAddrPlus4 - 1; +@@ -337,6 +338,7 @@ + // stack after we restore all regs. + return Target; + } ++} + + + diff --git a/sys-devel/llvm/files/llvm-3.0-PPC_macro.patch b/sys-devel/llvm/files/llvm-3.0-PPC_macro.patch new file mode 100644 index 000000000000..c485e9ba6847 --- /dev/null +++ b/sys-devel/llvm/files/llvm-3.0-PPC_macro.patch @@ -0,0 +1,43 @@ +Index: llvm-3.0-3.0/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.h +=================================================================== +--- llvm-3.0-3.0.orig/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.h 2011-07-25 23:24:55.000000000 +0000 ++++ llvm-3.0-3.0/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.h 2011-12-02 13:06:48.000000000 +0000 +@@ -34,6 +34,10 @@ + + } // End llvm namespace + ++// Generated files will use "namespace PPC". To avoid symbol clash, ++// undefine PPC here. PPC may be predefined on some hosts. ++#undef PPC ++ + // Defines symbolic names for PowerPC registers. This defines a mapping from + // register name to register number. + // +Index: llvm-3.0-3.0/lib/Target/PowerPC/MCTargetDesc/PPCPredicates.h +=================================================================== +--- llvm-3.0-3.0.orig/lib/Target/PowerPC/MCTargetDesc/PPCPredicates.h 2011-07-26 00:24:13.000000000 +0000 ++++ llvm-3.0-3.0/lib/Target/PowerPC/MCTargetDesc/PPCPredicates.h 2011-12-02 13:06:48.000000000 +0000 +@@ -14,6 +14,10 @@ + #ifndef LLVM_TARGET_POWERPC_PPCPREDICATES_H + #define LLVM_TARGET_POWERPC_PPCPREDICATES_H + ++// Generated files will use "namespace PPC". To avoid symbol clash, ++// undefine PPC here. PPC may be predefined on some hosts. ++#undef PPC ++ + namespace llvm { + namespace PPC { + /// Predicate - These are "(BI << 5) | BO" for various predicates. +Index: llvm-3.0-3.0/lib/Target/PowerPC/MCTargetDesc/PPCFixupKinds.h +=================================================================== +--- llvm-3.0-3.0.orig/lib/Target/PowerPC/MCTargetDesc/PPCFixupKinds.h 2011-07-25 19:53:23.000000000 +0000 ++++ llvm-3.0-3.0/lib/Target/PowerPC/MCTargetDesc/PPCFixupKinds.h 2011-12-02 16:21:23.000000000 +0000 +@@ -12,6 +12,8 @@ + + #include "llvm/MC/MCFixup.h" + ++#undef PPC ++ + namespace llvm { + namespace PPC { + enum Fixups { diff --git a/sys-devel/llvm/files/llvm-3.0-gold_LTO_link.patch b/sys-devel/llvm/files/llvm-3.0-gold_LTO_link.patch new file mode 100644 index 000000000000..031448d2888a --- /dev/null +++ b/sys-devel/llvm/files/llvm-3.0-gold_LTO_link.patch @@ -0,0 +1,10 @@ +--- tools/gold/Makefile 2011/11/23 03:03:21 145094 ++++ tools/gold/Makefile 2011/11/23 03:07:25 145095 +@@ -24,6 +24,6 @@ + # Because off_t is used in the public API, the largefile parts are required for + # ABI compatibility. + CXXFLAGS+=-I$(BINUTILS_INCDIR) -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 +-CXXFLAGS+=$(SharedLibDir)/$(SharedPrefix)LTO$(SHLIBEXT) ++CXXFLAGS+=-L$(SharedLibDir)/$(SharedPrefix) -lLTO + + include $(LEVEL)/Makefile.common diff --git a/sys-devel/llvm/files/llvm-3.0-ocaml_install.patch b/sys-devel/llvm/files/llvm-3.0-ocaml_install.patch new file mode 100644 index 000000000000..18f5cf6c373c --- /dev/null +++ b/sys-devel/llvm/files/llvm-3.0-ocaml_install.patch @@ -0,0 +1,16 @@ +https://bugs.gentoo.org/show_bug.cgi?id=393023 +http://llvm.org/bugs/show_bug.cgi?id=11177 + +Index: llvm-3.0-3.0/bindings/ocaml/llvm/Makefile +=================================================================== +--- llvm-3.0-3.0.orig/bindings/ocaml/llvm/Makefile 2011-11-15 12:17:02.785987852 +0100 ++++ llvm-3.0-3.0/bindings/ocaml/llvm/Makefile 2011-11-15 12:20:12.661983615 +0100 +@@ -30,7 +30,7 @@ + $(OcamlDir)/META.llvm: META.llvm + $(Verb) $(CP) -f $< $@ + +-install-meta:: $(ObjDir)/META.llvm ++install-meta:: $(ObjDir)/../META.llvm + $(Echo) "Install $(BuildMode) $(DestMETA)" + $(Verb) $(MKDIR) $(PROJ_libocamldir) + $(Verb) $(DataInstall) META.llvm "$(DestMETA)" diff --git a/sys-devel/llvm/files/llvm-3.0-set_soname.patch b/sys-devel/llvm/files/llvm-3.0-set_soname.patch new file mode 100644 index 000000000000..69ba74dddad8 --- /dev/null +++ b/sys-devel/llvm/files/llvm-3.0-set_soname.patch @@ -0,0 +1,12 @@ +https://bugs.gentoo.org/show_bug.cgi?id=409267 +http://llvm.org/bugs/show_bug.cgi?id=12334 +--- tools/llvm-shlib/Makefile.orig 2012-03-26 18:14:13.071797115 +0200 ++++ tools/llvm-shlib/Makefile 2012-03-26 17:31:12.491196254 +0200 +@@ -67,6 +67,7 @@ + # Include everything from the .a's into the shared library. + LLVMLibsOptions := -Wl,--whole-archive $(LLVMLibsOptions) \ + -Wl,--no-whole-archive ++ LLVMLibsOptions += -Wl,--soname,lib$(LIBRARYNAME)$(SHLIBEXT) + endif + + ifeq ($(HOST_OS),Linux) diff --git a/sys-devel/llvm/files/llvm-3.1-ExecutionEngine_tests_xfail_arm.patch b/sys-devel/llvm/files/llvm-3.1-ExecutionEngine_tests_xfail_arm.patch new file mode 100644 index 000000000000..05a20e673a87 --- /dev/null +++ b/sys-devel/llvm/files/llvm-3.1-ExecutionEngine_tests_xfail_arm.patch @@ -0,0 +1,27 @@ +diff -Naur llvm-3.1.src/test/ExecutionEngine/2002-12-16-ArgTest.ll llvm.src/test/ExecutionEngine/2002-12-16-ArgTest.ll +--- llvm-3.1.src/test/ExecutionEngine/2002-12-16-ArgTest.ll 2012-04-12 22:13:57.000000000 +0200 ++++ llvm.src/test/ExecutionEngine/2002-12-16-ArgTest.ll 2012-10-08 15:06:30.000000000 +0200 +@@ -1,4 +1,5 @@ + ; RUN: %lli %s > /dev/null ++; XFAIL: arm + + @.LC0 = internal global [10 x i8] c"argc: %d\0A\00" ; <[10 x i8]*> [#uses=1] + +diff -Naur llvm-3.1.src/test/ExecutionEngine/test-fp-no-external-funcs.ll llvm.src/test/ExecutionEngine/test-fp-no-external-funcs.ll +--- llvm-3.1.src/test/ExecutionEngine/test-fp-no-external-funcs.ll 2012-04-12 22:13:57.000000000 +0200 ++++ llvm.src/test/ExecutionEngine/test-fp-no-external-funcs.ll 2012-10-08 15:06:30.000000000 +0200 +@@ -1,4 +1,5 @@ + ; RUN: %lli %s > /dev/null ++; XFAIL: arm + + define double @test(double* %DP, double %Arg) { + %D = load double* %DP ; <double> [#uses=1] +diff -Naur llvm-3.1.src/test/ExecutionEngine/test-fp.ll llvm.src/test/ExecutionEngine/test-fp.ll +--- llvm-3.1.src/test/ExecutionEngine/test-fp.ll 2012-04-12 22:13:57.000000000 +0200 ++++ llvm.src/test/ExecutionEngine/test-fp.ll 2012-10-08 15:06:30.000000000 +0200 +@@ -1,4 +1,5 @@ + ; RUN: %lli %s > /dev/null ++; XFAIL: arm + + define double @test(double* %DP, double %Arg) { + %D = load double* %DP ; <double> [#uses=1] diff --git a/sys-devel/llvm/files/llvm-3.1-docs-pod-markup-fixes.patch b/sys-devel/llvm/files/llvm-3.1-docs-pod-markup-fixes.patch new file mode 100644 index 000000000000..cd8a62a037d2 --- /dev/null +++ b/sys-devel/llvm/files/llvm-3.1-docs-pod-markup-fixes.patch @@ -0,0 +1,28 @@ +--- llvm-3.1.src/docs/CommandGuide/lit.pod~ 2012-03-27 03:01:14.000000000 +0900 ++++ llvm-3.1.src/docs/CommandGuide/lit.pod 2013-01-23 12:47:30.297510832 +0900 +@@ -386,8 +386,6 @@ + ******************** + PASS: D (4 of 4) + +-=back +- + =head2 LIT EXAMPLE TESTS + + The B<lit> distribution contains several example implementations of test suites +--- llvm-3.1.src/docs/CommandGuide/llvm-cov.pod~ 2011-11-29 08:39:25.000000000 +0900 ++++ llvm-3.1.src/docs/CommandGuide/llvm-cov.pod 2013-01-23 13:44:32.184212441 +0900 +@@ -18,12 +18,12 @@ + + =over + +-=item B<-gcno=filename] ++=item B<-gcno=filename> + + This option selects input description file generated by compiler while instrumenting + program. + +-=item B<-gcda=filename] ++=item B<-gcda=filename> + + This option selects coverage data file generated by instrumented compiler. + diff --git a/sys-devel/llvm/files/llvm-3.1-fix_debug_line_info.patch b/sys-devel/llvm/files/llvm-3.1-fix_debug_line_info.patch new file mode 100644 index 000000000000..de2d46b618c3 --- /dev/null +++ b/sys-devel/llvm/files/llvm-3.1-fix_debug_line_info.patch @@ -0,0 +1,65 @@ +From 737fdba46f2b2b7d39bc728d15ea2334c44779e0 Mon Sep 17 00:00:00 2001 +From: Ben Longbons <b.r.longbons@gmail.com> +Date: Fri, 29 Jun 2012 12:58:34 -0700 +Subject: [PATCH] Revert "Patch to set is_stmt a little better for prologue + lines in a function." + +This meants that the debugger could find meaningful line information. + +This reverts commit 60b35f408bc3194e7ea4e96367c0b42dc5e7f850. +--- + lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 7 ++----- + test/DebugInfo/X86/ending-run.ll | 6 ++---- + 2 files changed, 4 insertions(+), 9 deletions(-) + +diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +index 3e79a6d..24aedfb 100644 +--- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp ++++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +@@ -1093,15 +1093,12 @@ void DwarfDebug::beginInstruction(const MachineInstr *MI) { + if (!MI->isDebugValue()) { + DebugLoc DL = MI->getDebugLoc(); + if (DL != PrevInstLoc && (!DL.isUnknown() || UnknownLocations)) { +- unsigned Flags = 0; ++ unsigned Flags = DWARF2_FLAG_IS_STMT; + PrevInstLoc = DL; + if (DL == PrologEndLoc) { + Flags |= DWARF2_FLAG_PROLOGUE_END; + PrologEndLoc = DebugLoc(); + } +- if (PrologEndLoc.isUnknown()) +- Flags |= DWARF2_FLAG_IS_STMT; +- + if (!DL.isUnknown()) { + const MDNode *Scope = DL.getScope(Asm->MF->getFunction()->getContext()); + recordSourceLine(DL.getLine(), DL.getCol(), Scope, Flags); +@@ -1382,7 +1379,7 @@ void DwarfDebug::beginFunction(const MachineFunction *MF) { + MF->getFunction()->getContext()); + recordSourceLine(FnStartDL.getLine(), FnStartDL.getCol(), + FnStartDL.getScope(MF->getFunction()->getContext()), +- 0); ++ DWARF2_FLAG_IS_STMT); + } + } + +diff --git a/test/DebugInfo/X86/ending-run.ll b/test/DebugInfo/X86/ending-run.ll +index 6935c47..0cd3de1 100644 +--- a/test/DebugInfo/X86/ending-run.ll ++++ b/test/DebugInfo/X86/ending-run.ll +@@ -1,11 +1,9 @@ + ; RUN: llc -mtriple=x86_64-apple-darwin %s -o %t -filetype=obj + ; RUN: llvm-dwarfdump %t | FileCheck %s + +-; Check that the line table starts at 7, not 4, but that the first +-; statement isn't until line 8. ++; Check that the line table starts at 7, not 4. + +-; CHECK-NOT: 0x0000000000000000 7 0 1 0 is_stmt +-; CHECK: 0x0000000000000000 7 0 1 0 ++; CHECK: 0x0000000000000000 7 0 1 0 is_stmt + ; CHECK: 0x0000000000000004 8 18 1 0 is_stmt prologue_end + + define i32 @callee(i32 %x) nounwind uwtable ssp { +-- +1.7.10 + diff --git a/sys-devel/llvm/files/llvm-3.1-ivybridge_support.patch b/sys-devel/llvm/files/llvm-3.1-ivybridge_support.patch new file mode 100644 index 000000000000..a03ec422467c --- /dev/null +++ b/sys-devel/llvm/files/llvm-3.1-ivybridge_support.patch @@ -0,0 +1,13 @@ +--- llvm/trunk/lib/Support/Host.cpp 2012/04/23 22:22:46 155401 ++++ llvm/trunk/lib/Support/Host.cpp 2012/04/23 22:41:39 155402 +@@ -230,6 +230,10 @@ + case 45: + return "corei7-avx"; + ++ // Ivy Bridge: ++ case 58: ++ return "core-avx-i"; ++ + case 28: // Intel Atom processor. All processors are manufactured using + // the 45 nm process + return "atom"; diff --git a/sys-devel/llvm/files/llvm-3.2-nodoctargz.patch b/sys-devel/llvm/files/llvm-3.2-nodoctargz.patch new file mode 100644 index 000000000000..3a622b53daa9 --- /dev/null +++ b/sys-devel/llvm/files/llvm-3.2-nodoctargz.patch @@ -0,0 +1,45 @@ +--- docs/Makefile.orig 2012-04-30 17:00:01.000000000 +0200 ++++ docs/Makefile 2012-04-30 17:15:52.000000000 +0200 +@@ -52,11 +52,10 @@ + # 'make generated BUILD_FOR_WEBSITE=1' + generated:: $(generated_targets) + +-install-html: $(PROJ_OBJ_DIR)/html.tar.gz ++install-html: + $(Echo) Installing HTML documentation + $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/html + $(Verb) $(DataInstall) $(HTML) $(DESTDIR)$(PROJ_docsdir)/html +- $(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/html.tar.gz $(DESTDIR)$(PROJ_docsdir) + + $(PROJ_OBJ_DIR)/html.tar.gz: $(HTML) + $(Echo) Packaging HTML documentation +@@ -68,12 +67,11 @@ + install-doxygen: doxygen + $(Echo) Installing doxygen documentation + $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/html/doxygen +- $(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/doxygen.tar.gz $(DESTDIR)$(PROJ_docsdir) + $(Verb) cd $(PROJ_OBJ_DIR)/doxygen && \ + $(FIND) . -type f -exec \ + $(DataInstall) {} $(DESTDIR)$(PROJ_docsdir)/html/doxygen \; + +-doxygen: regendoc $(PROJ_OBJ_DIR)/doxygen.tar.gz ++doxygen: regendoc + + regendoc: + $(Echo) Building doxygen documentation +@@ -99,7 +97,6 @@ + install-ocamldoc: ocamldoc + $(Echo) Installing ocamldoc documentation + $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/ocamldoc/html +- $(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/ocamldoc.tar.gz $(DESTDIR)$(PROJ_docsdir) + $(Verb) cd $(PROJ_OBJ_DIR)/ocamldoc && \ + $(FIND) . -type f -exec \ + $(DataInstall) {} $(DESTDIR)$(PROJ_docsdir)/ocamldoc/html \; +@@ -109,7 +106,6 @@ + $(Verb) $(RM) -rf $(PROJ_OBJ_DIR)/ocamldoc.tar* + $(Verb) $(TAR) cf $(PROJ_OBJ_DIR)/ocamldoc.tar ocamldoc + $(Verb) $(GZIPBIN) $(PROJ_OBJ_DIR)/ocamldoc.tar +- $(Verb) $(CP) $(PROJ_OBJ_DIR)/ocamldoc.tar.gz $(PROJ_OBJ_DIR)/ocamldoc/html/ + + regen-ocamldoc: + $(Echo) Building ocamldoc documentation diff --git a/sys-devel/llvm/files/llvm-3.3-R600_debug.patch b/sys-devel/llvm/files/llvm-3.3-R600_debug.patch new file mode 100644 index 000000000000..b104273fb43c --- /dev/null +++ b/sys-devel/llvm/files/llvm-3.3-R600_debug.patch @@ -0,0 +1,22 @@ +Fixes compilation of llvm-3.3 on gcc-4.6 and 4.7 when VIDEO_CARDS=radeon + +This issue is caused because although Q is a multiset the original code tries to get +a set iterator which can't be converted in a multiset one. + +The fix is as simple as just using a multiset iterator. + +Patch by Francisco Blas Izquierdo Riera (klondike) +Consider the changes in the Public Domain +https://bugs.gentoo.org/show_bug.cgi?id=474096 + +--- lib/Target/R600/R600MachineScheduler.cpp ++++ lib/Target/R600/R600MachineScheduler.cpp +@@ -290,7 +290,7 @@ + SUnit *R600SchedStrategy::PopInst(std::multiset<SUnit *, CompareSUnit> &Q) { + if (Q.empty()) + return NULL; +- for (std::set<SUnit *, CompareSUnit>::iterator It = Q.begin(), E = Q.end(); ++ for (std::multiset<SUnit *, CompareSUnit>::iterator It = Q.begin(), E = Q.end(); + It != E; ++It) { + SUnit *SU = *It; + InstructionsGroupCandidate.push_back(SU->getInstr()); diff --git a/sys-devel/llvm/files/llvm-3.3-cmake-modulepath.patch b/sys-devel/llvm/files/llvm-3.3-cmake-modulepath.patch new file mode 100644 index 000000000000..754ae46ffb1c --- /dev/null +++ b/sys-devel/llvm/files/llvm-3.3-cmake-modulepath.patch @@ -0,0 +1,24 @@ +--- cmake/modules/LLVMConfig.cmake.in.old 2013-12-30 14:40:54.888983600 +0100 ++++ cmake/modules/LLVMConfig.cmake.in 2013-12-30 14:44:15.448970509 +0100 +@@ -39,16 +39,10 @@ + set(LLVM_LIBRARY_DIRS ${LLVM_INSTALL_PREFIX}/lib) + set(LLVM_DEFINITIONS "-D__STDC_LIMIT_MACROS" "-D__STDC_CONSTANT_MACROS") + +-# We try to include using the current setting of CMAKE_MODULE_PATH, +-# which suppossedly was filled by the user with the directory where +-# this file was installed: +-include( LLVM-Config OPTIONAL RESULT_VARIABLE LLVMCONFIG_INCLUDED ) +- +-# If failed, we assume that this is an un-installed build: +-if( NOT LLVMCONFIG_INCLUDED ) +- set(CMAKE_MODULE_PATH ++# For some reasons without it it fails on Gentoo, see bug #496480 ++set(CMAKE_MODULE_PATH + ${CMAKE_MODULE_PATH} +- "@LLVM_SOURCE_DIR@/cmake/modules") +- include( LLVM-Config ) +-endif() ++ "@LLVM_INSTALL_PREFIX@/share/llvm/cmake") ++ ++include(LLVM-Config) + diff --git a/sys-devel/llvm/files/llvm-3.3-gentoo-install.patch b/sys-devel/llvm/files/llvm-3.3-gentoo-install.patch new file mode 100644 index 000000000000..e477be505244 --- /dev/null +++ b/sys-devel/llvm/files/llvm-3.3-gentoo-install.patch @@ -0,0 +1,141 @@ +From 378109dbae7e4772d9b096384904c638a6a34028 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <gentoo@mgorny.alt.pl> +Date: Fri, 19 Jul 2013 10:10:52 +0200 +Subject: [PATCH 1/2] gentoo install fixes + +--- + Makefile.config.in | 6 +++--- + Makefile.rules | 7 +++---- + tools/gold/Makefile | 2 +- + tools/llvm-config/BuildVariables.inc.in | 2 ++ + tools/llvm-config/Makefile | 4 ++++ + tools/llvm-config/llvm-config.cpp | 5 +++-- + utils/FileCheck/Makefile | 2 +- + 7 files changed, 17 insertions(+), 11 deletions(-) + +diff --git a/Makefile.config.in b/Makefile.config.in +index fd4f6ef..5634ecc 100644 +--- a/Makefile.config.in ++++ b/Makefile.config.in +@@ -95,10 +95,10 @@ PROJ_internal_prefix := $(prefix) + endif + + PROJ_bindir := $(PROJ_prefix)/bin +-PROJ_libdir := $(PROJ_prefix)/lib ++PROJ_libdir := $(PROJ_prefix)/$(GENTOO_LIBDIR)/llvm + PROJ_datadir := $(PROJ_prefix)/share +-PROJ_docsdir := $(PROJ_prefix)/docs/llvm +-PROJ_etcdir := $(PROJ_prefix)/etc/llvm ++PROJ_docsdir := $(PROJ_prefix)/share/doc/@PF@ ++PROJ_etcdir := @EPREFIX@/etc/llvm + PROJ_includedir := $(PROJ_prefix)/include + PROJ_infodir := $(PROJ_prefix)/info + PROJ_mandir := $(PROJ_prefix)/share/man +diff --git a/Makefile.rules b/Makefile.rules +index f0c542b..db252f7 100644 +--- a/Makefile.rules ++++ b/Makefile.rules +@@ -276,7 +276,7 @@ ifeq ($(ENABLE_OPTIMIZED),1) + # Don't use -fomit-frame-pointer on Darwin or FreeBSD. + ifneq ($(HOST_OS),FreeBSD) + ifneq ($(HOST_OS),Darwin) +- OmitFramePointer := -fomit-frame-pointer ++ OmitFramePointer := + endif + endif + +@@ -639,7 +638,7 @@ endif + ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW)) + ifneq ($(HOST_OS), Darwin) + ifdef TOOLNAME +- LD.Flags += $(RPATH) -Wl,'$$ORIGIN/../lib' ++ LD.Flags += $(RPATH) -Wl,'$$ORIGIN/../lib' $(RPATH) -Wl,'$(PROJ_libdir)' + ifdef EXAMPLE_TOOL + LD.Flags += $(RPATH) -Wl,$(ExmplDir) $(DynamicFlag) + else +@@ -648,7 +647,7 @@ ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW)) + endif + else + ifneq ($(DARWIN_MAJVERS),4) +- LD.Flags += $(RPATH) -Wl,@executable_path/../lib ++ LD.Flags += $(RPATH) -Wl,@executable_path/../lib -Wl,'$(PROJ_libdir)' + endif + ifeq ($(RC_XBS),YES) + TempFile := $(shell mkdir -p ${OBJROOT}/dSYMs ; mktemp ${OBJROOT}/dSYMs/llvm-lto.XXXXXX) +diff --git a/tools/gold/Makefile b/tools/gold/Makefile +index 496e31c..d36b340 100644 +--- a/tools/gold/Makefile ++++ b/tools/gold/Makefile +@@ -24,7 +24,7 @@ include $(LEVEL)/Makefile.config + # Because off_t is used in the public API, the largefile parts are required for + # ABI compatibility. + CXXFLAGS += -I$(BINUTILS_INCDIR) -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 +-LDFLAGS += -L$(SharedLibDir)/$(SharedPrefix) ++LDFLAGS += -L$(PROJ_libdir) + + include $(LEVEL)/Makefile.common + +diff --git a/tools/llvm-config/BuildVariables.inc.in b/tools/llvm-config/BuildVariables.inc.in +index fe87afb..fd9f2c6 100644 +--- a/tools/llvm-config/BuildVariables.inc.in ++++ b/tools/llvm-config/BuildVariables.inc.in +@@ -25,3 +25,5 @@ + #define LLVM_BUILDMODE "@LLVM_BUILDMODE@" + #define LLVM_TARGETS_BUILT "@LLVM_TARGETS_BUILT@" + #define LLVM_SYSTEM_LIBS "@LLVM_SYSTEM_LIBS@" ++#define LLVM_RPATH "@LLVM_RPATH@" ++#define LLVM_LIBDIR "@LLVM_LIBDIR@" +diff --git a/tools/llvm-config/Makefile b/tools/llvm-config/Makefile +index b20b6bf..fc56781 100644 +--- a/tools/llvm-config/Makefile ++++ b/tools/llvm-config/Makefile +@@ -55,6 +55,10 @@ $(ObjDir)/BuildVariables.inc: $(BUILDVARIABLES_SRCPATH) Makefile $(ObjDir)/.dir + >> temp.sed + $(Verb) $(ECHO) 's/@LLVM_TARGETS_BUILT@/$(subst /,\/,$(TARGETS_TO_BUILD))/' \ + >> temp.sed ++ $(Verb) $(ECHO) 's/@LLVM_RPATH@/$(subst /,\/,$(RPATH))/' \ ++ >> temp.sed ++ $(Verb) $(ECHO) 's/@LLVM_LIBDIR@/$(subst /,\/,$(GENTOO_LIBDIR))/' \ ++ >> temp.sed + $(Verb) $(SED) -f temp.sed < $< > $@ + $(Verb) $(RM) temp.sed + +diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp +index 7edf5ec..4541c28 100644 +--- a/tools/llvm-config/llvm-config.cpp ++++ b/tools/llvm-config/llvm-config.cpp +@@ -250,7 +250,7 @@ int main(int argc, char **argv) { + ActivePrefix = CurrentExecPrefix; + ActiveIncludeDir = ActivePrefix + "/include"; + ActiveBinDir = ActivePrefix + "/bin"; +- ActiveLibDir = ActivePrefix + "/lib"; ++ ActiveLibDir = ActivePrefix + "/" LLVM_LIBDIR "/llvm"; + ActiveIncludeOption = "-I" + ActiveIncludeDir; + } + +@@ -277,7 +277,8 @@ int main(int argc, char **argv) { + } else if (Arg == "--cxxflags") { + OS << ActiveIncludeOption << ' ' << LLVM_CXXFLAGS << '\n'; + } else if (Arg == "--ldflags") { +- OS << "-L" << ActiveLibDir << ' ' << LLVM_LDFLAGS ++ OS << "-L" << ActiveLibDir << ' ' ++ << LLVM_RPATH << " -Wl," << ActiveLibDir << ' ' << LLVM_LDFLAGS + << ' ' << LLVM_SYSTEM_LIBS << '\n'; + } else if (Arg == "--libs") { + PrintLibs = true; +diff --git a/utils/FileCheck/Makefile b/utils/FileCheck/Makefile +index 268b7bc..e7674f9 100644 +--- a/utils/FileCheck/Makefile ++++ b/utils/FileCheck/Makefile +@@ -15,7 +15,7 @@ USEDLIBS = LLVMSupport.a + TOOL_NO_EXPORTS = 1 + + # Don't install this utility +-NO_INSTALL = 1 ++#NO_INSTALL = 1 + + include $(LEVEL)/Makefile.common + +-- +1.8.3.2 + diff --git a/sys-devel/llvm/files/llvm-3.3-insecure-rpath.patch b/sys-devel/llvm/files/llvm-3.3-insecure-rpath.patch new file mode 100644 index 000000000000..659f23783810 --- /dev/null +++ b/sys-devel/llvm/files/llvm-3.3-insecure-rpath.patch @@ -0,0 +1,30 @@ +From d23d21bc76693dd2a43b5d76c68972ac01a055ba Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <gentoo@mgorny.alt.pl> +Date: Sat, 20 Jul 2013 15:56:56 +0200 +Subject: [PATCH] Remove insecure RUNPATHs. + +LLVM seems to build fine without them, and they were removed for 3.4 +already. +--- + Makefile.rules | 5 ----- + 1 file changed, 5 deletions(-) + +diff --git a/Makefile.rules b/Makefile.rules +index db252f7..a29481b 100644 +--- a/Makefile.rules ++++ b/Makefile.rules +@@ -639,11 +639,6 @@ ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW)) + ifneq ($(HOST_OS), Darwin) + ifdef TOOLNAME + LD.Flags += $(RPATH) -Wl,'$(PROJ_libdir)' +- ifdef EXAMPLE_TOOL +- LD.Flags += $(RPATH) -Wl,$(ExmplDir) $(DynamicFlag) +- else +- LD.Flags += $(RPATH) -Wl,$(ToolDir) $(DynamicFlag) +- endif + endif + else + ifneq ($(DARWIN_MAJVERS),4) +-- +1.8.3.2 + diff --git a/sys-devel/llvm/files/llvm-3.3-r2-gentoo-install.patch b/sys-devel/llvm/files/llvm-3.3-r2-gentoo-install.patch new file mode 100644 index 000000000000..c5bd8b8695b0 --- /dev/null +++ b/sys-devel/llvm/files/llvm-3.3-r2-gentoo-install.patch @@ -0,0 +1,117 @@ +From a554809b6bdbe29b1f775c89104c1088300685ef Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org> +Date: Sat, 28 Dec 2013 10:30:28 +0100 +Subject: [PATCH] Update for gentoo install layout. + +--- + Makefile.config.in | 6 +++--- + Makefile.rules | 8 ++++---- + tools/llvm-config/BuildVariables.inc.in | 1 + + tools/llvm-config/Makefile | 2 ++ + tools/llvm-config/llvm-config.cpp | 2 +- + utils/FileCheck/Makefile | 2 +- + 6 files changed, 12 insertions(+), 9 deletions(-) + +diff --git a/Makefile.config.in b/Makefile.config.in +index fd4f6ef..b63786c 100644 +--- a/Makefile.config.in ++++ b/Makefile.config.in +@@ -95,10 +95,10 @@ PROJ_internal_prefix := $(prefix) + endif + + PROJ_bindir := $(PROJ_prefix)/bin +-PROJ_libdir := $(PROJ_prefix)/lib ++PROJ_libdir := $(PROJ_prefix)/$(GENTOO_LIBDIR) + PROJ_datadir := $(PROJ_prefix)/share +-PROJ_docsdir := $(PROJ_prefix)/docs/llvm +-PROJ_etcdir := $(PROJ_prefix)/etc/llvm ++PROJ_docsdir := $(PROJ_prefix)/share/doc/@PF@ ++PROJ_etcdir := @EPREFIX@/etc/llvm + PROJ_includedir := $(PROJ_prefix)/include + PROJ_infodir := $(PROJ_prefix)/info + PROJ_mandir := $(PROJ_prefix)/share/man +diff --git a/Makefile.rules b/Makefile.rules +index f0c542b..6cc19fd 100644 +--- a/Makefile.rules ++++ b/Makefile.rules +@@ -276,7 +276,7 @@ ifeq ($(ENABLE_OPTIMIZED),1) + # Don't use -fomit-frame-pointer on Darwin or FreeBSD. + ifneq ($(HOST_OS),FreeBSD) + ifneq ($(HOST_OS),Darwin) +- OmitFramePointer := -fomit-frame-pointer ++ OmitFramePointer := + endif + endif + +@@ -601,7 +601,7 @@ endif + ifdef SHARED_LIBRARY + ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW)) + ifneq ($(HOST_OS),Darwin) +- LD.Flags += $(RPATH) -Wl,'$$ORIGIN' ++ LD.Flags += + endif + endif + endif +@@ -641,9 +641,9 @@ ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin MingW)) + ifdef TOOLNAME + LD.Flags += $(RPATH) -Wl,'$$ORIGIN/../lib' + ifdef EXAMPLE_TOOL +- LD.Flags += $(RPATH) -Wl,$(ExmplDir) $(DynamicFlag) ++ LD.Flags += $(DynamicFlag) + else +- LD.Flags += $(RPATH) -Wl,$(ToolDir) $(DynamicFlag) ++ LD.Flags += $(DynamicFlag) + endif + endif + else +diff --git a/tools/llvm-config/BuildVariables.inc.in b/tools/llvm-config/BuildVariables.inc.in +index fe87afb..908acd4 100644 +--- a/tools/llvm-config/BuildVariables.inc.in ++++ b/tools/llvm-config/BuildVariables.inc.in +@@ -25,3 +25,4 @@ + #define LLVM_BUILDMODE "@LLVM_BUILDMODE@" + #define LLVM_TARGETS_BUILT "@LLVM_TARGETS_BUILT@" + #define LLVM_SYSTEM_LIBS "@LLVM_SYSTEM_LIBS@" ++#define LLVM_LIBDIR "@LLVM_LIBDIR@" +diff --git a/tools/llvm-config/Makefile b/tools/llvm-config/Makefile +index b20b6bf..0aeba45 100644 +--- a/tools/llvm-config/Makefile ++++ b/tools/llvm-config/Makefile +@@ -55,6 +55,8 @@ $(ObjDir)/BuildVariables.inc: $(BUILDVARIABLES_SRCPATH) Makefile $(ObjDir)/.dir + >> temp.sed + $(Verb) $(ECHO) 's/@LLVM_TARGETS_BUILT@/$(subst /,\/,$(TARGETS_TO_BUILD))/' \ + >> temp.sed ++ $(Verb) $(ECHO) 's/@LLVM_LIBDIR@/$(subst /,\/,$(GENTOO_LIBDIR))/' \ ++ >> temp.sed + $(Verb) $(SED) -f temp.sed < $< > $@ + $(Verb) $(RM) temp.sed + +diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp +index 7edf5ec..c09b702 100644 +--- a/tools/llvm-config/llvm-config.cpp ++++ b/tools/llvm-config/llvm-config.cpp +@@ -250,7 +250,7 @@ int main(int argc, char **argv) { + ActivePrefix = CurrentExecPrefix; + ActiveIncludeDir = ActivePrefix + "/include"; + ActiveBinDir = ActivePrefix + "/bin"; +- ActiveLibDir = ActivePrefix + "/lib"; ++ ActiveLibDir = ActivePrefix + "/" LLVM_LIBDIR; + ActiveIncludeOption = "-I" + ActiveIncludeDir; + } + +diff --git a/utils/FileCheck/Makefile b/utils/FileCheck/Makefile +index 268b7bc..e7674f9 100644 +--- a/utils/FileCheck/Makefile ++++ b/utils/FileCheck/Makefile +@@ -15,7 +15,7 @@ USEDLIBS = LLVMSupport.a + TOOL_NO_EXPORTS = 1 + + # Don't install this utility +-NO_INSTALL = 1 ++#NO_INSTALL = 1 + + include $(LEVEL)/Makefile.common + +-- +1.8.5.2 + diff --git a/sys-devel/llvm/files/llvm-3.4-cmake-configparser.patch b/sys-devel/llvm/files/llvm-3.4-cmake-configparser.patch new file mode 100644 index 000000000000..cda8bdc4e1ab --- /dev/null +++ b/sys-devel/llvm/files/llvm-3.4-cmake-configparser.patch @@ -0,0 +1,35 @@ +From 773560acfad511769017e971991c0305dbc0323d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org> +Date: Wed, 11 Jun 2014 09:40:26 +0200 +Subject: [PATCH] Avoid using external configparser in favor of built-in + ConfigParser. + +We only support Python 2 anyway, and configparser-3.2 is known to break +the build. Since some packages actually force version 3.2, and we do not +to pull in extra dependencies, forcing built-in seems to be the best +option. + +Fixes: https://bugs.gentoo.org/show_bug.cgi?id=500856 +--- + utils/llvm-build/llvmbuild/componentinfo.py | 5 +---- + 1 file changed, 1 insertion(+), 4 deletions(-) + +diff --git a/utils/llvm-build/llvmbuild/componentinfo.py b/utils/llvm-build/llvmbuild/componentinfo.py +index eda3a48..c963ef1 100644 +--- a/utils/llvm-build/llvmbuild/componentinfo.py ++++ b/utils/llvm-build/llvmbuild/componentinfo.py +@@ -3,10 +3,7 @@ Descriptor objects for entities that are part of the LLVM project. + """ + + from __future__ import absolute_import +-try: +- import configparser +-except: +- import ConfigParser as configparser ++import ConfigParser as configparser + import sys + + from llvmbuild.util import * +-- +2.0.0 + diff --git a/sys-devel/llvm/files/llvm-3.4-fix_varargs.patch b/sys-devel/llvm/files/llvm-3.4-fix_varargs.patch new file mode 100644 index 000000000000..377c4da79d2f --- /dev/null +++ b/sys-devel/llvm/files/llvm-3.4-fix_varargs.patch @@ -0,0 +1,148 @@ +https://bugs.gentoo.org/show_bug.cgi?id=497298 +http://llvm.org/bugs/show_bug.cgi?id=18346 + +SVN revisions: +http://llvm.org/viewvc/llvm-project?view=revision&revision=197503 +http://llvm.org/viewvc/llvm-project?view=revision&revision=197505 +http://llvm.org/viewvc/llvm-project?view=revision&revision=197520 + +diff -Naur llvm-3.4.orig/lib/Target/X86/X86ISelLowering.cpp llvm-3.4/lib/Target/X86/X86ISelLowering.cpp +--- llvm-3.4.orig/lib/Target/X86/X86ISelLowering.cpp 2014-01-08 11:22:23.373060109 +0100 ++++ llvm-3.4/lib/Target/X86/X86ISelLowering.cpp 2014-01-08 11:23:58.517125907 +0100 +@@ -15226,9 +15226,15 @@ + MBB->addSuccessor(EndMBB); + } + ++ // Make sure the last operand is EFLAGS, which gets clobbered by the branch ++ // that was just emitted, but clearly shouldn't be "saved". ++ assert((MI->getNumOperands() <= 3 || ++ !MI->getOperand(MI->getNumOperands() - 1).isReg() || ++ MI->getOperand(MI->getNumOperands() - 1).getReg() == X86::EFLAGS) ++ && "Expected last argument to be EFLAGS"); + unsigned MOVOpc = Subtarget->hasFp256() ? X86::VMOVAPSmr : X86::MOVAPSmr; + // In the XMM save block, save all the XMM argument registers. +- for (int i = 3, e = MI->getNumOperands(); i != e; ++i) { ++ for (int i = 3, e = MI->getNumOperands() - 1; i != e; ++i) { + int64_t Offset = (i - 3) * 16 + VarArgsFPOffset; + MachineMemOperand *MMO = + F->getMachineMemOperand( +diff -Naur llvm-3.4.orig/lib/Target/X86/X86InstrCompiler.td llvm-3.4/lib/Target/X86/X86InstrCompiler.td +--- llvm-3.4.orig/lib/Target/X86/X86InstrCompiler.td 2014-01-08 11:22:23.374060109 +0100 ++++ llvm-3.4/lib/Target/X86/X86InstrCompiler.td 2014-01-08 11:23:39.654112857 +0100 +@@ -72,7 +72,7 @@ + + + // x86-64 va_start lowering magic. +-let usesCustomInserter = 1 in { ++let usesCustomInserter = 1, Defs = [EFLAGS] in { + def VASTART_SAVE_XMM_REGS : I<0, Pseudo, + (outs), + (ins GR8:$al, +@@ -81,7 +81,8 @@ + "#VASTART_SAVE_XMM_REGS $al, $regsavefi, $offset", + [(X86vastart_save_xmm_regs GR8:$al, + imm:$regsavefi, +- imm:$offset)]>; ++ imm:$offset), ++ (implicit EFLAGS)]>; + + // The VAARG_64 pseudo-instruction takes the address of the va_list, + // and places the address of the next argument into a register. +diff -Naur llvm-3.4.orig/test/CodeGen/X86/vaargs.ll llvm-3.4/test/CodeGen/X86/vaargs.ll +--- llvm-3.4.orig/test/CodeGen/X86/vaargs.ll 1970-01-01 01:00:00.000000000 +0100 ++++ llvm-3.4/test/CodeGen/X86/vaargs.ll 2014-01-08 11:23:53.451122402 +0100 +@@ -0,0 +1,67 @@ ++; RUN: llc -mcpu=corei7-avx %s -o - | FileCheck %s --check-prefix=CHECK --check-prefix=NO-FLAGS ++target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" ++target triple = "x86_64-apple-macosx10.9.0" ++ ++%struct.__va_list_tag = type { i32, i32, i8*, i8* } ++ ++; Check that vastart gets the right thing. ++define i32 @sum(i32 %count, ...) nounwind optsize ssp uwtable { ++; CHECK: testb %al, %al ++; CHECK-NEXT: je ++; CHECK-NEXT: ## BB#{{[0-9]+}}: ++; CHECK-NEXT: vmovaps %xmm0, 48(%rsp) ++; CHECK-NEXT: vmovaps %xmm1, 64(%rsp) ++; CHECK-NEXT: vmovaps %xmm2, 80(%rsp) ++; CHECK-NEXT: vmovaps %xmm3, 96(%rsp) ++; CHECK-NEXT: vmovaps %xmm4, 112(%rsp) ++; CHECK-NEXT: vmovaps %xmm5, 128(%rsp) ++; CHECK-NEXT: vmovaps %xmm6, 144(%rsp) ++; CHECK-NEXT: vmovaps %xmm7, 160(%rsp) ++ ++; Check that [EFLAGS] hasn't been pulled in. ++; NO-FLAGS-NOT: %flags ++ ++ %ap = alloca [1 x %struct.__va_list_tag], align 16 ++ %1 = bitcast [1 x %struct.__va_list_tag]* %ap to i8* ++ call void @llvm.va_start(i8* %1) ++ %2 = icmp sgt i32 %count, 0 ++ br i1 %2, label %.lr.ph, label %._crit_edge ++ ++.lr.ph: ; preds = %0 ++ %3 = getelementptr inbounds [1 x %struct.__va_list_tag]* %ap, i64 0, i64 0, i32 0 ++ %4 = getelementptr inbounds [1 x %struct.__va_list_tag]* %ap, i64 0, i64 0, i32 2 ++ %.pre = load i32* %3, align 16 ++ br label %5 ++ ++; <label>:5 ; preds = %.lr.ph, %13 ++ %6 = phi i32 [ %.pre, %.lr.ph ], [ %14, %13 ] ++ %.01 = phi i32 [ %count, %.lr.ph ], [ %15, %13 ] ++ %7 = icmp ult i32 %6, 41 ++ br i1 %7, label %8, label %10 ++ ++; <label>:8 ; preds = %5 ++ %9 = add i32 %6, 8 ++ store i32 %9, i32* %3, align 16 ++ br label %13 ++ ++; <label>:10 ; preds = %5 ++ %11 = load i8** %4, align 8 ++ %12 = getelementptr i8* %11, i64 8 ++ store i8* %12, i8** %4, align 8 ++ br label %13 ++ ++; <label>:13 ; preds = %10, %8 ++ %14 = phi i32 [ %6, %10 ], [ %9, %8 ] ++ %15 = add nsw i32 %.01, 1 ++ %16 = icmp sgt i32 %15, 0 ++ br i1 %16, label %5, label %._crit_edge ++ ++._crit_edge: ; preds = %13, %0 ++ %.0.lcssa = phi i32 [ %count, %0 ], [ %15, %13 ] ++ call void @llvm.va_end(i8* %1) ++ ret i32 %.0.lcssa ++} ++ ++declare void @llvm.va_start(i8*) nounwind ++ ++declare void @llvm.va_end(i8*) nounwind +diff -Naur llvm-3.4.orig/test/CodeGen/X86/vastart-defs-eflags.ll llvm-3.4/test/CodeGen/X86/vastart-defs-eflags.ll +--- llvm-3.4.orig/test/CodeGen/X86/vastart-defs-eflags.ll 1970-01-01 01:00:00.000000000 +0100 ++++ llvm-3.4/test/CodeGen/X86/vastart-defs-eflags.ll 2014-01-08 11:23:39.654112857 +0100 +@@ -0,0 +1,23 @@ ++; RUN: llc %s -o - | FileCheck %s ++ ++target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" ++target triple = "x86_64-apple-macosx10.10.0" ++ ++; Check that vastart handling doesn't get between testb and je for the branch. ++define i32 @check_flag(i32 %flags, ...) nounwind { ++entry: ++; CHECK: {{^}} testb $2, %bh ++; CHECK-NOT: test ++; CHECK: {{^}} je ++ %and = and i32 %flags, 512 ++ %tobool = icmp eq i32 %and, 0 ++ br i1 %tobool, label %if.end, label %if.then ++ ++if.then: ; preds = %entry ++ br label %if.end ++ ++if.end: ; preds = %entry, %if.then ++ %hasflag = phi i32 [ 1, %if.then ], [ 0, %entry ] ++ ret i32 %hasflag ++} ++ diff --git a/sys-devel/llvm/files/llvm-3.4-gentoo-install.patch b/sys-devel/llvm/files/llvm-3.4-gentoo-install.patch new file mode 100644 index 000000000000..a2ba7dee47ed --- /dev/null +++ b/sys-devel/llvm/files/llvm-3.4-gentoo-install.patch @@ -0,0 +1,96 @@ +From b8846d389ff5e2b768a114f752cf39788accba26 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org> +Date: Mon, 19 Aug 2013 13:22:46 +0200 +Subject: [PATCH] gentoo install fixes + +--- + Makefile.config.in | 6 +++--- + Makefile.rules | 6 +++--- + tools/llvm-config/BuildVariables.inc.in | 2 ++ + tools/llvm-config/Makefile | 4 ++++ + tools/llvm-config/llvm-config.cpp | 5 +++-- + utils/FileCheck/Makefile | 2 +- + 7 files changed, 17 insertions(+), 10 deletions(-) + +diff --git a/Makefile.config.in b/Makefile.config.in +index dcca45f..e75ae2e 100644 +--- a/Makefile.config.in ++++ b/Makefile.config.in +@@ -95,10 +95,10 @@ PROJ_internal_prefix := $(prefix) + endif + + PROJ_bindir := $(PROJ_prefix)/bin +-PROJ_libdir := $(PROJ_prefix)/lib ++PROJ_libdir := $(PROJ_prefix)/$(GENTOO_LIBDIR) + PROJ_datadir := $(PROJ_prefix)/share +-PROJ_docsdir := $(PROJ_prefix)/docs/llvm +-PROJ_etcdir := $(PROJ_prefix)/etc/llvm ++PROJ_docsdir := $(PROJ_prefix)/share/doc/@PF@ ++PROJ_etcdir := @EPREFIX@/etc/llvm + PROJ_includedir := $(PROJ_prefix)/include + PROJ_infodir := $(PROJ_prefix)/info + PROJ_mandir := $(PROJ_prefix)/share/man +diff --git a/Makefile.rules b/Makefile.rules +index e53598b..217f754 100644 +--- a/Makefile.rules ++++ b/Makefile.rules +@@ -275,7 +275,7 @@ ifeq ($(ENABLE_OPTIMIZED),1) + BuildMode := Release + # Don't use -fomit-frame-pointer on Darwin or FreeBSD. + ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin Darwin DragonFly FreeBSD GNU/kFreeBSD)) +- OmitFramePointer := -fomit-frame-pointer ++ OmitFramePointer := + endif + + CXX.Flags += $(OPTIMIZE_OPTION) $(OmitFramePointer) +diff --git a/tools/llvm-config/BuildVariables.inc.in b/tools/llvm-config/BuildVariables.inc.in +index fe87afb..fd9f2c6 100644 +--- a/tools/llvm-config/BuildVariables.inc.in ++++ b/tools/llvm-config/BuildVariables.inc.in +@@ -25,3 +25,4 @@ + #define LLVM_BUILDMODE "@LLVM_BUILDMODE@" + #define LLVM_TARGETS_BUILT "@LLVM_TARGETS_BUILT@" + #define LLVM_SYSTEM_LIBS "@LLVM_SYSTEM_LIBS@" ++#define LLVM_LIBDIR "@LLVM_LIBDIR@" +diff --git a/tools/llvm-config/Makefile b/tools/llvm-config/Makefile +index b20b6bf..fc56781 100644 +--- a/tools/llvm-config/Makefile ++++ b/tools/llvm-config/Makefile +@@ -55,6 +55,8 @@ $(ObjDir)/BuildVariables.inc: $(BUILDVARIABLES_SRCPATH) Makefile $(ObjDir)/.dir + >> temp.sed + $(Verb) $(ECHO) 's/@LLVM_TARGETS_BUILT@/$(subst /,\/,$(TARGETS_TO_BUILD))/' \ + >> temp.sed ++ $(Verb) $(ECHO) 's/@LLVM_LIBDIR@/$(subst /,\/,$(GENTOO_LIBDIR))/' \ ++ >> temp.sed + $(Verb) $(SED) -f temp.sed < $< > $@ + $(Verb) $(RM) temp.sed + +diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp +index 3924e2e..f439c60 100644 +--- a/tools/llvm-config/llvm-config.cpp ++++ b/tools/llvm-config/llvm-config.cpp +@@ -250,7 +250,7 @@ int main(int argc, char **argv) { + ActivePrefix = CurrentExecPrefix; + ActiveIncludeDir = ActivePrefix + "/include"; + ActiveBinDir = ActivePrefix + "/bin"; +- ActiveLibDir = ActivePrefix + "/lib"; ++ ActiveLibDir = ActivePrefix + "/" LLVM_LIBDIR; + ActiveIncludeOption = "-I" + ActiveIncludeDir; + } + +diff --git a/utils/FileCheck/Makefile b/utils/FileCheck/Makefile +index 268b7bc..e7674f9 100644 +--- a/utils/FileCheck/Makefile ++++ b/utils/FileCheck/Makefile +@@ -15,7 +15,7 @@ USEDLIBS = LLVMSupport.a + TOOL_NO_EXPORTS = 1 + + # Don't install this utility +-NO_INSTALL = 1 ++#NO_INSTALL = 1 + + include $(LEVEL)/Makefile.common + +-- +1.8.4.2 + diff --git a/sys-devel/llvm/files/llvm-3.5-gcc-4.9.patch b/sys-devel/llvm/files/llvm-3.5-gcc-4.9.patch new file mode 100644 index 000000000000..7da657f457d9 --- /dev/null +++ b/sys-devel/llvm/files/llvm-3.5-gcc-4.9.patch @@ -0,0 +1,43 @@ +commit 080fb498017d17af2e4d7563608c7d8a848f20da +Author: Sanjoy Das <sanjoy at azulsystems.com> +Date: Thu Jun 19 15:38:02 2014 -0700 + + Fix the --enable-shared build. + + Currently a build configured with ./configure --enable-shared breaks + with an undefined "llvm::cl::parser<llvm::PassInfo + const*>::getOption(unsigned int) const" symbol when linking opt. This + body for this symbol gets emitted into Pass.o (along with the destructor + for PassNameParser), but gets linked into libLLVM-3.5svn.so with local + visibility, causing the link error. + + This fix uses the existing EXTERN_TEMPLATE machinery to force a globally + visible definition for the functions in parser<const PassInfo *> into + Pass.o. + +diff --git a/include/llvm/IR/LegacyPassNameParser.h b/include/llvm/IR/LegacyPassNameParser.h +index e2e4912..a07e3fd 100644 +--- a/include/llvm/IR/LegacyPassNameParser.h ++++ b/include/llvm/IR/LegacyPassNameParser.h +@@ -95,6 +95,8 @@ private: + } + }; + ++EXTERN_TEMPLATE_INSTANTIATION(class cl::parser<const PassInfo *>); ++ + ///===----------------------------------------------------------------------===// + /// FilteredPassNameParser class - Make use of the pass registration + /// mechanism to automatically add a command line argument to opt for +diff --git a/lib/IR/Pass.cpp b/lib/IR/Pass.cpp +index 91d86ae..00ce223 100644 +--- a/lib/IR/Pass.cpp ++++ b/lib/IR/Pass.cpp +@@ -234,6 +234,8 @@ PassNameParser::~PassNameParser() { + // attempting to remove the registration listener is an error. + } + ++TEMPLATE_INSTANTIATION(class cl::parser<const PassInfo *>); ++ + //===----------------------------------------------------------------------===// + // AnalysisUsage Class Implementation + // diff --git a/sys-devel/llvm/files/llvm-3.5-gentoo-install.patch b/sys-devel/llvm/files/llvm-3.5-gentoo-install.patch new file mode 100644 index 000000000000..7a8c9f7dfc1c --- /dev/null +++ b/sys-devel/llvm/files/llvm-3.5-gentoo-install.patch @@ -0,0 +1,83 @@ +From b8846d389ff5e2b768a114f752cf39788accba26 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org> +Date: Mon, 19 Aug 2013 13:22:46 +0200 +Subject: [PATCH] gentoo install fixes + +--- + Makefile.config.in | 6 +++--- + Makefile.rules | 6 +++--- + tools/llvm-config/BuildVariables.inc.in | 2 ++ + tools/llvm-config/Makefile | 4 ++++ + tools/llvm-config/llvm-config.cpp | 5 +++-- + utils/FileCheck/Makefile | 2 +- + 7 files changed, 17 insertions(+), 10 deletions(-) + +diff --git a/Makefile.config.in b/Makefile.config.in +index dcca45f..e75ae2e 100644 +--- a/Makefile.config.in ++++ b/Makefile.config.in +@@ -95,10 +95,10 @@ PROJ_internal_prefix := $(prefix) + endif + + PROJ_bindir := $(PROJ_prefix)/bin +-PROJ_libdir := $(PROJ_prefix)/lib ++PROJ_libdir := $(PROJ_prefix)/$(GENTOO_LIBDIR) + PROJ_datadir := $(PROJ_prefix)/share +-PROJ_docsdir := $(PROJ_prefix)/docs/llvm +-PROJ_etcdir := $(PROJ_prefix)/etc/llvm ++PROJ_docsdir := $(PROJ_prefix)/share/doc/@PF@ ++PROJ_etcdir := @EPREFIX@/etc/llvm + PROJ_includedir := $(PROJ_prefix)/include + PROJ_infodir := $(PROJ_prefix)/info + PROJ_mandir := $(PROJ_prefix)/share/man +diff --git a/Makefile.rules b/Makefile.rules +index e53598b..217f754 100644 +--- a/Makefile.rules ++++ b/Makefile.rules +@@ -275,7 +275,7 @@ ifeq ($(ENABLE_OPTIMIZED),1) + BuildMode := Release + # Don't use -fomit-frame-pointer on Darwin or FreeBSD. + ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin Darwin DragonFly FreeBSD GNU/kFreeBSD)) +- OmitFramePointer := -fomit-frame-pointer ++ OmitFramePointer := + endif + + CXX.Flags += $(OPTIMIZE_OPTION) $(OmitFramePointer) +diff --git a/tools/llvm-config/BuildVariables.inc.in b/tools/llvm-config/BuildVariables.inc.in +index fe87afb..fd9f2c6 100644 +--- a/tools/llvm-config/BuildVariables.inc.in ++++ b/tools/llvm-config/BuildVariables.inc.in +@@ -25,3 +25,4 @@ + #define LLVM_BUILDMODE "@LLVM_BUILDMODE@" + #define LLVM_TARGETS_BUILT "@LLVM_TARGETS_BUILT@" + #define LLVM_SYSTEM_LIBS "@LLVM_SYSTEM_LIBS@" ++#define LLVM_LIBDIR "@LLVM_LIBDIR@" +diff --git a/tools/llvm-config/Makefile b/tools/llvm-config/Makefile +index b20b6bf..fc56781 100644 +--- a/tools/llvm-config/Makefile ++++ b/tools/llvm-config/Makefile +@@ -55,6 +55,8 @@ $(ObjDir)/BuildVariables.inc: $(BUILDVARIABLES_SRCPATH) Makefile $(ObjDir)/.dir + >> temp.sed + $(Verb) $(ECHO) 's/@LLVM_TARGETS_BUILT@/$(subst /,\/,$(TARGETS_TO_BUILD))/' \ + >> temp.sed ++ $(Verb) $(ECHO) 's/@LLVM_LIBDIR@/$(subst /,\/,$(GENTOO_LIBDIR))/' \ ++ >> temp.sed + $(Verb) $(SED) -f temp.sed < $< > $@ + $(Verb) $(RM) temp.sed + +diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp +index 3924e2e..f439c60 100644 +--- a/tools/llvm-config/llvm-config.cpp ++++ b/tools/llvm-config/llvm-config.cpp +@@ -250,7 +250,7 @@ int main(int argc, char **argv) { + ActivePrefix = CurrentExecPrefix; + ActiveIncludeDir = ActivePrefix + "/include"; + ActiveBinDir = ActivePrefix + "/bin"; +- ActiveLibDir = ActivePrefix + "/lib"; ++ ActiveLibDir = ActivePrefix + "/" LLVM_LIBDIR; + ActiveIncludeOption = "-I" + ActiveIncludeDir; + } + +-- +1.8.4.2 + diff --git a/sys-devel/llvm/files/llvm-3.5.0-fix_LLVMExports_cmake.patch b/sys-devel/llvm/files/llvm-3.5.0-fix_LLVMExports_cmake.patch new file mode 100644 index 000000000000..9fbd7b73f169 --- /dev/null +++ b/sys-devel/llvm/files/llvm-3.5.0-fix_LLVMExports_cmake.patch @@ -0,0 +1,39 @@ +Index: cmake/modules/Makefile +=================================================================== +--- cmake/modules/Makefile (revision 217451) ++++ cmake/modules/Makefile (working copy) +@@ -33,6 +33,16 @@ + LLVM_ENABLE_RTTI := 0 + endif + ++LLVM_LIBS_TO_EXPORT := $(subst -l,,$(shell $(LLVM_CONFIG) --libs $(LINK_COMPONENTS) || echo Error)) ++ ++ifeq ($(LLVM_LIBS_TO_EXPORT),Error) ++$(error llvm-config --libs failed) ++endif ++ ++ifndef LLVM_LIBS_TO_EXPORT ++$(error LLVM_LIBS_TO_EXPORT cannot be empty) ++endif ++ + OBJMODS := LLVMConfig.cmake LLVMConfigVersion.cmake LLVMExports.cmake + + $(PROJ_OBJ_DIR)/LLVMConfig.cmake: LLVMConfig.cmake.in $(LLVMBuildCMakeFrag) +@@ -45,7 +55,7 @@ + -e 's/@LLVM_VERSION_PATCH@/'"$(LLVM_VERSION_PATCH)"'/' \ + -e 's/@PACKAGE_VERSION@/'"$(LLVMVersion)"'/' \ + -e 's/@LLVM_COMMON_DEPENDS@//' \ +- -e 's/@LLVM_AVAILABLE_LIBS@/'"$(subst -l,,$(LLVMConfigLibs))"'/' \ ++ -e 's/@LLVM_AVAILABLE_LIBS@/'"$(LLVM_LIBS_TO_EXPORT)"'/' \ + -e 's/@LLVM_ALL_TARGETS@/'"$(ALL_TARGETS)"'/' \ + -e 's/@LLVM_TARGETS_TO_BUILD@/'"$(TARGETS_TO_BUILD)"'/' \ + -e 's/@LLVM_TARGETS_WITH_JIT@/'"$(TARGETS_WITH_JIT)"'/' \ +@@ -83,7 +93,7 @@ + $(Echo) 'Generating LLVM CMake target exports file' + $(Verb) ( \ + echo '# LLVM CMake target exports. Do not include directly.' && \ +- for lib in $(subst -l,,$(LLVMConfigLibs)); do \ ++ for lib in $(LLVM_LIBS_TO_EXPORT); do \ + echo 'add_library('"$$lib"' STATIC IMPORTED)' && \ + echo 'set_property(TARGET '"$$lib"' PROPERTY IMPORTED_LOCATION "'"$(PROJ_libdir)/lib$$lib.a"'")' ; \ + done && \ diff --git a/sys-devel/llvm/files/llvm-3.5.2-gcc-5.1.patch b/sys-devel/llvm/files/llvm-3.5.2-gcc-5.1.patch new file mode 100644 index 000000000000..7cb2817561c1 --- /dev/null +++ b/sys-devel/llvm/files/llvm-3.5.2-gcc-5.1.patch @@ -0,0 +1,14 @@ +Index: include/llvm/ADT/IntrusiveRefCntPtr.h +=================================================================== +--- include/llvm/ADT/IntrusiveRefCntPtr.h (revision 218294) ++++ include/llvm/ADT/IntrusiveRefCntPtr.h (revision 218295) +@@ -197,6 +197,9 @@ + private: + void retain() { if (Obj) IntrusiveRefCntPtrInfo<T>::retain(Obj); } + void release() { if (Obj) IntrusiveRefCntPtrInfo<T>::release(Obj); } ++ ++ template <typename X> ++ friend class IntrusiveRefCntPtr; + }; + + template<class T, class U> diff --git a/sys-devel/llvm/files/llvm-3.6-gentoo-install.patch b/sys-devel/llvm/files/llvm-3.6-gentoo-install.patch new file mode 100644 index 000000000000..c4d0db2c0743 --- /dev/null +++ b/sys-devel/llvm/files/llvm-3.6-gentoo-install.patch @@ -0,0 +1,82 @@ +From bb016afeba4d9e886e776565a508634a261111a2 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org> +Date: Wed, 31 Dec 2014 11:26:12 +0100 +Subject: [PATCH] gentoo build fixes + +--- + Makefile.config.in | 6 +++--- + Makefile.rules | 2 +- + tools/llvm-config/BuildVariables.inc.in | 1 + + tools/llvm-config/Makefile | 2 ++ + tools/llvm-config/llvm-config.cpp | 2 +- + 5 files changed, 8 insertions(+), 5 deletions(-) + +diff --git a/Makefile.config.in b/Makefile.config.in +index d34a2d5..a26cd08 100644 +--- a/Makefile.config.in ++++ b/Makefile.config.in +@@ -99,10 +99,10 @@ PROJ_internal_prefix := $(prefix) + endif + + PROJ_bindir := $(PROJ_prefix)/bin +-PROJ_libdir := $(PROJ_prefix)/lib ++PROJ_libdir := $(PROJ_prefix)/$(GENTOO_LIBDIR) + PROJ_datadir := $(PROJ_prefix)/share +-PROJ_docsdir := $(PROJ_prefix)/docs/llvm +-PROJ_etcdir := $(PROJ_prefix)/etc/llvm ++PROJ_docsdir := $(PROJ_prefix)/share/doc/@PF@ ++PROJ_etcdir := @EPREFIX@/etc/llvm + PROJ_includedir := $(PROJ_prefix)/include + PROJ_infodir := $(PROJ_prefix)/info + PROJ_mandir := $(PROJ_prefix)/share/man +diff --git a/Makefile.rules b/Makefile.rules +index c8c971f..d1258b1 100644 +--- a/Makefile.rules ++++ b/Makefile.rules +@@ -283,7 +283,7 @@ ifeq ($(ENABLE_OPTIMIZED),1) + BuildMode := Release + # Don't use -fomit-frame-pointer on Darwin or FreeBSD. + ifneq ($(HOST_OS), $(filter $(HOST_OS), Cygwin Darwin DragonFly FreeBSD GNU/kFreeBSD)) +- OmitFramePointer := -fomit-frame-pointer ++ OmitFramePointer := + endif + + CXX.Flags += $(OPTIMIZE_OPTION) $(OmitFramePointer) +diff --git a/tools/llvm-config/BuildVariables.inc.in b/tools/llvm-config/BuildVariables.inc.in +index 3f51f49..513ea89 100644 +--- a/tools/llvm-config/BuildVariables.inc.in ++++ b/tools/llvm-config/BuildVariables.inc.in +@@ -26,3 +26,4 @@ + #define LLVM_LIBDIR_SUFFIX "@LLVM_LIBDIR_SUFFIX@" + #define LLVM_TARGETS_BUILT "@LLVM_TARGETS_BUILT@" + #define LLVM_SYSTEM_LIBS "@LLVM_SYSTEM_LIBS@" ++#define LLVM_LIBDIR "@LLVM_LIBDIR@" +diff --git a/tools/llvm-config/Makefile b/tools/llvm-config/Makefile +index 1ff8b6f..5d73c6e 100644 +--- a/tools/llvm-config/Makefile ++++ b/tools/llvm-config/Makefile +@@ -65,6 +65,8 @@ $(ObjDir)/BuildVariables.inc: $(BUILDVARIABLES_SRCPATH) Makefile $(ObjDir)/.dir + >> temp.sed + $(Verb) $(ECHO) 's/@LLVM_TARGETS_BUILT@/$(subst /,\/,$(TARGETS_TO_BUILD))/' \ + >> temp.sed ++ $(Verb) $(ECHO) 's/@LLVM_LIBDIR@/$(subst /,\/,$(GENTOO_LIBDIR))/' \ ++ >> temp.sed + $(Verb) $(SED) -f temp.sed < $< > $@ + $(Verb) $(RM) temp.sed + +diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp +index 224035a..57180ac 100644 +--- a/tools/llvm-config/llvm-config.cpp ++++ b/tools/llvm-config/llvm-config.cpp +@@ -265,7 +265,7 @@ int main(int argc, char **argv) { + ActivePrefix = CurrentExecPrefix; + ActiveIncludeDir = ActivePrefix + "/include"; + ActiveBinDir = ActivePrefix + "/bin"; +- ActiveLibDir = ActivePrefix + "/lib" + LLVM_LIBDIR_SUFFIX; ++ ActiveLibDir = ActivePrefix + "/" LLVM_LIBDIR; + ActiveIncludeOption = "-I" + ActiveIncludeDir; + } + +-- +2.2.1 + diff --git a/sys-devel/llvm/files/llvm-3.6.0-ocaml-ctypes-0.4.0.patch b/sys-devel/llvm/files/llvm-3.6.0-ocaml-ctypes-0.4.0.patch new file mode 100644 index 000000000000..154c9cc25f77 --- /dev/null +++ b/sys-devel/llvm/files/llvm-3.6.0-ocaml-ctypes-0.4.0.patch @@ -0,0 +1,35 @@ +diff -Naur llvm-3.6.0.src.orig/bindings/ocaml/executionengine/llvm_executionengine.ml llvm-3.6.0.src/bindings/ocaml/executionengine/llvm_executionengine.ml +--- llvm-3.6.0.src.orig/bindings/ocaml/executionengine/llvm_executionengine.ml 2015-03-17 11:49:27.274824345 +0100 ++++ llvm-3.6.0.src/bindings/ocaml/executionengine/llvm_executionengine.ml 2015-03-17 11:49:40.333829421 +0100 +@@ -43,11 +43,11 @@ + = "llvm_ee_run_static_dtors" + external data_layout : llexecutionengine -> Llvm_target.DataLayout.t + = "llvm_ee_get_data_layout" +-external add_global_mapping_ : Llvm.llvalue -> int64 -> llexecutionengine -> unit ++external add_global_mapping_ : Llvm.llvalue -> nativeint -> llexecutionengine -> unit + = "llvm_ee_add_global_mapping" +-external get_global_value_address_ : string -> llexecutionengine -> int64 ++external get_global_value_address_ : string -> llexecutionengine -> nativeint + = "llvm_ee_get_global_value_address" +-external get_function_address_ : string -> llexecutionengine -> int64 ++external get_function_address_ : string -> llexecutionengine -> nativeint + = "llvm_ee_get_function_address" + + let add_global_mapping llval ptr ee = +@@ -55,14 +55,14 @@ + + let get_global_value_address name typ ee = + let vptr = get_global_value_address_ name ee in +- if Int64.to_int vptr <> 0 then ++ if Nativeint.to_int vptr <> 0 then + let open Ctypes in !@ (coerce (ptr void) (ptr typ) (ptr_of_raw_address vptr)) + else + raise (Error ("Value " ^ name ^ " not found")) + + let get_function_address name typ ee = + let fptr = get_function_address_ name ee in +- if Int64.to_int fptr <> 0 then ++ if Nativeint.to_int fptr <> 0 then + let open Ctypes in coerce (ptr void) typ (ptr_of_raw_address fptr) + else + raise (Error ("Function " ^ name ^ " not found")) diff --git a/sys-devel/llvm/files/llvm-3.7-nodoctargz.patch b/sys-devel/llvm/files/llvm-3.7-nodoctargz.patch new file mode 100644 index 000000000000..86905234779f --- /dev/null +++ b/sys-devel/llvm/files/llvm-3.7-nodoctargz.patch @@ -0,0 +1,49 @@ +--- docs/Makefile.orig 2012-04-30 17:00:01.000000000 +0200 ++++ docs/Makefile 2012-04-30 17:15:52.000000000 +0200 +@@ -52,11 +52,10 @@ + # 'make generated BUILD_FOR_WEBSITE=1' + generated:: $(generated_targets) + +-install-html: $(PROJ_OBJ_DIR)/html.tar.gz ++install-html: + $(Echo) Installing HTML documentation + $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/html + $(Verb) $(DataInstall) $(HTML) $(DESTDIR)$(PROJ_docsdir)/html +- $(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/html.tar.gz $(DESTDIR)$(PROJ_docsdir) + + $(PROJ_OBJ_DIR)/html.tar.gz: $(HTML) + $(Echo) Packaging HTML documentation +@@ -68,12 +67,11 @@ + + install-doxygen: doxygen + $(Echo) Installing doxygen documentation +- $(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/doxygen.tar.gz $(DESTDIR)$(PROJ_docsdir) + $(Verb) cd $(PROJ_OBJ_DIR)/doxygen/html && \ + for DIR in $$($(FIND) . -type d); do \ + DESTSUB="$(DESTDIR)$(PROJ_docsdir)/html/doxygen/$$(echo $$DIR | cut -c 3-)"; \ + $(MKDIR) $$DESTSUB && \ + $(FIND) $$DIR -maxdepth 1 -type f -exec $(DataInstall) {} $$DESTSUB \; ; \ + if [ $$? != 0 ]; then exit 1; fi \ + done + +-doxygen: regendoc $(PROJ_OBJ_DIR)/doxygen.tar.gz ++doxygen: regendoc + + regendoc: + $(Echo) Building doxygen documentation +@@ -99,7 +97,6 @@ + install-ocamldoc: ocamldoc + $(Echo) Installing ocamldoc documentation + $(Verb) $(MKDIR) $(DESTDIR)$(PROJ_docsdir)/ocamldoc/html +- $(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/ocamldoc.tar.gz $(DESTDIR)$(PROJ_docsdir) + $(Verb) cd $(PROJ_OBJ_DIR)/ocamldoc && \ + $(FIND) . -type f -exec \ + $(DataInstall) {} $(DESTDIR)$(PROJ_docsdir)/ocamldoc/html \; +@@ -109,7 +106,6 @@ + $(Verb) $(RM) -rf $(PROJ_OBJ_DIR)/ocamldoc.tar* + $(Verb) $(TAR) cf $(PROJ_OBJ_DIR)/ocamldoc.tar ocamldoc + $(Verb) $(GZIPBIN) $(PROJ_OBJ_DIR)/ocamldoc.tar +- $(Verb) $(CP) $(PROJ_OBJ_DIR)/ocamldoc.tar.gz $(PROJ_OBJ_DIR)/ocamldoc/html/ + + regen-ocamldoc: + $(Echo) Building ocamldoc documentation diff --git a/sys-devel/llvm/llvm-2.8-r2.ebuild b/sys-devel/llvm/llvm-2.8-r2.ebuild new file mode 100644 index 000000000000..ed5e5427de51 --- /dev/null +++ b/sys-devel/llvm/llvm-2.8-r2.ebuild @@ -0,0 +1,168 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI="4" +inherit eutils multilib toolchain-funcs + +DESCRIPTION="Low Level Virtual Machine" +HOMEPAGE="http://llvm.org/" +# Upstream silently re-released the tarball... +# drop the -> in 2.9 +SRC_URI="http://llvm.org/releases/${PV}/${P}.tgz -> ${P}-r1.tgz" + +LICENSE="UoI-NCSA" +SLOT="0" +KEYWORDS="amd64 ppc x86 ~amd64-linux ~x86-linux ~ppc-macos" +IUSE="debug +libffi multitarget ocaml test udis86" + +DEPEND="dev-lang/perl + >=sys-devel/make-3.79 + >=sys-devel/flex-2.5.4 + >=sys-devel/bison-1.875d + || ( >=sys-devel/gcc-3.0 >=sys-devel/gcc-apple-4.2.1 ) + || ( >=sys-devel/binutils-2.18 >=sys-devel/binutils-apple-3.2.3 ) + libffi? ( virtual/libffi ) + ocaml? ( dev-lang/ocaml ) + udis86? ( dev-libs/udis86[pic(+)] )" +RDEPEND="dev-lang/perl" + +S=${WORKDIR}/${PN}-${PV/_pre*} + +pkg_setup() { + # need to check if the active compiler is ok + + broken_gcc=" 3.2.2 3.2.3 3.3.2 4.1.1 " + broken_gcc_x86=" 3.4.0 3.4.2 " + broken_gcc_amd64=" 3.4.6 " + + gcc_vers=$(gcc-fullversion) + + if [[ ${broken_gcc} == *" ${version} "* ]] ; then + elog "Your version of gcc is known to miscompile llvm." + elog "Check http://www.llvm.org/docs/GettingStarted.html for" + elog "possible solutions." + die "Your currently active version of gcc is known to miscompile llvm" + fi + + if [[ ${CHOST} == i*86-* && ${broken_gcc_x86} == *" ${version} "* ]] ; then + elog "Your version of gcc is known to miscompile llvm on x86" + elog "architectures. Check" + elog "http://www.llvm.org/docs/GettingStarted.html for possible" + elog "solutions." + die "Your currently active version of gcc is known to miscompile llvm" + fi + + if [[ ${CHOST} == x86_64-* && ${broken_gcc_amd64} == *" ${version} "* ]]; + then + elog "Your version of gcc is known to miscompile llvm in amd64" + elog "architectures. Check" + elog "http://www.llvm.org/docs/GettingStarted.html for possible" + elog "solutions." + die "Your currently active version of gcc is known to miscompile llvm" + fi +} + +src_prepare() { + # unfortunately ./configure won't listen to --mandir and the-like, so take + # care of this. + einfo "Fixing install dirs" + sed -e 's,^PROJ_docsdir.*,PROJ_docsdir := $(PROJ_prefix)/share/doc/'${PF}, \ + -e 's,^PROJ_etcdir.*,PROJ_etcdir := '"${EPREFIX}"'/etc/llvm,' \ + -e 's,^PROJ_libdir.*,PROJ_libdir := $(PROJ_prefix)/'$(get_libdir)/${PN}, \ + -i Makefile.config.in || die "Makefile.config sed failed" + sed -e 's,$ABS_RUN_DIR/lib,'"${EPREFIX}"/usr/$(get_libdir)/${PN}, \ + -i tools/llvm-config/llvm-config.in.in || die "llvm-config sed failed" + + einfo "Fixing rpath and CFLAGS" + sed -e 's,\$(RPATH) -Wl\,\$(\(ToolDir\|LibDir\)),$(RPATH) -Wl\,'"${EPREFIX}"/usr/$(get_libdir)/${PN}, \ + -e '/OmitFramePointer/s/-fomit-frame-pointer//' \ + -i Makefile.rules || die "rpath sed failed" + + epatch "${FILESDIR}"/${PN}-2.7-nodoctargz.patch + epatch "${FILESDIR}"/${PN}-2.6-commandguide-nops.patch + epatch "${FILESDIR}"/${PN}-2.8-darwin8.patch + # Upstream backport, r117774 + epatch "${FILESDIR}"/${P}-alignof.patch + + # Additional unistd.h include for GCC 4.7 + epatch "${FILESDIR}"/${PN}-2.9-gcc4.7.patch + + # User patches + epatch_user +} + +src_configure() { + local CONF_FLAGS="--enable-shared" + + if use debug; then + CONF_FLAGS="${CONF_FLAGS} --disable-optimized" + einfo "Note: Compiling LLVM in debug mode will create huge and slow binaries" + # ...and you probably shouldn't use tmpfs, unless it can hold 900MB + else + CONF_FLAGS="${CONF_FLAGS} \ + --enable-optimized \ + --with-optimize-option= \ + --disable-assertions \ + --disable-expensive-checks" + fi + + if use multitarget; then + CONF_FLAGS="${CONF_FLAGS} --enable-targets=all" + else + CONF_FLAGS="${CONF_FLAGS} --enable-targets=host-only" + fi + + if use amd64; then + CONF_FLAGS="${CONF_FLAGS} --enable-pic" + fi + + CONF_FLAGS="${CONF_FLAGS} \ + --with-llvmgccdir=/dev/null \ + --with-llvmgcc=nope \ + --with-llvmgxx=nope" + + if use ocaml; then + CONF_FLAGS="${CONF_FLAGS} --enable-bindings=ocaml" + else + CONF_FLAGS="${CONF_FLAGS} --enable-bindings=none" + fi + + if use udis86; then + CONF_FLAGS="${CONF_FLAGS} --with-udis86" + fi + CONF_FLAGS="${CONF_FLAGS} $(use_enable libffi)" + econf ${CONF_FLAGS} || die "econf failed" +} + +src_compile() { + emake VERBOSE=1 KEEP_SYMBOLS=1 REQUIRES_RTTI=1 || die "emake failed" +} + +src_install() { + emake KEEP_SYMBOLS=1 DESTDIR="${D}" install || die "install failed" + + # Fix install_names on Darwin. The build system is too complicated + # to just fix this, so we correct it post-install + local lib= f= odylib= + if [[ ${CHOST} == *-darwin* ]] ; then + for lib in lib{EnhancedDisassembly,LLVM-${PV},BugpointPasses,LLVMHello,LTO,profile_rt}.dylib ; do + # libEnhancedDisassembly is Darwin10 only, so non-fatal + [[ -f ${ED}/usr/lib/${PN}/${lib} ]] || continue + ebegin "fixing install_name of $lib" + install_name_tool \ + -id "${EPREFIX}"/usr/lib/${PN}/${lib} \ + "${ED}"/usr/lib/${PN}/${lib} + eend $? + done + for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/${PN}/libLTO.dylib ; do + odylib=$(scanmacho -BF'%n#f' "${f}" | tr ',' '\n' | grep libLLVM-${PV}.dylib) + ebegin "fixing install_name reference to ${odylib} of ${f##*/}" + install_name_tool \ + -change "${odylib}" \ + "${EPREFIX}"/usr/lib/${PN}/libLLVM-${PV}.dylib \ + "${f}" + eend $? + done + fi +} diff --git a/sys-devel/llvm/llvm-2.9-r2.ebuild b/sys-devel/llvm/llvm-2.9-r2.ebuild new file mode 100644 index 000000000000..515e38739f5d --- /dev/null +++ b/sys-devel/llvm/llvm-2.9-r2.ebuild @@ -0,0 +1,175 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI="4" +inherit eutils flag-o-matic multilib toolchain-funcs pax-utils + +DESCRIPTION="Low Level Virtual Machine" +HOMEPAGE="http://llvm.org/" +SRC_URI="http://llvm.org/releases/${PV}/${P}.tgz" + +LICENSE="UoI-NCSA" +SLOT="0" +KEYWORDS="amd64 ~ppc x86 ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos" +IUSE="debug +libffi multitarget ocaml test udis86 vim-syntax" + +DEPEND="dev-lang/perl + >=sys-devel/make-3.79 + >=sys-devel/flex-2.5.4 + >=sys-devel/bison-1.875d + || ( >=sys-devel/gcc-3.0 >=sys-devel/gcc-apple-4.2.1 ) + || ( >=sys-devel/binutils-2.18 >=sys-devel/binutils-apple-3.2.3 ) + libffi? ( virtual/pkgconfig + virtual/libffi ) + ocaml? ( dev-lang/ocaml ) + udis86? ( dev-libs/udis86[pic(+)] )" +RDEPEND="dev-lang/perl + libffi? ( virtual/libffi ) + vim-syntax? ( || ( app-editors/vim app-editors/gvim ) )" + +S=${WORKDIR}/${PN}-${PV/_pre*} + +pkg_setup() { + # need to check if the active compiler is ok + + broken_gcc=" 3.2.2 3.2.3 3.3.2 4.1.1 " + broken_gcc_x86=" 3.4.0 3.4.2 " + broken_gcc_amd64=" 3.4.6 " + + gcc_vers=$(gcc-fullversion) + + if [[ ${broken_gcc} == *" ${version} "* ]] ; then + elog "Your version of gcc is known to miscompile llvm." + elog "Check http://www.llvm.org/docs/GettingStarted.html for" + elog "possible solutions." + die "Your currently active version of gcc is known to miscompile llvm" + fi + + if [[ ${CHOST} == i*86-* && ${broken_gcc_x86} == *" ${version} "* ]] ; then + elog "Your version of gcc is known to miscompile llvm on x86" + elog "architectures. Check" + elog "http://www.llvm.org/docs/GettingStarted.html for possible" + elog "solutions." + die "Your currently active version of gcc is known to miscompile llvm" + fi + + if [[ ${CHOST} == x86_64-* && ${broken_gcc_amd64} == *" ${version} "* ]]; + then + elog "Your version of gcc is known to miscompile llvm in amd64" + elog "architectures. Check" + elog "http://www.llvm.org/docs/GettingStarted.html for possible" + elog "solutions." + die "Your currently active version of gcc is known to miscompile llvm" + fi +} + +src_prepare() { + # unfortunately ./configure won't listen to --mandir and the-like, so take + # care of this. + einfo "Fixing install dirs" + sed -e 's,^PROJ_docsdir.*,PROJ_docsdir := $(PROJ_prefix)/share/doc/'${PF}, \ + -e 's,^PROJ_etcdir.*,PROJ_etcdir := '"${EPREFIX}"'/etc/llvm,' \ + -e 's,^PROJ_libdir.*,PROJ_libdir := $(PROJ_prefix)/'$(get_libdir)/${PN}, \ + -i Makefile.config.in || die "Makefile.config sed failed" + sed -e 's,$ABS_RUN_DIR/lib,'"${EPREFIX}"/usr/$(get_libdir)/${PN}, \ + -i tools/llvm-config/llvm-config.in.in || die "llvm-config sed failed" + + einfo "Fixing rpath and CFLAGS" + sed -e 's,\$(RPATH) -Wl\,\$(\(ToolDir\|LibDir\)),$(RPATH) -Wl\,'"${EPREFIX}"/usr/$(get_libdir)/${PN}, \ + -e '/OmitFramePointer/s/-fomit-frame-pointer//' \ + -i Makefile.rules || die "rpath sed failed" + + epatch "${FILESDIR}"/${PN}-2.6-commandguide-nops.patch + epatch "${FILESDIR}"/${PN}-2.9-nodoctargz.patch + + # Upstream commit r131062 + epatch "${FILESDIR}"/${P}-Operator.h-c++0x.patch + + # Additional unistd.h include for GCC 4.7 + epatch "${FILESDIR}"/${P}-gcc4.7.patch + + # User patches + epatch_user +} + +src_configure() { + local CONF_FLAGS="--enable-shared + --with-optimize-option= + $(use_enable !debug optimized) + $(use_enable debug assertions) + $(use_enable debug expensive-checks)" + + if use multitarget; then + CONF_FLAGS="${CONF_FLAGS} --enable-targets=all" + else + CONF_FLAGS="${CONF_FLAGS} --enable-targets=host-only" + fi + + if use amd64; then + CONF_FLAGS="${CONF_FLAGS} --enable-pic" + fi + + CONF_FLAGS="${CONF_FLAGS} \ + --with-llvmgccdir=/dev/null \ + --with-llvmgcc=nope \ + --with-llvmgxx=nope" + + if use ocaml; then + CONF_FLAGS="${CONF_FLAGS} --enable-bindings=ocaml" + else + CONF_FLAGS="${CONF_FLAGS} --enable-bindings=none" + fi + + if use udis86; then + CONF_FLAGS="${CONF_FLAGS} --with-udis86" + fi + + if use libffi; then + append-cppflags "$(pkg-config --cflags libffi)" + fi + CONF_FLAGS="${CONF_FLAGS} $(use_enable libffi)" + econf ${CONF_FLAGS} || die "econf failed" +} + +src_compile() { + emake VERBOSE=1 KEEP_SYMBOLS=1 REQUIRES_RTTI=1 || die "emake failed" + + pax-mark m Release/bin/lli + if use test; then + pax-mark m unittests/ExecutionEngine/JIT/Release/JITTests + fi +} + +src_install() { + emake KEEP_SYMBOLS=1 DESTDIR="${D}" install || die "install failed" + + if use vim-syntax; then + insinto /usr/share/vim/vimfiles/syntax + doins utils/vim/*.vim + fi + + # Fix install_names on Darwin. The build system is too complicated + # to just fix this, so we correct it post-install + local lib= f= odylib= + if [[ ${CHOST} == *-darwin* ]] ; then + for lib in lib{EnhancedDisassembly,LLVM-${PV},LTO}.dylib {BugpointPasses,LLVMHello,profile_rt}.dylib ; do + # libEnhancedDisassembly is Darwin10 only, so non-fatal + [[ -f ${ED}/usr/lib/${PN}/${lib} ]] || continue + ebegin "fixing install_name of $lib" + install_name_tool \ + -id "${EPREFIX}"/usr/lib/${PN}/${lib} \ + "${ED}"/usr/lib/${PN}/${lib} + eend $? + done + for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/${PN}/libLTO.dylib ; do + odylib=$(scanmacho -BF'%n#f' "${f}" | tr ',' '\n' | grep libLLVM-${PV}.dylib) + ebegin "fixing install_name reference to ${odylib} of ${f##*/}" + install_name_tool \ + -change "${odylib}" \ + "${EPREFIX}"/usr/lib/${PN}/libLLVM-${PV}.dylib \ + "${f}" + eend $? + done + fi +} diff --git a/sys-devel/llvm/llvm-3.0-r2.ebuild b/sys-devel/llvm/llvm-3.0-r2.ebuild new file mode 100644 index 000000000000..a0caca12b07d --- /dev/null +++ b/sys-devel/llvm/llvm-3.0-r2.ebuild @@ -0,0 +1,181 @@ +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI="4" +PYTHON_DEPEND="2" +inherit eutils flag-o-matic multilib toolchain-funcs python pax-utils + +DESCRIPTION="Low Level Virtual Machine" +HOMEPAGE="http://llvm.org/" +SRC_URI="http://llvm.org/releases/${PV}/${P}.tar.gz" + +LICENSE="UoI-NCSA" +SLOT="0" +KEYWORDS="amd64 ~ppc x86 ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos" +IUSE="debug gold +libffi multitarget ocaml test udis86 vim-syntax" + +DEPEND="dev-lang/perl + >=sys-devel/make-3.79 + >=sys-devel/flex-2.5.4 + >=sys-devel/bison-1.875d + || ( >=sys-devel/gcc-3.0 >=sys-devel/gcc-apple-4.2.1 ) + || ( >=sys-devel/binutils-2.18 >=sys-devel/binutils-apple-3.2.3 ) + gold? ( >=sys-devel/binutils-2.22[cxx] ) + libffi? ( virtual/pkgconfig + virtual/libffi ) + ocaml? ( dev-lang/ocaml ) + udis86? ( dev-libs/udis86[pic(+)] )" +RDEPEND="dev-lang/perl + libffi? ( virtual/libffi ) + vim-syntax? ( || ( app-editors/vim app-editors/gvim ) )" + +S=${WORKDIR}/${P}.src + +pkg_setup() { + # Required for test and build + python_set_active_version 2 + python_pkg_setup + + # need to check if the active compiler is ok + + broken_gcc=" 3.2.2 3.2.3 3.3.2 4.1.1 " + broken_gcc_x86=" 3.4.0 3.4.2 " + broken_gcc_amd64=" 3.4.6 " + + gcc_vers=$(gcc-fullversion) + + if [[ ${broken_gcc} == *" ${version} "* ]] ; then + elog "Your version of gcc is known to miscompile llvm." + elog "Check http://www.llvm.org/docs/GettingStarted.html for" + elog "possible solutions." + die "Your currently active version of gcc is known to miscompile llvm" + fi + + if [[ ${CHOST} == i*86-* && ${broken_gcc_x86} == *" ${version} "* ]] ; then + elog "Your version of gcc is known to miscompile llvm on x86" + elog "architectures. Check" + elog "http://www.llvm.org/docs/GettingStarted.html for possible" + elog "solutions." + die "Your currently active version of gcc is known to miscompile llvm" + fi + + if [[ ${CHOST} == x86_64-* && ${broken_gcc_amd64} == *" ${version} "* ]]; + then + elog "Your version of gcc is known to miscompile llvm in amd64" + elog "architectures. Check" + elog "http://www.llvm.org/docs/GettingStarted.html for possible" + elog "solutions." + die "Your currently active version of gcc is known to miscompile llvm" + fi +} + +src_prepare() { + # unfortunately ./configure won't listen to --mandir and the-like, so take + # care of this. + einfo "Fixing install dirs" + sed -e 's,^PROJ_docsdir.*,PROJ_docsdir := $(PROJ_prefix)/share/doc/'${PF}, \ + -e 's,^PROJ_etcdir.*,PROJ_etcdir := '"${EPREFIX}"'/etc/llvm,' \ + -e 's,^PROJ_libdir.*,PROJ_libdir := $(PROJ_prefix)/'$(get_libdir)/${PN}, \ + -i Makefile.config.in || die "Makefile.config sed failed" + sed -e 's,$ABS_RUN_DIR/lib,'"${EPREFIX}"/usr/$(get_libdir)/${PN}, \ + -i tools/llvm-config/llvm-config.in.in || die "llvm-config sed failed" + + einfo "Fixing rpath and CFLAGS" + sed -e 's,\$(RPATH) -Wl\,\$(\(ToolDir\|LibDir\)),$(RPATH) -Wl\,'"${EPREFIX}"/usr/$(get_libdir)/${PN}, \ + -e '/OmitFramePointer/s/-fomit-frame-pointer//' \ + -i Makefile.rules || die "rpath sed failed" + + # Specify python version + python_convert_shebangs -r 2 test/Scripts + + epatch "${FILESDIR}"/${PN}-2.6-commandguide-nops.patch + epatch "${FILESDIR}"/${PN}-2.9-nodoctargz.patch + epatch "${FILESDIR}"/${P}-ocaml_install.patch + epatch "${FILESDIR}"/${P}-PPC_macro.patch + epatch "${FILESDIR}"/${P}-PPCCompilationCallbackC_static.patch + epatch "${FILESDIR}"/${P}-gold_LTO_link.patch + epatch "${FILESDIR}"/${P}-set_soname.patch + + # User patches + epatch_user +} + +src_configure() { + local CONF_FLAGS="--enable-shared + --with-optimize-option= + $(use_enable !debug optimized) + $(use_enable debug assertions) + $(use_enable debug expensive-checks)" + + if use multitarget; then + CONF_FLAGS="${CONF_FLAGS} --enable-targets=all" + else + CONF_FLAGS="${CONF_FLAGS} --enable-targets=host-only" + fi + + if use amd64; then + CONF_FLAGS="${CONF_FLAGS} --enable-pic" + fi + + if use gold; then + CONF_FLAGS="${CONF_FLAGS} --with-binutils-include=${EPREFIX}/usr/include/" + fi + if use ocaml; then + CONF_FLAGS="${CONF_FLAGS} --enable-bindings=ocaml" + else + CONF_FLAGS="${CONF_FLAGS} --enable-bindings=none" + fi + + if use udis86; then + CONF_FLAGS="${CONF_FLAGS} --with-udis86" + fi + + if use libffi; then + append-cppflags "$(pkg-config --cflags libffi)" + fi + CONF_FLAGS="${CONF_FLAGS} $(use_enable libffi)" + econf ${CONF_FLAGS} || die "econf failed" +} + +src_compile() { + emake VERBOSE=1 KEEP_SYMBOLS=1 REQUIRES_RTTI=1 || die "emake failed" + + pax-mark m Release/bin/lli + if use test; then + pax-mark m unittests/ExecutionEngine/JIT/Release/JITTests + fi +} + +src_install() { + emake KEEP_SYMBOLS=1 DESTDIR="${D}" install || die "install failed" + + if use vim-syntax; then + insinto /usr/share/vim/vimfiles/syntax + doins utils/vim/*.vim + fi + + # Fix install_names on Darwin. The build system is too complicated + # to just fix this, so we correct it post-install + local lib= f= odylib= + if [[ ${CHOST} == *-darwin* ]] ; then + for lib in lib{EnhancedDisassembly,LLVM-${PV},LTO,profile_rt}.dylib {BugpointPasses,LLVMHello}.dylib ; do + # libEnhancedDisassembly is Darwin10 only, so non-fatal + [[ -f ${ED}/usr/lib/${PN}/${lib} ]] || continue + ebegin "fixing install_name of $lib" + install_name_tool \ + -id "${EPREFIX}"/usr/lib/${PN}/${lib} \ + "${ED}"/usr/lib/${PN}/${lib} + eend $? + done + for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/${PN}/libLTO.dylib ; do + odylib=$(scanmacho -BF'%n#f' "${f}" | tr ',' '\n' | grep libLLVM-${PV}.dylib) + ebegin "fixing install_name reference to ${odylib} of ${f##*/}" + install_name_tool \ + -change "${odylib}" \ + "${EPREFIX}"/usr/lib/${PN}/libLLVM-${PV}.dylib \ + "${f}" + eend $? + done + fi +} diff --git a/sys-devel/llvm/llvm-3.1-r2.ebuild b/sys-devel/llvm/llvm-3.1-r2.ebuild new file mode 100644 index 000000000000..fd9ce132d8ea --- /dev/null +++ b/sys-devel/llvm/llvm-3.1-r2.ebuild @@ -0,0 +1,191 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI="4" +PYTHON_DEPEND="2" +inherit eutils flag-o-matic multilib toolchain-funcs python pax-utils + +DESCRIPTION="Low Level Virtual Machine" +HOMEPAGE="http://llvm.org/" +SRC_URI="http://llvm.org/releases/${PV}/${P}.src.tar.gz" + +LICENSE="UoI-NCSA" +SLOT="0" +KEYWORDS="amd64 arm ppc x86 ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos" +IUSE="debug gold +libffi multitarget ocaml test udis86 vim-syntax" + +DEPEND="dev-lang/perl + >=sys-devel/make-3.79 + >=sys-devel/flex-2.5.4 + >=sys-devel/bison-1.875d + || ( >=sys-devel/gcc-3.0 >=sys-devel/gcc-apple-4.2.1 ) + || ( >=sys-devel/binutils-2.18 >=sys-devel/binutils-apple-3.2.3 ) + gold? ( >=sys-devel/binutils-2.22[cxx] ) + libffi? ( virtual/pkgconfig + virtual/libffi ) + ocaml? ( dev-lang/ocaml ) + udis86? ( dev-libs/udis86[pic(+)] )" +RDEPEND="dev-lang/perl + libffi? ( virtual/libffi ) + vim-syntax? ( || ( app-editors/vim app-editors/gvim ) )" + +S=${WORKDIR}/${P}.src + +pkg_setup() { + # Required for test and build + python_set_active_version 2 + python_pkg_setup + + # need to check if the active compiler is ok + + broken_gcc=" 3.2.2 3.2.3 3.3.2 4.1.1 " + broken_gcc_x86=" 3.4.0 3.4.2 " + broken_gcc_amd64=" 3.4.6 " + + gcc_vers=$(gcc-fullversion) + + if [[ ${broken_gcc} == *" ${version} "* ]] ; then + elog "Your version of gcc is known to miscompile llvm." + elog "Check http://www.llvm.org/docs/GettingStarted.html for" + elog "possible solutions." + die "Your currently active version of gcc is known to miscompile llvm" + fi + + if [[ ${CHOST} == i*86-* && ${broken_gcc_x86} == *" ${version} "* ]] ; then + elog "Your version of gcc is known to miscompile llvm on x86" + elog "architectures. Check" + elog "http://www.llvm.org/docs/GettingStarted.html for possible" + elog "solutions." + die "Your currently active version of gcc is known to miscompile llvm" + fi + + if [[ ${CHOST} == x86_64-* && ${broken_gcc_amd64} == *" ${version} "* ]]; + then + elog "Your version of gcc is known to miscompile llvm in amd64" + elog "architectures. Check" + elog "http://www.llvm.org/docs/GettingStarted.html for possible" + elog "solutions." + die "Your currently active version of gcc is known to miscompile llvm" + fi +} + +src_prepare() { + # unfortunately ./configure won't listen to --mandir and the-like, so take + # care of this. + einfo "Fixing install dirs" + sed -e 's,^PROJ_docsdir.*,PROJ_docsdir := $(PROJ_prefix)/share/doc/'${PF}, \ + -e 's,^PROJ_etcdir.*,PROJ_etcdir := '"${EPREFIX}"'/etc/llvm,' \ + -e 's,^PROJ_libdir.*,PROJ_libdir := $(PROJ_prefix)/'$(get_libdir)/${PN}, \ + -i Makefile.config.in || die "Makefile.config sed failed" + sed -e "/ActiveLibDir = ActivePrefix/s/lib/$(get_libdir)\/${PN}/" \ + -i tools/llvm-config/llvm-config.cpp || die "llvm-config sed failed" + + einfo "Fixing rpath and CFLAGS" + sed -e 's,\$(RPATH) -Wl\,\$(\(ToolDir\|LibDir\)),$(RPATH) -Wl\,'"${EPREFIX}"/usr/$(get_libdir)/${PN}, \ + -e '/OmitFramePointer/s/-fomit-frame-pointer//' \ + -i Makefile.rules || die "rpath sed failed" + if use gold; then + sed -e 's,\$(SharedLibDir),'"${EPREFIX}"/usr/$(get_libdir)/${PN}, \ + -i tools/gold/Makefile || die "gold rpath sed failed" + fi + + # Specify python version + python_convert_shebangs -r 2 test/Scripts + + epatch "${FILESDIR}"/${PN}-2.6-commandguide-nops.patch + epatch "${FILESDIR}"/${PN}-2.9-nodoctargz.patch + epatch "${FILESDIR}"/${PN}-3.0-PPC_macro.patch + epatch "${FILESDIR}"/${P}-ivybridge_support.patch + epatch "${FILESDIR}"/${P}-fix_debug_line_info.patch + epatch "${FILESDIR}"/${P}-ExecutionEngine_tests_xfail_arm.patch + epatch "${FILESDIR}"/${P}-docs-pod-markup-fixes.patch + + # Apply r600 OpenCL-related patches, bug #425688 + epatch "${FILESDIR}"/cl-patches/*.patch + + # User patches + epatch_user +} + +src_configure() { + local CONF_FLAGS="--enable-shared + --with-optimize-option= + $(use_enable !debug optimized) + $(use_enable debug assertions) + $(use_enable debug expensive-checks)" + + if use multitarget; then + CONF_FLAGS="${CONF_FLAGS} --enable-targets=all" + else + CONF_FLAGS="${CONF_FLAGS} --enable-targets=host,cpp" + fi + + if use amd64; then + CONF_FLAGS="${CONF_FLAGS} --enable-pic" + fi + + if use gold; then + CONF_FLAGS="${CONF_FLAGS} --with-binutils-include=${EPREFIX}/usr/include/" + fi + if use ocaml; then + CONF_FLAGS="${CONF_FLAGS} --enable-bindings=ocaml" + else + CONF_FLAGS="${CONF_FLAGS} --enable-bindings=none" + fi + + if use udis86; then + CONF_FLAGS="${CONF_FLAGS} --with-udis86" + fi + + if use libffi; then + append-cppflags "$(pkg-config --cflags libffi)" + fi + CONF_FLAGS="${CONF_FLAGS} $(use_enable libffi)" + + # llvm prefers clang over gcc, so we may need to force that + tc-export CC CXX + econf ${CONF_FLAGS} +} + +src_compile() { + emake VERBOSE=1 KEEP_SYMBOLS=1 REQUIRES_RTTI=1 + + pax-mark m Release/bin/lli + if use test; then + pax-mark m unittests/ExecutionEngine/JIT/Release/JITTests + fi +} + +src_install() { + emake KEEP_SYMBOLS=1 DESTDIR="${D}" install + + if use vim-syntax; then + insinto /usr/share/vim/vimfiles/syntax + doins utils/vim/*.vim + fi + + # Fix install_names on Darwin. The build system is too complicated + # to just fix this, so we correct it post-install + local lib= f= odylib= + if [[ ${CHOST} == *-darwin* ]] ; then + for lib in lib{EnhancedDisassembly,LLVM-${PV},LTO,profile_rt}.dylib {BugpointPasses,LLVMHello}.dylib ; do + # libEnhancedDisassembly is Darwin10 only, so non-fatal + [[ -f ${ED}/usr/lib/${PN}/${lib} ]] || continue + ebegin "fixing install_name of $lib" + install_name_tool \ + -id "${EPREFIX}"/usr/lib/${PN}/${lib} \ + "${ED}"/usr/lib/${PN}/${lib} + eend $? + done + for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/${PN}/libLTO.dylib ; do + odylib=$(scanmacho -BF'%n#f' "${f}" | tr ',' '\n' | grep libLLVM-${PV}.dylib) + ebegin "fixing install_name reference to ${odylib} of ${f##*/}" + install_name_tool \ + -change "${odylib}" \ + "${EPREFIX}"/usr/lib/${PN}/libLLVM-${PV}.dylib \ + "${f}" + eend $? + done + fi +} diff --git a/sys-devel/llvm/llvm-3.2.ebuild b/sys-devel/llvm/llvm-3.2.ebuild new file mode 100644 index 000000000000..ffd5153077b3 --- /dev/null +++ b/sys-devel/llvm/llvm-3.2.ebuild @@ -0,0 +1,206 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI=5 + +# pypy gives me around 1700 unresolved tests due to open file limit +# being exceeded. probably GC does not close them fast enough. +PYTHON_COMPAT=( python2_7 ) + +inherit eutils flag-o-matic multilib python-any-r1 toolchain-funcs pax-utils + +DESCRIPTION="Low Level Virtual Machine" +HOMEPAGE="http://llvm.org/" +SRC_URI="http://llvm.org/releases/${PV}/${P}.src.tar.gz + !doc? ( http://dev.gentoo.org/~voyageur/distfiles/${P}-manpages.tar.bz2 )" + +LICENSE="UoI-NCSA" +SLOT="0/${PV}" +KEYWORDS="~amd64 ~arm ~ppc ~x86 ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos" +IUSE="debug doc gold +libffi multitarget ocaml test udis86 vim-syntax" + +DEPEND="dev-lang/perl + >=sys-devel/make-3.79 + >=sys-devel/flex-2.5.4 + >=sys-devel/bison-1.875d + || ( >=sys-devel/gcc-3.0 >=sys-devel/gcc-apple-4.2.1 ) + || ( >=sys-devel/binutils-2.18 >=sys-devel/binutils-apple-3.2.3 ) + doc? ( dev-python/sphinx ) + gold? ( >=sys-devel/binutils-2.22[cxx] ) + libffi? ( virtual/pkgconfig + virtual/libffi ) + ocaml? ( dev-lang/ocaml ) + udis86? ( dev-libs/udis86[pic(+)] ) + ${PYTHON_DEPS}" +RDEPEND="dev-lang/perl + libffi? ( virtual/libffi ) + vim-syntax? ( || ( app-editors/vim app-editors/gvim ) )" + +S=${WORKDIR}/${P}.src + +pkg_setup() { + # Required for test and build + python-any-r1_pkg_setup + + # need to check if the active compiler is ok + + broken_gcc=" 3.2.2 3.2.3 3.3.2 4.1.1 " + broken_gcc_x86=" 3.4.0 3.4.2 " + broken_gcc_amd64=" 3.4.6 " + + gcc_vers=$(gcc-fullversion) + + if [[ ${broken_gcc} == *" ${version} "* ]] ; then + elog "Your version of gcc is known to miscompile llvm." + elog "Check http://www.llvm.org/docs/GettingStarted.html for" + elog "possible solutions." + die "Your currently active version of gcc is known to miscompile llvm" + fi + + if [[ ${CHOST} == i*86-* && ${broken_gcc_x86} == *" ${version} "* ]] ; then + elog "Your version of gcc is known to miscompile llvm on x86" + elog "architectures. Check" + elog "http://www.llvm.org/docs/GettingStarted.html for possible" + elog "solutions." + die "Your currently active version of gcc is known to miscompile llvm" + fi + + if [[ ${CHOST} == x86_64-* && ${broken_gcc_amd64} == *" ${version} "* ]]; + then + elog "Your version of gcc is known to miscompile llvm in amd64" + elog "architectures. Check" + elog "http://www.llvm.org/docs/GettingStarted.html for possible" + elog "solutions." + die "Your currently active version of gcc is known to miscompile llvm" + fi +} + +src_prepare() { + # unfortunately ./configure won't listen to --mandir and the-like, so take + # care of this. + einfo "Fixing install dirs" + sed -e 's,^PROJ_docsdir.*,PROJ_docsdir := $(PROJ_prefix)/share/doc/'${PF}, \ + -e 's,^PROJ_etcdir.*,PROJ_etcdir := '"${EPREFIX}"'/etc/llvm,' \ + -e 's,^PROJ_libdir.*,PROJ_libdir := $(PROJ_prefix)/'$(get_libdir)/${PN}, \ + -i Makefile.config.in || die "Makefile.config sed failed" + sed -e "/ActiveLibDir = ActivePrefix/s/lib/$(get_libdir)\/${PN}/" \ + -i tools/llvm-config/llvm-config.cpp || die "llvm-config sed failed" + + einfo "Fixing rpath and CFLAGS" + sed -e 's,\$(RPATH) -Wl\,\$(\(ToolDir\|LibDir\)),$(RPATH) -Wl\,'"${EPREFIX}"/usr/$(get_libdir)/${PN}, \ + -e '/OmitFramePointer/s/-fomit-frame-pointer//' \ + -i Makefile.rules || die "rpath sed failed" + if use gold; then + sed -e 's,\$(SharedLibDir),'"${EPREFIX}"/usr/$(get_libdir)/${PN}, \ + -i tools/gold/Makefile || die "gold rpath sed failed" + fi + + # FileCheck is needed at least for dragonegg tests + sed -e "/NO_INSTALL = 1/s/^/#/" -i utils/FileCheck/Makefile \ + || die "FileCheck Makefile sed failed" + + epatch "${FILESDIR}"/${PN}-3.2-nodoctargz.patch + epatch "${FILESDIR}"/${PN}-3.0-PPC_macro.patch + + # User patches + epatch_user +} + +src_configure() { + local CONF_FLAGS="--enable-shared + --with-optimize-option= + $(use_enable !debug optimized) + $(use_enable debug assertions) + $(use_enable debug expensive-checks)" + + if use multitarget; then + CONF_FLAGS="${CONF_FLAGS} --enable-targets=all" + else + CONF_FLAGS="${CONF_FLAGS} --enable-targets=host,cpp" + fi + + if use amd64; then + CONF_FLAGS="${CONF_FLAGS} --enable-pic" + fi + + if use gold; then + CONF_FLAGS="${CONF_FLAGS} --with-binutils-include=${EPREFIX}/usr/include/" + fi + if use ocaml; then + CONF_FLAGS="${CONF_FLAGS} --enable-bindings=ocaml" + else + CONF_FLAGS="${CONF_FLAGS} --enable-bindings=none" + fi + + if use udis86; then + CONF_FLAGS="${CONF_FLAGS} --with-udis86" + fi + + if use libffi; then + append-cppflags "$(pkg-config --cflags libffi)" + fi + CONF_FLAGS="${CONF_FLAGS} $(use_enable libffi)" + + # llvm prefers clang over gcc, so we may need to force that + tc-export CC CXX + econf ${CONF_FLAGS} +} + +src_compile() { + emake VERBOSE=1 KEEP_SYMBOLS=1 REQUIRES_RTTI=1 + + if use doc; then + emake -C docs -f Makefile.sphinx man + emake -C docs -f Makefile.sphinx html + fi + + pax-mark m Release/bin/lli + if use test; then + pax-mark m unittests/ExecutionEngine/JIT/Release/JITTests + pax-mark m unittests/ExecutionEngine/MCJIT/Release/MCJITTests + pax-mark m unittests/Support/Release/SupportTests + fi +} + +src_install() { + emake KEEP_SYMBOLS=1 DESTDIR="${D}" install + + if use doc; then + doman docs/_build/man/*.1 + dohtml -r docs/_build/html/ + else + doman "${WORKDIR}"/${P}-manpages/*.1 + fi + + if use vim-syntax; then + insinto /usr/share/vim/vimfiles/syntax + doins utils/vim/*.vim + fi + + # Fix install_names on Darwin. The build system is too complicated + # to just fix this, so we correct it post-install + local lib= f= odylib= libpv=${PV} + if [[ ${CHOST} == *-darwin* ]] ; then + eval $(grep PACKAGE_VERSION= configure) + [[ -n ${PACKAGE_VERSION} ]] && libpv=${PACKAGE_VERSION} + for lib in lib{EnhancedDisassembly,LLVM-${libpv},LTO,profile_rt}.dylib {BugpointPasses,LLVMHello}.dylib ; do + # libEnhancedDisassembly is Darwin10 only, so non-fatal + [[ -f ${ED}/usr/lib/${PN}/${lib} ]] || continue + ebegin "fixing install_name of $lib" + install_name_tool \ + -id "${EPREFIX}"/usr/lib/${PN}/${lib} \ + "${ED}"/usr/lib/${PN}/${lib} + eend $? + done + for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/${PN}/libLTO.dylib ; do + odylib=$(scanmacho -BF'%n#f' "${f}" | tr ',' '\n' | grep libLLVM-${libpv}.dylib) + ebegin "fixing install_name reference to ${odylib} of ${f##*/}" + install_name_tool \ + -change "${odylib}" \ + "${EPREFIX}"/usr/lib/${PN}/libLLVM-${libpv}.dylib \ + "${f}" + eend $? + done + fi +} diff --git a/sys-devel/llvm/llvm-3.3-r3.ebuild b/sys-devel/llvm/llvm-3.3-r3.ebuild new file mode 100644 index 000000000000..cdcfea39012d --- /dev/null +++ b/sys-devel/llvm/llvm-3.3-r3.ebuild @@ -0,0 +1,500 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI=5 + +PYTHON_COMPAT=( python2_7 pypy ) + +inherit cmake-utils eutils flag-o-matic multilib multilib-minimal \ + python-r1 toolchain-funcs pax-utils check-reqs + +DESCRIPTION="Low Level Virtual Machine" +HOMEPAGE="http://llvm.org/" +SRC_URI="http://llvm.org/releases/${PV}/${P}.src.tar.gz + clang? ( http://llvm.org/releases/${PV}/compiler-rt-${PV}.src.tar.gz + http://llvm.org/releases/${PV}/cfe-${PV}.src.tar.gz ) + !doc? ( http://dev.gentoo.org/~voyageur/distfiles/${P}-manpages.tar.bz2 )" + +LICENSE="UoI-NCSA" +SLOT="0/${PV}" +KEYWORDS="amd64 arm ppc ppc64 x86 ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos" +IUSE="clang debug doc gold +libffi multitarget ocaml python + +static-analyzer test udis86 xml video_cards_radeon + kernel_Darwin kernel_FreeBSD" + +COMMON_DEPEND=" + sys-libs/zlib:0= + clang? ( + python? ( ${PYTHON_DEPS} ) + static-analyzer? ( + dev-lang/perl:* + ${PYTHON_DEPS} + ) + xml? ( dev-libs/libxml2:2= ) + ) + gold? ( >=sys-devel/binutils-2.22:*[cxx] ) + libffi? ( >=virtual/libffi-3.0.13-r1:0=[${MULTILIB_USEDEP}] ) + ocaml? ( dev-lang/ocaml:0= ) + udis86? ( >=dev-libs/udis86-1.7-r2:0=[pic(+),${MULTILIB_USEDEP}] )" +DEPEND="${COMMON_DEPEND} + dev-lang/perl + >=sys-devel/make-3.81 + >=sys-devel/flex-2.5.4 + >=sys-devel/bison-1.875d + || ( >=sys-devel/gcc-3.0 >=sys-devel/gcc-apple-4.2.1 + ( >=sys-freebsd/freebsd-lib-9.1-r10 sys-libs/libcxx ) + ) + || ( >=sys-devel/binutils-2.18 >=sys-devel/binutils-apple-3.2.3 ) + clang? ( xml? ( virtual/pkgconfig ) ) + doc? ( dev-python/sphinx ) + libffi? ( virtual/pkgconfig ) + ${PYTHON_DEPS}" +RDEPEND="${COMMON_DEPEND} + clang? ( !<=sys-devel/clang-3.3-r99 + !>=sys-devel/clang-9999 ) + abi_x86_32? ( !<=app-emulation/emul-linux-x86-baselibs-20130224-r2 + !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)] )" + +# pypy gives me around 1700 unresolved tests due to open file limit +# being exceeded. probably GC does not close them fast enough. +REQUIRED_USE="${PYTHON_REQUIRED_USE} + test? ( || ( $(python_gen_useflags 'python*') ) )" + +S=${WORKDIR}/${P}.src + +# Some people actually override that in make.conf. That sucks since +# we need to run install per-directory, and ninja can't do that... +# so why did it call itself ninja in the first place? +CMAKE_MAKEFILE_GENERATOR=emake + +pkg_pretend() { + # in megs + # !clang !debug !multitarget -O2 400 + # !clang !debug multitarget -O2 550 + # clang !debug !multitarget -O2 950 + # clang !debug multitarget -O2 1200 + # !clang debug multitarget -O2 5G + # clang !debug multitarget -O0 -g 12G + # clang debug multitarget -O2 16G + # clang debug multitarget -O0 -g 14G + + local build_size=550 + use clang && build_size=1200 + + if use debug; then + ewarn "USE=debug is known to increase the size of package considerably" + ewarn "and cause the tests to fail." + ewarn + + (( build_size *= 14 )) + elif is-flagq '-g?(gdb)?([1-9])'; then + ewarn "The C++ compiler -g option is known to increase the size of the package" + ewarn "considerably. If you run out of space, please consider removing it." + ewarn + + (( build_size *= 10 )) + fi + + # Multiply by number of ABIs :). + local abis=( $(multilib_get_enabled_abis) ) + (( build_size *= ${#abis[@]} )) + + local CHECKREQS_DISK_BUILD=${build_size}M + check-reqs_pkg_pretend +} + +pkg_setup() { + pkg_pretend + + # need to check if the active compiler is ok + + broken_gcc=( 3.2.2 3.2.3 3.3.2 4.1.1 ) + broken_gcc_x86=( 3.4.0 3.4.2 ) + broken_gcc_amd64=( 3.4.6 ) + + gcc_vers=$(gcc-fullversion) + + if has "${gcc_vers}" "${broken_gcc[@]}"; then + elog "Your version of gcc is known to miscompile llvm." + elog "Check http://www.llvm.org/docs/GettingStarted.html for" + elog "possible solutions." + die "Your currently active version of gcc is known to miscompile llvm" + fi + + if use abi_x86_32 && has "${gcc_vers}" "${broken_gcc_x86[@]}"; then + elog "Your version of gcc is known to miscompile llvm on x86" + elog "architectures. Check" + elog "http://www.llvm.org/docs/GettingStarted.html for possible" + elog "solutions." + die "Your currently active version of gcc is known to miscompile llvm" + fi + + if use abi_x86_64 && has "${gcc_vers}" "${broken_gcc_amd64[@]}"; then + elog "Your version of gcc is known to miscompile llvm in amd64" + elog "architectures. Check" + elog "http://www.llvm.org/docs/GettingStarted.html for possible" + elog "solutions." + die "Your currently active version of gcc is known to miscompile llvm" + fi +} + +src_unpack() { + default + + rm -f "${S}"/tools/clang "${S}"/projects/compiler-rt \ + || die "symlinks removal failed" + + if use clang; then + mv "${WORKDIR}"/cfe-${PV}.src "${S}"/tools/clang \ + || die "clang source directory move failed" + mv "${WORKDIR}"/compiler-rt-${PV}.src "${S}"/projects/compiler-rt \ + || die "compiler-rt source directory move failed" + fi +} + +src_prepare() { + epatch "${FILESDIR}"/${PN}-3.2-nodoctargz.patch + epatch "${FILESDIR}"/${P}-R600_debug.patch + epatch "${FILESDIR}"/${PN}-3.3-r2-gentoo-install.patch + + # Hack cmake search path for Gentoo, bug #496480 + epatch "${FILESDIR}"/${PN}-3.3-cmake-modulepath.patch + + if use clang; then + # Automatically select active system GCC's libraries, bugs #406163 and #417913 + epatch "${FILESDIR}"/clang-3.1-gentoo-runtime-gcc-detection-v3.patch + + epatch "${FILESDIR}"/clang-3.3-gentoo-install.patch + + # backport support for g++-X.Y header location + epatch "${FILESDIR}"/clang-3.3-gcc-header-path.patch + fi + + local sub_files=( + Makefile.config.in + Makefile.rules + tools/llvm-config/llvm-config.cpp + ) + use clang && sub_files+=( + tools/clang/lib/Driver/Tools.cpp + tools/clang/tools/scan-build/scan-build + ) + + # unfortunately ./configure won't listen to --mandir and the-like, so take + # care of this. + # note: we're setting the main libdir intentionally. + # where per-ABI is appropriate, we use $(GENTOO_LIBDIR) make. + einfo "Fixing install dirs" + sed -e "s,@libdir@,$(get_libdir),g" \ + -e "s,@PF@,${PF},g" \ + -e "s,@EPREFIX@,${EPREFIX},g" \ + -i "${sub_files[@]}" \ + || die "install paths sed failed" + + # User patches + epatch_user + + python_setup +} + +multilib_src_configure() { + # disable timestamps since they confuse ccache + local conf_flags=( + --disable-timestamps + --enable-keep-symbols + --enable-shared + --with-optimize-option= + $(use_enable !debug optimized) + $(use_enable debug assertions) + $(use_enable debug expensive-checks) + $(use_enable libffi) + ) + + if use clang; then + conf_flags+=( --with-clang-resource-dir=../lib/clang/${PV} ) + fi + # well, it's used only by clang executable c-index-test + if multilib_is_native_abi && use clang && use xml; then + conf_flags+=( XML2CONFIG="$(tc-getPKG_CONFIG) libxml-2.0" ) + else + conf_flags+=( ac_cv_prog_XML2CONFIG="" ) + fi + + local targets bindings + if use multitarget; then + targets='all' + else + targets='host,cpp' + fi + conf_flags+=( --enable-targets=${targets} ) + + if use video_cards_radeon; then + conf_flags+=( --enable-experimental-targets=R600 ) + fi + + if multilib_is_native_abi; then + use gold && conf_flags+=( --with-binutils-include="${EPREFIX}"/usr/include/ ) + # extra commas don't hurt + use ocaml && bindings+=',ocaml' + fi + + [[ ${bindings} ]] || bindings='none' + conf_flags+=( --enable-bindings=${bindings} ) + + if use udis86; then + conf_flags+=( --with-udis86 ) + fi + + if use libffi; then + local CPPFLAGS=${CPPFLAGS} + append-cppflags "$(pkg-config --cflags libffi)" + fi + + # llvm prefers clang over gcc, so we may need to force that + tc-export CC CXX + + ECONF_SOURCE=${S} \ + econf "${conf_flags[@]}" + + multilib_is_native_abi && cmake_configure +} + +cmake_configure() { + # sadly, cmake doesn't seem to have host autodetection + # but it's fairly easy to steal this from configured autotools + local targets=$(sed -n -e 's/^TARGETS_TO_BUILD=//p' Makefile.config || die) + local libdir=$(get_libdir) + + # cmake doesn't have R600 in 3.3 + targets=${targets/R600 /} + + local mycmakeargs=( + -DLLVM_TARGETS_TO_BUILD="${targets// /;}" + -DLLVM_LIBDIR_SUFFIX=${libdir#lib} + ) + + BUILD_DIR=${S%/}_cmake \ + cmake-utils_src_configure +} + +set_makeargs() { + MAKEARGS=( + VERBOSE=1 + REQUIRES_RTTI=1 + GENTOO_LIBDIR=$(get_libdir) + ) + + # for tests, we want it all! otherwise, we may use a little filtering... + # adding ONLY_TOOLS also disables unittest building... + if [[ ${EBUILD_PHASE_FUNC} != src_test ]]; then + local tools=( llvm-config ) + use clang && tools+=( clang ) + + if multilib_is_native_abi; then + tools+=( + opt llvm-as llvm-dis llc llvm-ar llvm-nm llvm-link lli + llvm-extract llvm-mc llvm-bcanalyzer llvm-diff macho-dump + llvm-objdump llvm-readobj llvm-rtdyld llvm-dwarfdump llvm-cov + llvm-size llvm-stress llvm-mcmarkup llvm-symbolizer obj2yaml + yaml2obj lto llvm-prof llvm-ranlib bugpoint + ) + + # those tools require 'lto' built first, so we need to delay + # building them to a second run + if [[ ${1} != -1 ]]; then + use gold && tools+=( gold ) + fi + fi + + MAKEARGS+=( + # filter tools + disable unittests implicitly + ONLY_TOOLS="${tools[*]}" + + # this disables unittests & docs from clang + BUILD_CLANG_ONLY=YES + ) + fi +} + +multilib_src_compile() { + local MAKEARGS + set_makeargs -1 + emake "${MAKEARGS[@]}" + + if multilib_is_native_abi; then + set_makeargs + emake -C tools "${MAKEARGS[@]}" + + if use doc; then + emake -C "${S}"/docs -f Makefile.sphinx man + use clang && emake -C "${S}"/tools/clang/docs/tools \ + BUILD_FOR_WEBSITE=1 DST_MAN_DIR="${T}"/ man + emake -C "${S}"/docs -f Makefile.sphinx html + fi + fi + + if use debug; then + pax-mark m Debug+Asserts+Checks/bin/llvm-rtdyld + pax-mark m Debug+Asserts+Checks/bin/lli + else + pax-mark m Release/bin/llvm-rtdyld + pax-mark m Release/bin/lli + fi +} + +multilib_src_test() { + local MAKEARGS + set_makeargs + + # build the remaining tools & unittests + emake "${MAKEARGS[@]}" + + pax-mark m unittests/ExecutionEngine/JIT/Release/JITTests + pax-mark m unittests/ExecutionEngine/MCJIT/Release/MCJITTests + pax-mark m unittests/Support/Release/SupportTests + + emake "${MAKEARGS[@]}" check + use clang && emake "${MAKEARGS[@]}" -C tools/clang test +} + +src_install() { + local MULTILIB_WRAPPED_HEADERS=( + /usr/include/llvm/Config/config.h + /usr/include/llvm/Config/llvm-config.h + ) + + use clang && MULTILIB_WRAPPED_HEADERS+=( + /usr/include/clang/Config/config.h + ) + + multilib-minimal_src_install + + # Remove unnecessary headers on FreeBSD, bug #417171 + use kernel_FreeBSD && use clang && rm "${ED}"usr/lib/clang/${PV}/include/{std,float,iso,limits,tgmath,varargs}*.h +} + +multilib_src_install() { + local MAKEARGS + set_makeargs + + emake "${MAKEARGS[@]}" DESTDIR="${D}" install + + # Preserve ABI-variant of llvm-config. + dodir /tmp + mv "${ED}"/usr/bin/llvm-config "${ED}"/tmp/"${CHOST}"-llvm-config || die + + if ! multilib_is_native_abi; then + # Drop all the executables since LLVM doesn't like to + # clobber when installing. + rm -r "${ED}"/usr/bin || die + + # Backwards compat, will be happily removed someday. + dosym "${CHOST}"-llvm-config /tmp/llvm-config.${ABI} + else + # Move files back. + mv "${ED}"/tmp/*llvm-config* "${ED}"/usr/bin || die + # Create a symlink for host's llvm-config. + dosym "${CHOST}"-llvm-config /usr/bin/llvm-config + + # Install docs. + if use doc; then + doman "${S}"/docs/_build/man/*.1 + use clang && doman "${T}"/clang.1 + dohtml -r "${S}"/docs/_build/html/ + else + doman "${WORKDIR}"/${P}-manpages/*.1 + fi + + # Symlink the gold plugin. + if use gold; then + dodir /usr/${CHOST}/binutils-bin/lib/bfd-plugins + dosym ../../../../$(get_libdir)/LLVMgold.so \ + /usr/${CHOST}/binutils-bin/lib/bfd-plugins/LLVMgold.so + fi + + # install cmake modules + emake -C "${S%/}"_cmake/cmake/modules DESTDIR="${D}" install + fi + + # Fix install_names on Darwin. The build system is too complicated + # to just fix this, so we correct it post-install + local lib= f= odylib= libpv=${PV} + if [[ ${CHOST} == *-darwin* ]] ; then + eval $(grep PACKAGE_VERSION= configure) + [[ -n ${PACKAGE_VERSION} ]] && libpv=${PACKAGE_VERSION} + for lib in lib{EnhancedDisassembly,LLVM-${libpv},LTO,profile_rt,clang}.dylib LLVMHello.dylib ; do + # libEnhancedDisassembly is Darwin10 only, so non-fatal + # + omit clang libs if not enabled + [[ -f ${ED}/usr/lib/${lib} ]] || continue + + ebegin "fixing install_name of $lib" + install_name_tool \ + -id "${EPREFIX}"/usr/lib/${lib} \ + "${ED}"/usr/lib/${lib} + eend $? + done + for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/lib{LTO,clang}.dylib ; do + # omit clang libs if not enabled + [[ -f ${ED}/usr/lib/${lib} ]] || continue + + odylib=$(scanmacho -BF'%n#f' "${f}" | tr ',' '\n' | grep libLLVM-${libpv}.dylib) + ebegin "fixing install_name reference to ${odylib} of ${f##*/}" + install_name_tool \ + -change "${odylib}" \ + "${EPREFIX}"/usr/lib/libLLVM-${libpv}.dylib \ + -change "@rpath/libclang.dylib" \ + "${EPREFIX}"/usr/lib/libclang.dylib \ + -change "${S}"/Release/lib/libclang.dylib \ + "${EPREFIX}"/usr/lib/libclang.dylib \ + "${f}" + eend $? + done + fi +} + +multilib_src_install_all() { + insinto /usr/share/vim/vimfiles/syntax + doins utils/vim/*.vim + + if use clang; then + cd tools/clang || die + + if use static-analyzer ; then + dobin tools/scan-build/ccc-analyzer + dosym ccc-analyzer /usr/bin/c++-analyzer + dobin tools/scan-build/scan-build + + insinto /usr/share/${PN} + doins tools/scan-build/scanview.css + doins tools/scan-build/sorttable.js + fi + + python_inst() { + if use static-analyzer ; then + pushd tools/scan-view >/dev/null || die + + python_doscript scan-view + + touch __init__.py || die + python_moduleinto clang + python_domodule __init__.py Reporter.py Resources ScanView.py startfile.py + + popd >/dev/null || die + fi + + if use python ; then + pushd bindings/python/clang >/dev/null || die + + python_moduleinto clang + python_domodule __init__.py cindex.py enumerations.py + + popd >/dev/null || die + fi + + # AddressSanitizer symbolizer (currently separate) + python_doscript "${S}"/projects/compiler-rt/lib/asan/scripts/asan_symbolize.py + } + python_foreach_impl python_inst + fi +} diff --git a/sys-devel/llvm/llvm-3.4.2.ebuild b/sys-devel/llvm/llvm-3.4.2.ebuild new file mode 100644 index 000000000000..0469f83f66c8 --- /dev/null +++ b/sys-devel/llvm/llvm-3.4.2.ebuild @@ -0,0 +1,543 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI=5 + +PYTHON_COMPAT=( python2_7 pypy ) +# this causes some issues so make it optional for now. +# 3.5 will have CMakeFiles support in autotools. +WANT_CMAKE=cmake + +inherit cmake-utils eutils flag-o-matic multibuild multilib \ + multilib-minimal python-r1 toolchain-funcs pax-utils check-reqs prefix + +DESCRIPTION="Low Level Virtual Machine" +HOMEPAGE="http://llvm.org/" +SRC_URI="http://llvm.org/releases/${PV}/${P}.src.tar.gz + clang? ( http://llvm.org/releases/${PV}/compiler-rt-3.4.src.tar.gz + http://llvm.org/releases/${PV}/cfe-${PV}.src.tar.gz + http://llvm.org/releases/${PV}/clang-tools-extra-3.4.src.tar.gz ) + !doc? ( http://dev.gentoo.org/~mgorny/dist/${PN}-3.4-manpages.tar.bz2 )" + +LICENSE="UoI-NCSA" +SLOT="0/3.4" +KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos" +IUSE="clang debug doc gold +libffi multitarget ncurses ocaml python + +static-analyzer test udis86 xml video_cards_radeon + kernel_Darwin kernel_FreeBSD" + +COMMON_DEPEND=" + sys-libs/zlib:0= + clang? ( + python? ( ${PYTHON_DEPS} ) + static-analyzer? ( + dev-lang/perl:* + ${PYTHON_DEPS} + ) + xml? ( dev-libs/libxml2:2= ) + ) + gold? ( >=sys-devel/binutils-2.22:*[cxx] ) + libffi? ( >=virtual/libffi-3.0.13-r1:0=[${MULTILIB_USEDEP}] ) + ncurses? ( >=sys-libs/ncurses-5.9-r3:5=[${MULTILIB_USEDEP}] ) + ocaml? ( dev-lang/ocaml:0= ) + udis86? ( >=dev-libs/udis86-1.7-r2:0=[pic(+),${MULTILIB_USEDEP}] )" +DEPEND="${COMMON_DEPEND} + dev-lang/perl + >=sys-devel/make-3.81 + >=sys-devel/flex-2.5.4 + >=sys-devel/bison-1.875d + || ( >=sys-devel/gcc-3.0 >=sys-devel/gcc-apple-4.2.1 >=sys-devel/llvm-3.3 + ( >=sys-freebsd/freebsd-lib-9.1-r10 sys-libs/libcxx ) + ) + || ( >=sys-devel/binutils-2.18 >=sys-devel/binutils-apple-5.1 ) + clang? ( xml? ( virtual/pkgconfig ) ) + doc? ( dev-python/sphinx ) + libffi? ( virtual/pkgconfig ) + ${PYTHON_DEPS}" +RDEPEND="${COMMON_DEPEND} + clang? ( !<=sys-devel/clang-${PV}-r99 + !>=sys-devel/clang-9999 ) + abi_x86_32? ( !<=app-emulation/emul-linux-x86-baselibs-20130224-r2 + !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)] )" +PDEPEND="clang? ( =sys-devel/clang-${PV}-r100 )" + +# pypy gives me around 1700 unresolved tests due to open file limit +# being exceeded. probably GC does not close them fast enough. +REQUIRED_USE="${PYTHON_REQUIRED_USE} + test? ( || ( $(python_gen_useflags 'python*') ) )" + +S=${WORKDIR}/${P}.src + +# Some people actually override that in make.conf. That sucks since +# we need to run install per-directory, and ninja can't do that... +# so why did it call itself ninja in the first place? +CMAKE_MAKEFILE_GENERATOR=emake + +MULTILIB_CHOST_TOOLS=( + /usr/bin/llvm-config +) + +pkg_pretend() { + # in megs + # !clang !debug !multitarget -O2 400 + # !clang !debug multitarget -O2 550 + # clang !debug !multitarget -O2 950 + # clang !debug multitarget -O2 1200 + # !clang debug multitarget -O2 5G + # clang !debug multitarget -O0 -g 12G + # clang debug multitarget -O2 16G + # clang debug multitarget -O0 -g 14G + + local build_size=550 + use clang && build_size=1200 + + if use debug; then + ewarn "USE=debug is known to increase the size of package considerably" + ewarn "and cause the tests to fail." + ewarn + + (( build_size *= 14 )) + elif is-flagq '-g?(gdb)?([1-9])'; then + ewarn "The C++ compiler -g option is known to increase the size of the package" + ewarn "considerably. If you run out of space, please consider removing it." + ewarn + + (( build_size *= 10 )) + fi + + # Multiply by number of ABIs :). + local abis=( $(multilib_get_enabled_abis) ) + (( build_size *= ${#abis[@]} )) + + local CHECKREQS_DISK_BUILD=${build_size}M + check-reqs_pkg_pretend +} + +pkg_setup() { + pkg_pretend + + # need to check if the active compiler is ok + + broken_gcc=( 3.2.2 3.2.3 3.3.2 4.1.1 ) + broken_gcc_x86=( 3.4.0 3.4.2 ) + broken_gcc_amd64=( 3.4.6 ) + + gcc_vers=$(gcc-fullversion) + + if has "${gcc_vers}" "${broken_gcc[@]}"; then + elog "Your version of gcc is known to miscompile llvm." + elog "Check http://www.llvm.org/docs/GettingStarted.html for" + elog "possible solutions." + die "Your currently active version of gcc is known to miscompile llvm" + fi + + if use abi_x86_32 && has "${gcc_vers}" "${broken_gcc_x86[@]}"; then + elog "Your version of gcc is known to miscompile llvm on x86" + elog "architectures. Check" + elog "http://www.llvm.org/docs/GettingStarted.html for possible" + elog "solutions." + die "Your currently active version of gcc is known to miscompile llvm" + fi + + if use abi_x86_64 && has "${gcc_vers}" "${broken_gcc_amd64[@]}"; then + elog "Your version of gcc is known to miscompile llvm in amd64" + elog "architectures. Check" + elog "http://www.llvm.org/docs/GettingStarted.html for possible" + elog "solutions." + die "Your currently active version of gcc is known to miscompile llvm" + fi +} + +src_unpack() { + default + + rm -f "${S}"/tools/clang "${S}"/projects/compiler-rt \ + || die "symlinks removal failed" + + if use clang; then + mv "${WORKDIR}"/cfe-${PV}.src "${S}"/tools/clang \ + || die "clang source directory move failed" + mv "${WORKDIR}"/compiler-rt-3.4 "${S}"/projects/compiler-rt \ + || die "compiler-rt source directory move failed" + mv "${WORKDIR}"/clang-tools-extra-3.4 "${S}"/tools/clang/tools/extra \ + || die "clang-tools-extra source directory move failed" + fi +} + +src_prepare() { + epatch "${FILESDIR}"/${PN}-3.2-nodoctargz.patch + epatch "${FILESDIR}"/${PN}-3.4-gentoo-install.patch + # Hack cmake search path for Gentoo, bug #496480 + epatch "${FILESDIR}"/${PN}-3.3-cmake-modulepath.patch + # Use built-in ConfigParser to avoid failures with configparser-3.2 + # https://bugs.gentoo.org/show_bug.cgi?id=500856 + epatch "${FILESDIR}"/${PN}-3.4-cmake-configparser.patch + + if use clang; then + # Automatically select active system GCC's libraries, bugs #406163 and #417913 + epatch "${FILESDIR}"/clang-3.1-gentoo-runtime-gcc-detection-v3.patch + + epatch "${FILESDIR}"/clang-3.4-gentoo-install.patch + epatch "${FILESDIR}"/clang-3.4-darwin_build_fix.patch + epatch "${FILESDIR}"/clang-3.4-darwin_prefix-include-paths.patch + eprefixify tools/clang/lib/Frontend/InitHeaderSearch.cpp + fi + + if use prefix && use clang; then + sed -i -e "/^CFLAGS /s@-Werror@-I${EPREFIX}/usr/include@" \ + projects/compiler-rt/make/platform/clang_*.mk || die + fi + + local sub_files=( + Makefile.config.in + Makefile.rules + tools/llvm-config/llvm-config.cpp + ) + use clang && sub_files+=( + tools/clang/lib/Driver/Tools.cpp + tools/clang/tools/scan-build/scan-build + ) + + # unfortunately ./configure won't listen to --mandir and the-like, so take + # care of this. + # note: we're setting the main libdir intentionally. + # where per-ABI is appropriate, we use $(GENTOO_LIBDIR) make. + einfo "Fixing install dirs" + sed -e "s,@libdir@,$(get_libdir),g" \ + -e "s,@PF@,${PF},g" \ + -e "s,@EPREFIX@,${EPREFIX},g" \ + -i "${sub_files[@]}" \ + || die "install paths sed failed" + + if use clang; then + # constantly fails for a long time, likely due to our patches + rm tools/clang/test/Driver/cross-linux.c || die + fi + + # User patches + epatch_user + + python_setup +} + +multilib_src_configure() { + # disable timestamps since they confuse ccache + local conf_flags=( + --disable-timestamps + --enable-keep-symbols + --enable-shared + --with-optimize-option= + $(use_enable !debug optimized) + $(use_enable debug assertions) + $(use_enable debug expensive-checks) + $(use_enable ncurses terminfo) + $(use_enable libffi) + ) + + if use clang; then + conf_flags+=( --with-clang-resource-dir=../lib/clang/${PV} ) + fi + # well, it's used only by clang executable c-index-test + if multilib_is_native_abi && use clang && use xml; then + conf_flags+=( XML2CONFIG="$(tc-getPKG_CONFIG) libxml-2.0" ) + else + conf_flags+=( ac_cv_prog_XML2CONFIG="" ) + fi + + local targets bindings + if use multitarget; then + targets='all' + else + targets='host,cpp' + use video_cards_radeon && targets+=',r600' + fi + conf_flags+=( --enable-targets=${targets} ) + + if multilib_is_native_abi; then + use gold && conf_flags+=( --with-binutils-include="${EPREFIX}"/usr/include/ ) + # extra commas don't hurt + use ocaml && bindings+=',ocaml' + fi + + [[ ${bindings} ]] || bindings='none' + conf_flags+=( --enable-bindings=${bindings} ) + + if use udis86; then + conf_flags+=( --with-udis86 ) + fi + + if use libffi; then + local CPPFLAGS=${CPPFLAGS} + append-cppflags "$(pkg-config --cflags libffi)" + fi + + # llvm prefers clang over gcc, so we may need to force that + tc-export CC CXX + + ECONF_SOURCE=${S} \ + econf "${conf_flags[@]}" + + multilib_is_native_abi && cmake_configure +} + +cmake_configure() { + # sadly, cmake doesn't seem to have host autodetection + # but it's fairly easy to steal this from configured autotools + local targets=$(sed -n -e 's/^TARGETS_TO_BUILD=//p' Makefile.config || die) + local libdir=$(get_libdir) + local mycmakeargs=( + # just the stuff needed to get correct cmake modules + $(cmake-utils_use ncurses LLVM_ENABLE_TERMINFO) + + -DLLVM_TARGETS_TO_BUILD="${targets// /;}" + -DLLVM_LIBDIR_SUFFIX=${libdir#lib} + ) + + BUILD_DIR=${S%/}_cmake \ + cmake-utils_src_configure +} + +set_makeargs() { + MAKEARGS=( + VERBOSE=1 + REQUIRES_RTTI=1 + GENTOO_LIBDIR=$(get_libdir) + ) + + # for tests, we want it all! otherwise, we may use a little filtering... + # adding ONLY_TOOLS also disables unittest building... + if [[ ${EBUILD_PHASE_FUNC} != src_test ]]; then + local tools=( llvm-config ) + use clang && tools+=( clang ) + + if multilib_is_native_abi; then + tools+=( + opt llvm-as llvm-dis llc llvm-ar llvm-nm llvm-link lli + llvm-extract llvm-mc llvm-bcanalyzer llvm-diff macho-dump + llvm-objdump llvm-readobj llvm-rtdyld llvm-dwarfdump llvm-cov + llvm-size llvm-stress llvm-mcmarkup llvm-symbolizer obj2yaml + yaml2obj lto bugpoint + ) + + # the build system runs explicitly specified tools in parallel, + # so we need to split it into two runs + if [[ ${1} != -1 ]]; then + # those require lto + tools+=( llvm-lto ) + use gold && tools+=( gold ) + + # those require clang :) + # we need to explicitly specify all its tools + # since we're passing BUILD_CLANG_ONLY + use clang && tools+=( + clang/tools/{clang-check,clang-format,extra} + ) + fi + fi + + MAKEARGS+=( + # filter tools + disable unittests implicitly + ONLY_TOOLS="${tools[*]}" + + # this disables unittests & docs from clang + BUILD_CLANG_ONLY=YES + ) + fi +} + +multilib_src_compile() { + local MAKEARGS + set_makeargs -1 + emake "${MAKEARGS[@]}" + + if multilib_is_native_abi; then + set_makeargs + emake -C tools "${MAKEARGS[@]}" + + if use doc; then + emake -C "${S}"/docs -f Makefile.sphinx man + use clang && emake -C "${S}"/tools/clang/docs/tools \ + BUILD_FOR_WEBSITE=1 DST_MAN_DIR="${T}"/ man + emake -C "${S}"/docs -f Makefile.sphinx html + fi + fi + + if use debug; then + pax-mark m Debug+Asserts+Checks/bin/llvm-rtdyld + pax-mark m Debug+Asserts+Checks/bin/lli + pax-mark m Debug+Asserts+Checks/bin/lli-child-target + else + pax-mark m Release/bin/llvm-rtdyld + pax-mark m Release/bin/lli + pax-mark m Release/bin/lli-child-target + fi +} + +multilib_src_test() { + local MAKEARGS + set_makeargs + + # build the remaining tools & unittests + emake "${MAKEARGS[@]}" + + pax-mark m unittests/ExecutionEngine/JIT/Release/JITTests + pax-mark m unittests/ExecutionEngine/MCJIT/Release/MCJITTests + pax-mark m unittests/Support/Release/SupportTests + + # respect TMPDIR! + local -x LIT_PRESERVES_TMP=1 + emake "${MAKEARGS[@]}" check + use clang && emake "${MAKEARGS[@]}" -C tools/clang test +} + +src_install() { + local MULTILIB_WRAPPED_HEADERS=( + /usr/include/llvm/Config/config.h + /usr/include/llvm/Config/llvm-config.h + ) + + use clang && MULTILIB_WRAPPED_HEADERS+=( + /usr/include/clang/Config/config.h + ) + + multilib-minimal_src_install + + # Remove unnecessary headers on FreeBSD, bug #417171 + use kernel_FreeBSD && use clang && rm "${ED}"usr/lib/clang/${PV}/include/{std,float,iso,limits,tgmath,varargs}*.h +} + +multilib_src_install() { + local MAKEARGS + set_makeargs + + local root=${D}/_${ABI} + + emake "${MAKEARGS[@]}" DESTDIR="${root}" install + multibuild_merge_root "${root}" "${D}" + + if ! multilib_is_native_abi; then + # Backwards compat, will be happily removed someday. + dosym "${CHOST}"-llvm-config /usr/bin/llvm-config.${ABI} + else + # Install docs. + if use doc; then + doman "${S}"/docs/_build/man/*.1 + use clang && doman "${T}"/clang.1 + dohtml -r "${S}"/docs/_build/html/ + else + if ! use clang; then + rm "${WORKDIR}"/${PN}-3.4-manpages/clang.1 || die + fi + doman "${WORKDIR}"/${PN}-3.4-manpages/*.1 + fi + + # Symlink the gold plugin. + if use gold; then + dodir /usr/${CHOST}/binutils-bin/lib/bfd-plugins + dosym ../../../../$(get_libdir)/LLVMgold.so \ + /usr/${CHOST}/binutils-bin/lib/bfd-plugins/LLVMgold.so + fi + + # install cmake modules + if use cmake; then + emake -C "${S%/}"_cmake/cmake/modules DESTDIR="${D}" install + fi + fi + + # Fix install_names on Darwin. The build system is too complicated + # to just fix this, so we correct it post-install + local lib= f= odylib= ndylib= libpv=${PV} + if [[ ${CHOST} == *-darwin* ]] ; then + eval $(grep PACKAGE_VERSION= configure) + [[ -n ${PACKAGE_VERSION} ]] && libpv=${PACKAGE_VERSION} + libpvminor=${libpv%.[0-9]*} + for lib in lib{EnhancedDisassembly,LLVM-${libpv},LTO,profile_rt,clang}.dylib LLVMHello.dylib clang/${libpv}/lib/darwin/libclang_rt.asan_{osx,iossim}_dynamic.dylib; do + # libEnhancedDisassembly is Darwin10 only, so non-fatal + # + omit clang libs if not enabled + [[ -f ${ED}/usr/lib/${lib} ]] || continue + + ebegin "fixing install_name of $lib" + install_name_tool \ + -id "${EPREFIX}"/usr/lib/${lib} \ + "${ED}"/usr/lib/${lib} + eend $? + done + for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/lib*.dylib "${ED}"/usr/lib/clang/${libpv}/lib/darwin/*.dylib ; do + # omit clang libs if not enabled + [[ -f "${f}" ]] || continue + + scanmacho -BF'%n#f' "${f}" | tr ',' '\n' | \ + while read odylib ; do + ndylib= + case ${odylib} in + */libclang.dylib) + ndylib="${EPREFIX}"/usr/lib/libclang.dylib + ;; + */libLLVM-${libpv}.dylib) + ndylib="${EPREFIX}"/usr/lib/libLLVM-${libpv}.dylib + ;; + */libLLVM-${libpvminor}.dylib) + ndylib="${EPREFIX}"/usr/lib/libLLVM-${libpvminor}.dylib + ;; + */libLTO.dylib) + ndylib="${EPREFIX}"/usr/lib/libLTO.dylib + ;; + esac + if [[ -n ${ndylib} ]] ; then + ebegin "fixing install_name reference to ${odylib} of ${f##*/}" + install_name_tool \ + -change "${odylib}" "${ndylib}" \ + "${f}" + eend $? + fi + done + done + fi +} + +multilib_src_install_all() { + insinto /usr/share/vim/vimfiles/syntax + doins utils/vim/*.vim + + if use clang; then + cd tools/clang || die + + if use static-analyzer ; then + dobin tools/scan-build/ccc-analyzer + dosym ccc-analyzer /usr/bin/c++-analyzer + dobin tools/scan-build/scan-build + + insinto /usr/share/${PN} + doins tools/scan-build/scanview.css + doins tools/scan-build/sorttable.js + fi + + python_inst() { + if use static-analyzer ; then + pushd tools/scan-view >/dev/null || die + + python_doscript scan-view + + touch __init__.py || die + python_moduleinto clang + python_domodule __init__.py Reporter.py Resources ScanView.py startfile.py + + popd >/dev/null || die + fi + + if use python ; then + pushd bindings/python/clang >/dev/null || die + + python_moduleinto clang + python_domodule __init__.py cindex.py enumerations.py + + popd >/dev/null || die + fi + + # AddressSanitizer symbolizer (currently separate) + python_doscript "${S}"/projects/compiler-rt/lib/asan/scripts/asan_symbolize.py + } + python_foreach_impl python_inst + fi +} diff --git a/sys-devel/llvm/llvm-3.5.0.ebuild b/sys-devel/llvm/llvm-3.5.0.ebuild new file mode 100644 index 000000000000..d194efb959f8 --- /dev/null +++ b/sys-devel/llvm/llvm-3.5.0.ebuild @@ -0,0 +1,530 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI=5 + +PYTHON_COMPAT=( python2_7 pypy ) + +inherit eutils flag-o-matic multibuild multilib \ + multilib-minimal python-r1 toolchain-funcs pax-utils check-reqs prefix + +DESCRIPTION="Low Level Virtual Machine" +HOMEPAGE="http://llvm.org/" +SRC_URI="http://llvm.org/releases/${PV}/${P}.src.tar.xz + clang? ( http://llvm.org/releases/${PV}/compiler-rt-${PV}.src.tar.xz + http://llvm.org/releases/${PV}/cfe-${PV}.src.tar.xz + http://llvm.org/releases/${PV}/clang-tools-extra-${PV}.src.tar.xz ) + !doc? ( http://dev.gentoo.org/~voyageur/distfiles/${P}-manpages.tar.bz2 )" + +LICENSE="UoI-NCSA" +SLOT="0/3.5" +KEYWORDS="amd64 arm ppc ppc64 ~sparc x86 ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos" +IUSE="clang debug doc gold libedit +libffi multitarget ncurses ocaml python + +static-analyzer test xml video_cards_radeon + kernel_Darwin kernel_FreeBSD" + +COMMON_DEPEND=" + sys-libs/zlib:0= + clang? ( + python? ( ${PYTHON_DEPS} ) + static-analyzer? ( + dev-lang/perl:* + ${PYTHON_DEPS} + ) + xml? ( dev-libs/libxml2:2= ) + ) + gold? ( >=sys-devel/binutils-2.22:*[cxx] ) + libedit? ( dev-libs/libedit:0=[${MULTILIB_USEDEP}] ) + libffi? ( >=virtual/libffi-3.0.13-r1:0=[${MULTILIB_USEDEP}] ) + ncurses? ( >=sys-libs/ncurses-5.9-r3:5=[${MULTILIB_USEDEP}] ) + ocaml? ( dev-lang/ocaml:0= )" +# configparser-3.2 breaks the build (3.3 or none at all are fine) +DEPEND="${COMMON_DEPEND} + app-arch/xz-utils + dev-lang/perl + >=sys-devel/make-3.81 + >=sys-devel/flex-2.5.4 + >=sys-devel/bison-1.875d + || ( >=sys-devel/gcc-3.0 >=sys-devel/gcc-apple-4.2.1 + ( >=sys-freebsd/freebsd-lib-9.1-r10 sys-libs/libcxx ) + ) + || ( >=sys-devel/binutils-2.18 >=sys-devel/binutils-apple-5.1 ) + clang? ( xml? ( virtual/pkgconfig ) ) + doc? ( dev-python/sphinx ) + libffi? ( virtual/pkgconfig ) + !!<dev-python/configparser-3.3.0.2 + ${PYTHON_DEPS}" +RDEPEND="${COMMON_DEPEND} + clang? ( !<=sys-devel/clang-${PV}-r99 + !>=sys-devel/clang-9999 ) + abi_x86_32? ( !<=app-emulation/emul-linux-x86-baselibs-20130224-r2 + !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)] )" +PDEPEND="clang? ( =sys-devel/clang-${PV}-r100 )" + +# pypy gives me around 1700 unresolved tests due to open file limit +# being exceeded. probably GC does not close them fast enough. +REQUIRED_USE="${PYTHON_REQUIRED_USE} + test? ( || ( $(python_gen_useflags 'python*') ) )" + +S=${WORKDIR}/${P}.src + +# Some people actually override that in make.conf. That sucks since +# we need to run install per-directory, and ninja can't do that... +# so why did it call itself ninja in the first place? +CMAKE_MAKEFILE_GENERATOR=emake + +pkg_pretend() { + # in megs + # !clang !debug !multitarget -O2 400 + # !clang !debug multitarget -O2 550 + # clang !debug !multitarget -O2 950 + # clang !debug multitarget -O2 1200 + # !clang debug multitarget -O2 5G + # clang !debug multitarget -O0 -g 12G + # clang debug multitarget -O2 16G + # clang debug multitarget -O0 -g 14G + + local build_size=550 + use clang && build_size=1200 + + if use debug; then + ewarn "USE=debug is known to increase the size of package considerably" + ewarn "and cause the tests to fail." + ewarn + + (( build_size *= 14 )) + elif is-flagq '-g?(gdb)?([1-9])'; then + ewarn "The C++ compiler -g option is known to increase the size of the package" + ewarn "considerably. If you run out of space, please consider removing it." + ewarn + + (( build_size *= 10 )) + fi + + # Multiply by number of ABIs :). + local abis=( $(multilib_get_enabled_abis) ) + (( build_size *= ${#abis[@]} )) + + local CHECKREQS_DISK_BUILD=${build_size}M + check-reqs_pkg_pretend + + if [[ ${MERGE_TYPE} != binary ]]; then + echo 'int main() {return 0;}' > "${T}"/test.cxx || die + ebegin "Trying to build a C++11 test program" + if ! $(tc-getCXX) -std=c++11 -o /dev/null "${T}"/test.cxx; then + eerror "LLVM-${PV} requires C++11-capable C++ compiler. Your current compiler" + eerror "does not seem to support -std=c++11 option. Please upgrade your compiler" + eerror "to gcc-4.7 or an equivalent version supporting C++11." + die "Currently active compiler does not support -std=c++11" + fi + eend ${?} + fi +} + +pkg_setup() { + pkg_pretend +} + +src_unpack() { + default + + rm -f "${S}"/tools/clang "${S}"/projects/compiler-rt \ + || die "symlinks removal failed" + + if use clang; then + mv "${WORKDIR}"/cfe-${PV}.src "${S}"/tools/clang \ + || die "clang source directory move failed" + mv "${WORKDIR}"/compiler-rt-${PV}.src "${S}"/projects/compiler-rt \ + || die "compiler-rt source directory move failed" + mv "${WORKDIR}"/clang-tools-extra-${PV}.src "${S}"/tools/clang/tools/extra \ + || die "clang-tools-extra source directory move failed" + fi +} + +src_prepare() { + epatch "${FILESDIR}"/${PN}-3.2-nodoctargz.patch + epatch "${FILESDIR}"/${PN}-3.5-gcc-4.9.patch + epatch "${FILESDIR}"/${PN}-3.5-gentoo-install.patch + + epatch "${FILESDIR}"/${P}-fix_LLVMExports_cmake.patch + + if use clang; then + # Automatically select active system GCC's libraries, bugs #406163 and #417913 + epatch "${FILESDIR}"/clang-3.5-gentoo-runtime-gcc-detection-v3.patch + + epatch "${FILESDIR}"/clang-3.5-gentoo-install.patch + epatch "${FILESDIR}"/clang-3.4-darwin_prefix-include-paths.patch + eprefixify tools/clang/lib/Frontend/InitHeaderSearch.cpp + fi + + if use prefix && use clang; then + sed -i -e "/^CFLAGS /s@-Werror@-I${EPREFIX}/usr/include@" \ + projects/compiler-rt/make/platform/clang_*.mk || die + fi + + local sub_files=( + Makefile.config.in + Makefile.rules + tools/llvm-config/llvm-config.cpp + ) + use clang && sub_files+=( + tools/clang/lib/Driver/Tools.cpp + tools/clang/tools/scan-build/scan-build + ) + + # unfortunately ./configure won't listen to --mandir and the-like, so take + # care of this. + # note: we're setting the main libdir intentionally. + # where per-ABI is appropriate, we use $(GENTOO_LIBDIR) make. + einfo "Fixing install dirs" + sed -e "s,@libdir@,$(get_libdir),g" \ + -e "s,@PF@,${PF},g" \ + -e "s,@EPREFIX@,${EPREFIX},g" \ + -i "${sub_files[@]}" \ + || die "install paths sed failed" + + if use clang; then + # constantly fails for a long time, likely due to our patches + rm tools/clang/test/Driver/cross-linux.c || die + fi + + # User patches + epatch_user + + python_setup +} + +multilib_src_configure() { + # disable timestamps since they confuse ccache + local conf_flags=( + --disable-timestamps + --enable-keep-symbols + --enable-shared + --with-optimize-option= + $(tc-is-static-only && echo --disable-shared) + $(use_enable !debug optimized) + $(use_enable debug assertions) + $(use_enable debug expensive-checks) + $(use_enable libedit) + $(use_enable ncurses terminfo) + $(use_enable libffi) + ) + + # well, it's used only by clang executable c-index-test + if multilib_is_native_abi && use clang && use xml; then + conf_flags+=( XML2CONFIG="$(tc-getPKG_CONFIG) libxml-2.0" ) + else + conf_flags+=( ac_cv_prog_XML2CONFIG="" ) + fi + + local targets bindings + if use multitarget; then + targets='all' + else + targets='host,cpp' + use video_cards_radeon && targets+=',r600' + fi + conf_flags+=( --enable-targets=${targets} ) + + if multilib_is_native_abi; then + use gold && conf_flags+=( --with-binutils-include="${EPREFIX}"/usr/include/ ) + # extra commas don't hurt + use ocaml && bindings+=',ocaml' + fi + + [[ ${bindings} ]] || bindings='none' + conf_flags+=( --enable-bindings=${bindings} ) + + if use libffi; then + local CPPFLAGS=${CPPFLAGS} + append-cppflags "$(pkg-config --cflags libffi)" + fi + + # llvm prefers clang over gcc, so we may need to force that + tc-export CC CXX + + ECONF_SOURCE=${S} \ + econf "${conf_flags[@]}" +} + +set_makeargs() { + MAKEARGS=( + VERBOSE=1 + REQUIRES_RTTI=1 + GENTOO_LIBDIR=$(get_libdir) + ) + + # for tests, we want it all! otherwise, we may use a little filtering... + # adding ONLY_TOOLS also disables unittest building... + if [[ ${EBUILD_PHASE_FUNC} != src_test ]]; then + local tools=( llvm-config ) + use clang && tools+=( clang ) + + if multilib_is_native_abi; then + tools+=( + opt llvm-as llvm-dis llc llvm-ar llvm-nm llvm-link lli + llvm-extract llvm-mc llvm-bcanalyzer llvm-diff macho-dump + llvm-objdump llvm-readobj llvm-rtdyld llvm-dwarfdump llvm-cov + llvm-size llvm-stress llvm-mcmarkup llvm-profdata + llvm-symbolizer obj2yaml yaml2obj lto bugpoint + ) + + # the build system runs explicitly specified tools in parallel, + # so we need to split it into two runs + if [[ ${1} != -1 ]]; then + # those require lto + tools+=( llvm-lto ) + use gold && tools+=( gold ) + + # those require clang :) + # we need to explicitly specify all its tools + # since we're passing BUILD_CLANG_ONLY + use clang && tools+=( + clang/tools/{clang-check,clang-format,extra} + ) + fi + fi + + MAKEARGS+=( + # filter tools + disable unittests implicitly + ONLY_TOOLS="${tools[*]}" + + # this disables unittests & docs from clang + BUILD_CLANG_ONLY=YES + ) + fi +} + +multilib_src_compile() { + local MAKEARGS + set_makeargs -1 + emake "${MAKEARGS[@]}" + + if multilib_is_native_abi; then + set_makeargs + emake -C tools "${MAKEARGS[@]}" + + if use doc; then + emake -C "${S}"/docs -f Makefile.sphinx man + use clang && emake -C "${S}"/tools/clang/docs/tools \ + BUILD_FOR_WEBSITE=1 DST_MAN_DIR="${T}"/ man + emake -C "${S}"/docs -f Makefile.sphinx html + fi + fi + + if use debug; then + pax-mark m Debug+Asserts+Checks/bin/llvm-rtdyld + pax-mark m Debug+Asserts+Checks/bin/lli + pax-mark m Debug+Asserts+Checks/bin/lli-child-target + else + pax-mark m Release/bin/llvm-rtdyld + pax-mark m Release/bin/lli + pax-mark m Release/bin/lli-child-target + fi +} + +multilib_src_test() { + local MAKEARGS + set_makeargs + + # build the remaining tools & unittests + emake "${MAKEARGS[@]}" + + pax-mark m unittests/ExecutionEngine/JIT/Release/JITTests + pax-mark m unittests/ExecutionEngine/MCJIT/Release/MCJITTests + pax-mark m unittests/Support/Release/SupportTests + + # respect TMPDIR! + local -x LIT_PRESERVES_TMP=1 + emake "${MAKEARGS[@]}" check + use clang && emake "${MAKEARGS[@]}" -C tools/clang test +} + +src_install() { + local MULTILIB_CHOST_TOOLS=( + /usr/bin/llvm-config + ) + + local MULTILIB_WRAPPED_HEADERS=( + /usr/include/llvm/Config/config.h + /usr/include/llvm/Config/llvm-config.h + ) + + if use clang; then + # note: magic applied below + MULTILIB_CHOST_TOOLS+=( + /usr/bin/clang + /usr/bin/clang++ + /usr/bin/clang-${PV} + /usr/bin/clang++-${PV} + ) + + MULTILIB_WRAPPED_HEADERS+=( + /usr/include/clang/Config/config.h + ) + fi + + multilib-minimal_src_install + + # Remove unnecessary headers on FreeBSD, bug #417171 + use kernel_FreeBSD && use clang && rm "${ED}"usr/lib/clang/${PV}/include/{std,float,iso,limits,tgmath,varargs}*.h +} + +multilib_src_install() { + local MAKEARGS + set_makeargs + + local root=${D}/_${ABI} + + emake "${MAKEARGS[@]}" DESTDIR="${root}" install + multibuild_merge_root "${root}" "${D}" + + if ! multilib_is_native_abi; then + # Backwards compat, will be happily removed someday. + dosym "${CHOST}"-llvm-config /usr/bin/llvm-config.${ABI} + else + # Install docs. + if use doc; then + doman "${S}"/docs/_build/man/*.1 + use clang && doman "${T}"/clang.1 + dohtml -r "${S}"/docs/_build/html/ + else + if ! use clang; then + rm "${WORKDIR}"/${P}-manpages/clang.1 || die + fi + doman "${WORKDIR}"/${P}-manpages/*.1 + fi + + # Symlink the gold plugin. + if use gold; then + dodir /usr/${CHOST}/binutils-bin/lib/bfd-plugins + dosym ../../../../$(get_libdir)/LLVMgold.so \ + /usr/${CHOST}/binutils-bin/lib/bfd-plugins/LLVMgold.so + fi + fi + + # apply CHOST and PV to clang executables + # they're statically linked so we don't have to worry about the lib + if use clang; then + local clang_tools=( clang clang++ ) + local i + + # append ${PV} and symlink back + # TODO: use alternatives.eclass? does that make any sense? + # maybe with USE=-clang on :0 and USE=clang on older + for i in "${clang_tools[@]}"; do + mv "${ED%/}/usr/bin/${i}"{,-${PV}} || die + dosym "${i}"-${PV} /usr/bin/${i} + done + + # now prepend ${CHOST} and let the multilib-build.eclass symlink it + if ! multilib_is_native_abi; then + # non-native? let's replace it with a simple wrapper + for i in "${clang_tools[@]}"; do + rm "${ED%/}/usr/bin/${i}-${PV}" || die + cat > "${T}"/wrapper.tmp <<-_EOF_ + #!${EPREFIX}/bin/sh + exec "${i}-${PV}" $(get_abi_CFLAGS) "\${@}" + _EOF_ + newbin "${T}"/wrapper.tmp "${i}-${PV}" + done + fi + fi + + # Fix install_names on Darwin. The build system is too complicated + # to just fix this, so we correct it post-install + local lib= f= odylib= ndylib= libpv=${PV} + if [[ ${CHOST} == *-darwin* ]] ; then + eval $(grep PACKAGE_VERSION= configure) + [[ -n ${PACKAGE_VERSION} ]] && libpv=${PACKAGE_VERSION} + libpvminor=${libpv%.[0-9]*} + for lib in lib{EnhancedDisassembly,LLVM-${libpv},LTO,profile_rt,clang}.dylib LLVMHello.dylib clang/${libpv}/lib/darwin/libclang_rt.asan_{osx,iossim}_dynamic.dylib; do + # libEnhancedDisassembly is Darwin10 only, so non-fatal + # + omit clang libs if not enabled + [[ -f ${ED}/usr/lib/${lib} ]] || continue + + ebegin "fixing install_name of $lib" + install_name_tool \ + -id "${EPREFIX}"/usr/lib/${lib} \ + "${ED}"/usr/lib/${lib} + eend $? + done + for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/lib*.dylib "${ED}"/usr/lib/clang/${libpv}/lib/darwin/*.dylib ; do + # omit clang libs if not enabled + [[ -f "${f}" ]] || continue + + scanmacho -BF'%n#f' "${f}" | tr ',' '\n' | \ + while read odylib ; do + ndylib= + case ${odylib} in + */libclang.dylib) + ndylib="${EPREFIX}"/usr/lib/libclang.dylib + ;; + */libLLVM-${libpv}.dylib) + ndylib="${EPREFIX}"/usr/lib/libLLVM-${libpv}.dylib + ;; + */libLLVM-${libpvminor}.dylib) + ndylib="${EPREFIX}"/usr/lib/libLLVM-${libpvminor}.dylib + ;; + */libLTO.dylib) + ndylib="${EPREFIX}"/usr/lib/libLTO.dylib + ;; + esac + if [[ -n ${ndylib} ]] ; then + ebegin "fixing install_name reference to ${odylib} of ${f##*/}" + install_name_tool \ + -change "${odylib}" "${ndylib}" \ + "${f}" + eend $? + fi + done + done + fi +} + +multilib_src_install_all() { + insinto /usr/share/vim/vimfiles/syntax + doins utils/vim/*.vim + + if use clang; then + cd tools/clang || die + + if use static-analyzer ; then + dobin tools/scan-build/ccc-analyzer + dosym ccc-analyzer /usr/bin/c++-analyzer + dobin tools/scan-build/scan-build + + insinto /usr/share/${PN} + doins tools/scan-build/scanview.css + doins tools/scan-build/sorttable.js + fi + + python_inst() { + if use static-analyzer ; then + pushd tools/scan-view >/dev/null || die + + python_doscript scan-view + + touch __init__.py || die + python_moduleinto clang + python_domodule __init__.py Reporter.py Resources ScanView.py startfile.py + + popd >/dev/null || die + fi + + if use python ; then + pushd bindings/python/clang >/dev/null || die + + python_moduleinto clang + python_domodule __init__.py cindex.py enumerations.py + + popd >/dev/null || die + fi + + # AddressSanitizer symbolizer (currently separate) + python_doscript "${S}"/projects/compiler-rt/lib/asan/scripts/asan_symbolize.py + } + python_foreach_impl python_inst + fi +} diff --git a/sys-devel/llvm/llvm-3.5.1.ebuild b/sys-devel/llvm/llvm-3.5.1.ebuild new file mode 100644 index 000000000000..14a9e2b5c9d1 --- /dev/null +++ b/sys-devel/llvm/llvm-3.5.1.ebuild @@ -0,0 +1,530 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI=5 + +PYTHON_COMPAT=( python2_7 pypy ) + +inherit eutils flag-o-matic multibuild multilib \ + multilib-minimal python-r1 toolchain-funcs pax-utils check-reqs prefix + +DESCRIPTION="Low Level Virtual Machine" +HOMEPAGE="http://llvm.org/" +SRC_URI="http://llvm.org/releases/${PV}/${P}.src.tar.xz + clang? ( http://llvm.org/releases/${PV}/compiler-rt-${PV}.src.tar.xz + http://llvm.org/releases/${PV}/cfe-${PV}.src.tar.xz + http://llvm.org/releases/${PV}/clang-tools-extra-${PV}.src.tar.xz ) + !doc? ( http://dev.gentoo.org/~voyageur/distfiles/${PN}-3.5.0-manpages.tar.bz2 )" + +LICENSE="UoI-NCSA" +SLOT="0/3.5" +KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos" +IUSE="clang debug doc gold libedit +libffi multitarget ncurses ocaml python + +static-analyzer test xml video_cards_radeon + kernel_Darwin kernel_FreeBSD" + +COMMON_DEPEND=" + sys-libs/zlib:0= + clang? ( + python? ( ${PYTHON_DEPS} ) + static-analyzer? ( + dev-lang/perl:* + ${PYTHON_DEPS} + ) + xml? ( dev-libs/libxml2:2= ) + ) + gold? ( >=sys-devel/binutils-2.22:*[cxx] ) + libedit? ( dev-libs/libedit:0=[${MULTILIB_USEDEP}] ) + libffi? ( >=virtual/libffi-3.0.13-r1:0=[${MULTILIB_USEDEP}] ) + ncurses? ( >=sys-libs/ncurses-5.9-r3:5=[${MULTILIB_USEDEP}] ) + ocaml? ( dev-lang/ocaml:0= )" +# configparser-3.2 breaks the build (3.3 or none at all are fine) +DEPEND="${COMMON_DEPEND} + app-arch/xz-utils + dev-lang/perl + >=sys-devel/make-3.81 + >=sys-devel/flex-2.5.4 + >=sys-devel/bison-1.875d + || ( >=sys-devel/gcc-3.0 >=sys-devel/gcc-apple-4.2.1 + ( >=sys-freebsd/freebsd-lib-9.1-r10 sys-libs/libcxx ) + ) + || ( >=sys-devel/binutils-2.18 >=sys-devel/binutils-apple-5.1 ) + clang? ( xml? ( virtual/pkgconfig ) ) + doc? ( dev-python/sphinx ) + libffi? ( virtual/pkgconfig ) + !!<dev-python/configparser-3.3.0.2 + ${PYTHON_DEPS}" +RDEPEND="${COMMON_DEPEND} + clang? ( !<=sys-devel/clang-${PV}-r99 + !>=sys-devel/clang-9999 ) + abi_x86_32? ( !<=app-emulation/emul-linux-x86-baselibs-20130224-r2 + !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)] )" +PDEPEND="clang? ( =sys-devel/clang-${PV}-r100 )" + +# pypy gives me around 1700 unresolved tests due to open file limit +# being exceeded. probably GC does not close them fast enough. +REQUIRED_USE="${PYTHON_REQUIRED_USE} + test? ( || ( $(python_gen_useflags 'python*') ) )" + +S=${WORKDIR}/${P}.src + +# Some people actually override that in make.conf. That sucks since +# we need to run install per-directory, and ninja can't do that... +# so why did it call itself ninja in the first place? +CMAKE_MAKEFILE_GENERATOR=emake + +pkg_pretend() { + # in megs + # !clang !debug !multitarget -O2 400 + # !clang !debug multitarget -O2 550 + # clang !debug !multitarget -O2 950 + # clang !debug multitarget -O2 1200 + # !clang debug multitarget -O2 5G + # clang !debug multitarget -O0 -g 12G + # clang debug multitarget -O2 16G + # clang debug multitarget -O0 -g 14G + + local build_size=550 + use clang && build_size=1200 + + if use debug; then + ewarn "USE=debug is known to increase the size of package considerably" + ewarn "and cause the tests to fail." + ewarn + + (( build_size *= 14 )) + elif is-flagq '-g?(gdb)?([1-9])'; then + ewarn "The C++ compiler -g option is known to increase the size of the package" + ewarn "considerably. If you run out of space, please consider removing it." + ewarn + + (( build_size *= 10 )) + fi + + # Multiply by number of ABIs :). + local abis=( $(multilib_get_enabled_abis) ) + (( build_size *= ${#abis[@]} )) + + local CHECKREQS_DISK_BUILD=${build_size}M + check-reqs_pkg_pretend + + if [[ ${MERGE_TYPE} != binary ]]; then + echo 'int main() {return 0;}' > "${T}"/test.cxx || die + ebegin "Trying to build a C++11 test program" + if ! $(tc-getCXX) -std=c++11 -o /dev/null "${T}"/test.cxx; then + eerror "LLVM-${PV} requires C++11-capable C++ compiler. Your current compiler" + eerror "does not seem to support -std=c++11 option. Please upgrade your compiler" + eerror "to gcc-4.7 or an equivalent version supporting C++11." + die "Currently active compiler does not support -std=c++11" + fi + eend ${?} + fi +} + +pkg_setup() { + pkg_pretend +} + +src_unpack() { + default + + rm -f "${S}"/tools/clang "${S}"/projects/compiler-rt \ + || die "symlinks removal failed" + + if use clang; then + mv "${WORKDIR}"/cfe-${PV}.src "${S}"/tools/clang \ + || die "clang source directory move failed" + mv "${WORKDIR}"/compiler-rt-${PV}.src "${S}"/projects/compiler-rt \ + || die "compiler-rt source directory move failed" + mv "${WORKDIR}"/clang-tools-extra-${PV}.src "${S}"/tools/clang/tools/extra \ + || die "clang-tools-extra source directory move failed" + fi +} + +src_prepare() { + epatch "${FILESDIR}"/${PN}-3.2-nodoctargz.patch + epatch "${FILESDIR}"/${PN}-3.5-gcc-4.9.patch + epatch "${FILESDIR}"/${PN}-3.5-gentoo-install.patch + # Make ocaml warnings non-fatal, bug #537308 + sed -e "/RUN/s/-warn-error A//" -i test/Bindings/Ocaml/*ml || die + + if use clang; then + # Automatically select active system GCC's libraries, bugs #406163 and #417913 + epatch "${FILESDIR}"/clang-3.5-gentoo-runtime-gcc-detection-v3.patch + + epatch "${FILESDIR}"/clang-3.5-gentoo-install.patch + epatch "${FILESDIR}"/clang-3.4-darwin_prefix-include-paths.patch + eprefixify tools/clang/lib/Frontend/InitHeaderSearch.cpp + fi + + if use prefix && use clang; then + sed -i -e "/^CFLAGS /s@-Werror@-I${EPREFIX}/usr/include@" \ + projects/compiler-rt/make/platform/clang_*.mk || die + fi + + local sub_files=( + Makefile.config.in + Makefile.rules + tools/llvm-config/llvm-config.cpp + ) + use clang && sub_files+=( + tools/clang/lib/Driver/Tools.cpp + tools/clang/tools/scan-build/scan-build + ) + + # unfortunately ./configure won't listen to --mandir and the-like, so take + # care of this. + # note: we're setting the main libdir intentionally. + # where per-ABI is appropriate, we use $(GENTOO_LIBDIR) make. + einfo "Fixing install dirs" + sed -e "s,@libdir@,$(get_libdir),g" \ + -e "s,@PF@,${PF},g" \ + -e "s,@EPREFIX@,${EPREFIX},g" \ + -i "${sub_files[@]}" \ + || die "install paths sed failed" + + if use clang; then + # constantly fails for a long time, likely due to our patches + rm tools/clang/test/Driver/cross-linux.c || die + fi + + # User patches + epatch_user + + python_setup +} + +multilib_src_configure() { + # disable timestamps since they confuse ccache + local conf_flags=( + --disable-timestamps + --enable-keep-symbols + --enable-shared + --with-optimize-option= + $(tc-is-static-only && echo --disable-shared) + $(use_enable !debug optimized) + $(use_enable debug assertions) + $(use_enable debug expensive-checks) + $(use_enable libedit) + $(use_enable ncurses terminfo) + $(use_enable libffi) + ) + + # well, it's used only by clang executable c-index-test + if multilib_is_native_abi && use clang && use xml; then + conf_flags+=( XML2CONFIG="$(tc-getPKG_CONFIG) libxml-2.0" ) + else + conf_flags+=( ac_cv_prog_XML2CONFIG="" ) + fi + + local targets bindings + if use multitarget; then + targets='all' + else + targets='host,cpp' + use video_cards_radeon && targets+=',r600' + fi + conf_flags+=( --enable-targets=${targets} ) + + if multilib_is_native_abi; then + use gold && conf_flags+=( --with-binutils-include="${EPREFIX}"/usr/include/ ) + # extra commas don't hurt + use ocaml && bindings+=',ocaml' + fi + + [[ ${bindings} ]] || bindings='none' + conf_flags+=( --enable-bindings=${bindings} ) + + if use libffi; then + local CPPFLAGS=${CPPFLAGS} + append-cppflags "$(pkg-config --cflags libffi)" + fi + + # llvm prefers clang over gcc, so we may need to force that + tc-export CC CXX + + ECONF_SOURCE=${S} \ + econf "${conf_flags[@]}" +} + +set_makeargs() { + MAKEARGS=( + VERBOSE=1 + REQUIRES_RTTI=1 + GENTOO_LIBDIR=$(get_libdir) + ) + + # for tests, we want it all! otherwise, we may use a little filtering... + # adding ONLY_TOOLS also disables unittest building... + if [[ ${EBUILD_PHASE_FUNC} != src_test ]]; then + local tools=( llvm-config ) + use clang && tools+=( clang ) + + if multilib_is_native_abi; then + tools+=( + opt llvm-as llvm-dis llc llvm-ar llvm-nm llvm-link lli + llvm-extract llvm-mc llvm-bcanalyzer llvm-diff macho-dump + llvm-objdump llvm-readobj llvm-rtdyld llvm-dwarfdump llvm-cov + llvm-size llvm-stress llvm-mcmarkup llvm-profdata + llvm-symbolizer obj2yaml yaml2obj lto bugpoint + ) + + # the build system runs explicitly specified tools in parallel, + # so we need to split it into two runs + if [[ ${1} != -1 ]]; then + # those require lto + tools+=( llvm-lto ) + use gold && tools+=( gold ) + + # those require clang :) + # we need to explicitly specify all its tools + # since we're passing BUILD_CLANG_ONLY + use clang && tools+=( + clang/tools/{clang-check,clang-format,extra} + ) + fi + fi + + MAKEARGS+=( + # filter tools + disable unittests implicitly + ONLY_TOOLS="${tools[*]}" + + # this disables unittests & docs from clang + BUILD_CLANG_ONLY=YES + ) + fi +} + +multilib_src_compile() { + local MAKEARGS + set_makeargs -1 + emake "${MAKEARGS[@]}" + + if multilib_is_native_abi; then + set_makeargs + emake -C tools "${MAKEARGS[@]}" + + if use doc; then + emake -C "${S}"/docs -f Makefile.sphinx man + use clang && emake -C "${S}"/tools/clang/docs/tools \ + BUILD_FOR_WEBSITE=1 DST_MAN_DIR="${T}"/ man + emake -C "${S}"/docs -f Makefile.sphinx html + fi + fi + + if use debug; then + pax-mark m Debug+Asserts+Checks/bin/llvm-rtdyld + pax-mark m Debug+Asserts+Checks/bin/lli + pax-mark m Debug+Asserts+Checks/bin/lli-child-target + else + pax-mark m Release/bin/llvm-rtdyld + pax-mark m Release/bin/lli + pax-mark m Release/bin/lli-child-target + fi +} + +multilib_src_test() { + local MAKEARGS + set_makeargs + + # build the remaining tools & unittests + emake "${MAKEARGS[@]}" + + pax-mark m unittests/ExecutionEngine/JIT/Release/JITTests + pax-mark m unittests/ExecutionEngine/MCJIT/Release/MCJITTests + pax-mark m unittests/Support/Release/SupportTests + + # respect TMPDIR! + local -x LIT_PRESERVES_TMP=1 + emake "${MAKEARGS[@]}" check + use clang && emake "${MAKEARGS[@]}" -C tools/clang test +} + +src_install() { + local MULTILIB_CHOST_TOOLS=( + /usr/bin/llvm-config + ) + + local MULTILIB_WRAPPED_HEADERS=( + /usr/include/llvm/Config/config.h + /usr/include/llvm/Config/llvm-config.h + ) + + if use clang; then + # note: magic applied below + MULTILIB_CHOST_TOOLS+=( + /usr/bin/clang + /usr/bin/clang++ + /usr/bin/clang-${PV} + /usr/bin/clang++-${PV} + ) + + MULTILIB_WRAPPED_HEADERS+=( + /usr/include/clang/Config/config.h + ) + fi + + multilib-minimal_src_install + + # Remove unnecessary headers on FreeBSD, bug #417171 + use kernel_FreeBSD && use clang && rm "${ED}"usr/lib/clang/${PV}/include/{std,float,iso,limits,tgmath,varargs}*.h +} + +multilib_src_install() { + local MAKEARGS + set_makeargs + + local root=${D}/_${ABI} + + emake "${MAKEARGS[@]}" DESTDIR="${root}" install + multibuild_merge_root "${root}" "${D}" + + if ! multilib_is_native_abi; then + # Backwards compat, will be happily removed someday. + dosym "${CHOST}"-llvm-config /usr/bin/llvm-config.${ABI} + else + # Install docs. + if use doc; then + doman "${S}"/docs/_build/man/*.1 + use clang && doman "${T}"/clang.1 + dohtml -r "${S}"/docs/_build/html/ + else + if ! use clang; then + rm "${WORKDIR}"/${PN}-3.5.0-manpages/clang.1 || die + fi + doman "${WORKDIR}"/${PN}-3.5.0-manpages/*.1 + fi + + # Symlink the gold plugin. + if use gold; then + dodir /usr/${CHOST}/binutils-bin/lib/bfd-plugins + dosym ../../../../$(get_libdir)/LLVMgold.so \ + /usr/${CHOST}/binutils-bin/lib/bfd-plugins/LLVMgold.so + fi + fi + + # apply CHOST and PV to clang executables + # they're statically linked so we don't have to worry about the lib + if use clang; then + local clang_tools=( clang clang++ ) + local i + + # append ${PV} and symlink back + # TODO: use alternatives.eclass? does that make any sense? + # maybe with USE=-clang on :0 and USE=clang on older + for i in "${clang_tools[@]}"; do + mv "${ED%/}/usr/bin/${i}"{,-${PV}} || die + dosym "${i}"-${PV} /usr/bin/${i} + done + + # now prepend ${CHOST} and let the multilib-build.eclass symlink it + if ! multilib_is_native_abi; then + # non-native? let's replace it with a simple wrapper + for i in "${clang_tools[@]}"; do + rm "${ED%/}/usr/bin/${i}-${PV}" || die + cat > "${T}"/wrapper.tmp <<-_EOF_ + #!${EPREFIX}/bin/sh + exec "${i}-${PV}" $(get_abi_CFLAGS) "\${@}" + _EOF_ + newbin "${T}"/wrapper.tmp "${i}-${PV}" + done + fi + fi + + # Fix install_names on Darwin. The build system is too complicated + # to just fix this, so we correct it post-install + local lib= f= odylib= ndylib= libpv=${PV} + if [[ ${CHOST} == *-darwin* ]] ; then + eval $(grep PACKAGE_VERSION= configure) + [[ -n ${PACKAGE_VERSION} ]] && libpv=${PACKAGE_VERSION} + libpvminor=${libpv%.[0-9]*} + for lib in lib{EnhancedDisassembly,LLVM-${libpv},LTO,profile_rt,clang}.dylib LLVMHello.dylib clang/${libpv}/lib/darwin/libclang_rt.asan_{osx,iossim}_dynamic.dylib; do + # libEnhancedDisassembly is Darwin10 only, so non-fatal + # + omit clang libs if not enabled + [[ -f ${ED}/usr/lib/${lib} ]] || continue + + ebegin "fixing install_name of $lib" + install_name_tool \ + -id "${EPREFIX}"/usr/lib/${lib} \ + "${ED}"/usr/lib/${lib} + eend $? + done + for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/lib*.dylib "${ED}"/usr/lib/clang/${libpv}/lib/darwin/*.dylib ; do + # omit clang libs if not enabled + [[ -f "${f}" ]] || continue + + scanmacho -BF'%n#f' "${f}" | tr ',' '\n' | \ + while read odylib ; do + ndylib= + case ${odylib} in + */libclang.dylib) + ndylib="${EPREFIX}"/usr/lib/libclang.dylib + ;; + */libLLVM-${libpv}.dylib) + ndylib="${EPREFIX}"/usr/lib/libLLVM-${libpv}.dylib + ;; + */libLLVM-${libpvminor}.dylib) + ndylib="${EPREFIX}"/usr/lib/libLLVM-${libpvminor}.dylib + ;; + */libLTO.dylib) + ndylib="${EPREFIX}"/usr/lib/libLTO.dylib + ;; + esac + if [[ -n ${ndylib} ]] ; then + ebegin "fixing install_name reference to ${odylib} of ${f##*/}" + install_name_tool \ + -change "${odylib}" "${ndylib}" \ + "${f}" + eend $? + fi + done + done + fi +} + +multilib_src_install_all() { + insinto /usr/share/vim/vimfiles/syntax + doins utils/vim/*.vim + + if use clang; then + cd tools/clang || die + + if use static-analyzer ; then + dobin tools/scan-build/ccc-analyzer + dosym ccc-analyzer /usr/bin/c++-analyzer + dobin tools/scan-build/scan-build + + insinto /usr/share/${PN} + doins tools/scan-build/scanview.css + doins tools/scan-build/sorttable.js + fi + + python_inst() { + if use static-analyzer ; then + pushd tools/scan-view >/dev/null || die + + python_doscript scan-view + + touch __init__.py || die + python_moduleinto clang + python_domodule __init__.py Reporter.py Resources ScanView.py startfile.py + + popd >/dev/null || die + fi + + if use python ; then + pushd bindings/python/clang >/dev/null || die + + python_moduleinto clang + python_domodule __init__.py cindex.py enumerations.py + + popd >/dev/null || die + fi + + # AddressSanitizer symbolizer (currently separate) + python_doscript "${S}"/projects/compiler-rt/lib/asan/scripts/asan_symbolize.py + } + python_foreach_impl python_inst + fi +} diff --git a/sys-devel/llvm/llvm-3.5.2.ebuild b/sys-devel/llvm/llvm-3.5.2.ebuild new file mode 100644 index 000000000000..4d3aa2ccce2f --- /dev/null +++ b/sys-devel/llvm/llvm-3.5.2.ebuild @@ -0,0 +1,532 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI=5 + +PYTHON_COMPAT=( python2_7 pypy ) + +inherit eutils flag-o-matic multibuild multilib \ + multilib-minimal python-r1 toolchain-funcs pax-utils check-reqs prefix + +DESCRIPTION="Low Level Virtual Machine" +HOMEPAGE="http://llvm.org/" +SRC_URI="http://llvm.org/releases/${PV}/${P}.src.tar.xz + clang? ( http://llvm.org/releases/${PV}/compiler-rt-${PV}.src.tar.xz + http://llvm.org/releases/${PV}/cfe-${PV}.src.tar.xz + http://llvm.org/releases/${PV}/clang-tools-extra-${PV}.src.tar.xz ) + !doc? ( http://dev.gentoo.org/~voyageur/distfiles/${PN}-3.5.0-manpages.tar.bz2 )" + +LICENSE="UoI-NCSA" +SLOT="0/3.5" +KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos" +IUSE="clang debug doc gold libedit +libffi multitarget ncurses ocaml python + +static-analyzer test xml video_cards_radeon + kernel_Darwin kernel_FreeBSD" + +COMMON_DEPEND=" + sys-libs/zlib:0= + clang? ( + python? ( ${PYTHON_DEPS} ) + static-analyzer? ( + dev-lang/perl:* + ${PYTHON_DEPS} + ) + xml? ( dev-libs/libxml2:2= ) + ) + gold? ( >=sys-devel/binutils-2.22:*[cxx] ) + libedit? ( dev-libs/libedit:0=[${MULTILIB_USEDEP}] ) + libffi? ( >=virtual/libffi-3.0.13-r1:0=[${MULTILIB_USEDEP}] ) + ncurses? ( >=sys-libs/ncurses-5.9-r3:5=[${MULTILIB_USEDEP}] ) + ocaml? ( dev-lang/ocaml:0= )" +# configparser-3.2 breaks the build (3.3 or none at all are fine) +DEPEND="${COMMON_DEPEND} + app-arch/xz-utils + dev-lang/perl + >=sys-devel/make-3.81 + >=sys-devel/flex-2.5.4 + >=sys-devel/bison-1.875d + || ( >=sys-devel/gcc-3.0 >=sys-devel/llvm-3.3 + ( >=sys-freebsd/freebsd-lib-9.1-r10 sys-libs/libcxx ) + ) + || ( >=sys-devel/binutils-2.18 >=sys-devel/binutils-apple-5.1 ) + kernel_Darwin? ( sys-libs/libcxx ) + clang? ( xml? ( virtual/pkgconfig ) ) + doc? ( dev-python/sphinx ) + libffi? ( virtual/pkgconfig ) + !!<dev-python/configparser-3.3.0.2 + ${PYTHON_DEPS}" +RDEPEND="${COMMON_DEPEND} + clang? ( !<=sys-devel/clang-${PV}-r99 + !>=sys-devel/clang-9999 ) + abi_x86_32? ( !<=app-emulation/emul-linux-x86-baselibs-20130224-r2 + !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)] )" +PDEPEND="clang? ( =sys-devel/clang-${PV}-r100 )" + +# pypy gives me around 1700 unresolved tests due to open file limit +# being exceeded. probably GC does not close them fast enough. +REQUIRED_USE="${PYTHON_REQUIRED_USE} + test? ( || ( $(python_gen_useflags 'python*') ) )" + +S=${WORKDIR}/${P}.src + +# Some people actually override that in make.conf. That sucks since +# we need to run install per-directory, and ninja can't do that... +# so why did it call itself ninja in the first place? +CMAKE_MAKEFILE_GENERATOR=emake + +pkg_pretend() { + # in megs + # !clang !debug !multitarget -O2 400 + # !clang !debug multitarget -O2 550 + # clang !debug !multitarget -O2 950 + # clang !debug multitarget -O2 1200 + # !clang debug multitarget -O2 5G + # clang !debug multitarget -O0 -g 12G + # clang debug multitarget -O2 16G + # clang debug multitarget -O0 -g 14G + + local build_size=550 + use clang && build_size=1200 + + if use debug; then + ewarn "USE=debug is known to increase the size of package considerably" + ewarn "and cause the tests to fail." + ewarn + + (( build_size *= 14 )) + elif is-flagq '-g?(gdb)?([1-9])'; then + ewarn "The C++ compiler -g option is known to increase the size of the package" + ewarn "considerably. If you run out of space, please consider removing it." + ewarn + + (( build_size *= 10 )) + fi + + # Multiply by number of ABIs :). + local abis=( $(multilib_get_enabled_abis) ) + (( build_size *= ${#abis[@]} )) + + local CHECKREQS_DISK_BUILD=${build_size}M + check-reqs_pkg_pretend + + if [[ ${MERGE_TYPE} != binary ]]; then + echo 'int main() {return 0;}' > "${T}"/test.cxx || die + ebegin "Trying to build a C++11 test program" + if ! $(tc-getCXX) -std=c++11 -o /dev/null "${T}"/test.cxx; then + eerror "LLVM-${PV} requires C++11-capable C++ compiler. Your current compiler" + eerror "does not seem to support -std=c++11 option. Please upgrade your compiler" + eerror "to gcc-4.7 or an equivalent version supporting C++11." + die "Currently active compiler does not support -std=c++11" + fi + eend ${?} + fi +} + +pkg_setup() { + pkg_pretend +} + +src_unpack() { + default + + rm -f "${S}"/tools/clang "${S}"/projects/compiler-rt \ + || die "symlinks removal failed" + + if use clang; then + mv "${WORKDIR}"/cfe-${PV}.src "${S}"/tools/clang \ + || die "clang source directory move failed" + mv "${WORKDIR}"/compiler-rt-${PV}.src "${S}"/projects/compiler-rt \ + || die "compiler-rt source directory move failed" + mv "${WORKDIR}"/clang-tools-extra-${PV}.src "${S}"/tools/clang/tools/extra \ + || die "clang-tools-extra source directory move failed" + fi +} + +src_prepare() { + epatch "${FILESDIR}"/${PN}-3.2-nodoctargz.patch + epatch "${FILESDIR}"/${PN}-3.5-gcc-4.9.patch + epatch "${FILESDIR}"/${PN}-3.5-gentoo-install.patch + epatch "${FILESDIR}"/${P}-gcc-5.1.patch + # Make ocaml warnings non-fatal, bug #537308 + sed -e "/RUN/s/-warn-error A//" -i test/Bindings/Ocaml/*ml || die + + if use clang; then + # Automatically select active system GCC's libraries, bugs #406163 and #417913 + epatch "${FILESDIR}"/clang-3.5-gentoo-runtime-gcc-detection-v3.patch + + epatch "${FILESDIR}"/clang-3.5-gentoo-install.patch + epatch "${FILESDIR}"/clang-3.4-darwin_prefix-include-paths.patch + eprefixify tools/clang/lib/Frontend/InitHeaderSearch.cpp + fi + + if use prefix && use clang; then + sed -i -e "/^CFLAGS /s@-Werror@-I${EPREFIX}/usr/include@" \ + projects/compiler-rt/make/platform/clang_*.mk || die + fi + + local sub_files=( + Makefile.config.in + Makefile.rules + tools/llvm-config/llvm-config.cpp + ) + use clang && sub_files+=( + tools/clang/lib/Driver/Tools.cpp + tools/clang/tools/scan-build/scan-build + ) + + # unfortunately ./configure won't listen to --mandir and the-like, so take + # care of this. + # note: we're setting the main libdir intentionally. + # where per-ABI is appropriate, we use $(GENTOO_LIBDIR) make. + einfo "Fixing install dirs" + sed -e "s,@libdir@,$(get_libdir),g" \ + -e "s,@PF@,${PF},g" \ + -e "s,@EPREFIX@,${EPREFIX},g" \ + -i "${sub_files[@]}" \ + || die "install paths sed failed" + + if use clang; then + # constantly fails for a long time, likely due to our patches + rm tools/clang/test/Driver/cross-linux.c || die + fi + + # User patches + epatch_user + + python_setup +} + +multilib_src_configure() { + # disable timestamps since they confuse ccache + local conf_flags=( + --disable-timestamps + --enable-keep-symbols + --enable-shared + --with-optimize-option= + $(tc-is-static-only && echo --disable-shared) + $(use_enable !debug optimized) + $(use_enable debug assertions) + $(use_enable debug expensive-checks) + $(use_enable libedit) + $(use_enable ncurses terminfo) + $(use_enable libffi) + ) + + # well, it's used only by clang executable c-index-test + if multilib_is_native_abi && use clang && use xml; then + conf_flags+=( XML2CONFIG="$(tc-getPKG_CONFIG) libxml-2.0" ) + else + conf_flags+=( ac_cv_prog_XML2CONFIG="" ) + fi + + local targets bindings + if use multitarget; then + targets='all' + else + targets='host,cpp' + use video_cards_radeon && targets+=',r600' + fi + conf_flags+=( --enable-targets=${targets} ) + + if multilib_is_native_abi; then + use gold && conf_flags+=( --with-binutils-include="${EPREFIX}"/usr/include/ ) + # extra commas don't hurt + use ocaml && bindings+=',ocaml' + fi + + [[ ${bindings} ]] || bindings='none' + conf_flags+=( --enable-bindings=${bindings} ) + + if use libffi; then + local CPPFLAGS=${CPPFLAGS} + append-cppflags "$(pkg-config --cflags libffi)" + fi + + # llvm prefers clang over gcc, so we may need to force that + tc-export CC CXX + + ECONF_SOURCE=${S} \ + econf "${conf_flags[@]}" +} + +set_makeargs() { + MAKEARGS=( + VERBOSE=1 + REQUIRES_RTTI=1 + GENTOO_LIBDIR=$(get_libdir) + ) + + # for tests, we want it all! otherwise, we may use a little filtering... + # adding ONLY_TOOLS also disables unittest building... + if [[ ${EBUILD_PHASE_FUNC} != src_test ]]; then + local tools=( llvm-config ) + use clang && tools+=( clang ) + + if multilib_is_native_abi; then + tools+=( + opt llvm-as llvm-dis llc llvm-ar llvm-nm llvm-link lli + llvm-extract llvm-mc llvm-bcanalyzer llvm-diff macho-dump + llvm-objdump llvm-readobj llvm-rtdyld llvm-dwarfdump llvm-cov + llvm-size llvm-stress llvm-mcmarkup llvm-profdata + llvm-symbolizer obj2yaml yaml2obj lto bugpoint + ) + + # the build system runs explicitly specified tools in parallel, + # so we need to split it into two runs + if [[ ${1} != -1 ]]; then + # those require lto + tools+=( llvm-lto ) + use gold && tools+=( gold ) + + # those require clang :) + # we need to explicitly specify all its tools + # since we're passing BUILD_CLANG_ONLY + use clang && tools+=( + clang/tools/{clang-check,clang-format,extra} + ) + fi + fi + + MAKEARGS+=( + # filter tools + disable unittests implicitly + ONLY_TOOLS="${tools[*]}" + + # this disables unittests & docs from clang + BUILD_CLANG_ONLY=YES + ) + fi +} + +multilib_src_compile() { + local MAKEARGS + set_makeargs -1 + emake "${MAKEARGS[@]}" + + if multilib_is_native_abi; then + set_makeargs + emake -C tools "${MAKEARGS[@]}" + + if use doc; then + emake -C "${S}"/docs -f Makefile.sphinx man + use clang && emake -C "${S}"/tools/clang/docs/tools \ + BUILD_FOR_WEBSITE=1 DST_MAN_DIR="${T}"/ man + emake -C "${S}"/docs -f Makefile.sphinx html + fi + fi + + if use debug; then + pax-mark m Debug+Asserts+Checks/bin/llvm-rtdyld + pax-mark m Debug+Asserts+Checks/bin/lli + pax-mark m Debug+Asserts+Checks/bin/lli-child-target + else + pax-mark m Release/bin/llvm-rtdyld + pax-mark m Release/bin/lli + pax-mark m Release/bin/lli-child-target + fi +} + +multilib_src_test() { + local MAKEARGS + set_makeargs + + # build the remaining tools & unittests + emake "${MAKEARGS[@]}" + + pax-mark m unittests/ExecutionEngine/JIT/Release/JITTests + pax-mark m unittests/ExecutionEngine/MCJIT/Release/MCJITTests + pax-mark m unittests/Support/Release/SupportTests + + # respect TMPDIR! + local -x LIT_PRESERVES_TMP=1 + emake "${MAKEARGS[@]}" check + use clang && emake "${MAKEARGS[@]}" -C tools/clang test +} + +src_install() { + local MULTILIB_CHOST_TOOLS=( + /usr/bin/llvm-config + ) + + local MULTILIB_WRAPPED_HEADERS=( + /usr/include/llvm/Config/config.h + /usr/include/llvm/Config/llvm-config.h + ) + + if use clang; then + # note: magic applied below + MULTILIB_CHOST_TOOLS+=( + /usr/bin/clang + /usr/bin/clang++ + /usr/bin/clang-${PV} + /usr/bin/clang++-${PV} + ) + + MULTILIB_WRAPPED_HEADERS+=( + /usr/include/clang/Config/config.h + ) + fi + + multilib-minimal_src_install + + # Remove unnecessary headers on FreeBSD, bug #417171 + use kernel_FreeBSD && use clang && rm "${ED}"usr/lib/clang/${PV}/include/{std,float,iso,limits,tgmath,varargs}*.h +} + +multilib_src_install() { + local MAKEARGS + set_makeargs + + local root=${D}/_${ABI} + + emake "${MAKEARGS[@]}" DESTDIR="${root}" install + multibuild_merge_root "${root}" "${D}" + + if ! multilib_is_native_abi; then + # Backwards compat, will be happily removed someday. + dosym "${CHOST}"-llvm-config /usr/bin/llvm-config.${ABI} + else + # Install docs. + if use doc; then + doman "${S}"/docs/_build/man/*.1 + use clang && doman "${T}"/clang.1 + dohtml -r "${S}"/docs/_build/html/ + else + if ! use clang; then + rm "${WORKDIR}"/${PN}-3.5.0-manpages/clang.1 || die + fi + doman "${WORKDIR}"/${PN}-3.5.0-manpages/*.1 + fi + + # Symlink the gold plugin. + if use gold; then + dodir /usr/${CHOST}/binutils-bin/lib/bfd-plugins + dosym ../../../../$(get_libdir)/LLVMgold.so \ + /usr/${CHOST}/binutils-bin/lib/bfd-plugins/LLVMgold.so + fi + fi + + # apply CHOST and PV to clang executables + # they're statically linked so we don't have to worry about the lib + if use clang; then + local clang_tools=( clang clang++ ) + local i + + # append ${PV} and symlink back + # TODO: use alternatives.eclass? does that make any sense? + # maybe with USE=-clang on :0 and USE=clang on older + for i in "${clang_tools[@]}"; do + mv "${ED%/}/usr/bin/${i}"{,-${PV}} || die + dosym "${i}"-${PV} /usr/bin/${i} + done + + # now prepend ${CHOST} and let the multilib-build.eclass symlink it + if ! multilib_is_native_abi; then + # non-native? let's replace it with a simple wrapper + for i in "${clang_tools[@]}"; do + rm "${ED%/}/usr/bin/${i}-${PV}" || die + cat > "${T}"/wrapper.tmp <<-_EOF_ + #!${EPREFIX}/bin/sh + exec "${i}-${PV}" $(get_abi_CFLAGS) "\${@}" + _EOF_ + newbin "${T}"/wrapper.tmp "${i}-${PV}" + done + fi + fi + + # Fix install_names on Darwin. The build system is too complicated + # to just fix this, so we correct it post-install + local lib= f= odylib= ndylib= libpv=${PV} + if [[ ${CHOST} == *-darwin* ]] ; then + eval $(grep PACKAGE_VERSION= configure) + [[ -n ${PACKAGE_VERSION} ]] && libpv=${PACKAGE_VERSION} + libpvminor=${libpv%.[0-9]*} + for lib in lib{EnhancedDisassembly,LLVM-${libpv},LTO,profile_rt,clang}.dylib LLVMHello.dylib clang/${libpv}/lib/darwin/libclang_rt.asan_{osx,iossim}_dynamic.dylib; do + # libEnhancedDisassembly is Darwin10 only, so non-fatal + # + omit clang libs if not enabled + [[ -f ${ED}/usr/lib/${lib} ]] || continue + + ebegin "fixing install_name of $lib" + install_name_tool \ + -id "${EPREFIX}"/usr/lib/${lib} \ + "${ED}"/usr/lib/${lib} + eend $? + done + for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/lib*.dylib "${ED}"/usr/lib/clang/${libpv}/lib/darwin/*.dylib ; do + # omit clang libs if not enabled + [[ -f "${f}" ]] || continue + + scanmacho -BF'%n#f' "${f}" | tr ',' '\n' | \ + while read odylib ; do + ndylib= + case ${odylib} in + */libclang.dylib) + ndylib="${EPREFIX}"/usr/lib/libclang.dylib + ;; + */libLLVM-${libpv}.dylib) + ndylib="${EPREFIX}"/usr/lib/libLLVM-${libpv}.dylib + ;; + */libLLVM-${libpvminor}.dylib) + ndylib="${EPREFIX}"/usr/lib/libLLVM-${libpvminor}.dylib + ;; + */libLTO.dylib) + ndylib="${EPREFIX}"/usr/lib/libLTO.dylib + ;; + esac + if [[ -n ${ndylib} ]] ; then + ebegin "fixing install_name reference to ${odylib} of ${f##*/}" + install_name_tool \ + -change "${odylib}" "${ndylib}" \ + "${f}" + eend $? + fi + done + done + fi +} + +multilib_src_install_all() { + insinto /usr/share/vim/vimfiles/syntax + doins utils/vim/*.vim + + if use clang; then + cd tools/clang || die + + if use static-analyzer ; then + dobin tools/scan-build/ccc-analyzer + dosym ccc-analyzer /usr/bin/c++-analyzer + dobin tools/scan-build/scan-build + + insinto /usr/share/${PN} + doins tools/scan-build/scanview.css + doins tools/scan-build/sorttable.js + fi + + python_inst() { + if use static-analyzer ; then + pushd tools/scan-view >/dev/null || die + + python_doscript scan-view + + touch __init__.py || die + python_moduleinto clang + python_domodule __init__.py Reporter.py Resources ScanView.py startfile.py + + popd >/dev/null || die + fi + + if use python ; then + pushd bindings/python/clang >/dev/null || die + + python_moduleinto clang + python_domodule __init__.py cindex.py enumerations.py + + popd >/dev/null || die + fi + + # AddressSanitizer symbolizer (currently separate) + python_doscript "${S}"/projects/compiler-rt/lib/asan/scripts/asan_symbolize.py + } + python_foreach_impl python_inst + fi +} diff --git a/sys-devel/llvm/llvm-3.6.0.ebuild b/sys-devel/llvm/llvm-3.6.0.ebuild new file mode 100644 index 000000000000..830367ca280a --- /dev/null +++ b/sys-devel/llvm/llvm-3.6.0.ebuild @@ -0,0 +1,534 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI=5 + +PYTHON_COMPAT=( python2_7 pypy ) + +inherit eutils flag-o-matic multibuild multilib \ + multilib-minimal python-r1 toolchain-funcs pax-utils check-reqs prefix + +DESCRIPTION="Low Level Virtual Machine" +HOMEPAGE="http://llvm.org/" +SRC_URI="http://llvm.org/releases/${PV}/${P}.src.tar.xz + clang? ( http://llvm.org/releases/${PV}/compiler-rt-${PV}.src.tar.xz + http://llvm.org/releases/${PV}/cfe-${PV}.src.tar.xz + http://llvm.org/releases/${PV}/clang-tools-extra-${PV}.src.tar.xz ) + !doc? ( http://dev.gentoo.org/~voyageur/distfiles/${P}-manpages.tar.bz2 )" + +LICENSE="UoI-NCSA" +SLOT="0/3.6" +KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos" +IUSE="clang debug doc gold libedit +libffi multitarget ncurses ocaml python + +static-analyzer test xml video_cards_radeon + kernel_Darwin kernel_FreeBSD" + +COMMON_DEPEND=" + sys-libs/zlib:0= + clang? ( + python? ( ${PYTHON_DEPS} ) + static-analyzer? ( + dev-lang/perl:* + ${PYTHON_DEPS} + ) + xml? ( dev-libs/libxml2:2= ) + ) + gold? ( >=sys-devel/binutils-2.22:*[cxx] ) + libedit? ( dev-libs/libedit:0=[${MULTILIB_USEDEP}] ) + libffi? ( >=virtual/libffi-3.0.13-r1:0=[${MULTILIB_USEDEP}] ) + ncurses? ( >=sys-libs/ncurses-5.9-r3:5=[${MULTILIB_USEDEP}] ) + ocaml? ( + dev-lang/ocaml:0= + dev-ml/findlib + dev-ml/ocaml-ctypes )" +# configparser-3.2 breaks the build (3.3 or none at all are fine) +DEPEND="${COMMON_DEPEND} + app-arch/xz-utils + dev-lang/perl + >=sys-devel/make-3.81 + >=sys-devel/flex-2.5.4 + >=sys-devel/bison-1.875d + || ( >=sys-devel/gcc-3.0 >=sys-devel/gcc-apple-4.2.1 + ( >=sys-freebsd/freebsd-lib-9.1-r10 sys-libs/libcxx ) + ) + || ( >=sys-devel/binutils-2.18 >=sys-devel/binutils-apple-5.1 ) + clang? ( xml? ( virtual/pkgconfig ) ) + doc? ( dev-python/sphinx ) + libffi? ( virtual/pkgconfig ) + !!<dev-python/configparser-3.3.0.2 + ocaml? ( test? ( dev-ml/ounit ) ) + ${PYTHON_DEPS}" +RDEPEND="${COMMON_DEPEND} + clang? ( !<=sys-devel/clang-${PV}-r99 + !>=sys-devel/clang-9999 ) + abi_x86_32? ( !<=app-emulation/emul-linux-x86-baselibs-20130224-r2 + !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)] )" +PDEPEND="clang? ( =sys-devel/clang-${PV}-r100 )" + +# pypy gives me around 1700 unresolved tests due to open file limit +# being exceeded. probably GC does not close them fast enough. +REQUIRED_USE="${PYTHON_REQUIRED_USE} + test? ( || ( $(python_gen_useflags 'python*') ) )" + +S=${WORKDIR}/${P/_}.src + +# Some people actually override that in make.conf. That sucks since +# we need to run install per-directory, and ninja can't do that... +# so why did it call itself ninja in the first place? +CMAKE_MAKEFILE_GENERATOR=emake + +pkg_pretend() { + # in megs + # !clang !debug !multitarget -O2 400 + # !clang !debug multitarget -O2 550 + # clang !debug !multitarget -O2 950 + # clang !debug multitarget -O2 1200 + # !clang debug multitarget -O2 5G + # clang !debug multitarget -O0 -g 12G + # clang debug multitarget -O2 16G + # clang debug multitarget -O0 -g 14G + + local build_size=550 + use clang && build_size=1200 + + if use debug; then + ewarn "USE=debug is known to increase the size of package considerably" + ewarn "and cause the tests to fail." + ewarn + + (( build_size *= 14 )) + elif is-flagq '-g?(gdb)?([1-9])'; then + ewarn "The C++ compiler -g option is known to increase the size of the package" + ewarn "considerably. If you run out of space, please consider removing it." + ewarn + + (( build_size *= 10 )) + fi + + # Multiply by number of ABIs :). + local abis=( $(multilib_get_enabled_abis) ) + (( build_size *= ${#abis[@]} )) + + local CHECKREQS_DISK_BUILD=${build_size}M + check-reqs_pkg_pretend + + if [[ ${MERGE_TYPE} != binary ]]; then + echo 'int main() {return 0;}' > "${T}"/test.cxx || die + ebegin "Trying to build a C++11 test program" + if ! $(tc-getCXX) -std=c++11 -o /dev/null "${T}"/test.cxx; then + eerror "LLVM-${PV} requires C++11-capable C++ compiler. Your current compiler" + eerror "does not seem to support -std=c++11 option. Please upgrade your compiler" + eerror "to gcc-4.7 or an equivalent version supporting C++11." + die "Currently active compiler does not support -std=c++11" + fi + eend ${?} + fi +} + +pkg_setup() { + pkg_pretend +} + +src_unpack() { + default + + rm -f "${S}"/tools/clang "${S}"/projects/compiler-rt \ + || die "symlinks removal failed" + + if use clang; then + mv "${WORKDIR}"/cfe-${PV/_}.src "${S}"/tools/clang \ + || die "clang source directory move failed" + mv "${WORKDIR}"/compiler-rt-${PV/_}.src "${S}"/projects/compiler-rt \ + || die "compiler-rt source directory move failed" + mv "${WORKDIR}"/clang-tools-extra-${PV/_}.src "${S}"/tools/clang/tools/extra \ + || die "clang-tools-extra source directory move failed" + fi +} + +src_prepare() { + epatch "${FILESDIR}"/${PN}-3.2-nodoctargz.patch + epatch "${FILESDIR}"/${PN}-3.5-gcc-4.9.patch + epatch "${FILESDIR}"/${PN}-3.6-gentoo-install.patch + # Make ocaml warnings non-fatal, bug #537308 + sed -e "/RUN/s/-warn-error A//" -i test/Bindings/OCaml/*ml || die + + if use clang; then + # Automatically select active system GCC's libraries, bugs #406163 and #417913 + epatch "${FILESDIR}"/clang-3.5-gentoo-runtime-gcc-detection-v3.patch + + epatch "${FILESDIR}"/clang-3.6-gentoo-install.patch + epatch "${FILESDIR}"/clang-3.4-darwin_prefix-include-paths.patch + eprefixify tools/clang/lib/Frontend/InitHeaderSearch.cpp + fi + + if use prefix && use clang; then + sed -i -e "/^CFLAGS /s@-Werror@-I${EPREFIX}/usr/include@" \ + projects/compiler-rt/make/platform/clang_*.mk || die + fi + + local sub_files=( + Makefile.config.in + Makefile.rules + tools/llvm-config/llvm-config.cpp + ) + use clang && sub_files+=( + tools/clang/lib/Driver/Tools.cpp + tools/clang/tools/scan-build/scan-build + ) + + # unfortunately ./configure won't listen to --mandir and the-like, so take + # care of this. + # note: we're setting the main libdir intentionally. + # where per-ABI is appropriate, we use $(GENTOO_LIBDIR) make. + einfo "Fixing install dirs" + sed -e "s,@libdir@,$(get_libdir),g" \ + -e "s,@PF@,${PF},g" \ + -e "s,@EPREFIX@,${EPREFIX},g" \ + -i "${sub_files[@]}" \ + || die "install paths sed failed" + + if use clang; then + # constantly fails for a long time, likely due to our patches + rm tools/clang/test/Driver/cross-linux.c || die + fi + + # User patches + epatch_user + + python_setup +} + +multilib_src_configure() { + # disable timestamps since they confuse ccache + local conf_flags=( + --disable-timestamps + --enable-keep-symbols + --enable-shared + --with-optimize-option= + $(tc-is-static-only && echo --disable-shared) + $(use_enable !debug optimized) + $(use_enable debug assertions) + $(use_enable debug expensive-checks) + $(use_enable libedit) + $(use_enable ncurses terminfo) + $(use_enable libffi) + ) + + # well, it's used only by clang executable c-index-test + if multilib_is_native_abi && use clang && use xml; then + conf_flags+=( XML2CONFIG="$(tc-getPKG_CONFIG) libxml-2.0" ) + else + conf_flags+=( ac_cv_prog_XML2CONFIG="" ) + fi + + local targets bindings + if use multitarget; then + targets='all' + else + targets='host,cpp' + use video_cards_radeon && targets+=',r600' + fi + conf_flags+=( --enable-targets=${targets} ) + + if multilib_is_native_abi; then + use gold && conf_flags+=( --with-binutils-include="${EPREFIX}"/usr/include/ ) + # extra commas don't hurt + use ocaml && bindings+=',ocaml' + fi + + [[ ${bindings} ]] || bindings='none' + conf_flags+=( --enable-bindings=${bindings} ) + + if use libffi; then + local CPPFLAGS=${CPPFLAGS} + append-cppflags "$(pkg-config --cflags libffi)" + fi + + # llvm prefers clang over gcc, so we may need to force that + tc-export CC CXX + + ECONF_SOURCE=${S} \ + econf "${conf_flags[@]}" +} + +set_makeargs() { + MAKEARGS=( + VERBOSE=1 + REQUIRES_RTTI=1 + GENTOO_LIBDIR=$(get_libdir) + ) + + # for tests, we want it all! otherwise, we may use a little filtering... + # adding ONLY_TOOLS also disables unittest building... + if [[ ${EBUILD_PHASE_FUNC} != src_test ]]; then + local tools=( llvm-config ) + use clang && tools+=( clang ) + + if multilib_is_native_abi; then + tools+=( + opt llvm-as llvm-dis llc llvm-ar llvm-nm llvm-link lli + llvm-extract llvm-mc llvm-bcanalyzer llvm-diff macho-dump + llvm-objdump llvm-readobj llvm-rtdyld llvm-dwarfdump llvm-cov + llvm-size llvm-stress llvm-mcmarkup llvm-profdata + llvm-symbolizer obj2yaml yaml2obj lto bugpoint + ) + + # the build system runs explicitly specified tools in parallel, + # so we need to split it into two runs + if [[ ${1} != -1 ]]; then + # those require lto + tools+=( llvm-lto ) + use gold && tools+=( gold ) + + # those require clang :) + # we need to explicitly specify all its tools + # since we're passing BUILD_CLANG_ONLY + use clang && tools+=( + clang/tools/{clang-check,clang-format,extra} + ) + fi + fi + + MAKEARGS+=( + # filter tools + disable unittests implicitly + ONLY_TOOLS="${tools[*]}" + + # this disables unittests & docs from clang + BUILD_CLANG_ONLY=YES + ) + fi +} + +multilib_src_compile() { + local MAKEARGS + set_makeargs -1 + emake "${MAKEARGS[@]}" + + if multilib_is_native_abi; then + set_makeargs + emake -C tools "${MAKEARGS[@]}" + + if use doc; then + emake -C "${S}"/docs -f Makefile.sphinx man + use clang && emake -C "${S}"/tools/clang/docs/tools \ + BUILD_FOR_WEBSITE=1 DST_MAN_DIR="${T}"/ man + emake -C "${S}"/docs -f Makefile.sphinx html + fi + fi + + if use debug; then + pax-mark m Debug+Asserts+Checks/bin/llvm-rtdyld + pax-mark m Debug+Asserts+Checks/bin/lli + pax-mark m Debug+Asserts+Checks/bin/lli-child-target + else + pax-mark m Release/bin/llvm-rtdyld + pax-mark m Release/bin/lli + pax-mark m Release/bin/lli-child-target + fi +} + +multilib_src_test() { + local MAKEARGS + set_makeargs + + # build the remaining tools & unittests + emake "${MAKEARGS[@]}" + + pax-mark m unittests/ExecutionEngine/JIT/Release/JITTests + pax-mark m unittests/ExecutionEngine/MCJIT/Release/MCJITTests + pax-mark m unittests/Support/Release/SupportTests + + # respect TMPDIR! + local -x LIT_PRESERVES_TMP=1 + emake "${MAKEARGS[@]}" check + use clang && emake "${MAKEARGS[@]}" -C tools/clang test +} + +src_install() { + local MULTILIB_CHOST_TOOLS=( + /usr/bin/llvm-config + ) + + local MULTILIB_WRAPPED_HEADERS=( + /usr/include/llvm/Config/config.h + /usr/include/llvm/Config/llvm-config.h + ) + + if use clang; then + # note: magic applied below + MULTILIB_CHOST_TOOLS+=( + /usr/bin/clang + /usr/bin/clang++ + /usr/bin/clang-${PV} + /usr/bin/clang++-${PV} + ) + + MULTILIB_WRAPPED_HEADERS+=( + /usr/include/clang/Config/config.h + ) + fi + + multilib-minimal_src_install + + # Remove unnecessary headers on FreeBSD, bug #417171 + use kernel_FreeBSD && use clang && rm "${ED}"usr/lib/clang/${PV}/include/{std,float,iso,limits,tgmath,varargs}*.h +} + +multilib_src_install() { + local MAKEARGS + set_makeargs + + local root=${D}/_${ABI} + + emake "${MAKEARGS[@]}" DESTDIR="${root}" install + multibuild_merge_root "${root}" "${D}" + + if ! multilib_is_native_abi; then + # Backwards compat, will be happily removed someday. + dosym "${CHOST}"-llvm-config /usr/bin/llvm-config.${ABI} + else + # Install docs. + if use doc; then + doman "${S}"/docs/_build/man/*.1 + use clang && doman "${T}"/clang.1 + dohtml -r "${S}"/docs/_build/html/ + else + if ! use clang; then + rm "${WORKDIR}"/${P}-manpages/clang.1 || die + fi + doman "${WORKDIR}"/${P}-manpages/*.1 + fi + + # Symlink the gold plugin. + if use gold; then + dodir /usr/${CHOST}/binutils-bin/lib/bfd-plugins + dosym ../../../../$(get_libdir)/LLVMgold.so \ + /usr/${CHOST}/binutils-bin/lib/bfd-plugins/LLVMgold.so + fi + fi + + # apply CHOST and PV to clang executables + # they're statically linked so we don't have to worry about the lib + if use clang; then + local clang_tools=( clang clang++ ) + local i + + # append ${PV} and symlink back + # TODO: use alternatives.eclass? does that make any sense? + # maybe with USE=-clang on :0 and USE=clang on older + for i in "${clang_tools[@]}"; do + mv "${ED%/}/usr/bin/${i}"{,-${PV}} || die + dosym "${i}"-${PV} /usr/bin/${i} + done + + # now prepend ${CHOST} and let the multilib-build.eclass symlink it + if ! multilib_is_native_abi; then + # non-native? let's replace it with a simple wrapper + for i in "${clang_tools[@]}"; do + rm "${ED%/}/usr/bin/${i}-${PV}" || die + cat > "${T}"/wrapper.tmp <<-_EOF_ + #!${EPREFIX}/bin/sh + exec "${i}-${PV}" $(get_abi_CFLAGS) "\${@}" + _EOF_ + newbin "${T}"/wrapper.tmp "${i}-${PV}" + done + fi + fi + + # Fix install_names on Darwin. The build system is too complicated + # to just fix this, so we correct it post-install + local lib= f= odylib= ndylib= libpv=${PV} + if [[ ${CHOST} == *-darwin* ]] ; then + eval $(grep PACKAGE_VERSION= configure) + [[ -n ${PACKAGE_VERSION} ]] && libpv=${PACKAGE_VERSION} + libpvminor=${libpv%.[0-9]*} + for lib in lib{EnhancedDisassembly,LLVM-${libpv},LTO,profile_rt,clang}.dylib LLVMHello.dylib clang/${libpv}/lib/darwin/libclang_rt.asan_{osx,iossim}_dynamic.dylib; do + # libEnhancedDisassembly is Darwin10 only, so non-fatal + # + omit clang libs if not enabled + [[ -f ${ED}/usr/lib/${lib} ]] || continue + + ebegin "fixing install_name of $lib" + install_name_tool \ + -id "${EPREFIX}"/usr/lib/${lib} \ + "${ED}"/usr/lib/${lib} + eend $? + done + for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/lib*.dylib "${ED}"/usr/lib/clang/${libpv}/lib/darwin/*.dylib ; do + # omit clang libs if not enabled + [[ -f "${f}" ]] || continue + + scanmacho -BF'%n#f' "${f}" | tr ',' '\n' | \ + while read odylib ; do + ndylib= + case ${odylib} in + */libclang.dylib) + ndylib="${EPREFIX}"/usr/lib/libclang.dylib + ;; + */libLLVM-${libpv}.dylib) + ndylib="${EPREFIX}"/usr/lib/libLLVM-${libpv}.dylib + ;; + */libLLVM-${libpvminor}.dylib) + ndylib="${EPREFIX}"/usr/lib/libLLVM-${libpvminor}.dylib + ;; + */libLTO.dylib) + ndylib="${EPREFIX}"/usr/lib/libLTO.dylib + ;; + esac + if [[ -n ${ndylib} ]] ; then + ebegin "fixing install_name reference to ${odylib} of ${f##*/}" + install_name_tool \ + -change "${odylib}" "${ndylib}" \ + "${f}" + eend $? + fi + done + done + fi +} + +multilib_src_install_all() { + insinto /usr/share/vim/vimfiles/syntax + doins utils/vim/*.vim + + if use clang; then + cd tools/clang || die + + if use static-analyzer ; then + dobin tools/scan-build/ccc-analyzer + dosym ccc-analyzer /usr/bin/c++-analyzer + dobin tools/scan-build/scan-build + + insinto /usr/share/${PN} + doins tools/scan-build/scanview.css + doins tools/scan-build/sorttable.js + fi + + python_inst() { + if use static-analyzer ; then + pushd tools/scan-view >/dev/null || die + + python_doscript scan-view + + touch __init__.py || die + python_moduleinto clang + python_domodule __init__.py Reporter.py Resources ScanView.py startfile.py + + popd >/dev/null || die + fi + + if use python ; then + pushd bindings/python/clang >/dev/null || die + + python_moduleinto clang + python_domodule __init__.py cindex.py enumerations.py + + popd >/dev/null || die + fi + + # AddressSanitizer symbolizer (currently separate) + python_doscript "${S}"/projects/compiler-rt/lib/asan/scripts/asan_symbolize.py + } + python_foreach_impl python_inst + fi +} diff --git a/sys-devel/llvm/llvm-3.6.1.ebuild b/sys-devel/llvm/llvm-3.6.1.ebuild new file mode 100644 index 000000000000..73a32beb863f --- /dev/null +++ b/sys-devel/llvm/llvm-3.6.1.ebuild @@ -0,0 +1,541 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI=5 + +PYTHON_COMPAT=( python2_7 pypy ) + +inherit eutils flag-o-matic multibuild multilib \ + multilib-minimal python-r1 toolchain-funcs pax-utils check-reqs prefix + +DESCRIPTION="Low Level Virtual Machine" +HOMEPAGE="http://llvm.org/" +SRC_URI="http://llvm.org/releases/${PV}/${P}.src.tar.xz + clang? ( http://llvm.org/releases/${PV}/compiler-rt-${PV}.src.tar.xz + http://llvm.org/releases/${PV}/cfe-${PV}.src.tar.xz + http://llvm.org/releases/${PV}/clang-tools-extra-${PV}.src.tar.xz ) + !doc? ( http://dev.gentoo.org/~voyageur/distfiles/${P}-manpages.tar.bz2 )" + +LICENSE="UoI-NCSA" +SLOT="0/3.6" +KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos" +IUSE="clang debug doc gold libedit +libffi multitarget ncurses ocaml python + +static-analyzer test xml video_cards_radeon + kernel_Darwin kernel_FreeBSD" + +COMMON_DEPEND=" + sys-libs/zlib:0= + clang? ( + python? ( ${PYTHON_DEPS} ) + static-analyzer? ( + dev-lang/perl:* + ${PYTHON_DEPS} + ) + xml? ( dev-libs/libxml2:2= ) + ) + gold? ( >=sys-devel/binutils-2.22:*[cxx] ) + libedit? ( dev-libs/libedit:0=[${MULTILIB_USEDEP}] ) + libffi? ( >=virtual/libffi-3.0.13-r1:0=[${MULTILIB_USEDEP}] ) + ncurses? ( >=sys-libs/ncurses-5.9-r3:5=[${MULTILIB_USEDEP}] ) + ocaml? ( + dev-lang/ocaml:0= + dev-ml/findlib + dev-ml/ocaml-ctypes )" +# configparser-3.2 breaks the build (3.3 or none at all are fine) +DEPEND="${COMMON_DEPEND} + app-arch/xz-utils + dev-lang/perl + >=sys-devel/make-3.81 + >=sys-devel/flex-2.5.4 + >=sys-devel/bison-1.875d + || ( >=sys-devel/gcc-3.0 >=sys-devel/llvm-3.5 + ( >=sys-freebsd/freebsd-lib-9.1-r10 sys-libs/libcxx ) + ) + || ( >=sys-devel/binutils-2.18 >=sys-devel/binutils-apple-5.1 ) + kernel_Darwin? ( sys-libs/libcxx ) + clang? ( xml? ( virtual/pkgconfig ) ) + doc? ( dev-python/sphinx ) + libffi? ( virtual/pkgconfig ) + !!<dev-python/configparser-3.3.0.2 + ocaml? ( test? ( dev-ml/ounit ) ) + ${PYTHON_DEPS}" +RDEPEND="${COMMON_DEPEND} + clang? ( !<=sys-devel/clang-${PV}-r99 + !>=sys-devel/clang-9999 ) + abi_x86_32? ( !<=app-emulation/emul-linux-x86-baselibs-20130224-r2 + !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)] )" +PDEPEND="clang? ( =sys-devel/clang-${PV}-r100 )" + +# pypy gives me around 1700 unresolved tests due to open file limit +# being exceeded. probably GC does not close them fast enough. +REQUIRED_USE="${PYTHON_REQUIRED_USE} + test? ( || ( $(python_gen_useflags 'python*') ) )" + +S=${WORKDIR}/${P/_}.src + +# Some people actually override that in make.conf. That sucks since +# we need to run install per-directory, and ninja can't do that... +# so why did it call itself ninja in the first place? +CMAKE_MAKEFILE_GENERATOR=emake + +pkg_pretend() { + # in megs + # !clang !debug !multitarget -O2 400 + # !clang !debug multitarget -O2 550 + # clang !debug !multitarget -O2 950 + # clang !debug multitarget -O2 1200 + # !clang debug multitarget -O2 5G + # clang !debug multitarget -O0 -g 12G + # clang debug multitarget -O2 16G + # clang debug multitarget -O0 -g 14G + + local build_size=550 + use clang && build_size=1200 + + if use debug; then + ewarn "USE=debug is known to increase the size of package considerably" + ewarn "and cause the tests to fail." + ewarn + + (( build_size *= 14 )) + elif is-flagq '-g?(gdb)?([1-9])'; then + ewarn "The C++ compiler -g option is known to increase the size of the package" + ewarn "considerably. If you run out of space, please consider removing it." + ewarn + + (( build_size *= 10 )) + fi + + # Multiply by number of ABIs :). + local abis=( $(multilib_get_enabled_abis) ) + (( build_size *= ${#abis[@]} )) + + local CHECKREQS_DISK_BUILD=${build_size}M + check-reqs_pkg_pretend + + if [[ ${MERGE_TYPE} != binary ]]; then + echo 'int main() {return 0;}' > "${T}"/test.cxx || die + ebegin "Trying to build a C++11 test program" + if ! $(tc-getCXX) -std=c++11 -o /dev/null "${T}"/test.cxx; then + eerror "LLVM-${PV} requires C++11-capable C++ compiler. Your current compiler" + eerror "does not seem to support -std=c++11 option. Please upgrade your compiler" + eerror "to gcc-4.7 or an equivalent version supporting C++11." + die "Currently active compiler does not support -std=c++11" + fi + eend ${?} + fi +} + +pkg_setup() { + pkg_pretend +} + +src_unpack() { + default + + rm -f "${S}"/tools/clang "${S}"/projects/compiler-rt \ + || die "symlinks removal failed" + + if use clang; then + mv "${WORKDIR}"/cfe-${PV/_}.src "${S}"/tools/clang \ + || die "clang source directory move failed" + mv "${WORKDIR}"/compiler-rt-${PV/_}.src "${S}"/projects/compiler-rt \ + || die "compiler-rt source directory move failed" + mv "${WORKDIR}"/clang-tools-extra-${PV/_}.src "${S}"/tools/clang/tools/extra \ + || die "clang-tools-extra source directory move failed" + fi +} + +src_prepare() { + epatch "${FILESDIR}"/${PN}-3.2-nodoctargz.patch + epatch "${FILESDIR}"/${PN}-3.5-gcc-4.9.patch + epatch "${FILESDIR}"/${PN}-3.6-gentoo-install.patch + epatch "${FILESDIR}"/${PN}-3.6.0-ocaml-ctypes-0.4.0.patch + # Make ocaml warnings non-fatal, bug #537308 + sed -e "/RUN/s/-warn-error A//" -i test/Bindings/OCaml/*ml || die + + if use clang; then + # Automatically select active system GCC's libraries, bugs #406163 and #417913 + epatch "${FILESDIR}"/clang-3.5-gentoo-runtime-gcc-detection-v3.patch + + epatch "${FILESDIR}"/clang-3.6-gentoo-install.patch + epatch "${FILESDIR}"/clang-3.4-darwin_prefix-include-paths.patch + eprefixify tools/clang/lib/Frontend/InitHeaderSearch.cpp + + # Fix build fails with using gcc-4.9 on Gentoo/FreeBSD, bug #548444 + epatch "${FILESDIR}"/clang-3.6-fbsd-gcc49.patch + fi + + if use prefix && use clang; then + sed -i -e "/^CFLAGS /s@-Werror@-I${EPREFIX}/usr/include@" \ + projects/compiler-rt/make/platform/clang_*.mk || die + fi + + local sub_files=( + Makefile.config.in + Makefile.rules + tools/llvm-config/llvm-config.cpp + ) + use clang && sub_files+=( + tools/clang/lib/Driver/Tools.cpp + tools/clang/tools/scan-build/scan-build + ) + + # unfortunately ./configure won't listen to --mandir and the-like, so take + # care of this. + # note: we're setting the main libdir intentionally. + # where per-ABI is appropriate, we use $(GENTOO_LIBDIR) make. + einfo "Fixing install dirs" + sed -e "s,@libdir@,$(get_libdir),g" \ + -e "s,@PF@,${PF},g" \ + -e "s,@EPREFIX@,${EPREFIX},g" \ + -i "${sub_files[@]}" \ + || die "install paths sed failed" + + if use clang; then + # constantly fails for a long time, likely due to our patches + rm tools/clang/test/Driver/cross-linux.c || die + fi + + # User patches + epatch_user + + python_setup +} + +multilib_src_configure() { + # disable timestamps since they confuse ccache + local conf_flags=( + --disable-timestamps + --enable-keep-symbols + --enable-shared + --with-optimize-option= + $(tc-is-static-only && echo --disable-shared) + $(use_enable !debug optimized) + $(use_enable debug assertions) + $(use_enable debug expensive-checks) + $(use_enable libedit) + $(use_enable ncurses terminfo) + $(use_enable libffi) + ) + + # well, it's used only by clang executable c-index-test + if multilib_is_native_abi && use clang && use xml; then + conf_flags+=( XML2CONFIG="$(tc-getPKG_CONFIG) libxml-2.0" ) + else + conf_flags+=( ac_cv_prog_XML2CONFIG="" ) + fi + + local targets bindings + if use multitarget; then + targets='all' + else + targets='host,cpp' + use video_cards_radeon && targets+=',r600' + fi + conf_flags+=( --enable-targets=${targets} ) + + if multilib_is_native_abi; then + use gold && conf_flags+=( --with-binutils-include="${EPREFIX}"/usr/include/ ) + # extra commas don't hurt + use ocaml && bindings+=',ocaml' + fi + + [[ ${bindings} ]] || bindings='none' + conf_flags+=( --enable-bindings=${bindings} ) + + if use libffi; then + local CPPFLAGS=${CPPFLAGS} + append-cppflags "$(pkg-config --cflags libffi)" + fi + + # Enable large file support, bug #550708 + append-lfs-flags + # llvm prefers clang over gcc, so we may need to force that + tc-export CC CXX + + ECONF_SOURCE=${S} \ + econf "${conf_flags[@]}" +} + +set_makeargs() { + MAKEARGS=( + VERBOSE=1 + REQUIRES_RTTI=1 + GENTOO_LIBDIR=$(get_libdir) + ) + + # for tests, we want it all! otherwise, we may use a little filtering... + # adding ONLY_TOOLS also disables unittest building... + if [[ ${EBUILD_PHASE_FUNC} != src_test ]]; then + local tools=( llvm-config ) + use clang && tools+=( clang ) + + if multilib_is_native_abi; then + tools+=( + opt llvm-as llvm-dis llc llvm-ar llvm-nm llvm-link lli + llvm-extract llvm-mc llvm-bcanalyzer llvm-diff macho-dump + llvm-objdump llvm-readobj llvm-rtdyld llvm-dwarfdump llvm-cov + llvm-size llvm-stress llvm-mcmarkup llvm-profdata + llvm-symbolizer obj2yaml yaml2obj lto bugpoint + ) + + # the build system runs explicitly specified tools in parallel, + # so we need to split it into two runs + if [[ ${1} != -1 ]]; then + # those require lto + tools+=( llvm-lto ) + use gold && tools+=( gold ) + + # those require clang :) + # we need to explicitly specify all its tools + # since we're passing BUILD_CLANG_ONLY + use clang && tools+=( + clang/tools/{clang-check,clang-format,extra} + ) + fi + fi + + MAKEARGS+=( + # filter tools + disable unittests implicitly + ONLY_TOOLS="${tools[*]}" + + # this disables unittests & docs from clang + BUILD_CLANG_ONLY=YES + ) + fi +} + +multilib_src_compile() { + local MAKEARGS + set_makeargs -1 + emake "${MAKEARGS[@]}" + + if multilib_is_native_abi; then + set_makeargs + emake -C tools "${MAKEARGS[@]}" + + if use doc; then + emake -C "${S}"/docs -f Makefile.sphinx man + use clang && emake -C "${S}"/tools/clang/docs/tools \ + BUILD_FOR_WEBSITE=1 DST_MAN_DIR="${T}"/ man + emake -C "${S}"/docs -f Makefile.sphinx html + fi + fi + + if use debug; then + pax-mark m Debug+Asserts+Checks/bin/llvm-rtdyld + pax-mark m Debug+Asserts+Checks/bin/lli + pax-mark m Debug+Asserts+Checks/bin/lli-child-target + else + pax-mark m Release/bin/llvm-rtdyld + pax-mark m Release/bin/lli + pax-mark m Release/bin/lli-child-target + fi +} + +multilib_src_test() { + local MAKEARGS + set_makeargs + + # build the remaining tools & unittests + emake "${MAKEARGS[@]}" + + pax-mark m unittests/ExecutionEngine/JIT/Release/JITTests + pax-mark m unittests/ExecutionEngine/MCJIT/Release/MCJITTests + pax-mark m unittests/Support/Release/SupportTests + + # respect TMPDIR! + local -x LIT_PRESERVES_TMP=1 + emake "${MAKEARGS[@]}" check + use clang && emake "${MAKEARGS[@]}" -C tools/clang test +} + +src_install() { + local MULTILIB_CHOST_TOOLS=( + /usr/bin/llvm-config + ) + + local MULTILIB_WRAPPED_HEADERS=( + /usr/include/llvm/Config/config.h + /usr/include/llvm/Config/llvm-config.h + ) + + if use clang; then + # note: magic applied below + MULTILIB_CHOST_TOOLS+=( + /usr/bin/clang + /usr/bin/clang++ + /usr/bin/clang-${PV} + /usr/bin/clang++-${PV} + ) + + MULTILIB_WRAPPED_HEADERS+=( + /usr/include/clang/Config/config.h + ) + fi + + multilib-minimal_src_install + + # Remove unnecessary headers on FreeBSD, bug #417171 + use kernel_FreeBSD && use clang && rm "${ED}"usr/lib/clang/${PV}/include/{std,float,iso,limits,tgmath,varargs}*.h +} + +multilib_src_install() { + local MAKEARGS + set_makeargs + + local root=${D}/_${ABI} + + emake "${MAKEARGS[@]}" DESTDIR="${root}" install + multibuild_merge_root "${root}" "${D}" + + if ! multilib_is_native_abi; then + # Backwards compat, will be happily removed someday. + dosym "${CHOST}"-llvm-config /usr/bin/llvm-config.${ABI} + else + # Install docs. + if use doc; then + doman "${S}"/docs/_build/man/*.1 + use clang && doman "${T}"/clang.1 + dohtml -r "${S}"/docs/_build/html/ + else + if ! use clang; then + rm "${WORKDIR}"/${P}-manpages/clang.1 || die + fi + doman "${WORKDIR}"/${P}-manpages/*.1 + fi + + # Symlink the gold plugin. + if use gold; then + dodir /usr/${CHOST}/binutils-bin/lib/bfd-plugins + dosym ../../../../$(get_libdir)/LLVMgold.so \ + /usr/${CHOST}/binutils-bin/lib/bfd-plugins/LLVMgold.so + fi + fi + + # apply CHOST and PV to clang executables + # they're statically linked so we don't have to worry about the lib + if use clang; then + local clang_tools=( clang clang++ ) + local i + + # append ${PV} and symlink back + # TODO: use alternatives.eclass? does that make any sense? + # maybe with USE=-clang on :0 and USE=clang on older + for i in "${clang_tools[@]}"; do + mv "${ED%/}/usr/bin/${i}"{,-${PV}} || die + dosym "${i}"-${PV} /usr/bin/${i} + done + + # now prepend ${CHOST} and let the multilib-build.eclass symlink it + if ! multilib_is_native_abi; then + # non-native? let's replace it with a simple wrapper + for i in "${clang_tools[@]}"; do + rm "${ED%/}/usr/bin/${i}-${PV}" || die + cat > "${T}"/wrapper.tmp <<-_EOF_ + #!${EPREFIX}/bin/sh + exec "${i}-${PV}" $(get_abi_CFLAGS) "\${@}" + _EOF_ + newbin "${T}"/wrapper.tmp "${i}-${PV}" + done + fi + fi + + # Fix install_names on Darwin. The build system is too complicated + # to just fix this, so we correct it post-install + local lib= f= odylib= ndylib= libpv=${PV} + if [[ ${CHOST} == *-darwin* ]] ; then + eval $(grep PACKAGE_VERSION= configure) + [[ -n ${PACKAGE_VERSION} ]] && libpv=${PACKAGE_VERSION} + libpvminor=${libpv%.[0-9]*} + for lib in lib{EnhancedDisassembly,LLVM-${libpv},LTO,profile_rt,clang}.dylib LLVMHello.dylib clang/${libpv}/lib/darwin/libclang_rt.asan_{osx,iossim}_dynamic.dylib; do + # libEnhancedDisassembly is Darwin10 only, so non-fatal + # + omit clang libs if not enabled + [[ -f ${ED}/usr/lib/${lib} ]] || continue + + ebegin "fixing install_name of $lib" + install_name_tool \ + -id "${EPREFIX}"/usr/lib/${lib} \ + "${ED}"/usr/lib/${lib} + eend $? + done + for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/lib*.dylib "${ED}"/usr/lib/clang/${libpv}/lib/darwin/*.dylib ; do + # omit clang libs if not enabled + [[ -f "${f}" ]] || continue + + scanmacho -BF'%n#f' "${f}" | tr ',' '\n' | \ + while read odylib ; do + ndylib= + case ${odylib} in + */libclang.dylib) + ndylib="${EPREFIX}"/usr/lib/libclang.dylib + ;; + */libLLVM-${libpv}.dylib) + ndylib="${EPREFIX}"/usr/lib/libLLVM-${libpv}.dylib + ;; + */libLLVM-${libpvminor}.dylib) + ndylib="${EPREFIX}"/usr/lib/libLLVM-${libpvminor}.dylib + ;; + */libLTO.dylib) + ndylib="${EPREFIX}"/usr/lib/libLTO.dylib + ;; + esac + if [[ -n ${ndylib} ]] ; then + ebegin "fixing install_name reference to ${odylib} of ${f##*/}" + install_name_tool \ + -change "${odylib}" "${ndylib}" \ + "${f}" + eend $? + fi + done + done + fi +} + +multilib_src_install_all() { + insinto /usr/share/vim/vimfiles/syntax + doins utils/vim/*.vim + + if use clang; then + cd tools/clang || die + + if use static-analyzer ; then + dobin tools/scan-build/ccc-analyzer + dosym ccc-analyzer /usr/bin/c++-analyzer + dobin tools/scan-build/scan-build + + insinto /usr/share/${PN} + doins tools/scan-build/scanview.css + doins tools/scan-build/sorttable.js + fi + + python_inst() { + if use static-analyzer ; then + pushd tools/scan-view >/dev/null || die + + python_doscript scan-view + + touch __init__.py || die + python_moduleinto clang + python_domodule __init__.py Reporter.py Resources ScanView.py startfile.py + + popd >/dev/null || die + fi + + if use python ; then + pushd bindings/python/clang >/dev/null || die + + python_moduleinto clang + python_domodule __init__.py cindex.py enumerations.py + + popd >/dev/null || die + fi + + # AddressSanitizer symbolizer (currently separate) + python_doscript "${S}"/projects/compiler-rt/lib/asan/scripts/asan_symbolize.py + } + python_foreach_impl python_inst + fi +} diff --git a/sys-devel/llvm/llvm-3.6.2.ebuild b/sys-devel/llvm/llvm-3.6.2.ebuild new file mode 100644 index 000000000000..e8085c497902 --- /dev/null +++ b/sys-devel/llvm/llvm-3.6.2.ebuild @@ -0,0 +1,541 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI=5 + +PYTHON_COMPAT=( python2_7 pypy ) + +inherit eutils flag-o-matic multibuild multilib \ + multilib-minimal python-r1 toolchain-funcs pax-utils check-reqs prefix + +DESCRIPTION="Low Level Virtual Machine" +HOMEPAGE="http://llvm.org/" +SRC_URI="http://llvm.org/releases/${PV}/${P}.src.tar.xz + clang? ( http://llvm.org/releases/${PV}/compiler-rt-${PV}.src.tar.xz + http://llvm.org/releases/${PV}/cfe-${PV}.src.tar.xz + http://llvm.org/releases/${PV}/clang-tools-extra-${PV}.src.tar.xz ) + !doc? ( http://dev.gentoo.org/~voyageur/distfiles/${PN}-3.6.1-manpages.tar.bz2 )" + +LICENSE="UoI-NCSA" +SLOT="0/3.6" +KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~x64-freebsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos" +IUSE="clang debug doc gold libedit +libffi multitarget ncurses ocaml python + +static-analyzer test xml video_cards_radeon + kernel_Darwin kernel_FreeBSD" + +COMMON_DEPEND=" + sys-libs/zlib:0= + clang? ( + python? ( ${PYTHON_DEPS} ) + static-analyzer? ( + dev-lang/perl:* + ${PYTHON_DEPS} + ) + xml? ( dev-libs/libxml2:2= ) + ) + gold? ( >=sys-devel/binutils-2.22:*[cxx] ) + libedit? ( dev-libs/libedit:0=[${MULTILIB_USEDEP}] ) + libffi? ( >=virtual/libffi-3.0.13-r1:0=[${MULTILIB_USEDEP}] ) + ncurses? ( >=sys-libs/ncurses-5.9-r3:5=[${MULTILIB_USEDEP}] ) + ocaml? ( + dev-lang/ocaml:0= + dev-ml/findlib + dev-ml/ocaml-ctypes )" +# configparser-3.2 breaks the build (3.3 or none at all are fine) +DEPEND="${COMMON_DEPEND} + app-arch/xz-utils + dev-lang/perl + >=sys-devel/make-3.81 + >=sys-devel/flex-2.5.4 + >=sys-devel/bison-1.875d + || ( >=sys-devel/gcc-3.0 >=sys-devel/llvm-3.5 + ( >=sys-freebsd/freebsd-lib-9.1-r10 sys-libs/libcxx ) + ) + || ( >=sys-devel/binutils-2.18 >=sys-devel/binutils-apple-5.1 ) + kernel_Darwin? ( sys-libs/libcxx ) + clang? ( xml? ( virtual/pkgconfig ) ) + doc? ( dev-python/sphinx ) + libffi? ( virtual/pkgconfig ) + !!<dev-python/configparser-3.3.0.2 + ocaml? ( test? ( dev-ml/ounit ) ) + ${PYTHON_DEPS}" +RDEPEND="${COMMON_DEPEND} + clang? ( !<=sys-devel/clang-${PV}-r99 + !>=sys-devel/clang-9999 ) + abi_x86_32? ( !<=app-emulation/emul-linux-x86-baselibs-20130224-r2 + !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)] )" +PDEPEND="clang? ( =sys-devel/clang-${PV}-r100 )" + +# pypy gives me around 1700 unresolved tests due to open file limit +# being exceeded. probably GC does not close them fast enough. +REQUIRED_USE="${PYTHON_REQUIRED_USE} + test? ( || ( $(python_gen_useflags 'python*') ) )" + +S=${WORKDIR}/${P/_}.src + +# Some people actually override that in make.conf. That sucks since +# we need to run install per-directory, and ninja can't do that... +# so why did it call itself ninja in the first place? +CMAKE_MAKEFILE_GENERATOR=emake + +pkg_pretend() { + # in megs + # !clang !debug !multitarget -O2 400 + # !clang !debug multitarget -O2 550 + # clang !debug !multitarget -O2 950 + # clang !debug multitarget -O2 1200 + # !clang debug multitarget -O2 5G + # clang !debug multitarget -O0 -g 12G + # clang debug multitarget -O2 16G + # clang debug multitarget -O0 -g 14G + + local build_size=550 + use clang && build_size=1200 + + if use debug; then + ewarn "USE=debug is known to increase the size of package considerably" + ewarn "and cause the tests to fail." + ewarn + + (( build_size *= 14 )) + elif is-flagq '-g?(gdb)?([1-9])'; then + ewarn "The C++ compiler -g option is known to increase the size of the package" + ewarn "considerably. If you run out of space, please consider removing it." + ewarn + + (( build_size *= 10 )) + fi + + # Multiply by number of ABIs :). + local abis=( $(multilib_get_enabled_abis) ) + (( build_size *= ${#abis[@]} )) + + local CHECKREQS_DISK_BUILD=${build_size}M + check-reqs_pkg_pretend + + if [[ ${MERGE_TYPE} != binary ]]; then + echo 'int main() {return 0;}' > "${T}"/test.cxx || die + ebegin "Trying to build a C++11 test program" + if ! $(tc-getCXX) -std=c++11 -o /dev/null "${T}"/test.cxx; then + eerror "LLVM-${PV} requires C++11-capable C++ compiler. Your current compiler" + eerror "does not seem to support -std=c++11 option. Please upgrade your compiler" + eerror "to gcc-4.7 or an equivalent version supporting C++11." + die "Currently active compiler does not support -std=c++11" + fi + eend ${?} + fi +} + +pkg_setup() { + pkg_pretend +} + +src_unpack() { + default + + rm -f "${S}"/tools/clang "${S}"/projects/compiler-rt \ + || die "symlinks removal failed" + + if use clang; then + mv "${WORKDIR}"/cfe-${PV/_}.src "${S}"/tools/clang \ + || die "clang source directory move failed" + mv "${WORKDIR}"/compiler-rt-${PV/_}.src "${S}"/projects/compiler-rt \ + || die "compiler-rt source directory move failed" + mv "${WORKDIR}"/clang-tools-extra-${PV/_}.src "${S}"/tools/clang/tools/extra \ + || die "clang-tools-extra source directory move failed" + fi +} + +src_prepare() { + epatch "${FILESDIR}"/${PN}-3.2-nodoctargz.patch + epatch "${FILESDIR}"/${PN}-3.5-gcc-4.9.patch + epatch "${FILESDIR}"/${PN}-3.6-gentoo-install.patch + epatch "${FILESDIR}"/${PN}-3.6.0-ocaml-ctypes-0.4.0.patch + # Make ocaml warnings non-fatal, bug #537308 + sed -e "/RUN/s/-warn-error A//" -i test/Bindings/OCaml/*ml || die + + if use clang; then + # Automatically select active system GCC's libraries, bugs #406163 and #417913 + epatch "${FILESDIR}"/clang-3.5-gentoo-runtime-gcc-detection-v3.patch + + epatch "${FILESDIR}"/clang-3.6-gentoo-install.patch + epatch "${FILESDIR}"/clang-3.4-darwin_prefix-include-paths.patch + eprefixify tools/clang/lib/Frontend/InitHeaderSearch.cpp + + # Fix build fails with using gcc-4.9 on Gentoo/FreeBSD, bug #548444 + epatch "${FILESDIR}"/clang-3.6-fbsd-gcc49.patch + fi + + if use prefix && use clang; then + sed -i -e "/^CFLAGS /s@-Werror@-I${EPREFIX}/usr/include@" \ + projects/compiler-rt/make/platform/clang_*.mk || die + fi + + local sub_files=( + Makefile.config.in + Makefile.rules + tools/llvm-config/llvm-config.cpp + ) + use clang && sub_files+=( + tools/clang/lib/Driver/Tools.cpp + tools/clang/tools/scan-build/scan-build + ) + + # unfortunately ./configure won't listen to --mandir and the-like, so take + # care of this. + # note: we're setting the main libdir intentionally. + # where per-ABI is appropriate, we use $(GENTOO_LIBDIR) make. + einfo "Fixing install dirs" + sed -e "s,@libdir@,$(get_libdir),g" \ + -e "s,@PF@,${PF},g" \ + -e "s,@EPREFIX@,${EPREFIX},g" \ + -i "${sub_files[@]}" \ + || die "install paths sed failed" + + if use clang; then + # constantly fails for a long time, likely due to our patches + rm tools/clang/test/Driver/cross-linux.c || die + fi + + # User patches + epatch_user + + python_setup +} + +multilib_src_configure() { + # disable timestamps since they confuse ccache + local conf_flags=( + --disable-timestamps + --enable-keep-symbols + --enable-shared + --with-optimize-option= + $(tc-is-static-only && echo --disable-shared) + $(use_enable !debug optimized) + $(use_enable debug assertions) + $(use_enable debug expensive-checks) + $(use_enable libedit) + $(use_enable ncurses terminfo) + $(use_enable libffi) + ) + + # well, it's used only by clang executable c-index-test + if multilib_is_native_abi && use clang && use xml; then + conf_flags+=( XML2CONFIG="$(tc-getPKG_CONFIG) libxml-2.0" ) + else + conf_flags+=( ac_cv_prog_XML2CONFIG="" ) + fi + + local targets bindings + if use multitarget; then + targets='all' + else + targets='host,cpp' + use video_cards_radeon && targets+=',r600' + fi + conf_flags+=( --enable-targets=${targets} ) + + if multilib_is_native_abi; then + use gold && conf_flags+=( --with-binutils-include="${EPREFIX}"/usr/include/ ) + # extra commas don't hurt + use ocaml && bindings+=',ocaml' + fi + + [[ ${bindings} ]] || bindings='none' + conf_flags+=( --enable-bindings=${bindings} ) + + if use libffi; then + local CPPFLAGS=${CPPFLAGS} + append-cppflags "$(pkg-config --cflags libffi)" + fi + + # Enable large file support, bug #550708 + append-lfs-flags + # llvm prefers clang over gcc, so we may need to force that + tc-export CC CXX + + ECONF_SOURCE=${S} \ + econf "${conf_flags[@]}" +} + +set_makeargs() { + MAKEARGS=( + VERBOSE=1 + REQUIRES_RTTI=1 + GENTOO_LIBDIR=$(get_libdir) + ) + + # for tests, we want it all! otherwise, we may use a little filtering... + # adding ONLY_TOOLS also disables unittest building... + if [[ ${EBUILD_PHASE_FUNC} != src_test ]]; then + local tools=( llvm-config ) + use clang && tools+=( clang ) + + if multilib_is_native_abi; then + tools+=( + opt llvm-as llvm-dis llc llvm-ar llvm-nm llvm-link lli + llvm-extract llvm-mc llvm-bcanalyzer llvm-diff macho-dump + llvm-objdump llvm-readobj llvm-rtdyld llvm-dwarfdump llvm-cov + llvm-size llvm-stress llvm-mcmarkup llvm-profdata + llvm-symbolizer obj2yaml yaml2obj lto bugpoint + ) + + # the build system runs explicitly specified tools in parallel, + # so we need to split it into two runs + if [[ ${1} != -1 ]]; then + # those require lto + tools+=( llvm-lto ) + use gold && tools+=( gold ) + + # those require clang :) + # we need to explicitly specify all its tools + # since we're passing BUILD_CLANG_ONLY + use clang && tools+=( + clang/tools/{clang-check,clang-format,extra} + ) + fi + fi + + MAKEARGS+=( + # filter tools + disable unittests implicitly + ONLY_TOOLS="${tools[*]}" + + # this disables unittests & docs from clang + BUILD_CLANG_ONLY=YES + ) + fi +} + +multilib_src_compile() { + local MAKEARGS + set_makeargs -1 + emake "${MAKEARGS[@]}" + + if multilib_is_native_abi; then + set_makeargs + emake -C tools "${MAKEARGS[@]}" + + if use doc; then + emake -C "${S}"/docs -f Makefile.sphinx man + use clang && emake -C "${S}"/tools/clang/docs/tools \ + BUILD_FOR_WEBSITE=1 DST_MAN_DIR="${T}"/ man + emake -C "${S}"/docs -f Makefile.sphinx html + fi + fi + + if use debug; then + pax-mark m Debug+Asserts+Checks/bin/llvm-rtdyld + pax-mark m Debug+Asserts+Checks/bin/lli + pax-mark m Debug+Asserts+Checks/bin/lli-child-target + else + pax-mark m Release/bin/llvm-rtdyld + pax-mark m Release/bin/lli + pax-mark m Release/bin/lli-child-target + fi +} + +multilib_src_test() { + local MAKEARGS + set_makeargs + + # build the remaining tools & unittests + emake "${MAKEARGS[@]}" + + pax-mark m unittests/ExecutionEngine/JIT/Release/JITTests + pax-mark m unittests/ExecutionEngine/MCJIT/Release/MCJITTests + pax-mark m unittests/Support/Release/SupportTests + + # respect TMPDIR! + local -x LIT_PRESERVES_TMP=1 + emake "${MAKEARGS[@]}" check + use clang && emake "${MAKEARGS[@]}" -C tools/clang test +} + +src_install() { + local MULTILIB_CHOST_TOOLS=( + /usr/bin/llvm-config + ) + + local MULTILIB_WRAPPED_HEADERS=( + /usr/include/llvm/Config/config.h + /usr/include/llvm/Config/llvm-config.h + ) + + if use clang; then + # note: magic applied below + MULTILIB_CHOST_TOOLS+=( + /usr/bin/clang + /usr/bin/clang++ + /usr/bin/clang-${PV} + /usr/bin/clang++-${PV} + ) + + MULTILIB_WRAPPED_HEADERS+=( + /usr/include/clang/Config/config.h + ) + fi + + multilib-minimal_src_install + + # Remove unnecessary headers on FreeBSD, bug #417171 + use kernel_FreeBSD && use clang && rm "${ED}"usr/lib/clang/${PV}/include/{std,float,iso,limits,tgmath,varargs}*.h +} + +multilib_src_install() { + local MAKEARGS + set_makeargs + + local root=${D}/_${ABI} + + emake "${MAKEARGS[@]}" DESTDIR="${root}" install + multibuild_merge_root "${root}" "${D}" + + if ! multilib_is_native_abi; then + # Backwards compat, will be happily removed someday. + dosym "${CHOST}"-llvm-config /usr/bin/llvm-config.${ABI} + else + # Install docs. + if use doc; then + doman "${S}"/docs/_build/man/*.1 + use clang && doman "${T}"/clang.1 + dohtml -r "${S}"/docs/_build/html/ + else + if ! use clang; then + rm "${WORKDIR}"/${PN}-3.6.1-manpages/clang.1 || die + fi + doman "${WORKDIR}"/${PN}-3.6.1-manpages/*.1 + fi + + # Symlink the gold plugin. + if use gold; then + dodir /usr/${CHOST}/binutils-bin/lib/bfd-plugins + dosym ../../../../$(get_libdir)/LLVMgold.so \ + /usr/${CHOST}/binutils-bin/lib/bfd-plugins/LLVMgold.so + fi + fi + + # apply CHOST and PV to clang executables + # they're statically linked so we don't have to worry about the lib + if use clang; then + local clang_tools=( clang clang++ ) + local i + + # append ${PV} and symlink back + # TODO: use alternatives.eclass? does that make any sense? + # maybe with USE=-clang on :0 and USE=clang on older + for i in "${clang_tools[@]}"; do + mv "${ED%/}/usr/bin/${i}"{,-${PV}} || die + dosym "${i}"-${PV} /usr/bin/${i} + done + + # now prepend ${CHOST} and let the multilib-build.eclass symlink it + if ! multilib_is_native_abi; then + # non-native? let's replace it with a simple wrapper + for i in "${clang_tools[@]}"; do + rm "${ED%/}/usr/bin/${i}-${PV}" || die + cat > "${T}"/wrapper.tmp <<-_EOF_ + #!${EPREFIX}/bin/sh + exec "${i}-${PV}" $(get_abi_CFLAGS) "\${@}" + _EOF_ + newbin "${T}"/wrapper.tmp "${i}-${PV}" + done + fi + fi + + # Fix install_names on Darwin. The build system is too complicated + # to just fix this, so we correct it post-install + local lib= f= odylib= ndylib= libpv=${PV} + if [[ ${CHOST} == *-darwin* ]] ; then + eval $(grep PACKAGE_VERSION= configure) + [[ -n ${PACKAGE_VERSION} ]] && libpv=${PACKAGE_VERSION} + libpvminor=${libpv%.[0-9]*} + for lib in lib{EnhancedDisassembly,LLVM-${libpv},LTO,profile_rt,clang}.dylib LLVMHello.dylib clang/${libpv}/lib/darwin/libclang_rt.asan_{osx,iossim}_dynamic.dylib; do + # libEnhancedDisassembly is Darwin10 only, so non-fatal + # + omit clang libs if not enabled + [[ -f ${ED}/usr/lib/${lib} ]] || continue + + ebegin "fixing install_name of $lib" + install_name_tool \ + -id "${EPREFIX}"/usr/lib/${lib} \ + "${ED}"/usr/lib/${lib} + eend $? + done + for f in "${ED}"/usr/bin/* "${ED}"/usr/lib/lib*.dylib "${ED}"/usr/lib/clang/${libpv}/lib/darwin/*.dylib ; do + # omit clang libs if not enabled + [[ -f "${f}" ]] || continue + + scanmacho -BF'%n#f' "${f}" | tr ',' '\n' | \ + while read odylib ; do + ndylib= + case ${odylib} in + */libclang.dylib) + ndylib="${EPREFIX}"/usr/lib/libclang.dylib + ;; + */libLLVM-${libpv}.dylib) + ndylib="${EPREFIX}"/usr/lib/libLLVM-${libpv}.dylib + ;; + */libLLVM-${libpvminor}.dylib) + ndylib="${EPREFIX}"/usr/lib/libLLVM-${libpvminor}.dylib + ;; + */libLTO.dylib) + ndylib="${EPREFIX}"/usr/lib/libLTO.dylib + ;; + esac + if [[ -n ${ndylib} ]] ; then + ebegin "fixing install_name reference to ${odylib} of ${f##*/}" + install_name_tool \ + -change "${odylib}" "${ndylib}" \ + "${f}" + eend $? + fi + done + done + fi +} + +multilib_src_install_all() { + insinto /usr/share/vim/vimfiles/syntax + doins utils/vim/*.vim + + if use clang; then + cd tools/clang || die + + if use static-analyzer ; then + dobin tools/scan-build/ccc-analyzer + dosym ccc-analyzer /usr/bin/c++-analyzer + dobin tools/scan-build/scan-build + + insinto /usr/share/${PN} + doins tools/scan-build/scanview.css + doins tools/scan-build/sorttable.js + fi + + python_inst() { + if use static-analyzer ; then + pushd tools/scan-view >/dev/null || die + + python_doscript scan-view + + touch __init__.py || die + python_moduleinto clang + python_domodule __init__.py Reporter.py Resources ScanView.py startfile.py + + popd >/dev/null || die + fi + + if use python ; then + pushd bindings/python/clang >/dev/null || die + + python_moduleinto clang + python_domodule __init__.py cindex.py enumerations.py + + popd >/dev/null || die + fi + + # AddressSanitizer symbolizer (currently separate) + python_doscript "${S}"/projects/compiler-rt/lib/asan/scripts/asan_symbolize.py + } + python_foreach_impl python_inst + fi +} diff --git a/sys-devel/llvm/llvm-9999.ebuild b/sys-devel/llvm/llvm-9999.ebuild new file mode 100644 index 000000000000..aa013b67f400 --- /dev/null +++ b/sys-devel/llvm/llvm-9999.ebuild @@ -0,0 +1,487 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI=5 + +: ${CMAKE_MAKEFILE_GENERATOR:=ninja} +PYTHON_COMPAT=( python2_7 pypy ) + +inherit check-reqs cmake-utils eutils flag-o-matic git-r3 multilib \ + multilib-minimal python-r1 toolchain-funcs pax-utils + +DESCRIPTION="Low Level Virtual Machine" +HOMEPAGE="http://llvm.org/" +SRC_URI="" +EGIT_REPO_URI="http://llvm.org/git/llvm.git + https://github.com/llvm-mirror/llvm.git" + +LICENSE="UoI-NCSA" +SLOT="0/${PV}" +KEYWORDS="" +IUSE="clang debug +doc gold libedit +libffi lldb multitarget ncurses ocaml + python +static-analyzer test xml video_cards_radeon kernel_Darwin" + +COMMON_DEPEND=" + sys-libs/zlib:0= + clang? ( + python? ( ${PYTHON_DEPS} ) + static-analyzer? ( + dev-lang/perl:* + ${PYTHON_DEPS} + ) + xml? ( dev-libs/libxml2:2= ) + ) + gold? ( >=sys-devel/binutils-2.22:*[cxx] ) + libedit? ( dev-libs/libedit:0=[${MULTILIB_USEDEP}] ) + libffi? ( >=virtual/libffi-3.0.13-r1:0=[${MULTILIB_USEDEP}] ) + ncurses? ( >=sys-libs/ncurses-5.9-r3:5=[${MULTILIB_USEDEP}] ) + ocaml? ( + dev-lang/ocaml:0= + dev-ml/findlib + dev-ml/ocaml-ctypes )" +# configparser-3.2 breaks the build (3.3 or none at all are fine) +DEPEND="${COMMON_DEPEND} + dev-lang/perl + >=sys-devel/make-3.81 + >=sys-devel/flex-2.5.4 + >=sys-devel/bison-1.875d + || ( >=sys-devel/gcc-3.0 >=sys-devel/llvm-3.5 + ( >=sys-freebsd/freebsd-lib-9.1-r10 sys-libs/libcxx ) + ) + || ( >=sys-devel/binutils-2.18 >=sys-devel/binutils-apple-5.1 ) + kernel_Darwin? ( sys-libs/libcxx ) + clang? ( xml? ( virtual/pkgconfig ) ) + doc? ( dev-python/sphinx ) + libffi? ( virtual/pkgconfig ) + lldb? ( dev-lang/swig ) + !!<dev-python/configparser-3.3.0.2 + ocaml? ( test? ( dev-ml/ounit ) ) + ${PYTHON_DEPS}" +RDEPEND="${COMMON_DEPEND} + clang? ( !<=sys-devel/clang-${PV}-r99 ) + abi_x86_32? ( !<=app-emulation/emul-linux-x86-baselibs-20130224-r2 + !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)] )" +PDEPEND="clang? ( =sys-devel/clang-${PV}-r100 )" + +# pypy gives me around 1700 unresolved tests due to open file limit +# being exceeded. probably GC does not close them fast enough. +REQUIRED_USE="${PYTHON_REQUIRED_USE} + lldb? ( clang ) + test? ( || ( $(python_gen_useflags 'python*') ) )" + +pkg_pretend() { + # in megs + # !clang !debug !multitarget -O2 400 + # !clang !debug multitarget -O2 550 + # clang !debug !multitarget -O2 950 + # clang !debug multitarget -O2 1200 + # !clang debug multitarget -O2 5G + # clang !debug multitarget -O0 -g 12G + # clang debug multitarget -O2 16G + # clang debug multitarget -O0 -g 14G + + local build_size=550 + use clang && build_size=1200 + + if use debug; then + ewarn "USE=debug is known to increase the size of package considerably" + ewarn "and cause the tests to fail." + ewarn + + (( build_size *= 14 )) + elif is-flagq '-g?(gdb)?([1-9])'; then + ewarn "The C++ compiler -g option is known to increase the size of the package" + ewarn "considerably. If you run out of space, please consider removing it." + ewarn + + (( build_size *= 10 )) + fi + + # Multiply by number of ABIs :). + local abis=( $(multilib_get_enabled_abis) ) + (( build_size *= ${#abis[@]} )) + + local CHECKREQS_DISK_BUILD=${build_size}M + check-reqs_pkg_pretend + + if [[ ${MERGE_TYPE} != binary ]]; then + echo 'int main() {return 0;}' > "${T}"/test.cxx || die + ebegin "Trying to build a C++11 test program" + if ! $(tc-getCXX) -std=c++11 -o /dev/null "${T}"/test.cxx; then + eerror "LLVM-${PV} requires C++11-capable C++ compiler. Your current compiler" + eerror "does not seem to support -std=c++11 option. Please upgrade your compiler" + eerror "to gcc-4.7 or an equivalent version supporting C++11." + die "Currently active compiler does not support -std=c++11" + fi + eend ${?} + fi +} + +pkg_setup() { + pkg_pretend +} + +src_unpack() { + if use clang; then + git-r3_fetch "http://llvm.org/git/compiler-rt.git + https://github.com/llvm-mirror/compiler-rt.git" + git-r3_fetch "http://llvm.org/git/clang.git + https://github.com/llvm-mirror/clang.git" + git-r3_fetch "http://llvm.org/git/clang-tools-extra.git + https://github.com/llvm-mirror/clang-tools-extra.git" + fi + if use lldb; then + git-r3_fetch "http://llvm.org/git/lldb.git + https://github.com/llvm-mirror/lldb.git" + fi + git-r3_fetch + + if use clang; then + git-r3_checkout http://llvm.org/git/compiler-rt.git \ + "${S}"/projects/compiler-rt + git-r3_checkout http://llvm.org/git/clang.git \ + "${S}"/tools/clang + git-r3_checkout http://llvm.org/git/clang-tools-extra.git \ + "${S}"/tools/clang/tools/extra + fi + if use lldb; then + git-r3_checkout http://llvm.org/git/lldb.git \ + "${S}"/tools/lldb + fi + git-r3_checkout +} + +src_prepare() { + # Make ocaml warnings non-fatal, bug #537308 + sed -e "/RUN/s/-warn-error A//" -i test/Bindings/OCaml/*ml || die + + # Make it possible to override Sphinx HTML install dirs + # https://llvm.org/bugs/show_bug.cgi?id=23780 + epatch "${FILESDIR}"/cmake/0002-cmake-Support-overriding-Sphinx-HTML-doc-install-dir.patch + + # Prevent race conditions with parallel Sphinx runs + # https://llvm.org/bugs/show_bug.cgi?id=23781 + epatch "${FILESDIR}"/cmake/0003-cmake-Add-an-ordering-dep-between-HTML-man-Sphinx-ta.patch + + # Prevent installing libgtest + # https://llvm.org/bugs/show_bug.cgi?id=18341 + epatch "${FILESDIR}"/cmake/0004-cmake-Do-not-install-libgtest.patch + + if use clang; then + # Automatically select active system GCC's libraries, bugs #406163 and #417913 + epatch "${FILESDIR}"/clang-3.5-gentoo-runtime-gcc-detection-v3.patch + + epatch "${FILESDIR}"/clang-3.6-gentoo-install.patch + + sed -i -e "s^@EPREFIX@^${EPREFIX}^" \ + tools/clang/tools/scan-build/scan-build || die + + # Install clang runtime into /usr/lib/clang + # https://llvm.org/bugs/show_bug.cgi?id=23792 + epatch "${FILESDIR}"/cmake/clang-0001-Install-clang-runtime-into-usr-lib-without-suffix.patch + epatch "${FILESDIR}"/cmake/compiler-rt-0001-cmake-Install-compiler-rt-into-usr-lib-without-suffi.patch + + # Make it possible to override CLANG_LIBDIR_SUFFIX + # (that is used only to find LLVMgold.so) + # https://llvm.org/bugs/show_bug.cgi?id=23793 + epatch "${FILESDIR}"/cmake/clang-0002-cmake-Make-CLANG_LIBDIR_SUFFIX-overridable.patch + fi + + if use lldb; then + # Do not install dummy readline.so module from + # https://llvm.org/bugs/show_bug.cgi?id=18841 + sed -e 's/add_subdirectory(readline)/#&/' \ + -i tools/lldb/scripts/Python/modules/CMakeLists.txt || die + fi + + # User patches + epatch_user + + python_setup + + # Native libdir is used to hold LLVMgold.so + NATIVE_LIBDIR=$(get_libdir) +} + +multilib_src_configure() { + local targets + if use multitarget; then + targets=all + else + targets='host;CppBackend' + use video_cards_radeon && targets+=';AMDGPU' + fi + + local ffi_cflags ffi_ldflags + if use libffi; then + ffi_cflags=$(pkg-config --cflags-only-I libffi) + ffi_ldflags=$(pkg-config --libs-only-L libffi) + fi + + local libdir=$(get_libdir) + local mycmakeargs=( + "${mycmakeargs[@]}" + -DLLVM_LIBDIR_SUFFIX=${libdir#lib} + + -DBUILD_SHARED_LIBS=ON + -DLLVM_ENABLE_TIMESTAMPS=OFF + -DLLVM_TARGETS_TO_BUILD="${targets}" + -DLLVM_BUILD_TESTS=$(usex test) + + -DLLVM_ENABLE_FFI=$(usex libffi) + -DLLVM_ENABLE_TERMINFO=$(usex ncurses) + -DLLVM_ENABLE_ASSERTIONS=$(usex debug) + -DLLVM_ENABLE_EH=ON + -DLLVM_ENABLE_RTTI=ON + + -DWITH_POLLY=OFF # TODO + + -DLLVM_HOST_TRIPLE="${CHOST}" + + -DFFI_INCLUDE_DIR="${ffi_cflags#-I}" + -DFFI_LIBRARY_DIR="${ffi_ldflags#-L}" + + -DHAVE_HISTEDIT_H=$(usex libedit) + ) + + if use lldb; then + mycmakeargs+=( + -DLLDB_DISABLE_LIBEDIT=$(usex !libedit) + -DLLDB_DISABLE_CURSES=$(usex !ncurses) + -DLLDB_ENABLE_TERMINFO=$(usex ncurses) + ) + fi + + if ! multilib_is_native_abi || ! use ocaml; then + mycmakeargs+=( + -DOCAMLFIND=NO + ) + fi +# Note: go bindings have no CMake rules at the moment +# but let's kill the check in case they are introduced +# if ! multilib_is_native_abi || ! use go; then + mycmakeargs+=( + -DGO_EXECUTABLE=GO_EXECUTABLE-NOTFOUND + ) +# fi + + if multilib_is_native_abi; then + mycmakeargs+=( + -DLLVM_BUILD_DOCS=$(usex doc) + -DLLVM_ENABLE_SPHINX=$(usex doc) + -DLLVM_ENABLE_DOXYGEN=OFF + -DLLVM_INSTALL_HTML="${EPREFIX}/usr/share/doc/${PF}/html" + ) + + if use clang; then + mycmakeargs+=( + -DCLANG_INSTALL_HTML="${EPREFIX}/usr/share/doc/${PF}/clang" + ) + fi + + if use gold; then + mycmakeargs+=( + -DLLVM_BINUTILS_INCDIR="${EPREFIX}"/usr/include + ) + fi + + if use lldb; then + mycmakeargs+=( + -DLLDB_DISABLE_PYTHON=$(usex !python) + ) + fi + + else + if use clang; then + mycmakeargs+=( + # disable compiler-rt on non-native ABI because: + # 1. it fails to configure because of -m32 + # 2. it is shared between ABIs so no point building + # it multiple times + -DLLVM_EXTERNAL_COMPILER_RT_BUILD=OFF + -DLLVM_EXTERNAL_CLANG_TOOLS_EXTRA_BUILD=OFF + ) + fi + if use lldb; then + mycmakeargs+=( + # only run swig on native abi + -DLLDB_DISABLE_PYTHON=ON + ) + fi + fi + + if use clang; then + mycmakeargs+=( + -DCLANG_ENABLE_ARCMT=$(usex static-analyzer) + -DCLANG_ENABLE_STATIC_ANALYZER=$(usex static-analyzer) + -DCLANG_LIBDIR_SUFFIX="${NATIVE_LIBDIR#lib}" + ) + + # -- not needed when compiler-rt is built with host compiler -- + # cmake passes host C*FLAGS to compiler-rt build + # which is performed using clang, so we need to filter out + # some flags clang does not support + # (if you know some more flags that don't work, let us know) + #filter-flags -msahf -frecord-gcc-switches + fi + + cmake-utils_src_configure +} + +multilib_src_compile() { + cmake-utils_src_compile + + pax-mark m "${BUILD_DIR}"/bin/llvm-rtdyld + pax-mark m "${BUILD_DIR}"/bin/lli + pax-mark m "${BUILD_DIR}"/bin/lli-child-target + + if use test; then + pax-mark m "${BUILD_DIR}"/unittests/ExecutionEngine/Orc/OrcJITTests + pax-mark m "${BUILD_DIR}"/unittests/ExecutionEngine/MCJIT/MCJITTests + pax-mark m "${BUILD_DIR}"/unittests/Support/SupportTests + fi +} + +multilib_src_test() { + # respect TMPDIR! + local -x LIT_PRESERVES_TMP=1 + local test_targets=( check ) + # clang tests won't work on non-native ABI because we skip compiler-rt + multilib_is_native_abi && use clang && test_targets+=( check-clang ) + cmake-utils_src_make "${test_targets[@]}" +} + +src_install() { + local MULTILIB_CHOST_TOOLS=( + /usr/bin/llvm-config + ) + + local MULTILIB_WRAPPED_HEADERS=( + /usr/include/llvm/Config/config.h + /usr/include/llvm/Config/llvm-config.h + ) + + if use clang; then + # note: magic applied in multilib_src_install()! + CLANG_VERSION=3.8 + + MULTILIB_CHOST_TOOLS+=( + /usr/bin/clang + /usr/bin/clang++ + /usr/bin/clang-cl + /usr/bin/clang-${CLANG_VERSION} + /usr/bin/clang++-${CLANG_VERSION} + /usr/bin/clang-cl-${CLANG_VERSION} + ) + + MULTILIB_WRAPPED_HEADERS+=( + /usr/include/clang/Config/config.h + ) + fi + + multilib-minimal_src_install +} + +multilib_src_install() { + cmake-utils_src_install + + if multilib_is_native_abi; then + # Install docs. + #use doc && dohtml -r "${S}"/docs/_build/html/ + + # Symlink the gold plugin. + if use gold; then + dodir "/usr/${CHOST}/binutils-bin/lib/bfd-plugins" + dosym "../../../../$(get_libdir)/LLVMgold.so" \ + "/usr/${CHOST}/binutils-bin/lib/bfd-plugins/LLVMgold.so" + fi + fi + + # apply CHOST and CLANG_VERSION to clang executables + # they're statically linked so we don't have to worry about the lib + if use clang; then + local clang_tools=( clang clang++ clang-cl ) + local i + + # cmake gives us: + # - clang-X.Y + # - clang -> clang-X.Y + # - clang++, clang-cl -> clang + # we want to have: + # - clang-X.Y + # - clang++-X.Y, clang-cl-X.Y -> clang-X.Y + # - clang, clang++, clang-cl -> clang*-X.Y + # so we need to fix the two tools + for i in "${clang_tools[@]:1}"; do + rm "${ED%/}/usr/bin/${i}" || die + dosym "clang-${CLANG_VERSION}" "/usr/bin/${i}-${CLANG_VERSION}" + dosym "${i}-${CLANG_VERSION}" "/usr/bin/${i}" + done + + # now prepend ${CHOST} and let the multilib-build.eclass symlink it + if ! multilib_is_native_abi; then + # non-native? let's replace it with a simple wrapper + for i in "${clang_tools[@]}"; do + rm "${ED%/}/usr/bin/${i}-${CLANG_VERSION}" || die + cat > "${T}"/wrapper.tmp <<-_EOF_ + #!${EPREFIX}/bin/sh + exec "${i}-${CLANG_VERSION}" $(get_abi_CFLAGS) "\${@}" + _EOF_ + newbin "${T}"/wrapper.tmp "${i}-${CLANG_VERSION}" + done + fi + fi +} + +multilib_src_install_all() { + insinto /usr/share/vim/vimfiles + doins -r utils/vim/*/ + # some users may find it useful + dodoc utils/vim/vimrc + + if use clang; then + pushd tools/clang >/dev/null || die + + if use static-analyzer ; then + pushd tools/scan-build >/dev/null || die + + dobin ccc-analyzer scan-build + dosym ccc-analyzer /usr/bin/c++-analyzer + doman scan-build.1 + + insinto /usr/share/llvm + doins scanview.css sorttable.js + + popd >/dev/null || die + fi + + python_inst() { + if use static-analyzer ; then + pushd tools/scan-view >/dev/null || die + + python_doscript scan-view + + touch __init__.py || die + python_moduleinto clang + python_domodule *.py Resources + + popd >/dev/null || die + fi + + if use python ; then + pushd bindings/python/clang >/dev/null || die + + python_moduleinto clang + python_domodule *.py + + popd >/dev/null || die + fi + + # AddressSanitizer symbolizer (currently separate) + python_doscript "${S}"/projects/compiler-rt/lib/asan/scripts/asan_symbolize.py + } + python_foreach_impl python_inst + popd >/dev/null || die + fi +} diff --git a/sys-devel/llvm/metadata.xml b/sys-devel/llvm/metadata.xml new file mode 100644 index 000000000000..53210f753014 --- /dev/null +++ b/sys-devel/llvm/metadata.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer> + <email>voyageur@gentoo.org</email> + <name>Bernard Cafarelli</name> + </maintainer> + <maintainer> + <email>mgorny@gentoo.org</email> + <name>Michał Górny</name> + </maintainer> + <longdescription>Low Level Virtual Machine (LLVM) is: + 1. A compilation strategy designed to enable effective program optimization across the entire lifetime of a program. LLVM supports effective optimization at compile time, link-time (particularly interprocedural), run-time and offline (i.e., after software is installed), while remaining transparent to developers and maintaining compatibility with existing build scripts. + 2. A virtual instruction set - LLVM is a low-level object code representation that uses simple RISC-like instructions, but provides rich, language-independent, type information and dataflow (SSA) information about operands. This combination enables sophisticated transformations on object code, while remaining light-weight enough to be attached to the executable. This combination is key to allowing link-time, run-time, and offline transformations. + 3. A compiler infrastructure - LLVM is also a collection of source code that implements the language and compilation strategy. The primary components of the LLVM infrastructure are a GCC-based C and C++ front-end, a link-time optimization framework with a growing set of global and interprocedural analyses and transformations, static back-ends for many popular (and some obscure) architectures, a back-end which emits portable C code, and a Just-In-Time compilers for several architectures. + 4. LLVM does not imply things that you would expect from a high-level virtual machine. It does not require garbage collection or run-time code generation (In fact, LLVM makes a great static compiler!). Note that optional LLVM components can be used to build high-level virtual machines and other systems that need these services.</longdescription> + <use> + <flag name='clang'>Build the clang C/C++ compiler</flag> + <flag name='cmake'>Enable cmake support (experimental)</flag> + <flag name='doc'>Build and install the HTML documentation and regenerate the man pages</flag> + <flag name='gold'>Build the gold linker plugin</flag> + <flag name='lldb'>Build the lldb debugger</flag> + <flag name='multitarget'>Build all host targets (default: host only)</flag> + <flag name='ncurses'>Support querying terminal properties using ncurses' terminfo</flag> + <flag name='static-analyzer'>Install the Clang static analyzer (requires USE=clang)</flag> + <flag name='udis86'>Enable support for <pkg>dev-libs/udis86</pkg> disassembler library</flag> + </use> +</pkgmetadata> |