* [gentoo-commits] repo/gentoo:master commit in: dev-lang/ghc/files/, dev-lang/ghc/
@ 2016-12-28 22:49 Sergei Trofimovich
0 siblings, 0 replies; 9+ messages in thread
From: Sergei Trofimovich @ 2016-12-28 22:49 UTC (permalink / raw
To: gentoo-commits
commit: ce2c3248dff78e70172969b90055f439936be773
Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Wed Dec 28 22:20:50 2016 +0000
Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Wed Dec 28 22:37:38 2016 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ce2c3248
dev-lang/ghc: drop old
Package-Manager: Portage-2.3.3, Repoman-2.3.1
dev-lang/ghc/Manifest | 26 -
dev-lang/ghc/files/ghc-7.0.4-darwin8.patch | 18 -
dev-lang/ghc/files/ghc-7.10.1-T10590-dequeue.patch | 89 ---
dev-lang/ghc/files/ghc-7.2.1-freebsd-CHOST.patch | 13 -
.../ghc-7.4-rc2-macos-prefix-respect-gcc.patch | 23 -
dev-lang/ghc/files/ghc-7.4.1-darwin-CHOST.patch | 18 -
...ghc-7.4.1-ticket-7339-fix-unaligned-unreg.patch | 28 -
dev-lang/ghc/files/ghc-7.4.2-system-libffi.patch | 119 ---
.../ghc/files/ghc-7.5.20120505-system-libffi.patch | 88 ---
.../files/ghc-7.6.2-integer-simple-div-mod.patch | 57 --
.../ghc/files/ghc-7.6.3-trac-3333-weak-syms.patch | 387 ----------
dev-lang/ghc/files/ghc-7.8.3-cc-lang.patch | 129 ----
dev-lang/ghc/files/ghc-7.8.3-deRefStablePtr.patch | 38 -
dev-lang/ghc/files/ghc-7.8.3-ia64-prim.patch | 69 --
dev-lang/ghc/files/ghc-7.8.3-pic-asm.patch | 107 ---
dev-lang/ghc/files/ghc-7.8.3-unreg-lit.patch | 84 ---
dev-lang/ghc/files/terminfo-0.3.2.5-tinfo.patch | 25 -
dev-lang/ghc/ghc-7.10.2-r1.ebuild | 662 ----------------
dev-lang/ghc/ghc-7.10.2.ebuild | 652 ----------------
dev-lang/ghc/ghc-7.4.2.ebuild | 640 ----------------
dev-lang/ghc/ghc-7.6.3-r1.ebuild | 829 ---------------------
dev-lang/ghc/ghc-7.8.3.ebuild | 624 ----------------
dev-lang/ghc/metadata.xml | 1 -
23 files changed, 4726 deletions(-)
diff --git a/dev-lang/ghc/Manifest b/dev-lang/ghc/Manifest
index a9b82dc..d15ace8 100644
--- a/dev-lang/ghc/Manifest
+++ b/dev-lang/ghc/Manifest
@@ -1,16 +1,7 @@
-DIST binary-0.7.5.0.tar.gz 45764 SHA256 4709c5aa7cc99cb4a465a68de1648968208d0c60c368e2fece476d977530ef19 SHA512 232e7c3da1c0055f3e9f211a86e81c76bc44ab1b70cabd23c93634dbaa42eed8bd9314fbedc16b9703d3ca92b0bbf232e6c30bb1384687dad0e6e85c9abb8947 WHIRLPOOL 1d8dcf9d5125ff398375f4024c0e43fa168004811db7824e2739ec5c0451b38dae9ad74f757c7708427deed0044580b182e35d1c7ecffec25f7b10c70bd32075
DIST binary-0.7.6.1.tar.gz 47086 SHA256 8f85cafc15be660757878a665d024ce595d4422fead174e20a501c9ec8f81067 SHA512 655daa93a52b845a85d440810452933d7bc3398ad1b51e1e955b2d19a0a32679325a0d1751ad50d252531e493528262e14dab32af4b9a515855fe7f64e0730b2 WHIRLPOOL 6853eb2c817e8ae792226c6c7764ce495833f965c3d503fe7e39c0502019d12f7bd46309b72dfdb276c7dbce8c004cb59fdea4936d69ede0a7c8b487acda2702
-DIST ghc-7.10.2-src.tar.bz2 12651156 SHA256 908a01ca86238318f4e880fda400ea399d0a0008d699c912b85d0e0f746e5689 SHA512 e3f99a9e848c12b728212da24bf9029ec8cde88cdfa7eeb4ee2ea223ad8bcaae3e7c27456d09d60a3d21efa8f907ccd2490caf5630ca5fe3ce87f04901275a66 WHIRLPOOL dee757e79de8ac6bcf127212703985282ce96d050be50e78c3f249f13dc0212c9fd96899502748ceb26b9fc3a804379a456e19a9bedfef72f6890992b00492da
DIST ghc-7.10.3-src.tar.bz2 13281867 SHA256 3e29a56a74ed6a74d3ee2a6db9389f2462837da46ca6dce9d2965f9c152f0c15 SHA512 97a8282d8a75399c78d85d6faab7ac253a993dc69f1840358572f1878b8fd1a527c28801e5823c8200b5690e268e4a0c00941945ada13790852c75a83b612c17 WHIRLPOOL 04af6ea2738a1cc9e266efbb0e1b41b70d4cd915b48ca1265fade62b1c56cd51056fd1a82fc14cebc19a0c16782609a991c1a181ebe59574f1a10b4f26ad830d
-DIST ghc-7.4.2-src.tar.bz2 25836446 SHA256 f2ee1289a33cc70539287129841acc7eaf16112bb60c59b5a6ee91887bfd836d SHA512 5a3d06a36702fa7e337b482c9de92ce1f84a68f18d8560bcc11f3617d6d46f93167fee27e786de6483a9ef0eab3b1ac6909a71dd53908d36156df4e465075050 WHIRLPOOL 61865eed2bf92728e7c4c4a0c48be44081bf728cfd824760d643e2fad838d96c19e173052d3aac073e0795b5efa3720ba5ddf13cca1ec7952b7524bbe1f204bc
-DIST ghc-7.6.3-src.tar.bz2 110763823 SHA256 bd43823d31f6b5d0b2ca7b74151a8f98336ab0800be85f45bb591c9c26aac998 SHA512 ac86f18b4feeb0bdc9e867261600b210caf62740d73ae657259bbe8149b8c2c4f5a73d09d74d944d4e50f85cc87503485365f0a0ae65befe8d2b6844e5e1253a WHIRLPOOL 0fe1f5f2987699067494559e6a679d28f027eee8fb2a00c683161dbce5443b1faeebfb51572209b75231cee24c7f0c929cabbc82a93f70e16d05e351fdfe2eaf
-DIST ghc-7.8.3-src.tar.xz 9160092 SHA256 b0cd96a549ba3b5e512847a4a8cd1a3174e4b2b75dadfc41c568fb812887b958 SHA512 2cc8c2aa6f18ba565c1e2aa637045e246f1214c2a77e95c2a97dfb97203b8983e4ad3cc13178b4b51aff70c58d59a1f68f94cd813d043745cb02411bad04bb00 WHIRLPOOL 3a2e8eea0db7a150e4732efed488a3a5eb56da00a9a90a3379afcb4090323925a2a7485fec6676e784139f112d7c825e8d18a576c34c760af4a7f3adb22c021a
DIST ghc-7.8.4-ia64-CLOSUREs-regenerated.patch.gz 13268 SHA256 3bdff22e654aee6f942d43edf1bf6cf70404c0152c4fcf89276f10d2c4c5b4b9 SHA512 a655713e06324b56f0041edf70837487e296d28e6f3ee35fe116b9938765aaf3469d25e92645e0940655ed3607dff27d3826fe0f995c84e81b51bfc956816e7d WHIRLPOOL d2cb53bdc6debc0278d554168ea3ab22b0fd8314adac81444637278a92d21b766280fedfb4b7d1b4540c7381c7962dec6b13a799ab2fee4d456fe2875d5c6a5b
DIST ghc-7.8.4-src.tar.bz2 10600755 SHA256 59e3bd514a1820cc1c03e1808282205c0b8518369acae12645ceaf839e6f114b SHA512 079a53891d8ebd8d9b88da96170e60981608a619f8282e4b7948f35244e99bd87277649ac7fcebc227a61a4d21960db8d5e5b9e92f2c69c82d8d68d7fd0a41d3 WHIRLPOOL a9be7641adbd237ed6e0f644c312e655e98be9566097aee5e2c0022e8756d5b2236e42dd86d76c638a001b5ca3f67307e89ec0cd003a92cd112a5d6d3e3d8467
-DIST ghc-bin-7.10.2-amd64.tbz2 112028560 SHA256 536297ac402da44ec1aafb1a937960883d12d192db16715ca34ab6469773a4c7 SHA512 207d8032c99d52bf4215ddeea2dbcd5816bb8d4caf2c3c31190e3ca92b49667d98a4f97aaf4cd6b40090f150854d520f75b5420dfe1ade7f036cf35d3dcb5100 WHIRLPOOL 8e43956a61c2c0fead242e3b179cde4918c04f3db7dbb27cc986f00f981261d98028ead82548b87d183d8da928635d5db4aa62ff1161f4077e5370483530a316
-DIST ghc-bin-7.10.2-r1-amd64-noncurses.tbz2 111863814 SHA256 782a68a13343ac8d6ed97540b411f714c4e826ccc3d152724198548c9240aceb SHA512 b154dbd7fb4fefc4283ec337b0c6ce6b6b6b3a62e9d889ca9c5dd5b5e5987f811a1c87845239ca94941afea630fc8bf1d8db94eb11a4023abd4b1d772dfb17c1 WHIRLPOOL 1e1f1ec82c831d115cd5f0b27f1914da94d92a9eca9af634210eb5f72b54281de6e08ea8e304bebaec8a456659b40866b9f0e24ef0e72c3f5a63d85296eb172a
-DIST ghc-bin-7.10.2-r1-x86-noncurses.tbz2 113572461 SHA256 3ad1e2888d26b6858cd1efe0e9863bc325b97c47be19fdd2e8dd5bbc86f7266b SHA512 573b7228b576a47ca1c3796cc2d4180a6c9dcaff58555cf52fc85a9b487920fc19487ff9ee8e0b6c33d6196ba05b9908f0d984bf3a4c0d91f52667e7389580a5 WHIRLPOOL 2c8cda95d04e9f345aa2f20fe8758761dd35648b788b7bf9b8f571687a8aae92456552883684d83ec2d2acaf22a002121643316df3c82349400c7de3d0300f7d
-DIST ghc-bin-7.10.2-x86.tbz2 113900477 SHA256 eefb7a3002e3dcdd6d936b2b2826eadf3cd100352babad4c9a355b944064240a SHA512 61dae4b9c80bfef6b1e0550c77b70f25d11f4a9fbe3b57d6c4ad451b4b584884432405d39dc32b9f85f3a5ad9d02657356ae0ebd99518848f3d330314c74b595 WHIRLPOOL da0d7eb62d2ee2aeb80a3f495da2ff123e29151b7517fbcd212f83ab3722638f10019511f4f237e8e001c68dd957ed2817fb0f1a2b42c2710239343f1d801496
DIST ghc-bin-7.10.3-alpha.tbz2 183558856 SHA256 780ac45b9b38fb40f08eeb7dae741649ac19dce2271df4bc764cac9be6c5c225 SHA512 08709fe9b4036ab41715c9a637a2a160104e3ab9e0ed9efaaf73428e3cfe19619e50c42b72c60bbbd27be2b9c2ea68f63d72c1a27d4519756e7c0d909f724230 WHIRLPOOL f488ecc945c6100ba86b9ae25eb6a472693556be0205a6c8634f2c235e779fe17b391ced7fec5d89c0c6c3d21583fe9f9b80bf628f3307890becf3f3ffb57a96
DIST ghc-bin-7.10.3-amd64.tbz2 112040431 SHA256 c3c71aff288f7de2785d1c3d54f0fd636144eb3dcb590bdda087b0775203e517 SHA512 e1554b3944edbe8e16537de5a29132dc6a22d780d9a700cdc9b76387b94191164398d6f2242bf8199527802572e2bb02545569d4f0930a0ee0dbfdeb25978558 WHIRLPOOL c2497a9565abf7d37e7928f508f7bf7241dd529aa252da708517f9f067e3d016341b7a73cac34888b99c9b84a8d01fd9e8d76f2b332d53e0d708b078f20ee807
DIST ghc-bin-7.10.3-ia64.tbz2 238680956 SHA256 0da9b5966f0920341f4cf041b814817e1ed06060e8a491481ab19a68153767db SHA512 3694011aec8a6dc37889418b318993cb82f9b46a5175dd837713f396c8f59a19a920e0b0669fe3b4ec37d5bd8837c115264c0a8fc97c5a4ce06a3bdd52fcfce5 WHIRLPOOL 9e059a953607b6477ea7c27bf55175d838c6aa3c57fcf92f13fa6112e9e728037073047be300a5a757395d759d30545546cb46816ec879a2d31c3c0a78868e42
@@ -18,22 +9,6 @@ DIST ghc-bin-7.10.3-ppc.tbz2 125832171 SHA256 67817636f5b91e04ecf94972c0bfe8e4e9
DIST ghc-bin-7.10.3-ppc64.tbz2 142469712 SHA256 c8fa2ea861d4c5373f7f67fd3a29db4e48593d669c8616c2f349592af7e4846f SHA512 eb59d3abc8b10010311d59df9473c5ea649eb0dd7f9ad41a1929a540a0ef8c20abaccd68254f8abab037fb1fc94d824f474e18e4316b8f2a7a954d0645a2a2a4 WHIRLPOOL 14ccfbcf818a80f1daf39b44dc7562304af925e548407ce0deecd2d4593f4e138da38cfe63d4e5b8b0303c0237c678c27eaac4331288ee9b9dcbcf8be7390f74
DIST ghc-bin-7.10.3-sparc.tbz2 163105069 SHA256 b9ef4179d87f4a56e9a786b28b0674f817118c73784b0dce283affadab296875 SHA512 d467a42487378d7dee311eb33aa1c151f5c16a6e7a4ab5bd8177df229f474adf19da3e1ca1064943a40abafcab6852b0589dd34413da82b33a03ede1ac17bf5d WHIRLPOOL 26ecb662f1d0eae524388008c24b3d25f954668aba781e997afd934c10b379b32e3376bc3a1232b066de84d3e1d1ad838dcef667b0f7606d0ac52acd7ef78a72
DIST ghc-bin-7.10.3-x86.tbz2 113877175 SHA256 a06d54e7256292123b49c4d429761794b53d2440d2efeb98bcfe79920c65b044 SHA512 75096fe9106d975c15e646b0a559c544621fd02791f491bce54926efabf0e55b97150069ddfa7a9f02cc30bb6975d3d3121a82207a9f67b8dda5ebfe17ec4744 WHIRLPOOL 63fea83be14ae317f313251b7c952c974a8e4f9671d78d1b3ef77c3ab317d2194faddc8d71431c5e1fc42215abed1842913f2f40ba383288784e984c47cd27f0
-DIST ghc-bin-7.4.2-alpha.tbz2 130483507 SHA256 cd8e72e569574f137bf10fcdb4337bb0dc320deb2a2c4d72529a821735c53ae6 SHA512 6fb99dea706965afa60f4aeb68da3da1c69dda477f5fcfb4e67b73d75b78583193148ce9f623a356679a57f1a740f8010f28a22f08e56ace50f3fcd42142f83f WHIRLPOOL e5ec69ab24dc963ac709f13928c0e35931d5d50ca6b21dfb0aa79f9088c0ce1196b64bb4d9668e35d73dcdf9e2df9c3da59c95eaf3db8b793a6bb65b1f4ba6c0
-DIST ghc-bin-7.4.2-amd64-stable-glibc.tbz2 93139900 SHA256 f06dff00585cc1a8ecc8ac29aeca7fdc601d272eed29d7613f7a2f2924cad585 SHA512 9b725f2613dd9013851a16eaea4000ea424c51cbafa97d3860f120fdb9936247f8c65208775a80a2f49b74946ddda2e843a54dec00b78c521197374aa3dd2d50 WHIRLPOOL 9e2630b1de40a059c324be38a1fe68b16ea484bc7afc2a397ea05192263d1964aed1d29fde543622ceab12ed2df111204576fdc72b7e35b2bbf9c6b9519901d1
-DIST ghc-bin-7.4.2-ia64.tbz2 155787636 SHA256 a1d89221645832cc5d11cde4937cce75d564e6a79eba334b92a4c465eb3f161f SHA512 c7138ed8eaf40ee7e7559b6063096351b64fc35cbd1adb4c734b2f2c6b77fb98368b1296fcb67c1a0b21b0faf053a82f8f98c3656b89c593e677ce78165d0c74 WHIRLPOOL 7ff2db2932a6d56961dcca386c9ec8f8eb1ee12e1b84230fbb089ff137eeb216117eecaa37b33b4c037ebee0063a07cd380077b754e64ef0219759b54a4f7fe2
-DIST ghc-bin-7.4.2-ppc.tbz2 89396808 SHA256 ebf6083a1f3256a978a9408cffa2562e837b641136e5d6ad41a8ab5c2f50e804 SHA512 d7abd4a2612f26b6937dd20c11d2081b2c846178347a8e09f4ef5d8b1ef2ad3eabb9d5429fd0c214f6c5bd53eb194ccf199745904d6b861650c9eef681a48bc1 WHIRLPOOL e2f8a4c8e3209432a744fd8587be39591d7b4fb026dca36755933f49e6f650e1b34e6087d9260aee65206a700f9d70e2fb6cbe42d29645b52f060729845a347e
-DIST ghc-bin-7.4.2-ppc64.tbz2 105431655 SHA256 d0aecf47749a9862085aec6403f25197465d99a02a3c721dffd5314bf81d74eb SHA512 f220fb91b1856da37f72166fe050d4908049845eec03626d09c5b6e88701b0002835c3343c3584baf9f9d9efb5c7cbc210eb64c6eb711a58764d0fea92e8ac9f WHIRLPOOL e27022a72c254fd189995fd1b39629d5328927b83237ae4e61e97ab5efb5c451c92fe77f944c724bf9d14130d5a6cd2e0896a7cd6052de1ef7091531aa39fa0f
-DIST ghc-bin-7.4.2-sparc.tbz2 121224130 SHA256 e5eaf1f31ddc4790e0226f0075236af340ec9674d98701452d5c51455ca1cb52 SHA512 a3647d82bbb36fe0ca55185ebc9479a264e785eb5a8a33be6c37b8a6cbcf8c55373374801c685eef004de78db5aa1c96760b2bedb2ca0ac9097d39fe286984e9 WHIRLPOOL d2d5f8c5abb001fb5425e68d3d26d941569b832c373e40b5a96aaa11f589db9e2b72eb1cbcf8df7b8d4473e2cc1c61498b284d8b006cc20822c3a203fd0fe2cd
-DIST ghc-bin-7.4.2-x86-stable-glibc.tbz2 92394017 SHA256 2c42257a60aec03ae622c1a600cd210a6094f26ac310fbd307006e7f2260e2a4 SHA512 9e8ef72d2aeb5681e6bb71e2eb875587ddd51089cfc3443c33c69f93274a29e5680de4bf4884af05cd84f0e9cea13d66d20f1e89994460137910cbc987b64359 WHIRLPOOL 5722824af91f1191e6a38a8eb4696e765468e3bf54ad411b1d387ae4bcc7cd4cb772bdf2054d7013a3cff41feaaf5607f051b3c0d9f609ca19f1a1f92dd02586
-DIST ghc-bin-7.6.3-amd64.tbz2 94441516 SHA256 3ef747e96a40c9d5021e88b8afee0a97838c27b00619d9187783d95279c31779 SHA512 89f6c693d83d6309a0e44fcc68e30279c858adb0a0ea9317dd168b2e632c22a8507da78ed953523f5d7156db98e06c6df56d6edc19c0c50b3941ea578263dc64 WHIRLPOOL 891dfbfc9d88fa579b6a837651f7cc6d9aecef8b8752ec7bcebbdfef2a6d8929d0edaceff27ec61d6160d36d1b0e8406b7829a04a858ed64210b5c57b9c98940
-DIST ghc-bin-7.6.3-r1-alpha.tbz2 123486983 SHA256 fb6828d9dff7b90563cc7b3277ed38801907930aebd6042a7e5ba61e5f50db73 SHA512 7821bdf7490283dc062be090d224138dd34641e014cc6742edaa51dcc9cb1de9724d575955b596c9273b878dfe79023daf172b132b124f67567132649cf9a30d WHIRLPOOL 4e51a7e7f54fcb4aeb7a4ade4140533413348f9aacf04f683fe7cc5e20843dc6a95bdd6d79a995e5e1085747be9e584df6ada61430662f06eb600abae0c7eabd
-DIST ghc-bin-7.6.3-r1-ia64.tbz2 154480728 SHA256 9a176312f796a189c0354deab9a7c446db274f75f40554963c2f86597a5951fb SHA512 2aa945cebcd3d0c26af5ddb53cf2002ec6d263d071173495905dd52898bd2ab6605370b0025554c1f6afbd28e276abc708708e4add9a9b8cb08b4bb39f8f50a1 WHIRLPOOL 6371531141e707618577e924c01102481a12d91e2c85e24694ba64f9b2545869c248999138146f63ca379a4243ccd0dfa322ea01a23d222b9757584787c5a899
-DIST ghc-bin-7.6.3-r1-ppc.tbz2 91800558 SHA256 c9b2262957585c9f02136014aa05423e1b7674c8eb0731a6d991e400e053e33a SHA512 2a101a30a4324780f1a614e044ba614f9094cd57d026c56f2b3ba514ae049c26ce8e4acbc89e93229da451b6fbe05ba0980b500cdd785bb2bce968a60434403a WHIRLPOOL 3a3b7e1eb945be01ab195880c7709514d2d11d25bab12fc15c2257207da48a37e6d6d7699c9ed5c1cc32d01057240a4d795e43cdf9d9d2748a1d94b93fb283ed
-DIST ghc-bin-7.6.3-r1-ppc64.tbz2 121213680 SHA256 7d820988a762dc56ec471c9fcb5510f2e0bb47560181aa7dea8a934e73952477 SHA512 17fb269a2eae326db927b8734cd8326061b059ecd50a377c51c37cd657380be1ae61964df299009259de6e4e00aa71a525a9224f8fa607d6cc7994c221848358 WHIRLPOOL 76e9664a535e6be54c5288be683959ab6aadafb04d03c5d2f08f8ee663868b3ed390e2a0c8e6d233a532af694709e03dc0f78d16dfe51b87e201655219da4704
-DIST ghc-bin-7.6.3-r1-sparc.tbz2 121641337 SHA256 0fb31b9584c1c6caafb44a51158bfd3d85c28d2313f8201855f58c019a1692c0 SHA512 d71efc47769efb091f93cb288b54a1fadfd4184053149b1cd7c219a0c9c95ed97c32b101c712e20643fea12546357b70a11f2852bebeac2141e961a3e4bf8764 WHIRLPOOL 37d320e01d8e43ecba6e90f8d0a9c440d30ea31ff79d9094a8205d9ce892570f81b8641080034215fdddf71131de1acc364e2a485383af8346190c36201c1e91
-DIST ghc-bin-7.6.3-x86.tbz2 93718672 SHA256 a55024f66a048437fcd6ef0f33cdb994a43628998a2f0fe4d094cc9ba83d1615 SHA512 624f2a3238dee15853018d45632d1363e42d34099a77e5e9ce5c8da976cb4c33578144f7c39dbf25ee68c17d8d42910db2347186849eeeda6bc20053ce2be990 WHIRLPOOL bc646fc19906b59416358fb7558b6e2c3f7ad069c2fcf443be36b621894cfcecb0844acf5b5f9c383e034dfff3e24d312a7da0d7a629836134ec5dc1ecd6f139
-DIST ghc-bin-7.8.3-amd64.tbz2 100786052 SHA256 af49f547336a4f9f13cd625155d5a6a998e52ae7da8bbbddc856f88b00b6aff4 SHA512 b1826095b67fa2028678057f70909bff4e082b82f3b70f1aedbc91073efad54334fa1864bc8248c9249eec6edab3671dc38ac1650be86f1245e2fecf92528952 WHIRLPOOL 5b44fff77a0d79c6f7c5c8ca792eb6b36987d1de58d5ebc0a9b05da9c19a2c312eca6b9d40e7e63437742b7f9c28c925feb3bea7f9803dda95fac7acaa7a3132
-DIST ghc-bin-7.8.3-x86.tbz2 102583755 SHA256 c67f0d2471e594b4fdfc5b219bb6b61e57e6ba75132aa3f63d171550af8cbe3c SHA512 badabbba2f46b5ab3a2601e53997ce6533162afeec7dc36eeb877a62680a9f599aeb05dd3682f45d3e273d71d28b8bd01eee37dcad3c7354e8f83b7be4e58536 WHIRLPOOL 7b99b6bbeb4ad6d203f270d8446285825ad0857a8ab058d8c126155b49e8819e0efc2f6c42b5ff775dc0ece5488e97fcc7ae2459fe87fdceef43d63a75443430
DIST ghc-bin-7.8.4-alpha.tbz2 210691009 SHA256 23c9e5ef97b444fa87d3b9509a7b2b7b68c526ca4139739dd60c08fb1279d48a SHA512 f08230de82f0c4112da9d0b48227ca74d5d0b4a84046d746b023557b7aeeb9678f5ac037fe89a863178df4b9036e5c5c63182d14dfbb42c772011de883e3966f WHIRLPOOL d624b4d5eac8aa68f389b81e68d7fa2ea960c9b9c5fabb27ddf4da5140c18fd0ee9080725fb645e2c532bb0a01ade32da2cf6aac08707f9d89a94ea9752b8e72
DIST ghc-bin-7.8.4-amd64.tbz2 100573133 SHA256 bd9d144c08caa0ff345ada8d7eed7592531b8f8b9ef2f94d0b9a42fd747440aa SHA512 e4416d6dae3c644f74bafb3aecf1a123f985427aba32d0e0c43143a137d64a9220fc5947cd9bde8a3bc44555ae71184fc06a3f7df7976aadd065ad5681b90954 WHIRLPOOL ab0bd6219d68e08cb473cf2f3f15538d65940f28e84f026361032c3a6bc09f7820faf67629e915f27c2afda7de41fa9c6010a1b5cd487df0936d968c7e58a3a4
DIST ghc-bin-7.8.4-ia64.tbz2 222789275 SHA256 8bbbc11ba64d08bad691593afafc4c6a7cf078b10cf33cb8508bf0a0b3ccf523 SHA512 2d8b89e399cbe9bfeae29cf3ceea736bfaa65ea21483fa2ee95d9814e122fcfbb67ce22ad8175493fab088e9a9d0139610c67e9d5c8b4f797b5e14846df32b6e WHIRLPOOL 181d48bbb53d181c8febf63ddae620bec1a6c212a5b5bf938228689df2ff45ba68d7d4a99ebb1b68aa516d5633be41125321e3f8fdef6e5f0cd1e4a7f9b8774c
@@ -41,6 +16,5 @@ DIST ghc-bin-7.8.4-ppc.tbz2 112803496 SHA256 a47e0fb17137878af1e7b5a166046bee20d
DIST ghc-bin-7.8.4-ppc64.tbz2 129284515 SHA256 1e8a350af39d1db1e58a74c9bc4a4c57765eceb33e5b32751fb31340b9ff02ff SHA512 53974e15c26cf6b62d8f838607abd209ec57cf0f45fcc48b90ad62736f5e4e7ff263dcd326ae03d8d5557a22eb9730e5eb8ae4eda55e52dd3d973bc73c84935e WHIRLPOOL adaaa92323d319f6576423ac41678f7d263f36e0e30d89fc14ee89104b006772c26d7b408be7f85225d1bddaf5f15ebdcbb7136f5c8bf7bda4bb0938eefbe6c2
DIST ghc-bin-7.8.4-sparc.tbz2 147340595 SHA256 1cde749ce3c47016c5c7a7179423d0aa2b174ddae4af0392ae3b7f57b098ec0c SHA512 ee5f0b2f1cf2693a0f2be9df71ef61b52bc2327225d40b8be955c1584b9901ffc6aaab63c1e46bf9bb352633b605c98378f8fd3e6cd71aef1c089007e4110217 WHIRLPOOL 27d55a016ffb49852553f920c29929c3bdf383e28b4b806ceb9ffc8b46a59b438801101402e498b069aa6eb56870b70a00ba7b1f4098f3fd8d8ddf1b20caa626
DIST ghc-bin-7.8.4-x86.tbz2 102312459 SHA256 4c53148836e5a1ba55b8db5bb7c3eb915103e0955fb503b2facdc5a72f12a974 SHA512 cabc5bd6d8760ce4120e7053f6c1dffca7d161ba454b6201087760096c037c932e3ff8c82e53346c8278855bf0cff1c2f5fb8046242ca4d8307355b060a9556e WHIRLPOOL 0171d67dc1b63381a491e1577a783eb0e8f53cb579ba96a9b4fdf6685d494d78eb2be780f77ff33422d3b7c320ed102d9b48f6e954f8fee5532982575001a4a5
-DIST hoopl-3.10.1.0.tar.gz 241582 SHA256 7af615dfd4051670dccf31e5a7e1e71a9ae5f301e6a0668557fd84f61f6bc2d4 SHA512 943fe7034c89f4f914617cf1bccf7f66c3e660328fbbd9ae40f78a3f78a4a5b6fdd86c2afd40c11d4c4c4a34bc8fd47ab7e6227cdf9f3f4887b5cc796720e7aa WHIRLPOOL 3a410081f70c4ebbb563a48d71ec6f1e226a13b965ea12d01ca521b32041308394c7da6d3b3e36e75d1322c188b81fc08f4b2bf6037df5d8ac4998a944326be2
DIST hoopl-3.10.2.0.tar.gz 241940 SHA256 6740814c774e51815e8260ae1b4ac8af6ab69f02e112904450f689c4792f1121 SHA512 083baa8a5eb53247aff8d5b9b2144e0f63adb9400934297bbd80bfcec607dd90a34def4301045a60472ef10b0fb90ab84692fc08f786e7f806c28afdab1ef66a WHIRLPOOL 761e7440d2bc32b594ab55ea967c5b075bb638b2fdba6606beaf9c31a90e20031e914146828004b3d11203668210a6994be9fabc3b0ebb428d516b57cae9ee68
DIST transformers-0.4.3.0.tar.gz 28632 SHA256 b3d0a797e815ca50d411e20c02f781efe7751308007d880af7f0b5c4365c3a9d SHA512 c3ec0893ebba4fbd6087c3202e919552c4a9bff3350b5c0589e7ebb18751a515d98b8cac15b0a3252906ea72b5a0eb09b7fe88c8da88b09d6ce4fbf0f50b2780 WHIRLPOOL 89591781926b1d025056dedcfc5de61705056c1e3a8eba72f2e89789e78d2ed4d8909f84d6560dfc66bc0b360f98cb3dc3835f3a05c2325f747498373c88aa4b
diff --git a/dev-lang/ghc/files/ghc-7.0.4-darwin8.patch b/dev-lang/ghc/files/ghc-7.0.4-darwin8.patch
deleted file mode 100644
index bfbee41..00000000
--- a/dev-lang/ghc/files/ghc-7.0.4-darwin8.patch
+++ /dev/null
@@ -1,18 +0,0 @@
-Workaround headers problem in Darwin 8 as well.
-
---- rts/PosixSource.h
-+++ rts/PosixSource.h
-@@ -11,6 +11,13 @@
-
- #include <ghcplatform.h>
-
-+#if defined(darwin_HOST_OS)
-+/* unfortunately the hack below only works for Darwin 9 and
-+ * above, so as hack include sys/types early (before setting
-+ * _POSIX_C_SOURCE) (this obviously obsoletes the hack below) */
-+#include <sys/types.h>
-+#endif
-+
- #if defined(freebsd_HOST_OS)
- #define _POSIX_C_SOURCE 200112L
- #define _XOPEN_SOURCE 600
diff --git a/dev-lang/ghc/files/ghc-7.10.1-T10590-dequeue.patch b/dev-lang/ghc/files/ghc-7.10.1-T10590-dequeue.patch
deleted file mode 100644
index be0f7a0..00000000
--- a/dev-lang/ghc/files/ghc-7.10.1-T10590-dequeue.patch
+++ /dev/null
@@ -1,89 +0,0 @@
-diff --git a/rts/RaiseAsync.c b/rts/RaiseAsync.c
-index 3b206ff..08c031c 100644
---- a/rts/RaiseAsync.c
-+++ b/rts/RaiseAsync.c
-@@ -56,7 +56,8 @@ static void throwToSendMsg (Capability *cap USED_IF_THREADS,
-
- static void
- throwToSingleThreaded__ (Capability *cap, StgTSO *tso, StgClosure *exception,
-- rtsBool stop_at_atomically, StgUpdateFrame *stop_here)
-+ rtsBool stop_at_atomically, StgUpdateFrame *stop_here,
-+ rtsBool dequeue)
- {
- // Thread already dead?
- if (tso->what_next == ThreadComplete || tso->what_next == ThreadKilled) {
-@@ -64,7 +65,9 @@ throwToSingleThreaded__ (Capability *cap, StgTSO *tso, StgClosure *exception,
- }
-
- // Remove it from any blocking queues
-- removeFromQueues(cap,tso);
-+ if (dequeue) {
-+ removeFromQueues(cap,tso);
-+ }
-
- raiseAsync(cap, tso, exception, stop_at_atomically, stop_here);
- }
-@@ -72,20 +75,26 @@ throwToSingleThreaded__ (Capability *cap, StgTSO *tso, StgClosure *exception,
- void
- throwToSingleThreaded (Capability *cap, StgTSO *tso, StgClosure *exception)
- {
-- throwToSingleThreaded__(cap, tso, exception, rtsFalse, NULL);
-+ throwToSingleThreaded__(cap, tso, exception, rtsFalse, NULL, rtsTrue);
-+}
-+
-+void
-+throwToSingleThreadedNoDequeue (Capability *cap, StgTSO *tso, StgClosure *exception)
-+{
-+ throwToSingleThreaded__(cap, tso, exception, rtsFalse, NULL, rtsFalse);
- }
-
- void
- throwToSingleThreaded_ (Capability *cap, StgTSO *tso, StgClosure *exception,
- rtsBool stop_at_atomically)
- {
-- throwToSingleThreaded__ (cap, tso, exception, stop_at_atomically, NULL);
-+ throwToSingleThreaded__ (cap, tso, exception, stop_at_atomically, NULL, rtsTrue);
- }
-
- void // cannot return a different TSO
- suspendComputation (Capability *cap, StgTSO *tso, StgUpdateFrame *stop_here)
- {
-- throwToSingleThreaded__ (cap, tso, NULL, rtsFalse, stop_here);
-+ throwToSingleThreaded__ (cap, tso, NULL, rtsFalse, stop_here, rtsTrue);
- }
-
- /* -----------------------------------------------------------------------------
-diff --git a/rts/RaiseAsync.h b/rts/RaiseAsync.h
-index 6bfed8d..2e8a7a3 100644
---- a/rts/RaiseAsync.h
-+++ b/rts/RaiseAsync.h
-@@ -23,6 +23,10 @@ void throwToSingleThreaded (Capability *cap,
- StgTSO *tso,
- StgClosure *exception);
-
-+void throwToSingleThreadedNoDequeue (Capability *cap,
-+ StgTSO *tso,
-+ StgClosure *exception);
-+
- void throwToSingleThreaded_ (Capability *cap,
- StgTSO *tso,
- StgClosure *exception,
-diff --git a/rts/posix/Select.c b/rts/posix/Select.c
-index 4b19235..6889499 100644
---- a/rts/posix/Select.c
-+++ b/rts/posix/Select.c
-@@ -412,8 +412,12 @@ awaitEvent(rtsBool wait)
- IF_DEBUG(scheduler,
- debugBelch("Killing blocked thread %lu on bad fd=%i\n",
- (unsigned long)tso->id, fd));
-- throwToSingleThreaded(&MainCapability, tso,
-- (StgClosure *)blockedOnBadFD_closure);
-+ /*
-+ * We can't use throwToSingleThreaded() here
-+ * as 'RTS_FD_IS_READY' breaks blocked_queue_hd list
-+ */
-+ throwToSingleThreadedNoDequeue(&MainCapability, tso,
-+ (StgClosure *)blockedOnBadFD_closure);
- break;
- case RTS_FD_IS_READY:
- IF_DEBUG(scheduler,
diff --git a/dev-lang/ghc/files/ghc-7.2.1-freebsd-CHOST.patch b/dev-lang/ghc/files/ghc-7.2.1-freebsd-CHOST.patch
deleted file mode 100644
index da59cd7..00000000
--- a/dev-lang/ghc/files/ghc-7.2.1-freebsd-CHOST.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git a/aclocal.m4 b/aclocal.m4
-index 11bb003..52df243 100644
---- a/aclocal.m4
-+++ b/aclocal.m4
-@@ -1545,7 +1545,7 @@ case "$1" in
- freebsd|netbsd|openbsd|dragonfly|osf1|osf3|hpux|linuxaout|kfreebsdgnu|freebsd2|solaris2|cygwin32|mingw32|darwin|gnu|nextstep2|nextstep3|sunos4|ultrix|irix|aix|haiku)
- $2="$1"
- ;;
-- freebsd8) # like i686-gentoo-freebsd8
-+ freebsd*) # like i686-gentoo-freebsd8 or i686-gentoo-freebsd8.2
- $2="freebsd"
- ;;
- darwin*)
diff --git a/dev-lang/ghc/files/ghc-7.4-rc2-macos-prefix-respect-gcc.patch b/dev-lang/ghc/files/ghc-7.4-rc2-macos-prefix-respect-gcc.patch
deleted file mode 100644
index 770fd65..00000000
--- a/dev-lang/ghc/files/ghc-7.4-rc2-macos-prefix-respect-gcc.patch
+++ /dev/null
@@ -1,23 +0,0 @@
-diff --git a/aclocal.m4 b/aclocal.m4
-index a377cb9..4f8fd69 100644
---- a/aclocal.m4
-+++ b/aclocal.m4
-@@ -1950,17 +1950,7 @@ AC_DEFUN([XCODE_VERSION],[
- # --------------------------------
- # Finds where gcc is
- AC_DEFUN([FIND_GCC],[
-- if test "$TargetOS_CPP" = "darwin" &&
-- test "$XCodeVersion1" -eq 4 &&
-- test "$XCodeVersion2" -lt 2
-- then
-- # In Xcode 4.1, 'gcc-4.2' is the gcc legacy backend (rather
-- # than the LLVM backend). We prefer the legacy gcc, but in
-- # Xcode 4.2 'gcc-4.2' was removed.
-- FP_ARG_WITH_PATH_GNU_PROG([CC], [gcc-4.2])
-- else
-- FP_ARG_WITH_PATH_GNU_PROG([CC], [gcc])
-- fi
-+ FP_ARG_WITH_PATH_GNU_PROG([CC], [gcc])
- export CC
- WhatGccIsCalled="$CC"
- AC_SUBST(WhatGccIsCalled)
diff --git a/dev-lang/ghc/files/ghc-7.4.1-darwin-CHOST.patch b/dev-lang/ghc/files/ghc-7.4.1-darwin-CHOST.patch
deleted file mode 100644
index 3481588..00000000
--- a/dev-lang/ghc/files/ghc-7.4.1-darwin-CHOST.patch
+++ /dev/null
@@ -1,18 +0,0 @@
-like the other CHOST patches, but this one catches another case where
-$host is used (instead of the cannonicalised variables)
-
---- aclocal.m4
-+++ aclocal.m4
-@@ -93,10 +93,10 @@
- exeext='.exe'
- soext='.dll'
- ;;
-- i386-apple-darwin|powerpc-apple-darwin)
-+ i386-apple-darwin*|powerpc-apple-darwin*)
- soext='.dylib'
- ;;
-- x86_64-apple-darwin)
-+ x86_64-apple-darwin*)
- soext='.dylib'
- ;;
- esac
diff --git a/dev-lang/ghc/files/ghc-7.4.1-ticket-7339-fix-unaligned-unreg.patch b/dev-lang/ghc/files/ghc-7.4.1-ticket-7339-fix-unaligned-unreg.patch
deleted file mode 100644
index f2f19f1..00000000
--- a/dev-lang/ghc/files/ghc-7.4.1-ticket-7339-fix-unaligned-unreg.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-From 26f8466507bd9383e0a7d1e62e397eca4a13822a Mon Sep 17 00:00:00 2001
-From: Sergei Trofimovich <slyfox@gentoo.org>
-Date: Tue, 13 Nov 2012 01:39:14 +0300
-Subject: [PATCH] Fix unaligned access on alpha and friends (ticket #7339)
-
-Assume unknown arch (alpha and mips) an alignment sensitive target.
-Otherwise on alpha it causes ghc-7.4.1 to generate invalud lexers.
-
-Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
----
- compiler/cmm/PprC.hs | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/compiler/cmm/PprC.hs b/compiler/cmm/PprC.hs
-index 21826f8..8cdcde6 100644
---- a/compiler/cmm/PprC.hs
-+++ b/compiler/cmm/PprC.hs
-@@ -963,6 +963,7 @@ cLoad platform expr rep
- | otherwise
- = char '*' <> parens (cCast platform (machRepPtrCType rep) expr)
- where -- On these platforms, unaligned loads are known to cause problems
-+ bewareLoadStoreAlignment ArchUnknown = True -- like alpha or mips
- bewareLoadStoreAlignment (ArchARM {}) = True
- bewareLoadStoreAlignment _ = False
-
---
-1.8.0
-
diff --git a/dev-lang/ghc/files/ghc-7.4.2-system-libffi.patch b/dev-lang/ghc/files/ghc-7.4.2-system-libffi.patch
deleted file mode 100644
index 73c4aa2..00000000
--- a/dev-lang/ghc/files/ghc-7.4.2-system-libffi.patch
+++ /dev/null
@@ -1,119 +0,0 @@
-Make ghc use the libffi installed on the system instead of the bundled one.
-
-This patch is based on the one used by Debian and Fedora, but was
-augmented by additional lines to identify the libffi include directory
-using pkg-config, as libffi on Gentoo installs into a subdirectory of
-the system include directory.
-
-2012-04-24 Martin von Gagern
-
-References:
-https://bugs.gentoo.org/411925
-http://hackage.haskell.org/trac/ghc/ticket/5743
-
-Index: ghc-7.4.1/ghc.mk
-===================================================================
---- ghc-7.4.1.orig/ghc.mk
-+++ ghc-7.4.1/ghc.mk
-@@ -579,7 +579,6 @@ BUILD_DIRS += \
- driver/ghci \
- driver/ghc \
- driver/haddock \
-- libffi \
- includes \
- rts
-
-Index: ghc-7.4.1/rts/ghc.mk
-===================================================================
---- ghc-7.4.1.orig/rts/ghc.mk
-+++ ghc-7.4.1/rts/ghc.mk
-@@ -86,8 +86,7 @@
- ALL_RTS_DEF_LIBNAMES = base ghc-prim
- ALL_RTS_DEF_LIBS = \
- rts/dist/build/win32/libHSbase.dll.a \
-- rts/dist/build/win32/libHSghc-prim.dll.a \
-- libffi/build/inst/lib/libffi.dll.a
-+ rts/dist/build/win32/libHSghc-prim.dll.a
-
- # -- import libs for the regular Haskell libraries
- define make-importlib-def # args $1 = lib name
-@@ -172,12 +171,12 @@
- # Making a shared library for the RTS.
- ifneq "$$(findstring dyn, $1)" ""
- ifeq "$$(HOSTPLATFORM)" "i386-unknown-mingw32"
--$$(rts_$1_LIB) : $$(rts_$1_OBJS) $$(ALL_RTS_DEF_LIBS) rts/libs.depend rts/dist/build/libffi-5.dll
-+$$(rts_$1_LIB) : $$(rts_$1_OBJS) $$(ALL_RTS_DEF_LIBS) rts/libs.depend
- "$$(RM)" $$(RM_OPTS) $$@
- "$$(rts_dist_HC)" -package-name rts -shared -dynamic -dynload deploy \
- -no-auto-link-packages -Lrts/dist/build -lffi-5 `cat rts/libs.depend` $$(rts_$1_OBJS) $$(ALL_RTS_DEF_LIBS) -o $$@
- else
--$$(rts_$1_LIB) : $$(rts_$1_OBJS) $$(rts_$1_DTRACE_OBJS) rts/libs.depend rts/dist/build/libffi$$(soext)
-+$$(rts_$1_LIB) : $$(rts_$1_OBJS) $$(rts_$1_DTRACE_OBJS) rts/libs.depend
- "$$(RM)" $$(RM_OPTS) $$@
- "$$(rts_dist_HC)" -package-name rts -shared -dynamic -dynload deploy \
- -no-auto-link-packages -Lrts/dist/build -lffi `cat rts/libs.depend` $$(rts_$1_OBJS) \
-@@ -188,9 +187,9 @@
- endif
- endif
- else
--$$(rts_$1_LIB) : $$(rts_$1_OBJS) $$(rts_$1_DTRACE_OBJS) $$(rts_ffi_objs_stamp)
-+$$(rts_$1_LIB) : $$(rts_$1_OBJS) $$(rts_$1_DTRACE_OBJS)
- "$$(RM)" $$(RM_OPTS) $$@
-- echo $$(rts_ffi_objs) $$(rts_$1_OBJS) $$(rts_$1_DTRACE_OBJS) | "$$(XARGS)" $$(XARGS_OPTS) "$$(AR_STAGE1)" \
-+ echo $$(rts_$1_OBJS) $$(rts_$1_DTRACE_OBJS) | "$$(XARGS)" $$(XARGS_OPTS) "$$(AR_STAGE1)" \
- $$(AR_OPTS_STAGE1) $$(EXTRA_AR_ARGS_STAGE1) $$@
- endif
-
-@@ -403,6 +402,12 @@
- rts/dist/build/sm/Evac_thr_CC_OPTS += -DPARALLEL_GC -Irts/sm
- rts/dist/build/sm/Scav_thr_CC_OPTS += -DPARALLEL_GC -Irts/sm
-
-+# Use system libffi
-+libffi_include_flags:=$(shell pkg-config --cflags-only-I libffi)
-+rts/Adjustor_CC_OPTS += $(libffi_include_flags)
-+rts/Interpreter_CC_OPTS += $(libffi_include_flags)
-+rts/sm/Storage_CC_OPTS += $(libffi_include_flags)
-+
- #-----------------------------------------------------------------------------
- # Add PAPI library if needed
-
-@@ -504,10 +509,8 @@
- # installing
-
- INSTALL_LIBS += $(ALL_RTS_LIBS)
--INSTALL_LIBS += $(wildcard rts/dist/build/libffi$(soext)*)
--INSTALL_LIBS += $(wildcard rts/dist/build/libffi-5.dll)
-
--install: install_libffi_headers
-+install:
-
- .PHONY: install_libffi_headers
- install_libffi_headers :
-Index: ghc-7.4.1/rts/package.conf.in
-===================================================================
---- ghc-7.4.1.orig/rts/package.conf.in
-+++ ghc-7.4.1/rts/package.conf.in
-@@ -24,8 +24,9 @@
- hs-libraries: "HSrts"
-
- extra-libraries:
-+ "ffi"
- #ifdef HAVE_LIBM
-- "m" /* for ldexp() */
-+ , "m" /* for ldexp() */
- #endif
- #ifdef HAVE_LIBRT
- , "rt"
-Index: ghc-7.4.1/compiler/ghc.mk
-===================================================================
---- ghc-7.4.1.orig/compiler/ghc.mk
-+++ ghc-7.4.1/compiler/ghc.mk
-@@ -260,6 +260,8 @@
-
- compiler_CPP_OPTS += -I$(GHC_INCLUDE_DIR)
- compiler_CPP_OPTS += ${GhcCppOpts}
-+libffi_include_flags := $(shell pkg-config --cflags-only-I libffi)
-+compiler/ghci/LibFFI_HSC2HS_OPTS += $(addprefix --cflag=,$(libffi_include_flags))
-
- $(PRIMOPS_TXT) compiler/parser/Parser.y: %: %.pp compiler/stage1/$(PLATFORM_H)
- $(CPP) $(RAWCPP_FLAGS) -P $(compiler_CPP_OPTS) -x c $< | grep -v '^#pragma GCC' > $@
diff --git a/dev-lang/ghc/files/ghc-7.5.20120505-system-libffi.patch b/dev-lang/ghc/files/ghc-7.5.20120505-system-libffi.patch
deleted file mode 100644
index f3b0c71..00000000
--- a/dev-lang/ghc/files/ghc-7.5.20120505-system-libffi.patch
+++ /dev/null
@@ -1,88 +0,0 @@
---- ghc-7.5.20120505-orig/ghc.mk 2012-05-06 03:01:29.000000000 +1000
-+++ ghc-7.5.20120505/ghc.mk 2012-05-06 17:22:01.023416003 +1000
-@@ -584,7 +584,6 @@
- $(MAYBE_GHCI) \
- driver/ghc \
- driver/haddock \
-- libffi \
- includes \
- rts
-
---- ghc-7.5.20120505-orig/rts/ghc.mk 2012-05-06 03:01:30.000000000 +1000
-+++ ghc-7.5.20120505/rts/ghc.mk 2012-05-06 17:28:31.925897226 +1000
-@@ -171,12 +171,12 @@
- # Making a shared library for the RTS.
- ifneq "$$(findstring dyn, $1)" ""
- ifeq "$$(HostOS_CPP)" "mingw32"
--$$(rts_$1_LIB) : $$(rts_$1_OBJS) $$(ALL_RTS_DEF_LIBS) rts/libs.depend rts/dist/build/$$(LIBFFI_DLL)
-+$$(rts_$1_LIB) : $$(rts_$1_OBJS) $$(ALL_RTS_DEF_LIBS) rts/libs.depend
- "$$(RM)" $$(RM_OPTS) $$@
- "$$(rts_dist_HC)" -package-name rts -shared -dynamic -dynload deploy \
- -no-auto-link-packages -Lrts/dist/build -l$(LIBFFI_WINDOWS_LIB) `cat rts/libs.depend` $$(rts_$1_OBJS) $$(ALL_RTS_DEF_LIBS) -o $$@
- else
--$$(rts_$1_LIB) : $$(rts_$1_OBJS) $$(rts_$1_DTRACE_OBJS) rts/libs.depend rts/dist/build/libffi$$(soext)
-+$$(rts_$1_LIB) : $$(rts_$1_OBJS) $$(rts_$1_DTRACE_OBJS) rts/libs.depend
- "$$(RM)" $$(RM_OPTS) $$@
- "$$(rts_dist_HC)" -package-name rts -shared -dynamic -dynload deploy \
- -no-auto-link-packages -Lrts/dist/build -lffi `cat rts/libs.depend` $$(rts_$1_OBJS) \
-@@ -187,9 +187,9 @@
- endif
- endif
- else
--$$(rts_$1_LIB) : $$(rts_$1_OBJS) $$(rts_$1_DTRACE_OBJS) $$(rts_ffi_objs_stamp)
-+$$(rts_$1_LIB) : $$(rts_$1_OBJS) $$(rts_$1_DTRACE_OBJS)
- "$$(RM)" $$(RM_OPTS) $$@
-- echo $$(rts_ffi_objs) $$(rts_$1_OBJS) $$(rts_$1_DTRACE_OBJS) | "$$(XARGS)" $$(XARGS_OPTS) "$$(AR_STAGE1)" \
-+ echo $$(rts_$1_OBJS) $$(rts_$1_DTRACE_OBJS) | "$$(XARGS)" $$(XARGS_OPTS) "$$(AR_STAGE1)" \
- $$(AR_OPTS_STAGE1) $$(EXTRA_AR_ARGS_STAGE1) $$@
- endif
-
-@@ -407,6 +407,12 @@
- rts/dist/build/sm/Evac_thr_CC_OPTS += -DPARALLEL_GC -Irts/sm
- rts/dist/build/sm/Scav_thr_CC_OPTS += -DPARALLEL_GC -Irts/sm
-
-+# Use system libffi
-+libffi_include_flags:=$(shell pkg-config --cflags-only-I libffi)
-+rts/Adjustor_CC_OPTS += $(libffi_include_flags)
-+rts/Interpreter_CC_OPTS += $(libffi_include_flags)
-+rts/sm/Storage_CC_OPTS += $(libffi_include_flags)
-+
- #-----------------------------------------------------------------------------
- # Add PAPI library if needed
-
-@@ -508,10 +514,8 @@
- # installing
-
- INSTALL_LIBS += $(ALL_RTS_LIBS)
--INSTALL_LIBS += $(wildcard rts/dist/build/libffi$(soext)*)
--INSTALL_LIBS += $(wildcard rts/dist/build/$(LIBFFI_DLL))
-
--install: install_libffi_headers
-+install:
-
- .PHONY: install_libffi_headers
- install_libffi_headers :
---- ghc-7.5.20120505-orig/rts/package.conf.in 2012-05-06 03:01:30.000000000 +1000
-+++ ghc-7.5.20120505/rts/package.conf.in 2012-05-06 17:22:01.025416056 +1000
-@@ -24,8 +24,9 @@
- hs-libraries: "HSrts"
-
- extra-libraries:
-+ "ffi"
- #ifdef HAVE_LIBM
-- "m" /* for ldexp() */
-+ , "m" /* for ldexp() */
- #endif
- #ifdef HAVE_LIBRT
- , "rt"
---- ghc-7.5.20120505-orig/compiler/ghc.mk 2012-05-06 03:01:29.000000000 +1000
-+++ ghc-7.5.20120505/compiler/ghc.mk 2012-05-06 17:22:01.026416083 +1000
-@@ -260,6 +260,8 @@
-
- compiler_CPP_OPTS += $(addprefix -I,$(GHC_INCLUDE_DIRS))
- compiler_CPP_OPTS += ${GhcCppOpts}
-+libffi_include_flags := $(shell pkg-config --cflags-only-I libffi)
-+compiler/ghci/LibFFI_HSC2HS_OPTS += $(addprefix --cflag=,$(libffi_include_flags))
-
- $(PRIMOPS_TXT) compiler/parser/Parser.y: %: %.pp compiler/stage1/$(PLATFORM_H)
- $(CPP) $(RAWCPP_FLAGS) -P $(compiler_CPP_OPTS) -x c $< | grep -v '^#pragma GCC' > $@
diff --git a/dev-lang/ghc/files/ghc-7.6.2-integer-simple-div-mod.patch b/dev-lang/ghc/files/ghc-7.6.2-integer-simple-div-mod.patch
deleted file mode 100644
index 0dc5391..00000000
--- a/dev-lang/ghc/files/ghc-7.6.2-integer-simple-div-mod.patch
+++ /dev/null
@@ -1,57 +0,0 @@
-commit de13417726b90b0945aaaf0b9cfbaf8ab975d8b5
-Author: Gabor Greif <ggreif@gmail.com>
-Date: Tue Jul 24 14:31:36 2012 +0200
-
- track integer-gmp and add 'divInteger', 'modInteger'
-
-diff --git a/libraries/integer-simple/GHC/Integer.hs b/libraries/integer-simple/GHC/Integer.hs
-index c9b50a7..4122d38 100644
---- a/libraries/integer-simple/GHC/Integer.hs
-+++ b/libraries/integer-simple/GHC/Integer.hs
-@@ -4,7 +4,7 @@
- -----------------------------------------------------------------------------
- -- |
- -- Module : GHC.Integer
---- Copyright : (c) Ian Lynagh 2007-2008
-+-- Copyright : (c) Ian Lynagh 2007-2012
- -- License : BSD3
- --
- -- Maintainer : igloo@earth.li
-@@ -27,6 +27,7 @@ module GHC.Integer (
- plusInteger, minusInteger, timesInteger, negateInteger,
- eqInteger, neqInteger, absInteger, signumInteger,
- leInteger, gtInteger, ltInteger, geInteger, compareInteger,
-+ divInteger, modInteger,
- divModInteger, quotRemInteger, quotInteger, remInteger,
- encodeFloatInteger, decodeFloatInteger, floatFromInteger,
- encodeDoubleInteger, decodeDoubleInteger, doubleFromInteger,
-diff --git a/libraries/integer-simple/GHC/Integer/Type.hs b/libraries/integer-simple/GHC/Integer/Type.hs
-index c3d812c..67ed19c 100644
---- a/libraries/integer-simple/GHC/Integer/Type.hs
-+++ b/libraries/integer-simple/GHC/Integer/Type.hs
-@@ -7,7 +7,7 @@
- -----------------------------------------------------------------------------
- -- |
- -- Module : GHC.Integer.Type
---- Copyright : (c) Ian Lynagh 2007-2008
-+-- Copyright : (c) Ian Lynagh 2007-2012
- -- License : BSD3
- --
- -- Maintainer : igloo@earth.li
-@@ -370,6 +370,16 @@ n `divModInteger` d =
- then (# q `minusInteger` oneInteger, r `plusInteger` d #)
- else (# q, r #)
-
-+{-# NOINLINE divInteger #-}
-+divInteger :: Integer -> Integer -> Integer
-+n `divInteger` d = quotient
-+ where (# quotient, _ #) = n `divModInteger` d
-+
-+{-# NOINLINE modInteger #-}
-+modInteger :: Integer -> Integer -> Integer
-+n `modInteger` d = modulus
-+ where (# _, modulus #) = n `divModInteger` d
-+
- {-# NOINLINE quotRemInteger #-}
- quotRemInteger :: Integer -> Integer -> (# Integer, Integer #)
- Naught `quotRemInteger` (!_) = (# Naught, Naught #)
diff --git a/dev-lang/ghc/files/ghc-7.6.3-trac-3333-weak-syms.patch b/dev-lang/ghc/files/ghc-7.6.3-trac-3333-weak-syms.patch
deleted file mode 100644
index c3184a6..00000000
--- a/dev-lang/ghc/files/ghc-7.6.3-trac-3333-weak-syms.patch
+++ /dev/null
@@ -1,387 +0,0 @@
-The patch set adds support for weak symbols to ghci.
-
-For gentoo it fixes nonworking ghci / template haskell
-for package base.
-
-Steps to reproduce:
- 1. CFLAGS=-Os emerge ghc
- 2. ghci -package base
- Loading package base ... linking ... ghc: /usr/lib64/ghc-7.6.3/base-4.6.0.1/HSbase-4.6.0.1.o: unknown symbol `stat'
-
-When built with -O2 weak 'stat' resolved to '__xstat' and we don't see any errors.
-But on olwer optimization levels 'stat' remains.
-
-Patches-by: akio
-Gentoo-bug: http://bugs.gentoo.org/452442
-Upstream-bug: http://ghc.haskell.org/trac/ghc/ticket/3333
-
-From 500d57d3a18412c78cab5abc4d91f1564edc964d Mon Sep 17 00:00:00 2001
-From: Takano Akio <aljee@hyper.cx>
-Date: Sat, 29 Dec 2012 11:47:22 +0900
-Subject: [PATCH 1/3] Linker.c: remove stablehash, which is no longer used
-
----
- includes/rts/Linker.h | 3 ---
- rts/Linker.c | 31 ++-----------------------------
- 2 files changed, 2 insertions(+), 32 deletions(-)
-
-diff --git a/includes/rts/Linker.h b/includes/rts/Linker.h
-index e900e85..d20ebc2 100644
---- a/includes/rts/Linker.h
-+++ b/includes/rts/Linker.h
-@@ -23,9 +23,6 @@ typedef char pathchar;
- /* initialize the object linker */
- void initLinker( void );
-
--/* insert a stable symbol in the hash table */
--void insertStableSymbol(pathchar* obj_name, char* key, StgPtr data);
--
- /* insert a symbol in the hash table */
- void insertSymbol(pathchar* obj_name, char* key, void* data);
-
-diff --git a/rts/Linker.c b/rts/Linker.c
-index fa1de89..513fe3f 100644
---- a/rts/Linker.c
-+++ b/rts/Linker.c
-@@ -30,1 +30,0 @@
--#include "Stable.h"
-@@ -150,9 +149,6 @@ int dynamicByDefault = 0;
- /* Hash table mapping symbol names to Symbol */
- static /*Str*/HashTable *symhash;
-
--/* Hash table mapping symbol names to StgStablePtr */
--static /*Str*/HashTable *stablehash;
--
- /* List of currently loaded objects */
- ObjectCode *objects = NULL; /* initially empty */
-
-@@ -1126,1 +1126,0 @@ typedef struct _RtsSymbolVal {
-- SymI_HasProto(insertStableSymbol) \
-@@ -1488,7 +1483,6 @@ initLinker( void )
- #if defined(THREADED_RTS) && (defined(OBJFORMAT_ELF) || defined(OBJFORMAT_MACHO))
- initMutex(&dl_mutex);
- #endif
-- stablehash = allocStrHashTable();
- symhash = allocStrHashTable();
-
- /* populate the symbol table with stuff from the RTS */
-@@ -1817,17 +1811,6 @@ error:
- }
-
- /* -----------------------------------------------------------------------------
-- * insert a stable symbol in the hash table
-- */
--
--void
--insertStableSymbol(pathchar* obj_name, char* key, StgPtr p)
--{
-- ghciInsertStrHashTable(obj_name, stablehash, key, getStablePtr(p));
--}
--
--
--/* -----------------------------------------------------------------------------
- * insert a symbol in the hash table
- */
- void
-@@ -4749,8 +4732,6 @@ do_Elf_Rel_relocations ( ObjectCode* oc, char* ehdrC,
- #ifdef i386_HOST_ARCH
- Elf_Addr value;
- #endif
-- StgStablePtr stablePtr;
-- StgPtr stableVal;
- #ifdef arm_HOST_ARCH
- int is_target_thm=0, T=0;
- #endif
-@@ -4773,16 +4754,8 @@ do_Elf_Rel_relocations ( ObjectCode* oc, char* ehdrC,
-
- } else {
- symbol = strtab + sym.st_name;
-- stablePtr = (StgStablePtr)lookupHashTable(stablehash, (StgWord)symbol);
-- if (NULL == stablePtr) {
-- /* No, so look up the name in our global table. */
-- S_tmp = lookupSymbol( symbol );
-- S = (Elf_Addr)S_tmp;
-- } else {
-- stableVal = deRefStablePtr( stablePtr );
-- S_tmp = stableVal;
-- S = (Elf_Addr)S_tmp;
-- }
-+ S_tmp = lookupSymbol( symbol );
-+ S = (Elf_Addr)S_tmp;
- }
- if (!S) {
- errorBelch("%s: unknown symbol `%s'", oc->fileName, symbol);
---
-1.7.9.5
-
-From 2e5e0f7a90dd390adc5ae5fb2a3bc6e879aa42d6 Mon Sep 17 00:00:00 2001
-From: Takano Akio <aljee@hyper.cx>
-Date: Sat, 29 Dec 2012 11:59:34 +0900
-Subject: [PATCH 2/3] ghci: add support for ELF weak symbols
-
----
- rts/Linker.c | 102 ++++++++++++++++++++++++++++++++++++++++++++--------------
- 1 file changed, 78 insertions(+), 24 deletions(-)
-
-diff --git a/rts/Linker.c b/rts/Linker.c
-index 513fe3f..5105085 100644
---- a/rts/Linker.c
-+++ b/rts/Linker.c
-@@ -146,7 +146,13 @@ int dynamicByDefault = 1;
- int dynamicByDefault = 0;
- #endif
-
--/* Hash table mapping symbol names to Symbol */
-+typedef struct _RtsSymbolInfo {
-+ void *value;
-+ const ObjectCode *owner;
-+ HsBool weak;
-+} RtsSymbolInfo;
-+
-+/* Hash table mapping symbol names to RtsSymbolInfo */
- static /*Str*/HashTable *symhash;
-
- /* List of currently loaded objects */
-@@ -1415,15 +1421,31 @@ static RtsSymbolVal rtsSyms[] = {
- * Insert symbols into hash tables, checking for duplicates.
- */
-
--static void ghciInsertStrHashTable ( pathchar* obj_name,
-- HashTable *table,
-- char* key,
-- void *data
-- )
-+static void ghciInsertSymbolTable(
-+ pathchar* obj_name,
-+ HashTable *table,
-+ char* key,
-+ void *data,
-+ HsBool weak,
-+ ObjectCode *owner)
- {
-- if (lookupHashTable(table, (StgWord)key) == NULL)
-+ RtsSymbolInfo *pinfo = lookupStrHashTable(table, key);
-+ if (!pinfo) /* new entry */
-+ {
-+ pinfo = stgMallocBytes(sizeof (*pinfo), "ghciInsertToSymbolTable");
-+ pinfo->value = data;
-+ pinfo->owner = owner;
-+ pinfo->weak = weak;
-+ insertStrHashTable(table, key, pinfo);
-+ return;
-+ } else if ((!pinfo->weak || pinfo->value) && weak) {
-+ return; /* duplicate weak symbol, throw it away */
-+ } else if (pinfo->weak) /* weak symbol is in the table */
- {
-- insertStrHashTable(table, (StgWord)key, data);
-+ /* override the weak definition with the non-weak one */
-+ pinfo->value = data;
-+ pinfo->owner = owner;
-+ pinfo->weak = HS_BOOL_FALSE;
- return;
- }
- debugBelch(
-@@ -1444,6 +1466,32 @@ static void ghciInsertStrHashTable ( pathchar* obj_name,
- );
- stg_exit(1);
- }
-+
-+static HsBool ghciLookupSymbolTable(HashTable *table,
-+ const char *key, void **result)
-+{
-+ RtsSymbolInfo *pinfo = lookupStrHashTable(table, key);
-+ if (!pinfo) {
-+ *result = NULL;
-+ return HS_BOOL_FALSE;
-+ }
-+ if (pinfo->weak)
-+ IF_DEBUG(linker, debugBelch("lookup: promoting %s\n", key));
-+ /* Once it's looked up, it can no longer be overridden */
-+ pinfo->weak = HS_BOOL_FALSE;
-+
-+ *result = pinfo->value;
-+ return HS_BOOL_TRUE;
-+}
-+
-+static void ghciRemoveSymbolTable(HashTable *table, const char *key,
-+ ObjectCode *owner)
-+{
-+ RtsSymbolInfo *pinfo = lookupStrHashTable(table, key);
-+ if (!pinfo || owner != pinfo->owner) return;
-+ removeStrHashTable(table, key, NULL);
-+ stgFree(pinfo);
-+}
- /* -----------------------------------------------------------------------------
- * initialize the object linker
- */
-@@ -1487,8 +1535,8 @@ initLinker( void )
-
- /* populate the symbol table with stuff from the RTS */
- for (sym = rtsSyms; sym->lbl != NULL; sym++) {
-- ghciInsertStrHashTable(WSTR("(GHCi built-in symbols)"),
-- symhash, sym->lbl, sym->addr);
-+ ghciInsertSymbolTable(WSTR("(GHCi built-in symbols)"),
-+ symhash, sym->lbl, sym->addr, HS_BOOL_FALSE, NULL);
- IF_DEBUG(linker, debugBelch("initLinker: inserting rts symbol %s, %p\n", sym->lbl, sym->addr));
- }
- # if defined(OBJFORMAT_MACHO) && defined(powerpc_HOST_ARCH)
-@@ -1816,7 +1864,7 @@ error:
- void
- insertSymbol(pathchar* obj_name, char* key, void* data)
- {
-- ghciInsertStrHashTable(obj_name, symhash, key, data);
-+ ghciInsertSymbolTable(obj_name, symhash, key, data, HS_BOOL_FALSE, NULL);
- }
-
- /* -----------------------------------------------------------------------------
-@@ -1829,9 +1877,8 @@ lookupSymbol( char *lbl )
- IF_DEBUG(linker, debugBelch("lookupSymbol: looking up %s\n", lbl));
- initLinker() ;
- ASSERT(symhash != NULL);
-- val = lookupStrHashTable(symhash, lbl);
-
-- if (val == NULL) {
-+ if (!ghciLookupSymbolTable(symhash, lbl, &val)) {
- IF_DEBUG(linker, debugBelch("lookupSymbol: symbol not found\n"));
- # if defined(OBJFORMAT_ELF)
- return internal_dlsym(dl_prog_handle, lbl);
-@@ -1903,7 +1950,7 @@ void ghci_enquire ( char* addr )
- if (sym == NULL) continue;
- a = NULL;
- if (a == NULL) {
-- a = lookupStrHashTable(symhash, sym);
-+ ghciLookupSymbolTable(symhash, sym, (void **)&a);
- }
- if (a == NULL) {
- // debugBelch("ghci_enquire: can't find %s\n", sym);
-@@ -2715,7 +2762,7 @@ unloadObj( pathchar *path )
- int i;
- for (i = 0; i < oc->n_symbols; i++) {
- if (oc->symbols[i] != NULL) {
-- removeStrHashTable(symhash, oc->symbols[i], NULL);
-+ ghciRemoveSymbolTable(symhash, oc->symbols[i], oc);
- }
- }
- }
-@@ -3802,7 +3849,8 @@ ocGetNames_PEi386 ( ObjectCode* oc )
- ASSERT(i >= 0 && i < oc->n_symbols);
- /* cstring_from_COFF_symbol_name always succeeds. */
- oc->symbols[i] = (char*)sname;
-- ghciInsertStrHashTable(oc->fileName, symhash, (char*)sname, addr);
-+ ghciInsertSymbolTable(oc->fileName, symhash, (char*)sname, addr,
-+ HS_BOOL_FALSE, oc);
- } else {
- # if 0
- debugBelch(
-@@ -4595,6 +4643,7 @@ ocGetNames_ELF ( ObjectCode* oc )
- for (j = 0; j < nent; j++) {
-
- char isLocal = FALSE; /* avoids uninit-var warning */
-+ HsBool isWeak = HS_BOOL_FALSE;
- char* ad = NULL;
- char* nm = strtab + stab[j].st_name;
- int secno = stab[j].st_shndx;
-@@ -4615,6 +4664,7 @@ ocGetNames_ELF ( ObjectCode* oc )
- else
- if ( ( ELF_ST_BIND(stab[j].st_info)==STB_GLOBAL
- || ELF_ST_BIND(stab[j].st_info)==STB_LOCAL
-+ || ELF_ST_BIND(stab[j].st_info)==STB_WEAK
- )
- /* and not an undefined symbol */
- && stab[j].st_shndx != SHN_UNDEF
-@@ -4638,7 +4688,8 @@ ocGetNames_ELF ( ObjectCode* oc )
- ad = ehdrC + shdr[ secno ].sh_offset + stab[j].st_value;
- if (ELF_ST_BIND(stab[j].st_info)==STB_LOCAL) {
- isLocal = TRUE;
-- } else {
-+ isWeak = FALSE;
-+ } else { /* STB_GLOBAL or STB_WEAK */
- #ifdef ELF_FUNCTION_DESC
- /* dlsym() and the initialisation table both give us function
- * descriptors, so to be consistent we store function descriptors
-@@ -4649,6 +4700,7 @@ ocGetNames_ELF ( ObjectCode* oc )
- IF_DEBUG(linker,debugBelch( "addOTabName(GLOB): %10p %s %s\n",
- ad, oc->fileName, nm ));
- isLocal = FALSE;
-+ isWeak = (ELF_ST_BIND(stab[j].st_info)==STB_WEAK);
- }
- }
-
-@@ -4661,7 +4713,7 @@ ocGetNames_ELF ( ObjectCode* oc )
- if (isLocal) {
- /* Ignore entirely. */
- } else {
-- ghciInsertStrHashTable(oc->fileName, symhash, nm, ad);
-+ ghciInsertSymbolTable(oc->fileName, symhash, nm, ad, isWeak, oc);
- }
- } else {
- /* Skip. */
-@@ -6306,11 +6358,13 @@ ocGetNames_MachO(ObjectCode* oc)
- else
- {
- IF_DEBUG(linker, debugBelch("ocGetNames_MachO: inserting %s\n", nm));
-- ghciInsertStrHashTable(oc->fileName, symhash, nm,
-+ ghciInsertSymbolTable(oc->fileName, symhash, nm,
- image
- + sections[nlist[i].n_sect-1].offset
- - sections[nlist[i].n_sect-1].addr
-- + nlist[i].n_value);
-+ + nlist[i].n_value,
-+ HS_BOOL_FALSE,
-+ oc);
- oc->symbols[curSymbol++] = nm;
- }
- }
-@@ -6341,8 +6395,8 @@ ocGetNames_MachO(ObjectCode* oc)
- nlist[i].n_value = commonCounter;
-
- IF_DEBUG(linker, debugBelch("ocGetNames_MachO: inserting common symbol: %s\n", nm));
-- ghciInsertStrHashTable(oc->fileName, symhash, nm,
-- (void*)commonCounter);
-+ ghciInsertSymbolTable(oc->fileName, symhash, nm,
-+ (void*)commonCounter, HS_BOOL_FALSE, oc);
- oc->symbols[curSymbol++] = nm;
-
- commonCounter += sz;
-@@ -6466,7 +6520,7 @@ machoInitSymbolsWithoutUnderscore(void)
-
- #undef SymI_NeedsProto
- #define SymI_NeedsProto(x) \
-- ghciInsertStrHashTable("(GHCi built-in symbols)", symhash, #x, *p++);
-+ ghciInsertSymbolTable("(GHCi built-in symbols)", symhash, #x, *p++, HS_BOOL_FALSE, NULL);
-
- RTS_MACHO_NOUNDERLINE_SYMBOLS
-
---
-1.7.9.5
-
-From 916d7713b34b529ae7ec24eaa836a4eaca7724fc Mon Sep 17 00:00:00 2001
-From: Takano Akio <aljee@hyper.cx>
-Date: Sun, 6 Jan 2013 17:51:19 +0900
-Subject: [PATCH 3/3] Linker.c: add dso_handle to the symbol table
-
----
- rts/Linker.c | 7 +++++++
- 1 file changed, 7 insertions(+)
-
-diff --git a/rts/Linker.c b/rts/Linker.c
-index 5105085..0b2bf63 100644
---- a/rts/Linker.c
-+++ b/rts/Linker.c
-@@ -1542,6 +1542,13 @@ initLinker( void )
- # if defined(OBJFORMAT_MACHO) && defined(powerpc_HOST_ARCH)
- machoInitSymbolsWithoutUnderscore();
- # endif
-+ /* GCC defines a special symbol __dso_handle which is resolved to NULL if
-+ referenced from a statically linked module. We need to mimic this, but
-+ we cannot use NULL because we use it to mean nonexistent symbols. So we
-+ use an arbitrary (hopefully unique) address here.
-+ */
-+ ghciInsertSymbolTable(WSTR("(GHCi special symbols)"),
-+ symhash, "__dso_handle", (void *)0x12345687, HS_BOOL_FALSE, NULL);
-
- # if defined(OBJFORMAT_ELF) || defined(OBJFORMAT_MACHO)
- # if defined(RTLD_DEFAULT)
---
-1.7.9.5
-
diff --git a/dev-lang/ghc/files/ghc-7.8.3-cc-lang.patch b/dev-lang/ghc/files/ghc-7.8.3-cc-lang.patch
deleted file mode 100644
index 032dc9a..00000000
--- a/dev-lang/ghc/files/ghc-7.8.3-cc-lang.patch
+++ /dev/null
@@ -1,129 +0,0 @@
-commit 4d4d07704ee78221607a18b8118294b0aea1bac4
-Author: Sergei Trofimovich <slyfox@gentoo.org>
-Date: Tue Sep 2 00:06:56 2014 +0300
-
- systools: fix gcc version detecton on non-english locale
-
- Summary:
- ghc runs 'gcc -v' to check if we run under vanilla gcc
- or disaguised clang by checking for string
-
- "gcc version <something>"
-
- But this check does not always work as gcc has that string
- localized via gettext mechanism:
-
- (some gcc's locale strings)
- be.po-msgstr "версія gcc %s\n"
- da.po-msgstr "GCC version %s\n"
- de.po-msgstr "gcc-Version %s %s\n"
- el.po-msgstr "έκδοση gcc %s\n"
- ...
-
- To ping gcc to English locale we now override environment
- variable with 'LANGUAGE=en' value.
-
- Fixes Issue #8825
-
- Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
-
- Test Plan: validate
-
- Reviewers: austin
-
- Reviewed By: austin
-
- Subscribers: simonmar, ezyang, carter
-
- Differential Revision: https://phabricator.haskell.org/D185
-
- GHC Trac Issues: #8825
-
-diff --git a/compiler/main/SysTools.lhs b/compiler/main/SysTools.lhs
-index 72fa19b..67926f5 100644
---- a/compiler/main/SysTools.lhs
-+++ b/compiler/main/SysTools.lhs
-@@ -492,6 +492,51 @@ readCreateProcess proc = do
-
- return (ex, output)
-
-+readProcessEnvWithExitCode
-+ :: String -- ^ program path
-+ -> [String] -- ^ program args
-+ -> [(String, String)] -- ^ environment to override
-+ -> IO (ExitCode, String, String) -- ^ (exit_code, stdout, stderr)
-+readProcessEnvWithExitCode prog args env_update = do
-+ current_env <- getEnvironment
-+ let new_env = env_update ++ [ (k, v)
-+ | let overriden_keys = map fst env_update
-+ , (k, v) <- current_env
-+ , k `notElem` overriden_keys
-+ ]
-+ p = proc prog args
-+
-+ (_stdin, Just stdoh, Just stdeh, pid) <-
-+ createProcess p{ std_out = CreatePipe
-+ , std_err = CreatePipe
-+ , env = Just new_env
-+ }
-+
-+ outMVar <- newEmptyMVar
-+ errMVar <- newEmptyMVar
-+
-+ _ <- forkIO $ do
-+ stdo <- hGetContents stdoh
-+ _ <- evaluate (length stdo)
-+ putMVar outMVar stdo
-+
-+ _ <- forkIO $ do
-+ stde <- hGetContents stdeh
-+ _ <- evaluate (length stde)
-+ putMVar errMVar stde
-+
-+ out <- takeMVar outMVar
-+ hClose stdoh
-+ err <- takeMVar errMVar
-+ hClose stdeh
-+
-+ ex <- waitForProcess pid
-+
-+ return (ex, out, err)
-+
-+-- Don't let gcc localize version info string, #8825
-+en_locale_env :: [(String, String)]
-+en_locale_env = [("LANGUAGE", "en")]
-
- -- If the -B<dir> option is set, add <dir> to PATH. This works around
- -- a bug in gcc on Windows Vista where it can't find its auxiliary
-@@ -746,8 +791,9 @@ getLinkerInfo' dflags = do
- _ -> do
- -- In practice, we use the compiler as the linker here. Pass
- -- -Wl,--version to get linker version info.
-- (exitc, stdo, stde) <- readProcessWithExitCode pgm
-- ["-Wl,--version"] ""
-+ (exitc, stdo, stde) <- readProcessEnvWithExitCode pgm
-+ ["-Wl,--version"]
-+ en_locale_env
- -- Split the output by lines to make certain kinds
- -- of processing easier. In particular, 'clang' and 'gcc'
- -- have slightly different outputs for '-Wl,--version', but
-@@ -802,7 +848,8 @@ getCompilerInfo' dflags = do
-
- -- Process the executable call
- info <- catchIO (do
-- (exitc, stdo, stde) <- readProcessWithExitCode pgm ["-v"] ""
-+ (exitc, stdo, stde) <-
-+ readProcessEnvWithExitCode pgm ["-v"] en_locale_env
- -- Split the output by lines to make certain kinds
- -- of processing easier.
- parseCompilerInfo (lines stdo) (lines stde) exitc
-@@ -952,7 +999,8 @@ readElfSection _dflags section exe = do
- prog = "readelf"
- args = [Option "-p", Option section, FileOption "" exe]
- --
-- r <- readProcessWithExitCode prog (filter notNull (map showOpt args)) ""
-+ r <- readProcessEnvWithExitCode prog (filter notNull (map showOpt args))
-+ en_locale_env
- case r of
- (ExitSuccess, out, _err) -> return (doFilter (lines out))
- _ -> return Nothing
diff --git a/dev-lang/ghc/files/ghc-7.8.3-deRefStablePtr.patch b/dev-lang/ghc/files/ghc-7.8.3-deRefStablePtr.patch
deleted file mode 100644
index 8deec21..00000000
--- a/dev-lang/ghc/files/ghc-7.8.3-deRefStablePtr.patch
+++ /dev/null
@@ -1,38 +0,0 @@
-commit 104a66a461f4f89b8e5ad9c829923bb7ca8ceddb
-Author: Sergei Trofimovich <slyfox@gentoo.org>
-Date: Sat Aug 23 13:11:23 2014 +0300
-
- rts/Linker.c: declare 'deRefStablePtr' as an exported 'rts' symbol
-
- $ inplace/bin/ghc-stage2 -fforce-recomp -dcore-lint -dcmm-lint -dno-debug-output -no-user-package-db -rtsopts -optc-fno-builtin -fno-ghci-history \
- testsuite/tests/ffi/should_run/T4038.hs --interactive -v0 -ignore-dot-ghci +RTS -I0.1 -RTS
-
- *Main> main
- <interactive>: /tmp/ghc16668_0/ghc16668_5.o: unknown symbol `deRefStablePtr'
-
- The reference to 'deRefStablePtr' is generated by 'compiler/deSugar/DsForeign.lhs':
- the_cfun
- = case maybe_target of
- Nothing -> text "(StgClosure*)deRefStablePtr(the_stableptr)"
- Just hs_fn -> char '&' <> ppr hs_fn <> text "_closure"
-
- Patch fixes all broken tests using 'import wrapper':
- TEST="ffi013 ffi010 ffi011 ffi005 ffi020 ffi006 ffi019 fed001 T1679 T4038"
-
- Tests manifested as broken only in DYNAMIC_GHC_PROGRAMS=NO builds,
- where GHCi's custom linker is used instead of system's linker.
-
- Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
-
-diff --git a/rts/Linker.c b/rts/Linker.c
-index e97580d..b24be58 100644
---- a/rts/Linker.c
-+++ b/rts/Linker.c
-@@ -1092,6 +1092,7 @@ typedef struct _RtsSymbolVal {
- SymI_HasProto(__word_encodeFloat) \
- SymI_HasProto(stg_atomicallyzh) \
- SymI_HasProto(barf) \
-+ SymI_HasProto(deRefStablePtr) \
- SymI_HasProto(debugBelch) \
- SymI_HasProto(errorBelch) \
- SymI_HasProto(sysErrorBelch) \
diff --git a/dev-lang/ghc/files/ghc-7.8.3-ia64-prim.patch b/dev-lang/ghc/files/ghc-7.8.3-ia64-prim.patch
deleted file mode 100644
index 9026ecf..00000000
--- a/dev-lang/ghc/files/ghc-7.8.3-ia64-prim.patch
+++ /dev/null
@@ -1,69 +0,0 @@
-commit e2a8801b9779949010f30db6f6ef66f3c3a70776
-Author: Sergei Trofimovich <slyfox@gentoo.org>
-Date: Thu Sep 4 17:50:45 2014 +0300
-
- pprC: declare extern cmm primitives as functions, not data
-
- Summary:
- The commit fixes incorrect code generation of
- integer-gmp package on ia64 due to C prototype mismatch.
- Before patch prototype was
- StgWord poizh[];
- After patch it became
- StgFunPtr poizh();
-
- Long story:
-
- Consider the following simple example:
-
- {-# LANGUAGE MagicHash, GHCForeignImportPrim, UnliftedFFITypes #-}
- module M where
- import GHC.Prim -- Int#
- foreign import prim "poizh" poi# :: Int# -> Int#
-
- Before the patch Unregisterised build generated the
- following 'poizh' reference:
- EI_(poizh); /* StgWord poizh[]; */
- FN_(M_poizh_entry) {
- // ...
- JMP_((W_)&poizh);
- }
-
- After the patch it looks this way:
- EF_(poizh); /* StgFunPtr poizh(); */
- FN_(M_poizh_entry) {
- // ...
- JMP_((W_)&poizh);
- }
-
- On ia64 it leads to different relocation types being generated:
- incorrect one:
- addl r14 = @ltoffx(poizh#)
- ld8.mov r14 = [r14], poizh#
- correct one:
- addl r14 = @ltoff(@fptr(poizh#)), gp
- ld8 r14 = [r14]
-
- '@fptr(poizh#)' basically instructs assembler to creates
- another obect consisting of real address to 'poizh' instructions
- and module address. That '@fptr' object is used as a function "address".
- This object is different for every module referencing 'poizh' symbol.
-
- All indirect function calls expect '@fptr' object. That way
- call site can read real destination address and set destination
- module address in 'gp' register.
-
- Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
-
-diff --git a/compiler/cmm/CLabel.hs b/compiler/cmm/CLabel.hs
-index 02ad026..0f2c0ae 100644
---- a/compiler/cmm/CLabel.hs
-+++ b/compiler/cmm/CLabel.hs
-@@ -813,6 +813,7 @@ labelType (CmmLabel _ _ CmmClosure) = GcPtrLabel
- labelType (CmmLabel _ _ CmmCode) = CodeLabel
- labelType (CmmLabel _ _ CmmInfo) = DataLabel
- labelType (CmmLabel _ _ CmmEntry) = CodeLabel
-+labelType (CmmLabel _ _ CmmPrimCall) = CodeLabel
- labelType (CmmLabel _ _ CmmRetInfo) = DataLabel
- labelType (CmmLabel _ _ CmmRet) = CodeLabel
- labelType (RtsLabel (RtsSelectorInfoTable _ _)) = DataLabel
diff --git a/dev-lang/ghc/files/ghc-7.8.3-pic-asm.patch b/dev-lang/ghc/files/ghc-7.8.3-pic-asm.patch
deleted file mode 100644
index 10c41d5..00000000
--- a/dev-lang/ghc/files/ghc-7.8.3-pic-asm.patch
+++ /dev/null
@@ -1,107 +0,0 @@
-commit a93ab43ab5f40cadbedea2f6342b93c245e91434
-Author: Sergei Trofimovich <slyfox@gentoo.org>
-Date: Wed Aug 27 22:19:52 2014 +0300
-
- driver: pass '-fPIC' option to assembler as well
-
- Summary:
- Before the patch '-fPIC' was passed only to C compiler,
- but not to assembler itself.
-
- It led to runtime crash in GHC_DYNAMIC_PROGRAMS=YES mode
- on sparc32.
-
- Technical details are in 'Note [-fPIC for assembler]'.
-
- Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
-
- Test Plan: validate on sparc
-
- Reviewers: simonmar, austin, kgardas
-
- Reviewed By: austin
-
- Subscribers: simonmar, ezyang, carter
-
- Differential Revision: https://phabricator.haskell.org/D177
-
-diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs
-index 183f435..5a18e6e 100644
---- a/compiler/main/DriverPipeline.hs
-+++ b/compiler/main/DriverPipeline.hs
-@@ -1199,6 +1199,7 @@ runPhase (RealPhase (As with_cpp)) input_fn dflags
-
- as_prog <- whichAsProg
- let cmdline_include_paths = includePaths dflags
-+ let pic_c_flags = picCCOpts dflags
-
- next_phase <- maybeMergeStub
- output_fn <- phaseOutputFilename next_phase
-@@ -1212,6 +1213,9 @@ runPhase (RealPhase (As with_cpp)) input_fn dflags
- = liftIO $ as_prog dflags
- ([ SysTools.Option ("-I" ++ p) | p <- cmdline_include_paths ]
-
-+ -- See Note [-fPIC for assembler]
-+ ++ map SysTools.Option pic_c_flags
-+
- -- We only support SparcV9 and better because V8 lacks an atomic CAS
- -- instruction so we have to make sure that the assembler accepts the
- -- instruction set. Note that the user can still override this
-@@ -1253,6 +1257,8 @@ runPhase (RealPhase SplitAs) _input_fn dflags
- osuf = objectSuf dflags
- split_odir = base_o ++ "_" ++ osuf ++ "_split"
-
-+ let pic_c_flags = picCCOpts dflags
-+
- -- this also creates the hierarchy
- liftIO $ createDirectoryIfMissing True split_odir
-
-@@ -1286,6 +1292,9 @@ runPhase (RealPhase SplitAs) _input_fn dflags
- then [SysTools.Option "-mcpu=v9"]
- else []) ++
-
-+ -- See Note [-fPIC for assembler]
-+ map SysTools.Option pic_c_flags ++
-+
- [ SysTools.Option "-c"
- , SysTools.Option "-o"
- , SysTools.FileOption "" (split_obj n)
-@@ -2203,3 +2212,38 @@ haveRtsOptsFlags dflags =
- isJust (rtsOpts dflags) || case rtsOptsEnabled dflags of
- RtsOptsSafeOnly -> False
- _ -> True
-+
-+-- Note [-fPIC for assembler]
-+-- When compiling .c source file GHC's driver pipeline basically
-+-- does the following two things:
-+-- 1. ${CC} -S 'PIC_CFLAGS' source.c
-+-- 2. ${CC} -x assembler -c 'PIC_CFLAGS' source.S
-+--
-+-- Why do we need to pass 'PIC_CFLAGS' both to C compiler and assembler?
-+-- Because on some architectures (at least sparc32) assembler also choses
-+-- relocation type!
-+-- Consider the following C module:
-+--
-+-- /* pic-sample.c */
-+-- int v;
-+-- void set_v (int n) { v = n; }
-+-- int get_v (void) { return v; }
-+--
-+-- $ gcc -S -fPIC pic-sample.c
-+-- $ gcc -c pic-sample.s -o pic-sample.no-pic.o # incorrect binary
-+-- $ gcc -c -fPIC pic-sample.s -o pic-sample.pic.o # correct binary
-+--
-+-- $ objdump -r -d pic-sample.pic.o > pic-sample.pic.o.od
-+-- $ objdump -r -d pic-sample.no-pic.o > pic-sample.no-pic.o.od
-+-- $ diff -u pic-sample.pic.o.od pic-sample.no-pic.o.od
-+--
-+-- Most of architectures won't show any difference in this test, but on sparc32
-+-- the following assembly snippet:
-+--
-+-- sethi %hi(_GLOBAL_OFFSET_TABLE_-8), %l7
-+--
-+-- generates two kinds or relocations, only 'R_SPARC_PC22' is correct:
-+--
-+-- 3c: 2f 00 00 00 sethi %hi(0), %l7
-+-- - 3c: R_SPARC_PC22 _GLOBAL_OFFSET_TABLE_-0x8
-+-- + 3c: R_SPARC_HI22 _GLOBAL_OFFSET_TABLE_-0x8
diff --git a/dev-lang/ghc/files/ghc-7.8.3-unreg-lit.patch b/dev-lang/ghc/files/ghc-7.8.3-unreg-lit.patch
deleted file mode 100644
index 632696d..00000000
--- a/dev-lang/ghc/files/ghc-7.8.3-unreg-lit.patch
+++ /dev/null
@@ -1,84 +0,0 @@
-commit a6ea05e21e175407dc9e45f18c56c1d727fd0f26
-Author: Sergei Trofimovich <slyfox@gentoo.org>
-Date: Fri Aug 22 23:24:32 2014 +0300
-
- UNREG: fix emission of large Integer literals in C codegen
-
- Summary:
- On amd64/UNREG build there is many failing tests trying
- to deal with 'Integer' types.
-
- Looking at 'overflow1' test I've observed invalid C code generated by
- GHC.
-
- Cmm code
- CInt a = -1; (a == -1)
- yields 'False' with optimisations enabled via the following C code:
- StgWord64 a = (StgWord32)0xFFFFffffFFFFffffu; (a == 0xFFFFffffFFFFffffu)
-
- The patch fixes it by shrinking emitted literals to required sizes:
- StgWord64 a = (StgWord32)0xFFFFffffu; (a == 0xFFFFffffu)
-
- Thanks to Reid Barton for tracking down and fixing the issue.
-
- Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
-
- Test Plan: validate on UNREG build (amd64)
-
- Reviewers: simonmar, rwbarton, austin
-
- Subscribers: simonmar, ezyang, carter
-
- Differential Revision: https://phabricator.haskell.org/D173
-
-diff --git a/compiler/cmm/PprC.hs b/compiler/cmm/PprC.hs
-index 93a5d06..8605988 100644
---- a/compiler/cmm/PprC.hs
-+++ b/compiler/cmm/PprC.hs
-@@ -1221,8 +1221,9 @@ commafy xs = hsep $ punctuate comma xs
- pprHexVal :: Integer -> Width -> SDoc
- pprHexVal 0 _ = ptext (sLit "0x0")
- pprHexVal w rep
-- | w < 0 = parens (char '-' <> ptext (sLit "0x") <> go (-w) <> repsuffix rep)
-- | otherwise = ptext (sLit "0x") <> go w <> repsuffix rep
-+ | w < 0 = parens (char '-' <>
-+ ptext (sLit "0x") <> intToDoc (-w) <> repsuffix rep)
-+ | otherwise = ptext (sLit "0x") <> intToDoc w <> repsuffix rep
- where
- -- type suffix for literals:
- -- Integer literals are unsigned in Cmm/C. We explicitly cast to
-@@ -1237,10 +1238,33 @@ pprHexVal w rep
- else panic "pprHexVal: Can't find a 64-bit type"
- repsuffix _ = char 'U'
-
-+ intToDoc :: Integer -> SDoc
-+ intToDoc i = go (truncInt i)
-+
-+ -- We need to truncate value as Cmm backend does not drop
-+ -- redundant bits to ease handling of negative values.
-+ -- Thus the following Cmm code on 64-bit arch, like amd64:
-+ -- CInt v;
-+ -- v = {something};
-+ -- if (v == %lobits32(-1)) { ...
-+ -- leads to the following C code:
-+ -- StgWord64 v = (StgWord32)({something});
-+ -- if (v == 0xFFFFffffFFFFffffU) { ...
-+ -- Such code is incorrect as it promotes both operands to StgWord64
-+ -- and the whole condition is always false.
-+ truncInt :: Integer -> Integer
-+ truncInt i =
-+ case rep of
-+ W8 -> i `rem` (2^(8 :: Int))
-+ W16 -> i `rem` (2^(16 :: Int))
-+ W32 -> i `rem` (2^(32 :: Int))
-+ W64 -> i `rem` (2^(64 :: Int))
-+ _ -> panic ("pprHexVal/truncInt: C backend can't encode "
-+ ++ show rep ++ " literals")
-+
- go 0 = empty
- go w' = go q <> dig
- where
- (q,r) = w' `quotRem` 16
- dig | r < 10 = char (chr (fromInteger r + ord '0'))
- | otherwise = char (chr (fromInteger r - 10 + ord 'a'))
--
diff --git a/dev-lang/ghc/files/terminfo-0.3.2.5-tinfo.patch b/dev-lang/ghc/files/terminfo-0.3.2.5-tinfo.patch
deleted file mode 100644
index ca10da2..00000000
--- a/dev-lang/ghc/files/terminfo-0.3.2.5-tinfo.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-http://bugs.gentoo.org/454216
-
-Mon Jan 7 16:34:47 FET 2013 Judah Jacobson <judah.jacobson@gmail.com>
- * Search for terminfo in libtinfo; fixes GHC #7281.
-
- Patch from Paul Johnson.
-diff -rN -u old-terminfo/configure.ac new-terminfo/configure.ac
---- old-terminfo/configure.ac 2013-02-14 00:16:11.816111434 +0300
-+++ new-terminfo/configure.ac 2013-02-14 00:16:11.819111434 +0300
-@@ -39,10 +39,11 @@
- TERMINFO_INCLUDES="$CursesIncludes term.h"
- fi
-
--AC_CHECK_LIB(ncursesw, setupterm, HaveLibCurses=YES; LibCurses=ncursesw,
-- [AC_CHECK_LIB(ncurses, setupterm, HaveLibCurses=YES; LibCurses=ncurses,
-- [AC_CHECK_LIB(curses, setupterm, HaveLibCurses=YES; LibCurses=curses,
-- HaveLibCurses=NO; LibCurses=not-installed)])])
-+AC_CHECK_LIB(tinfo, setupterm, HaveLibCurses=YES; LibCurses=tinfo,
-+ [AC_CHECK_LIB(ncursesw, setupterm, HaveLibCurses=YES; LibCurses=ncursesw,
-+ [AC_CHECK_LIB(ncurses, setupterm, HaveLibCurses=YES; LibCurses=ncurses,
-+ [AC_CHECK_LIB(curses, setupterm, HaveLibCurses=YES; LibCurses=curses,
-+ HaveLibCurses=NO; LibCurses=not-installed)])])])
-
- if test "x$HaveLibCurses" = "xNO" ; then
- AC_MSG_FAILURE([curses library not found, so this package cannot be built])
diff --git a/dev-lang/ghc/ghc-7.10.2-r1.ebuild b/dev-lang/ghc/ghc-7.10.2-r1.ebuild
deleted file mode 100644
index 13af9a4..00000000
--- a/dev-lang/ghc/ghc-7.10.2-r1.ebuild
+++ /dev/null
@@ -1,662 +0,0 @@
-# Copyright 1999-2016 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Id$
-
-EAPI=5
-
-# to make make a crosscompiler use crossdev and symlink ghc tree into
-# cross overlay. result would look like 'cross-sparc-unknown-linux-gnu/ghc'
-#
-# 'CTARGET' definition and 'is_crosscompile' are taken from 'toolchain.eclass'
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} = ${CHOST} ]] ; then
- if [[ ${CATEGORY/cross-} != ${CATEGORY} ]] ; then
- export CTARGET=${CATEGORY/cross-}
- fi
-fi
-
-inherit autotools bash-completion-r1 eutils flag-o-matic ghc-package
-inherit multilib pax-utils toolchain-funcs versionator
-
-DESCRIPTION="The Glasgow Haskell Compiler"
-HOMEPAGE="http://www.haskell.org/ghc/"
-
-# we don't have any binaries yet
-arch_binaries=""
-
-# sorted!
-#arch_binaries="$arch_binaries alpha? ( http://code.haskell.org/~slyfox/ghc-alpha/ghc-bin-${PV}-alpha.tbz2 )"
-#arch_binaries="$arch_binaries arm? ( http://code.haskell.org/~slyfox/ghc-arm/ghc-bin-${PV}-arm.tbz2 )"
-arch_binaries="$arch_binaries amd64? ( http://code.haskell.org/~slyfox/ghc-amd64/ghc-bin-${PVR}-amd64-noncurses.tbz2 )"
-#arch_binaries="$arch_binaries ia64? ( http://code.haskell.org/~slyfox/ghc-ia64/ghc-bin-${PV}-ia64-fixed-fiw.tbz2 )"
-#arch_binaries="$arch_binaries ppc? ( http://code.haskell.org/~slyfox/ghc-ppc/ghc-bin-${PV}-ppc.tbz2 )"
-#arch_binaries="$arch_binaries ppc64? ( http://code.haskell.org/~slyfox/ghc-ppc64/ghc-bin-${PV}-ppc64.tbz2 )"
-#arch_binaries="$arch_binaries sparc? ( http://code.haskell.org/~slyfox/ghc-sparc/ghc-bin-${PV}-sparc.tbz2 )"
-arch_binaries="$arch_binaries x86? ( http://code.haskell.org/~slyfox/ghc-x86/ghc-bin-${PVR}-x86-noncurses.tbz2 )"
-
-# various ports:
-#arch_binaries="$arch_binaries x86-fbsd? ( http://code.haskell.org/~slyfox/ghc-x86-fbsd/ghc-bin-${PV}-x86-fbsd.tbz2 )"
-
-# 0 - yet
-yet_binary() {
- case "${ARCH}" in
- #alpha) return 0 ;;
- #arm)
- # ewarn "ARM binary is built on armv5tel-eabi toolchain. Use with caution."
- # return 0
- #;;
- amd64) return 0 ;;
- #ia64) return 0 ;;
- #ppc) return 0 ;;
- #ppc64) return 0 ;;
- #sparc) return 0 ;;
- x86) return 0 ;;
- *) return 1 ;;
- esac
-}
-
-GHC_PV=${PV}
-#GHC_PV=7.10.1.20150630 # uncomment only for -rc ebuilds
-GHC_P=${PN}-${GHC_PV} # using ${P} is almost never correct
-
-#SRC_URI="!binary? ( http://downloads.haskell.org/~ghc/${PV/_rc/-rc}/${GHC_P}-src.tar.bz2 )"
-# Upstream tarball was repackaged and inplace-updated. CDN cached old version for
-# many users
-SRC_URI="!binary? ( http://dev.gentoo.org/~slyfox/distfiles/${GHC_P}-src.tar.bz2 )"
-S="${WORKDIR}"/${GHC_P}
-
-[[ -n $arch_binaries ]] && SRC_URI+=" !ghcbootstrap? ( $arch_binaries )"
-
-BUMP_LIBRARIES=(
- # "hackage-name hackage-version"
- "binary 0.7.5.0"
- "hoopl 3.10.1.0"
- "transformers 0.4.3.0"
-)
-
-LICENSE="BSD"
-SLOT="0/${PV}"
-KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
-IUSE="doc ghcbootstrap ghcmakebinary +gmp"
-IUSE+=" binary"
-IUSE+=" elibc_glibc" # system stuff
-
-RDEPEND="
- >=dev-lang/perl-5.6.1
- >=dev-libs/gmp-5:=
- sys-libs/ncurses:=[unicode]
- !ghcmakebinary? ( virtual/libffi:= )
- !kernel_Darwin? ( >=sys-devel/gcc-2.95.3:* )
- kernel_linux? ( >=sys-devel/binutils-2.17:* )
- kernel_SunOS? ( >=sys-devel/binutils-2.17:* )
-"
-# gentoo binaries are built against ncurses-5
-RDEPEND+="
- binary? (
- || (
- sys-libs/ncurses:0/5
- sys-libs/ncurses:5/5
- )
- )
-"
-
-# force dependency on >=gmp-5, even if >=gmp-4.1 would be enough. this is due to
-# that we want the binaries to use the latest versioun available, and not to be
-# built against gmp-4
-
-# similar for glibc. we have bootstrapped binaries against glibc-2.17
-DEPEND="${RDEPEND}
- doc? ( app-text/docbook-xml-dtd:4.2
- app-text/docbook-xml-dtd:4.5
- app-text/docbook-xsl-stylesheets
- >=dev-libs/libxslt-1.1.2 )
- !ghcbootstrap? ( !prefix? ( elibc_glibc? ( >=sys-libs/glibc-2.17 ) ) )"
-
-PDEPEND="!ghcbootstrap? ( =app-admin/haskell-updater-1.2* )"
-
-REQUIRED_USE="?? ( ghcbootstrap binary )"
-
-# haskell libraries built with cabal in configure mode, #515354
-QA_CONFIGURE_OPTIONS+=" --with-compiler --with-gcc"
-
-is_crosscompile() {
- [[ ${CHOST} != ${CTARGET} ]]
-}
-
-append-ghc-cflags() {
- local persistent compile assemble link
- local flag ghcflag
-
- for flag in $*; do
- case ${flag} in
- persistent) persistent="yes";;
- compile) compile="yes";;
- assemble) assemble="yes";;
- link) link="yes";;
- *)
- [[ ${compile} ]] && ghcflag="-optc${flag}" CFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
- [[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
- [[ ${assemble} ]] && ghcflag="-opta${flag}" CFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
- [[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
- [[ ${link} ]] && ghcflag="-optl${flag}" LDFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
- [[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
- ;;
- esac
- done
-}
-
-# $1 - lib name (under libraries/)
-# $2 - lib version
-# example: bump_lib "transformers" "0.4.2.0"
-bump_lib() {
- local pn=$1 pv=$2
- local p=${pn}-${pv}
- local f
-
- einfo "Bumping ${pn} up to ${pv}"
-
- for f in ghc.mk GNUmakefile; do
- mv libraries/"${pn}"/$f "${WORKDIR}"/"${p}"/$f || die
- done
- mv libraries/"${pn}" "${WORKDIR}"/"${pn}".old || die
- mv "${WORKDIR}"/"${p}" libraries/"${pn}" || die
-}
-
-update_SRC_URI() {
- local p pn pv
- for p in "${BUMP_LIBRARIES[@]}"; do
- set -- $p
- pn=$1 pv=$2
-
- SRC_URI+=" mirror://hackage/package/${pn}/${pn}-${pv}.tar.gz"
- done
-}
-
-update_SRC_URI
-
-bump_libs() {
- local p pn pv
- for p in "${BUMP_LIBRARIES[@]}"; do
- set -- $p
- pn=$1 pv=$2
-
- bump_lib "${pn}" "${pv}"
- done
-}
-
-ghc_setup_cflags() {
- if is_crosscompile; then
- export CFLAGS=${GHC_CFLAGS-"-O2 -pipe"}
- export LDFLAGS=${GHC_LDFLAGS-"-Wl,-O1"}
- einfo "Crosscompiling mode:"
- einfo " CHOST: ${CHOST}"
- einfo " CTARGET: ${CTARGET}"
- einfo " CFLAGS: ${CFLAGS}"
- einfo " LDFLAGS: ${LDFLAGS}"
- return
- fi
- # We need to be very careful with the CFLAGS we ask ghc to pass through to
- # gcc. There are plenty of flags which will make gcc produce output that
- # breaks ghc in various ways. The main ones we want to pass through are
- # -mcpu / -march flags. These are important for arches like alpha & sparc.
- # We also use these CFLAGS for building the C parts of ghc, ie the rts.
- strip-flags
- strip-unsupported-flags
-
- # Cmm can't parse line numbers #482086
- replace-flags -ggdb[3-9] -ggdb2
-
- GHC_FLAGS=""
- GHC_PERSISTENT_FLAGS=""
- for flag in ${CFLAGS}; do
- case ${flag} in
-
- # Ignore extra optimisation (ghc passes -O to gcc anyway)
- # -O2 and above break on too many systems
- -O*) ;;
-
- # Arch and ABI flags are what we're really after
- -m*) append-ghc-cflags compile assemble ${flag};;
-
- # Sometimes it's handy to see backtrace of RTS
- # to get an idea what happens there
- -g*) append-ghc-cflags compile ${flag};;
-
- # Ignore all other flags, including all -f* flags
- esac
- done
-
- for flag in ${LDFLAGS}; do
- append-ghc-cflags link ${flag}
- done
-
- # hardened-gcc needs to be disabled, because the mangler doesn't accept
- # its output.
- gcc-specs-pie && append-ghc-cflags persistent compile link -nopie
- gcc-specs-ssp && append-ghc-cflags persistent compile -fno-stack-protector
-
- # prevent from failind building unregisterised ghc:
- # http://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg171602.html
- use ppc64 && append-ghc-cflags persistent compile -mminimal-toc
- # fix the similar issue as ppc64 TOC on ia64. ia64 has limited size of small data
- # currently ghc fails to build haddock
- # http://osdir.com/ml/gnu.binutils.bugs/2004-10/msg00050.html
- use ia64 && append-ghc-cflags persistent compile -G0
-}
-
-# substitutes string $1 to $2 in files $3 $4 ...
-relocate_path() {
- local from=$1
- local to=$2
- shift 2
- local file=
- for file in "$@"
- do
- sed -i -e "s|$from|$to|g" \
- "$file" || die "path relocation failed for '$file'"
- done
-}
-
-# changes hardcoded ghc paths and updates package index
-# $1 - new absolute root path
-relocate_ghc() {
- local to=$1
-
- # libdir for prebuilt binary and for current system may mismatch
- # It does for prefix installation for example: bug #476998
- local bin_ghc_prefix=${WORKDIR}/usr
- local bin_libpath=$(echo "${bin_ghc_prefix}"/lib*)
- local bin_libdir=${bin_libpath#${bin_ghc_prefix}/}
-
- # backup original script to use it later after relocation
- local gp_back="${T}/ghc-pkg-${GHC_PV}-orig"
- cp "${WORKDIR}/usr/bin/ghc-pkg-${GHC_PV}" "$gp_back" || die "unable to backup ghc-pkg wrapper"
-
- if [[ ${bin_libdir} != $(get_libdir) ]]; then
- einfo "Relocating '${bin_libdir}' to '$(get_libdir)' (bug #476998)"
- # moving the dir itself is not strictly needed
- # but then USE=binary would result in installing
- # in '${bin_libdir}'
- mv "${bin_ghc_prefix}/${bin_libdir}" "${bin_ghc_prefix}/$(get_libdir)" || die
-
- relocate_path "/usr/${bin_libdir}" "/usr/$(get_libdir)" \
- "${WORKDIR}/usr/bin/ghc-${GHC_PV}" \
- "${WORKDIR}/usr/bin/ghci-${GHC_PV}" \
- "${WORKDIR}/usr/bin/ghc-pkg-${GHC_PV}" \
- "${WORKDIR}/usr/bin/hsc2hs" \
- "${WORKDIR}/usr/bin/runghc-${GHC_PV}" \
- "$gp_back" \
- "${WORKDIR}/usr/$(get_libdir)/${GHC_P}/package.conf.d/"*
- fi
-
- # Relocate from /usr to ${EPREFIX}/usr
- relocate_path "/usr" "${to}/usr" \
- "${WORKDIR}/usr/bin/ghc-${GHC_PV}" \
- "${WORKDIR}/usr/bin/ghci-${GHC_PV}" \
- "${WORKDIR}/usr/bin/ghc-pkg-${GHC_PV}" \
- "${WORKDIR}/usr/bin/hsc2hs" \
- "${WORKDIR}/usr/bin/runghc-${GHC_PV}" \
- "${WORKDIR}/usr/$(get_libdir)/${GHC_P}/package.conf.d/"*
-
- # this one we will use to regenerate cache
- # so it should point to current tree location
- relocate_path "/usr" "${WORKDIR}/usr" "$gp_back"
-
- if use prefix; then
- # and insert LD_LIBRARY_PATH entry to EPREFIX dir tree
- # TODO: add the same for darwin's CHOST and it's DYLD_
- local new_ldpath='LD_LIBRARY_PATH="'${EPREFIX}/$(get_libdir):${EPREFIX}/usr/$(get_libdir)'${LD_LIBRARY_PATH:+:}${LD_LIBRARY_PATH}"\nexport LD_LIBRARY_PATH'
- sed -i -e '2i'"$new_ldpath" \
- "${WORKDIR}/usr/bin/ghc-${GHC_PV}" \
- "${WORKDIR}/usr/bin/ghci-${GHC_PV}" \
- "${WORKDIR}/usr/bin/ghc-pkg-${GHC_PV}" \
- "${WORKDIR}/usr/bin/hsc2hs" \
- "${WORKDIR}/usr/bin/runghc-${GHC_PV}" \
- "$gp_back" \
- "${WORKDIR}/usr/bin/hsc2hs" \
- || die "Adding LD_LIBRARY_PATH for wrappers failed"
- fi
-
- # regenerate the binary package cache
- "$gp_back" recache || die "failed to update cache after relocation"
- rm "$gp_back"
-}
-
-pkg_setup() {
- # quiet portage about prebuilt binaries
- use binary && QA_PREBUILT="*"
-
- [[ ${MERGE_TYPE} == binary ]] && return
-
- if use ghcbootstrap; then
- ewarn "You requested ghc bootstrapping, this is usually only used"
- ewarn "by Gentoo developers to make binary .tbz2 packages."
-
- [[ -z $(type -P ghc) ]] && \
- die "Could not find a ghc to bootstrap with."
- else
- if ! yet_binary; then
- eerror "Please try emerging with USE=ghcbootstrap and report build"
- eerror "sucess or failure to the haskell team (haskell@gentoo.org)"
- die "No binary available for '${ARCH}' arch yet, USE=ghcbootstrap"
- fi
- fi
-}
-
-src_unpack() {
- # Create the ${S} dir if we're using the binary version
- use binary && mkdir "${S}"
-
- # the Solaris and Darwin binaries from ghc (maeder) need to be
- # unpacked separately, so prevent them from being unpacked
- local ONLYA=${A}
- case ${CHOST} in
- *-darwin* | *-solaris*) ONLYA=${GHC_P}-src.tar.bz2 ;;
- esac
- unpack ${ONLYA}
-
- if [[ -d "${S}"/libraries/dph ]]; then
- # Sometimes dph libs get accidentally shipped with ghc
- # but they are not installed unless user requests it.
- # We never install them.
- elog "Removing 'libraries/dph'"
- rm -rf "${S}"/libraries/dph
- fi
-}
-
-src_prepare() {
- ghc_setup_cflags
-
- if ! use ghcbootstrap && [[ ${CHOST} != *-darwin* && ${CHOST} != *-solaris* ]]; then
- # Modify the wrapper script from the binary tarball to use GHC_PERSISTENT_FLAGS.
- # See bug #313635.
- sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_PERSISTENT_FLAGS}|" \
- "${WORKDIR}/usr/bin/ghc-${GHC_PV}"
-
- # allow hardened users use vanilla binary to bootstrap ghc
- # ghci uses mmap with rwx protection at it implements dynamic
- # linking on it's own (bug #299709)
- pax-mark -m "${WORKDIR}/usr/$(get_libdir)/${GHC_P}/bin/ghc"
- fi
-
- if use binary; then
- if use prefix; then
- relocate_ghc "${EPREFIX}"
- fi
-
- # Move unpacked files to the expected place
- mv "${WORKDIR}/usr" "${S}"
- else
- if ! use ghcbootstrap; then
- case ${CHOST} in
- *-darwin* | *-solaris*)
- # UPDATE ME for ghc-7
- mkdir "${WORKDIR}"/ghc-bin-installer || die
- pushd "${WORKDIR}"/ghc-bin-installer > /dev/null || die
- use sparc-solaris && unpack ghc-6.10.4-sparc-sun-solaris2.tar.bz2
- use x86-solaris && unpack ghc-7.0.3-i386-unknown-solaris2.tar.bz2
- use x86-macos && unpack ghc-7.4.1-i386-apple-darwin.tar.bz2
- use x64-macos && unpack ghc-7.4.1-x86_64-apple-darwin.tar.bz2
- popd > /dev/null
-
- pushd "${WORKDIR}"/ghc-bin-installer/ghc-[67].?*.? > /dev/null || die
- # fix the binaries so they run, on Solaris we need an
- # LD_LIBRARY_PATH which has our prefix libdirs, on
- # Darwin we need to replace the frameworks with our libs
- # from the prefix fix before installation, because some
- # of the tools are actually used during configure/make
- if [[ ${CHOST} == *-solaris* ]] ; then
- export LD_LIBRARY_PATH="${EPREFIX}/$(get_libdir):${EPREFIX}/usr/$(get_libdir):${LD_LIBRARY_PATH}"
- elif [[ ${CHOST} == *-darwin* ]] ; then
- local readline_framework=GNUreadline.framework/GNUreadline
- local gmp_framework=/opt/local/lib/libgmp.10.dylib
- local ncurses_file=/opt/local/lib/libncurses.5.dylib
- for binary in $(scanmacho -BRE MH_EXECUTE -F '%F' .) ; do
- install_name_tool -change \
- ${readline_framework} \
- "${EPREFIX}"/lib/libreadline.dylib \
- ${binary} || die
- install_name_tool -change \
- ${gmp_framework} \
- "${EPREFIX}"/usr/lib/libgmp.dylib \
- ${binary} || die
- install_name_tool -change \
- ${ncurses_file} \
- "${EPREFIX}"/usr/lib/libncurses.dylib \
- ${binary} || die
- done
- # we don't do frameworks!
- sed -i \
- -e 's/\(frameworks = \)\["GMP"\]/\1[]/g' \
- -e 's/\(extraLibraries = \)\["m"\]/\1["m","gmp"]/g' \
- rts/package.conf.in || die
- fi
-
- # it is autoconf, but we really don't want to give it too
- # much arguments, in fact we do the make in-place anyway
- ./configure --prefix="${WORKDIR}"/usr || die
- make install || die
- popd > /dev/null
- ;;
- *)
- relocate_ghc "${WORKDIR}"
- ;;
- esac
- fi
-
- sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_PERSISTENT_FLAGS}|" \
- "${S}/ghc/ghc.wrapper"
-
- cd "${S}" # otherwise epatch will break
-
- epatch "${FILESDIR}"/${PN}-7.0.4-CHOST-prefix.patch
-
- epatch "${FILESDIR}"/${PN}-7.8.2-cgen-constify.patch
- epatch "${FILESDIR}"/${PN}-7.8.3-prim-lm.patch
- epatch "${FILESDIR}"/${PN}-7.10.1-rc3-ghc-7.10-bootstrap.patch
- epatch "${FILESDIR}"/${PN}-7.10.1-T10590-dequeue.patch
- # Since ${S}/packages does not include base, etc. add them to gen_contents_index
- sed -e 's@\(for REPO in .*\)@\1 base integer-gmp integer-gmp2 integer-simple template-haskell@' \
- -i libraries/gen_contents_index || die
-
- if use prefix; then
- # Make configure find docbook-xsl-stylesheets from Prefix
- sed -e '/^FP_DIR_DOCBOOK_XSL/s:\[.*\]:['"${EPREFIX}"'/usr/share/sgml/docbook/xsl-stylesheets/]:' \
- -i utils/haddock/doc/configure.ac || die
- fi
-
- bump_libs
-
- # as we have changed the build system
- eautoreconf
- fi
-}
-
-src_configure() {
- if ! use binary; then
- # initialize build.mk
- echo '# Gentoo changes' > mk/build.mk
-
- # Put docs into the right place, ie /usr/share/doc/ghc-${GHC_PV}
- echo "docdir = ${EPREFIX}/usr/share/doc/${P}" >> mk/build.mk
- echo "htmldir = ${EPREFIX}/usr/share/doc/${P}" >> mk/build.mk
-
- # We also need to use the GHC_FLAGS flags when building ghc itself
- echo "SRC_HC_OPTS+=${HCFLAGS} ${GHC_FLAGS}" >> mk/build.mk
- echo "SRC_CC_OPTS+=${CFLAGS}" >> mk/build.mk
- echo "SRC_LD_OPTS+=${LDFLAGS}" >> mk/build.mk
-
- # We can't depend on haddock except when bootstrapping when we
- # must build docs and include them into the binary .tbz2 package
- # app-text/dblatex is not in portage, can not build PDF or PS
- echo "BUILD_DOCBOOK_PDF = NO" >> mk/build.mk
- echo "BUILD_DOCBOOK_PS = NO" >> mk/build.mk
- if use doc; then
- echo "BUILD_DOCBOOK_HTML = YES" >> mk/build.mk
- else
- echo "BUILD_DOCBOOK_HTML = NO" >> mk/build.mk
- fi
-
- # this controls presence on 'xhtml' and 'haddock' in final install
- echo "HADDOCK_DOCS = YES" >> mk/build.mk
-
- # allows overriding build flavours for libraries:
- # v - vanilla (static libs)
- # p - profiled
- # dyn - shared libraries
- # example: GHC_LIBRARY_WAYS="v dyn"
- if [[ -n ${GHC_LIBRARY_WAYS} ]]; then
- echo "GhcLibWays=${GHC_LIBRARY_WAYS}" >> mk/build.mk
- fi
-
- # Get ghc from the unpacked binary .tbz2
- # except when bootstrapping we just pick ghc up off the path
- if ! use ghcbootstrap; then
- export PATH="${WORKDIR}/usr/bin:${PATH}"
- fi
-
- if use gmp; then
- echo "INTEGER_LIBRARY=integer-gmp2" >> mk/build.mk
- else
- echo "INTEGER_LIBRARY=integer-simple" >> mk/build.mk
- fi
-
- # don't strip anything. Very useful when stage2 SIGSEGVs on you
- echo "STRIP_CMD = :" >> mk/build.mk
-
- local econf_args=()
-
- # GHC embeds 'gcc' it was built by and uses it later.
- # Don't allow things like ccache or versioned binary slip.
- # We use stable thing across gcc upgrades.
- is_crosscompile || econf_args+=(--with-gcc=${CHOST}-gcc)
-
- if use ghcmakebinary; then
- # When building booting libary we are trying to
- # bundle or restrict most of external depends
- # with unstable ABI:
- # - embed libffi (default GHC behaviour)
- # - disable ncurses support for ghci (via haskeline)
- # https://bugs.gentoo.org/557478
- # - disable ncurses support for ghc-pkg
- echo "libraries/haskeline_CONFIGURE_OPTS += --flag=-terminfo" >> mk/build.mk
- echo "utils/ghc-pkg_HC_OPTS += -DBOOTSTRAPPING" >> mk/build.mk
- else
- econf_args+=(--with-system-libffi)
- econf_args+=(--with-ffi-includes=$(pkg-config libffi --cflags-only-I | sed -e 's@^-I@@'))
- fi
-
- elog "Final mk/build.mk:"
- cat mk/build.mk || die
-
- econf ${econf_args[@]} --enable-bootstrap-with-devel-snapshot
-
- if [[ ${PV} == *9999* ]]; then
- GHC_PV="$(grep 'S\[\"PACKAGE_VERSION\"\]' config.status | sed -e 's@^.*=\"\(.*\)\"@\1@')"
- GHC_P=${PN}-${GHC_PV}
- fi
- GHC_TPF="$(grep 'S\[\"TargetPlatformFull\"\]' config.status | sed -e 's@^.*=\"\(.*\)\"@\1@')"
- fi # ! use binary
-}
-
-src_compile() {
- if ! use binary; then
- # 1. build compiler binary first
- emake ghc/stage2/build/tmp/ghc-stage2
- # 2. pax-mark (bug #516430)
- pax-mark -m ghc/stage2/build/tmp/ghc-stage2
- # 3. and then all the rest
- emake all
- fi # ! use binary
-}
-
-src_install() {
- if use binary; then
- use prefix && mkdir -p "${ED}"
- mv "${S}/usr" "${ED}"
- else
-
- emake -j1 install DESTDIR="${D}"
- dodoc "distrib/README" "ANNOUNCE" "LICENSE" "VERSION"
-
- # rename ghc-shipped files to avoid collision
- # of external packages. Motivating example:
- # user had installed:
- # dev-lang/ghc-7.8.4-r0 (with transformers-0.3.0.0)
- # dev-haskell/transformers-0.4.2.0
- # then user tried to update to
- # dev-lang/ghc-7.8.4-r1 (with transformers-0.4.2.0)
- # this will lead to single .conf file collision.
- local shipped_conf renamed_conf
- local package_confdir="${ED}/usr/$(get_libdir)/${GHC_P}/package.conf.d"
- for shipped_conf in "${package_confdir}"/*.conf; do
- # rename 'pkg-ver-id.conf' to 'pkg-ver-id-gentoo-${PF}.conf'
- renamed_conf=${shipped_conf%.conf}-gentoo-${PF}.conf
- mv "${shipped_conf}" "${renamed_conf}" || die
- done
-
- # remove link, but leave 'haddock-${GHC_P}'
- rm -f "${ED}"/usr/bin/haddock
-
- if [[ ! -f "${S}/VERSION" ]]; then
- echo "${GHC_PV}" > "${S}/VERSION" \
- || die "Could not create file ${S}/VERSION"
- fi
- newbashcomp "${FILESDIR}"/ghc-bash-completion ghc-pkg
- newbashcomp utils/completion/ghc.bash ghc
- fi
-
- # path to the package.cache
- local package_confdir="${ED}/usr/$(get_libdir)/${GHC_P}/package.conf.d"
- PKGCACHE="${package_confdir}"/package.cache
- # copy the package.conf.d, including timestamp, save it so we can help
- # users that have a broken package.conf.d
- cp -pR "${package_confdir}"{,.initial} || die "failed to backup intial package.conf.d"
-
- # copy the package.conf, including timestamp, save it so we later can put it
- # back before uninstalling, or when upgrading.
- cp -p "${PKGCACHE}"{,.shipped} \
- || die "failed to copy package.conf.d/package.cache"
-}
-
-pkg_preinst() {
- # have we got an earlier version of ghc installed?
- if has_version "<${CATEGORY}/${PF}"; then
- haskell_updater_warn="1"
- fi
-}
-
-pkg_postinst() {
- ghc-reregister
-
- # path to the package.cache
- PKGCACHE="${EROOT}/usr/$(get_libdir)/${GHC_P}/package.conf.d/package.cache"
-
- # give the cache a new timestamp, it must be as recent as
- # the package.conf.d directory.
- touch "${PKGCACHE}"
-
- if [[ "${haskell_updater_warn}" == "1" ]]; then
- ewarn
- ewarn "\e[1;31m************************************************************************\e[0m"
- ewarn
- ewarn "You have just upgraded from an older version of GHC."
- ewarn "You may have to run"
- ewarn " 'haskell-updater'"
- ewarn "to rebuild all ghc-based Haskell libraries."
- ewarn
- ewarn "\e[1;31m************************************************************************\e[0m"
- ewarn
- fi
-}
-
-pkg_prerm() {
- PKGCACHE="${EROOT}/usr/$(get_libdir)/${GHC_P}/package.conf.d/package.cache"
- rm -rf "${PKGCACHE}"
-
- cp -p "${PKGCACHE}"{.shipped,}
-}
-
-pkg_postrm() {
- ghc-package_pkg_postrm
-}
diff --git a/dev-lang/ghc/ghc-7.10.2.ebuild b/dev-lang/ghc/ghc-7.10.2.ebuild
deleted file mode 100644
index 7b04d83..00000000
--- a/dev-lang/ghc/ghc-7.10.2.ebuild
+++ /dev/null
@@ -1,652 +0,0 @@
-# Copyright 1999-2016 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Id$
-
-EAPI=5
-
-# to make make a crosscompiler use crossdev and symlink ghc tree into
-# cross overlay. result would look like 'cross-sparc-unknown-linux-gnu/ghc'
-#
-# 'CTARGET' definition and 'is_crosscompile' are taken from 'toolchain.eclass'
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} = ${CHOST} ]] ; then
- if [[ ${CATEGORY/cross-} != ${CATEGORY} ]] ; then
- export CTARGET=${CATEGORY/cross-}
- fi
-fi
-
-inherit autotools bash-completion-r1 eutils flag-o-matic ghc-package
-inherit multilib pax-utils toolchain-funcs versionator
-
-DESCRIPTION="The Glasgow Haskell Compiler"
-HOMEPAGE="http://www.haskell.org/ghc/"
-
-# we don't have any binaries yet
-arch_binaries=""
-
-# sorted!
-#arch_binaries="$arch_binaries alpha? ( http://code.haskell.org/~slyfox/ghc-alpha/ghc-bin-${PV}-alpha.tbz2 )"
-#arch_binaries="$arch_binaries arm? ( http://code.haskell.org/~slyfox/ghc-arm/ghc-bin-${PV}-arm.tbz2 )"
-arch_binaries="$arch_binaries amd64? ( http://code.haskell.org/~slyfox/ghc-amd64/ghc-bin-${PV}-amd64.tbz2 )"
-#arch_binaries="$arch_binaries ia64? ( http://code.haskell.org/~slyfox/ghc-ia64/ghc-bin-${PV}-ia64-fixed-fiw.tbz2 )"
-#arch_binaries="$arch_binaries ppc? ( http://code.haskell.org/~slyfox/ghc-ppc/ghc-bin-${PV}-ppc.tbz2 )"
-#arch_binaries="$arch_binaries ppc64? ( http://code.haskell.org/~slyfox/ghc-ppc64/ghc-bin-${PV}-ppc64.tbz2 )"
-#arch_binaries="$arch_binaries sparc? ( http://code.haskell.org/~slyfox/ghc-sparc/ghc-bin-${PV}-sparc.tbz2 )"
-arch_binaries="$arch_binaries x86? ( http://code.haskell.org/~slyfox/ghc-x86/ghc-bin-${PV}-x86.tbz2 )"
-
-# various ports:
-#arch_binaries="$arch_binaries x86-fbsd? ( http://code.haskell.org/~slyfox/ghc-x86-fbsd/ghc-bin-${PV}-x86-fbsd.tbz2 )"
-
-# 0 - yet
-yet_binary() {
- case "${ARCH}" in
- #alpha) return 0 ;;
- #arm)
- # ewarn "ARM binary is built on armv5tel-eabi toolchain. Use with caution."
- # return 0
- #;;
- amd64) return 0 ;;
- #ia64) return 0 ;;
- #ppc) return 0 ;;
- #ppc64) return 0 ;;
- #sparc) return 0 ;;
- x86) return 0 ;;
- *) return 1 ;;
- esac
-}
-
-GHC_PV=${PV}
-#GHC_PV=7.10.1.20150630 # uncomment only for -rc ebuilds
-GHC_P=${PN}-${GHC_PV} # using ${P} is almost never correct
-
-#SRC_URI="!binary? ( http://downloads.haskell.org/~ghc/${PV/_rc/-rc}/${GHC_P}-src.tar.bz2 )"
-# Upstream tarball was repackaged and inplace-updated. CDN cached old version for
-# many users
-SRC_URI="!binary? ( https://dev.gentoo.org/~slyfox/distfiles/${GHC_P}-src.tar.bz2 )"
-S="${WORKDIR}"/${GHC_P}
-
-[[ -n $arch_binaries ]] && SRC_URI+=" !ghcbootstrap? ( $arch_binaries )"
-
-BUMP_LIBRARIES=(
- # "hackage-name hackage-version"
- "binary 0.7.5.0"
- "hoopl 3.10.1.0"
- "transformers 0.4.3.0"
-)
-
-LICENSE="BSD"
-SLOT="0/${PV}"
-KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
-IUSE="doc ghcbootstrap ghcmakebinary +gmp"
-IUSE+=" binary"
-IUSE+=" elibc_glibc" # system stuff
-
-RDEPEND="
- >=dev-lang/perl-5.6.1
- >=dev-libs/gmp-5:=
- sys-libs/ncurses:=[unicode]
- !ghcmakebinary? ( virtual/libffi:= )
- !kernel_Darwin? ( >=sys-devel/gcc-2.95.3:* )
- kernel_linux? ( >=sys-devel/binutils-2.17:* )
- kernel_SunOS? ( >=sys-devel/binutils-2.17:* )
-"
-# gentoo binaries are built against ncurses-5
-RDEPEND+="
- binary? (
- || (
- sys-libs/ncurses:0/5
- sys-libs/ncurses:5/5
- )
- )
-"
-
-# force dependency on >=gmp-5, even if >=gmp-4.1 would be enough. this is due to
-# that we want the binaries to use the latest versioun available, and not to be
-# built against gmp-4
-
-# similar for glibc. we have bootstrapped binaries against glibc-2.17
-DEPEND="${RDEPEND}
- doc? ( app-text/docbook-xml-dtd:4.2
- app-text/docbook-xml-dtd:4.5
- app-text/docbook-xsl-stylesheets
- >=dev-libs/libxslt-1.1.2 )
- !ghcbootstrap? ( !prefix? ( elibc_glibc? ( >=sys-libs/glibc-2.17 ) ) )"
-
-PDEPEND="!ghcbootstrap? ( =app-admin/haskell-updater-1.2* )"
-
-REQUIRED_USE="?? ( ghcbootstrap binary )"
-
-# haskell libraries built with cabal in configure mode, #515354
-QA_CONFIGURE_OPTIONS+=" --with-compiler --with-gcc"
-
-is_crosscompile() {
- [[ ${CHOST} != ${CTARGET} ]]
-}
-
-append-ghc-cflags() {
- local persistent compile assemble link
- local flag ghcflag
-
- for flag in $*; do
- case ${flag} in
- persistent) persistent="yes";;
- compile) compile="yes";;
- assemble) assemble="yes";;
- link) link="yes";;
- *)
- [[ ${compile} ]] && ghcflag="-optc${flag}" CFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
- [[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
- [[ ${assemble} ]] && ghcflag="-opta${flag}" CFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
- [[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
- [[ ${link} ]] && ghcflag="-optl${flag}" LDFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
- [[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
- ;;
- esac
- done
-}
-
-# $1 - lib name (under libraries/)
-# $2 - lib version
-# example: bump_lib "transformers" "0.4.2.0"
-bump_lib() {
- local pn=$1 pv=$2
- local p=${pn}-${pv}
- local f
-
- einfo "Bumping ${pn} up to ${pv}"
-
- for f in ghc.mk GNUmakefile; do
- mv libraries/"${pn}"/$f "${WORKDIR}"/"${p}"/$f || die
- done
- mv libraries/"${pn}" "${WORKDIR}"/"${pn}".old || die
- mv "${WORKDIR}"/"${p}" libraries/"${pn}" || die
-}
-
-update_SRC_URI() {
- local p pn pv
- for p in "${BUMP_LIBRARIES[@]}"; do
- set -- $p
- pn=$1 pv=$2
-
- SRC_URI+=" mirror://hackage/package/${pn}/${pn}-${pv}.tar.gz"
- done
-}
-
-update_SRC_URI
-
-bump_libs() {
- local p pn pv
- for p in "${BUMP_LIBRARIES[@]}"; do
- set -- $p
- pn=$1 pv=$2
-
- bump_lib "${pn}" "${pv}"
- done
-}
-
-ghc_setup_cflags() {
- if is_crosscompile; then
- export CFLAGS=${GHC_CFLAGS-"-O2 -pipe"}
- export LDFLAGS=${GHC_LDFLAGS-"-Wl,-O1"}
- einfo "Crosscompiling mode:"
- einfo " CHOST: ${CHOST}"
- einfo " CTARGET: ${CTARGET}"
- einfo " CFLAGS: ${CFLAGS}"
- einfo " LDFLAGS: ${LDFLAGS}"
- return
- fi
- # We need to be very careful with the CFLAGS we ask ghc to pass through to
- # gcc. There are plenty of flags which will make gcc produce output that
- # breaks ghc in various ways. The main ones we want to pass through are
- # -mcpu / -march flags. These are important for arches like alpha & sparc.
- # We also use these CFLAGS for building the C parts of ghc, ie the rts.
- strip-flags
- strip-unsupported-flags
-
- # Cmm can't parse line numbers #482086
- replace-flags -ggdb[3-9] -ggdb2
-
- GHC_FLAGS=""
- GHC_PERSISTENT_FLAGS=""
- for flag in ${CFLAGS}; do
- case ${flag} in
-
- # Ignore extra optimisation (ghc passes -O to gcc anyway)
- # -O2 and above break on too many systems
- -O*) ;;
-
- # Arch and ABI flags are what we're really after
- -m*) append-ghc-cflags compile assemble ${flag};;
-
- # Sometimes it's handy to see backtrace of RTS
- # to get an idea what happens there
- -g*) append-ghc-cflags compile ${flag};;
-
- # Ignore all other flags, including all -f* flags
- esac
- done
-
- for flag in ${LDFLAGS}; do
- append-ghc-cflags link ${flag}
- done
-
- # hardened-gcc needs to be disabled, because the mangler doesn't accept
- # its output.
- gcc-specs-pie && append-ghc-cflags persistent compile link -nopie
- gcc-specs-ssp && append-ghc-cflags persistent compile -fno-stack-protector
-
- # prevent from failind building unregisterised ghc:
- # http://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg171602.html
- use ppc64 && append-ghc-cflags persistent compile -mminimal-toc
- # fix the similar issue as ppc64 TOC on ia64. ia64 has limited size of small data
- # currently ghc fails to build haddock
- # http://osdir.com/ml/gnu.binutils.bugs/2004-10/msg00050.html
- use ia64 && append-ghc-cflags persistent compile -G0
-}
-
-# substitutes string $1 to $2 in files $3 $4 ...
-relocate_path() {
- local from=$1
- local to=$2
- shift 2
- local file=
- for file in "$@"
- do
- sed -i -e "s|$from|$to|g" \
- "$file" || die "path relocation failed for '$file'"
- done
-}
-
-# changes hardcoded ghc paths and updates package index
-# $1 - new absolute root path
-relocate_ghc() {
- local to=$1
-
- # libdir for prebuilt binary and for current system may mismatch
- # It does for prefix installation for example: bug #476998
- local bin_ghc_prefix=${WORKDIR}/usr
- local bin_libpath=$(echo "${bin_ghc_prefix}"/lib*)
- local bin_libdir=${bin_libpath#${bin_ghc_prefix}/}
-
- # backup original script to use it later after relocation
- local gp_back="${T}/ghc-pkg-${GHC_PV}-orig"
- cp "${WORKDIR}/usr/bin/ghc-pkg-${GHC_PV}" "$gp_back" || die "unable to backup ghc-pkg wrapper"
-
- if [[ ${bin_libdir} != $(get_libdir) ]]; then
- einfo "Relocating '${bin_libdir}' to '$(get_libdir)' (bug #476998)"
- # moving the dir itself is not strictly needed
- # but then USE=binary would result in installing
- # in '${bin_libdir}'
- mv "${bin_ghc_prefix}/${bin_libdir}" "${bin_ghc_prefix}/$(get_libdir)" || die
-
- relocate_path "/usr/${bin_libdir}" "/usr/$(get_libdir)" \
- "${WORKDIR}/usr/bin/ghc-${GHC_PV}" \
- "${WORKDIR}/usr/bin/ghci-${GHC_PV}" \
- "${WORKDIR}/usr/bin/ghc-pkg-${GHC_PV}" \
- "${WORKDIR}/usr/bin/hsc2hs" \
- "${WORKDIR}/usr/bin/runghc-${GHC_PV}" \
- "$gp_back" \
- "${WORKDIR}/usr/$(get_libdir)/${GHC_P}/package.conf.d/"*
- fi
-
- # Relocate from /usr to ${EPREFIX}/usr
- relocate_path "/usr" "${to}/usr" \
- "${WORKDIR}/usr/bin/ghc-${GHC_PV}" \
- "${WORKDIR}/usr/bin/ghci-${GHC_PV}" \
- "${WORKDIR}/usr/bin/ghc-pkg-${GHC_PV}" \
- "${WORKDIR}/usr/bin/hsc2hs" \
- "${WORKDIR}/usr/bin/runghc-${GHC_PV}" \
- "${WORKDIR}/usr/$(get_libdir)/${GHC_P}/package.conf.d/"*
-
- # this one we will use to regenerate cache
- # so it should point to current tree location
- relocate_path "/usr" "${WORKDIR}/usr" "$gp_back"
-
- if use prefix; then
- # and insert LD_LIBRARY_PATH entry to EPREFIX dir tree
- # TODO: add the same for darwin's CHOST and it's DYLD_
- local new_ldpath='LD_LIBRARY_PATH="'${EPREFIX}/$(get_libdir):${EPREFIX}/usr/$(get_libdir)'${LD_LIBRARY_PATH:+:}${LD_LIBRARY_PATH}"\nexport LD_LIBRARY_PATH'
- sed -i -e '2i'"$new_ldpath" \
- "${WORKDIR}/usr/bin/ghc-${GHC_PV}" \
- "${WORKDIR}/usr/bin/ghci-${GHC_PV}" \
- "${WORKDIR}/usr/bin/ghc-pkg-${GHC_PV}" \
- "${WORKDIR}/usr/bin/hsc2hs" \
- "${WORKDIR}/usr/bin/runghc-${GHC_PV}" \
- "$gp_back" \
- "${WORKDIR}/usr/bin/hsc2hs" \
- || die "Adding LD_LIBRARY_PATH for wrappers failed"
- fi
-
- # regenerate the binary package cache
- "$gp_back" recache || die "failed to update cache after relocation"
- rm "$gp_back"
-}
-
-pkg_setup() {
- # quiet portage about prebuilt binaries
- use binary && QA_PREBUILT="*"
-
- [[ ${MERGE_TYPE} == binary ]] && return
-
- if use ghcbootstrap; then
- ewarn "You requested ghc bootstrapping, this is usually only used"
- ewarn "by Gentoo developers to make binary .tbz2 packages."
-
- [[ -z $(type -P ghc) ]] && \
- die "Could not find a ghc to bootstrap with."
- else
- if ! yet_binary; then
- eerror "Please try emerging with USE=ghcbootstrap and report build"
- eerror "sucess or failure to the haskell team (haskell@gentoo.org)"
- die "No binary available for '${ARCH}' arch yet, USE=ghcbootstrap"
- fi
- fi
-}
-
-src_unpack() {
- # Create the ${S} dir if we're using the binary version
- use binary && mkdir "${S}"
-
- # the Solaris and Darwin binaries from ghc (maeder) need to be
- # unpacked separately, so prevent them from being unpacked
- local ONLYA=${A}
- case ${CHOST} in
- *-darwin* | *-solaris*) ONLYA=${GHC_P}-src.tar.bz2 ;;
- esac
- unpack ${ONLYA}
-
- if [[ -d "${S}"/libraries/dph ]]; then
- # Sometimes dph libs get accidentally shipped with ghc
- # but they are not installed unless user requests it.
- # We never install them.
- elog "Removing 'libraries/dph'"
- rm -rf "${S}"/libraries/dph
- fi
-}
-
-src_prepare() {
- ghc_setup_cflags
-
- if ! use ghcbootstrap && [[ ${CHOST} != *-darwin* && ${CHOST} != *-solaris* ]]; then
- # Modify the wrapper script from the binary tarball to use GHC_PERSISTENT_FLAGS.
- # See bug #313635.
- sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_PERSISTENT_FLAGS}|" \
- "${WORKDIR}/usr/bin/ghc-${GHC_PV}"
-
- # allow hardened users use vanilla binary to bootstrap ghc
- # ghci uses mmap with rwx protection at it implements dynamic
- # linking on it's own (bug #299709)
- pax-mark -m "${WORKDIR}/usr/$(get_libdir)/${GHC_P}/bin/ghc"
- fi
-
- if use binary; then
- if use prefix; then
- relocate_ghc "${EPREFIX}"
- fi
-
- # Move unpacked files to the expected place
- mv "${WORKDIR}/usr" "${S}"
- else
- if ! use ghcbootstrap; then
- case ${CHOST} in
- *-darwin* | *-solaris*)
- # UPDATE ME for ghc-7
- mkdir "${WORKDIR}"/ghc-bin-installer || die
- pushd "${WORKDIR}"/ghc-bin-installer > /dev/null || die
- use sparc-solaris && unpack ghc-6.10.4-sparc-sun-solaris2.tar.bz2
- use x86-solaris && unpack ghc-7.0.3-i386-unknown-solaris2.tar.bz2
- use x86-macos && unpack ghc-7.4.1-i386-apple-darwin.tar.bz2
- use x64-macos && unpack ghc-7.4.1-x86_64-apple-darwin.tar.bz2
- popd > /dev/null
-
- pushd "${WORKDIR}"/ghc-bin-installer/ghc-[67].?*.? > /dev/null || die
- # fix the binaries so they run, on Solaris we need an
- # LD_LIBRARY_PATH which has our prefix libdirs, on
- # Darwin we need to replace the frameworks with our libs
- # from the prefix fix before installation, because some
- # of the tools are actually used during configure/make
- if [[ ${CHOST} == *-solaris* ]] ; then
- export LD_LIBRARY_PATH="${EPREFIX}/$(get_libdir):${EPREFIX}/usr/$(get_libdir):${LD_LIBRARY_PATH}"
- elif [[ ${CHOST} == *-darwin* ]] ; then
- local readline_framework=GNUreadline.framework/GNUreadline
- local gmp_framework=/opt/local/lib/libgmp.10.dylib
- local ncurses_file=/opt/local/lib/libncurses.5.dylib
- for binary in $(scanmacho -BRE MH_EXECUTE -F '%F' .) ; do
- install_name_tool -change \
- ${readline_framework} \
- "${EPREFIX}"/lib/libreadline.dylib \
- ${binary} || die
- install_name_tool -change \
- ${gmp_framework} \
- "${EPREFIX}"/usr/lib/libgmp.dylib \
- ${binary} || die
- install_name_tool -change \
- ${ncurses_file} \
- "${EPREFIX}"/usr/lib/libncurses.dylib \
- ${binary} || die
- done
- # we don't do frameworks!
- sed -i \
- -e 's/\(frameworks = \)\["GMP"\]/\1[]/g' \
- -e 's/\(extraLibraries = \)\["m"\]/\1["m","gmp"]/g' \
- rts/package.conf.in || die
- fi
-
- # it is autoconf, but we really don't want to give it too
- # much arguments, in fact we do the make in-place anyway
- ./configure --prefix="${WORKDIR}"/usr || die
- make install || die
- popd > /dev/null
- ;;
- *)
- relocate_ghc "${WORKDIR}"
- ;;
- esac
- fi
-
- sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_PERSISTENT_FLAGS}|" \
- "${S}/ghc/ghc.wrapper"
-
- cd "${S}" # otherwise epatch will break
-
- epatch "${FILESDIR}"/${PN}-7.0.4-CHOST-prefix.patch
-
- epatch "${FILESDIR}"/${PN}-7.8.2-cgen-constify.patch
- epatch "${FILESDIR}"/${PN}-7.8.3-prim-lm.patch
- epatch "${FILESDIR}"/${PN}-7.10.1-rc3-ghc-7.10-bootstrap.patch
- epatch "${FILESDIR}"/${PN}-7.10.1-T10590-dequeue.patch
- # Since ${S}/packages does not include base, etc. add them to gen_contents_index
- sed -e 's@\(for REPO in .*\)@\1 base integer-gmp integer-gmp2 integer-simple template-haskell@' \
- -i libraries/gen_contents_index || die
-
- if use prefix; then
- # Make configure find docbook-xsl-stylesheets from Prefix
- sed -e '/^FP_DIR_DOCBOOK_XSL/s:\[.*\]:['"${EPREFIX}"'/usr/share/sgml/docbook/xsl-stylesheets/]:' \
- -i utils/haddock/doc/configure.ac || die
- fi
-
- bump_libs
-
- # as we have changed the build system
- eautoreconf
- fi
-}
-
-src_configure() {
- if ! use binary; then
- # initialize build.mk
- echo '# Gentoo changes' > mk/build.mk
-
- # Put docs into the right place, ie /usr/share/doc/ghc-${GHC_PV}
- echo "docdir = ${EPREFIX}/usr/share/doc/${P}" >> mk/build.mk
- echo "htmldir = ${EPREFIX}/usr/share/doc/${P}" >> mk/build.mk
-
- # We also need to use the GHC_FLAGS flags when building ghc itself
- echo "SRC_HC_OPTS+=${HCFLAGS} ${GHC_FLAGS}" >> mk/build.mk
- echo "SRC_CC_OPTS+=${CFLAGS}" >> mk/build.mk
- echo "SRC_LD_OPTS+=${LDFLAGS}" >> mk/build.mk
-
- # We can't depend on haddock except when bootstrapping when we
- # must build docs and include them into the binary .tbz2 package
- # app-text/dblatex is not in portage, can not build PDF or PS
- echo "BUILD_DOCBOOK_PDF = NO" >> mk/build.mk
- echo "BUILD_DOCBOOK_PS = NO" >> mk/build.mk
- if use doc; then
- echo "BUILD_DOCBOOK_HTML = YES" >> mk/build.mk
- else
- echo "BUILD_DOCBOOK_HTML = NO" >> mk/build.mk
- fi
-
- # this controls presence on 'xhtml' and 'haddock' in final install
- echo "HADDOCK_DOCS = YES" >> mk/build.mk
-
- # allows overriding build flavours for libraries:
- # v - vanilla (static libs)
- # p - profiled
- # dyn - shared libraries
- # example: GHC_LIBRARY_WAYS="v dyn"
- if [[ -n ${GHC_LIBRARY_WAYS} ]]; then
- echo "GhcLibWays=${GHC_LIBRARY_WAYS}" >> mk/build.mk
- fi
-
- # Get ghc from the unpacked binary .tbz2
- # except when bootstrapping we just pick ghc up off the path
- if ! use ghcbootstrap; then
- export PATH="${WORKDIR}/usr/bin:${PATH}"
- fi
-
- if use gmp; then
- echo "INTEGER_LIBRARY=integer-gmp2" >> mk/build.mk
- else
- echo "INTEGER_LIBRARY=integer-simple" >> mk/build.mk
- fi
-
- # don't strip anything. Very useful when stage2 SIGSEGVs on you
- echo "STRIP_CMD = :" >> mk/build.mk
-
- elog "Final mk/build.mk:"
- cat mk/build.mk || die
-
- local econf_args=()
-
- # GHC embeds 'gcc' it was built by and uses it later.
- # Don't allow things like ccache or versioned binary slip.
- # We use stable thing across gcc upgrades.
- is_crosscompile || econf_args+=(--with-gcc=${CHOST}-gcc)
-
- if ! use ghcmakebinary; then
- econf_args+=(--with-system-libffi)
- econf_args+=(--with-ffi-includes=$(pkg-config libffi --cflags-only-I | sed -e 's@^-I@@'))
- fi
-
- econf ${econf_args[@]} --enable-bootstrap-with-devel-snapshot
-
- if [[ ${PV} == *9999* ]]; then
- GHC_PV="$(grep 'S\[\"PACKAGE_VERSION\"\]' config.status | sed -e 's@^.*=\"\(.*\)\"@\1@')"
- GHC_P=${PN}-${GHC_PV}
- fi
- GHC_TPF="$(grep 'S\[\"TargetPlatformFull\"\]' config.status | sed -e 's@^.*=\"\(.*\)\"@\1@')"
- fi # ! use binary
-}
-
-src_compile() {
- if ! use binary; then
- # 1. build compiler binary first
- emake ghc/stage2/build/tmp/ghc-stage2
- # 2. pax-mark (bug #516430)
- pax-mark -m ghc/stage2/build/tmp/ghc-stage2
- # 3. and then all the rest
- emake all
- fi # ! use binary
-}
-
-src_install() {
- if use binary; then
- use prefix && mkdir -p "${ED}"
- mv "${S}/usr" "${ED}"
- else
-
- emake -j1 install DESTDIR="${D}"
- dodoc "distrib/README" "ANNOUNCE" "LICENSE" "VERSION"
-
- # rename ghc-shipped files to avoid collision
- # of external packages. Motivating example:
- # user had installed:
- # dev-lang/ghc-7.8.4-r0 (with transformers-0.3.0.0)
- # dev-haskell/transformers-0.4.2.0
- # then user tried to update to
- # dev-lang/ghc-7.8.4-r1 (with transformers-0.4.2.0)
- # this will lead to single .conf file collision.
- local shipped_conf renamed_conf
- local package_confdir="${ED}/usr/$(get_libdir)/${GHC_P}/package.conf.d"
- for shipped_conf in "${package_confdir}"/*.conf; do
- # rename 'pkg-ver-id.conf' to 'pkg-ver-id-gentoo-${PF}.conf'
- renamed_conf=${shipped_conf%.conf}-gentoo-${PF}.conf
- mv "${shipped_conf}" "${renamed_conf}" || die
- done
-
- # remove link, but leave 'haddock-${GHC_P}'
- rm -f "${ED}"/usr/bin/haddock
-
- if [[ ! -f "${S}/VERSION" ]]; then
- echo "${GHC_PV}" > "${S}/VERSION" \
- || die "Could not create file ${S}/VERSION"
- fi
- newbashcomp "${FILESDIR}"/ghc-bash-completion ghc-pkg
- newbashcomp utils/completion/ghc.bash ghc
- fi
-
- # path to the package.cache
- local package_confdir="${ED}/usr/$(get_libdir)/${GHC_P}/package.conf.d"
- PKGCACHE="${package_confdir}"/package.cache
- # copy the package.conf.d, including timestamp, save it so we can help
- # users that have a broken package.conf.d
- cp -pR "${package_confdir}"{,.initial} || die "failed to backup intial package.conf.d"
-
- # copy the package.conf, including timestamp, save it so we later can put it
- # back before uninstalling, or when upgrading.
- cp -p "${PKGCACHE}"{,.shipped} \
- || die "failed to copy package.conf.d/package.cache"
-}
-
-pkg_preinst() {
- # have we got an earlier version of ghc installed?
- if has_version "<${CATEGORY}/${PF}"; then
- haskell_updater_warn="1"
- fi
-}
-
-pkg_postinst() {
- ghc-reregister
-
- # path to the package.cache
- PKGCACHE="${EROOT}/usr/$(get_libdir)/${GHC_P}/package.conf.d/package.cache"
-
- # give the cache a new timestamp, it must be as recent as
- # the package.conf.d directory.
- touch "${PKGCACHE}"
-
- if [[ "${haskell_updater_warn}" == "1" ]]; then
- ewarn
- ewarn "\e[1;31m************************************************************************\e[0m"
- ewarn
- ewarn "You have just upgraded from an older version of GHC."
- ewarn "You may have to run"
- ewarn " 'haskell-updater'"
- ewarn "to rebuild all ghc-based Haskell libraries."
- ewarn
- ewarn "\e[1;31m************************************************************************\e[0m"
- ewarn
- fi
-}
-
-pkg_prerm() {
- PKGCACHE="${EROOT}/usr/$(get_libdir)/${GHC_P}/package.conf.d/package.cache"
- rm -rf "${PKGCACHE}"
-
- cp -p "${PKGCACHE}"{.shipped,}
-}
-
-pkg_postrm() {
- ghc-package_pkg_postrm
-}
diff --git a/dev-lang/ghc/ghc-7.4.2.ebuild b/dev-lang/ghc/ghc-7.4.2.ebuild
deleted file mode 100644
index 366f1d4..00000000
--- a/dev-lang/ghc/ghc-7.4.2.ebuild
+++ /dev/null
@@ -1,640 +0,0 @@
-# Copyright 1999-2015 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Id$
-
-# Brief explanation of the bootstrap logic:
-#
-# Previous ghc ebuilds have been split into two: ghc and ghc-bin,
-# where ghc-bin was primarily used for bootstrapping purposes.
-# From now on, these two ebuilds have been combined, with the
-# binary USE flag used to determine whether or not the pre-built
-# binary package should be emerged or whether ghc should be compiled
-# from source. If the latter, then the relevant ghc-bin for the
-# arch in question will be used in the working directory to compile
-# ghc from source.
-#
-# This solution has the advantage of allowing us to retain the one
-# ebuild for both packages, and thus phase out virtual/ghc.
-
-# Note to users of hardened gcc-3.x:
-#
-# If you emerge ghc with hardened gcc it should work fine (because we
-# turn off the hardened features that would otherwise break ghc).
-# However, emerging ghc while using a vanilla gcc and then switching to
-# hardened gcc (using gcc-config) will leave you with a broken ghc. To
-# fix it you would need to either switch back to vanilla gcc or re-emerge
-# ghc (or ghc-bin). Note that also if you are using hardened gcc-3.x and
-# you switch to gcc-4.x that this will also break ghc and you'll need to
-# re-emerge ghc (or ghc-bin). People using vanilla gcc can switch between
-# gcc-3.x and 4.x with no problems.
-
-EAPI="5"
-
-inherit base autotools bash-completion-r1 eutils flag-o-matic multilib toolchain-funcs ghc-package versionator pax-utils
-
-DESCRIPTION="The Glasgow Haskell Compiler"
-HOMEPAGE="http://www.haskell.org/ghc/"
-
-# we don't have any binaries yet
-arch_binaries=""
-
-# sorted!
-arch_binaries="$arch_binaries alpha? ( http://code.haskell.org/~slyfox/ghc-alpha/ghc-bin-${PV}-alpha.tbz2 )"
-#arch_binaries="$arch_binaries arm? ( http://code.haskell.org/~slyfox/ghc-arm/ghc-bin-${PV}-arm.tbz2 )"
-arch_binaries="$arch_binaries amd64? ( http://code.haskell.org/~slyfox/ghc-amd64/ghc-bin-${PV}-amd64-stable-glibc.tbz2 )"
-arch_binaries="$arch_binaries ia64? ( http://code.haskell.org/~slyfox/ghc-ia64/ghc-bin-${PV}-ia64.tbz2 )"
-arch_binaries="$arch_binaries ppc? ( http://code.haskell.org/~slyfox/ghc-ppc/ghc-bin-${PV}-ppc.tbz2 )"
-arch_binaries="$arch_binaries ppc64? ( http://code.haskell.org/~slyfox/ghc-ppc64/ghc-bin-${PV}-ppc64.tbz2 )"
-arch_binaries="$arch_binaries sparc? ( http://code.haskell.org/~slyfox/ghc-sparc/ghc-bin-${PV}-sparc.tbz2 )"
-arch_binaries="$arch_binaries x86? ( http://code.haskell.org/~slyfox/ghc-x86/ghc-bin-${PV}-x86-stable-glibc.tbz2 )"
-
-# various ports:
-#arch_binaries="$arch_binaries x86-fbsd? ( http://code.haskell.org/~slyfox/ghc-x86-fbsd/ghc-bin-${PV}-x86-fbsd.tbz2 )"
-
-# 0 - yet
-yet_binary() {
- case "${ARCH}" in
- alpha) return 0 ;;
- #arm)
- # ewarn "ARM binary is built on armv5tel-eabi toolchain. Use with caution."
- # return 0
- #;;
- amd64) return 0 ;;
- ia64) return 0 ;;
- ppc) return 0 ;;
- ppc64) return 0 ;;
- sparc) return 0 ;;
- x86) return 0 ;;
- *) return 1 ;;
- esac
-}
-
-SRC_URI="!binary? ( http://www.haskell.org/ghc/dist/${PV}/${P}-src.tar.bz2 )"
-[[ -n $arch_binaries ]] && SRC_URI+=" !ghcbootstrap? ( $arch_binaries )"
-LICENSE="BSD"
-SLOT="0/${PV}"
-# ghc on ia64 needs gcc to support -mcmodel=medium (or some dark hackery) to avoid TOC overflow
-KEYWORDS="alpha amd64 ia64 ppc ppc64 sparc x86 ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x86-macos ~sparc-solaris ~x86-solaris"
-IUSE="doc ghcbootstrap ghcmakebinary +gmp llvm"
-IUSE+=" binary" # don't forget about me later!
-IUSE+=" elibc_glibc" # system stuff
-
-RDEPEND="
- !kernel_Darwin? ( >=sys-devel/gcc-2.95.3 )
- kernel_linux? ( >=sys-devel/binutils-2.17 )
- kernel_SunOS? ( >=sys-devel/binutils-2.17 )
- >=dev-lang/perl-5.6.1
- >=dev-libs/gmp-5
- virtual/libffi
- !<dev-haskell/haddock-2.10.0
- sys-libs/ncurses[unicode]"
-# earlier versions than 2.4.2 of haddock only works with older ghc releases
-
-# force dependency on >=gmp-5, even if >=gmp-4.1 would be enough. this is due to
-# that we want the binaries to use the latest versioun available, and not to be
-# built against gmp-4
-
-# similar for glibc. we have bootstrapped binaries against glibc-2.14
-DEPEND="${RDEPEND}
- ghcbootstrap? (
- doc? ( app-text/docbook-xml-dtd:4.2
- app-text/docbook-xml-dtd:4.5
- app-text/docbook-xsl-stylesheets
- >=dev-libs/libxslt-1.1.2 ) )
- !ghcbootstrap? ( !prefix? ( elibc_glibc? ( >=sys-libs/glibc-2.14 ) ) )"
-
-PDEPEND="!ghcbootstrap? ( =app-admin/haskell-updater-1.2* )"
-PDEPEND="
- ${PDEPEND}
- llvm? ( sys-devel/llvm )"
-
-# ia64 fails to return from STG GMP primitives (stage2 always SIGSEGVs)
-REQUIRED_USE="ia64? ( !gmp )"
-
-append-ghc-cflags() {
- local flag compile assemble link
- for flag in $*; do
- case ${flag} in
- compile) compile="yes";;
- assemble) assemble="yes";;
- link) link="yes";;
- *)
- [[ ${compile} ]] && GHC_FLAGS="${GHC_FLAGS} -optc${flag}" CFLAGS="${CFLAGS} ${flag}"
- [[ ${assemble} ]] && GHC_FLAGS="${GHC_FLAGS} -opta${flag}" CFLAGS="${CFLAGS} ${flag}"
- [[ ${link} ]] && GHC_FLAGS="${GHC_FLAGS} -optl${flag}" FILTERED_LDFLAGS="${FILTERED_LDFLAGS} ${flag}";;
- esac
- done
-}
-
-ghc_setup_cflags() {
- # We need to be very careful with the CFLAGS we ask ghc to pass through to
- # gcc. There are plenty of flags which will make gcc produce output that
- # breaks ghc in various ways. The main ones we want to pass through are
- # -mcpu / -march flags. These are important for arches like alpha & sparc.
- # We also use these CFLAGS for building the C parts of ghc, ie the rts.
- strip-flags
- strip-unsupported-flags
-
- # Cmm can't parse line numbers #482086
- replace-flags -ggdb[3-9] -ggdb2
-
- GHC_FLAGS=""
- for flag in ${CFLAGS}; do
- case ${flag} in
-
- # Ignore extra optimisation (ghc passes -O to gcc anyway)
- # -O2 and above break on too many systems
- -O*) ;;
-
- # Arch and ABI flags are what we're really after
- -m*) append-ghc-cflags compile assemble ${flag};;
-
- # Debugging flags don't help either. You can't debug Haskell code
- # at the C source level and the mangler discards the debug info.
- -g*) ;;
-
- # Ignore all other flags, including all -f* flags
- esac
- done
-
- FILTERED_LDFLAGS=""
- for flag in ${LDFLAGS}; do
- case ${flag} in
- # Pass the canary. we don't quite respect LDFLAGS, but we have an excuse!
- "-Wl,--hash-style="*) append-ghc-cflags link ${flag};;
-
- # Ignore all other flags
- esac
- done
-
- # hardened-gcc needs to be disabled, because the mangler doesn't accept
- # its output.
- gcc-specs-pie && append-ghc-cflags compile link -nopie
- gcc-specs-ssp && append-ghc-cflags compile -fno-stack-protector
-
- # prevent from failind building unregisterised ghc:
- # http://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg171602.html
- use ppc64 && append-ghc-cflags compile -mminimal-toc
- # fix the similar issue as ppc64 TOC on ia64. ia64 has limited size of small data
- # currently ghc fails to build haddock
- # http://osdir.com/ml/gnu.binutils.bugs/2004-10/msg00050.html
- use ia64 && append-ghc-cflags compile -G0
-
- # Unfortunately driver/split/ghc-split.lprl is dumb
- # enough to preserve stack marking for each split object
- # and it flags stack marking violation:
- # * !WX --- --- usr/lib64/ghc-7.4.1/base-4.5.0.0/libHSbase-4.5.0.0.a:Fingerprint__1.o
- # * !WX --- --- usr/lib64/ghc-7.4.1/base-4.5.0.0/libHSbase-4.5.0.0.a:Fingerprint__2.o
- # * !WX --- --- usr/lib64/ghc-7.4.1/base-4.5.0.0/libHSbase-4.5.0.0.a:Fingerprint__3.o
- case $($(tc-getAS) -v 2>&1 </dev/null) in
- *"GNU Binutils"*) # GNU ld
- append-ghc-cflags compile assemble -Wa,--noexecstack
- ;;
- esac
-}
-
-# substitutes string $1 to $2 in files $3 $4 ...
-relocate_path() {
- local from=$1
- local to=$2
- shift 2
- local file=
- for file in "$@"
- do
- sed -i -e "s|$from|$to|g" \
- "$file" || die "path relocation failed for '$file'"
- done
-}
-
-# changes hardcoded ghc paths and updates package index
-# $1 - new absolute root path
-relocate_ghc() {
- local to=$1
-
- # backup original script to use it later after relocation
- local gp_back="${T}/ghc-pkg-${PV}-orig"
- cp "${WORKDIR}/usr/bin/ghc-pkg-${PV}" "$gp_back" || die "unable to backup ghc-pkg wrapper"
-
- # Relocate from /usr to ${EPREFIX}/usr
- relocate_path "/usr" "${to}/usr" \
- "${WORKDIR}/usr/bin/ghc-${PV}" \
- "${WORKDIR}/usr/bin/ghci-${PV}" \
- "${WORKDIR}/usr/bin/ghc-pkg-${PV}" \
- "${WORKDIR}/usr/bin/hsc2hs" \
- "${WORKDIR}/usr/$(get_libdir)/${P}/package.conf.d/"*
-
- # this one we will use to regenerate cache
- # so it shoult point to current tree location
- relocate_path "/usr" "${WORKDIR}/usr" "$gp_back"
-
- if use prefix; then
- # and insert LD_LIBRARY_PATH entry to EPREFIX dir tree
- # TODO: add the same for darwin's CHOST and it's DYLD_
- local new_ldpath='LD_LIBRARY_PATH="'${EPREFIX}/$(get_libdir):${EPREFIX}/usr/$(get_libdir)'${LD_LIBRARY_PATH:+:}${LD_LIBRARY_PATH}"\nexport LD_LIBRARY_PATH'
- sed -i -e '2i'"$new_ldpath" \
- "${WORKDIR}/usr/bin/ghc-${PV}" \
- "${WORKDIR}/usr/bin/ghci-${PV}" \
- "${WORKDIR}/usr/bin/ghc-pkg-${PV}" \
- "$gp_back" \
- "${WORKDIR}/usr/bin/hsc2hs" \
- || die "Adding LD_LIBRARY_PATH for wrappers failed"
- fi
-
- # regenerate the binary package cache
- "$gp_back" recache || die "failed to update cache after relocation"
- rm "$gp_back"
-}
-
-pkg_setup() {
- # quiet portage about prebuilt binaries
- use binary && QA_PREBUILT="*"
-
- if use ghcbootstrap; then
- ewarn "You requested ghc bootstrapping, this is usually only used"
- ewarn "by Gentoo developers to make binary .tbz2 packages for"
- ewarn "use with the ghc ebuild's USE=\"binary\" feature."
- use binary && \
- die "USE=\"ghcbootstrap binary\" is not a valid combination."
- [[ -z $(type -P ghc) ]] && \
- die "Could not find a ghc to bootstrap with."
- else
- if ! yet_binary; then
- eerror "Please try emerging with USE=ghcbootstrap and report build"
- eerror "sucess or failure to the haskell team (haskell@gentoo.org)"
- die "No binary available for '${ARCH}' arch yet, USE=ghcbootstrap"
- fi
- fi
-}
-
-src_unpack() {
- # Create the ${S} dir if we're using the binary version
- use binary && mkdir "${S}"
-
- # the Solaris and Darwin binaries from ghc (maeder) need to be
- # unpacked separately, so prevent them from being unpacked
- local ONLYA=${A}
- case ${CHOST} in
- *-darwin* | *-solaris*) ONLYA=${P}-src.tar.bz2 ;;
- esac
- unpack ${ONLYA}
-}
-
-src_prepare() {
- ghc_setup_cflags
-
- if ! use ghcbootstrap && [[ ${CHOST} != *-darwin* && ${CHOST} != *-solaris* ]]; then
- # Modify the wrapper script from the binary tarball to use GHC_FLAGS.
- # See bug #313635.
- sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_FLAGS}|" \
- "${WORKDIR}/usr/bin/ghc-${PV}"
-
- # allow hardened users use vanilla binary to bootstrap ghc
- # ghci uses mmap with rwx protection at it implements dynamic
- # linking on it's own (bug #299709)
- pax-mark -m "${WORKDIR}/usr/$(get_libdir)/${P}/ghc"
- fi
-
- if use binary; then
- if use prefix; then
- relocate_ghc "${EPREFIX}"
- fi
-
- # Move unpacked files to the expected place
- mv "${WORKDIR}/usr" "${S}"
- else
- if ! use ghcbootstrap; then
- case ${CHOST} in
- *-darwin* | *-solaris*)
- mkdir "${WORKDIR}"/ghc-bin-installer || die
- pushd "${WORKDIR}"/ghc-bin-installer > /dev/null || die
- use sparc-solaris && unpack ghc-6.10.4-sparc-sun-solaris2.tar.bz2
- use x86-solaris && unpack ghc-7.0.3-i386-unknown-solaris2.tar.bz2
- use x86-macos && unpack ghc-7.4.1-i386-apple-darwin.tar.bz2
- use x64-macos && unpack ghc-7.4.1-x86_64-apple-darwin.tar.bz2
- popd > /dev/null
-
- pushd "${WORKDIR}"/ghc-bin-installer/ghc-[67].?*.? > /dev/null || die
- # fix the binaries so they run, on Solaris we need an
- # LD_LIBRARY_PATH which has our prefix libdirs, on
- # Darwin we need to replace the frameworks with our libs
- # from the prefix fix before installation, because some
- # of the tools are actually used during configure/make
- if [[ ${CHOST} == *-solaris* ]] ; then
- export LD_LIBRARY_PATH="${EPREFIX}/$(get_libdir):${EPREFIX}/usr/$(get_libdir):${LD_LIBRARY_PATH}"
- elif [[ ${CHOST} == *-darwin* ]] ; then
- local readline_framework=GNUreadline.framework/GNUreadline
- local gmp_framework=/opt/local/lib/libgmp.10.dylib
- local ncurses_file=/opt/local/lib/libncurses.5.dylib
- for binary in $(scanmacho -BRE MH_EXECUTE -F '%F' .) ; do
- install_name_tool -change \
- ${readline_framework} \
- "${EPREFIX}"/lib/libreadline.dylib \
- ${binary} || die
- install_name_tool -change \
- ${gmp_framework} \
- "${EPREFIX}"/usr/lib/libgmp.dylib \
- ${binary} || die
- install_name_tool -change \
- ${ncurses_file} \
- "${EPREFIX}"/usr/lib/libncurses.dylib \
- ${binary} || die
- done
- # we don't do frameworks!
- sed -i \
- -e 's/\(frameworks = \)\["GMP"\]/\1[]/g' \
- -e 's/\(extraLibraries = \)\["m"\]/\1["m","gmp"]/g' \
- rts/package.conf.in || die
- fi
-
- # it is autoconf, but we really don't want to give it too
- # much arguments, in fact we do the make in-place anyway
- ./configure --prefix="${WORKDIR}"/usr || die
- make install || die
- popd > /dev/null
- ;;
- *)
- relocate_ghc "${WORKDIR}"
- ;;
- esac
- fi
-
- sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_FLAGS}|" \
- "${S}/ghc/ghc.wrapper"
-
- cd "${S}" # otherwise epatch will break
-
- epatch "${FILESDIR}"/${PN}-7.0.4-CHOST-prefix.patch
-
- epatch "${FILESDIR}"/${PN}-7.0.4-darwin8.patch
- # failed to apply. FIXME
- #epatch "${FILESDIR}"/${PN}-6.12.3-mach-o-relocation-limit.patch
-
- epatch "${FILESDIR}"/${PN}-7.4-rc2-macos-prefix-respect-gcc.patch
- epatch "${FILESDIR}"/${PN}-7.4.1-darwin-CHOST.patch
- epatch "${FILESDIR}"/${PN}-7.2.1-freebsd-CHOST.patch
-
- we_want_libffi_workaround() {
- use ghcmakebinary && return 1
-
- # pick only registerised arches
- # https://bugs.gentoo.org/463814
- use amd64 && return 0
- use x86 && return 0
- return 1
- }
- # one mode external depend with unstable ABI be careful to stash it
- # avoid external libffi runtime when we build binaries
- we_want_libffi_workaround && epatch "${FILESDIR}"/${PN}-7.4.2-system-libffi.patch
-
- epatch "${FILESDIR}"/${PN}-7.4.1-ticket-7339-fix-unaligned-unreg.patch
-
- if use prefix; then
- # Make configure find docbook-xsl-stylesheets from Prefix
- sed -i -e '/^FP_DIR_DOCBOOK_XSL/s:\[.*\]:['"${EPREFIX}"'/usr/share/sgml/docbook/xsl-stylesheets/]:' utils/haddock/doc/configure.ac || die
- fi
-
- cd "${S}"/libraries/terminfo
- # bug #454216
- epatch "${FILESDIR}"/terminfo-0.3.2.5-tinfo.patch
-
- cd "${S}"
- # as we have changed the build system
- eautoreconf
- fi
-}
-
-src_configure() {
- if ! use binary; then
-
- # initialize build.mk
- echo '# Gentoo changes' > mk/build.mk
-
- # Put docs into the right place, ie /usr/share/doc/ghc-${PV}
- echo "docdir = ${EPREFIX}/usr/share/doc/${P}" >> mk/build.mk
- echo "htmldir = ${EPREFIX}/usr/share/doc/${P}" >> mk/build.mk
-
- # We also need to use the GHC_FLAGS flags when building ghc itself
- echo "SRC_HC_OPTS+=${GHC_FLAGS}" >> mk/build.mk
- echo "SRC_CC_OPTS+=${CFLAGS}" >> mk/build.mk
- echo "SRC_LD_OPTS+=${FILTERED_LDFLAGS}" >> mk/build.mk
-
- # We can't depend on haddock except when bootstrapping when we
- # must build docs and include them into the binary .tbz2 package
- if use ghcbootstrap && use doc; then
- echo "BUILD_DOCBOOK_PDF = NO" >> mk/build.mk
- echo "BUILD_DOCBOOK_PS = NO" >> mk/build.mk
- echo "BUILD_DOCBOOK_HTML = YES" >> mk/build.mk
- echo "HADDOCK_DOCS = YES" >> mk/build.mk
- else
- echo "BUILD_DOCBOOK_PDF = NO" >> mk/build.mk
- echo "BUILD_DOCBOOK_PS = NO" >> mk/build.mk
- echo "BUILD_DOCBOOK_HTML = NO" >> mk/build.mk
- echo "HADDOCK_DOCS = NO" >> mk/build.mk
- fi
-
- # circumvent a very strange bug that seems related with ghc producing
- # too much output while being filtered through tee (e.g. due to
- # portage logging) reported as bug #111183
- echo "SRC_HC_OPTS+=-w" >> mk/build.mk
-
- # some arches do not support ELF parsing for ghci module loading
- # PPC64: never worked (should be easy to implement)
- # alpha: never worked
- # arm: unimplemented or never worked
- if use alpha || use ppc64 || use arm; then
- echo "GhcWithInterpreter=NO" >> mk/build.mk
- fi
-
- # we have to tell it to build unregisterised on some arches
- # ppc64: EvilMangler currently does not understand some TOCs
- # ia64: EvilMangler bitrot
- if use alpha || use ia64 || use ppc64; then
- echo "GhcUnregisterised=YES" >> mk/build.mk
- echo "GhcWithNativeCodeGen=NO" >> mk/build.mk
- echo "SplitObjs=NO" >> mk/build.mk
- echo "GhcRTSWays := debug" >> mk/build.mk
- echo "GhcNotThreaded=YES" >> mk/build.mk
- fi
-
- # arm: no EvilMangler support, no NCG support
- if use arm; then
- echo "GhcUnregisterised=YES" >> mk/build.mk
- echo "GhcWithNativeCodeGen=NO" >> mk/build.mk
- fi
-
- # Have "ld -r --relax" problem with split-objs on sparc:
- if use sparc; then
- echo "SplitObjs=NO" >> mk/build.mk
- fi
-
- if ! use llvm; then
- echo "GhcWithLlvmCodeGen=NO" >> mk/build.mk
- fi
-
- # allows overriding build flavours for libraries:
- # v - vanilla (static libs)
- # p - profiled
- # dyn - shared libraries
- # example: GHC_LIBRARY_WAYS="v dyn"
- if [[ -n ${GHC_LIBRARY_WAYS} ]]; then
- echo "GhcLibWays=${GHC_LIBRARY_WAYS}" >> mk/build.mk
- fi
-
- # Get ghc from the unpacked binary .tbz2
- # except when bootstrapping we just pick ghc up off the path
- if ! use ghcbootstrap; then
- export PATH="${WORKDIR}/usr/bin:${PATH}"
- fi
-
- if use gmp; then
- echo "INTEGER_LIBRARY=integer-gmp" >> mk/build.mk
- else
- echo "INTEGER_LIBRARY=integer-simple" >> mk/build.mk
- fi
-
- # Since GHC 6.12.2 the GHC wrappers store which GCC version GHC was
- # compiled with, by saving the path to it. The purpose is to make sure
- # that GHC will use the very same gcc version when it compiles haskell
- # sources, as the extra-gcc-opts files contains extra gcc options which
- # match only this GCC version.
- # However, this is not required in Gentoo, as only modern GCCs are used
- # (>4).
- # Instead, this causes trouble when for example ccache is used during
- # compilation, but we don't want the wrappers to point to ccache.
- # Due to the above, we simply set GCC to be "gcc". When compiling ghc it
- # might point to ccache, once installed it will point to the users
- # regular gcc.
-
- econf --with-gcc=gcc || die "econf failed"
- fi # ! use binary
-}
-
-src_compile() {
- if ! use binary; then
- limit_jobs() {
- if [[ -n ${I_DEMAND_MY_CORES_LOADED} ]]; then
- ewarn "You have requested parallel build which is known to break."
- ewarn "Please report all breakages upstream."
- return
- fi
- echo $@
- }
- # ghc massively parallel make: #409631, #409873
- # but let users screw it by setting 'I_DEMAND_MY_CORES_LOADED'
- emake $(limit_jobs -j1) all
- fi # ! use binary
-}
-
-src_install() {
- if use binary; then
- use prefix && mkdir -p "${ED}"
- mv "${S}/usr" "${ED}"
-
- # Remove the docs if not requested
- if ! use doc; then
- rm -rf "${ED}/usr/share/doc/${P}/*/" \
- "${ED}/usr/share/doc/${P}/*.html" \
- || die "could not remove docs (P vs PF revision mismatch?)"
- fi
- else
- local insttarget="install"
-
- # We only built docs if we were bootstrapping, otherwise
- # we copy them out of the unpacked binary .tbz2
- if use doc && ! use ghcbootstrap; then
- mkdir -p "${ED}/usr/share/doc"
- mv "${WORKDIR}/usr/share/doc/${P}" "${ED}/usr/share/doc" \
- || die "failed to copy docs"
- else
- dodoc "${S}/README" "${S}/ANNOUNCE" "${S}/LICENSE" "${S}/VERSION"
- fi
-
- emake -j1 ${insttarget} \
- DESTDIR="${D}" \
- || die "make ${insttarget} failed"
-
- # remove wrapper and linker
- rm -f "${ED}"/usr/bin/haddock*
-
- # ghci uses mmap with rwx protection at it implements dynamic
- # linking on it's own (bug #299709)
- # so mark resulting binary
- pax-mark -m "${ED}/usr/$(get_libdir)/${P}/ghc"
-
- dobashcomp "${FILESDIR}/ghc-bash-completion"
-
- fi
-
- # path to the package.cache
- local package_confdir="${ED}/usr/$(get_libdir)/${P}/package.conf.d"
- PKGCACHE="${package_confdir}"/package.cache
-
- cp -pR "${package_confdir}"{,.initial} || die "failed to backup intial package.conf.d"
-
- # copy the package.conf, including timestamp, save it so we later can put it
- # back before uninstalling, or when upgrading.
- cp -p "${PKGCACHE}"{,.shipped} \
- || die "failed to copy package.conf.d/package.cache"
-}
-
-pkg_preinst() {
- # have we got an earlier version of ghc installed?
- if has_version "<${CATEGORY}/${PF}"; then
- haskell_updater_warn="1"
- fi
-}
-
-pkg_postinst() {
- ghc-reregister
-
- # path to the package.cache
- PKGCACHE="${EROOT}/usr/$(get_libdir)/${P}/package.conf.d/package.cache"
-
- # give the cache a new timestamp, it must be as recent as
- # the package.conf.d directory.
- touch "${PKGCACHE}"
-
- if [[ "${haskell_updater_warn}" == "1" ]]; then
- ewarn
- ewarn "\e[1;31m************************************************************************\e[0m"
- ewarn
- ewarn "You have just upgraded from an older version of GHC."
- ewarn "You may have to run"
- ewarn " 'haskell-updater --upgrade'"
- ewarn "to rebuild all ghc-based Haskell libraries."
- ewarn
- ewarn "\e[1;31m************************************************************************\e[0m"
- ewarn
- fi
-}
-
-pkg_prerm() {
- # Be very careful here... Call order when upgrading is (according to PMS):
- # * src_install for new package
- # * pkg_preinst for new package
- # * pkg_postinst for new package
- # * pkg_prerm for the package being replaced
- # * pkg_postrm for the package being replaced
- # so you'll actually be touching the new packages files, not the one you
- # uninstall, due to that or installation directory ${P} will be the same for
- # both packages.
-
- # Call order for reinstalling is (according to PMS):
- # * src_install
- # * pkg_preinst
- # * pkg_prerm for the package being replaced
- # * pkg_postrm for the package being replaced
- # * pkg_postinst
-
- # Overwrite the modified package.cache with a copy of the
- # original one, so that it will be removed during uninstall.
-
- PKGCACHE="${EROOT}/usr/$(get_libdir)/${P}/package.conf.d/package.cache"
- rm -rf "${PKGCACHE}"
-
- cp -p "${PKGCACHE}"{.shipped,}
-}
-
-pkg_postrm() {
- ghc-package_pkg_postrm
-}
diff --git a/dev-lang/ghc/ghc-7.6.3-r1.ebuild b/dev-lang/ghc/ghc-7.6.3-r1.ebuild
deleted file mode 100644
index c5c2e89..00000000
--- a/dev-lang/ghc/ghc-7.6.3-r1.ebuild
+++ /dev/null
@@ -1,829 +0,0 @@
-# Copyright 1999-2015 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Id$
-
-# Brief explanation of the bootstrap logic:
-#
-# Previous ghc ebuilds have been split into two: ghc and ghc-bin,
-# where ghc-bin was primarily used for bootstrapping purposes.
-# From now on, these two ebuilds have been combined, with the
-# binary USE flag used to determine whether or not the pre-built
-# binary package should be emerged or whether ghc should be compiled
-# from source. If the latter, then the relevant ghc-bin for the
-# arch in question will be used in the working directory to compile
-# ghc from source.
-#
-# This solution has the advantage of allowing us to retain the one
-# ebuild for both packages, and thus phase out virtual/ghc.
-
-# Note to users of hardened gcc-3.x:
-#
-# If you emerge ghc with hardened gcc it should work fine (because we
-# turn off the hardened features that would otherwise break ghc).
-# However, emerging ghc while using a vanilla gcc and then switching to
-# hardened gcc (using gcc-config) will leave you with a broken ghc. To
-# fix it you would need to either switch back to vanilla gcc or re-emerge
-# ghc (or ghc-bin). Note that also if you are using hardened gcc-3.x and
-# you switch to gcc-4.x that this will also break ghc and you'll need to
-# re-emerge ghc (or ghc-bin). People using vanilla gcc can switch between
-# gcc-3.x and 4.x with no problems.
-
-EAPI="5"
-
-# to make make a crosscompiler use crossdev and symlink ghc tree into
-# cross overlay. result would look like 'cross-sparc-unknown-linux-gnu/ghc'
-#
-# 'CTARGET' definition and 'is_crosscompile' are taken from 'toolchain.eclass'
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} = ${CHOST} ]] ; then
- if [[ ${CATEGORY/cross-} != ${CATEGORY} ]] ; then
- export CTARGET=${CATEGORY/cross-}
- fi
-fi
-
-inherit autotools bash-completion-r1 eutils flag-o-matic ghc-package
-inherit multilib multiprocessing pax-utils toolchain-funcs versionator
-
-DESCRIPTION="The Glasgow Haskell Compiler"
-HOMEPAGE="http://www.haskell.org/ghc/"
-
-# we don't have any binaries yet
-arch_binaries=""
-
-# sorted!
-arch_binaries="$arch_binaries alpha? ( http://code.haskell.org/~slyfox/ghc-alpha/ghc-bin-${PV}-r1-alpha.tbz2 )"
-#arch_binaries="$arch_binaries arm? ( http://code.haskell.org/~slyfox/ghc-arm/ghc-bin-${PV}-arm.tbz2 )"
-arch_binaries="$arch_binaries amd64? ( http://code.haskell.org/~slyfox/ghc-amd64/ghc-bin-${PV}-amd64.tbz2 )"
-arch_binaries="$arch_binaries ia64? ( http://code.haskell.org/~slyfox/ghc-ia64/ghc-bin-${PV}-r1-ia64.tbz2 )"
-arch_binaries="$arch_binaries ppc? ( http://code.haskell.org/~slyfox/ghc-ppc/ghc-bin-${PV}-r1-ppc.tbz2 )"
-arch_binaries="$arch_binaries ppc64? ( http://code.haskell.org/~slyfox/ghc-ppc64/ghc-bin-${PV}-r1-ppc64.tbz2 )"
-arch_binaries="$arch_binaries sparc? ( http://code.haskell.org/~slyfox/ghc-sparc/ghc-bin-${PV}-r1-sparc.tbz2 )"
-arch_binaries="$arch_binaries x86? ( http://code.haskell.org/~slyfox/ghc-x86/ghc-bin-${PV}-x86.tbz2 )"
-
-# various ports:
-#arch_binaries="$arch_binaries x86-fbsd? ( http://code.haskell.org/~slyfox/ghc-x86-fbsd/ghc-bin-${PV}-x86-fbsd.tbz2 )"
-
-# 0 - yet
-yet_binary() {
- case "${ARCH}" in
- alpha) return 0 ;;
- #arm)
- # ewarn "ARM binary is built on armv5tel-eabi toolchain. Use with caution."
- # return 0
- #;;
- amd64) return 0 ;;
- ia64) return 0 ;;
- ppc) return 0 ;;
- ppc64) return 0 ;;
- sparc) return 0 ;;
- x86) return 0 ;;
- *) return 1 ;;
- esac
-}
-
-SRC_URI="!binary? ( http://www.haskell.org/ghc/dist/${PV}/${P}-src.tar.bz2 )"
-[[ -n $arch_binaries ]] && SRC_URI+=" !ghcbootstrap? ( $arch_binaries )"
-LICENSE="BSD"
-SLOT="0/${PV}"
-KEYWORDS="~alpha amd64 ~ia64 ppc ~ppc64 ~sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x86-macos ~sparc-solaris ~x86-solaris"
-IUSE="doc ghcbootstrap ghcmakebinary +gmp llvm"
-IUSE+=" binary" # don't forget about me later!
-IUSE+=" elibc_glibc" # system stuff
-
-RDEPEND="
- !kernel_Darwin? ( >=sys-devel/gcc-2.95.3 )
- kernel_linux? ( >=sys-devel/binutils-2.17 )
- kernel_SunOS? ( >=sys-devel/binutils-2.17 )
- >=dev-lang/perl-5.6.1
- >=dev-libs/gmp-5
- virtual/libffi
- !<dev-haskell/haddock-2.4.2
- sys-libs/ncurses[unicode]"
-# earlier versions than 2.4.2 of haddock only works with older ghc releases
-
-# force dependency on >=gmp-5, even if >=gmp-4.1 would be enough. this is due to
-# that we want the binaries to use the latest versioun available, and not to be
-# built against gmp-4
-
-# similar for glibc. we have bootstrapped binaries against glibc-2.14
-DEPEND="${RDEPEND}
- ghcbootstrap? (
- doc? ( app-text/docbook-xml-dtd:4.2
- app-text/docbook-xml-dtd:4.5
- app-text/docbook-xsl-stylesheets
- >=dev-libs/libxslt-1.1.2 ) )
- !ghcbootstrap? ( !prefix? ( elibc_glibc? ( >=sys-libs/glibc-2.15 ) ) )"
-
-PDEPEND="!ghcbootstrap? ( =app-admin/haskell-updater-1.2* )"
-PDEPEND="
- ${PDEPEND}
- llvm? ( sys-devel/llvm )"
-
-# ia64 fails to return from STG GMP primitives (stage2 always SIGSEGVs)
-REQUIRED_USE="ia64? ( !gmp )"
-
-# haskell libraries built with cabal in configure mode, #515354
-QA_CONFIGURE_OPTIONS+=" --with-compiler --with-gcc"
-
-is_crosscompile() {
- [[ ${CHOST} != ${CTARGET} ]]
-}
-
-append-ghc-cflags() {
- local flag compile assemble link
- for flag in $*; do
- case ${flag} in
- compile) compile="yes";;
- assemble) assemble="yes";;
- link) link="yes";;
- *)
- [[ ${compile} ]] && GHC_FLAGS="${GHC_FLAGS} -optc${flag}" CFLAGS="${CFLAGS} ${flag}"
- [[ ${assemble} ]] && GHC_FLAGS="${GHC_FLAGS} -opta${flag}" CFLAGS="${CFLAGS} ${flag}"
- [[ ${link} ]] && GHC_FLAGS="${GHC_FLAGS} -optl${flag}" FILTERED_LDFLAGS="${FILTERED_LDFLAGS} ${flag}";;
- esac
- done
-}
-
-ghc_setup_cflags() {
- if is_crosscompile; then
- export CFLAGS=${GHC_CFLAGS-"-O2 -pipe"}
- export LDFLAGS=${GHC_LDFLAGS-"-Wl,-O1"}
- einfo "Crosscompiling mode:"
- einfo " CHOST: ${CHOST}"
- einfo " CTARGET: ${CTARGET}"
- einfo " CFLAGS: ${CFLAGS}"
- einfo " LDFLAGS: ${LDFLAGS}"
- return
- fi
- # We need to be very careful with the CFLAGS we ask ghc to pass through to
- # gcc. There are plenty of flags which will make gcc produce output that
- # breaks ghc in various ways. The main ones we want to pass through are
- # -mcpu / -march flags. These are important for arches like alpha & sparc.
- # We also use these CFLAGS for building the C parts of ghc, ie the rts.
- strip-flags
- strip-unsupported-flags
-
- # Cmm can't parse line numbers #482086
- replace-flags -ggdb[3-9] -ggdb2
-
- GHC_FLAGS=""
- for flag in ${CFLAGS}; do
- case ${flag} in
-
- # Ignore extra optimisation (ghc passes -O to gcc anyway)
- # -O2 and above break on too many systems
- -O*) ;;
-
- # Arch and ABI flags are what we're really after
- -m*) append-ghc-cflags compile assemble ${flag};;
-
- # Sometimes it's handy to see backtrace of RTS
- # to get an idea what happens there
- -g*) append-ghc-cflags compile ${flag};;
-
- # Ignore all other flags, including all -f* flags
- esac
- done
-
- FILTERED_LDFLAGS=""
- for flag in ${LDFLAGS}; do
- case ${flag} in
- # Pass the canary. we don't quite respect LDFLAGS, but we have an excuse!
- "-Wl,--hash-style="*) append-ghc-cflags link ${flag};;
-
- # Ignore all other flags
- esac
- done
-
- # hardened-gcc needs to be disabled, because the mangler doesn't accept
- # its output.
- gcc-specs-pie && append-ghc-cflags compile link -nopie
- gcc-specs-ssp && append-ghc-cflags compile -fno-stack-protector
-
- # prevent from failind building unregisterised ghc:
- # http://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg171602.html
- use ppc64 && append-ghc-cflags compile -mminimal-toc
- # fix the similar issue as ppc64 TOC on ia64. ia64 has limited size of small data
- # currently ghc fails to build haddock
- # http://osdir.com/ml/gnu.binutils.bugs/2004-10/msg00050.html
- use ia64 && append-ghc-cflags compile -G0 -Os
-
- # Unfortunately driver/split/ghc-split.lprl is dumb
- # enough to preserve stack marking for each split object
- # and it flags stack marking violation:
- # * !WX --- --- usr/lib64/ghc-7.4.1/base-4.5.0.0/libHSbase-4.5.0.0.a:Fingerprint__1.o
- # * !WX --- --- usr/lib64/ghc-7.4.1/base-4.5.0.0/libHSbase-4.5.0.0.a:Fingerprint__2.o
- # * !WX --- --- usr/lib64/ghc-7.4.1/base-4.5.0.0/libHSbase-4.5.0.0.a:Fingerprint__3.o
- case $($(tc-getAS) -v 2>&1 </dev/null) in
- *"GNU Binutils"*) # GNU ld
- append-ghc-cflags compile assemble -Wa,--noexecstack
- ;;
- esac
-}
-
-# substitutes string $1 to $2 in files $3 $4 ...
-relocate_path() {
- local from=$1
- local to=$2
- shift 2
- local file=
- for file in "$@"
- do
- sed -i -e "s|$from|$to|g" \
- "$file" || die "path relocation failed for '$file'"
- done
-}
-
-# changes hardcoded ghc paths and updates package index
-# $1 - new absolute root path
-relocate_ghc() {
- local to=$1
-
- # libdir for prebuilt binary and for current system may mismatch
- # It does for prefix installation for example: bug #476998
- local bin_ghc_prefix=${WORKDIR}/usr
- local bin_libpath=$(echo "${bin_ghc_prefix}"/lib*)
- local bin_libdir=${bin_libpath#${bin_ghc_prefix}/}
-
- # backup original script to use it later after relocation
- local gp_back="${T}/ghc-pkg-${PV}-orig"
- cp "${WORKDIR}/usr/bin/ghc-pkg-${PV}" "$gp_back" || die "unable to backup ghc-pkg wrapper"
-
- if [[ ${bin_libdir} != $(get_libdir) ]]; then
- einfo "Relocating '${bin_libdir}' to '$(get_libdir)' (bug #476998)"
- # moving the dir itself is not strictly needed
- # but then USE=binary would result in installing
- # in '${bin_libdir}'
- mv "${bin_ghc_prefix}/${bin_libdir}" "${bin_ghc_prefix}/$(get_libdir)" || die
-
- relocate_path "/usr/${bin_libdir}" "/usr/$(get_libdir)" \
- "${WORKDIR}/usr/bin/ghc-${PV}" \
- "${WORKDIR}/usr/bin/ghci-${PV}" \
- "${WORKDIR}/usr/bin/ghc-pkg-${PV}" \
- "${WORKDIR}/usr/bin/hsc2hs" \
- "${WORKDIR}/usr/bin/runghc-${PV}" \
- "$gp_back" \
- "${WORKDIR}/usr/$(get_libdir)/${P}/package.conf.d/"*
- fi
-
- # Relocate from /usr to ${EPREFIX}/usr
- relocate_path "/usr" "${to}/usr" \
- "${WORKDIR}/usr/bin/ghc-${PV}" \
- "${WORKDIR}/usr/bin/ghci-${PV}" \
- "${WORKDIR}/usr/bin/ghc-pkg-${PV}" \
- "${WORKDIR}/usr/bin/hsc2hs" \
- "${WORKDIR}/usr/bin/runghc-${PV}" \
- "${WORKDIR}/usr/$(get_libdir)/${P}/package.conf.d/"*
-
- # this one we will use to regenerate cache
- # so it should point to current tree location
- relocate_path "/usr" "${WORKDIR}/usr" "$gp_back"
-
- if use prefix; then
- # and insert LD_LIBRARY_PATH entry to EPREFIX dir tree
- # TODO: add the same for darwin's CHOST and it's DYLD_
- local new_ldpath='LD_LIBRARY_PATH="'${EPREFIX}/$(get_libdir):${EPREFIX}/usr/$(get_libdir)'${LD_LIBRARY_PATH:+:}${LD_LIBRARY_PATH}"\nexport LD_LIBRARY_PATH'
- sed -i -e '2i'"$new_ldpath" \
- "${WORKDIR}/usr/bin/ghc-${PV}" \
- "${WORKDIR}/usr/bin/ghci-${PV}" \
- "${WORKDIR}/usr/bin/ghc-pkg-${PV}" \
- "${WORKDIR}/usr/bin/hsc2hs" \
- "${WORKDIR}/usr/bin/runghc-${PV}" \
- "$gp_back" \
- || die "Adding LD_LIBRARY_PATH for wrappers failed"
- fi
-
- # regenerate the binary package cache
- "$gp_back" recache || die "failed to update cache after relocation"
- rm "$gp_back"
-}
-
-pkg_setup() {
- # quiet portage about prebuilt binaries
- use binary && QA_PREBUILT="*"
-
- if use ghcbootstrap; then
- ewarn "You requested ghc bootstrapping, this is usually only used"
- ewarn "by Gentoo developers to make binary .tbz2 packages for"
- ewarn "use with the ghc ebuild's USE=\"binary\" feature."
- use binary && \
- die "USE=\"ghcbootstrap binary\" is not a valid combination."
- [[ -z $(type -P ghc) ]] && \
- die "Could not find a ghc to bootstrap with."
- else
- if ! yet_binary; then
- eerror "Please try emerging with USE=ghcbootstrap and report build"
- eerror "sucess or failure to the haskell team (haskell@gentoo.org)"
- die "No binary available for '${ARCH}' arch yet, USE=ghcbootstrap"
- fi
- fi
-}
-
-src_unpack() {
- # Create the ${S} dir if we're using the binary version
- use binary && mkdir "${S}"
-
- # the Solaris and Darwin binaries from ghc (maeder) need to be
- # unpacked separately, so prevent them from being unpacked
- local ONLYA=${A}
- case ${CHOST} in
- *-darwin* | *-solaris*) ONLYA=${P}-src.tar.bz2 ;;
- esac
- unpack ${ONLYA}
-}
-
-src_prepare() {
- ghc_setup_cflags
-
- if ! use ghcbootstrap && [[ ${CHOST} != *-darwin* && ${CHOST} != *-solaris* ]]; then
- # Modify the wrapper script from the binary tarball to use GHC_FLAGS.
- # See bug #313635.
- sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_FLAGS}|" \
- "${WORKDIR}/usr/bin/ghc-${PV}"
-
- # allow hardened users use vanilla binary to bootstrap ghc
- # ghci uses mmap with rwx protection at it implements dynamic
- # linking on it's own (bug #299709)
- pax-mark -m "${WORKDIR}/usr/$(get_libdir)/${P}/ghc"
- fi
-
- if use binary; then
- if use prefix; then
- relocate_ghc "${EPREFIX}"
- fi
-
- # Move unpacked files to the expected place
- mv "${WORKDIR}/usr" "${S}"
- else
- if ! use ghcbootstrap; then
- case ${CHOST} in
- *-darwin* | *-solaris*)
- # UPDATE ME for ghc-7
- mkdir "${WORKDIR}"/ghc-bin-installer || die
- pushd "${WORKDIR}"/ghc-bin-installer > /dev/null || die
- use sparc-solaris && unpack ghc-6.10.4-sparc-sun-solaris2.tar.bz2
- use x86-solaris && unpack ghc-7.0.3-i386-unknown-solaris2.tar.bz2
- use x86-macos && unpack ghc-7.4.1-i386-apple-darwin.tar.bz2
- use x64-macos && unpack ghc-7.4.1-x86_64-apple-darwin.tar.bz2
- popd > /dev/null
-
- pushd "${WORKDIR}"/ghc-bin-installer/ghc-[67].?*.? > /dev/null || die
- # fix the binaries so they run, on Solaris we need an
- # LD_LIBRARY_PATH which has our prefix libdirs, on
- # Darwin we need to replace the frameworks with our libs
- # from the prefix fix before installation, because some
- # of the tools are actually used during configure/make
- if [[ ${CHOST} == *-solaris* ]] ; then
- export LD_LIBRARY_PATH="${EPREFIX}/$(get_libdir):${EPREFIX}/usr/$(get_libdir):${LD_LIBRARY_PATH}"
- elif [[ ${CHOST} == *-darwin* ]] ; then
- local readline_framework=GNUreadline.framework/GNUreadline
- local gmp_framework=/opt/local/lib/libgmp.10.dylib
- local ncurses_file=/opt/local/lib/libncurses.5.dylib
- for binary in $(scanmacho -BRE MH_EXECUTE -F '%F' .) ; do
- install_name_tool -change \
- ${readline_framework} \
- "${EPREFIX}"/lib/libreadline.dylib \
- ${binary} || die
- install_name_tool -change \
- ${gmp_framework} \
- "${EPREFIX}"/usr/lib/libgmp.dylib \
- ${binary} || die
- install_name_tool -change \
- ${ncurses_file} \
- "${EPREFIX}"/usr/lib/libncurses.dylib \
- ${binary} || die
- done
- # we don't do frameworks!
- sed -i \
- -e 's/\(frameworks = \)\["GMP"\]/\1[]/g' \
- -e 's/\(extraLibraries = \)\["m"\]/\1["m","gmp"]/g' \
- rts/package.conf.in || die
- fi
-
- # it is autoconf, but we really don't want to give it too
- # much arguments, in fact we do the make in-place anyway
- ./configure --prefix="${WORKDIR}"/usr || die
- make install || die
- popd > /dev/null
- ;;
- *)
- relocate_ghc "${WORKDIR}"
- ;;
- esac
- fi
-
- sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_FLAGS}|" \
- "${S}/ghc/ghc.wrapper"
-
- cd "${S}" # otherwise epatch will break
-
- epatch "${FILESDIR}"/${PN}-7.0.4-CHOST-prefix.patch
-
- # epatch "${FILESDIR}"/${PN}-7.0.4-darwin8.patch
- # failed to apply. FIXME
- #epatch "${FILESDIR}"/${PN}-6.12.3-mach-o-relocation-limit.patch
-
- # epatch "${FILESDIR}"/${PN}-7.4-rc2-macos-prefix-respect-gcc.patch
- # epatch "${FILESDIR}"/${PN}-7.2.1-freebsd-CHOST.patch
-
- we_want_libffi_workaround() {
- use ghcmakebinary && return 1
-
- # pick only registerised arches
- # https://bugs.gentoo.org/463814
- use amd64 && return 0
- use x86 && return 0
- return 1
- }
- # one mode external depend with unstable ABI be careful to stash it
- # avoid external libffi runtime when we build binaries
- we_want_libffi_workaround && epatch "${FILESDIR}"/${PN}-7.5.20120505-system-libffi.patch
-
- epatch "${FILESDIR}"/${PN}-7.4.1-ticket-7339-fix-unaligned-unreg.patch
- epatch "${FILESDIR}"/${PN}-7.6.2-integer-simple-div-mod.patch
- # ghc-7.8 changed linker code and likely fixed it
- epatch "${FILESDIR}"/${PN}-7.6.3-trac-3333-weak-syms.patch
- # bug 518734
- epatch "${FILESDIR}"/${PN}-7.6.3-preserve-inplace-xattr.patch
-
- if use prefix; then
- # Make configure find docbook-xsl-stylesheets from Prefix
- sed -e '/^FP_DIR_DOCBOOK_XSL/s:\[.*\]:['"${EPREFIX}"'/usr/share/sgml/docbook/xsl-stylesheets/]:' \
- -i utils/haddock/doc/configure.ac || die
- fi
-
- # as we have changed the build system
- eautoreconf
- fi
-}
-
-src_configure() {
- GHC_PV=${PV} # overrided in live ebuilds
-
- if ! use binary; then
- # initialize build.mk
- echo '# Gentoo changes' > mk/build.mk
-
- # Put docs into the right place, ie /usr/share/doc/ghc-${PV}
- echo "docdir = ${EPREFIX}/usr/share/doc/${P}" >> mk/build.mk
- echo "htmldir = ${EPREFIX}/usr/share/doc/${P}" >> mk/build.mk
-
- # We also need to use the GHC_FLAGS flags when building ghc itself
- echo "SRC_HC_OPTS+=${GHC_FLAGS}" >> mk/build.mk
- echo "SRC_CC_OPTS+=${CFLAGS}" >> mk/build.mk
- echo "SRC_LD_OPTS+=${FILTERED_LDFLAGS}" >> mk/build.mk
-
- # We can't depend on haddock except when bootstrapping when we
- # must build docs and include them into the binary .tbz2 package
- # app-text/dblatex is not in portage, can not build PDF or PS
- if use ghcbootstrap && use doc; then
- echo "BUILD_DOCBOOK_PDF = NO" >> mk/build.mk
- echo "BUILD_DOCBOOK_PS = NO" >> mk/build.mk
- echo "BUILD_DOCBOOK_HTML = YES" >> mk/build.mk
- if is_crosscompile; then
- # TODO this is a workaround for this build error with the live ebuild with haddock:
- # make[1]: *** No rule to make target `compiler/stage2/build/Module.hi',
- # needed by `utils/haddock/dist/build/Main.o'. Stop.
- echo "HADDOCK_DOCS = NO" >> mk/build.mk
- else
- echo "HADDOCK_DOCS = YES" >> mk/build.mk
- fi
- else
- echo "BUILD_DOCBOOK_PDF = NO" >> mk/build.mk
- echo "BUILD_DOCBOOK_PS = NO" >> mk/build.mk
- echo "BUILD_DOCBOOK_HTML = NO" >> mk/build.mk
- echo "HADDOCK_DOCS = NO" >> mk/build.mk
- fi
-
- # circumvent a very strange bug that seems related with ghc producing
- # too much output while being filtered through tee (e.g. due to
- # portage logging) reported as bug #111183
- echo "SRC_HC_OPTS+=-w" >> mk/build.mk
-
- # some arches do not support ELF parsing for ghci module loading
- # PPC64: never worked (should be easy to implement)
- # alpha: never worked
- # arm: http://hackage.haskell.org/trac/ghc/changeset/27302c9094909e04eb73f200d52d5e9370c34a8a
- if use alpha || use ppc64; then
- echo "GhcWithInterpreter=NO" >> mk/build.mk
- fi
-
- # we have to tell it to build unregisterised on some arches
- # ppc64: EvilMangler currently does not understand some TOCs
- # ia64: EvilMangler bitrot
- # set GHC_IS_UNREG if you like to build slow unregisterised
- # host compiler. Handy if you plan to user resulting
- # host compiler as a booting compiler for crosscompiler
- # which can work only in unregisterised mode.
- if use alpha || use ia64 || use ppc64 || [[ -n ${GHC_IS_UNREG} ]]; then
- echo "GhcUnregisterised=YES" >> mk/build.mk
- echo "GhcWithNativeCodeGen=NO" >> mk/build.mk
- echo "SplitObjs=NO" >> mk/build.mk
- echo "GhcRTSWays := debug" >> mk/build.mk
- echo "GhcNotThreaded=YES" >> mk/build.mk
- fi
-
- # arm: no EvilMangler support, no NCG support
- if use arm; then
- echo "GhcUnregisterised=YES" >> mk/build.mk
- echo "GhcWithNativeCodeGen=NO" >> mk/build.mk
- fi
-
- # Have "ld -r --relax" problem with split-objs on sparc:
- if use sparc; then
- echo "SplitObjs=NO" >> mk/build.mk
- fi
-
- if ! use llvm; then
- echo "GhcWithLlvmCodeGen=NO" >> mk/build.mk
- fi
-
- # allows overriding build flavours for libraries:
- # v - vanilla (static libs)
- # p - profiled
- # dyn - shared libraries
- # example: GHC_LIBRARY_WAYS="v dyn"
- if [[ -n ${GHC_LIBRARY_WAYS} ]]; then
- echo "GhcLibWays=${GHC_LIBRARY_WAYS}" >> mk/build.mk
- fi
-
- # Get ghc from the unpacked binary .tbz2
- # except when bootstrapping we just pick ghc up off the path
- if ! use ghcbootstrap; then
- export PATH="${WORKDIR}/usr/bin:${PATH}"
- fi
-
- if use gmp; then
- echo "INTEGER_LIBRARY=integer-gmp" >> mk/build.mk
- else
- echo "INTEGER_LIBRARY=integer-simple" >> mk/build.mk
- fi
-
- # Since GHC 6.12.2 the GHC wrappers store which GCC version GHC was
- # compiled with, by saving the path to it. The purpose is to make sure
- # that GHC will use the very same gcc version when it compiles haskell
- # sources, as the extra-gcc-opts files contains extra gcc options which
- # match only this GCC version.
- # However, this is not required in Gentoo, as only modern GCCs are used
- # (>4).
- # Instead, this causes trouble when for example ccache is used during
- # compilation, but we don't want the wrappers to point to ccache.
- # Due to the above, we simply set GCC to be "gcc". When compiling ghc it
- # might point to ccache, once installed it will point to the users
- # regular gcc.
-
- local econf_args=()
-
- is_crosscompile || econf_args+=--with-gcc=${CHOST}-gcc
-
- econf ${econf_args[@]} --enable-bootstrap-with-devel-snapshot \
- || die "econf failed"
-
- [[ ${PV} == *9999* ]] && GHC_PV="$(grep 'S\[\"PACKAGE_VERSION\"\]' config.status | sed -e 's@^.*=\"\(.*\)\"@\1@')"
- GHC_TPF="$(grep 'S\[\"TargetPlatformFull\"\]' config.status | sed -e 's@^.*=\"\(.*\)\"@\1@')"
- fi # ! use binary
-}
-
-src_compile() {
- if ! use binary; then
- limit_jobs() {
- local user_jobs=$(makeopts_jobs)
- local max_nonbreaking_jobs=$1
-
- [[ ${user_jobs} -le ${max_nonbreaking_jobs} ]] && return
-
- if [[ -n ${I_DEMAND_MY_CORES_LOADED} ]]; then
- ewarn "You have requested parallel build which is known to break."
- ewarn "Please report all breakages upstream."
- return
- else
- ewarn "Limiting MAKEOPTS -j${user_jobs} -> -j${max_nonbreaking_jobs} (bug #456386)"
- user_jobs=${max_nonbreaking_jobs}
- fi
- echo -j${user_jobs}
- }
- # ghc massively parallel make: #409631, #409873
- # but let users screw it by setting 'I_DEMAND_MY_CORES_LOADED'
- # 4 parallel jobs usually does not break
-
- # 1. build compiler binary first
- emake $(limit_jobs 4) ghc/stage2/build/tmp/ghc-stage2 V=1
- # 2. pax-mark (bug #516430)
- pax-mark -m ghc/stage2/build/tmp/ghc-stage2
- # 3. and then all the rest
- emake $(limit_jobs 4) all V=1
-
- if is_crosscompile; then
- # runghc does not work for a stage1 compiler, we can build it anyway
- # so it will print the error message: not built for interactive use
- pushd "${S}/utils/runghc" || die "Could not cd to utils/runghc"
- if [ ! -f Setup.hs ]; then
- echo 'import Distribution.Simple; main = defaultMainWithHooks defaultUserHooks' \
- > Setup.hs || die "failed to create default Setup.hs"
- fi
- ghc -o setup --make Setup.hs || die "setup build failed"
- ./setup configure || die "runghc configure failed"
- sed -e "s@VERSION@\"${GHC_PV}\"@" -i runghc.hs
- ./setup build || die "runghc build failed"
- popd
- fi
- fi # ! use binary
-}
-
-add-c_nonshared-to-ghci-libs() {
- local ghci_lib
- local nonshared_dir=${T}/libc_nonshared_objects
-
- is_crosscompile && return
- use elibc_glibc || return
- use prefix && return
-
- # we expect 'libc.a' bits be self-sufficient
- if gcc-specs-pie; then
- use x86 && return # but on x86 pie means linker support: #486140
- fi
-
- get-nonshared-objects() {
- # ns - 'nonshared'
- local ns_objects=" "
- local ns_sym
- local ns_srco
- local ns_dsto
-
- # extract
- mkdir "${nonshared_dir}" || die
- pushd "${nonshared_dir}" >/dev/null || die
- $(tc-getAR) x "${ROOT}"/usr/$(get_libdir)/libc.a
- popd >/dev/null || die
-
- # they are mostly contents of /usr/$(get_libdir)/libc_nonstahed.a
- # but 'c_nonstahed' contains PIC variants of symbols.
- # ghci uses non-PIC ones
- for ns_sym in \
- stat fstat lstat mknod \
- stat64 fstat64 lstat64 \
- fstatat fstatat64 mknodat
- do
- ns_srco=${nonshared_dir}/${ns_sym}.o
- ns_dsto=${nonshared_dir}/${ns_sym}_weakened.o
- [[ -f ${ns_srco} ]] || continue
- # here we do The Magic:
- # 1. --keep-global-symbol= hides everything to adoid double definition
- # of stuff like __stat, __fstat and
- # 2. --weaken converts exported symbols to weak symbols to be available
- # for redefinition
- $(tc-getOBJCOPY) \
- --weaken --keep-global-symbol=${ns_sym} \
- "${ns_srco}" "${ns_dsto}" || die
-
- ns_objects+=" ${ns_dsto}"
- done
-
- echo "${ns_objects}"
- }
- # bug #452442: when building libraries for ghci
- # ghc basically glues them together:
- # $ ld -r -o result foo.o bar.o ...
- # that way some symbols defined in libc_nonshared.a
- # do not get included into final HS*.o files
- # We piggyback on one of early loaded wired-in library
- # loaded before 'base'.
- while read ghci_lib
- do
- einfo "relinking '${ghci_lib}' with c_includes"
- mv "${ghci_lib}" "${ghci_lib}".unrelinked.o || die
- $(tc-getLD) -r -o "${ghci_lib}" \
- "${ghci_lib}".unrelinked.o \
- $(get-nonshared-objects) || die
- rm -r "${nonshared_dir}" || die
- rm "${ghci_lib}".unrelinked.o || die
- done < <(find "${ED}"/usr/$(get_libdir)/${P}/ -name 'HSghc-prim*.o')
-}
-
-src_install() {
- if use binary; then
- use prefix && mkdir -p "${ED}"
- mv "${S}/usr" "${ED}"
-
- # Remove the docs if not requested
- if ! use doc; then
- rm -rf "${ED}/usr/share/doc/${P}/*/" \
- "${ED}/usr/share/doc/${P}/*.html" \
- || die "could not remove docs (P vs PF revision mismatch?)"
- fi
- else
- local insttarget="install"
-
- # We only built docs if we were bootstrapping, otherwise
- # we copy them out of the unpacked binary .tbz2
- if use doc && ! use ghcbootstrap; then
- mkdir -p "${ED}/usr/share/doc"
- mv "${WORKDIR}/usr/share/doc/${P}" "${ED}/usr/share/doc" \
- || die "failed to copy docs"
- else
- dodoc "${S}/README" "${S}/ANNOUNCE" "${S}/LICENSE" "${S}/VERSION"
- fi
-
- emake -j1 ${insttarget} \
- DESTDIR="${D}" \
- || die "make ${insttarget} failed"
-
- # remove wrapper and link
- rm -f "${ED}"/usr/bin/haddock*
-
- add-c_nonshared-to-ghci-libs
-
- if [[ ! -f "${S}/VERSION" ]]; then
- echo "${GHC_PV}" > "${S}/VERSION" \
- || die "Could not create file ${S}/VERSION"
- fi
- dobashcomp "${FILESDIR}/ghc-bash-completion"
-
- fi
-
- # path to the package.cache
- local package_confdir="${ED}/usr/$(get_libdir)/${PN}-${GHC_PV}/package.conf.d"
- PKGCACHE="${package_confdir}"/package.cache
- # copy the package.conf.d, including timestamp, save it so we can help
- # users that have a broken package.conf.d
- cp -pR "${package_confdir}"{,.initial} || die "failed to backup intial package.conf.d"
-
- # copy the package.conf, including timestamp, save it so we later can put it
- # back before uninstalling, or when upgrading.
- cp -p "${PKGCACHE}"{,.shipped} \
- || die "failed to copy package.conf.d/package.cache"
-}
-
-pkg_preinst() {
- # have we got an earlier version of ghc installed?
- if has_version "<${CATEGORY}/${PF}"; then
- haskell_updater_warn="1"
- fi
-}
-
-pkg_postinst() {
- ghc-reregister
-
- # path to the package.cache
- PKGCACHE="${EROOT}/usr/$(get_libdir)/${P}/package.conf.d/package.cache"
-
- # give the cache a new timestamp, it must be as recent as
- # the package.conf.d directory.
- touch "${PKGCACHE}"
-
- if [[ "${haskell_updater_warn}" == "1" ]]; then
- ewarn
- ewarn "\e[1;31m************************************************************************\e[0m"
- ewarn
- ewarn "You have just upgraded from an older version of GHC."
- ewarn "You may have to run"
- ewarn " 'haskell-updater --upgrade'"
- ewarn "to rebuild all ghc-based Haskell libraries."
- ewarn
- ewarn "\e[1;31m************************************************************************\e[0m"
- ewarn
- fi
- if is_crosscompile; then
- ewarn
- ewarn "\e[1;31m************************************************************************\e[0m"
- ewarn
- ewarn "GHC built as a cross compiler. The interpreter, ghci and runghc, do"
- ewarn "not work for a cross compiler."
- ewarn "For the ghci error: \"<command line>: not built for interactive use\" see:"
- ewarn "http://www.haskell.org/haskellwiki/GHC:FAQ#When_I_try_to_start_ghci_.28probably_one_I_compiled_myself.29_it_says_ghc-5.02:_not_built_for_interactive_use"
- ewarn
- ewarn "\e[1;31m************************************************************************\e[0m"
- ewarn
- fi
-}
-
-pkg_prerm() {
- # Be very careful here... Call order when upgrading is (according to PMS):
- # * src_install for new package
- # * pkg_preinst for new package
- # * pkg_postinst for new package
- # * pkg_prerm for the package being replaced
- # * pkg_postrm for the package being replaced
- # so you'll actually be touching the new packages files, not the one you
- # uninstall, due to that or installation directory ${P} will be the same for
- # both packages.
-
- # Call order for reinstalling is (according to PMS):
- # * src_install
- # * pkg_preinst
- # * pkg_prerm for the package being replaced
- # * pkg_postrm for the package being replaced
- # * pkg_postinst
-
- # Overwrite the modified package.cache with a copy of the
- # original one, so that it will be removed during uninstall.
-
- PKGCACHE="${EROOT}/usr/$(get_libdir)/${P}/package.conf.d/package.cache"
- rm -rf "${PKGCACHE}"
-
- cp -p "${PKGCACHE}"{.shipped,}
-}
-
-pkg_postrm() {
- ghc-package_pkg_postrm
-}
diff --git a/dev-lang/ghc/ghc-7.8.3.ebuild b/dev-lang/ghc/ghc-7.8.3.ebuild
deleted file mode 100644
index 30b7aa5..00000000
--- a/dev-lang/ghc/ghc-7.8.3.ebuild
+++ /dev/null
@@ -1,624 +0,0 @@
-# Copyright 1999-2016 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Id$
-
-EAPI=5
-
-# to make make a crosscompiler use crossdev and symlink ghc tree into
-# cross overlay. result would look like 'cross-sparc-unknown-linux-gnu/ghc'
-#
-# 'CTARGET' definition and 'is_crosscompile' are taken from 'toolchain.eclass'
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} = ${CHOST} ]] ; then
- if [[ ${CATEGORY/cross-} != ${CATEGORY} ]] ; then
- export CTARGET=${CATEGORY/cross-}
- fi
-fi
-
-inherit autotools bash-completion-r1 eutils flag-o-matic ghc-package
-inherit multilib pax-utils toolchain-funcs versionator
-
-DESCRIPTION="The Glasgow Haskell Compiler"
-HOMEPAGE="http://www.haskell.org/ghc/"
-
-# we don't have any binaries yet
-arch_binaries=""
-
-# sorted!
-#arch_binaries="$arch_binaries alpha? ( http://code.haskell.org/~slyfox/ghc-alpha/ghc-bin-${PV}-alpha.tbz2 )"
-#arch_binaries="$arch_binaries arm? ( http://code.haskell.org/~slyfox/ghc-arm/ghc-bin-${PV}-arm.tbz2 )"
-arch_binaries="$arch_binaries amd64? ( http://code.haskell.org/~slyfox/ghc-amd64/ghc-bin-${PV}-amd64.tbz2 )"
-#arch_binaries="$arch_binaries ia64? ( http://code.haskell.org/~slyfox/ghc-ia64/ghc-bin-${PV}-ia64-fixed-fiw.tbz2 )"
-#arch_binaries="$arch_binaries ppc? ( http://code.haskell.org/~slyfox/ghc-ppc/ghc-bin-${PV}-ppc.tbz2 )"
-#arch_binaries="$arch_binaries ppc64? ( http://code.haskell.org/~slyfox/ghc-ppc64/ghc-bin-${PV}-ppc64.tbz2 )"
-#arch_binaries="$arch_binaries sparc? ( http://code.haskell.org/~slyfox/ghc-sparc/ghc-bin-${PV}-sparc.tbz2 )"
-arch_binaries="$arch_binaries x86? ( http://code.haskell.org/~slyfox/ghc-x86/ghc-bin-${PV}-x86.tbz2 )"
-
-# various ports:
-#arch_binaries="$arch_binaries x86-fbsd? ( http://code.haskell.org/~slyfox/ghc-x86-fbsd/ghc-bin-${PV}-x86-fbsd.tbz2 )"
-
-# 0 - yet
-yet_binary() {
- case "${ARCH}" in
- #alpha) return 0 ;;
- #arm)
- # ewarn "ARM binary is built on armv5tel-eabi toolchain. Use with caution."
- # return 0
- #;;
- amd64) return 0 ;;
- #ia64) return 0 ;;
- #ppc) return 0 ;;
- #ppc64) return 0 ;;
- #sparc) return 0 ;;
- x86) return 0 ;;
- *) return 1 ;;
- esac
-}
-
-GHC_PV=${PV}
-#GHC_PV=7.8.0.20140228 # uncomment only for -rc ebuilds
-GHC_P=${PN}-${GHC_PV} # using ${P} is almost never correct
-
-SRC_URI="!binary? ( http://www.haskell.org/ghc/dist/${PV/_rc/-rc}/${GHC_P}-src.tar.xz )"
-S="${WORKDIR}"/${GHC_P}
-
-[[ -n $arch_binaries ]] && SRC_URI+=" !ghcbootstrap? ( $arch_binaries )"
-LICENSE="BSD"
-SLOT="0/${PV}"
-KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
-IUSE="doc ghcbootstrap ghcmakebinary +gmp"
-IUSE+=" binary"
-IUSE+=" elibc_glibc" # system stuff
-
-RDEPEND="
- >=dev-lang/perl-5.6.1
- >=dev-libs/gmp-5:=
- sys-libs/ncurses:=[unicode]
- !ghcmakebinary? ( virtual/libffi:= )
- !kernel_Darwin? ( >=sys-devel/gcc-2.95.3 )
- kernel_linux? ( >=sys-devel/binutils-2.17 )
- kernel_SunOS? ( >=sys-devel/binutils-2.17 )
-"
-# gentoo binaries are built against ncurses-5
-RDEPEND+="
- binary? (
- || (
- sys-libs/ncurses:0/5
- sys-libs/ncurses:5/5
- )
- )
-"
-
-# force dependency on >=gmp-5, even if >=gmp-4.1 would be enough. this is due to
-# that we want the binaries to use the latest versioun available, and not to be
-# built against gmp-4
-
-# similar for glibc. we have bootstrapped binaries against glibc-2.17
-DEPEND="${RDEPEND}
- ghcbootstrap? (
- doc? ( app-text/docbook-xml-dtd:4.2
- app-text/docbook-xml-dtd:4.5
- app-text/docbook-xsl-stylesheets
- >=dev-libs/libxslt-1.1.2 ) )
- !ghcbootstrap? ( !prefix? ( elibc_glibc? ( >=sys-libs/glibc-2.17 ) ) )"
-
-PDEPEND="!ghcbootstrap? ( =app-admin/haskell-updater-1.2* )"
-
-REQUIRED_USE="?? ( ghcbootstrap binary )"
-
-# haskell libraries built with cabal in configure mode, #515354
-QA_CONFIGURE_OPTIONS+=" --with-compiler --with-gcc"
-
-is_crosscompile() {
- [[ ${CHOST} != ${CTARGET} ]]
-}
-
-append-ghc-cflags() {
- local persistent compile assemble link
- local flag ghcflag
-
- for flag in $*; do
- case ${flag} in
- persistent) persistent="yes";;
- compile) compile="yes";;
- assemble) assemble="yes";;
- link) link="yes";;
- *)
- [[ ${compile} ]] && ghcflag="-optc${flag}" CFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
- [[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
- [[ ${assemble} ]] && ghcflag="-opta${flag}" CFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
- [[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
- [[ ${link} ]] && ghcflag="-optl${flag}" LDFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
- [[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
- ;;
- esac
- done
-}
-
-ghc_setup_cflags() {
- if is_crosscompile; then
- export CFLAGS=${GHC_CFLAGS-"-O2 -pipe"}
- export LDFLAGS=${GHC_LDFLAGS-"-Wl,-O1"}
- einfo "Crosscompiling mode:"
- einfo " CHOST: ${CHOST}"
- einfo " CTARGET: ${CTARGET}"
- einfo " CFLAGS: ${CFLAGS}"
- einfo " LDFLAGS: ${LDFLAGS}"
- return
- fi
- # We need to be very careful with the CFLAGS we ask ghc to pass through to
- # gcc. There are plenty of flags which will make gcc produce output that
- # breaks ghc in various ways. The main ones we want to pass through are
- # -mcpu / -march flags. These are important for arches like alpha & sparc.
- # We also use these CFLAGS for building the C parts of ghc, ie the rts.
- strip-flags
- strip-unsupported-flags
-
- # Cmm can't parse line numbers #482086
- replace-flags -ggdb[3-9] -ggdb2
-
- GHC_FLAGS=""
- GHC_PERSISTENT_FLAGS=""
- for flag in ${CFLAGS}; do
- case ${flag} in
-
- # Ignore extra optimisation (ghc passes -O to gcc anyway)
- # -O2 and above break on too many systems
- -O*) ;;
-
- # Arch and ABI flags are what we're really after
- -m*) append-ghc-cflags compile assemble ${flag};;
-
- # Sometimes it's handy to see backtrace of RTS
- # to get an idea what happens there
- -g*) append-ghc-cflags compile ${flag};;
-
- # Ignore all other flags, including all -f* flags
- esac
- done
-
- for flag in ${LDFLAGS}; do
- append-ghc-cflags link ${flag}
- done
-
- # hardened-gcc needs to be disabled, because the mangler doesn't accept
- # its output.
- gcc-specs-pie && append-ghc-cflags persistent compile link -nopie
- gcc-specs-ssp && append-ghc-cflags persistent compile -fno-stack-protector
-
- # prevent from failind building unregisterised ghc:
- # http://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg171602.html
- use ppc64 && append-ghc-cflags persistent compile -mminimal-toc
- # fix the similar issue as ppc64 TOC on ia64. ia64 has limited size of small data
- # currently ghc fails to build haddock
- # http://osdir.com/ml/gnu.binutils.bugs/2004-10/msg00050.html
- use ia64 && append-ghc-cflags persistent compile -G0 -Os
-}
-
-# substitutes string $1 to $2 in files $3 $4 ...
-relocate_path() {
- local from=$1
- local to=$2
- shift 2
- local file=
- for file in "$@"
- do
- sed -i -e "s|$from|$to|g" \
- "$file" || die "path relocation failed for '$file'"
- done
-}
-
-# changes hardcoded ghc paths and updates package index
-# $1 - new absolute root path
-relocate_ghc() {
- local to=$1
-
- # libdir for prebuilt binary and for current system may mismatch
- # It does for prefix installation for example: bug #476998
- local bin_ghc_prefix=${WORKDIR}/usr
- local bin_libpath=$(echo "${bin_ghc_prefix}"/lib*)
- local bin_libdir=${bin_libpath#${bin_ghc_prefix}/}
-
- # backup original script to use it later after relocation
- local gp_back="${T}/ghc-pkg-${GHC_PV}-orig"
- cp "${WORKDIR}/usr/bin/ghc-pkg-${GHC_PV}" "$gp_back" || die "unable to backup ghc-pkg wrapper"
-
- if [[ ${bin_libdir} != $(get_libdir) ]]; then
- einfo "Relocating '${bin_libdir}' to '$(get_libdir)' (bug #476998)"
- # moving the dir itself is not strictly needed
- # but then USE=binary would result in installing
- # in '${bin_libdir}'
- mv "${bin_ghc_prefix}/${bin_libdir}" "${bin_ghc_prefix}/$(get_libdir)" || die
-
- relocate_path "/usr/${bin_libdir}" "/usr/$(get_libdir)" \
- "${WORKDIR}/usr/bin/ghc-${GHC_PV}" \
- "${WORKDIR}/usr/bin/ghci-${GHC_PV}" \
- "${WORKDIR}/usr/bin/ghc-pkg-${GHC_PV}" \
- "${WORKDIR}/usr/bin/hsc2hs" \
- "${WORKDIR}/usr/bin/runghc-${GHC_PV}" \
- "$gp_back" \
- "${WORKDIR}/usr/$(get_libdir)/${GHC_P}/package.conf.d/"*
- fi
-
- # Relocate from /usr to ${EPREFIX}/usr
- relocate_path "/usr" "${to}/usr" \
- "${WORKDIR}/usr/bin/ghc-${GHC_PV}" \
- "${WORKDIR}/usr/bin/ghci-${GHC_PV}" \
- "${WORKDIR}/usr/bin/ghc-pkg-${GHC_PV}" \
- "${WORKDIR}/usr/bin/hsc2hs" \
- "${WORKDIR}/usr/bin/runghc-${GHC_PV}" \
- "${WORKDIR}/usr/$(get_libdir)/${GHC_P}/package.conf.d/"*
-
- # this one we will use to regenerate cache
- # so it should point to current tree location
- relocate_path "/usr" "${WORKDIR}/usr" "$gp_back"
-
- if use prefix; then
- # and insert LD_LIBRARY_PATH entry to EPREFIX dir tree
- # TODO: add the same for darwin's CHOST and it's DYLD_
- local new_ldpath='LD_LIBRARY_PATH="'${EPREFIX}/$(get_libdir):${EPREFIX}/usr/$(get_libdir)'${LD_LIBRARY_PATH:+:}${LD_LIBRARY_PATH}"\nexport LD_LIBRARY_PATH'
- sed -i -e '2i'"$new_ldpath" \
- "${WORKDIR}/usr/bin/ghc-${GHC_PV}" \
- "${WORKDIR}/usr/bin/ghci-${GHC_PV}" \
- "${WORKDIR}/usr/bin/ghc-pkg-${GHC_PV}" \
- "${WORKDIR}/usr/bin/hsc2hs" \
- "${WORKDIR}/usr/bin/runghc-${GHC_PV}" \
- "$gp_back" \
- "${WORKDIR}/usr/bin/hsc2hs" \
- || die "Adding LD_LIBRARY_PATH for wrappers failed"
- fi
-
- # regenerate the binary package cache
- "$gp_back" recache || die "failed to update cache after relocation"
- rm "$gp_back"
-}
-
-pkg_setup() {
- # quiet portage about prebuilt binaries
- use binary && QA_PREBUILT="*"
-
- if use ghcbootstrap; then
- ewarn "You requested ghc bootstrapping, this is usually only used"
- ewarn "by Gentoo developers to make binary .tbz2 packages."
-
- [[ -z $(type -P ghc) ]] && \
- die "Could not find a ghc to bootstrap with."
- else
- if ! yet_binary; then
- eerror "Please try emerging with USE=ghcbootstrap and report build"
- eerror "sucess or failure to the haskell team (haskell@gentoo.org)"
- die "No binary available for '${ARCH}' arch yet, USE=ghcbootstrap"
- fi
- fi
-}
-
-src_unpack() {
- # Create the ${S} dir if we're using the binary version
- use binary && mkdir "${S}"
-
- # the Solaris and Darwin binaries from ghc (maeder) need to be
- # unpacked separately, so prevent them from being unpacked
- local ONLYA=${A}
- case ${CHOST} in
- *-darwin* | *-solaris*) ONLYA=${GHC_P}-src.tar.bz2 ;;
- esac
- unpack ${ONLYA}
-
- if [[ -d "${S}"/libraries/dph ]]; then
- # Sometimes dph libs get accidentally shipped with ghc
- # but they are not installed unless user requests it.
- # We never install them.
- elog "Removing 'libraries/dph'"
- rm -rf "${S}"/libraries/dph
- fi
-}
-
-src_prepare() {
- ghc_setup_cflags
-
- if ! use ghcbootstrap && [[ ${CHOST} != *-darwin* && ${CHOST} != *-solaris* ]]; then
- # Modify the wrapper script from the binary tarball to use GHC_PERSISTENT_FLAGS.
- # See bug #313635.
- sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_PERSISTENT_FLAGS}|" \
- "${WORKDIR}/usr/bin/ghc-${GHC_PV}"
-
- # allow hardened users use vanilla binary to bootstrap ghc
- # ghci uses mmap with rwx protection at it implements dynamic
- # linking on it's own (bug #299709)
- pax-mark -m "${WORKDIR}/usr/$(get_libdir)/${GHC_P}/bin/ghc"
- fi
-
- if use binary; then
- if use prefix; then
- relocate_ghc "${EPREFIX}"
- fi
-
- # Move unpacked files to the expected place
- mv "${WORKDIR}/usr" "${S}"
- else
- if ! use ghcbootstrap; then
- case ${CHOST} in
- *-darwin* | *-solaris*)
- # UPDATE ME for ghc-7
- mkdir "${WORKDIR}"/ghc-bin-installer || die
- pushd "${WORKDIR}"/ghc-bin-installer > /dev/null || die
- use sparc-solaris && unpack ghc-6.10.4-sparc-sun-solaris2.tar.bz2
- use x86-solaris && unpack ghc-7.0.3-i386-unknown-solaris2.tar.bz2
- use x86-macos && unpack ghc-7.4.1-i386-apple-darwin.tar.bz2
- use x64-macos && unpack ghc-7.4.1-x86_64-apple-darwin.tar.bz2
- popd > /dev/null
-
- pushd "${WORKDIR}"/ghc-bin-installer/ghc-[67].?*.? > /dev/null || die
- # fix the binaries so they run, on Solaris we need an
- # LD_LIBRARY_PATH which has our prefix libdirs, on
- # Darwin we need to replace the frameworks with our libs
- # from the prefix fix before installation, because some
- # of the tools are actually used during configure/make
- if [[ ${CHOST} == *-solaris* ]] ; then
- export LD_LIBRARY_PATH="${EPREFIX}/$(get_libdir):${EPREFIX}/usr/$(get_libdir):${LD_LIBRARY_PATH}"
- elif [[ ${CHOST} == *-darwin* ]] ; then
- local readline_framework=GNUreadline.framework/GNUreadline
- local gmp_framework=/opt/local/lib/libgmp.10.dylib
- local ncurses_file=/opt/local/lib/libncurses.5.dylib
- for binary in $(scanmacho -BRE MH_EXECUTE -F '%F' .) ; do
- install_name_tool -change \
- ${readline_framework} \
- "${EPREFIX}"/lib/libreadline.dylib \
- ${binary} || die
- install_name_tool -change \
- ${gmp_framework} \
- "${EPREFIX}"/usr/lib/libgmp.dylib \
- ${binary} || die
- install_name_tool -change \
- ${ncurses_file} \
- "${EPREFIX}"/usr/lib/libncurses.dylib \
- ${binary} || die
- done
- # we don't do frameworks!
- sed -i \
- -e 's/\(frameworks = \)\["GMP"\]/\1[]/g' \
- -e 's/\(extraLibraries = \)\["m"\]/\1["m","gmp"]/g' \
- rts/package.conf.in || die
- fi
-
- # it is autoconf, but we really don't want to give it too
- # much arguments, in fact we do the make in-place anyway
- ./configure --prefix="${WORKDIR}"/usr || die
- make install || die
- popd > /dev/null
- ;;
- *)
- relocate_ghc "${WORKDIR}"
- ;;
- esac
- fi
-
- sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_PERSISTENT_FLAGS}|" \
- "${S}/ghc/ghc.wrapper"
-
- cd "${S}" # otherwise epatch will break
-
- epatch "${FILESDIR}"/${PN}-7.0.4-CHOST-prefix.patch
-
- epatch "${FILESDIR}"/${PN}-7.8.1_rc1-libbfd.patch
-
- epatch "${FILESDIR}"/${PN}-7.8.2-cgen-constify.patch
- epatch "${FILESDIR}"/${PN}-7.8.3-prim-lm.patch
- # bug 518734
- epatch "${FILESDIR}"/${PN}-7.6.3-preserve-inplace-xattr.patch
- epatch "${FILESDIR}"/${PN}-7.8.3-unreg-lit.patch
-
- # upstream backports
- epatch "${FILESDIR}"/${PN}-7.8.3-linker-warn.patch
- epatch "${FILESDIR}"/${PN}-7.8.3-deRefStablePtr.patch
- epatch "${FILESDIR}"/${PN}-7.8.3-pic-asm.patch
- epatch "${FILESDIR}"/${PN}-7.8.3-pic-sparc.patch
- epatch "${FILESDIR}"/${PN}-7.8.3-cc-lang.patch
- epatch "${FILESDIR}"/${PN}-7.8.3-ia64-prim.patch
-
- if use prefix; then
- # Make configure find docbook-xsl-stylesheets from Prefix
- sed -e '/^FP_DIR_DOCBOOK_XSL/s:\[.*\]:['"${EPREFIX}"'/usr/share/sgml/docbook/xsl-stylesheets/]:' \
- -i utils/haddock/doc/configure.ac || die
- fi
-
- # as we have changed the build system
- eautoreconf
- fi
-}
-
-src_configure() {
- if ! use binary; then
- # initialize build.mk
- echo '# Gentoo changes' > mk/build.mk
-
- # Put docs into the right place, ie /usr/share/doc/ghc-${GHC_PV}
- echo "docdir = ${EPREFIX}/usr/share/doc/${P}" >> mk/build.mk
- echo "htmldir = ${EPREFIX}/usr/share/doc/${P}" >> mk/build.mk
-
- # We also need to use the GHC_FLAGS flags when building ghc itself
- echo "SRC_HC_OPTS+=${GHC_FLAGS}" >> mk/build.mk
- echo "SRC_CC_OPTS+=${CFLAGS}" >> mk/build.mk
- echo "SRC_LD_OPTS+=${LDFLAGS}" >> mk/build.mk
-
- # We can't depend on haddock except when bootstrapping when we
- # must build docs and include them into the binary .tbz2 package
- # app-text/dblatex is not in portage, can not build PDF or PS
- if use ghcbootstrap && use doc; then
- echo "BUILD_DOCBOOK_PDF = NO" >> mk/build.mk
- echo "BUILD_DOCBOOK_PS = NO" >> mk/build.mk
- echo "BUILD_DOCBOOK_HTML = YES" >> mk/build.mk
- echo "HADDOCK_DOCS = YES" >> mk/build.mk
- else
- echo "BUILD_DOCBOOK_PDF = NO" >> mk/build.mk
- echo "BUILD_DOCBOOK_PS = NO" >> mk/build.mk
- echo "BUILD_DOCBOOK_HTML = NO" >> mk/build.mk
- echo "HADDOCK_DOCS = NO" >> mk/build.mk
- fi
-
- # allows overriding build flavours for libraries:
- # v - vanilla (static libs)
- # p - profiled
- # dyn - shared libraries
- # example: GHC_LIBRARY_WAYS="v dyn"
- if [[ -n ${GHC_LIBRARY_WAYS} ]]; then
- echo "GhcLibWays=${GHC_LIBRARY_WAYS}" >> mk/build.mk
- fi
-
- # Get ghc from the unpacked binary .tbz2
- # except when bootstrapping we just pick ghc up off the path
- if ! use ghcbootstrap; then
- export PATH="${WORKDIR}/usr/bin:${PATH}"
- fi
-
- if use gmp; then
- echo "INTEGER_LIBRARY=integer-gmp" >> mk/build.mk
- else
- echo "INTEGER_LIBRARY=integer-simple" >> mk/build.mk
- fi
-
- # don't strip anything. Very useful when stage2 SIGSEGVs on you
- echo "STRIP_CMD = :" >> mk/build.mk
-
- local econf_args=()
-
- # GHC embeds 'gcc' it was built by and uses it later.
- # Don't allow things like ccache or versioned binary slip.
- # We use stable thing across gcc upgrades.
- is_crosscompile || econf_args+=(--with-gcc=${CHOST}-gcc)
-
- if ! use ghcmakebinary; then
- econf_args+=(--with-system-libffi)
- econf_args+=(--with-ffi-includes=$(pkg-config libffi --cflags-only-I | sed -e 's@^-I@@'))
- fi
-
- econf ${econf_args[@]} --enable-bootstrap-with-devel-snapshot
-
- if [[ ${PV} == *9999* ]]; then
- GHC_PV="$(grep 'S\[\"PACKAGE_VERSION\"\]' config.status | sed -e 's@^.*=\"\(.*\)\"@\1@')"
- GHC_P=${PN}-${GHC_PV}
- fi
- GHC_TPF="$(grep 'S\[\"TargetPlatformFull\"\]' config.status | sed -e 's@^.*=\"\(.*\)\"@\1@')"
- fi # ! use binary
-}
-
-src_compile() {
- if ! use binary; then
- # 1. build compiler binary first
- emake ghc/stage2/build/tmp/ghc-stage2
- # 2. pax-mark (bug #516430)
- pax-mark -m ghc/stage2/build/tmp/ghc-stage2
- # 3. and then all the rest
- emake all
- fi # ! use binary
-}
-
-src_install() {
- if use binary; then
- use prefix && mkdir -p "${ED}"
- mv "${S}/usr" "${ED}"
-
- # Remove the docs if not requested
- if ! use doc; then
- rm -rf "${ED}/usr/share/doc/${P}/*/" \
- "${ED}/usr/share/doc/${P}/*.html" \
- || die "could not remove docs (P vs PF revision mismatch?)"
- fi
- else
- # We only build docs if we were bootstrapping, otherwise
- # we copy them out of the unpacked binary .tbz2
- if use doc && ! use ghcbootstrap; then
- mkdir -p "${ED}/usr/share/doc"
- mv "${WORKDIR}/usr/share/doc/${P}" "${ED}/usr/share/doc" \
- || die "failed to copy docs"
- else
- dodoc "${S}/distrib/README" "${S}/ANNOUNCE" "${S}/LICENSE" "${S}/VERSION"
- fi
-
- emake -j1 install DESTDIR="${D}"
-
- # remove link, but leave 'haddock-${GHC_P}'
- rm -f "${ED}"/usr/bin/haddock
-
- if [[ ! -f "${S}/VERSION" ]]; then
- echo "${GHC_PV}" > "${S}/VERSION" \
- || die "Could not create file ${S}/VERSION"
- fi
- dobashcomp "${FILESDIR}/ghc-bash-completion"
-
- fi
-
- # path to the package.cache
- local package_confdir="${ED}/usr/$(get_libdir)/${GHC_P}/package.conf.d"
- PKGCACHE="${package_confdir}"/package.cache
- # copy the package.conf.d, including timestamp, save it so we can help
- # users that have a broken package.conf.d
- cp -pR "${package_confdir}"{,.initial} || die "failed to backup intial package.conf.d"
-
- # copy the package.conf, including timestamp, save it so we later can put it
- # back before uninstalling, or when upgrading.
- cp -p "${PKGCACHE}"{,.shipped} \
- || die "failed to copy package.conf.d/package.cache"
-}
-
-pkg_preinst() {
- # have we got an earlier version of ghc installed?
- if has_version "<${CATEGORY}/${PF}"; then
- haskell_updater_warn="1"
- fi
-}
-
-pkg_postinst() {
- ghc-reregister
-
- # path to the package.cache
- PKGCACHE="${EROOT}/usr/$(get_libdir)/${GHC_P}/package.conf.d/package.cache"
-
- # give the cache a new timestamp, it must be as recent as
- # the package.conf.d directory.
- touch "${PKGCACHE}"
-
- if [[ "${haskell_updater_warn}" == "1" ]]; then
- ewarn
- ewarn "\e[1;31m************************************************************************\e[0m"
- ewarn
- ewarn "You have just upgraded from an older version of GHC."
- ewarn "You may have to run"
- ewarn " 'haskell-updater --upgrade'"
- ewarn "to rebuild all ghc-based Haskell libraries."
- ewarn
- ewarn "\e[1;31m************************************************************************\e[0m"
- ewarn
- fi
-}
-
-pkg_prerm() {
- # Be very careful here... Call order when upgrading is (according to PMS):
- # * src_install for new package
- # * pkg_preinst for new package
- # * pkg_postinst for new package
- # * pkg_prerm for the package being replaced
- # * pkg_postrm for the package being replaced
- # so you'll actually be touching the new packages files, not the one you
- # uninstall, due to that or installation directory ${GHC_P} will be the same for
- # both packages.
-
- # Call order for reinstalling is (according to PMS):
- # * src_install
- # * pkg_preinst
- # * pkg_prerm for the package being replaced
- # * pkg_postrm for the package being replaced
- # * pkg_postinst
-
- # Overwrite the modified package.cache with a copy of the
- # original one, so that it will be removed during uninstall.
-
- PKGCACHE="${EROOT}/usr/$(get_libdir)/${GHC_P}/package.conf.d/package.cache"
- rm -rf "${PKGCACHE}"
-
- cp -p "${PKGCACHE}"{.shipped,}
-}
-
-pkg_postrm() {
- ghc-package_pkg_postrm
-}
diff --git a/dev-lang/ghc/metadata.xml b/dev-lang/ghc/metadata.xml
index a654b9b..521a174 100644
--- a/dev-lang/ghc/metadata.xml
+++ b/dev-lang/ghc/metadata.xml
@@ -9,6 +9,5 @@
<flag name="binary">Install the binary version directly, rather than using it to build the source version.</flag>
<flag name="ghcbootstrap">Bootstrap from an existing GHC installation.</flag>
<flag name="ghcmakebinary">Build with less runtime depends (bundle libffi for building bootstrap binaries).</flag>
- <flag name="llvm">Enable llvm code generator for ghc (-fllvm).</flag>
</use>
</pkgmetadata>
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: dev-lang/ghc/files/, dev-lang/ghc/
@ 2017-07-23 11:15 Sergei Trofimovich
0 siblings, 0 replies; 9+ messages in thread
From: Sergei Trofimovich @ 2017-07-23 11:15 UTC (permalink / raw
To: gentoo-commits
commit: 08a41d2dff99645af6ac5a7bb4774f5f193b6f20
Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 23 11:15:24 2017 +0000
Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sun Jul 23 11:15:34 2017 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=08a41d2d
dev-lang/ghc: bump up to 8.2.1 with x86 and amd64 binaries, no KEYWORDS yet
Package-Manager: Portage-2.3.6, Repoman-2.3.3
dev-lang/ghc/Manifest | 3 +
.../ghc/files/ghc-8.2.1_rc1-cgen-constify.patch | 378 ++++++++++
dev-lang/ghc/files/ghc-8.2.1_rc1-ghci-cross.patch | 60 ++
dev-lang/ghc/files/ghc-8.2.1_rc1-hp2ps-cross.patch | 104 +++
.../ghc/files/ghc-8.2.1_rc1-stage2-cross.patch | 81 +++
.../ghc/files/ghc-8.2.1_rc1-staged-cross.patch | 43 ++
.../ghc/files/ghc-8.2.1_rc1-unphased-cross.patch | 30 +
.../ghc/files/ghc-8.2.1_rc1-win32-cross-1.patch | 124 ++++
.../files/ghc-8.2.1_rc1-win32-cross-2-hack.patch | 144 ++++
dev-lang/ghc/files/ghc-8.2.1_rc2-O2-unreg.patch | 35 +
dev-lang/ghc/files/ghc-8.2.1_rc3-any-vendor.patch | 44 ++
.../ghc/files/ghc-8.2.1_rc3-stginit-data.patch | 27 +
dev-lang/ghc/ghc-8.2.1.ebuild | 770 +++++++++++++++++++++
13 files changed, 1843 insertions(+)
diff --git a/dev-lang/ghc/Manifest b/dev-lang/ghc/Manifest
index bbffd086951..1e20c41e682 100644
--- a/dev-lang/ghc/Manifest
+++ b/dev-lang/ghc/Manifest
@@ -3,6 +3,7 @@ DIST ghc-7.10.3-src.tar.bz2 13281867 SHA256 3e29a56a74ed6a74d3ee2a6db9389f246283
DIST ghc-7.8.4-ia64-CLOSUREs-regenerated.patch.gz 13268 SHA256 3bdff22e654aee6f942d43edf1bf6cf70404c0152c4fcf89276f10d2c4c5b4b9 SHA512 a655713e06324b56f0041edf70837487e296d28e6f3ee35fe116b9938765aaf3469d25e92645e0940655ed3607dff27d3826fe0f995c84e81b51bfc956816e7d WHIRLPOOL d2cb53bdc6debc0278d554168ea3ab22b0fd8314adac81444637278a92d21b766280fedfb4b7d1b4540c7381c7962dec6b13a799ab2fee4d456fe2875d5c6a5b
DIST ghc-7.8.4-src.tar.bz2 10600755 SHA256 59e3bd514a1820cc1c03e1808282205c0b8518369acae12645ceaf839e6f114b SHA512 079a53891d8ebd8d9b88da96170e60981608a619f8282e4b7948f35244e99bd87277649ac7fcebc227a61a4d21960db8d5e5b9e92f2c69c82d8d68d7fd0a41d3 WHIRLPOOL a9be7641adbd237ed6e0f644c312e655e98be9566097aee5e2c0022e8756d5b2236e42dd86d76c638a001b5ca3f67307e89ec0cd003a92cd112a5d6d3e3d8467
DIST ghc-8.0.2-src.tar.xz 10687760 SHA256 11625453e1d0686b3fa6739988f70ecac836cadc30b9f0c8b49ef9091d6118b1 SHA512 58ea3853cd93b556ecdc4abd0be079b2621171b8491f59004ea4e036a4cba4470aaafe6591b942e0a50a64bdc47540e01fe6900212a1ef7087850112d9bfc5ef WHIRLPOOL 5ffd94f797c32c87d9d818acbb1a41f2c140d6f1da169854aab6eece7a41499b55fc573f9a4fbcccf09dcfc92e460d8c91be5efd8650837e8bfba009b04261b1
+DIST ghc-8.2.1-src.tar.xz 10736016 SHA256 cfc2d496708dacea3ea7dde4c6a4b921b97a7f550ee2acea44cfa535840593f0 SHA512 d9aa2aa7f9414db8f4e51d6c275694b46df515e68331a1a2b6018256333a2c63ebd877b75ee90407ecce5be672ec9afc6bebd62aadbf8ae06b94f1760d1736be WHIRLPOOL ecbdf8e3f330ef329fab21865c5f063763a2320e03063aeb8777f6c4769a86b33504c0548df9c6ce859028277851e6e7482b7c3b62986c6186745f894e7567d9
DIST ghc-bin-7.10.3-alpha.tbz2 183558856 SHA256 780ac45b9b38fb40f08eeb7dae741649ac19dce2271df4bc764cac9be6c5c225 SHA512 08709fe9b4036ab41715c9a637a2a160104e3ab9e0ed9efaaf73428e3cfe19619e50c42b72c60bbbd27be2b9c2ea68f63d72c1a27d4519756e7c0d909f724230 WHIRLPOOL f488ecc945c6100ba86b9ae25eb6a472693556be0205a6c8634f2c235e779fe17b391ced7fec5d89c0c6c3d21583fe9f9b80bf628f3307890becf3f3ffb57a96
DIST ghc-bin-7.10.3-amd64.tbz2 112040431 SHA256 c3c71aff288f7de2785d1c3d54f0fd636144eb3dcb590bdda087b0775203e517 SHA512 e1554b3944edbe8e16537de5a29132dc6a22d780d9a700cdc9b76387b94191164398d6f2242bf8199527802572e2bb02545569d4f0930a0ee0dbfdeb25978558 WHIRLPOOL c2497a9565abf7d37e7928f508f7bf7241dd529aa252da708517f9f067e3d016341b7a73cac34888b99c9b84a8d01fd9e8d76f2b332d53e0d708b078f20ee807
DIST ghc-bin-7.10.3-ia64.tbz2 238680956 SHA256 0da9b5966f0920341f4cf041b814817e1ed06060e8a491481ab19a68153767db SHA512 3694011aec8a6dc37889418b318993cb82f9b46a5175dd837713f396c8f59a19a920e0b0669fe3b4ec37d5bd8837c115264c0a8fc97c5a4ce06a3bdd52fcfce5 WHIRLPOOL 9e059a953607b6477ea7c27bf55175d838c6aa3c57fcf92f13fa6112e9e728037073047be300a5a757395d759d30545546cb46816ec879a2d31c3c0a78868e42
@@ -24,5 +25,7 @@ DIST ghc-bin-8.0.2-ia64.tbz2 250237654 SHA256 f3e74db697900d031c4d405310c3bf3f40
DIST ghc-bin-8.0.2-ppc.tbz2 144760090 SHA256 a261dd97df396296d1a94c311c757040f74284b812634d97734557915d0a44ca SHA512 bc6bf8998064ffc1692c3bb83c44d1787760a3f4a1e6b79dedaefda5fe32b9052049a60f0ddd3c0b0bd24a722fb35e310e0189b3511721ff89d4d02b3d7c14bb WHIRLPOOL b070acb230dccc2faed66002f4384c8c9b17ce58655b5861766582558a66236136b1d02ab6226c7de5c74960c7d2d37c3c0069e38dfa980730043f623df4baa6
DIST ghc-bin-8.0.2-ppc64.tbz2 117432068 SHA256 f2eb278c4d40d92233767d48149ec96a6c6097159ec846a984152c99a559803a SHA512 0eaff0557b68649a15bbeb2019f46fa9e9e7b8a916aa210ab56888090a5b887d20d818e7987177bc6a8e7fde503de560026e6bb55fe39679b8b1ee13c6b7c4f9 WHIRLPOOL 8a4ba955183cb7c94ecb59f62eab18a4ee75aa422d3c6e7172d347112b8445dccf86c718fcd84d3271dcb1f35fee0451fece184840403a02f7ed8bb39785075e
DIST ghc-bin-8.0.2-x86.tbz2 133372061 SHA256 5e56bff6831a9c151d5d6f82db49b21d33bea05f05cdf74fca5adc423d546711 SHA512 020ce0e597e2907550c080f1bb0f863dbf83d5d45df2b3f44173506475bc4ef5423c5a060fdacd87614c3ec398ad94c2dcab9cff0376a54a2c54c2eb1e2f657d WHIRLPOOL 221eae08caff5c2157fae7df901c94d6d1393be3ab0526bb9d8a80d4304af4c4a420fcc2fe62926bf01c3bb02f161f1eb61c7eb47d3c6801cfacb25c1a33e983
+DIST ghc-bin-8.2.1-i686-pc-linux-gnu.tbz2 96157437 SHA256 2a05584fd51a4e9040a3611a0687d814b62b28c5ccd4102b00cf8bbfecadeec9 SHA512 e891e76557fa61853e28829b8bedc4a6abb92954f90cc1ebcf22a13cc137556bbe9262e7398b7e1aedbabeb997916b008bf1561a52f16a569f3d58ea9404f41e WHIRLPOOL c955dbc501b6c3effe08a91ba8b6584e74b224427c56232744c4ddedad72039e2cdb2f3ea1193e6ae2e7fd8a46a947cf7a835399c81f5dd5568c3ce1ad8a5adc
+DIST ghc-bin-8.2.1-x86_64-pc-linux-gnu.tbz2 97490496 SHA256 b67f4f7518a4e2ec5cfc0434dde0365cbfe37c4c7e164e9e8e38199bb6f083cd SHA512 52630a185d0eab56bce0469a612a54109895bfee041ec362ced59a9b35ba3b9c185e86bc7dbf0a5939081d3626baa19fbb3306e36d1857530248a7b9bfc100bb WHIRLPOOL 7998e0c351bd6943bd351909f5e9af0146a3e08f04141fc54807ebea994e4bbcec44247c885865eaa5af8786dfb514eed4fffc35ffaabe81f2d7f8a856ed10d9
DIST hoopl-3.10.2.0.tar.gz 241940 SHA256 6740814c774e51815e8260ae1b4ac8af6ab69f02e112904450f689c4792f1121 SHA512 083baa8a5eb53247aff8d5b9b2144e0f63adb9400934297bbd80bfcec607dd90a34def4301045a60472ef10b0fb90ab84692fc08f786e7f806c28afdab1ef66a WHIRLPOOL 761e7440d2bc32b594ab55ea967c5b075bb638b2fdba6606beaf9c31a90e20031e914146828004b3d11203668210a6994be9fabc3b0ebb428d516b57cae9ee68
DIST transformers-0.4.3.0.tar.gz 28632 SHA256 b3d0a797e815ca50d411e20c02f781efe7751308007d880af7f0b5c4365c3a9d SHA512 c3ec0893ebba4fbd6087c3202e919552c4a9bff3350b5c0589e7ebb18751a515d98b8cac15b0a3252906ea72b5a0eb09b7fe88c8da88b09d6ce4fbf0f50b2780 WHIRLPOOL 89591781926b1d025056dedcfc5de61705056c1e3a8eba72f2e89789e78d2ed4d8909f84d6560dfc66bc0b360f98cb3dc3835f3a05c2325f747498373c88aa4b
diff --git a/dev-lang/ghc/files/ghc-8.2.1_rc1-cgen-constify.patch b/dev-lang/ghc/files/ghc-8.2.1_rc1-cgen-constify.patch
new file mode 100644
index 00000000000..2e1ef932b45
--- /dev/null
+++ b/dev-lang/ghc/files/ghc-8.2.1_rc1-cgen-constify.patch
@@ -0,0 +1,378 @@
+From 7e00046772e053c63ac93630a60b0f396e32a2d7 Mon Sep 17 00:00:00 2001
+From: Sergei Trofimovich <slyfox@gentoo.org>
+Date: Sun, 16 Apr 2017 10:43:38 +0100
+Subject: [PATCH] compiler/cmm/PprC.hs: constify labels in .rodata
+
+Summary:
+Consider one-line module
+ module B (v) where v = "hello"
+in -fvia-C mode it generates code like
+ static char gibberish_str[] = "hello";
+
+It resides in data section (precious resource on ia64!).
+The patch switches genrator to emit:
+ static const char gibberish_str[] = "hello";
+
+Other types if symbols that gained 'const' qualifier are:
+
+- info tables (from haskell and CMM)
+- static reference tables (from haskell and CMM)
+
+Cleanups along the way:
+
+- fixed info tables defined in .cmm to reside in .rodata
+- split out closure declaration into 'IC_' / 'EC_'
+- added label declaration (based on label type) right before
+ each label definition (based on section type) so that C
+ compiler could check if declaration and definition matches
+ at definition site.
+
+Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
+
+Test Plan: ran testsuite on unregisterised x86_64 compiler
+
+Reviewers: simonmar, ezyang, austin, bgamari, erikd
+
+Subscribers: rwbarton, thomie
+
+GHC Trac Issues: #8996
+
+Differential Revision: https://phabricator.haskell.org/D3481
+---
+ compiler/cmm/CLabel.hs | 24 ++++++++++++++
+ compiler/cmm/Cmm.hs | 13 ++++++++
+ compiler/cmm/CmmInfo.hs | 2 +-
+ compiler/cmm/PprC.hs | 62 +++++++++++++++++++++++-------------
+ compiler/llvmGen/LlvmCodeGen/Data.hs | 12 -------
+ includes/Stg.h | 22 +++++++++----
+ includes/rts/storage/InfoTables.h | 2 +-
+ includes/stg/MiscClosures.h | 14 ++++----
+ 8 files changed, 102 insertions(+), 49 deletions(-)
+
+diff --git a/compiler/cmm/CLabel.hs b/compiler/cmm/CLabel.hs
+index 3ba4f7647a..62c8037e9c 100644
+--- a/compiler/cmm/CLabel.hs
++++ b/compiler/cmm/CLabel.hs
+@@ -89,6 +89,8 @@ module CLabel (
+ foreignLabelStdcallInfo,
+ isBytesLabel,
+ isForeignLabel,
++ isSomeRODataLabel,
++ isStaticClosureLabel,
+ mkCCLabel, mkCCSLabel,
+
+ DynamicLinkerLabelInfo(..),
+@@ -575,6 +577,28 @@ isForeignLabel :: CLabel -> Bool
+ isForeignLabel (ForeignLabel _ _ _ _) = True
+ isForeignLabel _lbl = False
+
++-- | Whether label is a static closure label (can come from haskell or cmm)
++isStaticClosureLabel :: CLabel -> Bool
++-- Closure defined in haskell (.hs)
++isStaticClosureLabel (IdLabel _ _ Closure) = True
++-- Closure defined in cmm
++isStaticClosureLabel (CmmLabel _ _ CmmClosure) = True
++isStaticClosureLabel _lbl = False
++
++-- | Whether label is a .rodata label
++isSomeRODataLabel :: CLabel -> Bool
++-- info table defined in haskell (.hs)
++isSomeRODataLabel (IdLabel _ _ ClosureTable) = True
++isSomeRODataLabel (IdLabel _ _ ConInfoTable) = True
++isSomeRODataLabel (IdLabel _ _ InfoTable) = True
++isSomeRODataLabel (IdLabel _ _ LocalInfoTable) = True
++-- static reference tables defined in haskell (.hs)
++isSomeRODataLabel (IdLabel _ _ SRT) = True
++isSomeRODataLabel (SRTLabel _) = True
++-- info table defined in cmm (.cmm)
++isSomeRODataLabel (CmmLabel _ _ CmmInfo) = True
++isSomeRODataLabel _lbl = False
++
+ -- | Get the label size field from a ForeignLabel
+ foreignLabelStdcallInfo :: CLabel -> Maybe Int
+ foreignLabelStdcallInfo (ForeignLabel _ info _ _) = info
+diff --git a/compiler/cmm/Cmm.hs b/compiler/cmm/Cmm.hs
+index d2ee531686..bab20f3fdd 100644
+--- a/compiler/cmm/Cmm.hs
++++ b/compiler/cmm/Cmm.hs
+@@ -9,6 +9,7 @@ module Cmm (
+ CmmBlock,
+ RawCmmDecl, RawCmmGroup,
+ Section(..), SectionType(..), CmmStatics(..), CmmStatic(..),
++ isSecConstant,
+
+ -- ** Blocks containing lists
+ GenBasicBlock(..), blockId,
+@@ -167,6 +168,18 @@ data SectionType
+ | OtherSection String
+ deriving (Show)
+
++-- | Should a data in this section be considered constant
++isSecConstant :: Section -> Bool
++isSecConstant (Section t _) = case t of
++ Text -> True
++ ReadOnlyData -> True
++ RelocatableReadOnlyData -> True
++ ReadOnlyData16 -> True
++ CString -> True
++ Data -> False
++ UninitialisedData -> False
++ (OtherSection _) -> False
++
+ data Section = Section SectionType CLabel
+
+ data CmmStatic
+diff --git a/compiler/cmm/CmmInfo.hs b/compiler/cmm/CmmInfo.hs
+index b5e800a977..35e3a1888d 100644
+--- a/compiler/cmm/CmmInfo.hs
++++ b/compiler/cmm/CmmInfo.hs
+@@ -133,7 +133,7 @@ mkInfoTable dflags proc@(CmmProc infos entry_lbl live blocks)
+ --
+ return (top_decls ++
+ [CmmProc mapEmpty entry_lbl live blocks,
+- mkDataLits (Section Data info_lbl) info_lbl
++ mkRODataLits info_lbl
+ (CmmLabel entry_lbl : rel_std_info ++ rel_extra_bits)])
+
+ --
+diff --git a/compiler/cmm/PprC.hs b/compiler/cmm/PprC.hs
+index 56de94079f..21ed6f6516 100644
+--- a/compiler/cmm/PprC.hs
++++ b/compiler/cmm/PprC.hs
+@@ -83,12 +83,13 @@ pprC tops = vcat $ intersperse blankLine $ map pprTop tops
+ -- top level procs
+ --
+ pprTop :: RawCmmDecl -> SDoc
+-pprTop (CmmProc infos clbl _ graph) =
++pprTop (CmmProc infos clbl _in_live_regs graph) =
+
+ (case mapLookup (g_entry graph) infos of
+ Nothing -> empty
+- Just (Statics info_clbl info_dat) -> pprDataExterns info_dat $$
+- pprWordArray info_clbl info_dat) $$
++ Just (Statics info_clbl info_dat) ->
++ pprDataExterns info_dat $$
++ pprWordArray info_is_in_rodata info_clbl info_dat) $$
+ (vcat [
+ blankLine,
+ extern_decls,
+@@ -99,6 +100,8 @@ pprTop (CmmProc infos clbl _ graph) =
+ rbrace ]
+ )
+ where
++ -- info tables are always in .rodata
++ info_is_in_rodata = True
+ blocks = toBlockListEntryFirst graph
+ (temp_decls, extern_decls) = pprTempAndExternDecls blocks
+
+@@ -107,21 +110,23 @@ pprTop (CmmProc infos clbl _ graph) =
+
+ -- We only handle (a) arrays of word-sized things and (b) strings.
+
+-pprTop (CmmData _section (Statics lbl [CmmString str])) =
++pprTop (CmmData section (Statics lbl [CmmString str])) =
++ pprExternDecl lbl $$
+ hcat [
+- pprLocalness lbl, text "char ", ppr lbl,
++ pprLocalness lbl, pprConstness (isSecConstant section), text "char ", ppr lbl,
+ text "[] = ", pprStringInCStyle str, semi
+ ]
+
+-pprTop (CmmData _section (Statics lbl [CmmUninitialised size])) =
++pprTop (CmmData section (Statics lbl [CmmUninitialised size])) =
++ pprExternDecl lbl $$
+ hcat [
+- pprLocalness lbl, text "char ", ppr lbl,
++ pprLocalness lbl, pprConstness (isSecConstant section), text "char ", ppr lbl,
+ brackets (int size), semi
+ ]
+
+-pprTop (CmmData _section (Statics lbl lits)) =
++pprTop (CmmData section (Statics lbl lits)) =
+ pprDataExterns lits $$
+- pprWordArray lbl lits
++ pprWordArray (isSecConstant section) lbl lits
+
+ -- --------------------------------------------------------------------------
+ -- BasicBlocks are self-contained entities: they always end in a jump.
+@@ -141,10 +146,12 @@ pprBBlock block =
+ -- Info tables. Just arrays of words.
+ -- See codeGen/ClosureInfo, and nativeGen/PprMach
+
+-pprWordArray :: CLabel -> [CmmStatic] -> SDoc
+-pprWordArray lbl ds
++pprWordArray :: Bool -> CLabel -> [CmmStatic] -> SDoc
++pprWordArray is_ro lbl ds
+ = sdocWithDynFlags $ \dflags ->
+- hcat [ pprLocalness lbl, text "StgWord"
++ -- TODO: align closures only
++ pprExternDecl lbl $$
++ hcat [ pprLocalness lbl, pprConstness is_ro, text "StgWord"
+ , space, ppr lbl, text "[]"
+ -- See Note [StgWord alignment]
+ , pprAlignment (wordWidth dflags)
+@@ -180,6 +187,10 @@ pprLocalness :: CLabel -> SDoc
+ pprLocalness lbl | not $ externallyVisibleCLabel lbl = text "static "
+ | otherwise = empty
+
++pprConstness :: Bool -> SDoc
++pprConstness is_ro | is_ro = text "const "
++ | otherwise = empty
++
+ -- --------------------------------------------------------------------------
+ -- Statements.
+ --
+@@ -984,31 +995,38 @@ is_cishCC JavaScriptCallConv = False
+ pprTempAndExternDecls :: [CmmBlock] -> (SDoc{-temps-}, SDoc{-externs-})
+ pprTempAndExternDecls stmts
+ = (pprUFM (getUniqSet temps) (vcat . map pprTempDecl),
+- vcat (map (pprExternDecl False{-ToDo-}) (Map.keys lbls)))
++ vcat (map pprExternDecl (Map.keys lbls)))
+ where (temps, lbls) = runTE (mapM_ te_BB stmts)
+
+ pprDataExterns :: [CmmStatic] -> SDoc
+ pprDataExterns statics
+- = vcat (map (pprExternDecl False{-ToDo-}) (Map.keys lbls))
++ = vcat (map pprExternDecl (Map.keys lbls))
+ where (_, lbls) = runTE (mapM_ te_Static statics)
+
+ pprTempDecl :: LocalReg -> SDoc
+ pprTempDecl l@(LocalReg _ rep)
+ = hcat [ machRepCType rep, space, pprLocalReg l, semi ]
+
+-pprExternDecl :: Bool -> CLabel -> SDoc
+-pprExternDecl _in_srt lbl
++pprExternDecl :: CLabel -> SDoc
++pprExternDecl lbl
+ -- do not print anything for "known external" things
+ | not (needsCDecl lbl) = empty
+ | Just sz <- foreignLabelStdcallInfo lbl = stdcall_decl sz
+ | otherwise =
+- hcat [ visibility, label_type lbl,
+- lparen, ppr lbl, text ");" ]
++ hcat [ visibility, label_type lbl , lparen, ppr lbl, text ");"
++ -- occasionally useful to see label type
++ -- , text "/* ", pprDebugCLabel lbl, text " */"
++ ]
+ where
+- label_type lbl | isBytesLabel lbl = text "B_"
+- | isForeignLabel lbl && isCFunctionLabel lbl = text "FF_"
+- | isCFunctionLabel lbl = text "F_"
+- | otherwise = text "I_"
++ label_type lbl | isBytesLabel lbl = text "B_"
++ | isForeignLabel lbl && isCFunctionLabel lbl
++ = text "FF_"
++ | isCFunctionLabel lbl = text "F_"
++ | isStaticClosureLabel lbl = text "C_"
++ -- generic .rodata labels
++ | isSomeRODataLabel lbl = text "RO_"
++ -- generic .data labels (common case)
++ | otherwise = text "RW_"
+
+ visibility
+ | externallyVisibleCLabel lbl = char 'E'
+diff --git a/compiler/llvmGen/LlvmCodeGen/Data.hs b/compiler/llvmGen/LlvmCodeGen/Data.hs
+index 9bb5a75bda..adb86d312d 100644
+--- a/compiler/llvmGen/LlvmCodeGen/Data.hs
++++ b/compiler/llvmGen/LlvmCodeGen/Data.hs
+@@ -56,18 +56,6 @@ genLlvmData (sec, Statics lbl xs) = do
+
+ return ([globDef], [tyAlias])
+
+--- | Should a data in this section be considered constant
+-isSecConstant :: Section -> Bool
+-isSecConstant (Section t _) = case t of
+- Text -> True
+- ReadOnlyData -> True
+- RelocatableReadOnlyData -> True
+- ReadOnlyData16 -> True
+- CString -> True
+- Data -> False
+- UninitialisedData -> False
+- (OtherSection _) -> False
+-
+ -- | Format the section type part of a Cmm Section
+ llvmSectionType :: Platform -> SectionType -> FastString
+ llvmSectionType p t = case t of
+diff --git a/includes/Stg.h b/includes/Stg.h
+index 619984d8e5..b1b3190307 100644
+--- a/includes/Stg.h
++++ b/includes/Stg.h
+@@ -223,13 +223,23 @@ typedef StgInt I_;
+ typedef StgWord StgWordArray[];
+ typedef StgFunPtr F_;
+
+-#define EB_(X) extern char X[]
+-#define IB_(X) static char X[]
+-#define EI_(X) extern StgWordArray (X) GNU_ATTRIBUTE(aligned (8))
+-#define II_(X) static StgWordArray (X) GNU_ATTRIBUTE(aligned (8))
++/* byte arrays (and strings): */
++#define EB_(X) extern const char X[]
++#define IB_(X) static const char X[]
++/* static (non-heap) closures (requires alignment for pointer tagging): */
++#define EC_(X) extern StgWordArray (X) GNU_ATTRIBUTE(aligned (8))
++#define IC_(X) static StgWordArray (X) GNU_ATTRIBUTE(aligned (8))
++/* writable data (does not require alignment): */
++#define ERW_(X) extern StgWordArray (X)
++#define IRW_(X) static StgWordArray (X)
++/* read-only data (does not require alignment): */
++#define ERO_(X) extern const StgWordArray (X)
++#define IRO_(X) static const StgWordArray (X)
++/* stg-native functions: */
+ #define IF_(f) static StgFunPtr GNUC3_ATTRIBUTE(used) f(void)
+-#define FN_(f) StgFunPtr f(void)
+-#define EF_(f) StgFunPtr f(void) /* External Cmm functions */
++#define FN_(f) StgFunPtr f(void)
++#define EF_(f) StgFunPtr f(void) /* External Cmm functions */
++/* foreign functions: */
+ #define EFF_(f) void f() /* See Note [External function prototypes] */
+
+ /* Note [External function prototypes] See Trac #8965, #11395
+diff --git a/includes/rts/storage/InfoTables.h b/includes/rts/storage/InfoTables.h
+index 307aac371c..163f1d1c87 100644
+--- a/includes/rts/storage/InfoTables.h
++++ b/includes/rts/storage/InfoTables.h
+@@ -266,7 +266,7 @@ typedef struct {
+ } StgFunInfoTable;
+
+ // canned bitmap for each arg type, indexed by constants in FunTypes.h
+-extern StgWord stg_arg_bitmaps[];
++extern const StgWord stg_arg_bitmaps[];
+
+ /* -----------------------------------------------------------------------------
+ Return info tables
+diff --git a/includes/stg/MiscClosures.h b/includes/stg/MiscClosures.h
+index 9d907ab3ba..b604f1c42b 100644
+--- a/includes/stg/MiscClosures.h
++++ b/includes/stg/MiscClosures.h
+@@ -21,10 +21,10 @@
+ #define STGMISCCLOSURES_H
+
+ #if IN_STG_CODE
+-# define RTS_RET_INFO(i) extern W_(i)[]
+-# define RTS_FUN_INFO(i) extern W_(i)[]
+-# define RTS_THUNK_INFO(i) extern W_(i)[]
+-# define RTS_INFO(i) extern W_(i)[]
++# define RTS_RET_INFO(i) extern const W_(i)[]
++# define RTS_FUN_INFO(i) extern const W_(i)[]
++# define RTS_THUNK_INFO(i) extern const W_(i)[]
++# define RTS_INFO(i) extern const W_(i)[]
+ # define RTS_CLOSURE(i) extern W_(i)[]
+ # define RTS_FUN_DECL(f) extern DLL_IMPORT_RTS StgFunPtr f(void)
+ #else
+@@ -489,9 +489,9 @@ extern StgWord RTS_VAR(sched_mutex);
+
+ // Apply.cmm
+ // canned bitmap for each arg type
+-extern StgWord stg_arg_bitmaps[];
+-extern StgWord stg_ap_stack_entries[];
+-extern StgWord stg_stack_save_entries[];
++extern const StgWord stg_arg_bitmaps[];
++extern const StgWord stg_ap_stack_entries[];
++extern const StgWord stg_stack_save_entries[];
+
+ // Storage.c
+ extern unsigned int RTS_VAR(g0);
+--
+2.12.2
+
diff --git a/dev-lang/ghc/files/ghc-8.2.1_rc1-ghci-cross.patch b/dev-lang/ghc/files/ghc-8.2.1_rc1-ghci-cross.patch
new file mode 100644
index 00000000000..dbba18e85c7
--- /dev/null
+++ b/dev-lang/ghc/files/ghc-8.2.1_rc1-ghci-cross.patch
@@ -0,0 +1,60 @@
+commit 732b3dbbff194eb8650c75afd79d892801afa0dc
+Author: Sergei Trofimovich <slyfox@gentoo.org>
+Date: Thu Apr 6 22:48:13 2017 +0100
+
+ add $(CrossCompilePrefix) to 'runghc' and 'ghci'
+
+ When Stage1Only=YES install mode is used one of rare tools
+ that lack $(CrossCompilePrefix) prefix are 'runghc' and 'ghci'.
+
+ This causes file collisions when multiple GHC crosscompilers
+ are installed in system.
+
+ Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
+
+diff --git a/driver/ghci/ghc.mk b/driver/ghci/ghc.mk
+index 41d1f15c17..0f31884080 100644
+--- a/driver/ghci/ghc.mk
++++ b/driver/ghci/ghc.mk
+@@ -16,16 +16,16 @@ ifneq "$(Windows_Host)" "YES"
+ install: install_driver_ghci
+
+ .PHONY: install_driver_ghci
+-install_driver_ghci: WRAPPER=$(DESTDIR)$(bindir)/ghci-$(ProjectVersion)
++install_driver_ghci: WRAPPER=$(DESTDIR)$(bindir)/$(CrossCompilePrefix)ghci-$(ProjectVersion)
+ install_driver_ghci:
+ $(INSTALL_DIR) "$(DESTDIR)$(bindir)"
+ $(call removeFiles, "$(WRAPPER)")
+ $(CREATE_SCRIPT) "$(WRAPPER)"
+ echo '#!$(SHELL)' >> "$(WRAPPER)"
+- echo 'exec "$(bindir)/ghc-$(ProjectVersion)" --interactive "$$@"' >> "$(WRAPPER)"
++ echo 'exec "$(bindir)/$(CrossCompilePrefix)ghc-$(ProjectVersion)" --interactive "$$@"' >> "$(WRAPPER)"
+ $(EXECUTABLE_FILE) "$(WRAPPER)"
+- $(call removeFiles,"$(DESTDIR)$(bindir)/ghci")
+- $(LN_S) ghci-$(ProjectVersion) "$(DESTDIR)$(bindir)/ghci"
++ $(call removeFiles,"$(DESTDIR)$(bindir)/$(CrossCompilePrefix)ghci")
++ $(LN_S) $(CrossCompilePrefix)ghci-$(ProjectVersion) "$(DESTDIR)$(bindir)/$(CrossCompilePrefix)ghci"
+
+ else # Windows_Host...
+
+diff --git a/utils/runghc/ghc.mk b/utils/runghc/ghc.mk
+index 9169ca21bd..50b11a612e 100644
+--- a/utils/runghc/ghc.mk
++++ b/utils/runghc/ghc.mk
+@@ -34,11 +34,11 @@ install: install_runhaskell
+ .PHONY: install_runhaskell
+ ifeq "$(Windows_Host)" "YES"
+ install_runhaskell: install_bins
+- "$(CP)" $(DESTDIR)$(bindir)/runghc$(exeext1) $(DESTDIR)$(bindir)/runhaskell$(exeext1)
++ "$(CP)" $(DESTDIR)$(bindir)/$(CrossCompilePrefix)runghc$(exeext1) $(DESTDIR)$(bindir)/$(CrossCompilePrefix)runhaskell$(exeext1)
+ else
+ install_runhaskell:
+- $(call removeFiles,"$(DESTDIR)$(bindir)/runhaskell")
+- $(LN_S) runghc "$(DESTDIR)$(bindir)/runhaskell"
+- $(call removeFiles,"$(DESTDIR)$(bindir)/runghc")
+- $(LN_S) runghc-$(ProjectVersion) "$(DESTDIR)$(bindir)/runghc"
++ $(call removeFiles,"$(DESTDIR)$(bindir)/$(CrossCompilePrefix)runhaskell")
++ $(LN_S) $(CrossCompilePrefix)runghc "$(DESTDIR)$(bindir)/$(CrossCompilePrefix)runhaskell"
++ $(call removeFiles,"$(DESTDIR)$(bindir)/$(CrossCompilePrefix)runghc")
++ $(LN_S) $(CrossCompilePrefix)runghc-$(ProjectVersion) "$(DESTDIR)$(bindir)/$(CrossCompilePrefix)runghc"
+ endif
diff --git a/dev-lang/ghc/files/ghc-8.2.1_rc1-hp2ps-cross.patch b/dev-lang/ghc/files/ghc-8.2.1_rc1-hp2ps-cross.patch
new file mode 100644
index 00000000000..26382b3cf44
--- /dev/null
+++ b/dev-lang/ghc/files/ghc-8.2.1_rc1-hp2ps-cross.patch
@@ -0,0 +1,104 @@
+commit ff84d052850b637b03bbb98cf05202e44886257d
+Author: Sergei Trofimovich <slyfox@gentoo.org>
+Date: Sat Apr 8 10:02:34 2017 +0100
+
+ cross-build 'unlit' and 'hp2ps' for stage2 install
+
+ In navive build case it does not matter much if we build
+ 'unlit' and 'hp2ps' tools with ghc-stage0 or ghc-stage1:
+ both GHCs are native compilers and both tools are written
+ in C (have no haskell code).
+
+ But in cross-case the difference is substantial:
+ In Stag1Only=YES case we need to install native tools built
+ by ghc-stage0/${host}-cc.
+ In Stag1Only=NO case we need to install cross-built tools
+ built by ghc-stage1/${target}-cc.
+
+ Before this change GHC did not have a rule to build cross-built
+ 'unlit' and 'hp2ps'.
+
+ The change adds cross-built 'unlit' and 'hp2ps' as 'dist-install'
+ targets.
+
+ 'inplace/lib/bin/unlit.bin' target is unchanged and still contains
+ native binary.
+
+ As a result this change allows cross-building and packaging whole
+ GHC for target platform!
+
+ Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
+
+diff --git a/utils/hp2ps/ghc.mk b/utils/hp2ps/ghc.mk
+index f6e01ec6c1..21ce87dcfa 100644
+--- a/utils/hp2ps/ghc.mk
++++ b/utils/hp2ps/ghc.mk
+@@ -10,6 +10,7 @@
+ #
+ # -----------------------------------------------------------------------------
+
++# stage0
+ utils/hp2ps_dist_C_SRCS = AreaBelow.c Curves.c Error.c Main.c \
+ Reorder.c TopTwenty.c AuxFile.c Deviation.c \
+ HpFile.c Marks.c Scale.c TraceElement.c \
+@@ -17,11 +18,27 @@ utils/hp2ps_dist_C_SRCS = AreaBelow.c Curves.c Error.c Main.c \
+ Utilities.c
+ utils/hp2ps_dist_EXTRA_LIBRARIES = m
+ utils/hp2ps_dist_PROGNAME = hp2ps
+-utils/hp2ps_dist_INSTALL = YES
+ utils/hp2ps_dist_INSTALL_INPLACE = YES
+ utils/hp2ps_dist_SHELL_WRAPPER = YES
+ utils/hp2ps_dist_INSTALL_SHELL_WRAPPER_NAME = hp2ps
+
+ utils/hp2ps_CC_OPTS += $(addprefix -I,$(GHC_INCLUDE_DIRS))
+
++# stage 1
++utils/hp2ps_dist-install_C_SRCS = $(utils/hp2ps_dist_C_SRCS)
++utils/hp2ps_dist-install_EXTRA_LIBRARIES = $(utils/hp2ps_dist_EXTRA_LIBRARIES)
++utils/hp2ps_dist-install_PROGNAME = $(utils/hp2ps_dist_PROGNAME)
++utils/hp2ps_dist-install_INSTALL_INPLACE = NO
++utils/hp2ps_dist-install_SHELL_WRAPPER = YES
++utils/hp2ps_dist-install_INSTALL_SHELL_WRAPPER_NAME = $(utils/hp2ps_dist_INSTALL_SHELL_WRAPPER_NAME)
++
++ifeq "$(Stage1Only)" "YES"
++utils/hp2ps_dist_INSTALL = YES
++utils/hp2ps_dist-install_INSTALL = NO
++else
++utils/hp2ps_dist_INSTALL = NO
++utils/hp2ps_dist-install_INSTALL = YES
++endif
++
+ $(eval $(call build-prog,utils/hp2ps,dist,0))
++$(eval $(call build-prog,utils/hp2ps,dist-install,1))
+diff --git a/utils/unlit/ghc.mk b/utils/unlit/ghc.mk
+index e947989b5e..8911f4e856 100644
+--- a/utils/unlit/ghc.mk
++++ b/utils/unlit/ghc.mk
+@@ -10,11 +10,25 @@
+ #
+ # -----------------------------------------------------------------------------
+
++# built by ghc-stage0
+ utils/unlit_dist_C_SRCS = unlit.c
+ utils/unlit_dist_PROGNAME = unlit
+ utils/unlit_dist_TOPDIR = YES
+-utils/unlit_dist_INSTALL = YES
+ utils/unlit_dist_INSTALL_INPLACE = YES
+
+-$(eval $(call build-prog,utils/unlit,dist,0))
++# built by ghc-stage1
++utils/unlit_dist-install_C_SRCS = $(utils/unlit_dist_C_SRCS)
++utils/unlit_dist-install_PROGNAME = $(utils/unlit_dist_PROGNAME)
++utils/unlit_dist-install_TOPDIR = $(utils/unlit_dist_TOPDIR)
++utils/unlit_dist-install_INSTALL_INPLACE = NO
++
++ifeq "$(Stage1Only)" "YES"
++utils/unlit_dist_INSTALL = YES
++utils/unlit_dist-install_INSTALL = NO
++else
++utils/unlit_dist_INSTALL = NO
++utils/unlit_dist-install_INSTALL = YES
++endif
+
++$(eval $(call build-prog,utils/unlit,dist,0))
++$(eval $(call build-prog,utils/unlit,dist-install,1))
diff --git a/dev-lang/ghc/files/ghc-8.2.1_rc1-stage2-cross.patch b/dev-lang/ghc/files/ghc-8.2.1_rc1-stage2-cross.patch
new file mode 100644
index 00000000000..1439d722fef
--- /dev/null
+++ b/dev-lang/ghc/files/ghc-8.2.1_rc1-stage2-cross.patch
@@ -0,0 +1,81 @@
+commit 54895c90440cb81f18657537b91f2aa35bd54173
+Author: Sergei Trofimovich <slyfox@gentoo.org>
+Date: Fri Apr 7 10:08:58 2017 +0100
+
+ fix 'make install' for cross-stage2
+
+ When cross-built GHC is being installed one of
+ latest steps is to register installed libraries
+ with 'ghc-pkg'.
+
+ GHC uses freshly installed 'ghc-pkg' and 'ghc-stage2'
+ for that.
+
+ Tested as:
+ ./configure --target=aarch64-unknown-linux-gnu
+ make install DESTDIR=$(pwd)/__s2 STRIP_CMD=:
+
+ Before the change install failed on ghc-pkg execution phase:
+
+ ".../ghc-cross/__s2/usr/local/lib/ghc-8.3.20170406/bin/ghc-pkg" \
+ --force \
+ --global-package-db \
+ ".../ghc-cross/__s2/usr/local/lib/ghc-8.3.20170406/package.conf.d" \
+ update rts/dist/package.conf.install
+ /bin/sh: .../ghc-cross/__s2/usr/local/lib/ghc-8.3.20170406/bin/ghc-pkg: \
+ No such file or directory
+
+ To avoid breakage we use 'ghc' and 'ghc-pkg' built by stage0.
+
+ Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
+
+ Test Plan: run 'make install' on stage2 crosscompiler
+
+ Reviewers: rwbarton, austin, bgamari
+
+ Subscribers: thomie, snowleopard
+
+ Differential Revision: https://phabricator.haskell.org/D3432
+
+diff --git a/ghc.mk b/ghc.mk
+index caa6c38fbb..8971f25981 100644
+--- a/ghc.mk
++++ b/ghc.mk
+@@ -962,6 +962,12 @@ endif
+
+ INSTALLED_PACKAGE_CONF=$(DESTDIR)$(topdir)/package.conf.d
+
++ifeq "$(CrossCompiling)" "YES"
++# when installing ghc-stage2 we can't run target's
++# 'ghc-pkg' and 'ghc-stage2' but those are needed for registration.
++INSTALLED_GHC_REAL=$(TOP)/inplace/bin/ghc-stage1
++INSTALLED_GHC_PKG_REAL=$(TOP)/$(ghc-pkg_DIST_BINARY)
++else # CrossCompiling
+ # Install packages in the right order, so that ghc-pkg doesn't complain.
+ # Also, install ghc-pkg first.
+ ifeq "$(Windows_Host)" "NO"
+@@ -971,6 +977,7 @@ else
+ INSTALLED_GHC_REAL=$(DESTDIR)$(bindir)/ghc.exe
+ INSTALLED_GHC_PKG_REAL=$(DESTDIR)$(bindir)/ghc-pkg.exe
+ endif
++endif # CrossCompiling
+
+ # Set the INSTALL_DISTDIR_p for each package; compiler is special
+ $(foreach p,$(filter-out compiler,$(INSTALL_PACKAGES)),\
+diff --git a/utils/ghc-pkg/ghc.mk b/utils/ghc-pkg/ghc.mk
+index 002c8122f2..4d5ef4e108 100644
+--- a/utils/ghc-pkg/ghc.mk
++++ b/utils/ghc-pkg/ghc.mk
+@@ -49,6 +49,12 @@ utils/ghc-pkg_dist_PROGNAME = ghc-pkg
+ utils/ghc-pkg_dist_SHELL_WRAPPER = YES
+ utils/ghc-pkg_dist_INSTALL_INPLACE = YES
+
++# When cross-built ghc-stage2 is installed 'make install' needs to call
++# native ghc-pkg (not the cross-built one) to register installed packages
++# 'ghc-pkg_DIST_BINARY' variable only refer to native binary.
++ghc-pkg_DIST_BINARY_NAME = ghc-pkg$(exeext0)
++ghc-pkg_DIST_BINARY = utils/ghc-pkg/dist/build/tmp/$(ghc-pkg_DIST_BINARY_NAME)
++
+ # See Note [Stage1Only vs stage=1] in mk/config.mk.in.
+ ifeq "$(Stage1Only)" "YES"
+ # Install the copy of ghc-pkg from the dist directory when running 'make
diff --git a/dev-lang/ghc/files/ghc-8.2.1_rc1-staged-cross.patch b/dev-lang/ghc/files/ghc-8.2.1_rc1-staged-cross.patch
new file mode 100644
index 00000000000..7e4ea7a9f61
--- /dev/null
+++ b/dev-lang/ghc/files/ghc-8.2.1_rc1-staged-cross.patch
@@ -0,0 +1,43 @@
+commit f2685df3b10e13f142736f28835e9064334bc143
+Author: Sergei Trofimovich <slyfox@gentoo.org>
+Date: Wed Apr 5 22:31:37 2017 +0100
+
+ avoid $(CrossCompilerPrefix) for stage2 install
+
+ Suppose we are crossbuilding ghc (when ghc-stage2
+ is a normal compiler for $target):
+
+ For this case 'make install' should install unprefixed
+ stage2 'ghc' and not '$(CorssCompilePrefix)-ghc'.
+
+ That way cross-built ghc is installable and
+ usable on target as if it would be built natively
+ on a target.
+
+ Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
+
+diff --git a/mk/config.mk.in b/mk/config.mk.in
+index 4d5d82aa80..5e274bb71f 100644
+--- a/mk/config.mk.in
++++ b/mk/config.mk.in
+@@ -530,7 +530,7 @@ SUPPORTS_THIS_UNIT_ID = @SUPPORTS_THIS_UNIT_ID@
+ # needs to know which gcc you're using in order to perform its tests.
+
+ GccVersion = @GccVersion@
+-CrossCompilePrefix = @CrossCompilePrefix@
++
+ # TargetPlatformFull retains the string passed to configure so we have it in
+ # the necessary format to pass to libffi's configure.
+ TargetPlatformFull = @TargetPlatformFull@
+@@ -567,6 +567,11 @@ CrossCompiling = @CrossCompiling@
+ # See Note [Stage1Only vs stage=1]
+ Stage1Only = NO
+
++# Installed tools prefix:
++# we add prefix to crosscompiler GHC only (ghc-stage1),
++# not cross-built GHC (not ghc-stage2).
++CrossCompilePrefix = $(if $(filter YES,$(Stage1Only)),@CrossCompilePrefix@,)
++
+ # Install stage 2 by default, or stage 1 in the cross compiler
+ # case. Can be changed to 3
+ INSTALL_GHC_STAGE= $(if $(filter YES,$(Stage1Only)),1,2)
diff --git a/dev-lang/ghc/files/ghc-8.2.1_rc1-unphased-cross.patch b/dev-lang/ghc/files/ghc-8.2.1_rc1-unphased-cross.patch
new file mode 100644
index 00000000000..a5528956de1
--- /dev/null
+++ b/dev-lang/ghc/files/ghc-8.2.1_rc1-unphased-cross.patch
@@ -0,0 +1,30 @@
+commit 6ff98b962db15d18eb1d082fe344cef692ecef8e
+Author: Sergei Trofimovich <slyfox@gentoo.org>
+Date: Thu Apr 6 08:55:56 2017 +0100
+
+ config.mk.in: remove phase=0 hack for CrossCompilePrefix
+
+ $(CrossCompilePrefix) is used only in 'make install'
+ target filenames in $(DESTDIR). None of inplace (or boot)
+ files contain $(CrossCompilePrefix).
+
+ Thus we don't need to worry about phases.
+
+ Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
+
+diff --git a/mk/config.mk.in b/mk/config.mk.in
+index 4e61eea821..4d5d82aa80 100644
+--- a/mk/config.mk.in
++++ b/mk/config.mk.in
+@@ -530,11 +530,7 @@ SUPPORTS_THIS_UNIT_ID = @SUPPORTS_THIS_UNIT_ID@
+ # needs to know which gcc you're using in order to perform its tests.
+
+ GccVersion = @GccVersion@
+-ifeq "$(phase)" "0"
+-CrossCompilePrefix =
+-else
+ CrossCompilePrefix = @CrossCompilePrefix@
+-endif
+ # TargetPlatformFull retains the string passed to configure so we have it in
+ # the necessary format to pass to libffi's configure.
+ TargetPlatformFull = @TargetPlatformFull@
diff --git a/dev-lang/ghc/files/ghc-8.2.1_rc1-win32-cross-1.patch b/dev-lang/ghc/files/ghc-8.2.1_rc1-win32-cross-1.patch
new file mode 100644
index 00000000000..79751e1ecbd
--- /dev/null
+++ b/dev-lang/ghc/files/ghc-8.2.1_rc1-win32-cross-1.patch
@@ -0,0 +1,124 @@
+commit a691f6a7a191a268380805481d8e63134764a4a1
+Author: Sergei Trofimovich <slyfox@inbox.ru>
+Date: Sat Apr 29 22:02:24 2017 +0100
+
+ add basic cross-compilation support (#87)
+
+ * fix include case: s/#include <Lmcons.h>/#include <lmcons.h>
+
+ Noticed when cross-compiling win32 on linux to i686-w64-mingw32-gcc.
+ i686-w64-mingw32 provides all headers in lowercase.
+
+ Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
+
+ * Pen.hsc: don't use c99-style comments in enum declarations
+
+ Ths change workarounds hsc2hs bug in cross-compile mode:
+ https://ghc.haskell.org/trac/ghc/ticket/13619
+
+ To reproduce the build failure it's enough to run
+ $ cabal configure --hsc2hs-options='--cross-safe --cross-compile'
+ $ cabal build --hsc2hs-options='--cross-safe --cross-compile'
+
+ Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
+
+ * SimpleMAPI.hsc: don't use #ifdef in enum declarations
+
+ This change workarounds hsc2hs bug in cross-compile mode:
+ https://ghc.haskell.org/trac/ghc/ticket/13620
+
+ To reproduce the build failure it's enough to run
+ $ cabal configure --hsc2hs-options='--cross-safe --cross-compile'
+ $ cabal build --hsc2hs-options='--cross-safe --cross-compile'
+
+ Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
+
+diff --git a/Graphics/Win32/GDI/Pen.hsc b/Graphics/Win32/GDI/Pen.hsc
+index c880170..8d8df5d 100644
+--- a/Graphics/Win32/GDI/Pen.hsc
++++ b/Graphics/Win32/GDI/Pen.hsc
+@@ -56,7 +56,7 @@ foreign import WINDOWS_CCONV unsafe "windows.h DeleteObject"
+
+ type PenStyle = INT
+
+-#{enum PenStyle, // Pick one of these
++#{enum PenStyle,
+ , pS_SOLID = PS_SOLID // default
+ , pS_DASH = PS_DASH // -------
+ , pS_DOT = PS_DOT // .......
+@@ -69,14 +69,14 @@ type PenStyle = INT
+ , pS_STYLE_MASK = PS_STYLE_MASK // all the above
+ }
+
+-#{enum PenStyle , // "or" with one of these
++#{enum PenStyle,
+ , pS_ENDCAP_ROUND = PS_ENDCAP_ROUND // default
+ , pS_ENDCAP_SQUARE = PS_ENDCAP_SQUARE
+ , pS_ENDCAP_FLAT = PS_ENDCAP_FLAT
+ , pS_ENDCAP_MASK = PS_ENDCAP_MASK // all the above
+ }
+
+-#{enum PenStyle, // "or" with one of these
++#{enum PenStyle,
+ , pS_JOIN_ROUND = PS_JOIN_ROUND // default
+ , pS_JOIN_BEVEL = PS_JOIN_BEVEL
+ , pS_JOIN_MITER = PS_JOIN_MITER
+@@ -87,7 +87,7 @@ If PS_JOIN_MASK is not defined with your GNU Windows32 header files,
+ you'll have to define it.
+ -}
+
+-#{enum PenStyle, // "or" with one of these
++#{enum PenStyle,
+ , pS_COSMETIC = PS_COSMETIC // default
+ , pS_GEOMETRIC = PS_GEOMETRIC
+ , pS_TYPE_MASK = PS_TYPE_MASK // all the above
+diff --git a/System/Win32/Info/Computer.hsc b/System/Win32/Info/Computer.hsc
+index bb2eb72..65ae8dc 100644
+--- a/System/Win32/Info/Computer.hsc
++++ b/System/Win32/Info/Computer.hsc
+@@ -65,7 +65,7 @@ import System.Win32.Utils ( tryWithoutNull )
+ import System.Win32.Word ( DWORD, LPDWORD )
+
+ #include <windows.h>
+-#include <Lmcons.h>
++#include <lmcons.h>
+ #include "alignment.h"
+ ##include "windows_cconv.h"
+
+diff --git a/System/Win32/SimpleMAPI.hsc b/System/Win32/SimpleMAPI.hsc
+index 9727cfc..5ebf06b 100644
+--- a/System/Win32/SimpleMAPI.hsc
++++ b/System/Win32/SimpleMAPI.hsc
+@@ -53,12 +53,6 @@ type MapiFlag = ULONG
+ , mAPI_LOGON_UI = MAPI_LOGON_UI
+ , mAPI_NEW_SESSION = MAPI_NEW_SESSION
+ , mAPI_FORCE_DOWNLOAD = MAPI_FORCE_DOWNLOAD
+-#ifdef MAPI_LOGOFF_SHARED
+- , mAPI_LOGOFF_SHARED = MAPI_LOGOFF_SHARED
+-#endif
+-#ifdef MAPI_LOGOFF_UI
+- , mAPI_LOGOFF_UI = MAPI_LOGOFF_UI
+-#endif
+ , mAPI_DIALOG = MAPI_DIALOG
+ , mAPI_UNREAD_ONLY = MAPI_UNREAD_ONLY
+ , mAPI_LONG_MSGID = MAPI_LONG_MSGID
+@@ -74,6 +68,19 @@ type MapiFlag = ULONG
+ , mAPI_RECEIPT_REQUESTED = MAPI_RECEIPT_REQUESTED
+ , mAPI_SENT = MAPI_SENT
+ }
++-- Have to define enum values outside previous declaration due to
++-- hsc2hs bug in --cross-compile mode:
++-- https://ghc.haskell.org/trac/ghc/ticket/13620
++#ifdef MAPI_LOGOFF_SHARED
++#{enum MapiFlag,
++ , mAPI_LOGOFF_SHARED = MAPI_LOGOFF_SHARED
++}
++#endif
++#ifdef MAPI_LOGOFF_UI
++#{enum MapiFlag,
++ , mAPI_LOGOFF_UI = MAPI_LOGOFF_UI
++}
++#endif
+
+ mapiErrors :: [(ULONG,String)]
+ mapiErrors =
diff --git a/dev-lang/ghc/files/ghc-8.2.1_rc1-win32-cross-2-hack.patch b/dev-lang/ghc/files/ghc-8.2.1_rc1-win32-cross-2-hack.patch
new file mode 100644
index 00000000000..6fdcf2d1278
--- /dev/null
+++ b/dev-lang/ghc/files/ghc-8.2.1_rc1-win32-cross-2-hack.patch
@@ -0,0 +1,144 @@
+hsc2hs can't detect values at compile-time if those are
+declared as pointers: https://github.com/haskell/win32/issues/88
+
+This patch is a huge hack: we encode absolute vaues from <windows.h>
+diff --git a/Graphics/Win32/GDI/Types.hsc b/Graphics/Win32/GDI/Types.hsc
+index c363530..8643cee 100644
+--- a/Graphics/Win32/GDI/Types.hsc
++++ b/Graphics/Win32/GDI/Types.hsc
+@@ -216,10 +216,10 @@ type HWND = HANDLE
+ type MbHWND = Maybe HWND
+
+ #{enum HWND, castUINTPtrToPtr
+- , hWND_BOTTOM = (UINT_PTR)HWND_BOTTOM
+- , hWND_NOTOPMOST = (UINT_PTR)HWND_NOTOPMOST
+- , hWND_TOP = (UINT_PTR)HWND_TOP
+- , hWND_TOPMOST = (UINT_PTR)HWND_TOPMOST
++ , hWND_BOTTOM = (UINT_PTR)(INT_PTR)(1)
++ , hWND_NOTOPMOST = (UINT_PTR)(INT_PTR)(-2)
++ , hWND_TOP = (UINT_PTR)(INT_PTR)(0)
++ , hWND_TOPMOST = (UINT_PTR)(INT_PTR)(-1)
+ }
+
+ type HMENU = HANDLE
+diff --git a/Graphics/Win32/Misc.hsc b/Graphics/Win32/Misc.hsc
+index 1248b5a..c791a20 100644
+--- a/Graphics/Win32/Misc.hsc
++++ b/Graphics/Win32/Misc.hsc
+@@ -67,23 +67,23 @@ foreign import WINDOWS_CCONV unsafe "windows.h LoadIconW"
+ c_LoadIcon :: HINSTANCE -> Icon -> IO HICON
+
+ #{enum Cursor, castUINTPtrToPtr
+- , iDC_ARROW = (UINT_PTR)IDC_ARROW
+- , iDC_IBEAM = (UINT_PTR)IDC_IBEAM
+- , iDC_WAIT = (UINT_PTR)IDC_WAIT
+- , iDC_CROSS = (UINT_PTR)IDC_CROSS
+- , iDC_UPARROW = (UINT_PTR)IDC_UPARROW
+- , iDC_SIZENWSE = (UINT_PTR)IDC_SIZENWSE
+- , iDC_SIZENESW = (UINT_PTR)IDC_SIZENESW
+- , iDC_SIZEWE = (UINT_PTR)IDC_SIZEWE
+- , iDC_SIZENS = (UINT_PTR)IDC_SIZENS
++ , iDC_ARROW = (UINT_PTR)(32512)
++ , iDC_IBEAM = (UINT_PTR)(32513)
++ , iDC_WAIT = (UINT_PTR)(32514)
++ , iDC_CROSS = (UINT_PTR)(32515)
++ , iDC_UPARROW = (UINT_PTR)(32516)
++ , iDC_SIZENWSE = (UINT_PTR)(32642)
++ , iDC_SIZENESW = (UINT_PTR)(32643)
++ , iDC_SIZEWE = (UINT_PTR)(32644)
++ , iDC_SIZENS = (UINT_PTR)(32645)
+ }
+
+ #{enum Icon, castUINTPtrToPtr
+- , iDI_APPLICATION = (UINT_PTR)IDI_APPLICATION
+- , iDI_HAND = (UINT_PTR)IDI_HAND
+- , iDI_QUESTION = (UINT_PTR)IDI_QUESTION
+- , iDI_EXCLAMATION = (UINT_PTR)IDI_EXCLAMATION
+- , iDI_ASTERISK = (UINT_PTR)IDI_ASTERISK
++ , iDI_APPLICATION = (UINT_PTR)(32512)
++ , iDI_HAND = (UINT_PTR)(32513)
++ , iDI_QUESTION = (UINT_PTR)(32514)
++ , iDI_EXCLAMATION = (UINT_PTR)(32515)
++ , iDI_ASTERISK = (UINT_PTR)(32516)
+ }
+
+ ----------------------------------------------------------------
+diff --git a/Graphics/Win32/Resource.hsc b/Graphics/Win32/Resource.hsc
+index e8ad565..ca58fa2 100644
+--- a/Graphics/Win32/Resource.hsc
++++ b/Graphics/Win32/Resource.hsc
+@@ -61,23 +61,23 @@ foreign import WINDOWS_CCONV unsafe "windows.h EndUpdateResourceW"
+ type ResourceType = LPCTSTR
+
+ #{enum ResourceType, castUINTPtrToPtr
+- , rT_ACCELERATOR = (UINT_PTR)RT_ACCELERATOR // Accelerator table
+- , rT_ANICURSOR = (UINT_PTR)RT_ANICURSOR // Animated cursor
+- , rT_ANIICON = (UINT_PTR)RT_ANIICON // Animated icon
+- , rT_BITMAP = (UINT_PTR)RT_BITMAP // Bitmap resource
+- , rT_CURSOR = (UINT_PTR)RT_CURSOR // Hardware-dependent cursor resource
+- , rT_DIALOG = (UINT_PTR)RT_DIALOG // Dialog box
+- , rT_FONT = (UINT_PTR)RT_FONT // Font resource
+- , rT_FONTDIR = (UINT_PTR)RT_FONTDIR // Font directory resource
+- , rT_GROUP_CURSOR = (UINT_PTR)RT_GROUP_CURSOR // Hardware-independent cursor resource
+- , rT_GROUP_ICON = (UINT_PTR)RT_GROUP_ICON // Hardware-independent icon resource
+- , rT_HTML = (UINT_PTR)RT_HTML // HTML document
+- , rT_ICON = (UINT_PTR)RT_ICON // Hardware-dependent icon resource
+- , rT_MENU = (UINT_PTR)RT_MENU // Menu resource
+- , rT_MESSAGETABLE = (UINT_PTR)RT_MESSAGETABLE // Message-table entry
+- , rT_RCDATA = (UINT_PTR)RT_RCDATA // Application-defined resource (raw data)
+- , rT_STRING = (UINT_PTR)RT_STRING // String-table entry
+- , rT_VERSION = (UINT_PTR)RT_VERSION // Version resource
++ , rT_ACCELERATOR = (UINT_PTR)(9)
++ , rT_ANICURSOR = (UINT_PTR)(21)
++ , rT_ANIICON = (UINT_PTR)(22)
++ , rT_BITMAP = (UINT_PTR)(2)
++ , rT_CURSOR = (UINT_PTR)(1)
++ , rT_DIALOG = (UINT_PTR)(5)
++ , rT_FONT = (UINT_PTR)(8)
++ , rT_FONTDIR = (UINT_PTR)(7)
++ , rT_GROUP_CURSOR = (UINT_PTR)(1 + DIFFERENCE)
++ , rT_GROUP_ICON = (UINT_PTR)(3 + DIFFERENCE)
++ , rT_HTML = (UINT_PTR)(23)
++ , rT_ICON = (UINT_PTR)(3)
++ , rT_MENU = (UINT_PTR)(4)
++ , rT_MESSAGETABLE = (UINT_PTR)(11)
++ , rT_RCDATA = (UINT_PTR)(10)
++ , rT_STRING = (UINT_PTR)(6)
++ , rT_VERSION = (UINT_PTR)(16)
+ }
+
+ findResource :: HMODULE -> String -> ResourceType -> IO HRSRC
+diff --git a/Graphics/Win32/Window/PostMessage.hsc b/Graphics/Win32/Window/PostMessage.hsc
+index 7f4c9f0..609f3f6 100644
+--- a/Graphics/Win32/Window/PostMessage.hsc
++++ b/Graphics/Win32/Window/PostMessage.hsc
+@@ -41,7 +41,7 @@ foreign import WINDOWS_CCONV "windows.h PostThreadMessageW"
+ c_PostThreadMessage :: DWORD -> WindowMessage -> WPARAM -> LPARAM -> IO BOOL
+
+ #{enum HWND, castUINTPtrToPtr
+- , hWND_BROADCAST = (UINT_PTR)HWND_BROADCAST
++ , hWND_BROADCAST = (UINT_PTR)(0xffff)
+ }
+
+ foreign import WINDOWS_CCONV "windows.h InSendMessage"
+diff --git a/System/Win32/Registry.hsc b/System/Win32/Registry.hsc
+index afbb011..c7edfc1 100644
+--- a/System/Win32/Registry.hsc
++++ b/System/Win32/Registry.hsc
+@@ -80,11 +80,11 @@ import System.Win32.Types (castUINTPtrToPtr, failUnlessSuccessOr, maybePtr)
+ #include <windows.h>
+
+ #{enum HKEY, (unsafePerformIO . newForeignHANDLE . castUINTPtrToPtr)
+- , hKEY_CLASSES_ROOT = (UINT_PTR)HKEY_CLASSES_ROOT
+- , hKEY_CURRENT_CONFIG = (UINT_PTR)HKEY_CURRENT_CONFIG
+- , hKEY_CURRENT_USER = (UINT_PTR)HKEY_CURRENT_USER
+- , hKEY_LOCAL_MACHINE = (UINT_PTR)HKEY_LOCAL_MACHINE
+- , hKEY_USERS = (UINT_PTR)HKEY_USERS
++ , hKEY_CLASSES_ROOT = (UINT_PTR)(0x80000000)
++ , hKEY_CURRENT_CONFIG = (UINT_PTR)(0x80000005)
++ , hKEY_CURRENT_USER = (UINT_PTR)(0x80000001)
++ , hKEY_LOCAL_MACHINE = (UINT_PTR)(0x80000002)
++ , hKEY_USERS = (UINT_PTR)(0x80000003)
+ }
+ -- , PKEYERFORMANCE_DATA NT only
+ -- , HKEY_DYN_DATA 95/98 only
diff --git a/dev-lang/ghc/files/ghc-8.2.1_rc2-O2-unreg.patch b/dev-lang/ghc/files/ghc-8.2.1_rc2-O2-unreg.patch
new file mode 100644
index 00000000000..00f9ca4fdff
--- /dev/null
+++ b/dev-lang/ghc/files/ghc-8.2.1_rc2-O2-unreg.patch
@@ -0,0 +1,35 @@
+ghc -O2 generates too large C files for unregisterised compiler.
+On ia64 it causes DynFlags to compile for 60 minutes (then assembler
+crashes).
+
+To decrease C code inflation we don't use -O2 in UNREG mode.
+diff --git a/mk/config.mk.in b/mk/config.mk.in
+index 4e61eea..15a56e9 100644
+--- a/mk/config.mk.in
++++ b/mk/config.mk.in
+@@ -72,11 +72,2 @@ GhcStage3HcOpts=-O2
+
+-# Disable -O2 optimization. Otherwise amount of generated C code
+-# makes things very slow to compile (~5 minutes on core-i7 for 'compiler/hsSyn/HsExpr.hs')
+-# and sometimes not compile at all (powerpc64 overflows something
+-# on 'compiler/hsSyn/HsExpr.hs').
+-ifeq "$(GhcUnregisterised)" "YES"
+-GhcStage1HcOpts=
+-GhcStage2HcOpts=
+-GhcStage3HcOpts=
+-endif
+
+@@ -904 +895,13 @@ CURSES_INCLUDE_DIRS = @CURSES_INCLUDE_DIRS@
+ CURSES_LIB_DIRS = @CURSES_LIB_DIRS@
++
++# Disable -O2 optimization. Otherwise amount of generated C code
++# makes things very slow to compile (~5 minutes on core-i7 for 'compiler/hsSyn/HsExpr.hs')
++# and sometimes not compile at all (powerpc64 overflows something
++# on 'compiler/hsSyn/HsExpr.hs').
++ifeq "$(GhcUnregisterised)" "YES"
++GhcStage1HcOpts=
++GhcStage2HcOpts=
++GhcStage3HcOpts=
++
++GhcLibHcOpts=
++endif
diff --git a/dev-lang/ghc/files/ghc-8.2.1_rc3-any-vendor.patch b/dev-lang/ghc/files/ghc-8.2.1_rc3-any-vendor.patch
new file mode 100644
index 00000000000..b55e37a8bf9
--- /dev/null
+++ b/dev-lang/ghc/files/ghc-8.2.1_rc3-any-vendor.patch
@@ -0,0 +1,44 @@
+From c2303dff95aa174021a1950656fdf9a1cf983959 Mon Sep 17 00:00:00 2001
+From: Sergei Trofimovich <slyfox@gentoo.org>
+Date: Sat, 8 Jul 2017 09:47:12 +0100
+Subject: [PATCH] aclocal.m4: allow arbitrary <vendor> string in toolchain
+ triplets
+
+Canonical triplets have a form of
+ <arch>-<vendor>-<os>[-<abi>]
+
+Checking for vendor is almost never correct as it's an
+arbitrary string.
+
+It's useful to have multiple "vendors" to denote
+otherwise the same (WRT <arch>, <os>, <abi>) target:
+ --target=x86_64-pc-linux-gnu
+ --target=x86_64-unknown-linux-gnu
+ --target=x86_64-ghc80-linux-gnu
+ --target=x86_64-ghchead-linux-gnu
+
+Do not fail unknown vendors. Only emit a warning.
+Ideally configure checks should never use "vendor".
+
+Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
+---
+ aclocal.m4 | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/aclocal.m4 b/aclocal.m4
+index 001f813dfc..1d9c09b0cd 100644
+--- a/aclocal.m4
++++ b/aclocal.m4
+@@ -230,8 +230,7 @@ AC_DEFUN([FPTOOLS_SET_HASKELL_PLATFORM_VARS],
+ dec|none|unknown|hp|apple|next|sun|sgi|ibm|montavista|portbld)
+ ;;
+ *)
+- echo "Unknown vendor [$]1"
+- exit 1
++ AC_MSG_WARN([Unknown vendor [$]1])
+ ;;
+ esac
+ }
+--
+2.13.3
+
diff --git a/dev-lang/ghc/files/ghc-8.2.1_rc3-stginit-data.patch b/dev-lang/ghc/files/ghc-8.2.1_rc3-stginit-data.patch
new file mode 100644
index 00000000000..81e751d778c
--- /dev/null
+++ b/dev-lang/ghc/files/ghc-8.2.1_rc3-stginit-data.patch
@@ -0,0 +1,27 @@
+Fix label type for __stginit_* labels: those are .data labels, not .text
+
+Noticed when was building --enable-unregisterised build for x86_64:
+
+/tmp/ghc22931_0/ghc_3.hc:5:9: error:
+ error: '__stginit_ghczmprim_GHCziTypes' redeclared as different kind of symbol
+ StgWord __stginit_ghczmprim_GHCziTypes[]__attribute__((aligned(8)))= {
+ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ |
+5 | StgWord __stginit_ghczmprim_GHCziTypes[]__attribute__((aligned(8)))= {
+ | ^
+
+In file included from /tmp/ghc22931_0/ghc_3.hc:3:0: error:
+
+/tmp/ghc22931_0/ghc_3.hc:4:5: error:
+ note: previous declaration of '__stginit_ghczmprim_GHCziTypes' was here
+ EF_(__stginit_ghczmprim_GHCziTypes);
+ ^
+diff --git a/compiler/cmm/CLabel.hs b/compiler/cmm/CLabel.hs
+index 77a889a..05d71ab 100644
+--- a/compiler/cmm/CLabel.hs
++++ b/compiler/cmm/CLabel.hs
+@@ -956,3 +956,3 @@ labelType (CaseLabel _ CaseReturnInfo) = DataLabel
+ labelType (CaseLabel _ _) = CodeLabel
+-labelType (PlainModuleInitLabel _) = CodeLabel
++labelType (PlainModuleInitLabel _) = DataLabel
+ labelType (SRTLabel _) = DataLabel
diff --git a/dev-lang/ghc/ghc-8.2.1.ebuild b/dev-lang/ghc/ghc-8.2.1.ebuild
new file mode 100644
index 00000000000..56c31c83f65
--- /dev/null
+++ b/dev-lang/ghc/ghc-8.2.1.ebuild
@@ -0,0 +1,770 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+
+# to make make a crosscompiler use crossdev and symlink ghc tree into
+# cross overlay. result would look like 'cross-sparc-unknown-linux-gnu/ghc'
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} = ${CHOST} ]] ; then
+ if [[ ${CATEGORY/cross-} != ${CATEGORY} ]] ; then
+ export CTARGET=${CATEGORY/cross-}
+ fi
+fi
+
+inherit autotools bash-completion-r1 eutils flag-o-matic ghc-package
+inherit multilib pax-utils toolchain-funcs versionator prefix
+inherit check-reqs
+DESCRIPTION="The Glasgow Haskell Compiler"
+HOMEPAGE="http://www.haskell.org/ghc/"
+
+# we don't have any binaries yet
+arch_binaries=""
+
+# sorted!
+#arch_binaries="$arch_binaries alpha? ( http://code.haskell.org/~slyfox/ghc-alpha/ghc-bin-${PV}-alpha.tbz2 )"
+#arch_binaries="$arch_binaries arm? ( http://code.haskell.org/~slyfox/ghc-arm/ghc-bin-${PV}-armv7a-hardfloat-linux-gnueabi.tbz2 )"
+#arch_binaries="$arch_binaries arm64? ( http://code.haskell.org/~slyfox/ghc-arm64/ghc-bin-${PV}-aarch64-unknown-linux-gnu.tbz2 )"
+arch_binaries="$arch_binaries amd64? ( http://code.haskell.org/~slyfox/ghc-amd64/ghc-bin-${PV}-x86_64-pc-linux-gnu.tbz2 )"
+#arch_binaries="$arch_binaries ia64? ( http://code.haskell.org/~slyfox/ghc-ia64/ghc-bin-${PV}-ia64-fixed-fiw.tbz2 )"
+#arch_binaries="$arch_binaries ppc? ( http://code.haskell.org/~slyfox/ghc-ppc/ghc-bin-${PV}-ppc.tbz2 )"
+#arch_binaries="$arch_binaries ppc64? ( http://code.haskell.org/~slyfox/ghc-ppc64/ghc-bin-${PV}-ppc64.tbz2 )"
+#arch_binaries="$arch_binaries sparc? ( http://code.haskell.org/~slyfox/ghc-sparc/ghc-bin-${PV}-sparc.tbz2 )"
+arch_binaries="$arch_binaries x86? ( http://code.haskell.org/~slyfox/ghc-x86/ghc-bin-${PV}-i686-pc-linux-gnu.tbz2 )"
+
+# various ports:
+#arch_binaries="$arch_binaries x86-fbsd? ( http://code.haskell.org/~slyfox/ghc-x86-fbsd/ghc-bin-${PV}-x86-fbsd.tbz2 )"
+
+# 0 - yet
+yet_binary() {
+ case "${ARCH}" in
+ #alpha) return 0 ;;
+ #arm64) return 0 ;;
+ #arm) return 0 ;;
+ amd64) return 0 ;;
+ #ia64) return 0 ;;
+ #ppc) return 0 ;;
+ #ppc64) return 0 ;;
+ #sparc) return 0 ;;
+ x86) return 0 ;;
+ *) return 1 ;;
+ esac
+}
+
+GHC_PV=${PV}
+#GHC_PV=8.2.0.20170704 # uncomment only for -rc ebuilds
+GHC_P=${PN}-${GHC_PV} # using ${P} is almost never correct
+
+SRC_URI="!binary? ( http://downloads.haskell.org/~ghc/${PV/_rc/-rc}/${GHC_P}-src.tar.xz )"
+S="${WORKDIR}"/${GHC_P}
+
+[[ -n $arch_binaries ]] && SRC_URI+=" !ghcbootstrap? ( $arch_binaries )"
+
+BUMP_LIBRARIES=(
+ # "hackage-name hackage-version"
+)
+
+LICENSE="BSD"
+SLOT="0/${PV}"
+#KEYWORDS="~alpha ~amd64 ~x86 ~amd64-linux ~x86-linux"
+IUSE="doc ghcbootstrap ghcmakebinary +gmp profile"
+IUSE+=" binary"
+
+RDEPEND="
+ >=dev-lang/perl-5.6.1
+ dev-libs/gmp:0=
+ sys-libs/ncurses:0=[unicode]
+ !ghcmakebinary? ( virtual/libffi:= )
+"
+
+# This set of dependencies is needed to run
+# prebuilt ghc. We specifically avoid ncurses
+# dependency with:
+# utils/ghc-pkg_HC_OPTS += -DBOOTSTRAPPING
+PREBUILT_BINARY_DEPENDS="
+ !prefix? ( elibc_glibc? ( >=sys-libs/glibc-2.17 ) )
+"
+# This set of dependencies is needed to install
+# ghc[binary] in system. terminfo package is linked
+# against ncurses.
+PREBUILT_BINARY_RDEPENDS="${PREBUILT_BINARY_DEPENDS}
+ sys-libs/ncurses:0/6
+"
+
+RDEPEND+="binary? ( ${PREBUILT_BINARY_RDEPENDS} )"
+
+DEPEND="${RDEPEND}
+ doc? ( app-text/docbook-xml-dtd:4.2
+ app-text/docbook-xml-dtd:4.5
+ app-text/docbook-xsl-stylesheets
+ dev-python/sphinx
+ >=dev-libs/libxslt-1.1.2 )
+ !ghcbootstrap? ( ${PREBUILT_BINARY_DEPENDS} )"
+
+PDEPEND="!ghcbootstrap? ( =app-admin/haskell-updater-1.2* )"
+
+REQUIRED_USE="?? ( ghcbootstrap binary )"
+
+# haskell libraries built with cabal in configure mode, #515354
+QA_CONFIGURE_OPTIONS+=" --with-compiler --with-gcc"
+
+is_crosscompile() {
+ [[ ${CHOST} != ${CTARGET} ]]
+}
+
+is_native() {
+ [[ ${CHOST} == ${CBUILD} ]] && [[ ${CHOST} == ${CTARGET} ]]
+}
+
+# returns tool prefix for crosscompiler.
+# Example:
+# CTARGET=armv7a-unknown-linux-gnueabi
+# CHOST=x86_64-pc-linux-gnu
+# "armv7a-unknown-linux-gnueabi-"
+# CTARGET=${CHOST}
+# ""
+# Used in tools and library prefix:
+# "${ED}"/usr/bin/$(cross)haddock
+# "${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
+
+cross() {
+ if is_crosscompile; then
+ echo "${CTARGET}-"
+ else
+ echo ""
+ fi
+}
+
+append-ghc-cflags() {
+ local persistent compile assemble link
+ local flag ghcflag
+
+ for flag in $*; do
+ case ${flag} in
+ persistent) persistent="yes";;
+ compile) compile="yes";;
+ assemble) assemble="yes";;
+ link) link="yes";;
+ *)
+ [[ ${compile} ]] && ghcflag="-optc${flag}" CFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
+ [[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
+ [[ ${assemble} ]] && ghcflag="-opta${flag}" CFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
+ [[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
+ [[ ${link} ]] && ghcflag="-optl${flag}" LDFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
+ [[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
+ ;;
+ esac
+ done
+}
+
+# $1 - lib name (under libraries/)
+# $2 - lib version
+# example: bump_lib "transformers" "0.4.2.0"
+bump_lib() {
+ local pn=$1 pv=$2
+ local p=${pn}-${pv}
+ local f
+
+ einfo "Bumping ${pn} up to ${pv}"
+
+ for f in ghc.mk GNUmakefile; do
+ mv libraries/"${pn}"/$f "${WORKDIR}"/"${p}"/$f || die
+ done
+ mv libraries/"${pn}" "${WORKDIR}"/"${pn}".old || die
+ mv "${WORKDIR}"/"${p}" libraries/"${pn}" || die
+}
+
+update_SRC_URI() {
+ local p pn pv
+ for p in "${BUMP_LIBRARIES[@]}"; do
+ set -- $p
+ pn=$1 pv=$2
+
+ SRC_URI+=" mirror://hackage/package/${pn}/${pn}-${pv}.tar.gz"
+ done
+}
+
+update_SRC_URI
+
+bump_libs() {
+ local p pn pv
+ for p in "${BUMP_LIBRARIES[@]}"; do
+ set -- $p
+ pn=$1 pv=$2
+
+ bump_lib "${pn}" "${pv}"
+ done
+}
+
+ghc_setup_cflags() {
+ # TODO: plumb CFLAGS and BUILD_CFLAGS to respective CONF_CC_OPTS_STAGE<N>
+ if ! is_native; then
+ export CFLAGS=${GHC_CFLAGS-"-O2 -pipe"}
+ export LDFLAGS=${GHC_LDFLAGS-"-Wl,-O1"}
+ einfo "Crosscompiling mode:"
+ einfo " CHOST: ${CHOST}"
+ einfo " CTARGET: ${CTARGET}"
+ einfo " CFLAGS: ${CFLAGS}"
+ einfo " LDFLAGS: ${LDFLAGS}"
+ einfo " prefix: $(cross)"
+ return
+ fi
+ # We need to be very careful with the CFLAGS we ask ghc to pass through to
+ # gcc. There are plenty of flags which will make gcc produce output that
+ # breaks ghc in various ways. The main ones we want to pass through are
+ # -mcpu / -march flags. These are important for arches like alpha & sparc.
+ # We also use these CFLAGS for building the C parts of ghc, ie the rts.
+ strip-flags
+ strip-unsupported-flags
+
+ # Cmm can't parse line numbers #482086
+ replace-flags -ggdb[3-9] -ggdb2
+
+ GHC_FLAGS=""
+ GHC_PERSISTENT_FLAGS=""
+ for flag in ${CFLAGS}; do
+ case ${flag} in
+
+ # Ignore extra optimisation (ghc passes -O to gcc anyway)
+ # -O2 and above break on too many systems
+ -O*) ;;
+
+ # Arch and ABI flags are what we're really after
+ -m*) append-ghc-cflags compile assemble ${flag};;
+
+ # Sometimes it's handy to see backtrace of RTS
+ # to get an idea what happens there
+ -g*) append-ghc-cflags compile ${flag};;
+
+ # Ignore all other flags, including all -f* flags
+ esac
+ done
+
+ for flag in ${LDFLAGS}; do
+ append-ghc-cflags link ${flag}
+ done
+
+ # GHC uses ${CBUILD}-gcc, ${CHOST}-gcc and ${CTARGET}-gcc at a single build.
+ # Skip any gentoo-specific tweaks for cross-case to avoid passing unsupported
+ # options to gcc.
+ if is_native; then
+ # hardened-gcc needs to be disabled, because our prebuilt binaries/libraries
+ # are not built with fPIC, bug #606666
+ gcc-specs-pie && append-ghc-cflags persistent compile link -nopie
+ tc-is-gcc && version_is_at_least 6.3 $(gcc-version) && if ! use ghcbootstrap; then
+ # gcc-6.3 has support for -no-pie upstream, but spelling differs from
+ # gentoo-specific '-nopie'. We enable it in non-bootstrap to allow
+ # hardened users try '-pie' in USE=ghcbootstrap mode.
+ append-ghc-cflags compile link -no-pie
+ fi
+
+ # prevent from failing to build unregisterised ghc:
+ # http://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg171602.html
+ use ppc64 && append-ghc-cflags persistent compile -mminimal-toc
+ fi
+}
+
+# substitutes string $1 to $2 in files $3 $4 ...
+relocate_path() {
+ local from=$1
+ local to=$2
+ shift 2
+ local file=
+ for file in "$@"
+ do
+ sed -i -e "s|$from|$to|g" \
+ "$file" || die "path relocation failed for '$file'"
+ done
+}
+
+# changes hardcoded ghc paths and updates package index
+# $1 - new absolute root path
+relocate_ghc() {
+ local to=$1
+
+ # libdir for prebuilt binary and for current system may mismatch
+ # It does for prefix installation for example: bug #476998
+ local bin_ghc_prefix=${WORKDIR}/usr
+ local bin_libpath=$(echo "${bin_ghc_prefix}"/lib*)
+ local bin_libdir=${bin_libpath#${bin_ghc_prefix}/}
+
+ # backup original script to use it later after relocation
+ local gp_back="${T}/ghc-pkg-${GHC_PV}-orig"
+ cp "${WORKDIR}/usr/bin/ghc-pkg-${GHC_PV}" "$gp_back" || die "unable to backup ghc-pkg wrapper"
+
+ if [[ ${bin_libdir} != $(get_libdir) ]]; then
+ einfo "Relocating '${bin_libdir}' to '$(get_libdir)' (bug #476998)"
+ # moving the dir itself is not strictly needed
+ # but then USE=binary would result in installing
+ # in '${bin_libdir}'
+ mv "${bin_ghc_prefix}/${bin_libdir}" "${bin_ghc_prefix}/$(get_libdir)" || die
+
+ relocate_path "/usr/${bin_libdir}" "/usr/$(get_libdir)" \
+ "${WORKDIR}/usr/bin/ghc-${GHC_PV}" \
+ "${WORKDIR}/usr/bin/ghci-${GHC_PV}" \
+ "${WORKDIR}/usr/bin/ghc-pkg-${GHC_PV}" \
+ "${WORKDIR}/usr/bin/hsc2hs" \
+ "${WORKDIR}/usr/bin/runghc-${GHC_PV}" \
+ "$gp_back" \
+ "${WORKDIR}/usr/$(get_libdir)/${GHC_P}/package.conf.d/"*
+ fi
+
+ # Relocate from /usr to ${EPREFIX}/usr
+ relocate_path "/usr" "${to}/usr" \
+ "${WORKDIR}/usr/bin/ghc-${GHC_PV}" \
+ "${WORKDIR}/usr/bin/ghci-${GHC_PV}" \
+ "${WORKDIR}/usr/bin/ghc-pkg-${GHC_PV}" \
+ "${WORKDIR}/usr/bin/hsc2hs" \
+ "${WORKDIR}/usr/bin/runghc-${GHC_PV}" \
+ "${WORKDIR}/usr/$(get_libdir)/${GHC_P}/package.conf.d/"*
+
+ # this one we will use to regenerate cache
+ # so it should point to current tree location
+ relocate_path "/usr" "${WORKDIR}/usr" "$gp_back"
+
+ if use prefix; then
+ # and insert LD_LIBRARY_PATH entry to EPREFIX dir tree
+ # TODO: add the same for darwin's CHOST and it's DYLD_
+ local new_ldpath='LD_LIBRARY_PATH="'${EPREFIX}/$(get_libdir):${EPREFIX}/usr/$(get_libdir)'${LD_LIBRARY_PATH:+:}${LD_LIBRARY_PATH}"\nexport LD_LIBRARY_PATH'
+ sed -i -e '2i'"$new_ldpath" \
+ "${WORKDIR}/usr/bin/ghc-${GHC_PV}" \
+ "${WORKDIR}/usr/bin/ghci-${GHC_PV}" \
+ "${WORKDIR}/usr/bin/ghc-pkg-${GHC_PV}" \
+ "${WORKDIR}/usr/bin/hsc2hs" \
+ "${WORKDIR}/usr/bin/runghc-${GHC_PV}" \
+ "$gp_back" \
+ || die "Adding LD_LIBRARY_PATH for wrappers failed"
+ hprefixify "${bin_libpath}"/${PN}*/settings
+ fi
+
+ # regenerate the binary package cache
+ "$gp_back" recache || die "failed to update cache after relocation"
+ rm "$gp_back"
+}
+
+ghc-check-reqs() {
+ # These are pessimistic values (slightly bigger than worst-case)
+ # Worst case is UNREG USE=profile ia64. See bug #611866 for some
+ # numbers on various arches.
+ CHECKREQS_DISK_BUILD=8G
+ CHECKREQS_DISK_USR=2G
+ # USE=binary roughly takes
+ use binary && CHECKREQS_DISK_BUILD=4G
+
+ "$@"
+}
+
+pkg_pretend() {
+ ghc-check-reqs check-reqs_pkg_pretend
+}
+
+pkg_setup() {
+ ghc-check-reqs check-reqs_pkg_setup
+
+ # quiet portage about prebuilt binaries
+ use binary && QA_PREBUILT="*"
+
+ [[ ${MERGE_TYPE} == binary ]] && return
+
+ if use ghcbootstrap; then
+ ewarn "You requested ghc bootstrapping, this is usually only used"
+ ewarn "by Gentoo developers to make binary .tbz2 packages."
+
+ [[ -z $(type -P ghc) ]] && \
+ die "Could not find a ghc to bootstrap with."
+ else
+ if ! yet_binary; then
+ eerror "Please try emerging with USE=ghcbootstrap and report build"
+ eerror "sucess or failure to the haskell team (haskell@gentoo.org)"
+ die "No binary available for '${ARCH}' arch yet, USE=ghcbootstrap"
+ fi
+ fi
+}
+
+src_unpack() {
+ # Create the ${S} dir if we're using the binary version
+ use binary && mkdir "${S}"
+
+ # the Solaris and Darwin binaries from ghc (maeder) need to be
+ # unpacked separately, so prevent them from being unpacked
+ local ONLYA=${A}
+ case ${CHOST} in
+ *-darwin* | *-solaris*) ONLYA=${GHC_P}-src.tar.bz2 ;;
+ esac
+ unpack ${ONLYA}
+}
+
+src_prepare() {
+ ghc_setup_cflags
+
+ if ! use ghcbootstrap && [[ ${CHOST} != *-darwin* && ${CHOST} != *-solaris* ]]; then
+ # Modify the wrapper script from the binary tarball to use GHC_PERSISTENT_FLAGS.
+ # See bug #313635.
+ sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_PERSISTENT_FLAGS}|" \
+ "${WORKDIR}/usr/bin/ghc-${GHC_PV}"
+
+ # allow hardened users use vanilla binary to bootstrap ghc
+ # ghci uses mmap with rwx protection at it implements dynamic
+ # linking on it's own (bug #299709)
+ pax-mark -m "${WORKDIR}/usr/$(get_libdir)/${GHC_P}/bin/ghc"
+ fi
+
+ if use binary; then
+ if use prefix; then
+ relocate_ghc "${EPREFIX}"
+ fi
+
+ # Move unpacked files to the expected place
+ mv "${WORKDIR}/usr" "${S}"
+ else
+ if ! use ghcbootstrap; then
+ case ${CHOST} in
+ *-darwin* | *-solaris*)
+ # UPDATE ME for ghc-7
+ mkdir "${WORKDIR}"/ghc-bin-installer || die
+ pushd "${WORKDIR}"/ghc-bin-installer > /dev/null || die
+ use sparc-solaris && unpack ghc-6.10.4-sparc-sun-solaris2.tar.bz2
+ use x86-solaris && unpack ghc-7.0.3-i386-unknown-solaris2.tar.bz2
+ use x86-macos && unpack ghc-7.4.1-i386-apple-darwin.tar.bz2
+ use x64-macos && unpack ghc-7.4.1-x86_64-apple-darwin.tar.bz2
+ popd > /dev/null
+
+ pushd "${WORKDIR}"/ghc-bin-installer/ghc-[67].?*.? > /dev/null || die
+ # fix the binaries so they run, on Solaris we need an
+ # LD_LIBRARY_PATH which has our prefix libdirs, on
+ # Darwin we need to replace the frameworks with our libs
+ # from the prefix fix before installation, because some
+ # of the tools are actually used during configure/make
+ if [[ ${CHOST} == *-solaris* ]] ; then
+ export LD_LIBRARY_PATH="${EPREFIX}/$(get_libdir):${EPREFIX}/usr/$(get_libdir):${LD_LIBRARY_PATH}"
+ elif [[ ${CHOST} == *-darwin* ]] ; then
+ local readline_framework=GNUreadline.framework/GNUreadline
+ local gmp_framework=/opt/local/lib/libgmp.10.dylib
+ local ncurses_file=/opt/local/lib/libncurses.5.dylib
+ for binary in $(scanmacho -BRE MH_EXECUTE -F '%F' .) ; do
+ install_name_tool -change \
+ ${readline_framework} \
+ "${EPREFIX}"/lib/libreadline.dylib \
+ ${binary} || die
+ install_name_tool -change \
+ ${gmp_framework} \
+ "${EPREFIX}"/usr/lib/libgmp.dylib \
+ ${binary} || die
+ install_name_tool -change \
+ ${ncurses_file} \
+ "${EPREFIX}"/usr/lib/libncurses.dylib \
+ ${binary} || die
+ done
+ # we don't do frameworks!
+ sed -i \
+ -e 's/\(frameworks = \)\["GMP"\]/\1[]/g' \
+ -e 's/\(extraLibraries = \)\["m"\]/\1["m","gmp"]/g' \
+ rts/package.conf.in || die
+ fi
+
+ # it is autoconf, but we really don't want to give it too
+ # much arguments, in fact we do the make in-place anyway
+ ./configure --prefix="${WORKDIR}"/usr || die
+ make install || die
+ popd > /dev/null
+ ;;
+ *)
+ relocate_ghc "${WORKDIR}"
+ ;;
+ esac
+ fi
+
+ sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_PERSISTENT_FLAGS}|" \
+ "${S}/ghc/ghc.wrapper"
+
+ cd "${S}" # otherwise epatch will break
+
+ epatch "${FILESDIR}"/${PN}-7.0.4-CHOST-prefix.patch
+
+ epatch "${FILESDIR}"/${PN}-8.2.1_rc1-cgen-constify.patch
+ epatch "${FILESDIR}"/${PN}-7.8.3-prim-lm.patch
+
+ epatch "${FILESDIR}"/${PN}-8.2.1_rc2-O2-unreg.patch
+
+ # a bunch of crosscompiler patches
+ epatch "${FILESDIR}"/${PN}-8.2.1_rc1-unphased-cross.patch
+ epatch "${FILESDIR}"/${PN}-8.2.1_rc1-staged-cross.patch
+ epatch "${FILESDIR}"/${PN}-8.2.1_rc1-ghci-cross.patch
+ epatch "${FILESDIR}"/${PN}-8.2.1_rc1-stage2-cross.patch
+ epatch "${FILESDIR}"/${PN}-8.2.1_rc1-hp2ps-cross.patch
+ epatch "${FILESDIR}"/${PN}-8.2.1_rc3-any-vendor.patch
+ epatch "${FILESDIR}"/${PN}-8.2.1_rc3-stginit-data.patch
+
+ # needs a new libffi release
+ epatch "${FILESDIR}"/${PN}-8.0.2-libffi-alpha.patch
+
+ # mingw32 target
+ pushd "${S}/libraries/Win32"
+ epatch "${FILESDIR}"/${PN}-8.2.1_rc1-win32-cross-1.patch # upstreamed, waits for merge to -HEAD
+ epatch "${FILESDIR}"/${PN}-8.2.1_rc1-win32-cross-2-hack.patch # bad workaround
+ popd
+
+ if use prefix; then
+ # Make configure find docbook-xsl-stylesheets from Prefix
+ sed -e '/^FP_DIR_DOCBOOK_XSL/s:\[.*\]:['"${EPREFIX}"'/usr/share/sgml/docbook/xsl-stylesheets/]:' \
+ -i utils/haddock/doc/configure.ac || die
+ fi
+
+ bump_libs
+
+ # as we have changed the build system
+ eautoreconf
+ fi
+}
+
+src_configure() {
+ if ! use binary; then
+ # initialize build.mk
+ echo '# Gentoo changes' > mk/build.mk
+
+ # Put docs into the right place, ie /usr/share/doc/ghc-${GHC_PV}
+ echo "docdir = ${EPREFIX}/usr/share/doc/$(cross)${P}" >> mk/build.mk
+ echo "htmldir = ${EPREFIX}/usr/share/doc/$(cross)${P}" >> mk/build.mk
+
+ # We also need to use the GHC_FLAGS flags when building ghc itself
+ echo "SRC_HC_OPTS+=${HCFLAGS} ${GHC_FLAGS}" >> mk/build.mk
+ echo "SRC_CC_OPTS+=${CFLAGS}" >> mk/build.mk
+ echo "SRC_LD_OPTS+=${LDFLAGS}" >> mk/build.mk
+ # Speed up initial Cabal bootstrap
+ echo "utils/ghc-cabal_dist_EXTRA_HC_OPTS+=$(ghc-make-args)" >> mk/build.mk
+
+ # We can't depend on haddock except when bootstrapping when we
+ # must build docs and include them into the binary .tbz2 package
+ # app-text/dblatex is not in portage, can not build PDF or PS
+ echo "BUILD_SPHINX_PDF = NO" >> mk/build.mk
+ echo "BUILD_SPHINX_HTML = $(usex doc YES NO)" >> mk/build.mk
+ echo "BUILD_MAN = $(usex doc YES NO)" >> mk/build.mk
+
+ # this controls presence on 'xhtml' and 'haddock' in final install
+ echo "HADDOCK_DOCS = YES" >> mk/build.mk
+
+ # not used outside of ghc's test
+ if [[ -n ${GHC_BUILD_DPH} ]]; then
+ echo "BUILD_DPH = YES" >> mk/build.mk
+ else
+ echo "BUILD_DPH = NO" >> mk/build.mk
+ fi
+
+ # Any non-native build has to skip as it needs
+ # target haddock binary to be runnabine.
+ if ! is_native; then
+ # disable docs generation as it requires running stage2
+ echo "HADDOCK_DOCS=NO" >> mk/build.mk
+ echo "BUILD_SPHINX_HTML=NO" >> mk/build.mk
+ echo "BUILD_SPHINX_PDF=NO" >> mk/build.mk
+ fi
+
+ if is_crosscompile; then
+ # Install ghc-stage1 crosscompiler instead of
+ # ghc-stage2 cross-built compiler.
+ echo "Stage1Only=YES" >> mk/build.mk
+ fi
+
+ # allows overriding build flavours for libraries:
+ # v - vanilla (static libs)
+ # p - profiled
+ # dyn - shared libraries
+ # example: GHC_LIBRARY_WAYS="v dyn"
+ if [[ -n ${GHC_LIBRARY_WAYS} ]]; then
+ echo "GhcLibWays=${GHC_LIBRARY_WAYS}" >> mk/build.mk
+ fi
+ echo "BUILD_PROF_LIBS = $(usex profile YES NO)" >> mk/build.mk
+
+ # Get ghc from the unpacked binary .tbz2
+ # except when bootstrapping we just pick ghc up off the path
+ if ! use ghcbootstrap; then
+ export PATH="${WORKDIR}/usr/bin:${PATH}"
+ fi
+
+ echo "INTEGER_LIBRARY = $(usex gmp integer-gmp integer-simple)" >> mk/build.mk
+
+ # don't strip anything. Very useful when stage2 SIGSEGVs on you
+ echo "STRIP_CMD = :" >> mk/build.mk
+
+ local econf_args=()
+
+ # GHC embeds toolchain it was built by and uses it later.
+ # Don't allow things like ccache or versioned binary slip.
+ # We use stable thing across gcc upgrades.
+ # User can use EXTRA_ECONF=CC=... to override this default.
+ econf_args+=(
+ AR=${CTARGET}-ar
+ CC=${CTARGET}-gcc
+ LD=${CTARGET}-ld
+ # these should be inferred by GHC but ghc defaults
+ # to using bundled tools on windows.
+ Windres=${CTARGET}-windres
+ DllWrap=${CTARGET}-dllwrap
+ )
+ if [[ ${CTARGET} == arm* ]] ; then
+ # ld.bfd-2.28 does not work for ghc. Force ld.gold
+ # instead. This should be removed once gentoo gets
+ # a fix for R_ARM_COPY bug: https://sourceware.org/PR16177
+ econf_args+=(LD=${CTARGET}-ld.gold)
+ fi
+
+ if [[ ${CBUILD} != ${CHOST} ]]; then
+ # GHC bug: ghc claims not to support cross-building.
+ # It does, but does not distinct --host= value
+ # for stage1 and stage2 compiler.
+ econf_args+=(--host=${CBUILD})
+ fi
+
+ if use ghcmakebinary; then
+ # When building booting libary we are trying to
+ # bundle or restrict most of external depends
+ # with unstable ABI:
+ # - embed libffi (default GHC behaviour)
+ # - disable ncurses support for ghci (via haskeline)
+ # https://bugs.gentoo.org/557478
+ # - disable ncurses support for ghc-pkg
+ echo "libraries/haskeline_CONFIGURE_OPTS += --flag=-terminfo" >> mk/build.mk
+ echo "utils/ghc-pkg_HC_OPTS += -DBOOTSTRAPPING" >> mk/build.mk
+ elif is_native; then
+ # using ${GTARGET}'s libffi is not supported yet:
+ # GHC embeds full path for ffi includes without /usr/${CTARGET} account.
+ econf_args+=(--with-system-libffi)
+ econf_args+=(--with-ffi-includes=$(pkg-config libffi --cflags-only-I | sed -e 's@^-I@@'))
+ fi
+
+ einfo "Final mk/build.mk:"
+ cat mk/build.mk || die
+
+ econf ${econf_args[@]} --enable-bootstrap-with-devel-snapshot
+
+ if [[ ${PV} == *9999* ]]; then
+ GHC_PV="$(grep 'S\[\"PACKAGE_VERSION\"\]' config.status | sed -e 's@^.*=\"\(.*\)\"@\1@')"
+ GHC_P=${PN}-${GHC_PV}
+ fi
+ fi # ! use binary
+}
+
+src_compile() {
+ if ! use binary; then
+ # Stage1Only crosscompiler does not build stage2
+ if ! is_crosscompile; then
+ # 1. build/pax-mark compiler binary first
+ emake ghc/stage2/build/tmp/ghc-stage2
+ # 2. pax-mark (bug #516430)
+ pax-mark -m ghc/stage2/build/tmp/ghc-stage2
+ # 2. build/pax-mark haddock using ghc-stage2
+ if is_native; then
+ # non-native build does not build haddock
+ # due to HADDOCK_DOCS=NO, but it could.
+ emake utils/haddock/dist/build/tmp/haddock
+ pax-mark -m utils/haddock/dist/build/tmp/haddock
+ fi
+ fi
+ # 3. and then all the rest
+ emake all
+ fi # ! use binary
+}
+
+src_install() {
+ if use binary; then
+ use prefix && mkdir -p "${ED}"
+ mv "${S}/usr" "${ED}"
+ else
+ [[ -f VERSION ]] || emake VERSION
+
+ # -j1 due to a rare race in install script:
+ # make --no-print-directory -f ghc.mk phase=final install
+ # /usr/lib/portage/python3.4/ebuild-helpers/xattr/install -c -m 755 \
+ # -d "/tmp/portage-tmpdir/portage/cross-armv7a-unknown-linux-gnueabi/ghc-9999/image/usr/lib64/armv7a-unknown-linux-gnueabi-ghc-8.3.20170404/include"
+ # /usr/lib/portage/python3.4/ebuild-helpers/xattr/install -c -m 644 utils/hsc2hs/template-hsc.h \
+ # "/tmp/portage-tmpdir/portage/cross-armv7a-unknown-linux-gnueabi/ghc-9999/image/usr/lib64/armv7a-unknown-linux-gnueabi-ghc-8.3.20170404"
+ # /usr/bin/install: cannot create regular file \
+ # '/tmp/portage-tmpdir/portage/cross-armv7a-unknown-linux-gnueabi/ghc-9999/image/usr/lib64/armv7a-unknown-linux-gnueabi-ghc-8.3.20170404': No such file or directory
+ emake -j1 install DESTDIR="${D}"
+
+ # Skip for cross-targets as they all share target location:
+ # /usr/share/doc/ghc-9999/
+ if ! is_crosscompile; then
+ dodoc "distrib/README" "ANNOUNCE" "LICENSE" "VERSION"
+ fi
+
+ # rename ghc-shipped files to avoid collision
+ # of external packages. Motivating example:
+ # user had installed:
+ # dev-lang/ghc-7.8.4-r0 (with transformers-0.3.0.0)
+ # dev-haskell/transformers-0.4.2.0
+ # then user tried to update to
+ # dev-lang/ghc-7.8.4-r1 (with transformers-0.4.2.0)
+ # this will lead to single .conf file collision.
+ local shipped_conf renamed_conf
+ local package_confdir="${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
+ for shipped_conf in "${package_confdir}"/*.conf; do
+ # rename 'pkg-ver-id.conf' to 'pkg-ver-id-gentoo-${PF}.conf'
+ renamed_conf=${shipped_conf%.conf}-gentoo-${PF}.conf
+ mv "${shipped_conf}" "${renamed_conf}" || die
+ done
+
+ # remove link, but leave 'haddock-${GHC_P}'
+ rm -f "${ED}"/usr/bin/$(cross)haddock
+
+ if ! is_crosscompile; then
+ newbashcomp "${FILESDIR}"/ghc-bash-completion ghc-pkg
+ newbashcomp utils/completion/ghc.bash ghc
+ fi
+ fi
+
+ # path to the package.cache
+ local package_confdir="${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
+ PKGCACHE="${package_confdir}"/package.cache
+ # copy the package.conf.d, including timestamp, save it so we can help
+ # users that have a broken package.conf.d
+ cp -pR "${package_confdir}"{,.initial} || die "failed to backup intial package.conf.d"
+
+ # copy the package.conf, including timestamp, save it so we later can put it
+ # back before uninstalling, or when upgrading.
+ cp -p "${PKGCACHE}"{,.shipped} \
+ || die "failed to copy package.conf.d/package.cache"
+}
+
+pkg_preinst() {
+ # have we got an earlier version of ghc installed?
+ if has_version "<${CATEGORY}/${PF}"; then
+ haskell_updater_warn="1"
+ fi
+}
+
+pkg_postinst() {
+ ghc-reregister
+
+ # path to the package.cache
+ PKGCACHE="${EROOT}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d/package.cache"
+
+ # give the cache a new timestamp, it must be as recent as
+ # the package.conf.d directory.
+ touch "${PKGCACHE}"
+
+ if [[ "${haskell_updater_warn}" == "1" ]]; then
+ ewarn
+ ewarn "\e[1;31m************************************************************************\e[0m"
+ ewarn
+ ewarn "You have just upgraded from an older version of GHC."
+ ewarn "You may have to run"
+ ewarn " 'haskell-updater'"
+ ewarn "to rebuild all ghc-based Haskell libraries."
+ ewarn
+ ewarn "\e[1;31m************************************************************************\e[0m"
+ ewarn
+ fi
+}
+
+pkg_prerm() {
+ PKGCACHE="${EROOT}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d/package.cache"
+ rm -rf "${PKGCACHE}"
+
+ cp -p "${PKGCACHE}"{.shipped,}
+}
+
+pkg_postrm() {
+ ghc-package_pkg_postrm
+}
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: dev-lang/ghc/files/, dev-lang/ghc/
@ 2021-02-28 18:43 Sergei Trofimovich
0 siblings, 0 replies; 9+ messages in thread
From: Sergei Trofimovich @ 2021-02-28 18:43 UTC (permalink / raw
To: gentoo-commits
commit: b855b628d2d613e95f5702d6bb269320ac12e8fc
Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sun Feb 28 18:42:42 2021 +0000
Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sun Feb 28 18:43:04 2021 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b855b628
dev-lang/ghc: bump up to 8.10.4 (no keywords yet)
Package-Manager: Portage-3.0.16, Repoman-3.0.2
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
dev-lang/ghc/Manifest | 4 +
dev-lang/ghc/files/ghc-8.10.3-C99-typo-ac270.patch | 12 +
dev-lang/ghc/ghc-8.10.4.ebuild | 799 +++++++++++++++++++++
3 files changed, 815 insertions(+)
diff --git a/dev-lang/ghc/Manifest b/dev-lang/ghc/Manifest
index 9ec9e69c069..ed19e2f59d9 100644
--- a/dev-lang/ghc/Manifest
+++ b/dev-lang/ghc/Manifest
@@ -9,6 +9,8 @@ DIST ghc-8.10.2-src.tar.xz 21880680 BLAKE2B 0c1b67c1576cfd1067d11838301f96041cab
DIST ghc-8.10.2-testsuite.tar.xz 2101788 BLAKE2B 0d4528223471dfd68cadcda47931d53508c9eafa415716ca5990ea519eb89bfa2bdd444280057be33467382dd3d178887262d54ef633aa8ce88ea91eb9d58ece SHA512 043faaf2f0dc34a868c481b284b94afd78aa1ec1a4056d1f3c97ca3f7dadb3e9cff0517a4cfb378fe5187389db7c9027763bf066328e7dcfd264b737f6d09e41
DIST ghc-8.10.3-src.tar.xz 19872356 BLAKE2B 043f41a21becc826b3cd13ee81b138cf2edfa18484f98361dc85b12f784df85571522347d5fafe40a19ea8ddf12390cd766db8fc21cf4971e797bc61404304cc SHA512 6f3248e728d3677dfddf2f02609167c67a194750418f2a5e34ed68f1135960761c5a5768255bfc8b2ef5640395609424878375184d2dde8e2d69021a3baf9ec8
DIST ghc-8.10.3-testsuite.tar.xz 2261376 BLAKE2B cd03d569c30637d531d9a13fa926a28f854a37d48ef0d4e2fde684664ae000f3c941b5113ccafd42fec019428bafb5344b1ddf8f84a71b21bca8831ed4784907 SHA512 4c9d20a27ed71eb7c73bd86c1049ea5adcc8a0b12040386b7d0dddb46b3cf704c52a3392e19ae4ff1c76b8868665c599391d47e47dba516fcadf8abbc30e28df
+DIST ghc-8.10.4-src.tar.xz 19818108 BLAKE2B 069dd8436c373ccf73c20d8b577243792ffdd3a031e869edd612fe1e273126e60803326542695012dbe62e57654ada18af9342bbe1a741b2bebb41cdb0d86035 SHA512 9bb078cb72535a352243b83b671c871392564efd09e478549f27ae58fc6f46e337a0782f5500d26d5704ad96eace22e77bb36031a1fe9b7e175f265b0b9c028b
+DIST ghc-8.10.4-testsuite.tar.xz 2236932 BLAKE2B 17d0520ad5c6daa0cc60530279ae7e617e4d79328b9f436abbe75e72f0803d9a997fb9e1ae61425326b070f45794a488d8507957fec9a6ed49eea86d30a1e579 SHA512 1bf129c8d872e3ceff7c19929605adc5d68daab9ded9aa2e5109b0de162089631472c66f04993adf8481291f8128bf804fe64a9d344c81e257f1b962ba5e382c
DIST ghc-8.2.1-src.tar.xz 10736016 BLAKE2B 60993cfc9569e83b0c383591ef30a7280e0138fbb7bd696ad62d87e68dcbccf31c0b8ba211b6647922b8595c7aec2c783648f12c67da53e0766b71c7d7c923fc SHA512 d9aa2aa7f9414db8f4e51d6c275694b46df515e68331a1a2b6018256333a2c63ebd877b75ee90407ecce5be672ec9afc6bebd62aadbf8ae06b94f1760d1736be
DIST ghc-8.2.2-src.tar.xz 10753272 BLAKE2B 6fd792390d3df20f84836466705c3f3c931ba2d594dcbe2b808ea0ae284460000b443df8aae74903eabf05ff9064d68a303086cf888ea68222eb1c60959c8f21 SHA512 6549416f470b599973d409fa45f59c25b07e6a94798cef1a19ad432547dc225338cf4dbc4a4793114b4a417798a3b59b122b92b020251074405c5302b7ffe799
DIST ghc-8.4.1-src.tar.xz 11301528 BLAKE2B 6dcf467d04cace856b68315c85b80f19b517dcbc8ae6e2a08c60afa141c9e0261e012738452c9ca208f9fc40c48bd1a0817e5e0fe9f4737383cd7b44ca65c8d9 SHA512 f8ae11f498bf2911fb92635534c6906c96f1fbe5072c7b7447bd3f69e408026b674564515af02a8aaddc57ee6905ce78d10005b12478a39c220580aaec13a9f7
@@ -53,6 +55,8 @@ DIST ghc-bin-8.10.2-i686-pc-linux-gnu.tbz2 123683156 BLAKE2B a486076ea6e67f124c8
DIST ghc-bin-8.10.2-x86_64-pc-linux-gnu.tbz2 122818630 BLAKE2B 030a68e2aca0eb0a273e0d48a3e180d92b219b2d1826d1d58fa133d0a6cae1316b3ccceadb55a4fa5870f87c3df85df2998e7611b93dbc1fea592437748b2daf SHA512 23bf47ee45fae54a843de9e6991b67fccb79c14ad8d08eff9f38a68a3530496c8ce4bc8cae8a731bb690ddd6cd0bf36d6d5bf37eb68ddae8ce646a0bf3916d8f
DIST ghc-bin-8.10.3-i686-pc-linux-gnu.tbz2 123802832 BLAKE2B a770dd43bee7a1d60fec2eb9aaa7de715eed01c19d9514e04678801827879977a5c91f5e191d026ca83aa5e5fc5f518593053b2e78b27b08df64b39058dbaec3 SHA512 f810432a56ddcd773e6118f038cdacd2f5e3a508d87bfa468ee861aef0cfc434ec5766a8a74360d8cec6cb9c664928290901c025496100e7c8465408635227f5
DIST ghc-bin-8.10.3-x86_64-pc-linux-gnu.tbz2 122993247 BLAKE2B e3395ebc7e87b4ae8f66dbbd9441c214c4d9535e55bfb14f78ebb92d30b1e100efc4893b3cdc65564d47bd53a21cb30106572b3fce13be022946171112c3218e SHA512 2ea4295bcaf6e3fd0db54ba67465e979cd85d3370c6c49f2381478ae9824ad89df53d7d93ccf06bdff5f4849f14306c9f50c13e6f6ba45f79e5b8c13ad63ae4f
+DIST ghc-bin-8.10.4-i686-pc-linux-gnu.tbz2 123831294 BLAKE2B 1ca4c1b5c34c948011049a73d409c741db89658d10e311cffbe464c631c3733278fc7dede6ad27474832295ded2c26fd4d6419c760505255e29f7cb232a670a4 SHA512 1f87cf63651f7c0e5f7f55d1f4d7d7c48b0a911cc6673a899d4b92190d765b359f9c7d73c329969c1b76f1af102b7e2c18a80382c81d5dade9ac7dd57de4ef65
+DIST ghc-bin-8.10.4-x86_64-pc-linux-gnu.tbz2 122558873 BLAKE2B 9f07c7bdc3beccfa629d28b2524ccd2f4688a5c0036a45408f5ace2d530a2a0e42f95b3cda5037ebb365317999e1ae776c6f9d21692867abfe85e33f2892b1be SHA512 68bd70f94961547746a696aa2839e156c95858fda0c7ec5b2ecf802070724ab7102b0aa86bcbf93432170d521cce4af10f46b851b470e5dc49dfa5b07380f46d
DIST ghc-bin-8.2.1-i686-pc-linux-gnu.tbz2 96157437 BLAKE2B 2b9608845db8cea78db07209fa054b3b05085d5c3ac07cbe3de02a93c87fb0cff12b1820f08757221c59c8a0a9e7a5563c44266b181525d916825e5cf5bac34c SHA512 e891e76557fa61853e28829b8bedc4a6abb92954f90cc1ebcf22a13cc137556bbe9262e7398b7e1aedbabeb997916b008bf1561a52f16a569f3d58ea9404f41e
DIST ghc-bin-8.2.1-x86_64-pc-linux-gnu.tbz2 97490496 BLAKE2B 3666ea70cb8b3645db071040d2069fe244042c11954b34e5d92aaa90132d2316c0ee8c176cd4e674772bea3b99df150404f62bd8745c046cdaf102ecf0a0fa54 SHA512 52630a185d0eab56bce0469a612a54109895bfee041ec362ced59a9b35ba3b9c185e86bc7dbf0a5939081d3626baa19fbb3306e36d1857530248a7b9bfc100bb
DIST ghc-bin-8.2.2-i686-pc-linux-gnu.tbz2 96638908 BLAKE2B b470f838e77330969f162196b0f1035fa764f5d123687fbf67c14323280bfe55216af0e16f8b79c62f290905d96abc8bfafee650f8d27c81608853e78329b2c9 SHA512 15b1525890477539878385efc15ce5f1cf2f126cc785c42923be958cabe3298cebe73526a2370cf4c630124160a7ca0f0f9062aebbf035dce807a0374eaddd14
diff --git a/dev-lang/ghc/files/ghc-8.10.3-C99-typo-ac270.patch b/dev-lang/ghc/files/ghc-8.10.3-C99-typo-ac270.patch
new file mode 100644
index 00000000000..762622a07e0
--- /dev/null
+++ b/dev-lang/ghc/files/ghc-8.10.3-C99-typo-ac270.patch
@@ -0,0 +1,12 @@
+autoconf-2.70 does not allow macros with underscores.
+--- a/aclocal.m4
++++ b/aclocal.m4
+@@ -673,7 +673,7 @@ AC_DEFUN([FP_SET_CFLAGS_C99],
+ CPPFLAGS="$$3"
+ unset ac_cv_prog_cc_c99
+ dnl perform detection
+- _AC_PROG_CC_C99
++ AC_PROG_CC_C99
+ fp_cc_c99="$ac_cv_prog_cc_c99"
+ case "x$ac_cv_prog_cc_c99" in
+ x) ;; # noop
diff --git a/dev-lang/ghc/ghc-8.10.4.ebuild b/dev-lang/ghc/ghc-8.10.4.ebuild
new file mode 100644
index 00000000000..a0a3d692f58
--- /dev/null
+++ b/dev-lang/ghc/ghc-8.10.4.ebuild
@@ -0,0 +1,799 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+# to make make a crosscompiler use crossdev and symlink ghc tree into
+# cross overlay. result would look like 'cross-sparc-unknown-linux-gnu/ghc'
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} = ${CHOST} ]] ; then
+ if [[ ${CATEGORY/cross-} != ${CATEGORY} ]] ; then
+ export CTARGET=${CATEGORY/cross-}
+ fi
+fi
+
+inherit autotools bash-completion-r1 eutils flag-o-matic ghc-package
+inherit multilib multiprocessing pax-utils toolchain-funcs prefix
+inherit check-reqs
+DESCRIPTION="The Glasgow Haskell Compiler"
+HOMEPAGE="https://www.haskell.org/ghc/"
+
+# we don't have any binaries yet
+arch_binaries=""
+
+BIN_PV=${PV}
+# sorted!
+#arch_binaries="$arch_binaries alpha? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-alpha.tbz2 )"
+#arch_binaries="$arch_binaries arm? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-armv7a-hardfloat-linux-gnueabi.tbz2 )"
+#arch_binaries="$arch_binaries arm64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-aarch64-unknown-linux-gnu.tbz2 )"
+arch_binaries="$arch_binaries amd64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-x86_64-pc-linux-gnu.tbz2 )"
+#arch_binaries="$arch_binaries ia64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ia64-fixed-fiw.tbz2 )"
+#arch_binaries="$arch_binaries ppc? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ppc.tbz2 )"
+#arch_binaries="$arch_binaries ppc64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ppc64.tbz2 )"
+#arch_binaries="$arch_binaries ppc64? ( !big-endian? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-powerpc64le-unknown-linux-gnu.tbz2 ) )"
+#arch_binaries="$arch_binaries sparc? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-sparc.tbz2 )"
+arch_binaries="$arch_binaries x86? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-i686-pc-linux-gnu.tbz2 )"
+
+# various ports:
+#arch_binaries="$arch_binaries x86-fbsd? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-x86-fbsd.tbz2 )"
+
+# 0 - yet
+yet_binary() {
+ case "${ARCH}" in
+ #alpha) return 0 ;;
+ #arm64) return 0 ;;
+ #arm) return 0 ;;
+ amd64) return 0 ;;
+ #ia64) return 0 ;;
+ #ppc) return 0 ;;
+ #ppc64)
+ # use big-endian && return 0
+ # return 0
+ # ;;
+ #sparc) return 0 ;;
+ x86) return 0 ;;
+ *) return 1 ;;
+ esac
+}
+
+GHC_PV=${PV}
+#GHC_PV=8.10.0.20200123 # uncomment only for -alpha, -beta, -rc ebuilds
+GHC_P=${PN}-${GHC_PV} # using ${P} is almost never correct
+
+SRC_URI="!binary? (
+ https://downloads.haskell.org/ghc/${PV/_/-}/${GHC_P}-src.tar.xz
+ test? ( https://downloads.haskell.org/ghc/${PV/_/-}/${GHC_P}-testsuite.tar.xz )
+)"
+S="${WORKDIR}"/${GHC_P}
+
+[[ -n $arch_binaries ]] && SRC_URI+=" !ghcbootstrap? ( $arch_binaries )"
+
+BUMP_LIBRARIES=(
+ # "hackage-name hackage-version"
+)
+
+LICENSE="BSD"
+SLOT="0/${PV}"
+# no binaries yet
+#KEYWORDS="~amd64 ~x86"
+IUSE="big-endian doc elfutils ghcbootstrap ghcmakebinary +gmp numa profile test"
+IUSE+=" binary"
+RESTRICT="!test? ( test )"
+
+RDEPEND="
+ >=dev-lang/perl-5.6.1
+ dev-libs/gmp:0=
+ sys-libs/ncurses:0=[unicode]
+ elfutils? ( dev-libs/elfutils )
+ !ghcmakebinary? ( dev-libs/libffi:= )
+ numa? ( sys-process/numactl )
+"
+
+# This set of dependencies is needed to run
+# prebuilt ghc. We specifically avoid ncurses
+# dependency with:
+# utils/ghc-pkg_HC_OPTS += -DBOOTSTRAPPING
+PREBUILT_BINARY_DEPENDS="
+ !prefix? ( elibc_glibc? ( >=sys-libs/glibc-2.17 ) )
+"
+# This set of dependencies is needed to install
+# ghc[binary] in system. terminfo package is linked
+# against ncurses.
+PREBUILT_BINARY_RDEPENDS="${PREBUILT_BINARY_DEPENDS}
+ sys-libs/ncurses:0/6
+"
+
+RDEPEND+="binary? ( ${PREBUILT_BINARY_RDEPENDS} )"
+
+DEPEND="${RDEPEND}
+ doc? ( app-text/docbook-xml-dtd:4.2
+ app-text/docbook-xml-dtd:4.5
+ app-text/docbook-xsl-stylesheets
+ dev-python/sphinx
+ >=dev-libs/libxslt-1.1.2 )
+ !ghcbootstrap? ( ${PREBUILT_BINARY_DEPENDS} )"
+
+# we build binaries without profiling support
+REQUIRED_USE="
+ ?? ( ghcbootstrap binary )
+ ?? ( profile binary )
+"
+
+# haskell libraries built with cabal in configure mode, #515354
+QA_CONFIGURE_OPTIONS+=" --with-compiler --with-gcc"
+
+is_crosscompile() {
+ [[ ${CHOST} != ${CTARGET} ]]
+}
+
+is_native() {
+ [[ ${CHOST} == ${CBUILD} ]] && [[ ${CHOST} == ${CTARGET} ]]
+}
+
+if ! is_crosscompile; then
+ PDEPEND="!ghcbootstrap? ( >=app-admin/haskell-updater-1.2 )"
+fi
+
+# returns tool prefix for crosscompiler.
+# Example:
+# CTARGET=armv7a-unknown-linux-gnueabi
+# CHOST=x86_64-pc-linux-gnu
+# "armv7a-unknown-linux-gnueabi-"
+# CTARGET=${CHOST}
+# ""
+# Used in tools and library prefix:
+# "${ED}"/usr/bin/$(cross)haddock
+# "${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
+
+cross() {
+ if is_crosscompile; then
+ echo "${CTARGET}-"
+ else
+ echo ""
+ fi
+}
+
+append-ghc-cflags() {
+ local persistent compile assemble link
+ local flag ghcflag
+
+ for flag in $*; do
+ case ${flag} in
+ persistent) persistent="yes";;
+ compile) compile="yes";;
+ assemble) assemble="yes";;
+ link) link="yes";;
+ *)
+ [[ ${compile} ]] && ghcflag="-optc${flag}" CFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
+ [[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
+ [[ ${assemble} ]] && ghcflag="-opta${flag}" CFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
+ [[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
+ [[ ${link} ]] && ghcflag="-optl${flag}" LDFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
+ [[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
+ ;;
+ esac
+ done
+}
+
+# $1 - lib name (under libraries/)
+# $2 - lib version
+# example: bump_lib "transformers" "0.4.2.0"
+bump_lib() {
+ local pn=$1 pv=$2
+ local p=${pn}-${pv}
+ local f
+
+ einfo "Bumping ${pn} up to ${pv}"
+
+ for f in ghc.mk GNUmakefile; do
+ mv libraries/"${pn}"/$f "${WORKDIR}"/"${p}"/$f || die
+ done
+ mv libraries/"${pn}" "${WORKDIR}"/"${pn}".old || die
+ mv "${WORKDIR}"/"${p}" libraries/"${pn}" || die
+}
+
+update_SRC_URI() {
+ local p pn pv
+ for p in "${BUMP_LIBRARIES[@]}"; do
+ set -- $p
+ pn=$1 pv=$2
+
+ SRC_URI+=" https://hackage.haskell.org/package/${pn}-${pv}/${pn}-${pv}.tar.gz"
+ done
+}
+
+update_SRC_URI
+
+bump_libs() {
+ local p pn pv
+ for p in "${BUMP_LIBRARIES[@]}"; do
+ set -- $p
+ pn=$1 pv=$2
+
+ bump_lib "${pn}" "${pv}"
+ done
+}
+
+ghc_setup_cflags() {
+ # TODO: plumb CFLAGS and BUILD_CFLAGS to respective CONF_CC_OPTS_STAGE<N>
+ if ! is_native; then
+ export CFLAGS=${GHC_CFLAGS-"-O2 -pipe"}
+ export LDFLAGS=${GHC_LDFLAGS-"-Wl,-O1"}
+ einfo "Crosscompiling mode:"
+ einfo " CHOST: ${CHOST}"
+ einfo " CTARGET: ${CTARGET}"
+ einfo " CFLAGS: ${CFLAGS}"
+ einfo " LDFLAGS: ${LDFLAGS}"
+ einfo " prefix: $(cross)"
+ return
+ fi
+ # We need to be very careful with the CFLAGS we ask ghc to pass through to
+ # gcc. There are plenty of flags which will make gcc produce output that
+ # breaks ghc in various ways. The main ones we want to pass through are
+ # -mcpu / -march flags. These are important for arches like alpha & sparc.
+ # We also use these CFLAGS for building the C parts of ghc, ie the rts.
+ strip-flags
+ strip-unsupported-flags
+
+ # Cmm can't parse line numbers #482086
+ replace-flags -ggdb[3-9] -ggdb2
+
+ GHC_FLAGS=""
+ GHC_PERSISTENT_FLAGS=""
+ for flag in ${CFLAGS}; do
+ case ${flag} in
+
+ # Ignore extra optimisation (ghc passes -O to gcc anyway)
+ # -O2 and above break on too many systems
+ -O*) ;;
+
+ # Arch and ABI flags are what we're really after
+ -m*) append-ghc-cflags compile assemble ${flag};;
+
+ # Sometimes it's handy to see backtrace of RTS
+ # to get an idea what happens there
+ -g*) append-ghc-cflags compile ${flag};;
+
+ # Ignore all other flags, including all -f* flags
+ esac
+ done
+
+ for flag in ${LDFLAGS}; do
+ append-ghc-cflags link ${flag}
+ done
+
+ # GHC uses ${CBUILD}-gcc, ${CHOST}-gcc and ${CTARGET}-gcc at a single build.
+ # Skip any gentoo-specific tweaks for cross-case to avoid passing unsupported
+ # options to gcc.
+ if is_native; then
+ # prevent from failing to build unregisterised ghc:
+ # https://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg171602.html
+ use ppc64 && append-ghc-cflags persistent compile -mminimal-toc
+ fi
+}
+
+# substitutes string $1 to $2 in files $3 $4 ...
+relocate_path() {
+ local from=$1
+ local to=$2
+ shift 2
+ local file=
+ for file in "$@"
+ do
+ sed -i -e "s|$from|$to|g" \
+ "$file" || die "path relocation failed for '$file'"
+ done
+}
+
+# changes hardcoded ghc paths and updates package index
+# $1 - new absolute root path
+relocate_ghc() {
+ local to=$1 ghc_v=${BIN_PV}
+
+ # libdir for prebuilt binary and for current system may mismatch
+ # It does for prefix installation for example: bug #476998
+ local bin_ghc_prefix=${WORKDIR}/usr
+ local bin_libpath=$(echo "${bin_ghc_prefix}"/lib*)
+ local bin_libdir=${bin_libpath#${bin_ghc_prefix}/}
+
+ # backup original script to use it later after relocation
+ local gp_back="${T}/ghc-pkg-${ghc_v}-orig"
+ cp "${WORKDIR}/usr/bin/ghc-pkg-${ghc_v}" "$gp_back" || die "unable to backup ghc-pkg wrapper"
+
+ if [[ ${bin_libdir} != $(get_libdir) ]]; then
+ einfo "Relocating '${bin_libdir}' to '$(get_libdir)' (bug #476998)"
+ # moving the dir itself is not strictly needed
+ # but then USE=binary would result in installing
+ # in '${bin_libdir}'
+ mv "${bin_ghc_prefix}/${bin_libdir}" "${bin_ghc_prefix}/$(get_libdir)" || die
+
+ relocate_path "/usr/${bin_libdir}" "/usr/$(get_libdir)" \
+ "${WORKDIR}/usr/bin/ghc-${ghc_v}" \
+ "${WORKDIR}/usr/bin/ghci-${ghc_v}" \
+ "${WORKDIR}/usr/bin/ghc-pkg-${ghc_v}" \
+ "${WORKDIR}/usr/bin/hsc2hs" \
+ "${WORKDIR}/usr/bin/runghc-${ghc_v}" \
+ "$gp_back" \
+ "${WORKDIR}/usr/$(get_libdir)/${PN}-${ghc_v}/package.conf.d/"*
+ fi
+
+ # Relocate from /usr to ${EPREFIX}/usr
+ relocate_path "/usr" "${to}/usr" \
+ "${WORKDIR}/usr/bin/ghc-${ghc_v}" \
+ "${WORKDIR}/usr/bin/ghci-${ghc_v}" \
+ "${WORKDIR}/usr/bin/ghc-pkg-${ghc_v}" \
+ "${WORKDIR}/usr/bin/haddock-ghc-${ghc_v}" \
+ "${WORKDIR}/usr/bin/hp2ps" \
+ "${WORKDIR}/usr/bin/hpc" \
+ "${WORKDIR}/usr/bin/hsc2hs" \
+ "${WORKDIR}/usr/bin/runghc-${ghc_v}" \
+ "${WORKDIR}/usr/$(get_libdir)/${PN}-${ghc_v}/package.conf.d/"*
+
+ # this one we will use to regenerate cache
+ # so it should point to current tree location
+ relocate_path "/usr" "${WORKDIR}/usr" "$gp_back"
+
+ if use prefix; then
+ hprefixify "${bin_libpath}"/${PN}*/settings
+ fi
+
+ # regenerate the binary package cache
+ "$gp_back" recache || die "failed to update cache after relocation"
+ rm "$gp_back"
+}
+
+ghc-check-reqs() {
+ # These are pessimistic values (slightly bigger than worst-case)
+ # Worst case is UNREG USE=profile ia64. See bug #611866 for some
+ # numbers on various arches.
+ CHECKREQS_DISK_BUILD=8G
+ CHECKREQS_DISK_USR=2G
+ # USE=binary roughly takes
+ use binary && CHECKREQS_DISK_BUILD=4G
+
+ "$@"
+}
+
+pkg_pretend() {
+ ghc-check-reqs check-reqs_pkg_pretend
+}
+
+pkg_setup() {
+ ghc-check-reqs check-reqs_pkg_setup
+
+ # quiet portage about prebuilt binaries
+ use binary && QA_PREBUILT="*"
+
+ [[ ${MERGE_TYPE} == binary ]] && return
+
+ if use ghcbootstrap; then
+ ewarn "You requested ghc bootstrapping, this is usually only used"
+ ewarn "by Gentoo developers to make binary .tbz2 packages."
+
+ [[ -z $(type -P ghc) ]] && \
+ die "Could not find a ghc to bootstrap with."
+ else
+ if ! yet_binary; then
+ eerror "Please try emerging with USE=ghcbootstrap and report build"
+ eerror "sucess or failure to the haskell team (haskell@gentoo.org)"
+ die "No binary available for '${ARCH}' arch yet, USE=ghcbootstrap"
+ fi
+ fi
+}
+
+src_unpack() {
+ # Create the ${S} dir if we're using the binary version
+ use binary && mkdir "${S}"
+
+ # the Solaris and Darwin binaries from ghc (maeder) need to be
+ # unpacked separately, so prevent them from being unpacked
+ local ONLYA=${A}
+ case ${CHOST} in
+ *-darwin* | *-solaris*) ONLYA=${GHC_P}-src.tar.xz ;;
+ esac
+ unpack ${ONLYA}
+}
+
+src_prepare() {
+ ghc_setup_cflags
+
+ if ! use ghcbootstrap && [[ ${CHOST} != *-darwin* && ${CHOST} != *-solaris* ]]; then
+ # Modify the wrapper script from the binary tarball to use GHC_PERSISTENT_FLAGS.
+ # See bug #313635.
+ sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_PERSISTENT_FLAGS}|" \
+ "${WORKDIR}/usr/bin/ghc-${BIN_PV}"
+
+ # allow hardened users use vanilla binary to bootstrap ghc
+ # ghci uses mmap with rwx protection at it implements dynamic
+ # linking on it's own (bug #299709)
+ pax-mark -m "${WORKDIR}/usr/$(get_libdir)/${PN}-${BIN_PV}/bin/ghc"
+ fi
+
+ if use binary; then
+ if use prefix; then
+ relocate_ghc "${EPREFIX}"
+ fi
+
+ # Move unpacked files to the expected place
+ mv "${WORKDIR}/usr" "${S}"
+ eapply_user
+ else
+ if ! use ghcbootstrap; then
+ case ${CHOST} in
+ *-darwin* | *-solaris*)
+ # UPDATE ME for ghc-7
+ mkdir "${WORKDIR}"/ghc-bin-installer || die
+ pushd "${WORKDIR}"/ghc-bin-installer > /dev/null || die
+ use sparc-solaris && unpack ghc-6.10.4-sparc-sun-solaris2.tar.bz2
+ use x86-solaris && unpack ghc-7.0.3-i386-unknown-solaris2.tar.bz2
+ use x86-macos && unpack ghc-7.4.1-i386-apple-darwin.tar.bz2
+ use x64-macos && unpack ghc-7.4.1-x86_64-apple-darwin.tar.bz2
+ popd > /dev/null
+
+ pushd "${WORKDIR}"/ghc-bin-installer/ghc-[67].?*.? > /dev/null || die
+ # fix the binaries so they run, on Solaris we need an
+ # LD_LIBRARY_PATH which has our prefix libdirs, on
+ # Darwin we need to replace the frameworks with our libs
+ # from the prefix fix before installation, because some
+ # of the tools are actually used during configure/make
+ if [[ ${CHOST} == *-solaris* ]] ; then
+ export LD_LIBRARY_PATH="${EPREFIX}/$(get_libdir):${EPREFIX}/usr/$(get_libdir):${LD_LIBRARY_PATH}"
+ elif [[ ${CHOST} == *-darwin* ]] ; then
+ local readline_framework=GNUreadline.framework/GNUreadline
+ local gmp_framework=/opt/local/lib/libgmp.10.dylib
+ local ncurses_file=/opt/local/lib/libncurses.5.dylib
+ for binary in $(scanmacho -BRE MH_EXECUTE -F '%F' .) ; do
+ install_name_tool -change \
+ ${readline_framework} \
+ "${EPREFIX}"/lib/libreadline.dylib \
+ ${binary} || die
+ install_name_tool -change \
+ ${gmp_framework} \
+ "${EPREFIX}"/usr/lib/libgmp.dylib \
+ ${binary} || die
+ install_name_tool -change \
+ ${ncurses_file} \
+ "${EPREFIX}"/usr/lib/libncurses.dylib \
+ ${binary} || die
+ done
+ # we don't do frameworks!
+ sed -i \
+ -e 's/\(frameworks = \)\["GMP"\]/\1[]/g' \
+ -e 's/\(extraLibraries = \)\["m"\]/\1["m","gmp"]/g' \
+ rts/package.conf.in || die
+ fi
+
+ # it is autoconf, but we really don't want to give it too
+ # many arguments, in fact we do the make in-place anyway
+ ./configure --prefix="${WORKDIR}"/usr || die
+ make install || die
+ popd > /dev/null
+ ;;
+ *)
+ relocate_ghc "${WORKDIR}"
+ ;;
+ esac
+ fi
+
+ sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_PERSISTENT_FLAGS}|" \
+ "${S}/ghc/ghc.wrapper"
+
+ cd "${S}" # otherwise eapply will break
+
+ eapply "${FILESDIR}"/${PN}-7.0.4-CHOST-prefix.patch
+ eapply "${FILESDIR}"/${PN}-8.2.1-darwin.patch
+ eapply "${FILESDIR}"/${PN}-7.8.3-prim-lm.patch
+ eapply "${FILESDIR}"/${PN}-8.8.1-revert-CPP.patch
+ eapply "${FILESDIR}"/${PN}-8.10.1-allow-cross-bootstrap.patch
+ eapply "${FILESDIR}"/${PN}-8.10.3-C99-typo-ac270.patch
+
+ # a bunch of crosscompiler patches
+ # needs newer version:
+ #eapply "${FILESDIR}"/${PN}-8.2.1_rc1-hp2ps-cross.patch
+
+ # mingw32 target
+ pushd "${S}/libraries/Win32"
+ eapply "${FILESDIR}"/${PN}-8.2.1_rc1-win32-cross-2-hack.patch # bad workaround
+ popd
+
+ bump_libs
+
+ eapply_user
+ # as we have changed the build system
+ eautoreconf
+ fi
+}
+
+src_configure() {
+ if ! use binary; then
+ # initialize build.mk
+ echo '# Gentoo changes' > mk/build.mk
+
+ # Put docs into the right place, ie /usr/share/doc/ghc-${GHC_PV}
+ echo "docdir = ${EPREFIX}/usr/share/doc/$(cross)${P}" >> mk/build.mk
+ echo "htmldir = ${EPREFIX}/usr/share/doc/$(cross)${P}" >> mk/build.mk
+
+ # We also need to use the GHC_FLAGS flags when building ghc itself
+ echo "SRC_HC_OPTS+=${HCFLAGS} ${GHC_FLAGS}" >> mk/build.mk
+ echo "SRC_CC_OPTS+=${CFLAGS}" >> mk/build.mk
+ echo "SRC_LD_OPTS+=${LDFLAGS}" >> mk/build.mk
+ # Speed up initial Cabal bootstrap
+ echo "utils/ghc-cabal_dist_EXTRA_HC_OPTS+=$(ghc-make-args)" >> mk/build.mk
+
+ # We can't depend on haddock except when bootstrapping when we
+ # must build docs and include them into the binary .tbz2 package
+ # app-text/dblatex is not in portage, can not build PDF or PS
+ echo "BUILD_SPHINX_PDF = NO" >> mk/build.mk
+ echo "BUILD_SPHINX_HTML = $(usex doc YES NO)" >> mk/build.mk
+ echo "BUILD_MAN = $(usex doc YES NO)" >> mk/build.mk
+
+ # this controls presence on 'xhtml' and 'haddock' in final install
+ echo "HADDOCK_DOCS = YES" >> mk/build.mk
+
+ # not used outside of ghc's test
+ if [[ -n ${GHC_BUILD_DPH} ]]; then
+ echo "BUILD_DPH = YES" >> mk/build.mk
+ else
+ echo "BUILD_DPH = NO" >> mk/build.mk
+ fi
+
+ # Any non-native build has to skip as it needs
+ # target haddock binary to be runnabine.
+ if ! is_native; then
+ # disable docs generation as it requires running stage2
+ echo "HADDOCK_DOCS=NO" >> mk/build.mk
+ echo "BUILD_SPHINX_HTML=NO" >> mk/build.mk
+ echo "BUILD_SPHINX_PDF=NO" >> mk/build.mk
+ fi
+
+ if is_crosscompile; then
+ # Install ghc-stage1 crosscompiler instead of
+ # ghc-stage2 cross-built compiler.
+ echo "Stage1Only=YES" >> mk/build.mk
+ fi
+
+ # allows overriding build flavours for libraries:
+ # v - vanilla (static libs)
+ # p - profiled
+ # dyn - shared libraries
+ # example: GHC_LIBRARY_WAYS="v dyn"
+ if [[ -n ${GHC_LIBRARY_WAYS} ]]; then
+ echo "GhcLibWays=${GHC_LIBRARY_WAYS}" >> mk/build.mk
+ fi
+ echo "BUILD_PROF_LIBS = $(usex profile YES NO)" >> mk/build.mk
+
+ # Get ghc from the unpacked binary .tbz2
+ # except when bootstrapping we just pick ghc up off the path
+ if ! use ghcbootstrap; then
+ export PATH="${WORKDIR}/usr/bin:${PATH}"
+ fi
+
+ echo "INTEGER_LIBRARY = $(usex gmp integer-gmp integer-simple)" >> mk/build.mk
+
+ # don't strip anything. Very useful when stage2 SIGSEGVs on you
+ echo "STRIP_CMD = :" >> mk/build.mk
+
+ local econf_args=()
+
+ # GHC embeds toolchain it was built by and uses it later.
+ # Don't allow things like ccache or versioned binary slip.
+ # We use stable thing across gcc upgrades.
+ # User can use EXTRA_ECONF=CC=... to override this default.
+ econf_args+=(
+ AR=${CTARGET}-ar
+ CC=${CTARGET}-gcc
+ # these should be inferred by GHC but ghc defaults
+ # to using bundled tools on windows.
+ Windres=${CTARGET}-windres
+ DllWrap=${CTARGET}-dllwrap
+ # we set the linker explicitly below
+ --disable-ld-override
+ )
+ case ${CTARGET} in
+ arm*)
+ # ld.bfd-2.28 does not work for ghc. Force ld.gold
+ # instead. This should be removed once gentoo gets
+ # a fix for R_ARM_COPY bug: https://sourceware.org/PR16177
+ econf_args+=(LD=${CTARGET}-ld.gold)
+ ;;
+ sparc*)
+ # ld.gold-2.28 does not work for ghc. Force ld.bfd
+ # instead. This should be removed once gentoo gets
+ # a fix for missing --no-relax support bug:
+ # https://sourceware.org/ml/binutils/2017-07/msg00183.html
+ econf_args+=(LD=${CTARGET}-ld.bfd)
+ ;;
+ *)
+ econf_args+=(LD=${CTARGET}-ld)
+ esac
+
+ if [[ ${CBUILD} != ${CHOST} ]]; then
+ # GHC bug: ghc claims not to support cross-building.
+ # It does, but does not distinct --host= value
+ # for stage1 and stage2 compiler.
+ econf_args+=(--host=${CBUILD})
+ fi
+
+ if use ghcmakebinary; then
+ # When building booting libary we are trying to
+ # bundle or restrict most of external depends
+ # with unstable ABI:
+ # - embed libffi (default GHC behaviour)
+ # - disable ncurses support for ghci (via haskeline)
+ # https://bugs.gentoo.org/557478
+ # - disable ncurses support for ghc-pkg
+ echo "libraries/haskeline_CONFIGURE_OPTS += --flag=-terminfo" >> mk/build.mk
+ echo "utils/ghc-pkg_HC_OPTS += -DBOOTSTRAPPING" >> mk/build.mk
+ elif is_native; then
+ # using ${GTARGET}'s libffi is not supported yet:
+ # GHC embeds full path for ffi includes without /usr/${CTARGET} account.
+ econf_args+=(--with-system-libffi)
+ econf_args+=(--with-ffi-includes=$($(tc-getPKG_CONFIG) libffi --cflags-only-I | sed -e 's@^-I@@'))
+ fi
+
+ einfo "Final mk/build.mk:"
+ cat mk/build.mk || die
+
+ econf ${econf_args[@]} \
+ --enable-bootstrap-with-devel-snapshot \
+ $(use_enable elfutils dwarf-unwind) \
+ $(use_enable numa)
+
+ if [[ ${PV} == *9999* ]]; then
+ GHC_PV="$(grep 'S\[\"PACKAGE_VERSION\"\]' config.status | sed -e 's@^.*=\"\(.*\)\"@\1@')"
+ GHC_P=${PN}-${GHC_PV}
+ fi
+ fi # ! use binary
+}
+
+src_compile() {
+ if ! use binary; then
+ # Stage1Only crosscompiler does not build stage2
+ if ! is_crosscompile; then
+ # 1. build/pax-mark compiler binary first
+ emake ghc/stage2/build/tmp/ghc-stage2
+ # 2. pax-mark (bug #516430)
+ pax-mark -m ghc/stage2/build/tmp/ghc-stage2
+ # 2. build/pax-mark haddock using ghc-stage2
+ if is_native; then
+ # non-native build does not build haddock
+ # due to HADDOCK_DOCS=NO, but it could.
+ emake utils/haddock/dist/build/tmp/haddock
+ pax-mark -m utils/haddock/dist/build/tmp/haddock
+ fi
+ fi
+ # 3. and then all the rest
+ emake all
+ fi # ! use binary
+}
+
+src_test() {
+ # TODO: deal with:
+ # - sandbox (pollutes environment)
+ # - extra packages (to extend testsuite coverage)
+ # bits are taken from 'validate'
+ local make_test_target='test' # can be fulltest
+ # not 'emake' as testsuite uses '$MAKE' without jobserver available
+ make $make_test_target stage=2 THREADS=$(makeopts_jobs)
+}
+
+src_install() {
+ if use binary; then
+ use prefix && mkdir -p "${ED}"
+ mv "${S}/usr" "${ED}"
+ else
+ [[ -f VERSION ]] || emake VERSION
+
+ # -j1 due to a rare race in install script:
+ # make --no-print-directory -f ghc.mk phase=final install
+ # /usr/lib/portage/python3.4/ebuild-helpers/xattr/install -c -m 755 \
+ # -d "/tmp/portage-tmpdir/portage/cross-armv7a-unknown-linux-gnueabi/ghc-9999/image/usr/lib64/armv7a-unknown-linux-gnueabi-ghc-8.3.20170404/include"
+ # /usr/lib/portage/python3.4/ebuild-helpers/xattr/install -c -m 644 utils/hsc2hs/template-hsc.h \
+ # "/tmp/portage-tmpdir/portage/cross-armv7a-unknown-linux-gnueabi/ghc-9999/image/usr/lib64/armv7a-unknown-linux-gnueabi-ghc-8.3.20170404"
+ # /usr/bin/install: cannot create regular file \
+ # '/tmp/portage-tmpdir/portage/cross-armv7a-unknown-linux-gnueabi/ghc-9999/image/usr/lib64/armv7a-unknown-linux-gnueabi-ghc-8.3.20170404': No such file or directory
+ emake -j1 install DESTDIR="${D}"
+
+ # Skip for cross-targets as they all share target location:
+ # /usr/share/doc/ghc-9999/
+ if ! is_crosscompile; then
+ dodoc "distrib/README" "LICENSE" "VERSION"
+ fi
+
+ # rename ghc-shipped files to avoid collision
+ # of external packages. Motivating example:
+ # user had installed:
+ # dev-lang/ghc-7.8.4-r0 (with transformers-0.3.0.0)
+ # dev-haskell/transformers-0.4.2.0
+ # then user tried to update to
+ # dev-lang/ghc-7.8.4-r1 (with transformers-0.4.2.0)
+ # this will lead to single .conf file collision.
+ local shipped_conf renamed_conf
+ local package_confdir="${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
+ for shipped_conf in "${package_confdir}"/*.conf; do
+ # rename 'pkg-ver-id.conf' to 'pkg-ver-id-gentoo-${PF}.conf'
+ renamed_conf=${shipped_conf%.conf}-gentoo-${PF}.conf
+ mv "${shipped_conf}" "${renamed_conf}" || die
+ done
+
+ # remove link, but leave 'haddock-${GHC_P}'
+ rm -f "${ED}"/usr/bin/$(cross)haddock
+
+ if ! is_crosscompile; then
+ newbashcomp "${FILESDIR}"/ghc-bash-completion ghc-pkg
+ newbashcomp utils/completion/ghc.bash ghc
+ fi
+ fi
+
+ # path to the package.cache
+ local package_confdir="${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
+ PKGCACHE="${package_confdir}"/package.cache
+ # copy the package.conf.d, including timestamp, save it so we can help
+ # users that have a broken package.conf.d
+ cp -pR "${package_confdir}"{,.initial} || die "failed to backup intial package.conf.d"
+
+ # copy the package.conf, including timestamp, save it so we later can put it
+ # back before uninstalling, or when upgrading.
+ cp -p "${PKGCACHE}"{,.shipped} \
+ || die "failed to copy package.conf.d/package.cache"
+
+ if is_crosscompile; then
+ # When we build a cross-compiler the layout is the following:
+ # usr/lib/${CTARGET}-ghc-${VER}/ contains target libraries
+ # but
+ # usr/lib/${CTARGET}-ghc-${VER}/bin/ directory
+ # containst host binaries (modulo bugs).
+
+ # Portage's stripping mechanism does not skip stripping
+ # foreign binaries. This frequently causes binaries to be
+ # broken.
+ #
+ # Thus below we disable stripping of target libraries and allow
+ # stripping hosts executables.
+ dostrip -x "/usr/$(get_libdir)/$(cross)${GHC_P}"
+ dostrip "/usr/$(get_libdir)/$(cross)${GHC_P}/bin"
+ fi
+}
+
+pkg_preinst() {
+ # have we got an earlier version of ghc installed?
+ if has_version "<${CATEGORY}/${PF}"; then
+ haskell_updater_warn="1"
+ fi
+}
+
+pkg_postinst() {
+ ghc-reregister
+
+ # path to the package.cache
+ PKGCACHE="${EROOT}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d/package.cache"
+
+ # give the cache a new timestamp, it must be as recent as
+ # the package.conf.d directory.
+ touch "${PKGCACHE}"
+
+ if [[ "${haskell_updater_warn}" == "1" ]]; then
+ ewarn
+ ewarn "\e[1;31m************************************************************************\e[0m"
+ ewarn
+ ewarn "You have just upgraded from an older version of GHC."
+ ewarn "You may have to run"
+ ewarn " 'haskell-updater'"
+ ewarn "to rebuild all ghc-based Haskell libraries."
+ ewarn
+ ewarn "\e[1;31m************************************************************************\e[0m"
+ ewarn
+ fi
+}
+
+pkg_prerm() {
+ PKGCACHE="${EROOT}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d/package.cache"
+ rm -rf "${PKGCACHE}"
+
+ cp -p "${PKGCACHE}"{.shipped,}
+}
+
+pkg_postrm() {
+ ghc-package_pkg_postrm
+}
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: dev-lang/ghc/files/, dev-lang/ghc/
@ 2021-06-06 10:01 Sergei Trofimovich
0 siblings, 0 replies; 9+ messages in thread
From: Sergei Trofimovich @ 2021-06-06 10:01 UTC (permalink / raw
To: gentoo-commits
commit: 014738239a0908d3bdb47240c54bf04411cdaf31
Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Sun Jun 6 09:57:22 2021 +0000
Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Sun Jun 6 10:01:03 2021 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=01473823
dev-lang/ghc: backport sphinx quoting fix
Reported-by: Andrew Savchenko
Closes: https://bugs.gentoo.org/792558
Package-Manager: Portage-3.0.19, Repoman-3.0.3
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
dev-lang/ghc/files/ghc-8.10.4-sphinx-quote.patch | 27 ++++++++++++++++++++++++
dev-lang/ghc/ghc-8.10.4.ebuild | 1 +
2 files changed, 28 insertions(+)
diff --git a/dev-lang/ghc/files/ghc-8.10.4-sphinx-quote.patch b/dev-lang/ghc/files/ghc-8.10.4-sphinx-quote.patch
new file mode 100644
index 00000000000..e9517dbea06
--- /dev/null
+++ b/dev-lang/ghc/files/ghc-8.10.4-sphinx-quote.patch
@@ -0,0 +1,27 @@
+https://bugs.gentoo.org/792558
+
+From 83407ffc7acc00cc025b9f6ed063add9ab9f9bcc Mon Sep 17 00:00:00 2001
+From: Krzysztof Gogolewski <krzysztof.gogolewski@tweag.io>
+Date: Fri, 25 Sep 2020 02:52:19 +0200
+Subject: [PATCH] Various documentation fixes
+
+* Use r'' in conf.py. This fixes a Sphinx warning:
+ WARNING: Support for evaluating Python 2 syntax is deprecated and will be removed in Sphinx 4.0. Convert docs/users_guide/conf.py to Python 3 syntax.
+--- a/docs/users_guide/conf.py
++++ b/docs/users_guide/conf.py
+@@ -100,13 +100,13 @@ htmlhelp_basename = 'GHCUsersGuide'
+ latex_elements = {
+ 'inputenc': '',
+ 'utf8extra': '',
+- 'preamble': '''
++ 'preamble': r'''
+ \usepackage{fontspec}
+ \usepackage{makeidx}
+ \setsansfont{DejaVu Sans}
+ \setromanfont{DejaVu Serif}
+ \setmonofont{DejaVu Sans Mono}
+-\setlength{\\tymin}{45pt}
++\setlength{\tymin}{45pt}
+ ''',
+ }
+
diff --git a/dev-lang/ghc/ghc-8.10.4.ebuild b/dev-lang/ghc/ghc-8.10.4.ebuild
index 3e4cfb0d0db..af942b11cd0 100644
--- a/dev-lang/ghc/ghc-8.10.4.ebuild
+++ b/dev-lang/ghc/ghc-8.10.4.ebuild
@@ -502,6 +502,7 @@ src_prepare() {
eapply "${FILESDIR}"/${PN}-8.8.1-revert-CPP.patch
eapply "${FILESDIR}"/${PN}-8.10.1-allow-cross-bootstrap.patch
eapply "${FILESDIR}"/${PN}-8.10.3-C99-typo-ac270.patch
+ eapply "${FILESDIR}"/${PN}-8.10.4-sphinx-quote.patch
# a bunch of crosscompiler patches
# needs newer version:
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: dev-lang/ghc/files/, dev-lang/ghc/
@ 2022-10-08 15:39 Sam James
0 siblings, 0 replies; 9+ messages in thread
From: Sam James @ 2022-10-08 15:39 UTC (permalink / raw
To: gentoo-commits
commit: aa97e84026a6db67f5f226ef7a7d3c2aefd0b5c2
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 8 15:39:22 2022 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Oct 8 15:39:37 2022 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=aa97e840
dev-lang/ghc: move large patch out of FILESDIR
Signed-off-by: Sam James <sam <AT> gentoo.org>
dev-lang/ghc/Manifest | 1 +
dev-lang/ghc/files/ghc-9.0.2-riscv64-llvm.patch | 799 ------------------------
dev-lang/ghc/ghc-9.0.2.ebuild | 4 +-
3 files changed, 4 insertions(+), 800 deletions(-)
diff --git a/dev-lang/ghc/Manifest b/dev-lang/ghc/Manifest
index 40f74af60159..936403504661 100644
--- a/dev-lang/ghc/Manifest
+++ b/dev-lang/ghc/Manifest
@@ -1,5 +1,6 @@
DIST ghc-8.10.6-src.tar.xz 19932832 BLAKE2B f5d0c43aa5df87648e32beeb5ed6866b231cbce4f344fb03110db826b36bbac435f5e89d9ffeef3f87c15e830fdee6b95150b7bdcd06906575bfcd9c83797dff SHA512 6314eb9744d47d803b30b621bd12bf6179dad5cc578ec267b3a65b89e9c9b431bdb4913936f040c7ca4fcc71a676a43e78b5f6173d123a844e7f29004405b8b6
DIST ghc-8.10.6-testsuite.tar.xz 2265044 BLAKE2B 72a1e955acecc92a720ee2747d96cacf56f2968c9deabb254c882a969c154baa0fdb639a857844ec91a4e47ee553dd13b58c3b790202e7e73500095c1ec85ee9 SHA512 f74d743bd8f889c2941be8fd5348e92abcaf75bce48140f7f9cc0c6ce33ba24a8479bef48631ffe2a10397c0ecf166b3bddb6ca8ee905859c029175de5d43f2a
+DIST ghc-9.0.2-riscv64-llvm.patch.xz 7148 BLAKE2B 01a0d4036b649f663aebebab06990ac041533e7462d3ee9e143444f1119b736f2f8f2dfc293d61da1fac9f0d3ef12e98bab5b0c9fe8440ed1eab22a1d45fb9d7 SHA512 8afb62d5363d8a1a8f63e85335f3c8fa35b7d22899ebe334218a60ce9519852325c8ce93bb0be794c36cbc3c1cc031b7b1e2f4d7665d71f49e95f737bd91ba1a
DIST ghc-9.0.2-src.tar.xz 27270396 BLAKE2B 0a73d910d3ef11161f895849025fe37ce231932f7cde441fdf620cf8c51678060a804467879eb0ee5c0a30413604c56e28e2aa1cde01e45c620b76987d9c0c0e SHA512 32994c7d2b8f47bae604cd825bfcf9c788d79ce26d1d5f58bd73a7093e11ae6c3c17b31dc0c9e454dbf67ca169b942f92213c388d615768cae86055bf6094dee
DIST ghc-9.0.2-testsuite.tar.xz 2403564 BLAKE2B 0e7f6fefb9c972f94073aca8b15147913ffa8d3cd3ff7fc63ef7e20b4efd8b443cf21f12e1ab0f5044790f6d8af6cf7788bda85a21b2f356ddface86eb896670 SHA512 b2375500ae837d74af8085d099899b5a7a589c59bdcc033ca0bd6e00f33c4f8d90b481e0c7c3de113e607fcfafdfe8edde4713e6d242b2d4ee87df2eb960c9c7
DIST ghc-bin-8.10.6-i686-pc-linux-gnu.tbz2 124324289 BLAKE2B afb34984872b35fdedbdedeb8756cc7c33e5b943dba57dd86910b076d483bb643265d0ab0027784dec5dc489eabd65b5ab17474f25fb2ce657925aa0efaa9033 SHA512 4be13e6dba298d12a4d49ae4633eec83cfaaaf22b5f8cfca5f5952aa294ae52fb3601490beed3bda5a7f7b6a5bd81e0ecc9fc39e8df836cc8fd377a0d0b783a0
diff --git a/dev-lang/ghc/files/ghc-9.0.2-riscv64-llvm.patch b/dev-lang/ghc/files/ghc-9.0.2-riscv64-llvm.patch
deleted file mode 100644
index 0dcd6cde197b..000000000000
--- a/dev-lang/ghc/files/ghc-9.0.2-riscv64-llvm.patch
+++ /dev/null
@@ -1,799 +0,0 @@
-GHC supplied all of the information necessary for a registerised build on riscv using LLVM codegen in 9.2.
-Andreas Schwab backported this to 8.10.7 in OpenSUSE: https://build.opensuse.org/package/show/openSUSE:Factory:RISCV/ghc
-This is a forward-port of the backport to 9.0.
-
-diff --git a/compiler/GHC/CmmToAsm.hs b/compiler/GHC/CmmToAsm.hs
-index 23175a1cd2..3f77573495 100644
---- a/compiler/GHC/CmmToAsm.hs
-+++ b/compiler/GHC/CmmToAsm.hs
-@@ -182,6 +182,7 @@ nativeCodeGen dflags this_mod modLoc h us cmms
- ArchAlpha -> panic "nativeCodeGen: No NCG for Alpha"
- ArchMipseb -> panic "nativeCodeGen: No NCG for mipseb"
- ArchMipsel -> panic "nativeCodeGen: No NCG for mipsel"
-+ ArchRISCV64 -> panic "nativeCodeGen: No NCG for RISCV64"
- ArchUnknown -> panic "nativeCodeGen: No NCG for unknown arch"
- ArchJavaScript-> panic "nativeCodeGen: No NCG for JavaScript"
-
-diff --git a/compiler/GHC/CmmToAsm/Reg/Graph/TrivColorable.hs b/compiler/GHC/CmmToAsm/Reg/Graph/TrivColorable.hs
-index 105e2ebdf9..07eca93ac3 100644
---- a/compiler/GHC/CmmToAsm/Reg/Graph/TrivColorable.hs
-+++ b/compiler/GHC/CmmToAsm/Reg/Graph/TrivColorable.hs
-@@ -120,6 +120,7 @@ trivColorable platform virtualRegSqueeze realRegSqueeze RcInteger conflicts excl
- ArchMipseb -> panic "trivColorable ArchMipseb"
- ArchMipsel -> panic "trivColorable ArchMipsel"
- ArchS390X -> panic "trivColorable ArchS390X"
-+ ArchRISCV64 -> panic "trivColorable ArchRISCV64"
- ArchJavaScript-> panic "trivColorable ArchJavaScript"
- ArchUnknown -> panic "trivColorable ArchUnknown")
- , count2 <- accSqueeze 0 cALLOCATABLE_REGS_INTEGER
-@@ -151,6 +152,7 @@ trivColorable platform virtualRegSqueeze realRegSqueeze RcFloat conflicts exclus
- ArchMipseb -> panic "trivColorable ArchMipseb"
- ArchMipsel -> panic "trivColorable ArchMipsel"
- ArchS390X -> panic "trivColorable ArchS390X"
-+ ArchRISCV64 -> panic "trivColorable ArchRISCV64"
- ArchJavaScript-> panic "trivColorable ArchJavaScript"
- ArchUnknown -> panic "trivColorable ArchUnknown")
- , count2 <- accSqueeze 0 cALLOCATABLE_REGS_FLOAT
-@@ -184,6 +186,7 @@ trivColorable platform virtualRegSqueeze realRegSqueeze RcDouble conflicts exclu
- ArchMipseb -> panic "trivColorable ArchMipseb"
- ArchMipsel -> panic "trivColorable ArchMipsel"
- ArchS390X -> panic "trivColorable ArchS390X"
-+ ArchRISCV64 -> panic "trivColorable ArchRISCV64"
- ArchJavaScript-> panic "trivColorable ArchJavaScript"
- ArchUnknown -> panic "trivColorable ArchUnknown")
- , count2 <- accSqueeze 0 cALLOCATABLE_REGS_DOUBLE
-diff --git a/compiler/GHC/CmmToAsm/Reg/Linear.hs b/compiler/GHC/CmmToAsm/Reg/Linear.hs
-index 1ab353cc34..d8228c69cd 100644
---- a/compiler/GHC/CmmToAsm/Reg/Linear.hs
-+++ b/compiler/GHC/CmmToAsm/Reg/Linear.hs
-@@ -225,6 +225,7 @@ linearRegAlloc config entry_ids block_live sccs
- ArchAlpha -> panic "linearRegAlloc ArchAlpha"
- ArchMipseb -> panic "linearRegAlloc ArchMipseb"
- ArchMipsel -> panic "linearRegAlloc ArchMipsel"
-+ ArchRISCV64 -> panic "linearRegAlloc ArchRISCV64"
- ArchJavaScript -> panic "linearRegAlloc ArchJavaScript"
- ArchUnknown -> panic "linearRegAlloc ArchUnknown"
- where
-diff --git a/compiler/GHC/CmmToAsm/Reg/Linear/FreeRegs.hs b/compiler/GHC/CmmToAsm/Reg/Linear/FreeRegs.hs
-index b89c056a82..1768422f5c 100644
---- a/compiler/GHC/CmmToAsm/Reg/Linear/FreeRegs.hs
-+++ b/compiler/GHC/CmmToAsm/Reg/Linear/FreeRegs.hs
-@@ -83,5 +83,6 @@ maxSpillSlots config = case platformArch (ncgPlatform config) of
- ArchAlpha -> panic "maxSpillSlots ArchAlpha"
- ArchMipseb -> panic "maxSpillSlots ArchMipseb"
- ArchMipsel -> panic "maxSpillSlots ArchMipsel"
-+ ArchRISCV64 -> panic "maxSpillSlots ArchRISCV64"
- ArchJavaScript-> panic "maxSpillSlots ArchJavaScript"
- ArchUnknown -> panic "maxSpillSlots ArchUnknown"
-diff --git a/compiler/GHC/CmmToAsm/Reg/Target.hs b/compiler/GHC/CmmToAsm/Reg/Target.hs
-index ba249801ba..284df45983 100644
---- a/compiler/GHC/CmmToAsm/Reg/Target.hs
-+++ b/compiler/GHC/CmmToAsm/Reg/Target.hs
-@@ -51,6 +51,7 @@ targetVirtualRegSqueeze platform
- ArchAlpha -> panic "targetVirtualRegSqueeze ArchAlpha"
- ArchMipseb -> panic "targetVirtualRegSqueeze ArchMipseb"
- ArchMipsel -> panic "targetVirtualRegSqueeze ArchMipsel"
-+ ArchRISCV64 -> panic "targetVirtualRegSqueeze ArchRISCV64"
- ArchJavaScript-> panic "targetVirtualRegSqueeze ArchJavaScript"
- ArchUnknown -> panic "targetVirtualRegSqueeze ArchUnknown"
-
-@@ -70,6 +71,7 @@ targetRealRegSqueeze platform
- ArchAlpha -> panic "targetRealRegSqueeze ArchAlpha"
- ArchMipseb -> panic "targetRealRegSqueeze ArchMipseb"
- ArchMipsel -> panic "targetRealRegSqueeze ArchMipsel"
-+ ArchRISCV64 -> panic "targetRealRegSqueeze ArchRISCV64"
- ArchJavaScript-> panic "targetRealRegSqueeze ArchJavaScript"
- ArchUnknown -> panic "targetRealRegSqueeze ArchUnknown"
-
-@@ -88,6 +90,7 @@ targetClassOfRealReg platform
- ArchAlpha -> panic "targetClassOfRealReg ArchAlpha"
- ArchMipseb -> panic "targetClassOfRealReg ArchMipseb"
- ArchMipsel -> panic "targetClassOfRealReg ArchMipsel"
-+ ArchRISCV64 -> panic "targetClassOfRealReg ArchRISCV64"
- ArchJavaScript-> panic "targetClassOfRealReg ArchJavaScript"
- ArchUnknown -> panic "targetClassOfRealReg ArchUnknown"
-
-@@ -106,6 +109,7 @@ targetMkVirtualReg platform
- ArchAlpha -> panic "targetMkVirtualReg ArchAlpha"
- ArchMipseb -> panic "targetMkVirtualReg ArchMipseb"
- ArchMipsel -> panic "targetMkVirtualReg ArchMipsel"
-+ ArchRISCV64 -> panic "targetMkVirtualReg ArchRISCV64"
- ArchJavaScript-> panic "targetMkVirtualReg ArchJavaScript"
- ArchUnknown -> panic "targetMkVirtualReg ArchUnknown"
-
-@@ -124,6 +128,7 @@ targetRegDotColor platform
- ArchAlpha -> panic "targetRegDotColor ArchAlpha"
- ArchMipseb -> panic "targetRegDotColor ArchMipseb"
- ArchMipsel -> panic "targetRegDotColor ArchMipsel"
-+ ArchRISCV64 -> panic "targetRegDotColor ArchRISCV64"
- ArchJavaScript-> panic "targetRegDotColor ArchJavaScript"
- ArchUnknown -> panic "targetRegDotColor ArchUnknown"
-
-diff --git a/compiler/GHC/CmmToLlvm/Mangler.hs b/compiler/GHC/CmmToLlvm/Mangler.hs
-index 0436dbcf07..5c71655ab3 100644
---- a/compiler/GHC/CmmToLlvm/Mangler.hs
-+++ b/compiler/GHC/CmmToLlvm/Mangler.hs
-@@ -42,7 +42,7 @@ llvmFixupAsm dflags f1 f2 = {-# SCC "llvm_mangler" #-}
-
- -- | These are the rewrites that the mangler will perform
- rewrites :: [Rewrite]
--rewrites = [rewriteSymType, rewriteAVX]
-+rewrites = [rewriteSymType, rewriteAVX, rewriteCall]
-
- type Rewrite = DynFlags -> B.ByteString -> Maybe B.ByteString
-
-@@ -106,6 +106,27 @@ rewriteAVX dflags s
- isVmovdqa = B.isPrefixOf (B.pack "vmovdqa")
- isVmovap = B.isPrefixOf (B.pack "vmovap")
-
-+-- | This rewrites (tail) calls to avoid creating PLT entries for
-+-- functions on riscv64. The replacement will load the address from the
-+-- GOT, which is resolved to point to the real address of the function.
-+rewriteCall :: Rewrite
-+rewriteCall dflags l
-+ | not isRISCV64 = Nothing
-+ | isCall l = Just $ replaceCall "call" "jalr" "ra" l
-+ | isTail l = Just $ replaceCall "tail" "jr" "t1" l
-+ | otherwise = Nothing
-+ where
-+ isRISCV64 = platformArch (targetPlatform dflags) == ArchRISCV64
-+ isCall = B.isPrefixOf (B.pack "call\t")
-+ isTail = B.isPrefixOf (B.pack "tail\t")
-+
-+ replaceCall call jump reg l =
-+ appendInsn (jump ++ "\t" ++ reg) $ removePlt $
-+ replaceOnce (B.pack call) (B.pack ("la\t" ++ reg ++ ",")) l
-+ where
-+ removePlt = replaceOnce (B.pack "@plt") (B.pack "")
-+ appendInsn i = (`B.append` B.pack ("\n\t" ++ i))
-+
- -- | @replaceOnce match replace bs@ replaces the first occurrence of the
- -- substring @match@ in @bs@ with @replace@.
- replaceOnce :: B.ByteString -> B.ByteString -> B.ByteString -> B.ByteString
-diff --git a/compiler/GHC/Driver/Pipeline.hs b/compiler/GHC/Driver/Pipeline.hs
-index 8edf49dfdd..d66404e916 100644
---- a/compiler/GHC/Driver/Pipeline.hs
-+++ b/compiler/GHC/Driver/Pipeline.hs
-@@ -936,6 +936,7 @@ llvmOptions dflags =
- ++ [("", "-mcpu=" ++ mcpu) | not (null mcpu)
- , not (any (isInfixOf "-mcpu") (getOpts dflags opt_lc)) ]
- ++ [("", "-mattr=" ++ attrs) | not (null attrs) ]
-+ ++ [("", "-target-abi=" ++ abi) | not (null abi) ]
-
- where target = platformMisc_llvmTarget $ platformMisc dflags
- Just (LlvmTarget _ mcpu mattr) = lookup target (llvmTargets $ llvmConfig dflags)
-@@ -965,6 +966,11 @@ llvmOptions dflags =
- ++ ["+bmi" | isBmiEnabled dflags ]
- ++ ["+bmi2" | isBmi2Enabled dflags ]
-
-+ abi :: String
-+ abi = case platformArch (targetPlatform dflags) of
-+ ArchRISCV64 -> "lp64d"
-+ _ -> ""
-+
- -- -----------------------------------------------------------------------------
- -- | Each phase in the pipeline returns the next phase to execute, and the
- -- name of the file in which the output was placed.
-diff --git a/compiler/GHC/Platform/RISCV64.hs b/compiler/GHC/Platform/RISCV64.hs
-new file mode 100644
-index 0000000000..289e2e27a8
---- /dev/null
-+++ b/compiler/GHC/Platform/RISCV64.hs
-@@ -0,0 +1,9 @@
-+{-# LANGUAGE CPP #-}
-+
-+module GHC.Platform.RISCV64 where
-+
-+import GHC.Prelude
-+
-+#define MACHREGS_NO_REGS 0
-+#define MACHREGS_riscv64 1
-+#include "../../../includes/CodeGen.Platform.hs"
-diff --git a/compiler/GHC/Platform/Regs.hs b/compiler/GHC/Platform/Regs.hs
-index 1bf21370c7..e0bdf5d6e5 100644
---- a/compiler/GHC/Platform/Regs.hs
-+++ b/compiler/GHC/Platform/Regs.hs
-@@ -15,6 +15,7 @@ import qualified GHC.Platform.S390X as S390X
- import qualified GHC.Platform.SPARC as SPARC
- import qualified GHC.Platform.X86 as X86
- import qualified GHC.Platform.X86_64 as X86_64
-+import qualified GHC.Platform.RISCV64 as RISCV64
- import qualified GHC.Platform.NoRegs as NoRegs
-
- -- | Returns 'True' if this global register is stored in a caller-saves
-@@ -31,6 +32,7 @@ callerSaves platform
- ArchSPARC -> SPARC.callerSaves
- ArchARM {} -> ARM.callerSaves
- ArchAArch64 -> AArch64.callerSaves
-+ ArchRISCV64 -> RISCV64.callerSaves
- arch
- | arch `elem` [ArchPPC, ArchPPC_64 ELF_V1, ArchPPC_64 ELF_V2] ->
- PPC.callerSaves
-@@ -53,6 +55,7 @@ activeStgRegs platform
- ArchSPARC -> SPARC.activeStgRegs
- ArchARM {} -> ARM.activeStgRegs
- ArchAArch64 -> AArch64.activeStgRegs
-+ ArchRISCV64 -> RISCV64.activeStgRegs
- arch
- | arch `elem` [ArchPPC, ArchPPC_64 ELF_V1, ArchPPC_64 ELF_V2] ->
- PPC.activeStgRegs
-@@ -70,6 +73,7 @@ haveRegBase platform
- ArchSPARC -> SPARC.haveRegBase
- ArchARM {} -> ARM.haveRegBase
- ArchAArch64 -> AArch64.haveRegBase
-+ ArchRISCV64 -> RISCV64.haveRegBase
- arch
- | arch `elem` [ArchPPC, ArchPPC_64 ELF_V1, ArchPPC_64 ELF_V2] ->
- PPC.haveRegBase
-@@ -87,6 +91,7 @@ globalRegMaybe platform
- ArchSPARC -> SPARC.globalRegMaybe
- ArchARM {} -> ARM.globalRegMaybe
- ArchAArch64 -> AArch64.globalRegMaybe
-+ ArchRISCV64 -> RISCV64.globalRegMaybe
- arch
- | arch `elem` [ArchPPC, ArchPPC_64 ELF_V1, ArchPPC_64 ELF_V2] ->
- PPC.globalRegMaybe
-@@ -104,6 +109,7 @@ freeReg platform
- ArchSPARC -> SPARC.freeReg
- ArchARM {} -> ARM.freeReg
- ArchAArch64 -> AArch64.freeReg
-+ ArchRISCV64 -> RISCV64.freeReg
- arch
- | arch `elem` [ArchPPC, ArchPPC_64 ELF_V1, ArchPPC_64 ELF_V2] ->
- PPC.freeReg
-diff --git a/compiler/ghc.cabal.in b/compiler/ghc.cabal.in
-index de53f7f548..483a601602 100644
---- a/compiler/ghc.cabal.in
-+++ b/compiler/ghc.cabal.in
-@@ -261,6 +261,7 @@ Library
- GHC.Platform.AArch64
- GHC.Platform.NoRegs
- GHC.Platform.PPC
-+ GHC.Platform.RISCV64
- GHC.Platform.S390X
- GHC.Platform.SPARC
- GHC.Platform.X86
-diff --git a/configure.ac b/configure.ac
-index 20911ae43f..b017d50bd6 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -283,7 +283,7 @@ dnl --------------------------------------------------------------
-
- AC_MSG_CHECKING(whether target supports a registerised ABI)
- case "$TargetArch" in
-- i386|x86_64|powerpc|powerpc64|powerpc64le|s390x|arm|aarch64)
-+ i386|x86_64|powerpc|powerpc64|powerpc64le|s390x|arm|aarch64|riscv64)
- UnregisterisedDefault=NO
- AC_MSG_RESULT([yes])
- ;;
-@@ -318,7 +318,7 @@ AC_MSG_CHECKING(whether target supports tables next to code)
- case "$Unregisterised" in
- NO)
- case "$TargetArch" in
-- ia64|powerpc64|powerpc64le|s390x)
-+ ia64|powerpc64|powerpc64le|s390x|riscv64)
- TablesNextToCodeDefault=NO
- AC_MSG_RESULT([no])
- ;;
-@@ -347,7 +347,7 @@ AC_SUBST(TablesNextToCode)
- dnl ** Does target have runtime linker support?
- dnl --------------------------------------------------------------
- case "$target" in
-- powerpc64-*|powerpc64le-*|powerpc-ibm-aix*|s390x-ibm-linux)
-+ powerpc64-*|powerpc64le-*|powerpc-ibm-aix*|s390x-ibm-linux|riscv64-*)
- TargetHasRTSLinker=NO
- ;;
- *)
-diff --git a/includes/CodeGen.Platform.hs b/includes/CodeGen.Platform.hs
-index b00acfa38a..8c942662e6 100644
---- a/includes/CodeGen.Platform.hs
-+++ b/includes/CodeGen.Platform.hs
-@@ -380,6 +380,74 @@ import GHC.Platform.Reg
- # define f14 30
- # define f15 31
-
-+#elif defined(MACHREGS_riscv64)
-+
-+# define zero 0
-+# define ra 1
-+# define sp 2
-+# define gp 3
-+# define tp 4
-+# define t0 5
-+# define t1 6
-+# define t2 7
-+# define s0 8
-+# define s1 9
-+# define a0 10
-+# define a1 11
-+# define a2 12
-+# define a3 13
-+# define a4 14
-+# define a5 15
-+# define a6 16
-+# define a7 17
-+# define s2 18
-+# define s3 19
-+# define s4 20
-+# define s5 21
-+# define s6 22
-+# define s7 23
-+# define s8 24
-+# define s9 25
-+# define s10 26
-+# define s11 27
-+# define t3 28
-+# define t4 29
-+# define t5 30
-+# define t6 31
-+
-+# define ft0 32
-+# define ft1 33
-+# define ft2 34
-+# define ft3 35
-+# define ft4 36
-+# define ft5 37
-+# define ft6 38
-+# define ft7 39
-+# define fs0 40
-+# define fs1 41
-+# define fa0 42
-+# define fa1 43
-+# define fa2 44
-+# define fa3 45
-+# define fa4 46
-+# define fa5 47
-+# define fa6 48
-+# define fa7 49
-+# define fs2 50
-+# define fs3 51
-+# define fs4 52
-+# define fs5 53
-+# define fs6 54
-+# define fs7 55
-+# define fs8 56
-+# define fs9 57
-+# define fs10 58
-+# define fs11 59
-+# define ft8 60
-+# define ft9 61
-+# define ft10 62
-+# define ft11 63
-+
- #endif
-
- callerSaves :: GlobalReg -> Bool
-@@ -667,7 +735,7 @@ globalRegMaybe :: GlobalReg -> Maybe RealReg
- #if defined(MACHREGS_i386) || defined(MACHREGS_x86_64) \
- || defined(MACHREGS_sparc) || defined(MACHREGS_powerpc) \
- || defined(MACHREGS_arm) || defined(MACHREGS_aarch64) \
-- || defined(MACHREGS_s390x)
-+ || defined(MACHREGS_s390x) || defined(MACHREGS_riscv64)
- # if defined(REG_Base)
- globalRegMaybe BaseReg = Just (RealRegSingle REG_Base)
- # endif
-diff --git a/includes/stg/MachRegs.h b/includes/stg/MachRegs.h
-index be7b7d60b4..1a9012e7ef 100644
---- a/includes/stg/MachRegs.h
-+++ b/includes/stg/MachRegs.h
-@@ -663,6 +663,68 @@ the stack. See Note [Overlapping global registers] for implications.
- #define CALLER_SAVES_D5
- #define CALLER_SAVES_D6
-
-+/* -----------------------------------------------------------------------------
-+ The riscv64 register mapping
-+
-+ Register | Role(s) | Call effect
-+ ------------+-----------------------------------------+-------------
-+ zero | Hard-wired zero | -
-+ ra | Return address | caller-saved
-+ sp | Stack pointer | callee-saved
-+ gp | Global pointer | callee-saved
-+ tp | Thread pointer | callee-saved
-+ t0,t1,t2 | - | caller-saved
-+ s0 | Frame pointer | callee-saved
-+ s1 | - | callee-saved
-+ a0,a1 | Arguments / return values | caller-saved
-+ a2..a7 | Arguments | caller-saved
-+ s2..s11 | - | callee-saved
-+ t3..t6 | - | caller-saved
-+ ft0..ft7 | - | caller-saved
-+ fs0,fs1 | - | callee-saved
-+ fa0,fa1 | Arguments / return values | caller-saved
-+ fa2..fa7 | Arguments | caller-saved
-+ fs2..fs11 | - | callee-saved
-+ ft8..ft11 | - | caller-saved
-+
-+ Each general purpose register as well as each floating-point
-+ register is 64 bits wide.
-+
-+ -------------------------------------------------------------------------- */
-+
-+#elif defined(MACHREGS_riscv64)
-+
-+#define REG(x) __asm__(#x)
-+
-+#define REG_Base s1
-+#define REG_Sp s2
-+#define REG_Hp s3
-+#define REG_R1 s4
-+#define REG_R2 s5
-+#define REG_R3 s6
-+#define REG_R4 s7
-+#define REG_R5 s8
-+#define REG_R6 s9
-+#define REG_R7 s10
-+#define REG_SpLim s11
-+
-+#define REG_F1 fs0
-+#define REG_F2 fs1
-+#define REG_F3 fs2
-+#define REG_F4 fs3
-+#define REG_F5 fs4
-+#define REG_F6 fs5
-+
-+#define REG_D1 fs6
-+#define REG_D2 fs7
-+#define REG_D3 fs8
-+#define REG_D4 fs9
-+#define REG_D5 fs10
-+#define REG_D6 fs11
-+
-+#define MAX_REAL_FLOAT_REG 6
-+#define MAX_REAL_DOUBLE_REG 6
-+
- #else
-
- #error Cannot find platform to give register info for
-diff --git a/includes/stg/MachRegsForHost.h b/includes/stg/MachRegsForHost.h
-index 3597b2be90..e902d528f6 100644
---- a/includes/stg/MachRegsForHost.h
-+++ b/includes/stg/MachRegsForHost.h
-@@ -71,6 +71,10 @@
- #define MACHREGS_s390x 1
- #endif
-
-+#if defined(riscv64_HOST_ARCH)
-+#define MACHREGS_riscv64 1
-+#endif
-+
- #endif
-
- #include "MachRegs.h"
-diff --git a/includes/stg/SMP.h b/includes/stg/SMP.h
-index 389dd95c88..f12fd3f71b 100644
---- a/includes/stg/SMP.h
-+++ b/includes/stg/SMP.h
-@@ -377,6 +377,8 @@ write_barrier(void) {
- __asm__ __volatile__ ("" : : : "memory");
- #elif defined(arm_HOST_ARCH) || defined(aarch64_HOST_ARCH)
- __asm__ __volatile__ ("dmb st" : : : "memory");
-+#elif defined(riscv64_HOST_ARCH)
-+ __asm__ __volatile__ ("fence w,w" : : : "memory");
- #else
- #error memory barriers unimplemented on this architecture
- #endif
-@@ -401,6 +403,8 @@ store_load_barrier(void) {
- __asm__ __volatile__ ("dmb" : : : "memory");
- #elif defined(aarch64_HOST_ARCH)
- __asm__ __volatile__ ("dmb sy" : : : "memory");
-+#elif defined(riscv64_HOST_ARCH)
-+ __asm__ __volatile__ ("fence w,r" : : : "memory");
- #else
- #error memory barriers unimplemented on this architecture
- #endif
-@@ -426,6 +430,8 @@ load_load_barrier(void) {
- __asm__ __volatile__ ("dmb" : : : "memory");
- #elif defined(aarch64_HOST_ARCH)
- __asm__ __volatile__ ("dmb sy" : : : "memory");
-+#elif defined(riscv64_HOST_ARCH)
-+ __asm__ __volatile__ ("fence w,r" : : : "memory");
- #else
- #error memory barriers unimplemented on this architecture
- #endif
-diff --git a/libraries/ghc-boot/GHC/Platform.hs b/libraries/ghc-boot/GHC/Platform.hs
-index 186f8c8af6..44d2c68c0a 100644
---- a/libraries/ghc-boot/GHC/Platform.hs
-+++ b/libraries/ghc-boot/GHC/Platform.hs
-@@ -130,6 +130,7 @@ data Arch
- | ArchAlpha
- | ArchMipseb
- | ArchMipsel
-+ | ArchRISCV64
- | ArchJavaScript
- deriving (Read, Show, Eq)
-
-@@ -171,6 +172,7 @@ stringEncodeArch = \case
- ArchAlpha -> "alpha"
- ArchMipseb -> "mipseb"
- ArchMipsel -> "mipsel"
-+ ArchRISCV64 -> "riscv64"
- ArchJavaScript -> "js"
-
- isARM :: Arch -> Bool
-@@ -338,6 +340,7 @@ platformCConvNeedsExtension :: Platform -> Bool
- platformCConvNeedsExtension platform = case platformArch platform of
- ArchPPC_64 _ -> True
- ArchS390X -> True
-+ ArchRISCV64 -> True
- _ -> False
-
-
-diff --git a/libraries/ghci/GHCi/InfoTable.hsc b/libraries/ghci/GHCi/InfoTable.hsc
-index ad4eb4d6a8..1d1f8cd074 100644
---- a/libraries/ghci/GHCi/InfoTable.hsc
-+++ b/libraries/ghci/GHCi/InfoTable.hsc
-@@ -73,6 +73,7 @@ data Arch = ArchSPARC
- | ArchPPC64
- | ArchPPC64LE
- | ArchS390X
-+ | ArchRISCV64
- deriving Show
-
- mkJumpToAddr :: MonadFail m => EntryFunPtr-> m ItblCodes
-@@ -109,6 +110,8 @@ mArch =
- Just ArchPPC64LE
- #elif defined(s390x_HOST_ARCH)
- Just ArchS390X
-+#elif defined(riscv64_HOST_ARCH)
-+ Just ArchRISCV64
- #else
- Nothing
- #endif
-@@ -288,6 +291,15 @@ mkJumpToAddr' platform a = case platform of
- 0xC0, 0x19, byte3 w64, byte2 w64, byte1 w64, byte0 w64,
- 0x07, 0xF1 ]
-
-+ ArchRISCV64 ->
-+ let w64 = fromIntegral (funPtrToInt a) :: Word64
-+ in Right [ 0x00000297 -- auipc t0,0
-+ , 0x01053283 -- ld t0,16(t0)
-+ , 0x00028067 -- jr t0
-+ , 0x00000013 -- nop
-+ , fromIntegral w64
-+ , fromIntegral (w64 `shiftR` 32) ]
-+
- byte0 :: (Integral w) => w -> Word8
- byte0 w = fromIntegral w
-
-diff --git a/llvm-targets b/llvm-targets
-index c328b2e001..0f809b2418 100644
---- a/llvm-targets
-+++ b/llvm-targets
-@@ -38,6 +38,8 @@
- ,("powerpc64le-unknown-linux-musl", ("e-m:e-i64:64-n32:64", "ppc64le", "+secure-plt"))
- ,("powerpc64le-unknown-linux", ("e-m:e-i64:64-n32:64", "ppc64le", ""))
- ,("s390x-ibm-linux", ("E-m:e-i1:8:16-i8:8:16-i64:64-f128:64-a:8:16-n32:64", "z10", ""))
-+,("riscv64-unknown-linux-gnu", ("e-m:e-p:64:64-i64:64-i128:128-n64-S128", "", "+m +a +f +d +c +relax"))
-+,("riscv64-unknown-linux", ("e-m:e-p:64:64-i64:64-i128:128-n64-S128", "", "+m +a +f +d +c +relax"))
- ,("i386-apple-darwin", ("e-m:o-p:32:32-p270:32:32-p271:32:32-p272:64:64-f64:32:64-f80:128-n8:16:32-S128", "penryn", ""))
- ,("x86_64-apple-darwin", ("e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128", "penryn", ""))
- ,("arm64-apple-darwin", ("e-m:o-i64:64-i128:128-n32:64-S128", "apple-a12", "+v8.3a +fp-armv8 +neon +crc +crypto +fullfp16 +ras +lse +rdm +rcpc +zcm +zcz +sha2 +aes"))
-diff --git a/m4/fptools.m4 b/m4/fptools.m4
-index 8c6c9b7062..7dbe53d3b4 100644
---- a/m4/fptools.m4
-+++ b/m4/fptools.m4
-@@ -231,7 +231,10 @@ AC_DEFUN([FPTOOLS_SET_HASKELL_PLATFORM_VARS],
- mipsel)
- test -z "[$]2" || eval "[$]2=ArchMipsel"
- ;;
-- hppa|hppa1_1|ia64|m68k|nios2|riscv32|riscv64|rs6000|s390|sh4|vax)
-+ riscv64)
-+ test -z "[$]2" || eval "[$]2=ArchRISCV64"
-+ ;;
-+ hppa|hppa1_1|ia64|m68k|nios2|riscv32|rs6000|s390|sh4|vax)
- test -z "[$]2" || eval "[$]2=ArchUnknown"
- ;;
- *)
-diff --git a/mk/config.mk.in b/mk/config.mk.in
-index 48b8e23145..e260730991 100644
---- a/mk/config.mk.in
-+++ b/mk/config.mk.in
-@@ -179,7 +179,7 @@ ifeq "$(TargetArch_CPP)" "arm"
- # We don't support load/store barriers pre-ARMv7. See #10433.
- ArchSupportsSMP=$(if $(filter $(ARM_ISA),ARMv5 ARMv6),NO,YES)
- else
--ArchSupportsSMP=$(strip $(patsubst $(TargetArch_CPP), YES, $(findstring $(TargetArch_CPP), i386 x86_64 sparc powerpc powerpc64 powerpc64le s390x aarch64)))
-+ArchSupportsSMP=$(strip $(patsubst $(TargetArch_CPP), YES, $(findstring $(TargetArch_CPP), i386 x86_64 sparc powerpc powerpc64 powerpc64le s390x aarch64 riscv64)))
- endif
-
- # The THREADED_RTS requires `BaseReg` to be in a register and the
-diff --git a/rts/StgCRunAsm.S b/rts/StgCRunAsm.S
-index 60f1bf9a13..16b125a7e8 100644
---- a/rts/StgCRunAsm.S
-+++ b/rts/StgCRunAsm.S
-@@ -232,6 +232,150 @@ StgReturn:
- .size StgReturn, .-StgReturn
-
- .section .note.GNU-stack,"",@progbits
-+
-+#elif defined(riscv64_HOST_ARCH)
-+# define STACK_FRAME_SIZE (RESERVED_C_STACK_BYTES+208)
-+ .text
-+ .align 1
-+ .globl StgRun
-+ .type StgRun, @function
-+StgRun:
-+ .cfi_startproc
-+ addi sp,sp,-208
-+ .cfi_def_cfa_offset 208
-+ /* save callee-saved registers */
-+ sd ra,200(sp)
-+ sd s0,192(sp)
-+ sd s1,184(sp)
-+ sd s2,176(sp)
-+ sd s3,168(sp)
-+ sd s4,160(sp)
-+ sd s5,152(sp)
-+ sd s6,144(sp)
-+ sd s7,136(sp)
-+ sd s8,128(sp)
-+ sd s9,120(sp)
-+ sd s10,112(sp)
-+ sd s11,104(sp)
-+ fsd fs0,88(sp)
-+ fsd fs1,80(sp)
-+ fsd fs2,72(sp)
-+ fsd fs3,64(sp)
-+ fsd fs4,56(sp)
-+ fsd fs5,48(sp)
-+ fsd fs6,40(sp)
-+ fsd fs7,32(sp)
-+ fsd fs8,24(sp)
-+ fsd fs9,16(sp)
-+ fsd fs10,8(sp)
-+ fsd fs11,0(sp)
-+ /* allocate stack frame */
-+ li t0,RESERVED_C_STACK_BYTES
-+ sub sp,sp,t0
-+ .cfi_def_cfa_offset STACK_FRAME_SIZE
-+ .cfi_offset 1, -8
-+ .cfi_offset 8, -16
-+ .cfi_offset 9, -24
-+ .cfi_offset 18, -32
-+ .cfi_offset 19, -40
-+ .cfi_offset 20, -48
-+ .cfi_offset 21, -56
-+ .cfi_offset 22, -64
-+ .cfi_offset 23, -72
-+ .cfi_offset 24, -80
-+ .cfi_offset 25, -88
-+ .cfi_offset 26, -96
-+ .cfi_offset 27, -104
-+ .cfi_offset 40, -120
-+ .cfi_offset 41, -128
-+ .cfi_offset 50, -136
-+ .cfi_offset 51, -144
-+ .cfi_offset 52, -152
-+ .cfi_offset 53, -160
-+ .cfi_offset 54, -168
-+ .cfi_offset 55, -176
-+ .cfi_offset 56, -184
-+ .cfi_offset 57, -192
-+ .cfi_offset 58, -200
-+ .cfi_offset 59, -208
-+ /* set STGs BaseReg from RISCV a1 */
-+ mv s1,a1
-+ /* jump to STG function */
-+ jr a0
-+ .cfi_endproc
-+ .size StgRun, .-StgRun
-+
-+ .text
-+ .align 1
-+ .globl StgReturn
-+ .type StgReturn, @function
-+StgReturn:
-+ .cfi_startproc
-+ /* set return value from STGs R1 (RISCV s4) */
-+ mv a0,s4
-+ /* deallocate stack frame */
-+ li t0,RESERVED_C_STACK_BYTES
-+ add sp,sp,t0
-+ .cfi_def_cfa_offset 208
-+ /* restore callee-saved registers */
-+ ld ra,200(sp)
-+ .cfi_restore 1
-+ ld s0,192(sp)
-+ .cfi_restore 8
-+ ld s1,184(sp)
-+ .cfi_restore 9
-+ ld s2,176(sp)
-+ .cfi_restore 18
-+ ld s3,168(sp)
-+ .cfi_restore 19
-+ ld s4,160(sp)
-+ .cfi_restore 20
-+ ld s5,152(sp)
-+ .cfi_restore 21
-+ ld s6,144(sp)
-+ .cfi_restore 22
-+ ld s7,136(sp)
-+ .cfi_restore 23
-+ ld s8,128(sp)
-+ .cfi_restore 24
-+ ld s9,120(sp)
-+ .cfi_restore 25
-+ ld s10,112(sp)
-+ .cfi_restore 26
-+ ld s11,104(sp)
-+ .cfi_restore 27
-+ fld fs0,88(sp)
-+ .cfi_restore 40
-+ fld fs1,80(sp)
-+ .cfi_restore 41
-+ fld fs2,72(sp)
-+ .cfi_restore 50
-+ fld fs3,64(sp)
-+ .cfi_restore 51
-+ fld fs4,56(sp)
-+ .cfi_restore 52
-+ fld fs5,48(sp)
-+ .cfi_restore 53
-+ fld fs6,40(sp)
-+ .cfi_restore 54
-+ fld fs7,32(sp)
-+ .cfi_restore 55
-+ fld fs8,24(sp)
-+ .cfi_restore 56
-+ fld fs9,16(sp)
-+ .cfi_restore 57
-+ fld fs10,8(sp)
-+ .cfi_restore 58
-+ fld fs11,0(sp)
-+ .cfi_restore 59
-+ addi sp,sp,208
-+ .cfi_def_cfa_offset 0
-+ /* jump back to caller of StgRun() */
-+ ret
-+ .cfi_endproc
-+ .size StgReturn, .-StgReturn
-+
-+ .section .note.GNU-stack,"",@progbits
- #endif
-
- #endif /* !USE_MINIINTERPRETER */
-diff --git a/rts/linker/Elf.c b/rts/linker/Elf.c
-index 1da69d03fa..0aa1c8dd3f 100644
---- a/rts/linker/Elf.c
-+++ b/rts/linker/Elf.c
-@@ -412,6 +412,12 @@ ocVerifyImage_ELF ( ObjectCode* oc )
- #endif
- #if defined(EM_AARCH64)
- case EM_AARCH64: IF_DEBUG(linker,debugBelch( "aarch64" )); break;
-+#endif
-+#if defined(EM_RISCV)
-+ case EM_RISCV: IF_DEBUG(linker,debugBelch( "riscv" ));
-+ errorBelch("%s: RTS linker not implemented on riscv",
-+ oc->fileName);
-+ return 0;
- #endif
- default: IF_DEBUG(linker,debugBelch( "unknown" ));
- errorBelch("%s: unknown architecture (e_machine == %d)"
-diff --git a/utils/genapply/Main.hs b/utils/genapply/Main.hs
-index a6d944efa4..a5697b427f 100644
---- a/utils/genapply/Main.hs
-+++ b/utils/genapply/Main.hs
-@@ -17,6 +17,8 @@ module Main(main) where
- -- We improperly include *HOST* macros for our target...
- #include "../../includes/ghcconfig.h"
-
-+#undef UnregisterisedCompiler
-+
- -- ...so that this header defines the right stuff. It is the RTS's host, but
- -- our target, as we are generating code that uses that RTS.
- #include "../../includes/stg/MachRegsForHost.h"
-diff --git a/utils/llvm-targets/gen-data-layout.sh b/utils/llvm-targets/gen-data-layout.sh
-index 32032cb97e..092e0892e5 100755
---- a/utils/llvm-targets/gen-data-layout.sh
-+++ b/utils/llvm-targets/gen-data-layout.sh
-@@ -76,6 +76,9 @@ TARGETS=(
- "powerpc64le-unknown-linux"
- # Linux s390x
- "s390x-ibm-linux"
-+ # Linux riscv64
-+ "riscv64-unknown-linux-gnu"
-+ "riscv64-unknown-linux"
-
- #########################
- # Darwin
diff --git a/dev-lang/ghc/ghc-9.0.2.ebuild b/dev-lang/ghc/ghc-9.0.2.ebuild
index 47d7344fd4de..cadfe300318d 100644
--- a/dev-lang/ghc/ghc-9.0.2.ebuild
+++ b/dev-lang/ghc/ghc-9.0.2.ebuild
@@ -68,6 +68,8 @@ SRC_URI="!binary? (
https://downloads.haskell.org/ghc/${PV/_/-}/${GHC_P}-src.tar.xz
test? ( https://downloads.haskell.org/ghc/${PV/_/-}/${GHC_P}-testsuite.tar.xz )
)"
+SRC_URI+=" https://dev.gentoo.org/~sam/distfiles/${CATEGORY}/${PN}/${P}-riscv64-llvm.patch.xz"
+
S="${WORKDIR}"/${GHC_P}
[[ -n $arch_binaries ]] && SRC_URI+=" !ghcbootstrap? ( $arch_binaries )"
@@ -539,7 +541,7 @@ src_prepare() {
eapply "${FILESDIR}"/${PN}-9.0.2-disable-unboxed-arrays.patch
eapply "${FILESDIR}"/${PN}-9.0.2-llvm-13.patch
eapply "${FILESDIR}"/latomic-subword
- eapply "${FILESDIR}"/${PN}-9.0.2-riscv64-llvm.patch
+ eapply "${WORKDIR}"/${P}-riscv64-llvm.patch
# mingw32 target
pushd "${S}/libraries/Win32"
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: dev-lang/ghc/files/, dev-lang/ghc/
@ 2022-11-25 21:57 Sam James
0 siblings, 0 replies; 9+ messages in thread
From: Sam James @ 2022-11-25 21:57 UTC (permalink / raw
To: gentoo-commits
commit: 900642cc0d5faf150896c30d5ce52d06f7bace3f
Author: Jack Todaro <solpeth <AT> posteo <DOT> org>
AuthorDate: Fri Nov 25 19:57:27 2022 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Nov 25 21:56:35 2022 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=900642cc
dev-lang/ghc: sync from ::haskell (clang-16 workaround)
Signed-off-by: Jack Todaro <solpeth <AT> posteo.org>
Signed-off-by: Sam James <sam <AT> gentoo.org>
dev-lang/ghc/Manifest | 4 +
dev-lang/ghc/files/ghc-8.10.6-aclocal.patch | 26 +
dev-lang/ghc/ghc-8.10.6-r1.ebuild | 820 ++++++++++++++++++++++++++++
3 files changed, 850 insertions(+)
diff --git a/dev-lang/ghc/Manifest b/dev-lang/ghc/Manifest
index 3aa657ce7c7e..f3d895e800a6 100644
--- a/dev-lang/ghc/Manifest
+++ b/dev-lang/ghc/Manifest
@@ -1,6 +1,10 @@
+DIST ghc-8.10.6-src.tar.xz 19932832 BLAKE2B f5d0c43aa5df87648e32beeb5ed6866b231cbce4f344fb03110db826b36bbac435f5e89d9ffeef3f87c15e830fdee6b95150b7bdcd06906575bfcd9c83797dff SHA512 6314eb9744d47d803b30b621bd12bf6179dad5cc578ec267b3a65b89e9c9b431bdb4913936f040c7ca4fcc71a676a43e78b5f6173d123a844e7f29004405b8b6
+DIST ghc-8.10.6-testsuite.tar.xz 2265044 BLAKE2B 72a1e955acecc92a720ee2747d96cacf56f2968c9deabb254c882a969c154baa0fdb639a857844ec91a4e47ee553dd13b58c3b790202e7e73500095c1ec85ee9 SHA512 f74d743bd8f889c2941be8fd5348e92abcaf75bce48140f7f9cc0c6ce33ba24a8479bef48631ffe2a10397c0ecf166b3bddb6ca8ee905859c029175de5d43f2a
DIST ghc-9.0.2-riscv64-llvm.patch.xz 7148 BLAKE2B 01a0d4036b649f663aebebab06990ac041533e7462d3ee9e143444f1119b736f2f8f2dfc293d61da1fac9f0d3ef12e98bab5b0c9fe8440ed1eab22a1d45fb9d7 SHA512 8afb62d5363d8a1a8f63e85335f3c8fa35b7d22899ebe334218a60ce9519852325c8ce93bb0be794c36cbc3c1cc031b7b1e2f4d7665d71f49e95f737bd91ba1a
DIST ghc-9.0.2-src.tar.xz 27270396 BLAKE2B 0a73d910d3ef11161f895849025fe37ce231932f7cde441fdf620cf8c51678060a804467879eb0ee5c0a30413604c56e28e2aa1cde01e45c620b76987d9c0c0e SHA512 32994c7d2b8f47bae604cd825bfcf9c788d79ce26d1d5f58bd73a7093e11ae6c3c17b31dc0c9e454dbf67ca169b942f92213c388d615768cae86055bf6094dee
DIST ghc-9.0.2-testsuite.tar.xz 2403564 BLAKE2B 0e7f6fefb9c972f94073aca8b15147913ffa8d3cd3ff7fc63ef7e20b4efd8b443cf21f12e1ab0f5044790f6d8af6cf7788bda85a21b2f356ddface86eb896670 SHA512 b2375500ae837d74af8085d099899b5a7a589c59bdcc033ca0bd6e00f33c4f8d90b481e0c7c3de113e607fcfafdfe8edde4713e6d242b2d4ee87df2eb960c9c7
+DIST ghc-bin-8.10.6-i686-pc-linux-gnu.tbz2 124324289 BLAKE2B afb34984872b35fdedbdedeb8756cc7c33e5b943dba57dd86910b076d483bb643265d0ab0027784dec5dc489eabd65b5ab17474f25fb2ce657925aa0efaa9033 SHA512 4be13e6dba298d12a4d49ae4633eec83cfaaaf22b5f8cfca5f5952aa294ae52fb3601490beed3bda5a7f7b6a5bd81e0ecc9fc39e8df836cc8fd377a0d0b783a0
+DIST ghc-bin-8.10.6-x86_64-pc-linux-gnu.tbz2 122871118 BLAKE2B 527b36abf60390c91f91bc650ee25484d39d377739da87b5b6fd1a752705c1f3bc0ce0c68644657c9a7c1fc9a3b858b9dd7d84b25eab1a89125fccb6eb1f6250 SHA512 42b7fae339e82a6078fae8920efea8d0992e4774ea66b100e22dd9df168be57d8bce52558b8501c3c567c40776389d94bde3f17d26d63535140ce26ac16c27e1
DIST ghc-bin-9.0.2-aarch64-unknown-linux-gnu.tar.gz 304621314 BLAKE2B d38b8571d41b5703da6b29f43664293761865166a7e3ab6b9c4b039f1af15faa4aa2013a32eb00059d6e595984895762eadff7b62141157d2dea6eb9b035138d SHA512 94e0e00329a18b494b509b3f8190cf6fed2399a2ac2d2d96fdfd90bf5dbeb8db68b6759f719ad85f8873961b0e983ff0006ce0bf109e96462169cbd9fa7b6784
DIST ghc-bin-9.0.2-i686-pc-linux-gnu.tbz2 123509908 BLAKE2B 45614984803a7bfa266f99d4adb4b5f2ab7b9e5e89c6ecd501296fc99a1d96e798ccb9c832f8dcb15fff9725beb918a7b63e62ff13f59b6506a2ef17930c45d2 SHA512 e0b7f4474c16f0763a2f787027fbdfeb3125b48c987fa1196bc189fefad9f0bfa2806da62af46d61ca911f5275b578076e2b326acf39e0894a8daa9deda0843a
DIST ghc-bin-9.0.2-powerpc64-unknown-linux-gnu.tar.gz 235636284 BLAKE2B 878ac300cca5d2cbc5cb21dbb347da755b4027cbf63ec77464740854fa8010569de5e03acef67cd877da13665c906b2fd04e24e226e9eb39b57ba979093c732b SHA512 28f096e965abdac9cc370c882639f10285b9073ba5332f7af215eccff948e41c01c3d6bb3bc8e3b4e809e12867a95b49f82dd76e0090b974088f75ab9d1bc199
diff --git a/dev-lang/ghc/files/ghc-8.10.6-aclocal.patch b/dev-lang/ghc/files/ghc-8.10.6-aclocal.patch
new file mode 100644
index 000000000000..8bd3ce58d072
--- /dev/null
+++ b/dev-lang/ghc/files/ghc-8.10.6-aclocal.patch
@@ -0,0 +1,26 @@
+diff --git a/aclocal.m4 b/aclocal.m4
+index 47d69c5..212ebc6 100644
+--- a/aclocal.m4
++++ b/aclocal.m4
+@@ -966,17 +966,15 @@ struct nlist xYzzY1[] = {{"xYzzY1", 0},{0}};
+ struct nlist xYzzY2[] = {{"_xYzzY2", 0},{0}};
+ #endif
+
+-int main(argc, argv)
+-int argc;
+-char **argv;
++int main(int argc, char **argv)
+ {
+ #if defined(HAVE_NLIST_H)
+ if(nlist(argv[0], xYzzY1) == 0 && xYzzY1[0].n_value != 0)
+- exit(1);
++ return 1;
+ if(nlist(argv[0], xYzzY2) == 0 && xYzzY2[0].n_value != 0)
+- exit(0);
++ return 0;
+ #endif
+- exit(1);
++ return 1;
+ }]])],[fptools_cv_leading_underscore=yes],[fptools_cv_leading_underscore=no],[fptools_cv_leading_underscore=no])
+ ;;
+ esac]);
diff --git a/dev-lang/ghc/ghc-8.10.6-r1.ebuild b/dev-lang/ghc/ghc-8.10.6-r1.ebuild
new file mode 100644
index 000000000000..40a6e8f7868b
--- /dev/null
+++ b/dev-lang/ghc/ghc-8.10.6-r1.ebuild
@@ -0,0 +1,820 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+# to make make a crosscompiler use crossdev and symlink ghc tree into
+# cross overlay. result would look like 'cross-sparc-unknown-linux-gnu/ghc'
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} = ${CHOST} ]] ; then
+ if [[ ${CATEGORY/cross-} != ${CATEGORY} ]] ; then
+ export CTARGET=${CATEGORY/cross-}
+ fi
+fi
+
+PYTHON_COMPAT=( python3_{8..10} )
+inherit python-any-r1
+inherit autotools bash-completion-r1 flag-o-matic ghc-package
+inherit multilib multiprocessing pax-utils toolchain-funcs prefix
+inherit check-reqs
+DESCRIPTION="The Glasgow Haskell Compiler"
+HOMEPAGE="https://www.haskell.org/ghc/"
+
+# we don't have any binaries yet
+arch_binaries=""
+
+BIN_PV=${PV}
+# sorted!
+#arch_binaries="$arch_binaries alpha? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-alpha.tbz2 )"
+#arch_binaries="$arch_binaries arm? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-armv7a-hardfloat-linux-gnueabi.tbz2 )"
+#arch_binaries="$arch_binaries arm64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-aarch64-unknown-linux-gnu.tbz2 )"
+arch_binaries="$arch_binaries amd64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-x86_64-pc-linux-gnu.tbz2 )"
+#arch_binaries="$arch_binaries ia64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ia64-fixed-fiw.tbz2 )"
+#arch_binaries="$arch_binaries ppc? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ppc.tbz2 )"
+#arch_binaries="$arch_binaries ppc64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ppc64.tbz2 )"
+#arch_binaries="$arch_binaries ppc64? ( !big-endian? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-powerpc64le-unknown-linux-gnu.tbz2 ) )"
+#arch_binaries="$arch_binaries sparc? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-sparc.tbz2 )"
+arch_binaries="$arch_binaries x86? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-i686-pc-linux-gnu.tbz2 )"
+
+# various ports:
+#arch_binaries="$arch_binaries x86-fbsd? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-x86-fbsd.tbz2 )"
+
+# 0 - yet
+yet_binary() {
+ case "${ARCH}" in
+ #alpha) return 0 ;;
+ #arm64) return 0 ;;
+ #arm) return 0 ;;
+ amd64) return 0 ;;
+ #ia64) return 0 ;;
+ #ppc) return 0 ;;
+ #ppc64)
+ # use big-endian && return 0
+ # return 0
+ # ;;
+ #sparc) return 0 ;;
+ x86) return 0 ;;
+ *) return 1 ;;
+ esac
+}
+
+GHC_PV=${PV}
+#GHC_PV=8.10.0.20200123 # uncomment only for -alpha, -beta, -rc ebuilds
+GHC_P=${PN}-${GHC_PV} # using ${P} is almost never correct
+
+SRC_URI="!binary? (
+ https://downloads.haskell.org/ghc/${PV/_/-}/${GHC_P}-src.tar.xz
+ test? ( https://downloads.haskell.org/ghc/${PV/_/-}/${GHC_P}-testsuite.tar.xz )
+)"
+S="${WORKDIR}"/${GHC_P}
+
+[[ -n $arch_binaries ]] && SRC_URI+=" !ghcbootstrap? ( $arch_binaries )"
+
+BUMP_LIBRARIES=(
+ # "hackage-name hackage-version"
+)
+
+LICENSE="BSD"
+SLOT="0/${PV}"
+KEYWORDS="~amd64 ~x86"
+IUSE="big-endian +doc elfutils ghcbootstrap ghcmakebinary +gmp numa profile test"
+IUSE+=" binary"
+RESTRICT="!test? ( test )"
+
+RDEPEND="
+ >=dev-lang/perl-5.6.1
+ dev-libs/gmp:0=
+ sys-libs/ncurses:=[unicode(+)]
+ elfutils? ( dev-libs/elfutils )
+ !ghcmakebinary? ( dev-libs/libffi:= )
+ numa? ( sys-process/numactl )
+"
+
+# This set of dependencies is needed to run
+# prebuilt ghc. We specifically avoid ncurses
+# dependency with:
+# utils/ghc-pkg_HC_OPTS += -DBOOTSTRAPPING
+PREBUILT_BINARY_DEPENDS="
+ !prefix? ( elibc_glibc? ( >=sys-libs/glibc-2.17 ) )
+"
+# This set of dependencies is needed to install
+# ghc[binary] in system. terminfo package is linked
+# against ncurses.
+PREBUILT_BINARY_RDEPENDS="${PREBUILT_BINARY_DEPENDS}
+ sys-libs/ncurses:0/6
+"
+
+RDEPEND+="binary? ( ${PREBUILT_BINARY_RDEPENDS} )"
+
+DEPEND="${RDEPEND}"
+BDEPEND="
+ virtual/pkgconfig
+ doc? ( app-text/docbook-xml-dtd:4.2
+ app-text/docbook-xml-dtd:4.5
+ app-text/docbook-xsl-stylesheets
+ dev-python/sphinx
+ >=dev-libs/libxslt-1.1.2 )
+ !ghcbootstrap? ( ${PREBUILT_BINARY_DEPENDS} )
+ test? ( ${PYTHON_DEPS} )
+"
+
+needs_python() {
+ # test driver is written in python
+ use test && return 0
+ return 1
+}
+
+# we build binaries without profiling support
+REQUIRED_USE="
+ ?? ( ghcbootstrap binary )
+ ?? ( profile binary )
+"
+
+# haskell libraries built with cabal in configure mode, #515354
+QA_CONFIGURE_OPTIONS+=" --with-compiler --with-gcc"
+
+is_crosscompile() {
+ [[ ${CHOST} != ${CTARGET} ]]
+}
+
+is_native() {
+ [[ ${CHOST} == ${CBUILD} ]] && [[ ${CHOST} == ${CTARGET} ]]
+}
+
+if ! is_crosscompile; then
+ PDEPEND="!ghcbootstrap? ( >=app-admin/haskell-updater-1.2 )"
+fi
+
+# returns tool prefix for crosscompiler.
+# Example:
+# CTARGET=armv7a-unknown-linux-gnueabi
+# CHOST=x86_64-pc-linux-gnu
+# "armv7a-unknown-linux-gnueabi-"
+# CTARGET=${CHOST}
+# ""
+# Used in tools and library prefix:
+# "${ED}"/usr/bin/$(cross)haddock
+# "${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
+
+cross() {
+ if is_crosscompile; then
+ echo "${CTARGET}-"
+ else
+ echo ""
+ fi
+}
+
+append-ghc-cflags() {
+ local persistent compile assemble link
+ local flag ghcflag
+
+ for flag in $*; do
+ case ${flag} in
+ persistent) persistent="yes";;
+ compile) compile="yes";;
+ assemble) assemble="yes";;
+ link) link="yes";;
+ *)
+ [[ ${compile} ]] && ghcflag="-optc${flag}" CFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
+ [[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
+ [[ ${assemble} ]] && ghcflag="-opta${flag}" CFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
+ [[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
+ [[ ${link} ]] && ghcflag="-optl${flag}" LDFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
+ [[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
+ ;;
+ esac
+ done
+}
+
+# $1 - lib name (under libraries/)
+# $2 - lib version
+# example: bump_lib "transformers" "0.4.2.0"
+bump_lib() {
+ local pn=$1 pv=$2
+ local p=${pn}-${pv}
+ local f
+
+ einfo "Bumping ${pn} up to ${pv}"
+
+ for f in ghc.mk GNUmakefile; do
+ mv libraries/"${pn}"/$f "${WORKDIR}"/"${p}"/$f || die
+ done
+ mv libraries/"${pn}" "${WORKDIR}"/"${pn}".old || die
+ mv "${WORKDIR}"/"${p}" libraries/"${pn}" || die
+}
+
+update_SRC_URI() {
+ local p pn pv
+ for p in "${BUMP_LIBRARIES[@]}"; do
+ set -- $p
+ pn=$1 pv=$2
+
+ SRC_URI+=" https://hackage.haskell.org/package/${pn}-${pv}/${pn}-${pv}.tar.gz"
+ done
+}
+
+update_SRC_URI
+
+bump_libs() {
+ local p pn pv
+ for p in "${BUMP_LIBRARIES[@]}"; do
+ set -- $p
+ pn=$1 pv=$2
+
+ bump_lib "${pn}" "${pv}"
+ done
+}
+
+ghc_setup_cflags() {
+ # TODO: plumb CFLAGS and BUILD_CFLAGS to respective CONF_CC_OPTS_STAGE<N>
+ if ! is_native; then
+ export CFLAGS=${GHC_CFLAGS-"-O2 -pipe"}
+ export LDFLAGS=${GHC_LDFLAGS-"-Wl,-O1"}
+ einfo "Crosscompiling mode:"
+ einfo " CHOST: ${CHOST}"
+ einfo " CTARGET: ${CTARGET}"
+ einfo " CFLAGS: ${CFLAGS}"
+ einfo " LDFLAGS: ${LDFLAGS}"
+ einfo " prefix: $(cross)"
+ return
+ fi
+ # We need to be very careful with the CFLAGS we ask ghc to pass through to
+ # gcc. There are plenty of flags which will make gcc produce output that
+ # breaks ghc in various ways. The main ones we want to pass through are
+ # -mcpu / -march flags. These are important for arches like alpha & sparc.
+ # We also use these CFLAGS for building the C parts of ghc, ie the rts.
+ strip-flags
+ strip-unsupported-flags
+
+ # Cmm can't parse line numbers #482086
+ replace-flags -ggdb[3-9] -ggdb2
+
+ GHC_FLAGS=""
+ GHC_PERSISTENT_FLAGS=""
+ for flag in ${CFLAGS}; do
+ case ${flag} in
+
+ # Ignore extra optimisation (ghc passes -O to gcc anyway)
+ # -O2 and above break on too many systems
+ -O*) ;;
+
+ # Arch and ABI flags are what we're really after
+ -m*) append-ghc-cflags compile assemble ${flag};;
+
+ # Sometimes it's handy to see backtrace of RTS
+ # to get an idea what happens there
+ -g*) append-ghc-cflags compile ${flag};;
+
+ # Ignore all other flags, including all -f* flags
+ esac
+ done
+
+ for flag in ${LDFLAGS}; do
+ append-ghc-cflags link ${flag}
+ done
+
+ # GHC uses ${CBUILD}-gcc, ${CHOST}-gcc and ${CTARGET}-gcc at a single build.
+ # Skip any gentoo-specific tweaks for cross-case to avoid passing unsupported
+ # options to gcc.
+ if is_native; then
+ # prevent from failing to build unregisterised ghc:
+ # https://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg171602.html
+ use ppc64 && append-ghc-cflags persistent compile -mminimal-toc
+ fi
+}
+
+# substitutes string $1 to $2 in files $3 $4 ...
+relocate_path() {
+ local from=$1
+ local to=$2
+ shift 2
+ local file=
+ for file in "$@"
+ do
+ sed -i -e "s|$from|$to|g" \
+ "$file" || die "path relocation failed for '$file'"
+ done
+}
+
+# changes hardcoded ghc paths and updates package index
+# $1 - new absolute root path
+relocate_ghc() {
+ local to=$1 ghc_v=${BIN_PV}
+
+ # libdir for prebuilt binary and for current system may mismatch
+ # It does for prefix installation for example: bug #476998
+ local bin_ghc_prefix=${WORKDIR}/usr
+ local bin_libpath=$(echo "${bin_ghc_prefix}"/lib*)
+ local bin_libdir=${bin_libpath#${bin_ghc_prefix}/}
+
+ # backup original script to use it later after relocation
+ local gp_back="${T}/ghc-pkg-${ghc_v}-orig"
+ cp "${WORKDIR}/usr/bin/ghc-pkg-${ghc_v}" "$gp_back" || die "unable to backup ghc-pkg wrapper"
+
+ if [[ ${bin_libdir} != $(get_libdir) ]]; then
+ einfo "Relocating '${bin_libdir}' to '$(get_libdir)' (bug #476998)"
+ # moving the dir itself is not strictly needed
+ # but then USE=binary would result in installing
+ # in '${bin_libdir}'
+ mv "${bin_ghc_prefix}/${bin_libdir}" "${bin_ghc_prefix}/$(get_libdir)" || die
+
+ relocate_path "/usr/${bin_libdir}" "/usr/$(get_libdir)" \
+ "${WORKDIR}/usr/bin/ghc-${ghc_v}" \
+ "${WORKDIR}/usr/bin/ghci-${ghc_v}" \
+ "${WORKDIR}/usr/bin/ghc-pkg-${ghc_v}" \
+ "${WORKDIR}/usr/bin/hsc2hs" \
+ "${WORKDIR}/usr/bin/runghc-${ghc_v}" \
+ "$gp_back" \
+ "${WORKDIR}/usr/$(get_libdir)/${PN}-${ghc_v}/package.conf.d/"*
+ fi
+
+ # Relocate from /usr to ${EPREFIX}/usr
+ relocate_path "/usr" "${to}/usr" \
+ "${WORKDIR}/usr/bin/ghc-${ghc_v}" \
+ "${WORKDIR}/usr/bin/ghci-${ghc_v}" \
+ "${WORKDIR}/usr/bin/ghc-pkg-${ghc_v}" \
+ "${WORKDIR}/usr/bin/haddock-ghc-${ghc_v}" \
+ "${WORKDIR}/usr/bin/hp2ps" \
+ "${WORKDIR}/usr/bin/hpc" \
+ "${WORKDIR}/usr/bin/hsc2hs" \
+ "${WORKDIR}/usr/bin/runghc-${ghc_v}" \
+ "${WORKDIR}/usr/$(get_libdir)/${PN}-${ghc_v}/package.conf.d/"*
+
+ # this one we will use to regenerate cache
+ # so it should point to current tree location
+ relocate_path "/usr" "${WORKDIR}/usr" "$gp_back"
+
+ if use prefix; then
+ hprefixify "${bin_libpath}"/${PN}*/settings
+ fi
+
+ # regenerate the binary package cache
+ "$gp_back" recache || die "failed to update cache after relocation"
+ rm "$gp_back"
+}
+
+ghc-check-reqs() {
+ # These are pessimistic values (slightly bigger than worst-case)
+ # Worst case is UNREG USE=profile ia64. See bug #611866 for some
+ # numbers on various arches.
+ CHECKREQS_DISK_BUILD=8G
+ CHECKREQS_DISK_USR=2G
+ # USE=binary roughly takes
+ use binary && CHECKREQS_DISK_BUILD=4G
+
+ "$@"
+}
+
+pkg_pretend() {
+ ghc-check-reqs check-reqs_pkg_pretend
+}
+
+pkg_setup() {
+ ghc-check-reqs check-reqs_pkg_setup
+
+ # quiet portage about prebuilt binaries
+ use binary && QA_PREBUILT="*"
+
+ [[ ${MERGE_TYPE} == binary ]] && return
+
+ if use ghcbootstrap; then
+ ewarn "You requested ghc bootstrapping, this is usually only used"
+ ewarn "by Gentoo developers to make binary .tbz2 packages."
+
+ [[ -z $(type -P ghc) ]] && \
+ die "Could not find a ghc to bootstrap with."
+ else
+ if ! yet_binary; then
+ eerror "Please try emerging with USE=ghcbootstrap and report build"
+ eerror "sucess or failure to the haskell team (haskell@gentoo.org)"
+ die "No binary available for '${ARCH}' arch yet, USE=ghcbootstrap"
+ fi
+ fi
+
+ if needs_python; then
+ python-any-r1_pkg_setup
+ fi
+}
+
+src_unpack() {
+ # Create the ${S} dir if we're using the binary version
+ use binary && mkdir "${S}"
+
+ # the Solaris and Darwin binaries from ghc (maeder) need to be
+ # unpacked separately, so prevent them from being unpacked
+ local ONLYA=${A}
+ case ${CHOST} in
+ *-darwin* | *-solaris*) ONLYA=${GHC_P}-src.tar.xz ;;
+ esac
+ unpack ${ONLYA}
+}
+
+src_prepare() {
+ # Force the use of C.utf8 locale
+ # <https://github.com/gentoo-haskell/gentoo-haskell/issues/1287>
+ # <https://github.com/gentoo-haskell/gentoo-haskell/issues/1289>
+ export LC_ALL=C.utf8
+
+ ghc_setup_cflags
+
+ if ! use ghcbootstrap && [[ ${CHOST} != *-darwin* && ${CHOST} != *-solaris* ]]; then
+ # Modify the wrapper script from the binary tarball to use GHC_PERSISTENT_FLAGS.
+ # See bug #313635.
+ sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_PERSISTENT_FLAGS}|" \
+ "${WORKDIR}/usr/bin/ghc-${BIN_PV}"
+
+ # allow hardened users use vanilla binary to bootstrap ghc
+ # ghci uses mmap with rwx protection at it implements dynamic
+ # linking on it's own (bug #299709)
+ pax-mark -m "${WORKDIR}/usr/$(get_libdir)/${PN}-${BIN_PV}/bin/ghc"
+ fi
+
+ if use binary; then
+ if use prefix; then
+ relocate_ghc "${EPREFIX}"
+ fi
+
+ # Move unpacked files to the expected place
+ mv "${WORKDIR}/usr" "${S}"
+ eapply_user
+ else
+ if ! use ghcbootstrap; then
+ case ${CHOST} in
+ *-darwin* | *-solaris*)
+ # UPDATE ME for ghc-7
+ mkdir "${WORKDIR}"/ghc-bin-installer || die
+ pushd "${WORKDIR}"/ghc-bin-installer > /dev/null || die
+ use sparc-solaris && unpack ghc-6.10.4-sparc-sun-solaris2.tar.bz2
+ use x86-solaris && unpack ghc-7.0.3-i386-unknown-solaris2.tar.bz2
+ use x86-macos && unpack ghc-7.4.1-i386-apple-darwin.tar.bz2
+ use x64-macos && unpack ghc-7.4.1-x86_64-apple-darwin.tar.bz2
+ popd > /dev/null
+
+ pushd "${WORKDIR}"/ghc-bin-installer/ghc-[67].?*.? > /dev/null || die
+ # fix the binaries so they run, on Solaris we need an
+ # LD_LIBRARY_PATH which has our prefix libdirs, on
+ # Darwin we need to replace the frameworks with our libs
+ # from the prefix fix before installation, because some
+ # of the tools are actually used during configure/make
+ if [[ ${CHOST} == *-solaris* ]] ; then
+ export LD_LIBRARY_PATH="${EPREFIX}/$(get_libdir):${EPREFIX}/usr/$(get_libdir):${LD_LIBRARY_PATH}"
+ elif [[ ${CHOST} == *-darwin* ]] ; then
+ local readline_framework=GNUreadline.framework/GNUreadline
+ local gmp_framework=/opt/local/lib/libgmp.10.dylib
+ local ncurses_file=/opt/local/lib/libncurses.5.dylib
+ for binary in $(scanmacho -BRE MH_EXECUTE -F '%F' .) ; do
+ install_name_tool -change \
+ ${readline_framework} \
+ "${EPREFIX}"/lib/libreadline.dylib \
+ ${binary} || die
+ install_name_tool -change \
+ ${gmp_framework} \
+ "${EPREFIX}"/usr/lib/libgmp.dylib \
+ ${binary} || die
+ install_name_tool -change \
+ ${ncurses_file} \
+ "${EPREFIX}"/usr/lib/libncurses.dylib \
+ ${binary} || die
+ done
+ # we don't do frameworks!
+ sed -i \
+ -e 's/\(frameworks = \)\["GMP"\]/\1[]/g' \
+ -e 's/\(extraLibraries = \)\["m"\]/\1["m","gmp"]/g' \
+ rts/package.conf.in || die
+ fi
+
+ # it is autoconf, but we really don't want to give it too
+ # many arguments, in fact we do the make in-place anyway
+ ./configure --prefix="${WORKDIR}"/usr || die
+ make install || die
+ popd > /dev/null
+ ;;
+ *)
+ relocate_ghc "${WORKDIR}"
+ ;;
+ esac
+ fi
+
+ sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_PERSISTENT_FLAGS}|" \
+ "${S}/ghc/ghc.wrapper"
+
+ cd "${S}" # otherwise eapply will break
+
+ eapply "${FILESDIR}"/${PN}-7.0.4-CHOST-prefix.patch
+ eapply "${FILESDIR}"/${PN}-8.2.1-darwin.patch
+ eapply "${FILESDIR}"/${PN}-7.8.3-prim-lm.patch
+ eapply "${FILESDIR}"/${PN}-8.8.1-revert-CPP.patch
+ eapply "${FILESDIR}"/${PN}-8.10.1-allow-cross-bootstrap.patch
+ eapply "${FILESDIR}"/${PN}-8.10.5-modorigin-verbose-conflict.patch
+ eapply "${FILESDIR}"/${PN}-8.10.6-aclocal.patch
+
+ # a bunch of crosscompiler patches
+ # needs newer version:
+ #eapply "${FILESDIR}"/${PN}-8.2.1_rc1-hp2ps-cross.patch
+
+ # mingw32 target
+ pushd "${S}/libraries/Win32"
+ eapply "${FILESDIR}"/${PN}-8.2.1_rc1-win32-cross-2-hack.patch # bad workaround
+ popd
+
+ bump_libs
+
+ eapply_user
+ # as we have changed the build system
+ eautoreconf
+ fi
+}
+
+src_configure() {
+ if ! use binary; then
+ # initialize build.mk
+ echo '# Gentoo changes' > mk/build.mk
+
+ # Put docs into the right place, ie /usr/share/doc/ghc-${GHC_PV}
+ echo "docdir = ${EPREFIX}/usr/share/doc/$(cross)${PF}" >> mk/build.mk
+ echo "htmldir = ${EPREFIX}/usr/share/doc/$(cross)${PF}" >> mk/build.mk
+
+ # We also need to use the GHC_FLAGS flags when building ghc itself
+ echo "SRC_HC_OPTS+=${HCFLAGS} ${GHC_FLAGS}" >> mk/build.mk
+ echo "SRC_CC_OPTS+=${CFLAGS}" >> mk/build.mk
+ echo "SRC_LD_OPTS+=${LDFLAGS}" >> mk/build.mk
+ # Speed up initial Cabal bootstrap
+ echo "utils/ghc-cabal_dist_EXTRA_HC_OPTS+=$(ghc-make-args)" >> mk/build.mk
+
+ # We can't depend on haddock except when bootstrapping when we
+ # must build docs and include them into the binary .tbz2 package
+ # app-text/dblatex is not in portage, can not build PDF or PS
+ echo "BUILD_SPHINX_PDF = NO" >> mk/build.mk
+ echo "BUILD_SPHINX_HTML = $(usex doc YES NO)" >> mk/build.mk
+ echo "BUILD_MAN = $(usex doc YES NO)" >> mk/build.mk
+
+ # this controls presence on 'xhtml' and 'haddock' in final install
+ echo "HADDOCK_DOCS = YES" >> mk/build.mk
+
+ # not used outside of ghc's test
+ if [[ -n ${GHC_BUILD_DPH} ]]; then
+ echo "BUILD_DPH = YES" >> mk/build.mk
+ else
+ echo "BUILD_DPH = NO" >> mk/build.mk
+ fi
+
+ # Any non-native build has to skip as it needs
+ # target haddock binary to be runnabine.
+ if ! is_native; then
+ # disable docs generation as it requires running stage2
+ echo "HADDOCK_DOCS=NO" >> mk/build.mk
+ echo "BUILD_SPHINX_HTML=NO" >> mk/build.mk
+ echo "BUILD_SPHINX_PDF=NO" >> mk/build.mk
+ fi
+
+ if is_crosscompile; then
+ # Install ghc-stage1 crosscompiler instead of
+ # ghc-stage2 cross-built compiler.
+ echo "Stage1Only=YES" >> mk/build.mk
+ fi
+
+ # allows overriding build flavours for libraries:
+ # v - vanilla (static libs)
+ # p - profiled
+ # dyn - shared libraries
+ # example: GHC_LIBRARY_WAYS="v dyn"
+ if [[ -n ${GHC_LIBRARY_WAYS} ]]; then
+ echo "GhcLibWays=${GHC_LIBRARY_WAYS}" >> mk/build.mk
+ fi
+ echo "BUILD_PROF_LIBS = $(usex profile YES NO)" >> mk/build.mk
+
+ # Get ghc from the unpacked binary .tbz2
+ # except when bootstrapping we just pick ghc up off the path
+ if ! use ghcbootstrap; then
+ export PATH="${WORKDIR}/usr/bin:${PATH}"
+ fi
+
+ echo "INTEGER_LIBRARY = $(usex gmp integer-gmp integer-simple)" >> mk/build.mk
+
+ # don't strip anything. Very useful when stage2 SIGSEGVs on you
+ echo "STRIP_CMD = :" >> mk/build.mk
+
+ local econf_args=()
+
+ # GHC embeds toolchain it was built by and uses it later.
+ # Don't allow things like ccache or versioned binary slip.
+ # We use stable thing across gcc upgrades.
+ # User can use EXTRA_ECONF=CC=... to override this default.
+ econf_args+=(
+ AR=${CTARGET}-ar
+ CC=${CTARGET}-gcc
+ # these should be inferred by GHC but ghc defaults
+ # to using bundled tools on windows.
+ Windres=${CTARGET}-windres
+ DllWrap=${CTARGET}-dllwrap
+ # we set the linker explicitly below
+ --disable-ld-override
+ )
+ case ${CTARGET} in
+ arm*)
+ # ld.bfd-2.28 does not work for ghc. Force ld.gold
+ # instead. This should be removed once gentoo gets
+ # a fix for R_ARM_COPY bug: https://sourceware.org/PR16177
+ econf_args+=(LD=${CTARGET}-ld.gold)
+ ;;
+ sparc*)
+ # ld.gold-2.28 does not work for ghc. Force ld.bfd
+ # instead. This should be removed once gentoo gets
+ # a fix for missing --no-relax support bug:
+ # https://sourceware.org/ml/binutils/2017-07/msg00183.html
+ econf_args+=(LD=${CTARGET}-ld.bfd)
+ ;;
+ *)
+ econf_args+=(LD=${CTARGET}-ld)
+ esac
+
+ if [[ ${CBUILD} != ${CHOST} ]]; then
+ # GHC bug: ghc claims not to support cross-building.
+ # It does, but does not distinct --host= value
+ # for stage1 and stage2 compiler.
+ econf_args+=(--host=${CBUILD})
+ fi
+
+ if use ghcmakebinary; then
+ # When building booting libary we are trying to
+ # bundle or restrict most of external depends
+ # with unstable ABI:
+ # - embed libffi (default GHC behaviour)
+ # - disable ncurses support for ghci (via haskeline)
+ # https://bugs.gentoo.org/557478
+ # - disable ncurses support for ghc-pkg
+ echo "libraries/haskeline_CONFIGURE_OPTS += --flag=-terminfo" >> mk/build.mk
+ echo "utils/ghc-pkg_HC_OPTS += -DBOOTSTRAPPING" >> mk/build.mk
+ elif is_native; then
+ # using ${GTARGET}'s libffi is not supported yet:
+ # GHC embeds full path for ffi includes without /usr/${CTARGET} account.
+ econf_args+=(--with-system-libffi)
+ econf_args+=(--with-ffi-includes=$($(tc-getPKG_CONFIG) libffi --cflags-only-I | sed -e 's@^-I@@'))
+ fi
+
+ einfo "Final mk/build.mk:"
+ cat mk/build.mk || die
+
+ econf ${econf_args[@]} \
+ --enable-bootstrap-with-devel-snapshot \
+ $(use_enable elfutils dwarf-unwind) \
+ $(use_enable numa)
+
+ if [[ ${PV} == *9999* ]]; then
+ GHC_PV="$(grep 'S\[\"PACKAGE_VERSION\"\]' config.status | sed -e 's@^.*=\"\(.*\)\"@\1@')"
+ GHC_P=${PN}-${GHC_PV}
+ fi
+ fi # ! use binary
+}
+
+src_compile() {
+ if ! use binary; then
+ # Stage1Only crosscompiler does not build stage2
+ if ! is_crosscompile; then
+ # 1. build/pax-mark compiler binary first
+ emake ghc/stage2/build/tmp/ghc-stage2
+ # 2. pax-mark (bug #516430)
+ pax-mark -m ghc/stage2/build/tmp/ghc-stage2
+ # 2. build/pax-mark haddock using ghc-stage2
+ if is_native; then
+ # non-native build does not build haddock
+ # due to HADDOCK_DOCS=NO, but it could.
+ emake utils/haddock/dist/build/tmp/haddock
+ pax-mark -m utils/haddock/dist/build/tmp/haddock
+ fi
+ fi
+ # 3. and then all the rest
+ emake all
+ fi # ! use binary
+}
+
+src_test() {
+ # TODO: deal with:
+ # - sandbox (pollutes environment)
+ # - extra packages (to extend testsuite coverage)
+ # bits are taken from 'validate'
+ local make_test_target='test' # can be fulltest
+ # not 'emake' as testsuite uses '$MAKE' without jobserver available
+ make $make_test_target stage=2 THREADS=$(makeopts_jobs)
+}
+
+src_install() {
+ if use binary; then
+ use prefix && mkdir -p "${ED}"
+ mv "${S}/usr" "${ED}"
+ else
+ [[ -f VERSION ]] || emake VERSION
+
+ # -j1 due to a rare race in install script:
+ # make --no-print-directory -f ghc.mk phase=final install
+ # /usr/lib/portage/python3.4/ebuild-helpers/xattr/install -c -m 755 \
+ # -d "/tmp/portage-tmpdir/portage/cross-armv7a-unknown-linux-gnueabi/ghc-9999/image/usr/lib64/armv7a-unknown-linux-gnueabi-ghc-8.3.20170404/include"
+ # /usr/lib/portage/python3.4/ebuild-helpers/xattr/install -c -m 644 utils/hsc2hs/template-hsc.h \
+ # "/tmp/portage-tmpdir/portage/cross-armv7a-unknown-linux-gnueabi/ghc-9999/image/usr/lib64/armv7a-unknown-linux-gnueabi-ghc-8.3.20170404"
+ # /usr/bin/install: cannot create regular file \
+ # '/tmp/portage-tmpdir/portage/cross-armv7a-unknown-linux-gnueabi/ghc-9999/image/usr/lib64/armv7a-unknown-linux-gnueabi-ghc-8.3.20170404': No such file or directory
+ emake -j1 install DESTDIR="${D}"
+
+ # Skip for cross-targets as they all share target location:
+ # /usr/share/doc/ghc-9999/
+ if ! is_crosscompile; then
+ dodoc "distrib/README" "LICENSE" "VERSION"
+ fi
+
+ # rename ghc-shipped files to avoid collision
+ # of external packages. Motivating example:
+ # user had installed:
+ # dev-lang/ghc-7.8.4-r0 (with transformers-0.3.0.0)
+ # dev-haskell/transformers-0.4.2.0
+ # then user tried to update to
+ # dev-lang/ghc-7.8.4-r1 (with transformers-0.4.2.0)
+ # this will lead to single .conf file collision.
+ local shipped_conf renamed_conf
+ local package_confdir="${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
+ for shipped_conf in "${package_confdir}"/*.conf; do
+ # rename 'pkg-ver-id.conf' to 'pkg-ver-id-gentoo-${PF}.conf'
+ renamed_conf=${shipped_conf%.conf}-gentoo-${PF}.conf
+ mv "${shipped_conf}" "${renamed_conf}" || die
+ done
+
+ # remove link, but leave 'haddock-${GHC_P}'
+ rm -f "${ED}"/usr/bin/$(cross)haddock
+
+ if ! is_crosscompile; then
+ newbashcomp "${FILESDIR}"/ghc-bash-completion ghc-pkg
+ newbashcomp utils/completion/ghc.bash ghc
+ fi
+ fi
+
+ # path to the package.cache
+ local package_confdir="${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
+ PKGCACHE="${package_confdir}"/package.cache
+ # copy the package.conf.d, including timestamp, save it so we can help
+ # users that have a broken package.conf.d
+ cp -pR "${package_confdir}"{,.initial} || die "failed to backup intial package.conf.d"
+
+ # copy the package.conf, including timestamp, save it so we later can put it
+ # back before uninstalling, or when upgrading.
+ cp -p "${PKGCACHE}"{,.shipped} \
+ || die "failed to copy package.conf.d/package.cache"
+
+ if is_crosscompile; then
+ # When we build a cross-compiler the layout is the following:
+ # usr/lib/${CTARGET}-ghc-${VER}/ contains target libraries
+ # but
+ # usr/lib/${CTARGET}-ghc-${VER}/bin/ directory
+ # containst host binaries (modulo bugs).
+
+ # Portage's stripping mechanism does not skip stripping
+ # foreign binaries. This frequently causes binaries to be
+ # broken.
+ #
+ # Thus below we disable stripping of target libraries and allow
+ # stripping hosts executables.
+ dostrip -x "/usr/$(get_libdir)/$(cross)${GHC_P}"
+ dostrip "/usr/$(get_libdir)/$(cross)${GHC_P}/bin"
+ fi
+}
+
+pkg_preinst() {
+ # have we got an earlier version of ghc installed?
+ if has_version "<${CATEGORY}/${PF}"; then
+ haskell_updater_warn="1"
+ fi
+}
+
+pkg_postinst() {
+ ghc-reregister
+
+ # path to the package.cache
+ PKGCACHE="${EROOT}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d/package.cache"
+
+ # give the cache a new timestamp, it must be as recent as
+ # the package.conf.d directory.
+ touch "${PKGCACHE}"
+
+ if [[ "${haskell_updater_warn}" == "1" ]]; then
+ ewarn
+ ewarn "\e[1;31m************************************************************************\e[0m"
+ ewarn
+ ewarn "You have just upgraded from an older version of GHC."
+ ewarn "You may have to run"
+ ewarn " 'haskell-updater'"
+ ewarn "to rebuild all ghc-based Haskell libraries."
+ ewarn
+ ewarn "\e[1;31m************************************************************************\e[0m"
+ ewarn
+ fi
+}
+
+pkg_prerm() {
+ PKGCACHE="${EROOT}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d/package.cache"
+ rm -rf "${PKGCACHE}"
+
+ cp -p "${PKGCACHE}"{.shipped,}
+}
+
+pkg_postrm() {
+ ghc-package_pkg_postrm
+}
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: dev-lang/ghc/files/, dev-lang/ghc/
@ 2022-11-25 21:57 Sam James
0 siblings, 0 replies; 9+ messages in thread
From: Sam James @ 2022-11-25 21:57 UTC (permalink / raw
To: gentoo-commits
commit: 8c04cb3ed60ea4977b2c38cf10fe0bae347095b4
Author: Jack Todaro <solpeth <AT> posteo <DOT> org>
AuthorDate: Fri Nov 25 19:47:18 2022 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Nov 25 21:56:34 2022 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8c04cb3e
dev-lang/ghc: sync from ::haskell (clang-16 workaround)
Signed-off-by: Jack Todaro <solpeth <AT> posteo.org>
Signed-off-by: Sam James <sam <AT> gentoo.org>
dev-lang/ghc/files/ghc-9.0.2-fptools.patch | 26 +
dev-lang/ghc/ghc-9.0.2-r2.ebuild | 854 +++++++++++++++++++++++++++++
2 files changed, 880 insertions(+)
diff --git a/dev-lang/ghc/files/ghc-9.0.2-fptools.patch b/dev-lang/ghc/files/ghc-9.0.2-fptools.patch
new file mode 100644
index 000000000000..8b00517386dd
--- /dev/null
+++ b/dev-lang/ghc/files/ghc-9.0.2-fptools.patch
@@ -0,0 +1,26 @@
+diff --git a/m4/fptools.m4 b/m4/fptools.m4
+index 8c6c9b7..a5db447 100644
+--- a/m4/fptools.m4
++++ b/m4/fptools.m4
+@@ -976,17 +976,15 @@ struct nlist xYzzY1[] = {{"xYzzY1", 0},{0}};
+ struct nlist xYzzY2[] = {{"_xYzzY2", 0},{0}};
+ #endif
+
+-int main(argc, argv)
+-int argc;
+-char **argv;
++int main(int argc, char **argv)
+ {
+ #if defined(HAVE_NLIST_H)
+ if(nlist(argv[0], xYzzY1) == 0 && xYzzY1[0].n_value != 0)
+- exit(1);
++ return 1;
+ if(nlist(argv[0], xYzzY2) == 0 && xYzzY2[0].n_value != 0)
+- exit(0);
++ return 0;
+ #endif
+- exit(1);
++ return 1;
+ }]])],[fptools_cv_leading_underscore=yes],[fptools_cv_leading_underscore=no],[fptools_cv_leading_underscore=no])
+ ;;
+ esac]);
diff --git a/dev-lang/ghc/ghc-9.0.2-r2.ebuild b/dev-lang/ghc/ghc-9.0.2-r2.ebuild
new file mode 100644
index 000000000000..363423eb235e
--- /dev/null
+++ b/dev-lang/ghc/ghc-9.0.2-r2.ebuild
@@ -0,0 +1,854 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+# to make make a crosscompiler use crossdev and symlink ghc tree into
+# cross overlay. result would look like 'cross-sparc-unknown-linux-gnu/ghc'
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} = ${CHOST} ]] ; then
+ if [[ ${CATEGORY/cross-} != ${CATEGORY} ]] ; then
+ export CTARGET=${CATEGORY/cross-}
+ fi
+fi
+
+PYTHON_COMPAT=( python3_{8..10} )
+inherit python-any-r1
+inherit autotools bash-completion-r1 flag-o-matic ghc-package
+inherit multiprocessing pax-utils toolchain-funcs prefix
+inherit check-reqs llvm
+DESCRIPTION="The Glasgow Haskell Compiler"
+HOMEPAGE="https://www.haskell.org/ghc/"
+
+# we don't have any binaries yet
+arch_binaries=""
+
+BIN_PV=${PV}
+# sorted!
+#arch_binaries="$arch_binaries alpha? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-alpha.tbz2 )"
+#arch_binaries="$arch_binaries arm? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-armv7a-hardfloat-linux-gnueabi.tbz2 )"
+arch_binaries="$arch_binaries arm64? ( https://github.com/matoro/ghc/releases/download/${PV}/ghc-bin-${PV}-aarch64-unknown-linux-gnu.tar.gz )"
+arch_binaries="$arch_binaries amd64? ( https://eidetic.codes/ghc-bin-${PV}-x86_64-pc-linux-gnu-r1.tbz2 )"
+#arch_binaries="$arch_binaries ia64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ia64-fixed-fiw.tbz2 )"
+#arch_binaries="$arch_binaries ppc? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ppc.tbz2 )"
+arch_binaries="$arch_binaries ppc64? (
+ big-endian? ( https://github.com/matoro/ghc/releases/download/${PV}/ghc-bin-${PV}-powerpc64-unknown-linux-gnu.tar.gz )
+ !big-endian? ( https://github.com/matoro/ghc/releases/download/${PV}/ghc-bin-${PV}-powerpc64le-unknown-linux-gnu.tar.gz )
+)"
+arch_binaries="$arch_binaries riscv? ( https://github.com/matoro/ghc/releases/download/${PV}/ghc-bin-${PV}-riscv64-unknown-linux-gnu.tar.gz )"
+#arch_binaries="$arch_binaries sparc? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-sparc.tbz2 )"
+arch_binaries="$arch_binaries x86? ( https://eidetic.codes/ghc-bin-${PV}-i686-pc-linux-gnu.tbz2 )"
+
+# various ports:
+#arch_binaries="$arch_binaries x86-fbsd? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-x86-fbsd.tbz2 )"
+
+# 0 - yet
+yet_binary() {
+ case "${ARCH}" in
+ #alpha) return 0 ;;
+ arm64) return 0 ;;
+ #arm) return 0 ;;
+ amd64) return 0 ;;
+ #ia64) return 0 ;;
+ #ppc) return 0 ;;
+ ppc64) return 0 ;;
+ riscv) return 0 ;;
+ #sparc) return 0 ;;
+ x86) return 0 ;;
+ *) return 1 ;;
+ esac
+}
+
+GHC_PV=${PV}
+#GHC_PV=8.10.0.20200123 # uncomment only for -alpha, -beta, -rc ebuilds
+GHC_P=${PN}-${GHC_PV} # using ${P} is almost never correct
+
+SRC_URI="!binary? (
+ https://downloads.haskell.org/ghc/${PV/_/-}/${GHC_P}-src.tar.xz
+ test? ( https://downloads.haskell.org/ghc/${PV/_/-}/${GHC_P}-testsuite.tar.xz )
+)"
+SRC_URI+=" https://dev.gentoo.org/~sam/distfiles/${CATEGORY}/${PN}/${P}-riscv64-llvm.patch.xz"
+
+S="${WORKDIR}"/${GHC_P}
+
+[[ -n $arch_binaries ]] && SRC_URI+=" !ghcbootstrap? ( $arch_binaries )"
+
+BUMP_LIBRARIES=(
+ # "hackage-name hackage-version"
+)
+
+LICENSE="BSD"
+SLOT="0/${PV}"
+KEYWORDS="~amd64 ~arm64 ~ppc64 ~riscv ~x86"
+IUSE="big-endian +doc elfutils ghcbootstrap ghcmakebinary +gmp llvm numa profile test unregisterised"
+IUSE+=" binary"
+RESTRICT="!test? ( test )"
+
+LLVM_MAX_SLOT="13"
+RDEPEND="
+ >=dev-lang/perl-5.6.1
+ dev-libs/gmp:0=
+ sys-libs/ncurses:=[unicode(+)]
+ elfutils? ( dev-libs/elfutils )
+ !ghcmakebinary? ( dev-libs/libffi:= )
+ numa? ( sys-process/numactl )
+ llvm? (
+ <sys-devel/llvm-$((${LLVM_MAX_SLOT} + 1)):=
+ || (
+ sys-devel/llvm:13
+ )
+ )
+"
+
+# This set of dependencies is needed to run
+# prebuilt ghc. We specifically avoid ncurses
+# dependency with:
+# utils/ghc-pkg_HC_OPTS += -DBOOTSTRAPPING
+PREBUILT_BINARY_DEPENDS="
+ !prefix? ( elibc_glibc? ( >=sys-libs/glibc-2.17 ) )
+"
+# This set of dependencies is needed to install
+# ghc[binary] in system. terminfo package is linked
+# against ncurses.
+PREBUILT_BINARY_RDEPENDS="${PREBUILT_BINARY_DEPENDS}
+ sys-libs/ncurses:0/6
+"
+
+RDEPEND+="binary? ( ${PREBUILT_BINARY_RDEPENDS} )"
+
+DEPEND="${RDEPEND}"
+BDEPEND="
+ virtual/pkgconfig
+ doc? ( app-text/docbook-xml-dtd:4.2
+ app-text/docbook-xml-dtd:4.5
+ app-text/docbook-xsl-stylesheets
+ dev-python/sphinx
+ >=dev-libs/libxslt-1.1.2 )
+ !ghcbootstrap? ( ${PREBUILT_BINARY_DEPENDS} )
+ test? ( ${PYTHON_DEPS} )
+"
+
+needs_python() {
+ # test driver is written in python
+ use test && return 0
+ return 1
+}
+
+# we build binaries without profiling support
+REQUIRED_USE="
+ ?? ( ghcbootstrap binary )
+ ?? ( profile binary )
+ ?? ( llvm unregisterised )
+"
+
+# haskell libraries built with cabal in configure mode, #515354
+QA_CONFIGURE_OPTIONS+=" --with-compiler --with-gcc"
+
+is_crosscompile() {
+ [[ ${CHOST} != ${CTARGET} ]]
+}
+
+is_native() {
+ [[ ${CHOST} == ${CBUILD} ]] && [[ ${CHOST} == ${CTARGET} ]]
+}
+
+if ! is_crosscompile; then
+ PDEPEND="!ghcbootstrap? ( >=app-admin/haskell-updater-1.2 )"
+fi
+
+# returns tool prefix for crosscompiler.
+# Example:
+# CTARGET=armv7a-unknown-linux-gnueabi
+# CHOST=x86_64-pc-linux-gnu
+# "armv7a-unknown-linux-gnueabi-"
+# CTARGET=${CHOST}
+# ""
+# Used in tools and library prefix:
+# "${ED}"/usr/bin/$(cross)haddock
+# "${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
+
+cross() {
+ if is_crosscompile; then
+ echo "${CTARGET}-"
+ else
+ echo ""
+ fi
+}
+
+append-ghc-cflags() {
+ local persistent compile assemble link
+ local flag ghcflag
+
+ for flag in $*; do
+ case ${flag} in
+ persistent) persistent="yes";;
+ compile) compile="yes";;
+ assemble) assemble="yes";;
+ link) link="yes";;
+ *)
+ [[ ${compile} ]] && ghcflag="-optc${flag}" CFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
+ [[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
+ [[ ${assemble} ]] && ghcflag="-opta${flag}" CFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
+ [[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
+ [[ ${link} ]] && ghcflag="-optl${flag}" LDFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
+ [[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
+ ;;
+ esac
+ done
+}
+
+# $1 - lib name (under libraries/)
+# $2 - lib version
+# example: bump_lib "transformers" "0.4.2.0"
+bump_lib() {
+ local pn=$1 pv=$2
+ local p=${pn}-${pv}
+ local f
+
+ einfo "Bumping ${pn} up to ${pv}"
+
+ for f in ghc.mk GNUmakefile; do
+ mv libraries/"${pn}"/$f "${WORKDIR}"/"${p}"/$f || die
+ done
+ mv libraries/"${pn}" "${WORKDIR}"/"${pn}".old || die
+ mv "${WORKDIR}"/"${p}" libraries/"${pn}" || die
+}
+
+update_SRC_URI() {
+ local p pn pv
+ for p in "${BUMP_LIBRARIES[@]}"; do
+ set -- $p
+ pn=$1 pv=$2
+
+ SRC_URI+=" https://hackage.haskell.org/package/${pn}-${pv}/${pn}-${pv}.tar.gz"
+ done
+}
+
+update_SRC_URI
+
+bump_libs() {
+ local p pn pv
+ for p in "${BUMP_LIBRARIES[@]}"; do
+ set -- $p
+ pn=$1 pv=$2
+
+ bump_lib "${pn}" "${pv}"
+ done
+}
+
+ghc_setup_cflags() {
+ # TODO: plumb CFLAGS and BUILD_CFLAGS to respective CONF_CC_OPTS_STAGE<N>
+ if ! is_native; then
+ export CFLAGS=${GHC_CFLAGS-"-O2 -pipe"}
+ export LDFLAGS=${GHC_LDFLAGS-"-Wl,-O1"}
+ einfo "Crosscompiling mode:"
+ einfo " CHOST: ${CHOST}"
+ einfo " CTARGET: ${CTARGET}"
+ einfo " CFLAGS: ${CFLAGS}"
+ einfo " LDFLAGS: ${LDFLAGS}"
+ einfo " prefix: $(cross)"
+ return
+ fi
+ # We need to be very careful with the CFLAGS we ask ghc to pass through to
+ # gcc. There are plenty of flags which will make gcc produce output that
+ # breaks ghc in various ways. The main ones we want to pass through are
+ # -mcpu / -march flags. These are important for arches like alpha & sparc.
+ # We also use these CFLAGS for building the C parts of ghc, ie the rts.
+ strip-flags
+ strip-unsupported-flags
+
+ # Cmm can't parse line numbers #482086
+ replace-flags -ggdb[3-9] -ggdb2
+
+ GHC_FLAGS=""
+ GHC_PERSISTENT_FLAGS=""
+ for flag in ${CFLAGS}; do
+ case ${flag} in
+
+ # Ignore extra optimisation (ghc passes -O to gcc anyway)
+ # -O2 and above break on too many systems
+ -O*) ;;
+
+ # Arch and ABI flags are what we're really after
+ -m*) append-ghc-cflags compile assemble ${flag};;
+
+ # Sometimes it's handy to see backtrace of RTS
+ # to get an idea what happens there
+ -g*) append-ghc-cflags compile ${flag};;
+
+ # Ignore all other flags, including all -f* flags
+ esac
+ done
+
+ for flag in ${LDFLAGS}; do
+ append-ghc-cflags link ${flag}
+ done
+}
+
+# substitutes string $1 to $2 in files $3 $4 ...
+relocate_path() {
+ local from=$1
+ local to=$2
+ shift 2
+ local file=
+ for file in "$@"
+ do
+ sed -i -e "s|$from|$to|g" \
+ "$file" || die "path relocation failed for '$file'"
+ done
+}
+
+# changes hardcoded ghc paths and updates package index
+# $1 - new absolute root path
+relocate_ghc() {
+ local to=$1 ghc_v=${BIN_PV}
+
+ # libdir for prebuilt binary and for current system may mismatch
+ # It does for prefix installation for example: bug #476998
+ local bin_ghc_prefix=${WORKDIR}/usr
+ local bin_libpath=$(echo "${bin_ghc_prefix}"/lib*)
+ local bin_libdir=${bin_libpath#${bin_ghc_prefix}/}
+
+ # backup original script to use it later after relocation
+ local gp_back="${T}/ghc-pkg-${ghc_v}-orig"
+ cp "${WORKDIR}/usr/bin/ghc-pkg-${ghc_v}" "$gp_back" || die "unable to backup ghc-pkg wrapper"
+
+ if [[ ${bin_libdir} != $(get_libdir) ]]; then
+ einfo "Relocating '${bin_libdir}' to '$(get_libdir)' (bug #476998)"
+ # moving the dir itself is not strictly needed
+ # but then USE=binary would result in installing
+ # in '${bin_libdir}'
+ mv "${bin_ghc_prefix}/${bin_libdir}" "${bin_ghc_prefix}/$(get_libdir)" || die
+
+ relocate_path "/usr/${bin_libdir}" "/usr/$(get_libdir)" \
+ "${WORKDIR}/usr/bin/ghc-${ghc_v}" \
+ "${WORKDIR}/usr/bin/ghci-${ghc_v}" \
+ "${WORKDIR}/usr/bin/ghc-pkg-${ghc_v}" \
+ "${WORKDIR}/usr/bin/hsc2hs" \
+ "${WORKDIR}/usr/bin/runghc-${ghc_v}" \
+ "$gp_back" \
+ "${WORKDIR}/usr/$(get_libdir)/${PN}-${ghc_v}/package.conf.d/"*
+ fi
+
+ # Relocate from /usr to ${EPREFIX}/usr
+ relocate_path "/usr" "${to}/usr" \
+ "${WORKDIR}/usr/bin/ghc-${ghc_v}" \
+ "${WORKDIR}/usr/bin/ghci-${ghc_v}" \
+ "${WORKDIR}/usr/bin/ghc-pkg-${ghc_v}" \
+ "${WORKDIR}/usr/bin/haddock-ghc-${ghc_v}" \
+ "${WORKDIR}/usr/bin/hp2ps" \
+ "${WORKDIR}/usr/bin/hpc" \
+ "${WORKDIR}/usr/bin/hsc2hs" \
+ "${WORKDIR}/usr/bin/runghc-${ghc_v}" \
+ "${WORKDIR}/usr/$(get_libdir)/${PN}-${ghc_v}/package.conf.d/"*
+
+ # this one we will use to regenerate cache
+ # so it should point to current tree location
+ relocate_path "/usr" "${WORKDIR}/usr" "$gp_back"
+
+ if use prefix; then
+ hprefixify "${bin_libpath}"/${PN}*/settings
+ fi
+
+ # regenerate the binary package cache
+ "$gp_back" recache || die "failed to update cache after relocation"
+ rm "$gp_back"
+}
+
+ghc-check-reqs() {
+ # These are pessimistic values (slightly bigger than worst-case)
+ # Worst case is UNREG USE=profile ia64. See bug #611866 for some
+ # numbers on various arches.
+ CHECKREQS_DISK_BUILD=8G
+ CHECKREQS_DISK_USR=2G
+ # USE=binary roughly takes
+ use binary && CHECKREQS_DISK_BUILD=4G
+
+ "$@"
+}
+
+llvmize() {
+ [[ -z "${1}" ]] && return
+ ( find "${1}" -type f \
+ | file -if- \
+ | grep "text/x-shellscript" \
+ | awk -F: '{print $1}' \
+ | xargs sed -i "s#^exec #PATH=\"$(get_llvm_prefix "${LLVM_MAX_SLOT}")/bin:\${PATH}\" exec #") || die
+}
+
+pkg_pretend() {
+ ghc-check-reqs check-reqs_pkg_pretend
+}
+
+pkg_setup() {
+ ghc-check-reqs check-reqs_pkg_setup
+
+ # quiet portage about prebuilt binaries
+ use binary && QA_PREBUILT="*"
+
+ [[ ${MERGE_TYPE} == binary ]] && return
+
+ if use ghcbootstrap; then
+ ewarn "You requested ghc bootstrapping, this is usually only used"
+ ewarn "by Gentoo developers to make binary .tbz2 packages."
+
+ [[ -z $(type -P ghc) ]] && \
+ die "Could not find a ghc to bootstrap with."
+ else
+ if ! yet_binary; then
+ eerror "Please try emerging with USE=ghcbootstrap and report build"
+ eerror "sucess or failure to the haskell team (haskell@gentoo.org)"
+ die "No binary available for '${ARCH}' arch yet, USE=ghcbootstrap"
+ fi
+ fi
+
+ if needs_python; then
+ python-any-r1_pkg_setup
+ fi
+
+ use llvm && llvm_pkg_setup
+}
+
+src_unpack() {
+ # Create the ${S} dir if we're using the binary version
+ use binary && mkdir "${S}"
+
+ # the Solaris and Darwin binaries from ghc (maeder) need to be
+ # unpacked separately, so prevent them from being unpacked
+ local ONLYA=${A}
+ case ${CHOST} in
+ *-darwin* | *-solaris*) ONLYA=${GHC_P}-src.tar.xz ;;
+ esac
+ unpack ${ONLYA}
+}
+
+src_prepare() {
+ ghc_setup_cflags
+
+ # ghc-9.0.2 release anomaly
+ # https://www.mail-archive.com/search?l=ghc-devs@haskell.org&q=subject:%22Re%5C%3A+%5C%5BHaskell%5C%5D+%5C%5BANNOUNCE%5C%5D+GHC+9.0.2+released%22&o=newest&f=1
+ # https://src.fedoraproject.org/rpms/ghc9.0/blob/rawhide/f/ghc9.0.spec#_327
+ rm -rf "libraries/containers/containers/dist-install" || die
+
+ if ! use ghcbootstrap && [[ ${CHOST} != *-darwin* && ${CHOST} != *-solaris* ]]; then
+ # Modify the wrapper script from the binary tarball to use GHC_PERSISTENT_FLAGS.
+ # See bug #313635.
+ sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_PERSISTENT_FLAGS}|" \
+ "${WORKDIR}/usr/bin/ghc-${BIN_PV}"
+
+ # allow hardened users use vanilla binary to bootstrap ghc
+ # ghci uses mmap with rwx protection at it implements dynamic
+ # linking on it's own (bug #299709)
+ pax-mark -m "${WORKDIR}/usr/$(get_libdir)/${PN}-${BIN_PV}/bin/ghc"
+ fi
+
+ use llvm && ! use ghcbootstrap && llvmize "${WORKDIR}/usr/bin"
+
+ # binpkg may have been built with FEATURES=splitdebug
+ if [[ -d "${WORKDIR}/usr/lib/debug" ]] ; then
+ rm -rf "${WORKDIR}/usr/lib/debug" || die
+ fi
+ find "${WORKDIR}/usr/lib" -type d -empty -delete 2>/dev/null # do not die on failure here
+
+ # ffi headers don't get included in the binpkg for some reason
+ for f in "${WORKDIR}/usr/$(get_libdir)/${PN}-${BIN_PV}/include/"{ffi.h,ffitarget.h}
+ do
+ mkdir -p "$(dirname "${f}")"
+ [[ -e "${f}" ]] || ln -sf "$($(tc-getPKG_CONFIG) --cflags-only-I libffi | sed "s/-I//g" | tr -d " ")/$(basename "${f}")" "${f}" || die
+ done
+
+ if use binary; then
+ if use prefix; then
+ relocate_ghc "${EPREFIX}"
+ fi
+
+ # Move unpacked files to the expected place
+ mv "${WORKDIR}/usr" "${S}"
+ eapply_user
+ else
+ if ! use ghcbootstrap; then
+ case ${CHOST} in
+ *-darwin* | *-solaris*)
+ # UPDATE ME for ghc-7
+ mkdir "${WORKDIR}"/ghc-bin-installer || die
+ pushd "${WORKDIR}"/ghc-bin-installer > /dev/null || die
+ use sparc-solaris && unpack ghc-6.10.4-sparc-sun-solaris2.tar.bz2
+ use x86-solaris && unpack ghc-7.0.3-i386-unknown-solaris2.tar.bz2
+ use x86-macos && unpack ghc-7.4.1-i386-apple-darwin.tar.bz2
+ use x64-macos && unpack ghc-7.4.1-x86_64-apple-darwin.tar.bz2
+ popd > /dev/null
+
+ pushd "${WORKDIR}"/ghc-bin-installer/ghc-[67].?*.? > /dev/null || die
+ # fix the binaries so they run, on Solaris we need an
+ # LD_LIBRARY_PATH which has our prefix libdirs, on
+ # Darwin we need to replace the frameworks with our libs
+ # from the prefix fix before installation, because some
+ # of the tools are actually used during configure/make
+ if [[ ${CHOST} == *-solaris* ]] ; then
+ export LD_LIBRARY_PATH="${EPREFIX}/$(get_libdir):${EPREFIX}/usr/$(get_libdir):${LD_LIBRARY_PATH}"
+ elif [[ ${CHOST} == *-darwin* ]] ; then
+ local readline_framework=GNUreadline.framework/GNUreadline
+ local gmp_framework=/opt/local/lib/libgmp.10.dylib
+ local ncurses_file=/opt/local/lib/libncurses.5.dylib
+ for binary in $(scanmacho -BRE MH_EXECUTE -F '%F' .) ; do
+ install_name_tool -change \
+ ${readline_framework} \
+ "${EPREFIX}"/lib/libreadline.dylib \
+ ${binary} || die
+ install_name_tool -change \
+ ${gmp_framework} \
+ "${EPREFIX}"/usr/lib/libgmp.dylib \
+ ${binary} || die
+ install_name_tool -change \
+ ${ncurses_file} \
+ "${EPREFIX}"/usr/lib/libncurses.dylib \
+ ${binary} || die
+ done
+ # we don't do frameworks!
+ sed -i \
+ -e 's/\(frameworks = \)\["GMP"\]/\1[]/g' \
+ -e 's/\(extraLibraries = \)\["m"\]/\1["m","gmp"]/g' \
+ rts/package.conf.in || die
+ fi
+
+ # it is autoconf, but we really don't want to give it too
+ # many arguments, in fact we do the make in-place anyway
+ ./configure --prefix="${WORKDIR}"/usr || die
+ make install || die
+ popd > /dev/null
+ ;;
+ *)
+ relocate_ghc "${WORKDIR}"
+ ;;
+ esac
+ fi
+
+ sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_PERSISTENT_FLAGS}|" \
+ "${S}/ghc/ghc.wrapper"
+
+ cd "${S}" # otherwise eapply will break
+
+ eapply "${FILESDIR}"/${PN}-9.0.2-CHOST-prefix.patch
+ eapply "${FILESDIR}"/${PN}-9.0.2-darwin.patch
+ # Fixes panic when compiling some packages
+ # https://github.com/gentoo-haskell/gentoo-haskell/issues/1250#issuecomment-1044257595
+ # https://gitlab.haskell.org/ghc/ghc/-/issues/21097
+ eapply "${FILESDIR}/${PN}-9.0.2-modorigin-semigroup.patch"
+ # Needed for testing with python-3.10
+ use test && eapply "${FILESDIR}/${PN}-9.0.2-fix-tests-python310.patch"
+ eapply "${FILESDIR}"/${PN}-8.10.1-allow-cross-bootstrap.patch
+ eapply "${FILESDIR}"/${PN}-9.0.2-disable-unboxed-arrays.patch
+ eapply "${FILESDIR}"/${PN}-9.0.2-llvm-13.patch
+ eapply "${FILESDIR}"/latomic-subword
+ eapply "${WORKDIR}"/${P}-riscv64-llvm.patch
+ eapply "${FILESDIR}"/${PN}-9.0.2-fptools.patch # clang-16 workaround
+
+ # mingw32 target
+ pushd "${S}/libraries/Win32"
+ eapply "${FILESDIR}"/${PN}-8.2.1_rc1-win32-cross-2-hack.patch # bad workaround
+ popd
+
+ bump_libs
+
+ eapply_user
+ # as we have changed the build system
+ eautoreconf
+ fi
+}
+
+src_configure() {
+ if ! use binary; then
+ # initialize build.mk
+ echo '# Gentoo changes' > mk/build.mk
+
+ # Put docs into the right place, ie /usr/share/doc/ghc-${GHC_PV}
+ echo "docdir = ${EPREFIX}/usr/share/doc/$(cross)${PF}" >> mk/build.mk
+ echo "htmldir = ${EPREFIX}/usr/share/doc/$(cross)${PF}" >> mk/build.mk
+
+ # We also need to use the GHC_FLAGS flags when building ghc itself
+ echo "SRC_HC_OPTS+=${HCFLAGS} ${GHC_FLAGS}" >> mk/build.mk
+ echo "SRC_CC_OPTS+=${CFLAGS}" >> mk/build.mk
+ echo "SRC_LD_OPTS+=${LDFLAGS}" >> mk/build.mk
+ # Speed up initial Cabal bootstrap
+ echo "utils/ghc-cabal_dist_EXTRA_HC_OPTS+=$(ghc-make-args)" >> mk/build.mk
+
+ # We can't depend on haddock except when bootstrapping when we
+ # must build docs and include them into the binary .tbz2 package
+ # app-text/dblatex is not in portage, can not build PDF or PS
+ echo "BUILD_SPHINX_PDF = NO" >> mk/build.mk
+ echo "BUILD_SPHINX_HTML = $(usex doc YES NO)" >> mk/build.mk
+ echo "BUILD_MAN = $(usex doc YES NO)" >> mk/build.mk
+
+ # this controls presence on 'xhtml' and 'haddock' in final install
+ echo "HADDOCK_DOCS = YES" >> mk/build.mk
+
+ # not used outside of ghc's test
+ if [[ -n ${GHC_BUILD_DPH} ]]; then
+ echo "BUILD_DPH = YES" >> mk/build.mk
+ else
+ echo "BUILD_DPH = NO" >> mk/build.mk
+ fi
+
+ # Any non-native build has to skip as it needs
+ # target haddock binary to be runnabine.
+ if ! is_native; then
+ # disable docs generation as it requires running stage2
+ echo "HADDOCK_DOCS=NO" >> mk/build.mk
+ echo "BUILD_SPHINX_HTML=NO" >> mk/build.mk
+ echo "BUILD_SPHINX_PDF=NO" >> mk/build.mk
+ fi
+
+ if is_crosscompile; then
+ # Install ghc-stage1 crosscompiler instead of
+ # ghc-stage2 cross-built compiler.
+ echo "Stage1Only=YES" >> mk/build.mk
+ fi
+
+ # allows overriding build flavours for libraries:
+ # v - vanilla (static libs)
+ # p - profiled
+ # dyn - shared libraries
+ # example: GHC_LIBRARY_WAYS="v dyn"
+ if [[ -n ${GHC_LIBRARY_WAYS} ]]; then
+ echo "GhcLibWays=${GHC_LIBRARY_WAYS}" >> mk/build.mk
+ fi
+ echo "BUILD_PROF_LIBS = $(usex profile YES NO)" >> mk/build.mk
+
+ # Get ghc from the unpacked binary .tbz2
+ # except when bootstrapping we just pick ghc up off the path
+ if ! use ghcbootstrap; then
+ export PATH="${WORKDIR}/usr/bin:${PATH}"
+ fi
+
+ echo "BIGNUM_BACKEND = $(usex gmp gmp native)" >> mk/build.mk
+
+ # don't strip anything. Very useful when stage2 SIGSEGVs on you
+ echo "STRIP_CMD = :" >> mk/build.mk
+
+ local econf_args=()
+
+ # GHC embeds toolchain it was built by and uses it later.
+ # Don't allow things like ccache or versioned binary slip.
+ # We use stable thing across gcc upgrades.
+ # User can use EXTRA_ECONF=CC=... to override this default.
+ econf_args+=(
+ AR=${CTARGET}-ar
+ CC=${CTARGET}-gcc
+ # these should be inferred by GHC but ghc defaults
+ # to using bundled tools on windows.
+ Windres=${CTARGET}-windres
+ DllWrap=${CTARGET}-dllwrap
+ # we set the linker explicitly below
+ --disable-ld-override
+ )
+ case ${CTARGET} in
+ arm*)
+ # ld.bfd-2.28 does not work for ghc. Force ld.gold
+ # instead. This should be removed once gentoo gets
+ # a fix for R_ARM_COPY bug: https://sourceware.org/PR16177
+ econf_args+=(LD=${CTARGET}-ld.gold)
+ ;;
+ sparc*)
+ # ld.gold-2.28 does not work for ghc. Force ld.bfd
+ # instead. This should be removed once gentoo gets
+ # a fix for missing --no-relax support bug:
+ # https://sourceware.org/ml/binutils/2017-07/msg00183.html
+ econf_args+=(LD=${CTARGET}-ld.bfd)
+ ;;
+ *)
+ econf_args+=(LD=${CTARGET}-ld)
+ esac
+
+ if [[ ${CBUILD} != ${CHOST} ]]; then
+ # GHC bug: ghc claims not to support cross-building.
+ # It does, but does not distinct --host= value
+ # for stage1 and stage2 compiler.
+ econf_args+=(--host=${CBUILD})
+ fi
+
+ if use ghcmakebinary; then
+ # When building booting libary we are trying to
+ # bundle or restrict most of external depends
+ # with unstable ABI:
+ # - embed libffi (default GHC behaviour)
+ # - disable ncurses support for ghci (via haskeline)
+ # https://bugs.gentoo.org/557478
+ # - disable ncurses support for ghc-pkg
+ echo "libraries/haskeline_CONFIGURE_OPTS += --flag=-terminfo" >> mk/build.mk
+ echo "utils/ghc-pkg_HC_OPTS += -DBOOTSTRAPPING" >> mk/build.mk
+ elif is_native; then
+ # using ${GTARGET}'s libffi is not supported yet:
+ # GHC embeds full path for ffi includes without /usr/${CTARGET} account.
+ econf_args+=(--with-system-libffi)
+ econf_args+=(--with-ffi-includes=$($(tc-getPKG_CONFIG) libffi --cflags-only-I | sed -e 's@^-I@@'))
+ fi
+
+ einfo "Final mk/build.mk:"
+ cat mk/build.mk || die
+
+ econf ${econf_args[@]} \
+ --enable-bootstrap-with-devel-snapshot \
+ $(use_enable elfutils dwarf-unwind) \
+ $(use_enable numa) \
+ $(use_enable unregisterised)
+
+ if [[ ${PV} == *9999* ]]; then
+ GHC_PV="$(grep 'S\[\"PACKAGE_VERSION\"\]' config.status | sed -e 's@^.*=\"\(.*\)\"@\1@')"
+ GHC_P=${PN}-${GHC_PV}
+ fi
+ fi # ! use binary
+}
+
+src_compile() {
+ if ! use binary; then
+ # Stage1Only crosscompiler does not build stage2
+ if ! is_crosscompile; then
+ # 1. build/pax-mark compiler binary first
+ emake ghc/stage2/build/tmp/ghc-stage2
+ # 2. pax-mark (bug #516430)
+ pax-mark -m ghc/stage2/build/tmp/ghc-stage2
+ # 2. build/pax-mark haddock using ghc-stage2
+ if is_native; then
+ # non-native build does not build haddock
+ # due to HADDOCK_DOCS=NO, but it could.
+ emake utils/haddock/dist/build/tmp/haddock
+ pax-mark -m utils/haddock/dist/build/tmp/haddock
+ fi
+ fi
+ # 3. and then all the rest
+ emake all
+ fi # ! use binary
+}
+
+src_test() {
+ # TODO: deal with:
+ # - sandbox (pollutes environment)
+ # - extra packages (to extend testsuite coverage)
+ # bits are taken from 'validate'
+ local make_test_target='test' # can be fulltest
+ # not 'emake' as testsuite uses '$MAKE' without jobserver available
+ make $make_test_target stage=2 THREADS=$(makeopts_jobs)
+}
+
+src_install() {
+ if use binary; then
+ use prefix && mkdir -p "${ED}"
+ mv "${S}/usr" "${ED}"
+ else
+ [[ -f VERSION ]] || emake VERSION
+
+ # -j1 due to a rare race in install script:
+ # make --no-print-directory -f ghc.mk phase=final install
+ # /usr/lib/portage/python3.4/ebuild-helpers/xattr/install -c -m 755 \
+ # -d "/tmp/portage-tmpdir/portage/cross-armv7a-unknown-linux-gnueabi/ghc-9999/image/usr/lib64/armv7a-unknown-linux-gnueabi-ghc-8.3.20170404/include"
+ # /usr/lib/portage/python3.4/ebuild-helpers/xattr/install -c -m 644 utils/hsc2hs/template-hsc.h \
+ # "/tmp/portage-tmpdir/portage/cross-armv7a-unknown-linux-gnueabi/ghc-9999/image/usr/lib64/armv7a-unknown-linux-gnueabi-ghc-8.3.20170404"
+ # /usr/bin/install: cannot create regular file \
+ # '/tmp/portage-tmpdir/portage/cross-armv7a-unknown-linux-gnueabi/ghc-9999/image/usr/lib64/armv7a-unknown-linux-gnueabi-ghc-8.3.20170404': No such file or directory
+ emake -j1 install DESTDIR="${D}"
+
+ use llvm && llvmize "${ED}/usr/bin"
+
+ # Skip for cross-targets as they all share target location:
+ # /usr/share/doc/ghc-9999/
+ if ! is_crosscompile; then
+ dodoc "distrib/README" "LICENSE" "VERSION"
+ fi
+
+ # rename ghc-shipped files to avoid collision
+ # of external packages. Motivating example:
+ # user had installed:
+ # dev-lang/ghc-7.8.4-r0 (with transformers-0.3.0.0)
+ # dev-haskell/transformers-0.4.2.0
+ # then user tried to update to
+ # dev-lang/ghc-7.8.4-r1 (with transformers-0.4.2.0)
+ # this will lead to single .conf file collision.
+ local shipped_conf renamed_conf
+ local package_confdir="${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
+ for shipped_conf in "${package_confdir}"/*.conf; do
+ # rename 'pkg-ver-id.conf' to 'pkg-ver-id-gentoo-${PF}.conf'
+ renamed_conf=${shipped_conf%.conf}-gentoo-${PF}.conf
+ mv "${shipped_conf}" "${renamed_conf}" || die
+ done
+
+ # remove link, but leave 'haddock-${GHC_P}'
+ rm -f "${ED}"/usr/bin/$(cross)haddock
+
+ if ! is_crosscompile; then
+ newbashcomp "${FILESDIR}"/ghc-bash-completion ghc-pkg
+ newbashcomp utils/completion/ghc.bash ghc
+ fi
+ fi
+
+ # path to the package.cache
+ local package_confdir="${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
+ PKGCACHE="${package_confdir}"/package.cache
+ # copy the package.conf.d, including timestamp, save it so we can help
+ # users that have a broken package.conf.d
+ cp -pR "${package_confdir}"{,.initial} || die "failed to backup intial package.conf.d"
+
+ # copy the package.conf, including timestamp, save it so we later can put it
+ # back before uninstalling, or when upgrading.
+ cp -p "${PKGCACHE}"{,.shipped} \
+ || die "failed to copy package.conf.d/package.cache"
+
+ if is_crosscompile; then
+ # When we build a cross-compiler the layout is the following:
+ # usr/lib/${CTARGET}-ghc-${VER}/ contains target libraries
+ # but
+ # usr/lib/${CTARGET}-ghc-${VER}/bin/ directory
+ # containst host binaries (modulo bugs).
+
+ # Portage's stripping mechanism does not skip stripping
+ # foreign binaries. This frequently causes binaries to be
+ # broken.
+ #
+ # Thus below we disable stripping of target libraries and allow
+ # stripping hosts executables.
+ dostrip -x "/usr/$(get_libdir)/$(cross)${GHC_P}"
+ dostrip "/usr/$(get_libdir)/$(cross)${GHC_P}/bin"
+ fi
+}
+
+pkg_preinst() {
+ # have we got an earlier version of ghc installed?
+ if has_version "<${CATEGORY}/${PF}"; then
+ haskell_updater_warn="1"
+ fi
+}
+
+pkg_postinst() {
+ ghc-reregister
+
+ # path to the package.cache
+ PKGCACHE="${EROOT}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d/package.cache"
+
+ # give the cache a new timestamp, it must be as recent as
+ # the package.conf.d directory.
+ touch "${PKGCACHE}"
+
+ if [[ "${haskell_updater_warn}" == "1" ]]; then
+ ewarn
+ ewarn "\e[1;31m************************************************************************\e[0m"
+ ewarn
+ ewarn "You have just upgraded from an older version of GHC."
+ ewarn "You may have to run"
+ ewarn " 'haskell-updater'"
+ ewarn "to rebuild all ghc-based Haskell libraries."
+ ewarn
+ ewarn "\e[1;31m************************************************************************\e[0m"
+ ewarn
+ fi
+}
+
+pkg_prerm() {
+ PKGCACHE="${EROOT}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d/package.cache"
+ rm -rf "${PKGCACHE}"
+
+ cp -p "${PKGCACHE}"{.shipped,}
+}
+
+pkg_postrm() {
+ ghc-package_pkg_postrm
+}
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: dev-lang/ghc/files/, dev-lang/ghc/
@ 2023-02-01 4:57 Michał Górny
0 siblings, 0 replies; 9+ messages in thread
From: Michał Górny @ 2023-02-01 4:57 UTC (permalink / raw
To: gentoo-commits
commit: 2a61a86e6a1416fbb57acff2118552fc1d5471c1
Author: Matoro Mahri <matoro <AT> users <DOT> noreply <DOT> github <DOT> com>
AuthorDate: Wed Feb 1 02:27:16 2023 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Feb 1 04:56:59 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2a61a86e
dev-lang/ghc: bump maximum LLVM to 14
Validated on arm64.
Closes: https://bugs.gentoo.org/876187
Signed-off-by: Matoro Mahri <matoro <AT> users.noreply.github.com>
Closes: https://github.com/gentoo/gentoo/pull/29366
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
dev-lang/ghc/files/ghc-9.0.2-llvm-14.patch | 15 +++++++++++++++
dev-lang/ghc/{ghc-9.0.2-r2.ebuild => ghc-9.0.2-r3.ebuild} | 5 +++--
2 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/dev-lang/ghc/files/ghc-9.0.2-llvm-14.patch b/dev-lang/ghc/files/ghc-9.0.2-llvm-14.patch
new file mode 100644
index 000000000000..ee4132bb2ee8
--- /dev/null
+++ b/dev-lang/ghc/files/ghc-9.0.2-llvm-14.patch
@@ -0,0 +1,15 @@
+https://bugs.gentoo.org/876187
+
+Bump max LLVM to 14. Validated on arm64.
+
+--- a/configure.ac
++++ b/configure.ac
+@@ -681,7 +681,7 @@ AC_SUBST(InstallNameToolCmd)
+ # versions of LLVM simultaneously, but that stopped working around
+ # 3.5/3.6 release of LLVM.
+ LlvmMinVersion=9 # inclusive
+-LlvmMaxVersion=14 # not inclusive
++LlvmMaxVersion=15 # not inclusive
+ AC_SUBST([LlvmMinVersion])
+ AC_SUBST([LlvmMaxVersion])
+ sUPPORTED_LLVM_VERSION_MIN=$(echo \($LlvmMinVersion\) | sed 's/\./,/')
diff --git a/dev-lang/ghc/ghc-9.0.2-r2.ebuild b/dev-lang/ghc/ghc-9.0.2-r3.ebuild
similarity index 99%
rename from dev-lang/ghc/ghc-9.0.2-r2.ebuild
rename to dev-lang/ghc/ghc-9.0.2-r3.ebuild
index 224ca5ec3652..b7d4466a00c3 100644
--- a/dev-lang/ghc/ghc-9.0.2-r2.ebuild
+++ b/dev-lang/ghc/ghc-9.0.2-r3.ebuild
@@ -85,7 +85,7 @@ IUSE="big-endian +doc elfutils ghcbootstrap ghcmakebinary +gmp llvm numa profile
IUSE+=" binary"
RESTRICT="!test? ( test )"
-LLVM_MAX_SLOT="13"
+LLVM_MAX_SLOT="14"
RDEPEND="
>=dev-lang/perl-5.6.1
dev-libs/gmp:0=
@@ -96,7 +96,7 @@ RDEPEND="
llvm? (
<sys-devel/llvm-$((${LLVM_MAX_SLOT} + 1)):=
|| (
- sys-devel/llvm:13
+ sys-devel/llvm:14
)
)
"
@@ -540,6 +540,7 @@ src_prepare() {
eapply "${FILESDIR}"/${PN}-8.10.1-allow-cross-bootstrap.patch
eapply "${FILESDIR}"/${PN}-9.0.2-disable-unboxed-arrays.patch
eapply "${FILESDIR}"/${PN}-9.0.2-llvm-13.patch
+ eapply "${FILESDIR}"/${PN}-9.0.2-llvm-14.patch
eapply "${FILESDIR}"/latomic-subword
eapply "${WORKDIR}"/${P}-riscv64-llvm.patch
eapply "${FILESDIR}"/${PN}-9.0.2-fptools.patch # clang-16 workaround
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: dev-lang/ghc/files/, dev-lang/ghc/
@ 2023-10-14 0:47 Sam James
0 siblings, 0 replies; 9+ messages in thread
From: Sam James @ 2023-10-14 0:47 UTC (permalink / raw
To: gentoo-commits
commit: 3ec66730cb3492e5af1a4b961673d327acb40eb7
Author: hololeap <hololeap <AT> protonmail <DOT> com>
AuthorDate: Mon Oct 9 04:10:17 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Oct 14 00:47:05 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3ec66730
dev-lang/ghc: drop 8.10.6-r3, 9.0.2-r3
Remove unused patches
Signed-off-by: hololeap <hololeap <AT> protonmail.com>
Closes: https://github.com/gentoo/gentoo/pull/33254
Signed-off-by: Sam James <sam <AT> gentoo.org>
dev-lang/ghc/Manifest | 10 -
dev-lang/ghc/files/ghc-7.0.4-CHOST-prefix.patch | 17 -
dev-lang/ghc/files/ghc-7.8.3-prim-lm.patch | 12 -
.../ghc-8.10.5-modorigin-verbose-conflict.patch | 20 -
dev-lang/ghc/files/ghc-8.10.6-aclocal.patch | 26 -
dev-lang/ghc/files/ghc-8.2.1-darwin.patch | 31 -
dev-lang/ghc/files/ghc-8.2.1_rc1-hp2ps-cross.patch | 104 ---
dev-lang/ghc/files/ghc-8.8.1-revert-CPP.patch | 52 --
dev-lang/ghc/ghc-8.10.6-r3.ebuild | 869 --------------------
dev-lang/ghc/ghc-9.0.2-r3.ebuild | 898 ---------------------
10 files changed, 2039 deletions(-)
diff --git a/dev-lang/ghc/Manifest b/dev-lang/ghc/Manifest
index 9e19de846f92..014f94dcbd76 100644
--- a/dev-lang/ghc/Manifest
+++ b/dev-lang/ghc/Manifest
@@ -1,20 +1,10 @@
-DIST ghc-8.10.6-src.tar.xz 19932832 BLAKE2B f5d0c43aa5df87648e32beeb5ed6866b231cbce4f344fb03110db826b36bbac435f5e89d9ffeef3f87c15e830fdee6b95150b7bdcd06906575bfcd9c83797dff SHA512 6314eb9744d47d803b30b621bd12bf6179dad5cc578ec267b3a65b89e9c9b431bdb4913936f040c7ca4fcc71a676a43e78b5f6173d123a844e7f29004405b8b6
-DIST ghc-8.10.6-testsuite.tar.xz 2265044 BLAKE2B 72a1e955acecc92a720ee2747d96cacf56f2968c9deabb254c882a969c154baa0fdb639a857844ec91a4e47ee553dd13b58c3b790202e7e73500095c1ec85ee9 SHA512 f74d743bd8f889c2941be8fd5348e92abcaf75bce48140f7f9cc0c6ce33ba24a8479bef48631ffe2a10397c0ecf166b3bddb6ca8ee905859c029175de5d43f2a
DIST ghc-9.0.2-riscv64-llvm.patch.xz 7148 BLAKE2B 01a0d4036b649f663aebebab06990ac041533e7462d3ee9e143444f1119b736f2f8f2dfc293d61da1fac9f0d3ef12e98bab5b0c9fe8440ed1eab22a1d45fb9d7 SHA512 8afb62d5363d8a1a8f63e85335f3c8fa35b7d22899ebe334218a60ce9519852325c8ce93bb0be794c36cbc3c1cc031b7b1e2f4d7665d71f49e95f737bd91ba1a
DIST ghc-9.0.2-src.tar.xz 27270396 BLAKE2B 0a73d910d3ef11161f895849025fe37ce231932f7cde441fdf620cf8c51678060a804467879eb0ee5c0a30413604c56e28e2aa1cde01e45c620b76987d9c0c0e SHA512 32994c7d2b8f47bae604cd825bfcf9c788d79ce26d1d5f58bd73a7093e11ae6c3c17b31dc0c9e454dbf67ca169b942f92213c388d615768cae86055bf6094dee
DIST ghc-9.0.2-testsuite.tar.xz 2403564 BLAKE2B 0e7f6fefb9c972f94073aca8b15147913ffa8d3cd3ff7fc63ef7e20b4efd8b443cf21f12e1ab0f5044790f6d8af6cf7788bda85a21b2f356ddface86eb896670 SHA512 b2375500ae837d74af8085d099899b5a7a589c59bdcc033ca0bd6e00f33c4f8d90b481e0c7c3de113e607fcfafdfe8edde4713e6d242b2d4ee87df2eb960c9c7
-DIST ghc-bin-8.10.6-r3-i686-pc-linux-gnu.gpkg.tar 73062400 BLAKE2B c0701c16434ae5918f5ec1c55ab06aa036b98947f0f68c58aaa59b2a23ebb408f60f1886c76271351f2e99a334d6e1feeb47b6c4c14c09040b197eebbbcf3142 SHA512 d75bb6d06d32a5f60b020e9d8d77485ea8c391fd88a4583d0ddfd33a0e75506dc23b736fa6a15da25116c6c90c53b2d75dae38935581c5145d5b247d3c19f2a6
-DIST ghc-bin-8.10.6-r3-x86_64-pc-linux-gnu.gpkg.tar 123996160 BLAKE2B 3279a3f312225cae30196467b6f61b749f8ea037b2b65adaafdea1668c81a5ed402bd3acedc02aaee371a6d27c3c01c0f4c837bb9058a0ed8b61715afab5ccc9 SHA512 ea24551137b5057a2c29e0bd9a22ce247669dc38bcebac7ff3bac746b1fc9bd46b1fe2d894fd862745bb97af0d92be2a0563c18fc29e7565c5506552edb0c3e1
-DIST ghc-bin-9.0.2-aarch64-unknown-linux-gnu.tar.gz 304621314 BLAKE2B d38b8571d41b5703da6b29f43664293761865166a7e3ab6b9c4b039f1af15faa4aa2013a32eb00059d6e595984895762eadff7b62141157d2dea6eb9b035138d SHA512 94e0e00329a18b494b509b3f8190cf6fed2399a2ac2d2d96fdfd90bf5dbeb8db68b6759f719ad85f8873961b0e983ff0006ce0bf109e96462169cbd9fa7b6784
-DIST ghc-bin-9.0.2-i686-pc-linux-gnu.tbz2 123509908 BLAKE2B 45614984803a7bfa266f99d4adb4b5f2ab7b9e5e89c6ecd501296fc99a1d96e798ccb9c832f8dcb15fff9725beb918a7b63e62ff13f59b6506a2ef17930c45d2 SHA512 e0b7f4474c16f0763a2f787027fbdfeb3125b48c987fa1196bc189fefad9f0bfa2806da62af46d61ca911f5275b578076e2b326acf39e0894a8daa9deda0843a
-DIST ghc-bin-9.0.2-powerpc64-unknown-linux-gnu.tar.gz 235636284 BLAKE2B 878ac300cca5d2cbc5cb21dbb347da755b4027cbf63ec77464740854fa8010569de5e03acef67cd877da13665c906b2fd04e24e226e9eb39b57ba979093c732b SHA512 28f096e965abdac9cc370c882639f10285b9073ba5332f7af215eccff948e41c01c3d6bb3bc8e3b4e809e12867a95b49f82dd76e0090b974088f75ab9d1bc199
-DIST ghc-bin-9.0.2-powerpc64le-unknown-linux-gnu.tar.gz 275226316 BLAKE2B 10ade2359432b0ede7431ee543f0ff47f4b203465d81719da579ad63ca467359eb9fcf7336a12feb6ff75a480f349576ff8ea1b4ebe1094fff228ae4fd00d6e0 SHA512 64b4c84d149358b8d3a6cb29a6d3a75af11e7b14e6d910c9789c9949262e4ed2a17f8a0d1e5dd297121957061fe2395d6f43acae6b4ab28851e3cd414cd9c89c
DIST ghc-bin-9.0.2-r4-aarch64-unknown-linux-gnu.tar.gz 221699967 BLAKE2B c6e34b23a9664b6dc7d13f939063c34665c558b2596e3446abd9a8f90e9ad586f515e1703c36d269f7fb4a36a85f497e9f4d356f01ede7a7a614b3cd4fbf0dbe SHA512 d9f381b417ee740c9bba9508d5ccca2a6bffdd32c6262d76f254a21cf7505d2aaa5695c0354ee9e8fb672b90ae67af6205cdd2fe6ad6aa5d610c760d59392b62
DIST ghc-bin-9.0.2-r4-i686-pc-linux-gnu.gpkg.tar 81059840 BLAKE2B 655405cd402cc7af424baf5b715f64af3ce97d474c883c618cd8e6fae40274dc6f584872c607cbe3553141a199729df98ddbdb5947a50520b67f53946f20d25a SHA512 401ab9ae646e18519ba1b06705944862d3f802068c4eae19fc019899eb14ceef95fa57e51b5527e5c5314c2433aff7e418e1d35c2de425c142c34e8fa21a5f46
DIST ghc-bin-9.0.2-r4-powerpc64-unknown-linux-gnu.tar.gz 233834058 BLAKE2B 32ee779c4567472799f985102cdf0a6a5dfb3984795b6efafe6a6326933e1d0128260012cbe5e0e20c71becd4d2e589e32f43882e66b479ef4c34358d7bd8e93 SHA512 be56a92c2f5f00f1f0b22f02745d836ac3706fc207932c71277c1076515ed4fd1875372844b4cbb0996afec5fc122255103ac03c65c99d087615005f1aa63732
DIST ghc-bin-9.0.2-r4-powerpc64le-unknown-linux-gnu.tar.gz 210668658 BLAKE2B fe33a43ea38e5fe17a003e60f29458f0dc5115f92db311dff11b2ce3fa1a9fc0304ad93c76535fb8e4ce44bb703f8a18638149f36b076c84f5c44385486722bd SHA512 12e04c29873ddd80ff259998121b3ce4b9dcdd1157cbb38ce8ac0234c6aaa0c156b0cc78f95af86288e6f595f9e010a1db88ba737e27773b404ed6129e58044f
DIST ghc-bin-9.0.2-r4-riscv64-unknown-linux-gnu.tar.gz 315182159 BLAKE2B 95ee2f82eb706b42a0a3303038cf28166ac1e766a5f38402f833830c311f02773881b5341d6d7a1772fdc616522b1448a740caf34e4e534b5d00fedeb23604de SHA512 dd143f8b379e8ca04ab6254aa19978a3a8caf61322e2e3b2bae7488025949845aa5d5fc0e3124ff360172c2b47e4a33df4d1d55c8a976c96b552cd3c930b2fad
DIST ghc-bin-9.0.2-r4-x86_64-pc-linux-gnu.gpkg.tar 123955200 BLAKE2B b1f45eea658f496997e63c21e3ef190749c122ee3a058d5f25fd90a2e2c33841817c540b9bf87e27e6981d9fb28d9201454217fa8ba9c1d9fc4ccf3d20652158 SHA512 06a240f7117f30179073e075634510d9ffe880010de16c93a001dce7b3020666b0b26d51c2c08cdaee7fc6513d9ffc7082f20b233d62b9149419abba2b4bd4ee
-DIST ghc-bin-9.0.2-riscv64-unknown-linux-gnu.tar.gz 313475807 BLAKE2B a5e1bbd4630eaff63dd01d79fdcb26a663771c0241d3211aa3a0033cb58addbe8e696177500ac06ae727fc645bfc6f16a3df763a6a0ae039b8823bcbfb9918bb SHA512 5e462f6f9d3f3507b3e09230729faa2a3e1fa92a8024fac602d75b804fff25f27e335871658f4b7b2c671f9e066373ca0285720da315a6c22f6f2c9c3cfea927
-DIST ghc-bin-9.0.2-x86_64-pc-linux-gnu-r1.tbz2 121347519 BLAKE2B 6bd41cdb8ba1661735e46df4709888e6461cff969678716c82681a0a0b0e8d0a32532a070f52efb0ab99ca126207998e8883d01902071e797a7a0f19881d5925 SHA512 c7de43577fd97e6fbde7bbffba4e1d2b83cdda405cff46f95c9eff23260542b426091d8dba75605d81ed41740a793a409e7448538e5adc7a391a901f20e8f2e4
DIST process-1.6.16.0.tar.gz 87354 BLAKE2B 8c2977d6801faef8825ed35f058a6207a518f72eb87ac3144f630bc028f4753cefb9ed4d3fc29185438bcb4f38d33f5a45aebec6a8101e4cdc1b3570ada2e5dc SHA512 1663f2746a05a5a4c29d249db54eaa49edbbadfe8d189eab02276c3f6f3d6b84c81cc4333318c42c7a7265638402cb13276f08aeea134a7f5dd98da050a34341
diff --git a/dev-lang/ghc/files/ghc-7.0.4-CHOST-prefix.patch b/dev-lang/ghc/files/ghc-7.0.4-CHOST-prefix.patch
deleted file mode 100644
index e38d9165e065..000000000000
--- a/dev-lang/ghc/files/ghc-7.0.4-CHOST-prefix.patch
+++ /dev/null
@@ -1,17 +0,0 @@
-Strip versioning components from *HOST for Darwin and Solaris
-
---- a/aclocal.m4
-+++ b/aclocal.m4
-@@ -1358,6 +1358,12 @@
- freebsd*)
- $2="freebsd"
- ;;
-+ darwin*)
-+ $2="darwin"
-+ ;;
-+ solaris2.*)
-+ $2="solaris2"
-+ ;;
- *)
- echo "Unknown OS $1"
- exit 1
diff --git a/dev-lang/ghc/files/ghc-7.8.3-prim-lm.patch b/dev-lang/ghc/files/ghc-7.8.3-prim-lm.patch
deleted file mode 100644
index 3ef2313fcec1..000000000000
--- a/dev-lang/ghc/files/ghc-7.8.3-prim-lm.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-Fix underlinking on ghc-prim.
-Fixes ghc-stage2 crahs on hardened toolchain.
-Reported-by: aranea
-diff --git a/libraries/ghc-prim/ghc-prim.cabal b/libraries/ghc-prim/ghc-prim.cabal
-index ffb32af..0431380 100644
---- a/libraries/ghc-prim/ghc-prim.cabal
-+++ b/libraries/ghc-prim/ghc-prim.cabal
-@@ -68,0 +68,4 @@ Library
-+
-+ -- ghc 'sin' (and other) primops generate 'libm' calls,
-+ -- but ghc itself does not add '-lm'
-+ extra-libraries: m
diff --git a/dev-lang/ghc/files/ghc-8.10.5-modorigin-verbose-conflict.patch b/dev-lang/ghc/files/ghc-8.10.5-modorigin-verbose-conflict.patch
deleted file mode 100644
index a34c0c9059fe..000000000000
--- a/dev-lang/ghc/files/ghc-8.10.5-modorigin-verbose-conflict.patch
+++ /dev/null
@@ -1,20 +0,0 @@
---- a/compiler/main/Packages.hs
-+++ b/compiler/main/Packages.hs
-@@ -219,12 +219,14 @@ fromFlag = ModOrigin Nothing [] [] True
- instance Semigroup ModuleOrigin where
- ModOrigin e res rhs f <> ModOrigin e' res' rhs' f' =
- ModOrigin (g e e') (res ++ res') (rhs ++ rhs') (f || f')
-- where g (Just b) (Just b')
-+ where g x@(Just b) y@(Just b')
- | b == b' = Just b
-- | otherwise = panic "ModOrigin: package both exposed/hidden"
-+ | otherwise = pprPanic "ModOrigin: package both exposed/hidden" $
-+ text "x: " <> ppr x $$ text "y: " <> ppr y
- g Nothing x = x
- g x Nothing = x
-- _x <> _y = panic "ModOrigin: hidden module redefined"
-+ x <> y = pprPanic "ModOrigin: hidden module redefined" $
-+ text "x: " <> ppr x $$ text "y: " <> ppr y
-
- instance Monoid ModuleOrigin where
- mempty = ModOrigin Nothing [] [] False
diff --git a/dev-lang/ghc/files/ghc-8.10.6-aclocal.patch b/dev-lang/ghc/files/ghc-8.10.6-aclocal.patch
deleted file mode 100644
index 8bd3ce58d072..000000000000
--- a/dev-lang/ghc/files/ghc-8.10.6-aclocal.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-diff --git a/aclocal.m4 b/aclocal.m4
-index 47d69c5..212ebc6 100644
---- a/aclocal.m4
-+++ b/aclocal.m4
-@@ -966,17 +966,15 @@ struct nlist xYzzY1[] = {{"xYzzY1", 0},{0}};
- struct nlist xYzzY2[] = {{"_xYzzY2", 0},{0}};
- #endif
-
--int main(argc, argv)
--int argc;
--char **argv;
-+int main(int argc, char **argv)
- {
- #if defined(HAVE_NLIST_H)
- if(nlist(argv[0], xYzzY1) == 0 && xYzzY1[0].n_value != 0)
-- exit(1);
-+ return 1;
- if(nlist(argv[0], xYzzY2) == 0 && xYzzY2[0].n_value != 0)
-- exit(0);
-+ return 0;
- #endif
-- exit(1);
-+ return 1;
- }]])],[fptools_cv_leading_underscore=yes],[fptools_cv_leading_underscore=no],[fptools_cv_leading_underscore=no])
- ;;
- esac]);
diff --git a/dev-lang/ghc/files/ghc-8.2.1-darwin.patch b/dev-lang/ghc/files/ghc-8.2.1-darwin.patch
deleted file mode 100644
index 53fedc4e4402..000000000000
--- a/dev-lang/ghc/files/ghc-8.2.1-darwin.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-From d39a3409acd3c40fb018ec1c114f15d3ecef6ef9 Mon Sep 17 00:00:00 2001
-From: Sergei Trofimovich <slyfox@gentoo.org>
-Date: Thu, 1 Jun 2017 22:30:05 +0100
-Subject: [PATCH] aclocal.m4: add support for versioned darwin triplets
-
-The change adds support for 'darwin*' OS:
- $ ./configure --target=aarch64-apple-darwin14
-
-Reported-by: jp_rider
-Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
----
- aclocal.m4 | 3 +++
- 1 file changed, 3 insertions(+)
-
-diff --git a/aclocal.m4 b/aclocal.m4
-index 7ad9c36453..437974a0c7 100644
---- a/aclocal.m4
-+++ b/aclocal.m4
-@@ -1906,6 +1906,9 @@ AC_DEFUN([GHC_CONVERT_OS],[
- aix*) # e.g. powerpc-ibm-aix7.1.3.0
- $3="aix"
- ;;
-+ darwin*) # e.g. aarch64-apple-darwin14
-+ $3="darwin"
-+ ;;
- freebsd*) # like i686-gentoo-freebsd7
- # i686-gentoo-freebsd8
- # i686-gentoo-freebsd8.2
---
-2.14.1
-
diff --git a/dev-lang/ghc/files/ghc-8.2.1_rc1-hp2ps-cross.patch b/dev-lang/ghc/files/ghc-8.2.1_rc1-hp2ps-cross.patch
deleted file mode 100644
index 26382b3cf44c..000000000000
--- a/dev-lang/ghc/files/ghc-8.2.1_rc1-hp2ps-cross.patch
+++ /dev/null
@@ -1,104 +0,0 @@
-commit ff84d052850b637b03bbb98cf05202e44886257d
-Author: Sergei Trofimovich <slyfox@gentoo.org>
-Date: Sat Apr 8 10:02:34 2017 +0100
-
- cross-build 'unlit' and 'hp2ps' for stage2 install
-
- In navive build case it does not matter much if we build
- 'unlit' and 'hp2ps' tools with ghc-stage0 or ghc-stage1:
- both GHCs are native compilers and both tools are written
- in C (have no haskell code).
-
- But in cross-case the difference is substantial:
- In Stag1Only=YES case we need to install native tools built
- by ghc-stage0/${host}-cc.
- In Stag1Only=NO case we need to install cross-built tools
- built by ghc-stage1/${target}-cc.
-
- Before this change GHC did not have a rule to build cross-built
- 'unlit' and 'hp2ps'.
-
- The change adds cross-built 'unlit' and 'hp2ps' as 'dist-install'
- targets.
-
- 'inplace/lib/bin/unlit.bin' target is unchanged and still contains
- native binary.
-
- As a result this change allows cross-building and packaging whole
- GHC for target platform!
-
- Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
-
-diff --git a/utils/hp2ps/ghc.mk b/utils/hp2ps/ghc.mk
-index f6e01ec6c1..21ce87dcfa 100644
---- a/utils/hp2ps/ghc.mk
-+++ b/utils/hp2ps/ghc.mk
-@@ -10,6 +10,7 @@
- #
- # -----------------------------------------------------------------------------
-
-+# stage0
- utils/hp2ps_dist_C_SRCS = AreaBelow.c Curves.c Error.c Main.c \
- Reorder.c TopTwenty.c AuxFile.c Deviation.c \
- HpFile.c Marks.c Scale.c TraceElement.c \
-@@ -17,11 +18,27 @@ utils/hp2ps_dist_C_SRCS = AreaBelow.c Curves.c Error.c Main.c \
- Utilities.c
- utils/hp2ps_dist_EXTRA_LIBRARIES = m
- utils/hp2ps_dist_PROGNAME = hp2ps
--utils/hp2ps_dist_INSTALL = YES
- utils/hp2ps_dist_INSTALL_INPLACE = YES
- utils/hp2ps_dist_SHELL_WRAPPER = YES
- utils/hp2ps_dist_INSTALL_SHELL_WRAPPER_NAME = hp2ps
-
- utils/hp2ps_CC_OPTS += $(addprefix -I,$(GHC_INCLUDE_DIRS))
-
-+# stage 1
-+utils/hp2ps_dist-install_C_SRCS = $(utils/hp2ps_dist_C_SRCS)
-+utils/hp2ps_dist-install_EXTRA_LIBRARIES = $(utils/hp2ps_dist_EXTRA_LIBRARIES)
-+utils/hp2ps_dist-install_PROGNAME = $(utils/hp2ps_dist_PROGNAME)
-+utils/hp2ps_dist-install_INSTALL_INPLACE = NO
-+utils/hp2ps_dist-install_SHELL_WRAPPER = YES
-+utils/hp2ps_dist-install_INSTALL_SHELL_WRAPPER_NAME = $(utils/hp2ps_dist_INSTALL_SHELL_WRAPPER_NAME)
-+
-+ifeq "$(Stage1Only)" "YES"
-+utils/hp2ps_dist_INSTALL = YES
-+utils/hp2ps_dist-install_INSTALL = NO
-+else
-+utils/hp2ps_dist_INSTALL = NO
-+utils/hp2ps_dist-install_INSTALL = YES
-+endif
-+
- $(eval $(call build-prog,utils/hp2ps,dist,0))
-+$(eval $(call build-prog,utils/hp2ps,dist-install,1))
-diff --git a/utils/unlit/ghc.mk b/utils/unlit/ghc.mk
-index e947989b5e..8911f4e856 100644
---- a/utils/unlit/ghc.mk
-+++ b/utils/unlit/ghc.mk
-@@ -10,11 +10,25 @@
- #
- # -----------------------------------------------------------------------------
-
-+# built by ghc-stage0
- utils/unlit_dist_C_SRCS = unlit.c
- utils/unlit_dist_PROGNAME = unlit
- utils/unlit_dist_TOPDIR = YES
--utils/unlit_dist_INSTALL = YES
- utils/unlit_dist_INSTALL_INPLACE = YES
-
--$(eval $(call build-prog,utils/unlit,dist,0))
-+# built by ghc-stage1
-+utils/unlit_dist-install_C_SRCS = $(utils/unlit_dist_C_SRCS)
-+utils/unlit_dist-install_PROGNAME = $(utils/unlit_dist_PROGNAME)
-+utils/unlit_dist-install_TOPDIR = $(utils/unlit_dist_TOPDIR)
-+utils/unlit_dist-install_INSTALL_INPLACE = NO
-+
-+ifeq "$(Stage1Only)" "YES"
-+utils/unlit_dist_INSTALL = YES
-+utils/unlit_dist-install_INSTALL = NO
-+else
-+utils/unlit_dist_INSTALL = NO
-+utils/unlit_dist-install_INSTALL = YES
-+endif
-
-+$(eval $(call build-prog,utils/unlit,dist,0))
-+$(eval $(call build-prog,utils/unlit,dist-install,1))
diff --git a/dev-lang/ghc/files/ghc-8.8.1-revert-CPP.patch b/dev-lang/ghc/files/ghc-8.8.1-revert-CPP.patch
deleted file mode 100644
index 8535cf09ef34..000000000000
--- a/dev-lang/ghc/files/ghc-8.8.1-revert-CPP.patch
+++ /dev/null
@@ -1,52 +0,0 @@
-Don't pass CPP options. Otherwise ghc-8.8.1 can't build itself.
-Eventually ghc will fix it's headers at propagate defines.
-
-https://gitlab.haskell.org/ghc/ghc/commit/cfd3e0f1cfd16c8f35cae139d2a871a32eb4d2e1
-https://gitlab.haskell.org/ghc/ghc/issues/17146
-
---- a/compiler/main/DriverPipeline.hs
-+++ b/compiler/main/DriverPipeline.hs
-@@ -1190,6 +1190,9 @@ runPhase (RealPhase Cmm) input_fn dflags
- -----------------------------------------------------------------------------
- -- Cc phase
-
-+-- we don't support preprocessing .c files (with -E) now. Doing so introduces
-+-- way too many hacks, and I can't say I've ever used it anyway.
-+
- runPhase (RealPhase cc_phase) input_fn dflags
- | any (cc_phase `eqPhase`) [Cc, Ccxx, HCc, Cobjc, Cobjcxx]
- = do
-@@ -1211,16 +1214,6 @@ runPhase (RealPhase cc_phase) input_fn dflags
- (includePathsQuote cmdline_include_paths)
- let include_paths = include_paths_quote ++ include_paths_global
-
-- -- pass -D or -optP to preprocessor when compiling foreign C files
-- -- (#16737). Doing it in this way is simpler and also enable the C
-- -- compiler to performs preprocessing and parsing in a single pass,
-- -- but it may introduce inconsistency if a different pgm_P is specified.
-- let more_preprocessor_opts = concat
-- [ ["-Xpreprocessor", i]
-- | not hcc
-- , i <- getOpts dflags opt_P
-- ]
--
- let gcc_extra_viac_flags = extraGccViaCFlags dflags
- let pic_c_flags = picCCOpts dflags
-
-@@ -1230,7 +1223,7 @@ runPhase (RealPhase cc_phase) input_fn dflags
- -- hc code doesn't not #include any header files anyway, so these
- -- options aren't necessary.
- pkg_extra_cc_opts <- liftIO $
-- if hcc
-+ if cc_phase `eqPhase` HCc
- then return []
- else getPackageExtraCcOpts dflags pkgs
-
-@@ -1312,7 +1305,6 @@ runPhase (RealPhase cc_phase) input_fn dflags
- ++ [ "-include", ghcVersionH ]
- ++ framework_paths
- ++ include_paths
-- ++ more_preprocessor_opts
- ++ pkg_extra_cc_opts
- ))
-
diff --git a/dev-lang/ghc/ghc-8.10.6-r3.ebuild b/dev-lang/ghc/ghc-8.10.6-r3.ebuild
deleted file mode 100644
index 37a70a60888b..000000000000
--- a/dev-lang/ghc/ghc-8.10.6-r3.ebuild
+++ /dev/null
@@ -1,869 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-# to make make a crosscompiler use crossdev and symlink ghc tree into
-# cross overlay. result would look like 'cross-sparc-unknown-linux-gnu/ghc'
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} = ${CHOST} ]] ; then
- if [[ ${CATEGORY/cross-} != ${CATEGORY} ]] ; then
- export CTARGET=${CATEGORY/cross-}
- fi
-fi
-
-PYTHON_COMPAT=( python3_{9..12} )
-inherit python-any-r1
-inherit autotools bash-completion-r1 flag-o-matic ghc-package
-inherit multiprocessing pax-utils toolchain-funcs prefix
-inherit check-reqs unpacker
-DESCRIPTION="The Glasgow Haskell Compiler"
-HOMEPAGE="https://www.haskell.org/ghc/"
-
-# we don't have any binaries yet
-arch_binaries=""
-
-BIN_PV=${PV}
-[[ $PR != r0 ]] && BIN_REV=${PR}
-
-# Differentiate glibc/musl
-
-#glibc_binaries="$glibc_binaries alpha? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-alpha.tbz2 )"
-glibc_binaries+=" amd64? ( https://eidetic.codes/${PN}-bin-${PVR}-x86_64-pc-linux-gnu.gpkg.tar )"
-#glibc_binaries="$glibc_binaries arm? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-armv7a-hardfloat-linux-gnueabi.tbz2 )"
-#glibc_binaries="$glibc_binaries arm64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-aarch64-unknown-linux-gnu.tbz2 )"
-#glibc_binaries="$glibc_binaries ia64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ia64-fixed-fiw.tbz2 )"
-#glibc_binaries="$glibc_binaries ppc? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ppc.tbz2 )"
-#glibc_binaries="$glibc_binaries ppc64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ppc64.tbz2 )"
-#glibc_binaries="$glibc_binaries ppc64? (
-# big-endian? ( https://github.com/matoro/ghc/releases/download/${PV}/ghc-bin-${PV}-powerpc64-unknown-linux-gnu.tar.gz )
-# !big-endian? ( https://github.com/matoro/ghc/releases/download/${PV}/ghc-bin-${PV}-powerpc64le-unknown-linux-gnu.tar.gz )
-#)"
-#glibc_binaries="$glibc_binaries riscv? ( https://github.com/matoro/ghc/releases/download/${PV}/ghc-bin-${PV}-riscv64-unknown-linux-gnu.tar.gz )"
-#glibc_binaries="$glibc_binaries sparc? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-sparc.tbz2 )"
-glibc_binaries+=" x86? ( https://eidetic.codes/${PN}-bin-${PVR}-i686-pc-linux-gnu.gpkg.tar )"
-
-#musl_binaries="$musl_binaries alpha? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-alpha.tbz2 )"
-#musl_binaries="$musl_binaries amd64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-x86_64-pc-linux-musl.tbz2 )"
-#musl_binaries="$musl_binaries arm? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-armv7a-hardfloat-linux-musl.tbz2 )"
-#musl_binaries="$musl_binaries arm64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-aarch64-unknown-linux-musl.tbz2 )"
-#musl_binaries="$musl_binaries ia64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ia64-fixed-fiw.tbz2 )"
-#musl_binaries="$musl_binaries ppc? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ppc.tbz2 )"
-#musl_binaries="$musl_binaries ppc64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ppc64.tbz2 )"
-#musl_binaries="$musl_binaries ppc64? ( !big-endian? ( https://github.com/matoro/ghc/releases/download/${PV}/ghc-bin-${PV}-powerpc64le-unknown-linux-musl.tar.gz ) )"
-#musl_binaries="$musl_binaries riscv? ( https://github.com/matoro/ghc/releases/download/${PV}/ghc-bin-${PV}-riscv64-unknown-linux-musl.tar.gz )"
-#musl_binaries="$musl_binaries sparc? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-sparc.tbz2 )"
-#musl_binaries="$musl_binaries x86? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-i686-pc-linux-musl.tbz2 )"
-
-[[ -n $glibc_binaries ]] && arch_binaries+=" elibc_glibc? ( $glibc_binaries )"
-[[ -n $musl_binaries ]] && arch_binaries+=" elibc_musl? ( $musl_binaries )"
-
-# various ports:
-#arch_binaries="$arch_binaries x86-fbsd? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-x86-fbsd.tbz2 )"
-
-# 0 - yet
-yet_binary() {
- case "${ELIBC}" in
- glibc)
- case "${ARCH}" in
- #alpha) return 0 ;;
- #arm64) return 0 ;;
- #arm) return 0 ;;
- amd64) return 0 ;;
- #ia64) return 0 ;;
- #ppc) return 0 ;;
- #ppc64) return 0 ;;
- #riscv) return 0 ;;
- #sparc) return 0 ;;
- x86) return 0 ;;
- *) return 1 ;;
- esac
- ;;
- musl)
- case "${ARCH}" in
- #alpha) return 0 ;;
- #arm64) return 0 ;;
- #arm) return 0 ;;
- #amd64) return 0 ;;
- #ia64) return 0 ;;
- #ppc) return 0 ;;
- #ppc64)
- # use big-endian || return 0
- # ;;
- #riscv) return 0 ;;
- #sparc) return 0 ;;
- #x86) return 0 ;;
- *) return 1 ;;
- esac
- ;;
- *) return 1 ;;
- esac
-}
-
-GHC_PV=${PV}
-#GHC_PV=8.10.0.20200123 # uncomment only for -alpha, -beta, -rc ebuilds
-GHC_P=${PN}-${GHC_PV} # using ${P} is almost never correct
-
-SRC_URI="!binary? (
- https://downloads.haskell.org/ghc/${PV/_/-}/${GHC_P}-src.tar.xz
- test? ( https://downloads.haskell.org/ghc/${PV/_/-}/${GHC_P}-testsuite.tar.xz )
-)"
-S="${WORKDIR}"/${GHC_P}
-
-[[ -n $arch_binaries ]] && SRC_URI+=" !ghcbootstrap? ( $arch_binaries )"
-
-BUMP_LIBRARIES=(
- # "hackage-name hackage-version"
- "process 1.6.16.0"
-)
-
-LICENSE="BSD"
-SLOT="0/${PV}"
-KEYWORDS="~amd64 ~x86"
-IUSE="big-endian doc elfutils ghcbootstrap ghcmakebinary +gmp numa profile test"
-IUSE+=" binary"
-RESTRICT="!test? ( test )"
-
-RDEPEND="
- >=dev-lang/perl-5.6.1
- dev-libs/gmp:0=
- sys-libs/ncurses:=[unicode(+)]
- elfutils? ( dev-libs/elfutils )
- !ghcmakebinary? ( dev-libs/libffi:=[-exec-static-trampoline] )
- numa? ( sys-process/numactl )
-"
-
-# This set of dependencies is needed to run
-# prebuilt ghc. We specifically avoid ncurses
-# dependency with:
-# utils/ghc-pkg_HC_OPTS += -DBOOTSTRAPPING
-PREBUILT_BINARY_DEPENDS="
- !prefix? ( elibc_glibc? ( >=sys-libs/glibc-2.17 ) )
-"
-# This set of dependencies is needed to install
-# ghc[binary] in system. terminfo package is linked
-# against ncurses.
-PREBUILT_BINARY_RDEPENDS="${PREBUILT_BINARY_DEPENDS}
- sys-libs/ncurses:0/6
-"
-
-RDEPEND+="binary? ( ${PREBUILT_BINARY_RDEPENDS} )"
-
-DEPEND="${RDEPEND}"
-BDEPEND="
- virtual/pkgconfig
- doc? ( app-text/docbook-xml-dtd:4.2
- app-text/docbook-xml-dtd:4.5
- app-text/docbook-xsl-stylesheets
- dev-python/sphinx
- >=dev-libs/libxslt-1.1.2 )
- !ghcbootstrap? ( ${PREBUILT_BINARY_DEPENDS} )
- test? ( ${PYTHON_DEPS} )
-"
-
-needs_python() {
- # test driver is written in python
- use test && return 0
- return 1
-}
-
-# we build binaries without profiling support
-REQUIRED_USE="
- ?? ( ghcbootstrap binary )
- ?? ( profile binary )
-"
-
-# haskell libraries built with cabal in configure mode, #515354
-QA_CONFIGURE_OPTIONS+=" --with-compiler --with-gcc"
-
-is_crosscompile() {
- [[ ${CHOST} != ${CTARGET} ]]
-}
-
-is_native() {
- [[ ${CHOST} == ${CBUILD} ]] && [[ ${CHOST} == ${CTARGET} ]]
-}
-
-if ! is_crosscompile; then
- PDEPEND="!ghcbootstrap? ( >=app-admin/haskell-updater-1.2 )"
-fi
-
-# returns tool prefix for crosscompiler.
-# Example:
-# CTARGET=armv7a-unknown-linux-gnueabi
-# CHOST=x86_64-pc-linux-gnu
-# "armv7a-unknown-linux-gnueabi-"
-# CTARGET=${CHOST}
-# ""
-# Used in tools and library prefix:
-# "${ED}"/usr/bin/$(cross)haddock
-# "${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
-
-cross() {
- if is_crosscompile; then
- echo "${CTARGET}-"
- else
- echo ""
- fi
-}
-
-append-ghc-cflags() {
- local persistent compile assemble link
- local flag ghcflag
-
- for flag in $*; do
- case ${flag} in
- persistent) persistent="yes";;
- compile) compile="yes";;
- assemble) assemble="yes";;
- link) link="yes";;
- *)
- [[ ${compile} ]] && ghcflag="-optc${flag}" CFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
- [[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
- [[ ${assemble} ]] && ghcflag="-opta${flag}" CFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
- [[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
- [[ ${link} ]] && ghcflag="-optl${flag}" LDFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
- [[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
- ;;
- esac
- done
-}
-
-# $1 - lib name (under libraries/)
-# $2 - lib version
-# example: bump_lib "transformers" "0.4.2.0"
-bump_lib() {
- local pn=$1 pv=$2
- local p=${pn}-${pv}
- local f
-
- einfo "Bumping ${pn} up to ${pv}"
-
- for f in ghc.mk GNUmakefile; do
- mv libraries/"${pn}"/$f "${WORKDIR}"/"${p}"/$f || die
- done
- mv libraries/"${pn}" "${WORKDIR}"/"${pn}".old || die
- mv "${WORKDIR}"/"${p}" libraries/"${pn}" || die
-}
-
-update_SRC_URI() {
- local p pn pv
- for p in "${BUMP_LIBRARIES[@]}"; do
- set -- $p
- pn=$1 pv=$2
-
- SRC_URI+=" https://hackage.haskell.org/package/${pn}-${pv}/${pn}-${pv}.tar.gz"
- done
-}
-
-update_SRC_URI
-
-bump_libs() {
- local p pn pv
- for p in "${BUMP_LIBRARIES[@]}"; do
- set -- $p
- pn=$1 pv=$2
-
- bump_lib "${pn}" "${pv}"
- done
-}
-
-ghc_setup_cflags() {
- # TODO: plumb CFLAGS and BUILD_CFLAGS to respective CONF_CC_OPTS_STAGE<N>
- if ! is_native; then
- export CFLAGS=${GHC_CFLAGS-"-O2 -pipe"}
- export LDFLAGS=${GHC_LDFLAGS-"-Wl,-O1"}
- einfo "Crosscompiling mode:"
- einfo " CHOST: ${CHOST}"
- einfo " CTARGET: ${CTARGET}"
- einfo " CFLAGS: ${CFLAGS}"
- einfo " LDFLAGS: ${LDFLAGS}"
- einfo " prefix: $(cross)"
- return
- fi
- # We need to be very careful with the CFLAGS we ask ghc to pass through to
- # gcc. There are plenty of flags which will make gcc produce output that
- # breaks ghc in various ways. The main ones we want to pass through are
- # -mcpu / -march flags. These are important for arches like alpha & sparc.
- # We also use these CFLAGS for building the C parts of ghc, ie the rts.
- strip-flags
- strip-unsupported-flags
-
- # Cmm can't parse line numbers #482086
- replace-flags -ggdb[3-9] -ggdb2
-
- GHC_FLAGS=""
- GHC_PERSISTENT_FLAGS=""
- for flag in ${CFLAGS}; do
- case ${flag} in
-
- # Ignore extra optimisation (ghc passes -O to gcc anyway)
- # -O2 and above break on too many systems
- -O*) ;;
-
- # Arch and ABI flags are what we're really after
- -m*) append-ghc-cflags compile assemble ${flag};;
-
- # Sometimes it's handy to see backtrace of RTS
- # to get an idea what happens there
- -g*) append-ghc-cflags compile ${flag};;
-
- # Ignore all other flags, including all -f* flags
- esac
- done
-
- for flag in ${LDFLAGS}; do
- append-ghc-cflags link ${flag}
- done
-
- # GHC uses ${CBUILD}-gcc, ${CHOST}-gcc and ${CTARGET}-gcc at a single build.
- # Skip any gentoo-specific tweaks for cross-case to avoid passing unsupported
- # options to gcc.
- if is_native; then
- # prevent from failing to build unregisterised ghc:
- # https://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg171602.html
- use ppc64 && append-ghc-cflags persistent compile -mminimal-toc
- fi
-}
-
-# substitutes string $1 to $2 in files $3 $4 ...
-relocate_path() {
- local from=$1
- local to=$2
- shift 2
- local file=
- for file in "$@"
- do
- sed -i -e "s|$from|$to|g" \
- "$file" || die "path relocation failed for '$file'"
- done
-}
-
-# changes hardcoded ghc paths and updates package index
-# $1 - new absolute root path
-relocate_ghc() {
- local to=$1 ghc_v=${BIN_PV}
-
- # libdir for prebuilt binary and for current system may mismatch
- # It does for prefix installation for example: bug #476998
- local bin_ghc_prefix=${WORKDIR}/usr
- local bin_libpath=$(echo "${bin_ghc_prefix}"/lib*)
- local bin_libdir=${bin_libpath#${bin_ghc_prefix}/}
-
- # backup original script to use it later after relocation
- local gp_back="${T}/ghc-pkg-${ghc_v}-orig"
- cp "${WORKDIR}/usr/bin/ghc-pkg-${ghc_v}" "$gp_back" || die "unable to backup ghc-pkg wrapper"
-
- if [[ ${bin_libdir} != $(get_libdir) ]]; then
- einfo "Relocating '${bin_libdir}' to '$(get_libdir)' (bug #476998)"
- # moving the dir itself is not strictly needed
- # but then USE=binary would result in installing
- # in '${bin_libdir}'
- mv "${bin_ghc_prefix}/${bin_libdir}" "${bin_ghc_prefix}/$(get_libdir)" || die
-
- relocate_path "/usr/${bin_libdir}" "/usr/$(get_libdir)" \
- "${WORKDIR}/usr/bin/ghc-${ghc_v}" \
- "${WORKDIR}/usr/bin/ghci-${ghc_v}" \
- "${WORKDIR}/usr/bin/ghc-pkg-${ghc_v}" \
- "${WORKDIR}/usr/bin/hsc2hs" \
- "${WORKDIR}/usr/bin/runghc-${ghc_v}" \
- "$gp_back" \
- "${WORKDIR}/usr/$(get_libdir)/${PN}-${ghc_v}/package.conf.d/"*
- fi
-
- # Relocate from /usr to ${EPREFIX}/usr
- relocate_path "/usr" "${to}/usr" \
- "${WORKDIR}/usr/bin/ghc-${ghc_v}" \
- "${WORKDIR}/usr/bin/ghci-${ghc_v}" \
- "${WORKDIR}/usr/bin/ghc-pkg-${ghc_v}" \
- "${WORKDIR}/usr/bin/haddock-ghc-${ghc_v}" \
- "${WORKDIR}/usr/bin/hp2ps" \
- "${WORKDIR}/usr/bin/hpc" \
- "${WORKDIR}/usr/bin/hsc2hs" \
- "${WORKDIR}/usr/bin/runghc-${ghc_v}" \
- "${WORKDIR}/usr/$(get_libdir)/${PN}-${ghc_v}/package.conf.d/"*
-
- # this one we will use to regenerate cache
- # so it should point to current tree location
- relocate_path "/usr" "${WORKDIR}/usr" "$gp_back"
-
- if use prefix; then
- hprefixify "${bin_libpath}"/${PN}*/settings
- fi
-
- # regenerate the binary package cache
- "$gp_back" recache || die "failed to update cache after relocation"
- rm "$gp_back"
-}
-
-ghc-check-reqs() {
- # These are pessimistic values (slightly bigger than worst-case)
- # Worst case is UNREG USE=profile ia64. See bug #611866 for some
- # numbers on various arches.
- CHECKREQS_DISK_BUILD=8G
- CHECKREQS_DISK_USR=2G
- # USE=binary roughly takes
- use binary && CHECKREQS_DISK_BUILD=4G
-
- "$@"
-}
-
-pkg_pretend() {
- ghc-check-reqs check-reqs_pkg_pretend
-}
-
-pkg_setup() {
- ghc-check-reqs check-reqs_pkg_setup
-
- # quiet portage about prebuilt binaries
- use binary && QA_PREBUILT="*"
-
- [[ ${MERGE_TYPE} == binary ]] && return
-
- if use ghcbootstrap; then
- ewarn "You requested ghc bootstrapping, this is usually only used"
- ewarn "by Gentoo developers to make binary .tbz2 packages."
-
- [[ -z $(type -P ghc) ]] && \
- die "Could not find a ghc to bootstrap with."
- else
- if ! yet_binary; then
- eerror "Please try emerging with USE=ghcbootstrap and report build"
- eerror "sucess or failure to the haskell team (haskell@gentoo.org)"
- die "No binary available for '${ARCH}' arch yet, USE=ghcbootstrap"
- fi
- fi
-
- if needs_python; then
- python-any-r1_pkg_setup
- fi
-}
-
-src_unpack() {
- # Create the ${S} dir if we're using the binary version
- use binary && mkdir "${S}"
-
- # the Solaris and Darwin binaries from ghc (maeder) need to be
- # unpacked separately, so prevent them from being unpacked
- local ONLYA=${A}
- case ${CHOST} in
- *-darwin* | *-solaris*) ONLYA=${GHC_P}-src.tar.xz ;;
- esac
- unpacker ${ONLYA}
-}
-
-src_prepare() {
- # Force the use of C.utf8 locale
- # <https://github.com/gentoo-haskell/gentoo-haskell/issues/1287>
- # <https://github.com/gentoo-haskell/gentoo-haskell/issues/1289>
- export LC_ALL=C.utf8
-
- ghc_setup_cflags
-
- if ! use ghcbootstrap; then
- # The switch to gpkg binaries means that they are unpacked in the wrong
- # location. They are now unnpacked in the $orig_bindir and need to be
- # moved so that usr/ is in $WORKDIR.
- local orig_bindir="${WORKDIR}/${PN}-${BIN_PV}${BIN_REV:+-${BIN_REV}}"
- mv -v "${orig_bindir}/image/usr" "${WORKDIR}" || die
-
- if [[ ${CHOST} != *-darwin* && ${CHOST} != *-solaris* ]]; then
- # Modify the wrapper script from the binary tarball to use GHC_PERSISTENT_FLAGS.
- # See bug #313635.
- sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_PERSISTENT_FLAGS}|" \
- "${WORKDIR}/usr/bin/ghc-${BIN_PV}"
-
- # allow hardened users use vanilla binary to bootstrap ghc
- # ghci uses mmap with rwx protection at it implements dynamic
- # linking on it's own (bug #299709)
- pax-mark -m "${WORKDIR}/usr/$(get_libdir)/${PN}-${BIN_PV}/bin/ghc"
- fi
- fi
-
- if use binary; then
- if use prefix; then
- relocate_ghc "${EPREFIX}"
- fi
-
- # Move unpacked files to the expected place
- mv "${WORKDIR}/usr" "${S}"
- eapply_user
- else
- if ! use ghcbootstrap; then
- case ${CHOST} in
- *-darwin* | *-solaris*)
- # UPDATE ME for ghc-7
- mkdir "${WORKDIR}"/ghc-bin-installer || die
- pushd "${WORKDIR}"/ghc-bin-installer > /dev/null || die
- use x64-macos && unpack ghc-7.4.1-x86_64-apple-darwin.tar.bz2
- popd > /dev/null
-
- pushd "${WORKDIR}"/ghc-bin-installer/ghc-[67].?*.? > /dev/null || die
- # fix the binaries so they run, on Solaris we need an
- # LD_LIBRARY_PATH which has our prefix libdirs, on
- # Darwin we need to replace the frameworks with our libs
- # from the prefix fix before installation, because some
- # of the tools are actually used during configure/make
- if [[ ${CHOST} == *-solaris* ]] ; then
- export LD_LIBRARY_PATH="${EPREFIX}/$(get_libdir):${EPREFIX}/usr/$(get_libdir):${LD_LIBRARY_PATH}"
- elif [[ ${CHOST} == *-darwin* ]] ; then
- local readline_framework=GNUreadline.framework/GNUreadline
- local gmp_framework=/opt/local/lib/libgmp.10.dylib
- local ncurses_file=/opt/local/lib/libncurses.5.dylib
- for binary in $(scanmacho -BRE MH_EXECUTE -F '%F' .) ; do
- install_name_tool -change \
- ${readline_framework} \
- "${EPREFIX}"/lib/libreadline.dylib \
- ${binary} || die
- install_name_tool -change \
- ${gmp_framework} \
- "${EPREFIX}"/usr/lib/libgmp.dylib \
- ${binary} || die
- install_name_tool -change \
- ${ncurses_file} \
- "${EPREFIX}"/usr/lib/libncurses.dylib \
- ${binary} || die
- done
- # we don't do frameworks!
- sed -i \
- -e 's/\(frameworks = \)\["GMP"\]/\1[]/g' \
- -e 's/\(extraLibraries = \)\["m"\]/\1["m","gmp"]/g' \
- rts/package.conf.in || die
- fi
-
- # it is autoconf, but we really don't want to give it too
- # many arguments, in fact we do the make in-place anyway
- ./configure --prefix="${WORKDIR}"/usr || die
- make install || die
- popd > /dev/null
- ;;
- *)
- relocate_ghc "${WORKDIR}"
- ;;
- esac
- fi
-
- sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_PERSISTENT_FLAGS}|" \
- "${S}/ghc/ghc.wrapper"
-
- cd "${S}" # otherwise eapply will break
-
- eapply "${FILESDIR}"/${PN}-7.0.4-CHOST-prefix.patch
- eapply "${FILESDIR}"/${PN}-8.2.1-darwin.patch
- eapply "${FILESDIR}"/${PN}-7.8.3-prim-lm.patch
- eapply "${FILESDIR}"/${PN}-8.8.1-revert-CPP.patch
- eapply "${FILESDIR}"/${PN}-8.10.1-allow-cross-bootstrap.patch
- eapply "${FILESDIR}"/${PN}-8.10.5-modorigin-verbose-conflict.patch
- eapply "${FILESDIR}"/${PN}-8.10.6-aclocal.patch
- eapply "${FILESDIR}"/${PN}-9.0.2-sphinx-6.patch
-
- # a bunch of crosscompiler patches
- # needs newer version:
- #eapply "${FILESDIR}"/${PN}-8.2.1_rc1-hp2ps-cross.patch
-
- # mingw32 target
- pushd "${S}/libraries/Win32"
- eapply "${FILESDIR}"/${PN}-8.2.1_rc1-win32-cross-2-hack.patch # bad workaround
- popd
-
- bump_libs
-
- eapply_user
- # as we have changed the build system
- eautoreconf
- fi
-}
-
-src_configure() {
- if ! use binary; then
- # initialize build.mk
- echo '# Gentoo changes' > mk/build.mk
-
- # Put docs into the right place, ie /usr/share/doc/ghc-${GHC_PV}
- echo "docdir = ${EPREFIX}/usr/share/doc/$(cross)${PF}" >> mk/build.mk
- echo "htmldir = ${EPREFIX}/usr/share/doc/$(cross)${PF}" >> mk/build.mk
-
- # We also need to use the GHC_FLAGS flags when building ghc itself
- echo "SRC_HC_OPTS+=${HCFLAGS} ${GHC_FLAGS}" >> mk/build.mk
- echo "SRC_CC_OPTS+=${CFLAGS}" >> mk/build.mk
- echo "SRC_LD_OPTS+=${LDFLAGS}" >> mk/build.mk
- # Speed up initial Cabal bootstrap
- echo "utils/ghc-cabal_dist_EXTRA_HC_OPTS+=$(ghc-make-args)" >> mk/build.mk
-
- # We can't depend on haddock except when bootstrapping when we
- # must build docs and include them into the binary .tbz2 package
- # app-text/dblatex is not in portage, can not build PDF or PS
- echo "BUILD_SPHINX_PDF = NO" >> mk/build.mk
- echo "BUILD_SPHINX_HTML = $(usex doc YES NO)" >> mk/build.mk
- echo "BUILD_MAN = $(usex doc YES NO)" >> mk/build.mk
-
- # this controls presence on 'xhtml' and 'haddock' in final install
- echo "HADDOCK_DOCS = YES" >> mk/build.mk
-
- # not used outside of ghc's test
- if [[ -n ${GHC_BUILD_DPH} ]]; then
- echo "BUILD_DPH = YES" >> mk/build.mk
- else
- echo "BUILD_DPH = NO" >> mk/build.mk
- fi
-
- # Any non-native build has to skip as it needs
- # target haddock binary to be runnabine.
- if ! is_native; then
- # disable docs generation as it requires running stage2
- echo "HADDOCK_DOCS=NO" >> mk/build.mk
- echo "BUILD_SPHINX_HTML=NO" >> mk/build.mk
- echo "BUILD_SPHINX_PDF=NO" >> mk/build.mk
- fi
-
- if is_crosscompile; then
- # Install ghc-stage1 crosscompiler instead of
- # ghc-stage2 cross-built compiler.
- echo "Stage1Only=YES" >> mk/build.mk
- fi
-
- # allows overriding build flavours for libraries:
- # v - vanilla (static libs)
- # p - profiled
- # dyn - shared libraries
- # example: GHC_LIBRARY_WAYS="v dyn"
- if [[ -n ${GHC_LIBRARY_WAYS} ]]; then
- echo "GhcLibWays=${GHC_LIBRARY_WAYS}" >> mk/build.mk
- fi
- echo "BUILD_PROF_LIBS = $(usex profile YES NO)" >> mk/build.mk
-
- # Get ghc from the unpacked binary .tbz2
- # except when bootstrapping we just pick ghc up off the path
- if ! use ghcbootstrap; then
- export PATH="${WORKDIR}/usr/bin:${PATH}"
- fi
-
- echo "INTEGER_LIBRARY = $(usex gmp integer-gmp integer-simple)" >> mk/build.mk
-
- # don't strip anything. Very useful when stage2 SIGSEGVs on you
- echo "STRIP_CMD = :" >> mk/build.mk
-
- local econf_args=()
-
- # GHC embeds toolchain it was built by and uses it later.
- # Don't allow things like ccache or versioned binary slip.
- # We use stable thing across gcc upgrades.
- # User can use EXTRA_ECONF=CC=... to override this default.
- econf_args+=(
- AR=${CTARGET}-ar
- CC=${CTARGET}-gcc
- # these should be inferred by GHC but ghc defaults
- # to using bundled tools on windows.
- Windres=${CTARGET}-windres
- DllWrap=${CTARGET}-dllwrap
- # we set the linker explicitly below
- --disable-ld-override
- )
- case ${CTARGET} in
- arm*)
- # ld.bfd-2.28 does not work for ghc. Force ld.gold
- # instead. This should be removed once gentoo gets
- # a fix for R_ARM_COPY bug: https://sourceware.org/PR16177
- econf_args+=(LD=${CTARGET}-ld.gold)
- ;;
- sparc*)
- # ld.gold-2.28 does not work for ghc. Force ld.bfd
- # instead. This should be removed once gentoo gets
- # a fix for missing --no-relax support bug:
- # https://sourceware.org/ml/binutils/2017-07/msg00183.html
- econf_args+=(LD=${CTARGET}-ld.bfd)
- ;;
- *)
- econf_args+=(LD=${CTARGET}-ld)
- esac
-
- if [[ ${CBUILD} != ${CHOST} ]]; then
- # GHC bug: ghc claims not to support cross-building.
- # It does, but does not distinct --host= value
- # for stage1 and stage2 compiler.
- econf_args+=(--host=${CBUILD})
- fi
-
- if use ghcmakebinary; then
- # When building booting libary we are trying to
- # bundle or restrict most of external depends
- # with unstable ABI:
- # - embed libffi (default GHC behaviour)
- # - disable ncurses support for ghci (via haskeline)
- # https://bugs.gentoo.org/557478
- # - disable ncurses support for ghc-pkg
- echo "libraries/haskeline_CONFIGURE_OPTS += --flag=-terminfo" >> mk/build.mk
- echo "utils/ghc-pkg_HC_OPTS += -DBOOTSTRAPPING" >> mk/build.mk
- elif is_native; then
- # using ${GTARGET}'s libffi is not supported yet:
- # GHC embeds full path for ffi includes without /usr/${CTARGET} account.
- econf_args+=(--with-system-libffi)
- econf_args+=(--with-ffi-includes=$($(tc-getPKG_CONFIG) libffi --cflags-only-I | sed -e 's@^-I@@'))
- fi
-
- einfo "Final mk/build.mk:"
- cat mk/build.mk || die
-
- econf ${econf_args[@]} \
- --enable-bootstrap-with-devel-snapshot \
- $(use_enable elfutils dwarf-unwind) \
- $(use_enable numa)
-
- if [[ ${PV} == *9999* ]]; then
- GHC_PV="$(grep 'S\[\"PACKAGE_VERSION\"\]' config.status | sed -e 's@^.*=\"\(.*\)\"@\1@')"
- GHC_P=${PN}-${GHC_PV}
- fi
- fi # ! use binary
-}
-
-src_compile() {
- if ! use binary; then
- # Stage1Only crosscompiler does not build stage2
- if ! is_crosscompile; then
- # 1. build/pax-mark compiler binary first
- emake ghc/stage2/build/tmp/ghc-stage2
- # 2. pax-mark (bug #516430)
- pax-mark -m ghc/stage2/build/tmp/ghc-stage2
- # 2. build/pax-mark haddock using ghc-stage2
- if is_native; then
- # non-native build does not build haddock
- # due to HADDOCK_DOCS=NO, but it could.
- emake utils/haddock/dist/build/tmp/haddock
- pax-mark -m utils/haddock/dist/build/tmp/haddock
- fi
- fi
- # 3. and then all the rest
- emake all
- fi # ! use binary
-}
-
-src_test() {
- # TODO: deal with:
- # - sandbox (pollutes environment)
- # - extra packages (to extend testsuite coverage)
- # bits are taken from 'validate'
- local make_test_target='test' # can be fulltest
- # not 'emake' as testsuite uses '$MAKE' without jobserver available
- make $make_test_target stage=2 THREADS=$(makeopts_jobs)
-}
-
-src_install() {
- if use binary; then
- use prefix && mkdir -p "${ED}"
- mv "${S}/usr" "${ED}"
- else
- [[ -f VERSION ]] || emake VERSION
-
- # -j1 due to a rare race in install script:
- # make --no-print-directory -f ghc.mk phase=final install
- # /usr/lib/portage/python3.4/ebuild-helpers/xattr/install -c -m 755 \
- # -d "/tmp/portage-tmpdir/portage/cross-armv7a-unknown-linux-gnueabi/ghc-9999/image/usr/lib64/armv7a-unknown-linux-gnueabi-ghc-8.3.20170404/include"
- # /usr/lib/portage/python3.4/ebuild-helpers/xattr/install -c -m 644 utils/hsc2hs/template-hsc.h \
- # "/tmp/portage-tmpdir/portage/cross-armv7a-unknown-linux-gnueabi/ghc-9999/image/usr/lib64/armv7a-unknown-linux-gnueabi-ghc-8.3.20170404"
- # /usr/bin/install: cannot create regular file \
- # '/tmp/portage-tmpdir/portage/cross-armv7a-unknown-linux-gnueabi/ghc-9999/image/usr/lib64/armv7a-unknown-linux-gnueabi-ghc-8.3.20170404': No such file or directory
- emake -j1 install DESTDIR="${D}"
-
- # Skip for cross-targets as they all share target location:
- # /usr/share/doc/ghc-9999/
- if ! is_crosscompile; then
- dodoc "distrib/README" "LICENSE" "VERSION"
- fi
-
- # rename ghc-shipped files to avoid collision
- # of external packages. Motivating example:
- # user had installed:
- # dev-lang/ghc-7.8.4-r0 (with transformers-0.3.0.0)
- # dev-haskell/transformers-0.4.2.0
- # then user tried to update to
- # dev-lang/ghc-7.8.4-r1 (with transformers-0.4.2.0)
- # this will lead to single .conf file collision.
- local shipped_conf renamed_conf
- local package_confdir="${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
- for shipped_conf in "${package_confdir}"/*.conf; do
- # rename 'pkg-ver-id.conf' to 'pkg-ver-id-gentoo-${PF}.conf'
- renamed_conf=${shipped_conf%.conf}-gentoo-${PF}.conf
- mv "${shipped_conf}" "${renamed_conf}" || die
- done
-
- # remove link, but leave 'haddock-${GHC_P}'
- rm -f "${ED}"/usr/bin/$(cross)haddock
-
- if ! is_crosscompile; then
- newbashcomp "${FILESDIR}"/ghc-bash-completion ghc-pkg
- newbashcomp utils/completion/ghc.bash ghc
- fi
- fi
-
- # path to the package.cache
- local package_confdir="${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
- PKGCACHE="${package_confdir}"/package.cache
- # copy the package.conf.d, including timestamp, save it so we can help
- # users that have a broken package.conf.d
- cp -pR "${package_confdir}"{,.initial} || die "failed to backup intial package.conf.d"
-
- # copy the package.conf, including timestamp, save it so we later can put it
- # back before uninstalling, or when upgrading.
- cp -p "${PKGCACHE}"{,.shipped} \
- || die "failed to copy package.conf.d/package.cache"
-
- if is_crosscompile; then
- # When we build a cross-compiler the layout is the following:
- # usr/lib/${CTARGET}-ghc-${VER}/ contains target libraries
- # but
- # usr/lib/${CTARGET}-ghc-${VER}/bin/ directory
- # containst host binaries (modulo bugs).
-
- # Portage's stripping mechanism does not skip stripping
- # foreign binaries. This frequently causes binaries to be
- # broken.
- #
- # Thus below we disable stripping of target libraries and allow
- # stripping hosts executables.
- dostrip -x "/usr/$(get_libdir)/$(cross)${GHC_P}"
- dostrip "/usr/$(get_libdir)/$(cross)${GHC_P}/bin"
- fi
-}
-
-pkg_preinst() {
- # have we got an earlier version of ghc installed?
- if has_version "<${CATEGORY}/${PF}"; then
- haskell_updater_warn="1"
- fi
-}
-
-pkg_postinst() {
- ghc-reregister
-
- # path to the package.cache
- PKGCACHE="${EROOT}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d/package.cache"
-
- # give the cache a new timestamp, it must be as recent as
- # the package.conf.d directory.
- touch "${PKGCACHE}"
-
- if [[ "${haskell_updater_warn}" == "1" ]]; then
- ewarn
- ewarn "\e[1;31m************************************************************************\e[0m"
- ewarn
- ewarn "You have just upgraded from an older version of GHC."
- ewarn "You may have to run"
- ewarn " 'haskell-updater'"
- ewarn "to rebuild all ghc-based Haskell libraries."
- ewarn
- ewarn "\e[1;31m************************************************************************\e[0m"
- ewarn
- fi
-}
-
-pkg_prerm() {
- PKGCACHE="${EROOT}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d/package.cache"
- rm -rf "${PKGCACHE}"
-
- cp -p "${PKGCACHE}"{.shipped,}
-}
-
-pkg_postrm() {
- ghc-package_pkg_postrm
-}
diff --git a/dev-lang/ghc/ghc-9.0.2-r3.ebuild b/dev-lang/ghc/ghc-9.0.2-r3.ebuild
deleted file mode 100644
index 6adec687c250..000000000000
--- a/dev-lang/ghc/ghc-9.0.2-r3.ebuild
+++ /dev/null
@@ -1,898 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-# to make make a crosscompiler use crossdev and symlink ghc tree into
-# cross overlay. result would look like 'cross-sparc-unknown-linux-gnu/ghc'
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} = ${CHOST} ]] ; then
- if [[ ${CATEGORY/cross-} != ${CATEGORY} ]] ; then
- export CTARGET=${CATEGORY/cross-}
- fi
-fi
-
-PYTHON_COMPAT=( python3_{9..12} )
-inherit python-any-r1
-inherit autotools bash-completion-r1 flag-o-matic ghc-package
-inherit multiprocessing pax-utils toolchain-funcs prefix
-inherit check-reqs llvm
-DESCRIPTION="The Glasgow Haskell Compiler"
-HOMEPAGE="https://www.haskell.org/ghc/"
-
-# we don't have any binaries yet
-arch_binaries=""
-
-BIN_PV=${PV}
-
-# Differentiate glibc/musl
-
-#glibc_binaries="$glibc_binaries alpha? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-alpha.tbz2 )"
-glibc_binaries="$glibc_binaries amd64? ( https://eidetic.codes/ghc-bin-${PV}-x86_64-pc-linux-gnu-r1.tbz2 )"
-#glibc_binaries="$glibc_binaries arm? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-armv7a-hardfloat-linux-gnueabi.tbz2 )"
-glibc_binaries="$glibc_binaries arm64? ( https://github.com/matoro/ghc/releases/download/${PV}/ghc-bin-${PV}-aarch64-unknown-linux-gnu.tar.gz )"
-#glibc_binaries="$glibc_binaries ia64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ia64-fixed-fiw.tbz2 )"
-#glibc_binaries="$glibc_binaries ppc? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ppc.tbz2 )"
-#glibc_binaries="$glibc_binaries ppc64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ppc64.tbz2 )"
-glibc_binaries="$glibc_binaries ppc64? (
- big-endian? ( https://github.com/matoro/ghc/releases/download/${PV}/ghc-bin-${PV}-powerpc64-unknown-linux-gnu.tar.gz )
- !big-endian? ( https://github.com/matoro/ghc/releases/download/${PV}/ghc-bin-${PV}-powerpc64le-unknown-linux-gnu.tar.gz )
-)"
-glibc_binaries="$glibc_binaries riscv? ( https://github.com/matoro/ghc/releases/download/${PV}/ghc-bin-${PV}-riscv64-unknown-linux-gnu.tar.gz )"
-#glibc_binaries="$glibc_binaries sparc? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-sparc.tbz2 )"
-glibc_binaries="$glibc_binaries x86? ( https://eidetic.codes/ghc-bin-${PV}-i686-pc-linux-gnu.tbz2 )"
-
-#musl_binaries="$musl_binaries alpha? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-alpha.tbz2 )"
-#musl_binaries="$musl_binaries amd64? ( https://eidetic.codes/ghc-bin-${PV}-x86_64-pc-linux-musl.tbz2 )"
-#musl_binaries="$musl_binaries arm? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-armv7a-hardfloat-linux-musl.tbz2 )"
-#musl_binaries="$musl_binaries arm64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-aarch64-unknown-linux-musl.tbz2 )"
-#musl_binaries="$musl_binaries ia64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ia64-fixed-fiw.tbz2 )"
-#musl_binaries="$musl_binaries ppc? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ppc.tbz2 )"
-#musl_binaries="$musl_binaries ppc64? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-ppc64.tbz2 )"
-#musl_binaries="$musl_binaries ppc64? ( !big-endian? ( https://github.com/matoro/ghc/releases/download/${PV}/ghc-bin-${PV}-powerpc64le-unknown-linux-musl.tar.gz ) )"
-#musl_binaries="$musl_binaries riscv? ( https://github.com/matoro/ghc/releases/download/${PV}/ghc-bin-${PV}-riscv64-unknown-linux-musl.tar.gz )"
-#musl_binaries="$musl_binaries sparc? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-sparc.tbz2 )"
-#musl_binaries="$musl_binaries x86? ( https://eidetic.codes/ghc-bin-${PV}-i686-pc-linux-musl.tbz2 )"
-
-[[ -n $glibc_binaries ]] && arch_binaries="$arch_binaries elibc_glibc? ( $glibc_binaries )"
-[[ -n $musl_binaries ]] && arch_binaries="$arch_binaries elibc_musl? ( $musl_binaries )"
-
-# various ports:
-#arch_binaries="$arch_binaries x86-fbsd? ( https://slyfox.uni.cx/~slyfox/distfiles/ghc-bin-${PV}-x86-fbsd.tbz2 )"
-
-# 0 - yet
-yet_binary() {
- case "${ELIBC}" in
- glibc)
- case "${ARCH}" in
- #alpha) return 0 ;;
- arm64) return 0 ;;
- #arm) return 0 ;;
- amd64) return 0 ;;
- #ia64) return 0 ;;
- #ppc) return 0 ;;
- ppc64) return 0 ;;
- riscv) return 0 ;;
- #sparc) return 0 ;;
- x86) return 0 ;;
- *) return 1 ;;
- esac
- ;;
- musl)
- case "${ARCH}" in
- #alpha) return 0 ;;
- #arm64) return 0 ;;
- #arm) return 0 ;;
- #amd64) return 0 ;;
- #ia64) return 0 ;;
- #ppc) return 0 ;;
- #ppc64)
- # use big-endian || return 0
- # ;;
- #riscv) return 0 ;;
- #sparc) return 0 ;;
- #x86) return 0 ;;
- *) return 1 ;;
- esac
- ;;
- esac
-}
-
-GHC_PV=${PV}
-#GHC_PV=8.10.0.20200123 # uncomment only for -alpha, -beta, -rc ebuilds
-GHC_P=${PN}-${GHC_PV} # using ${P} is almost never correct
-
-SRC_URI="!binary? (
- https://downloads.haskell.org/ghc/${PV/_/-}/${GHC_P}-src.tar.xz
- test? ( https://downloads.haskell.org/ghc/${PV/_/-}/${GHC_P}-testsuite.tar.xz )
-)"
-SRC_URI+=" https://dev.gentoo.org/~sam/distfiles/${CATEGORY}/${PN}/${P}-riscv64-llvm.patch.xz"
-
-S="${WORKDIR}"/${GHC_P}
-
-[[ -n $arch_binaries ]] && SRC_URI+=" !ghcbootstrap? ( $arch_binaries )"
-
-BUMP_LIBRARIES=(
- # "hackage-name hackage-version"
-)
-
-LICENSE="BSD"
-SLOT="0/${PV}"
-KEYWORDS="~amd64 ~arm64 ~ppc64 ~riscv ~x86"
-IUSE="big-endian doc elfutils ghcbootstrap ghcmakebinary +gmp llvm numa profile test unregisterised"
-IUSE+=" binary"
-RESTRICT="!test? ( test )"
-
-LLVM_MAX_SLOT="14"
-RDEPEND="
- >=dev-lang/perl-5.6.1
- dev-libs/gmp:0=
- sys-libs/ncurses:=[unicode(+)]
- elfutils? ( dev-libs/elfutils )
- !ghcmakebinary? ( dev-libs/libffi:= )
- numa? ( sys-process/numactl )
- llvm? (
- <sys-devel/llvm-$((${LLVM_MAX_SLOT} + 1)):=
- || (
- sys-devel/llvm:14
- )
- )
-"
-
-# This set of dependencies is needed to run
-# prebuilt ghc. We specifically avoid ncurses
-# dependency with:
-# utils/ghc-pkg_HC_OPTS += -DBOOTSTRAPPING
-PREBUILT_BINARY_DEPENDS="
- !prefix? ( elibc_glibc? ( >=sys-libs/glibc-2.17 ) )
-"
-# This set of dependencies is needed to install
-# ghc[binary] in system. terminfo package is linked
-# against ncurses.
-PREBUILT_BINARY_RDEPENDS="${PREBUILT_BINARY_DEPENDS}
- sys-libs/ncurses:0/6
-"
-
-RDEPEND+="binary? ( ${PREBUILT_BINARY_RDEPENDS} )"
-
-DEPEND="${RDEPEND}"
-BDEPEND="
- virtual/pkgconfig
- doc? ( app-text/docbook-xml-dtd:4.2
- app-text/docbook-xml-dtd:4.5
- app-text/docbook-xsl-stylesheets
- dev-python/sphinx
- >=dev-libs/libxslt-1.1.2 )
- !ghcbootstrap? ( ${PREBUILT_BINARY_DEPENDS} )
- test? ( ${PYTHON_DEPS} )
-"
-
-needs_python() {
- # test driver is written in python
- use test && return 0
- return 1
-}
-
-# we build binaries without profiling support
-REQUIRED_USE="
- ?? ( ghcbootstrap binary )
- ?? ( profile binary )
- ?? ( llvm unregisterised )
-"
-
-# haskell libraries built with cabal in configure mode, #515354
-QA_CONFIGURE_OPTIONS+=" --with-compiler --with-gcc"
-
-is_crosscompile() {
- [[ ${CHOST} != ${CTARGET} ]]
-}
-
-is_native() {
- [[ ${CHOST} == ${CBUILD} ]] && [[ ${CHOST} == ${CTARGET} ]]
-}
-
-if ! is_crosscompile; then
- PDEPEND="!ghcbootstrap? ( >=app-admin/haskell-updater-1.2 )"
-fi
-
-# returns tool prefix for crosscompiler.
-# Example:
-# CTARGET=armv7a-unknown-linux-gnueabi
-# CHOST=x86_64-pc-linux-gnu
-# "armv7a-unknown-linux-gnueabi-"
-# CTARGET=${CHOST}
-# ""
-# Used in tools and library prefix:
-# "${ED}"/usr/bin/$(cross)haddock
-# "${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
-
-cross() {
- if is_crosscompile; then
- echo "${CTARGET}-"
- else
- echo ""
- fi
-}
-
-append-ghc-cflags() {
- local persistent compile assemble link
- local flag ghcflag
-
- for flag in $*; do
- case ${flag} in
- persistent) persistent="yes";;
- compile) compile="yes";;
- assemble) assemble="yes";;
- link) link="yes";;
- *)
- [[ ${compile} ]] && ghcflag="-optc${flag}" CFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
- [[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
- [[ ${assemble} ]] && ghcflag="-opta${flag}" CFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
- [[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
- [[ ${link} ]] && ghcflag="-optl${flag}" LDFLAGS+=" ${flag}" && GHC_FLAGS+=" ${ghcflag}" &&
- [[ ${persistent} ]] && GHC_PERSISTENT_FLAGS+=" ${ghcflag}"
- ;;
- esac
- done
-}
-
-# $1 - lib name (under libraries/)
-# $2 - lib version
-# example: bump_lib "transformers" "0.4.2.0"
-bump_lib() {
- local pn=$1 pv=$2
- local p=${pn}-${pv}
- local f
-
- einfo "Bumping ${pn} up to ${pv}"
-
- for f in ghc.mk GNUmakefile; do
- mv libraries/"${pn}"/$f "${WORKDIR}"/"${p}"/$f || die
- done
- mv libraries/"${pn}" "${WORKDIR}"/"${pn}".old || die
- mv "${WORKDIR}"/"${p}" libraries/"${pn}" || die
-}
-
-update_SRC_URI() {
- local p pn pv
- for p in "${BUMP_LIBRARIES[@]}"; do
- set -- $p
- pn=$1 pv=$2
-
- SRC_URI+=" https://hackage.haskell.org/package/${pn}-${pv}/${pn}-${pv}.tar.gz"
- done
-}
-
-update_SRC_URI
-
-bump_libs() {
- local p pn pv
- for p in "${BUMP_LIBRARIES[@]}"; do
- set -- $p
- pn=$1 pv=$2
-
- bump_lib "${pn}" "${pv}"
- done
-}
-
-ghc_setup_cflags() {
- # TODO: plumb CFLAGS and BUILD_CFLAGS to respective CONF_CC_OPTS_STAGE<N>
- if ! is_native; then
- export CFLAGS=${GHC_CFLAGS-"-O2 -pipe"}
- export LDFLAGS=${GHC_LDFLAGS-"-Wl,-O1"}
- einfo "Crosscompiling mode:"
- einfo " CHOST: ${CHOST}"
- einfo " CTARGET: ${CTARGET}"
- einfo " CFLAGS: ${CFLAGS}"
- einfo " LDFLAGS: ${LDFLAGS}"
- einfo " prefix: $(cross)"
- return
- fi
- # We need to be very careful with the CFLAGS we ask ghc to pass through to
- # gcc. There are plenty of flags which will make gcc produce output that
- # breaks ghc in various ways. The main ones we want to pass through are
- # -mcpu / -march flags. These are important for arches like alpha & sparc.
- # We also use these CFLAGS for building the C parts of ghc, ie the rts.
- strip-flags
- strip-unsupported-flags
-
- # Cmm can't parse line numbers #482086
- replace-flags -ggdb[3-9] -ggdb2
-
- GHC_FLAGS=""
- GHC_PERSISTENT_FLAGS=""
- for flag in ${CFLAGS}; do
- case ${flag} in
-
- # Ignore extra optimisation (ghc passes -O to gcc anyway)
- # -O2 and above break on too many systems
- -O*) ;;
-
- # Arch and ABI flags are what we're really after
- -m*) append-ghc-cflags compile assemble ${flag};;
-
- # Sometimes it's handy to see backtrace of RTS
- # to get an idea what happens there
- -g*) append-ghc-cflags compile ${flag};;
-
- # Ignore all other flags, including all -f* flags
- esac
- done
-
- for flag in ${LDFLAGS}; do
- append-ghc-cflags link ${flag}
- done
-}
-
-# substitutes string $1 to $2 in files $3 $4 ...
-relocate_path() {
- local from=$1
- local to=$2
- shift 2
- local file=
- for file in "$@"
- do
- sed -i -e "s|$from|$to|g" \
- "$file" || die "path relocation failed for '$file'"
- done
-}
-
-# changes hardcoded ghc paths and updates package index
-# $1 - new absolute root path
-relocate_ghc() {
- local to=$1 ghc_v=${BIN_PV}
-
- # libdir for prebuilt binary and for current system may mismatch
- # It does for prefix installation for example: bug #476998
- local bin_ghc_prefix=${WORKDIR}/usr
- local bin_libpath=$(echo "${bin_ghc_prefix}"/lib*)
- local bin_libdir=${bin_libpath#${bin_ghc_prefix}/}
-
- # backup original script to use it later after relocation
- local gp_back="${T}/ghc-pkg-${ghc_v}-orig"
- cp "${WORKDIR}/usr/bin/ghc-pkg-${ghc_v}" "$gp_back" || die "unable to backup ghc-pkg wrapper"
-
- if [[ ${bin_libdir} != $(get_libdir) ]]; then
- einfo "Relocating '${bin_libdir}' to '$(get_libdir)' (bug #476998)"
- # moving the dir itself is not strictly needed
- # but then USE=binary would result in installing
- # in '${bin_libdir}'
- mv "${bin_ghc_prefix}/${bin_libdir}" "${bin_ghc_prefix}/$(get_libdir)" || die
-
- relocate_path "/usr/${bin_libdir}" "/usr/$(get_libdir)" \
- "${WORKDIR}/usr/bin/ghc-${ghc_v}" \
- "${WORKDIR}/usr/bin/ghci-${ghc_v}" \
- "${WORKDIR}/usr/bin/ghc-pkg-${ghc_v}" \
- "${WORKDIR}/usr/bin/hsc2hs" \
- "${WORKDIR}/usr/bin/runghc-${ghc_v}" \
- "$gp_back" \
- "${WORKDIR}/usr/$(get_libdir)/${PN}-${ghc_v}/package.conf.d/"*
- fi
-
- # Relocate from /usr to ${EPREFIX}/usr
- relocate_path "/usr" "${to}/usr" \
- "${WORKDIR}/usr/bin/ghc-${ghc_v}" \
- "${WORKDIR}/usr/bin/ghci-${ghc_v}" \
- "${WORKDIR}/usr/bin/ghc-pkg-${ghc_v}" \
- "${WORKDIR}/usr/bin/haddock-ghc-${ghc_v}" \
- "${WORKDIR}/usr/bin/hp2ps" \
- "${WORKDIR}/usr/bin/hpc" \
- "${WORKDIR}/usr/bin/hsc2hs" \
- "${WORKDIR}/usr/bin/runghc-${ghc_v}" \
- "${WORKDIR}/usr/$(get_libdir)/${PN}-${ghc_v}/package.conf.d/"*
-
- # this one we will use to regenerate cache
- # so it should point to current tree location
- relocate_path "/usr" "${WORKDIR}/usr" "$gp_back"
-
- if use prefix; then
- hprefixify "${bin_libpath}"/${PN}*/settings
- fi
-
- # regenerate the binary package cache
- "$gp_back" recache || die "failed to update cache after relocation"
- rm "$gp_back"
-}
-
-ghc-check-reqs() {
- # These are pessimistic values (slightly bigger than worst-case)
- # Worst case is UNREG USE=profile ia64. See bug #611866 for some
- # numbers on various arches.
- CHECKREQS_DISK_BUILD=8G
- CHECKREQS_DISK_USR=2G
- # USE=binary roughly takes
- use binary && CHECKREQS_DISK_BUILD=4G
-
- "$@"
-}
-
-llvmize() {
- [[ -z "${1}" ]] && return
- ( find "${1}" -type f \
- | file -if- \
- | grep "text/x-shellscript" \
- | awk -F: '{print $1}' \
- | xargs sed -i "s#^exec #PATH=\"$(get_llvm_prefix "${LLVM_MAX_SLOT}")/bin:\${PATH}\" exec #") || die
-}
-
-pkg_pretend() {
- ghc-check-reqs check-reqs_pkg_pretend
-}
-
-pkg_setup() {
- ghc-check-reqs check-reqs_pkg_setup
-
- # quiet portage about prebuilt binaries
- use binary && QA_PREBUILT="*"
-
- [[ ${MERGE_TYPE} == binary ]] && return
-
- if use ghcbootstrap; then
- ewarn "You requested ghc bootstrapping, this is usually only used"
- ewarn "by Gentoo developers to make binary .tbz2 packages."
-
- [[ -z $(type -P ghc) ]] && \
- die "Could not find a ghc to bootstrap with."
- else
- if ! yet_binary; then
- eerror "Please try emerging with USE=ghcbootstrap and report build"
- eerror "sucess or failure to the haskell team (haskell@gentoo.org)"
- die "No binary available for '${ARCH}' arch yet, USE=ghcbootstrap"
- fi
- fi
-
- if needs_python; then
- python-any-r1_pkg_setup
- fi
-
- use llvm && llvm_pkg_setup
-}
-
-src_unpack() {
- # Create the ${S} dir if we're using the binary version
- use binary && mkdir "${S}"
-
- # the Solaris and Darwin binaries from ghc (maeder) need to be
- # unpacked separately, so prevent them from being unpacked
- local ONLYA=${A}
- case ${CHOST} in
- *-darwin* | *-solaris*) ONLYA=${GHC_P}-src.tar.xz ;;
- esac
- unpack ${ONLYA}
-}
-
-src_prepare() {
- # Force the use of C.utf8 locale
- # <https://github.com/gentoo-haskell/gentoo-haskell/issues/1287>
- # <https://github.com/gentoo-haskell/gentoo-haskell/issues/1289>
- export LC_ALL=C.utf8
-
- ghc_setup_cflags
-
- # ghc-9.0.2 release anomaly
- # https://www.mail-archive.com/search?l=ghc-devs@haskell.org&q=subject:%22Re%5C%3A+%5C%5BHaskell%5C%5D+%5C%5BANNOUNCE%5C%5D+GHC+9.0.2+released%22&o=newest&f=1
- # https://src.fedoraproject.org/rpms/ghc9.0/blob/rawhide/f/ghc9.0.spec#_327
- rm -rf "libraries/containers/containers/dist-install" || die
-
- if ! use ghcbootstrap && [[ ${CHOST} != *-darwin* && ${CHOST} != *-solaris* ]]; then
- # Modify the wrapper script from the binary tarball to use GHC_PERSISTENT_FLAGS.
- # See bug #313635.
- sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_PERSISTENT_FLAGS}|" \
- "${WORKDIR}/usr/bin/ghc-${BIN_PV}"
-
- # allow hardened users use vanilla binary to bootstrap ghc
- # ghci uses mmap with rwx protection at it implements dynamic
- # linking on it's own (bug #299709)
- pax-mark -m "${WORKDIR}/usr/$(get_libdir)/${PN}-${BIN_PV}/bin/ghc"
- fi
-
- use llvm && ! use ghcbootstrap && llvmize "${WORKDIR}/usr/bin"
-
- # binpkg may have been built with FEATURES=splitdebug
- if [[ -d "${WORKDIR}/usr/lib/debug" ]] ; then
- rm -rf "${WORKDIR}/usr/lib/debug" || die
- fi
- find "${WORKDIR}/usr/lib" -type d -empty -delete 2>/dev/null # do not die on failure here
-
- # ffi headers don't get included in the binpkg for some reason
- for f in "${WORKDIR}/usr/$(get_libdir)/${PN}-${BIN_PV}/include/"{ffi.h,ffitarget.h}
- do
- mkdir -p "$(dirname "${f}")"
- [[ -e "${f}" ]] || ln -sf "$($(tc-getPKG_CONFIG) --cflags-only-I libffi | sed "s/-I//g" | tr -d " ")/$(basename "${f}")" "${f}" || die
- done
-
- eapply "${FILESDIR}"/${PN}-9.0.2-sphinx-6.patch
-
- if use binary; then
- if use prefix; then
- relocate_ghc "${EPREFIX}"
- fi
-
- # Move unpacked files to the expected place
- mv "${WORKDIR}/usr" "${S}"
- eapply_user
- else
- if ! use ghcbootstrap; then
- case ${CHOST} in
- *-darwin* | *-solaris*)
- # UPDATE ME for ghc-7
- mkdir "${WORKDIR}"/ghc-bin-installer || die
- pushd "${WORKDIR}"/ghc-bin-installer > /dev/null || die
- use x64-macos && unpack ghc-7.4.1-x86_64-apple-darwin.tar.bz2
- popd > /dev/null
-
- pushd "${WORKDIR}"/ghc-bin-installer/ghc-[67].?*.? > /dev/null || die
- # fix the binaries so they run, on Solaris we need an
- # LD_LIBRARY_PATH which has our prefix libdirs, on
- # Darwin we need to replace the frameworks with our libs
- # from the prefix fix before installation, because some
- # of the tools are actually used during configure/make
- if [[ ${CHOST} == *-solaris* ]] ; then
- export LD_LIBRARY_PATH="${EPREFIX}/$(get_libdir):${EPREFIX}/usr/$(get_libdir):${LD_LIBRARY_PATH}"
- elif [[ ${CHOST} == *-darwin* ]] ; then
- local readline_framework=GNUreadline.framework/GNUreadline
- local gmp_framework=/opt/local/lib/libgmp.10.dylib
- local ncurses_file=/opt/local/lib/libncurses.5.dylib
- for binary in $(scanmacho -BRE MH_EXECUTE -F '%F' .) ; do
- install_name_tool -change \
- ${readline_framework} \
- "${EPREFIX}"/lib/libreadline.dylib \
- ${binary} || die
- install_name_tool -change \
- ${gmp_framework} \
- "${EPREFIX}"/usr/lib/libgmp.dylib \
- ${binary} || die
- install_name_tool -change \
- ${ncurses_file} \
- "${EPREFIX}"/usr/lib/libncurses.dylib \
- ${binary} || die
- done
- # we don't do frameworks!
- sed -i \
- -e 's/\(frameworks = \)\["GMP"\]/\1[]/g' \
- -e 's/\(extraLibraries = \)\["m"\]/\1["m","gmp"]/g' \
- rts/package.conf.in || die
- fi
-
- # it is autoconf, but we really don't want to give it too
- # many arguments, in fact we do the make in-place anyway
- ./configure --prefix="${WORKDIR}"/usr || die
- make install || die
- popd > /dev/null
- ;;
- *)
- relocate_ghc "${WORKDIR}"
- ;;
- esac
- fi
-
- sed -i -e "s|\"\$topdir\"|\"\$topdir\" ${GHC_PERSISTENT_FLAGS}|" \
- "${S}/ghc/ghc.wrapper"
-
- cd "${S}" # otherwise eapply will break
-
- eapply "${FILESDIR}"/${PN}-9.0.2-CHOST-prefix.patch
- eapply "${FILESDIR}"/${PN}-9.0.2-darwin.patch
- # Fixes panic when compiling some packages
- # https://github.com/gentoo-haskell/gentoo-haskell/issues/1250#issuecomment-1044257595
- # https://gitlab.haskell.org/ghc/ghc/-/issues/21097
- eapply "${FILESDIR}/${PN}-9.0.2-modorigin-semigroup.patch"
- # Needed for testing with python-3.10
- use test && eapply "${FILESDIR}/${PN}-9.0.2-fix-tests-python310.patch"
- eapply "${FILESDIR}"/${PN}-8.10.1-allow-cross-bootstrap.patch
- eapply "${FILESDIR}"/${PN}-9.0.2-disable-unboxed-arrays.patch
- eapply "${FILESDIR}"/${PN}-9.0.2-llvm-13.patch
- eapply "${FILESDIR}"/${PN}-9.0.2-llvm-14.patch
- eapply "${FILESDIR}"/latomic-subword
- eapply "${WORKDIR}"/${P}-riscv64-llvm.patch
- eapply "${FILESDIR}"/${PN}-9.0.2-fptools.patch # clang-16 workaround
-
- # mingw32 target
- pushd "${S}/libraries/Win32"
- eapply "${FILESDIR}"/${PN}-8.2.1_rc1-win32-cross-2-hack.patch # bad workaround
- popd
-
- bump_libs
-
- eapply_user
- # as we have changed the build system
- eautoreconf
- fi
-}
-
-src_configure() {
- if ! use binary; then
- # initialize build.mk
- echo '# Gentoo changes' > mk/build.mk
-
- # Put docs into the right place, ie /usr/share/doc/ghc-${GHC_PV}
- echo "docdir = ${EPREFIX}/usr/share/doc/$(cross)${PF}" >> mk/build.mk
- echo "htmldir = ${EPREFIX}/usr/share/doc/$(cross)${PF}" >> mk/build.mk
-
- # We also need to use the GHC_FLAGS flags when building ghc itself
- echo "SRC_HC_OPTS+=${HCFLAGS} ${GHC_FLAGS}" >> mk/build.mk
- echo "SRC_CC_OPTS+=${CFLAGS}" >> mk/build.mk
- echo "SRC_LD_OPTS+=${LDFLAGS}" >> mk/build.mk
- # Speed up initial Cabal bootstrap
- echo "utils/ghc-cabal_dist_EXTRA_HC_OPTS+=$(ghc-make-args)" >> mk/build.mk
-
- # We can't depend on haddock except when bootstrapping when we
- # must build docs and include them into the binary .tbz2 package
- # app-text/dblatex is not in portage, can not build PDF or PS
- echo "BUILD_SPHINX_PDF = NO" >> mk/build.mk
- echo "BUILD_SPHINX_HTML = $(usex doc YES NO)" >> mk/build.mk
- echo "BUILD_MAN = $(usex doc YES NO)" >> mk/build.mk
-
- # this controls presence on 'xhtml' and 'haddock' in final install
- echo "HADDOCK_DOCS = YES" >> mk/build.mk
-
- # not used outside of ghc's test
- if [[ -n ${GHC_BUILD_DPH} ]]; then
- echo "BUILD_DPH = YES" >> mk/build.mk
- else
- echo "BUILD_DPH = NO" >> mk/build.mk
- fi
-
- # Any non-native build has to skip as it needs
- # target haddock binary to be runnabine.
- if ! is_native; then
- # disable docs generation as it requires running stage2
- echo "HADDOCK_DOCS=NO" >> mk/build.mk
- echo "BUILD_SPHINX_HTML=NO" >> mk/build.mk
- echo "BUILD_SPHINX_PDF=NO" >> mk/build.mk
- fi
-
- if is_crosscompile; then
- # Install ghc-stage1 crosscompiler instead of
- # ghc-stage2 cross-built compiler.
- echo "Stage1Only=YES" >> mk/build.mk
- fi
-
- # allows overriding build flavours for libraries:
- # v - vanilla (static libs)
- # p - profiled
- # dyn - shared libraries
- # example: GHC_LIBRARY_WAYS="v dyn"
- if [[ -n ${GHC_LIBRARY_WAYS} ]]; then
- echo "GhcLibWays=${GHC_LIBRARY_WAYS}" >> mk/build.mk
- fi
- echo "BUILD_PROF_LIBS = $(usex profile YES NO)" >> mk/build.mk
-
- # Get ghc from the unpacked binary .tbz2
- # except when bootstrapping we just pick ghc up off the path
- if ! use ghcbootstrap; then
- export PATH="${WORKDIR}/usr/bin:${PATH}"
- fi
-
- echo "BIGNUM_BACKEND = $(usex gmp gmp native)" >> mk/build.mk
-
- # don't strip anything. Very useful when stage2 SIGSEGVs on you
- echo "STRIP_CMD = :" >> mk/build.mk
-
- local econf_args=()
-
- # GHC embeds toolchain it was built by and uses it later.
- # Don't allow things like ccache or versioned binary slip.
- # We use stable thing across gcc upgrades.
- # User can use EXTRA_ECONF=CC=... to override this default.
- econf_args+=(
- AR=${CTARGET}-ar
- CC=${CTARGET}-gcc
- # these should be inferred by GHC but ghc defaults
- # to using bundled tools on windows.
- Windres=${CTARGET}-windres
- DllWrap=${CTARGET}-dllwrap
- # we set the linker explicitly below
- --disable-ld-override
- )
- case ${CTARGET} in
- arm*)
- # ld.bfd-2.28 does not work for ghc. Force ld.gold
- # instead. This should be removed once gentoo gets
- # a fix for R_ARM_COPY bug: https://sourceware.org/PR16177
- econf_args+=(LD=${CTARGET}-ld.gold)
- ;;
- sparc*)
- # ld.gold-2.28 does not work for ghc. Force ld.bfd
- # instead. This should be removed once gentoo gets
- # a fix for missing --no-relax support bug:
- # https://sourceware.org/ml/binutils/2017-07/msg00183.html
- econf_args+=(LD=${CTARGET}-ld.bfd)
- ;;
- *)
- econf_args+=(LD=${CTARGET}-ld)
- esac
-
- if [[ ${CBUILD} != ${CHOST} ]]; then
- # GHC bug: ghc claims not to support cross-building.
- # It does, but does not distinct --host= value
- # for stage1 and stage2 compiler.
- econf_args+=(--host=${CBUILD})
- fi
-
- if use ghcmakebinary; then
- # When building booting libary we are trying to
- # bundle or restrict most of external depends
- # with unstable ABI:
- # - embed libffi (default GHC behaviour)
- # - disable ncurses support for ghci (via haskeline)
- # https://bugs.gentoo.org/557478
- # - disable ncurses support for ghc-pkg
- echo "libraries/haskeline_CONFIGURE_OPTS += --flag=-terminfo" >> mk/build.mk
- echo "utils/ghc-pkg_HC_OPTS += -DBOOTSTRAPPING" >> mk/build.mk
- elif is_native; then
- # using ${GTARGET}'s libffi is not supported yet:
- # GHC embeds full path for ffi includes without /usr/${CTARGET} account.
- econf_args+=(--with-system-libffi)
- econf_args+=(--with-ffi-includes=$($(tc-getPKG_CONFIG) libffi --cflags-only-I | sed -e 's@^-I@@'))
- fi
-
- einfo "Final mk/build.mk:"
- cat mk/build.mk || die
-
- econf ${econf_args[@]} \
- --enable-bootstrap-with-devel-snapshot \
- $(use_enable elfutils dwarf-unwind) \
- $(use_enable numa) \
- $(use_enable unregisterised)
-
- if [[ ${PV} == *9999* ]]; then
- GHC_PV="$(grep 'S\[\"PACKAGE_VERSION\"\]' config.status | sed -e 's@^.*=\"\(.*\)\"@\1@')"
- GHC_P=${PN}-${GHC_PV}
- fi
- fi # ! use binary
-}
-
-src_compile() {
- if ! use binary; then
- # Stage1Only crosscompiler does not build stage2
- if ! is_crosscompile; then
- # 1. build/pax-mark compiler binary first
- emake ghc/stage2/build/tmp/ghc-stage2
- # 2. pax-mark (bug #516430)
- pax-mark -m ghc/stage2/build/tmp/ghc-stage2
- # 2. build/pax-mark haddock using ghc-stage2
- if is_native; then
- # non-native build does not build haddock
- # due to HADDOCK_DOCS=NO, but it could.
- emake utils/haddock/dist/build/tmp/haddock
- pax-mark -m utils/haddock/dist/build/tmp/haddock
- fi
- fi
- # 3. and then all the rest
- emake all
- fi # ! use binary
-}
-
-src_test() {
- # TODO: deal with:
- # - sandbox (pollutes environment)
- # - extra packages (to extend testsuite coverage)
- # bits are taken from 'validate'
- local make_test_target='test' # can be fulltest
- # not 'emake' as testsuite uses '$MAKE' without jobserver available
- make $make_test_target stage=2 THREADS=$(makeopts_jobs)
-}
-
-src_install() {
- if use binary; then
- use prefix && mkdir -p "${ED}"
- mv "${S}/usr" "${ED}"
- else
- [[ -f VERSION ]] || emake VERSION
-
- # -j1 due to a rare race in install script:
- # make --no-print-directory -f ghc.mk phase=final install
- # /usr/lib/portage/python3.4/ebuild-helpers/xattr/install -c -m 755 \
- # -d "/tmp/portage-tmpdir/portage/cross-armv7a-unknown-linux-gnueabi/ghc-9999/image/usr/lib64/armv7a-unknown-linux-gnueabi-ghc-8.3.20170404/include"
- # /usr/lib/portage/python3.4/ebuild-helpers/xattr/install -c -m 644 utils/hsc2hs/template-hsc.h \
- # "/tmp/portage-tmpdir/portage/cross-armv7a-unknown-linux-gnueabi/ghc-9999/image/usr/lib64/armv7a-unknown-linux-gnueabi-ghc-8.3.20170404"
- # /usr/bin/install: cannot create regular file \
- # '/tmp/portage-tmpdir/portage/cross-armv7a-unknown-linux-gnueabi/ghc-9999/image/usr/lib64/armv7a-unknown-linux-gnueabi-ghc-8.3.20170404': No such file or directory
- emake -j1 install DESTDIR="${D}"
-
- use llvm && llvmize "${ED}/usr/bin"
-
- # Skip for cross-targets as they all share target location:
- # /usr/share/doc/ghc-9999/
- if ! is_crosscompile; then
- dodoc "distrib/README" "LICENSE" "VERSION"
- fi
-
- # rename ghc-shipped files to avoid collision
- # of external packages. Motivating example:
- # user had installed:
- # dev-lang/ghc-7.8.4-r0 (with transformers-0.3.0.0)
- # dev-haskell/transformers-0.4.2.0
- # then user tried to update to
- # dev-lang/ghc-7.8.4-r1 (with transformers-0.4.2.0)
- # this will lead to single .conf file collision.
- local shipped_conf renamed_conf
- local package_confdir="${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
- for shipped_conf in "${package_confdir}"/*.conf; do
- # rename 'pkg-ver-id.conf' to 'pkg-ver-id-gentoo-${PF}.conf'
- renamed_conf=${shipped_conf%.conf}-gentoo-${PF}.conf
- mv "${shipped_conf}" "${renamed_conf}" || die
- done
-
- # remove link, but leave 'haddock-${GHC_P}'
- rm -f "${ED}"/usr/bin/$(cross)haddock
-
- if ! is_crosscompile; then
- newbashcomp "${FILESDIR}"/ghc-bash-completion ghc-pkg
- newbashcomp utils/completion/ghc.bash ghc
- fi
- fi
-
- # path to the package.cache
- local package_confdir="${ED}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d"
- PKGCACHE="${package_confdir}"/package.cache
- # copy the package.conf.d, including timestamp, save it so we can help
- # users that have a broken package.conf.d
- cp -pR "${package_confdir}"{,.initial} || die "failed to backup intial package.conf.d"
-
- # copy the package.conf, including timestamp, save it so we later can put it
- # back before uninstalling, or when upgrading.
- cp -p "${PKGCACHE}"{,.shipped} \
- || die "failed to copy package.conf.d/package.cache"
-
- if is_crosscompile; then
- # When we build a cross-compiler the layout is the following:
- # usr/lib/${CTARGET}-ghc-${VER}/ contains target libraries
- # but
- # usr/lib/${CTARGET}-ghc-${VER}/bin/ directory
- # containst host binaries (modulo bugs).
-
- # Portage's stripping mechanism does not skip stripping
- # foreign binaries. This frequently causes binaries to be
- # broken.
- #
- # Thus below we disable stripping of target libraries and allow
- # stripping hosts executables.
- dostrip -x "/usr/$(get_libdir)/$(cross)${GHC_P}"
- dostrip "/usr/$(get_libdir)/$(cross)${GHC_P}/bin"
- fi
-}
-
-pkg_preinst() {
- # have we got an earlier version of ghc installed?
- if has_version "<${CATEGORY}/${PF}"; then
- haskell_updater_warn="1"
- fi
-}
-
-pkg_postinst() {
- ghc-reregister
-
- # path to the package.cache
- PKGCACHE="${EROOT}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d/package.cache"
-
- # give the cache a new timestamp, it must be as recent as
- # the package.conf.d directory.
- touch "${PKGCACHE}"
-
- if [[ "${haskell_updater_warn}" == "1" ]]; then
- ewarn
- ewarn "\e[1;31m************************************************************************\e[0m"
- ewarn
- ewarn "You have just upgraded from an older version of GHC."
- ewarn "You may have to run"
- ewarn " 'haskell-updater'"
- ewarn "to rebuild all ghc-based Haskell libraries."
- ewarn
- ewarn "\e[1;31m************************************************************************\e[0m"
- ewarn
- fi
-}
-
-pkg_prerm() {
- PKGCACHE="${EROOT}/usr/$(get_libdir)/$(cross)${GHC_P}/package.conf.d/package.cache"
- rm -rf "${PKGCACHE}"
-
- cp -p "${PKGCACHE}"{.shipped,}
-}
-
-pkg_postrm() {
- ghc-package_pkg_postrm
-}
^ permalink raw reply related [flat|nested] 9+ messages in thread
end of thread, other threads:[~2023-10-14 0:47 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-08 15:39 [gentoo-commits] repo/gentoo:master commit in: dev-lang/ghc/files/, dev-lang/ghc/ Sam James
-- strict thread matches above, loose matches on Subject: below --
2023-10-14 0:47 Sam James
2023-02-01 4:57 Michał Górny
2022-11-25 21:57 Sam James
2022-11-25 21:57 Sam James
2021-06-06 10:01 Sergei Trofimovich
2021-02-28 18:43 Sergei Trofimovich
2017-07-23 11:15 Sergei Trofimovich
2016-12-28 22:49 Sergei Trofimovich
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox