summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2015-08-08 13:49:04 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2015-08-08 17:38:18 -0700
commit56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch)
tree3f91093cdb475e565ae857f1c5a7fd339e2d781e /x11-drivers/nvidia-drivers
downloadgentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip
proj/gentoo: Initial commit
This commit represents a new era for Gentoo: Storing the gentoo-x86 tree in Git, as converted from CVS. This commit is the start of the NEW history. Any historical data is intended to be grafted onto this point. Creation process: 1. Take final CVS checkout snapshot 2. Remove ALL ChangeLog* files 3. Transform all Manifests to thin 4. Remove empty Manifests 5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$ 5.1. Do not touch files with -kb/-ko keyword flags. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'x11-drivers/nvidia-drivers')
-rw-r--r--x11-drivers/nvidia-drivers/Manifest38
-rw-r--r--x11-drivers/nvidia-drivers/files/50nvidia-prelink-blacklist1
-rw-r--r--x11-drivers/nvidia-drivers/files/95-nvidia-settings2
-rw-r--r--x11-drivers/nvidia-drivers/files/NVIDIA_glx-defines.patch11
-rw-r--r--x11-drivers/nvidia-drivers/files/NVIDIA_glx-glheader.patch13
-rw-r--r--x11-drivers/nvidia-drivers/files/nvidia-169.0714
-rw-r--r--x11-drivers/nvidia-drivers/files/nvidia-drivers-331.13-pax-usercopy.patch52
-rw-r--r--x11-drivers/nvidia-drivers/files/nvidia-drivers-337.12-pax-constify.patch25
-rw-r--r--x11-drivers/nvidia-drivers/files/nvidia-drivers-346.16-pax-constify.patch25
-rw-r--r--x11-drivers/nvidia-drivers/files/nvidia-drivers-346.16-pax-usercopy.patch47
-rw-r--r--x11-drivers/nvidia-drivers/files/nvidia-drivers-pax-const.patch17
-rw-r--r--x11-drivers/nvidia-drivers/files/nvidia-drivers-pax-usercopy.patch54
-rw-r--r--x11-drivers/nvidia-drivers/files/nvidia-drivers-settings.desktop7
-rw-r--r--x11-drivers/nvidia-drivers/files/nvidia-persistenced.conf8
-rwxr-xr-xx11-drivers/nvidia-drivers/files/nvidia-persistenced.init25
-rw-r--r--x11-drivers/nvidia-drivers/files/nvidia-smi.init25
-rw-r--r--x11-drivers/nvidia-drivers/files/nvidia-udev.sh17
-rw-r--r--x11-drivers/nvidia-drivers/files/nvidia-uvm.conf3
-rw-r--r--x11-drivers/nvidia-drivers/files/nvidia.udev-rule6
-rw-r--r--x11-drivers/nvidia-drivers/metadata.xml15
-rw-r--r--x11-drivers/nvidia-drivers/nvidia-drivers-173.14.39.ebuild546
-rw-r--r--x11-drivers/nvidia-drivers/nvidia-drivers-304.125.ebuild457
-rw-r--r--x11-drivers/nvidia-drivers/nvidia-drivers-331.113.ebuild474
-rw-r--r--x11-drivers/nvidia-drivers/nvidia-drivers-340.76.ebuild479
-rw-r--r--x11-drivers/nvidia-drivers/nvidia-drivers-343.36.ebuild479
-rw-r--r--x11-drivers/nvidia-drivers/nvidia-drivers-346.87.ebuild489
-rw-r--r--x11-drivers/nvidia-drivers/nvidia-drivers-349.16.ebuild489
-rw-r--r--x11-drivers/nvidia-drivers/nvidia-drivers-352.30.ebuild489
-rw-r--r--x11-drivers/nvidia-drivers/nvidia-drivers-355.06.ebuild498
-rw-r--r--x11-drivers/nvidia-drivers/nvidia-drivers-96.43.23.ebuild519
30 files changed, 5324 insertions, 0 deletions
diff --git a/x11-drivers/nvidia-drivers/Manifest b/x11-drivers/nvidia-drivers/Manifest
new file mode 100644
index 000000000000..29b31675716c
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/Manifest
@@ -0,0 +1,38 @@
+DIST NVIDIA-FreeBSD-x86-173.14.39.tar.gz 20038266 SHA256 63a922ce4c5b676b4cb1ace98094dace4cc5408f2553e183df7b2127777a238b SHA512 96982fe7e0751c52fbef534193de09d187b99c1984c05e791223eb804719d8b3ba72efd983f227661ded4b71569bdbb914f1f629ab73a8bc9b8172832ccf3ec6 WHIRLPOOL 21f5906f42adf0064c7a7f81ac8e323de488e6d36356ee42c31a15c31ebb64335d5e2cff0ff022d41de480f9e0a57b3b96387f17151c7b59eceba2c61a7a102b
+DIST NVIDIA-FreeBSD-x86-304.125.tar.gz 34494889 SHA256 806d0bff9d394390b3a257472bc342857f150e9dba6673e6b930f47a93ec0269 SHA512 d2760196d3f0dfb1837d496bd11dbedab6a2bf3de98da35f16c92133452b915b425a718f72e560f5d6483caf5e2e5bcf99a462b2e392d7a08c77b59695649108 WHIRLPOOL eb008e1956043d48af5f928dc594c8ae9c8a946834d889db5b4a9b3f16bfaeb311221e5d3f83c8c599dee860b54a42030dccf2aaec31dffb6e8460bf646b82ad
+DIST NVIDIA-FreeBSD-x86-331.113.tar.gz 56371300 SHA256 f3b4b5ddf5977223646d2cdb0617ea8a5f667814ca23b29cb225c5685eacd9d7 SHA512 5c45142807a5b8ecb5e037921e4e449f4710a65358579087429e14ee50124863e6a65fbf8cc73efec22bd8ca85d3eb5a815c7301403dd3236e0bb0b177e5f3e8 WHIRLPOOL 97240066b1c45c887770bfe8539b733a2957fdc1511af5b08de4149b0ce9fedc87b6aa8ee8d243793d225c98c09681e4cca93dd1c5f601389637644e659d7863
+DIST NVIDIA-FreeBSD-x86-340.76.tar.gz 59362290 SHA256 0abbcc3bed3f017e7f1887a5c2d014e2b5a020462071998986ed49cdb8e7119f SHA512 e6d8b6d03fe0f9ab25ddeef680e0159ea4073d03762d3419761c02b917edefa9a1f81c209bd386838141c1924364c81126b0a356c325b056a0c2451865bed5eb WHIRLPOOL 7ec0cef6f92bfbd4c8b6a051dc8de4b6b138f63fd4f7e18756178a9aebb91ea32523d5ca885481d8c8c3d1531b153699f4e5606c155d6c3aa79a340637d3744b
+DIST NVIDIA-FreeBSD-x86-343.36.tar.gz 59205879 SHA256 8634e7537eca778790296f8355e39ae9a7e16642648e671a6c9339ee55fe340c SHA512 35fcf57d5e830cbe3c07ec70362ad9f0ff6ec327c6b11b6d3c533315e59031501501b9fdb80a3bef720506e5221ad84496745ce13d2c9885076f1c8e8537ba46 WHIRLPOOL 3ed3230dc190e7670c960743d94b8db1c0d9908b597f952746d851b403847e7b2836f1c60e6af0fe73072c1fda3971dfacc37c21908c227b2c20b5045dbfd61f
+DIST NVIDIA-FreeBSD-x86-346.87.tar.gz 58003852 SHA256 72481c38989c1aa1835485d2222e6a98f12f7265518fef4bd2c089fe8023d32e SHA512 6a8bf0671a48f9bfe74f844586985d7132a56b4056536e5581d695414bdebd4e393ac85bd6dd6d06f89a46dfd3b4aea0953bb254cab1b1ade2b383292686d6ae WHIRLPOOL 2358746b56d426be75af6a6665b78f2bcbf8abd7dcf954203cc09d945baf89b75fa004fec4be31cd407efc46bf2aaf5add1010ade7a6616fe8347d8954e892ef
+DIST NVIDIA-FreeBSD-x86-349.16.tar.gz 59441939 SHA256 d8b633790036f032b48196503bc6a85ca82de54edd2409f7c1ec86c053e89e07 SHA512 7d914c74b8b4b50931f27f085ca587fab9a4ba0dafab1cdbb751605cdf702b84e2e31b999b374c7adaa096d6dac6268e9b2ff6fcde5ac37b6dbdfd0ebf4a1422 WHIRLPOOL ab68e75c05a0cf2df803fcf3755c366a04cf6f973bb02b673df58dcdee6cb13a4cb5e6fec5270918c725603780b2fefbb89927789b92ddd01647852d34562b9a
+DIST NVIDIA-FreeBSD-x86-352.30.tar.gz 55043903 SHA256 6d91dce0171a0c7c21d9ce2c4c371940e4ccd273941c3c32bfd04bdc4166d2ae SHA512 cb3e160292f80aaae5d3a17fa9dbba9f3799e42e2a86c2ddae41ff2bce1ac80c68f15dc512fc3879bd7e9fdc8af472852e9d5d3c2ab5afe4e1c9cde7017fbfd9 WHIRLPOOL 351861aab1a22193f71e8231f76397ccc89a1109f583c0cc512ed1657263dd224211b7505e8b7647282bad0f85e15a38ae4d3da7d88ad45dde8d05e87877f157
+DIST NVIDIA-FreeBSD-x86-355.06.tar.gz 56677167 SHA256 49f691695228e0c2effcee4ad0f3ea90bb1086d0dd28af8f88eb10231753010a SHA512 f8698a6afb10d27e27559f56029fa38db9d0d5a7d4ead7a1f4097f113b618eb4b73c82ebbf1c53b0766a43e6a0dfe8eec9a85200b85df450f3c8d70aa713cbb4 WHIRLPOOL bf97c042f55b43ac5d9e286b2eadb75cab6d8a12e8cc54c061a9b0bcaabfd8d8b4df81f73ffff02df058fccd762afff16063b12e1d186b0e31f3aa6dece5d323
+DIST NVIDIA-FreeBSD-x86-96.43.23.tar.gz 15463464 SHA256 18d855db8381eda1a6cf548c9e5095fc5bb8694bf1d6e24fc1072fba4e54cd78 SHA512 42d7b1b76cdb3b23680363e565614a22112162a5dd3639cb804fe670c0c3f3f23595bbefa3f78afdc6a8ca848446dee853c7a355f2c96a0d01b354753ba2785c WHIRLPOOL f8e59ce521990cd9edee441e73f973f074db492952807a0931e362102874cddbb47604ff5c5eb20a0cbde27f9b6d4e440dd12cc2e5a20c9cb65bf3c0b3e62511
+DIST NVIDIA-FreeBSD-x86_64-304.125.tar.gz 35498616 SHA256 46b14b8c5ee1c02ff5e30afc9c99f4dd2edc426ccb2b73764093a1787639699d SHA512 34d48f24b1f5019b23c2937f8b5280fcc596764e1f5833cfe33db5e4d8395a0d69aa4c4214a5b97620dbaade73ac0fa333c36cceb4a137bb26d3ba37c31a0eb7 WHIRLPOOL 82677bd2aec3a60fe64211170573ef702b1dd1ab5a71ec922fb56b8d40f2163c0151a7c7f8bdace9127c8afcaf278f8f23a1cb585a8ad3bb7a0d42787ab17fb2
+DIST NVIDIA-FreeBSD-x86_64-331.113.tar.gz 47509194 SHA256 c848e187c79064ea3f52406312aa09d06f0aaef5063be7522b2b2319c43c872c SHA512 4e206719afcee47179e0756ac67fc4e61d513efb1cd0264b28726d6de16846feee873a2df362bf645b0527d395b6d82f5b54dbc447bccb74128d7bff37bb7b1b WHIRLPOOL a51b0bd9f7301d9bb76b54ffa44337ad4d875125281c4b9921e66a76d434879832f542df9c6ba436ef83fb3fa0afe5197f3425f1b7aa16274aca5080259f343d
+DIST NVIDIA-FreeBSD-x86_64-340.76.tar.gz 60206978 SHA256 60037d035b9af9f1d4dcdd5033e1b28b0cd4c7ca94f6bcb8d267e037a930fdc0 SHA512 d478eac282dfb43205f7464d6542cf1f71ed4dea6b8381314affb8647d104c5ddf7e658b6b8eb5e0bdb18207b92f76c574b24959ce23034d375cc712998e6e7c WHIRLPOOL 98ebffd792a47e3a9ef369976db11909bc13551f38977f85ece41e5a31a790c2c173badfc166e3a0bfe4361d5221129d19364c074ba11fc4aa9062d5cb1499a8
+DIST NVIDIA-FreeBSD-x86_64-343.36.tar.gz 60045074 SHA256 aa189d9fd6448ed49ff4a8dd09dd15c06f6b3ef662fd3d960b4853c485cbab8a SHA512 23c38de071ac6e2c87db2c767b07f243703e55cd6485eb8e538fb72f38e9856b7ff28430fdd7eccc4728f3d36c14eac8b1fbf7155fe864ead93ed4218d5b65b5 WHIRLPOOL 401cdc5675d5fe60b6ca492be912573e9fc56a0a67ad680e2cada783ec8a34c15c6ca1a495c8fdbf09e384bc420295750540f5c77907c459c80f400d8291e44a
+DIST NVIDIA-FreeBSD-x86_64-346.87.tar.gz 58770347 SHA256 fb91a3f66562843465cb6eb28d7d078a31dd9d9ccd65d63d87ee3d7cd7e91d8e SHA512 f1d0e1acfc0eae69d4db3200410babe559d72f46ae7d2beca4f214a35d2b6418bf6b9c333df669f2e77256e1e55959401c0525ae6568121e9b3e6aac0e77bc66 WHIRLPOOL 0df2ee60b2f49c36559aba1135d67a71b9f99dd71c8eb6f19221887f152f7b639176721f2ab3d9b75ae7de62a4248117a15ba25c2af2c469559688c0e6dc5577
+DIST NVIDIA-FreeBSD-x86_64-349.16.tar.gz 60290477 SHA256 b4cb3f3738f8a68b90fb7830ff9b48d9f1e51d3aa6e2dd555b690b4848101a86 SHA512 47c3f59f76b644e5ac69197a22ec8d17d764aa9090049633d274c579d59af8b36780e7a1aa97fa92414eb3c0e76d36e7bdf317f20ed2647482866cd5575f134d WHIRLPOOL a5455b5329211f92ca8f6e87fb796d9844e293878d4a64d2ef6a40a15b57687e66ab81baefb0132790d922b6b4e0c577469c75f98ad208433e14760cc77c6bf7
+DIST NVIDIA-FreeBSD-x86_64-352.30.tar.gz 56681273 SHA256 5fed650cb7b4298d6dac9750ee2e396b2fe24902700c16784c2d38ef0ecd80c1 SHA512 18f878325a02cf5caaba24b7892f55d0ce554492a563dce0a720741c39652c0520708432406d6c78c61fb6f92a4c9dae52dd428c02e3e8442188c49e693edc4d WHIRLPOOL aa2ea6d143a3382fef6a012ee3bfac26df26e1dcdb54ab5d34eab893b1a0459e2a1875925ccda3d531bb59d9336a166d4e369055151ecabae31356be19fd288f
+DIST NVIDIA-FreeBSD-x86_64-355.06.tar.gz 53894942 SHA256 65c5c44bdb6eb19817dfce99df052430b471b9412bd53b95b3723847b195f108 SHA512 f0bb9cff6b914a4526f48f91cb12a10a4ed99a7b550a76b73b087a8f08c90a0d5e8b6b0fb8eb866a1a7dcacbc1242064736c53a164aa48c85c9416a10e68f9ac WHIRLPOOL 989924bd876d440952a13492ea79794f2ca0a9fd026a8fd231d0d52a98bd5610a6560f628998b754cdc62b5e7c2e47948f2bbc2b01415666f433d126db26e06d
+DIST NVIDIA-Linux-x86-173.14.39-pkg0.run 15134997 SHA256 a09935f37121ed3db8ae3da63a0d8e9d4348a19c859811c9fe44d6ce8e3eab23 SHA512 e24e15ccec725d3cbca502c2b77061776a81ef92917a950adec4ff6bdc34f10903aa654433177ea74be0dade4af81c5380d5710d375a5ea445940d06154bde93 WHIRLPOOL fce3d8e4f6cdf698f5a057514b6fe220bb1011025bdce5bd4cf0e424fb4d306d38251b6726bda03f290ea8137d5a95ed418cf8751722879f9042462abd9181b6
+DIST NVIDIA-Linux-x86-304.125.run 40589395 SHA256 aec5b3a792910e152d5af756ef6fd7224c448c564564c7c448ab8ec3fc78c4f7 SHA512 cd77736790876b66c1e88bf30b7a93f755c0f94118edda8fde1701dc07dc4eb60f89a27b0ed432db74729f269cb239f32f3c5e045d701f60baf69da7fc0d0ea7 WHIRLPOOL 85cd375e1b67bbabe9a8119affec20b7a9a258f8b5be89d755f7ea596a94f98df053e8ade33f1aba1f74f753dcb636268c4f2074a09eaf68d858241f1482552c
+DIST NVIDIA-Linux-x86-331.113.run 37300924 SHA256 42535a99ab68452d30d9c3fad2fb162db01d1f6821115a3c1733ed203efd588b SHA512 bc820609e0379cc5805a5428cc364795b8a5d9e5a2a4395a1ddaa1dda85e6acc59368f87f5974a39fb42bd272458627b2c742fbf1f7fedddb17102439883b111 WHIRLPOOL 1d7b5cb8be5bb76dbe1b238aab4e39ccda0e5b07da268f0652966e79d5e0d2192773316d8f22a2d6a551305b17b610242918822e94e43263c9dbfba8a48bf49b
+DIST NVIDIA-Linux-x86-340.76.run 38818911 SHA256 9b29d93b49009caed84a8852825c3e7c6ebbbba8ec99b03ee5113108c8b036d0 SHA512 45d7b29670f9ca50de80d6d61260015b45f74422bbd12039923d04ae8b033b903b27e9f4c174461055f3cf45a4af44565ce9a8b9cd671e0e54d37770a1156839 WHIRLPOOL da7e072a56e3aff8b4688e60c5acd76c97804fa582d21c70dce043b13fa2317d1021f19927e827cf6132aebe2d40371c750e3eb56697bc7eda16bb7369bf2994
+DIST NVIDIA-Linux-x86-343.36.run 41073259 SHA256 8cc1c99fbda29b3258f57dbdacef11921aca2e3ac106ef591f0815716e1b829e SHA512 a6287cf8ad6379daa7c6d7ae6bc08f9985ad9e9353de6d88eb72d8a1acad3e25eb65076b904152c6ddd8ac54b9afcdbb7a5dfb9a46e75c5654be87b3df0e48e1 WHIRLPOOL 7aaa7977a850314045bcfcc36a8f6ed8b3f487ec972e109ea48cbe3edda4ff29c0bf02e7c11dacf6a3e71783259dc809840c32e301aa16f2d4394d7f07cffc0a
+DIST NVIDIA-Linux-x86-346.87.run 41303879 SHA256 0050d31e3c9d91d2372ddfe05ad7e217cdb68cd65aad60406a0c7ea878793999 SHA512 10b923847571576fbe31a037a16bdbaf9bac38caa7b380c12805f60163d6b0a359465e0d6acfa869c72dae701f62eb416b5874872e5cc34ae6cb5659ea899231 WHIRLPOOL ea7bc4cc1d70160f42bfcc082acbc00d39112d66e03f0b6cf17294cf9ac9b543e5242ddba3286eb3eff0f32d37227f40016dd40cf5e34ff1b26640bbba88f58b
+DIST NVIDIA-Linux-x86-349.16.run 42751511 SHA256 35c8d00ece6a450e8e72aac2bff45e89ce40ffbe3278802e8a0b4ff65c793d11 SHA512 d3609c4ccfbf6b005a8c58dc5bc3091c7b603229bb27bf48c545fafd9d7175a06ab4d5b414586a5234f2699bed4f613b809c058dff4e1f5fe4416adc53c4d3ab WHIRLPOOL ff4ff2f83e50c6675ec35035a2bd0d534acfb2f8fbb4d5b2d00770dae3b4f48db83fa789c57a6f958f13d8bdbb68971c5ba10cf2fc7b0c4a5a8cb836a09d4586
+DIST NVIDIA-Linux-x86-352.30.run 42931523 SHA256 563eb858584f3eec38f137055039cd4addc7bb4c8f47f90e87a0cc1f88db32e3 SHA512 53f03aa6bd0162d5cc068f4626f465a4a2f79c56609d8d3a86999f4cfcb4113752598337a0b893c6005b529924b677a0fd43c4e9e782b7e6e7d3d50337a07fc7 WHIRLPOOL ca56068eb5dd45b081634cabea1e9f96c54d388de79a19d7237059c45ee110118decb5a8d658605b65517ac39adae623b2c366e5d7bec219c8b9169ee71d7767
+DIST NVIDIA-Linux-x86-355.06.run 42921947 SHA256 741ba8e974f0592d3a7940cc16f9ea7b69fe8f42908c8e81988b9814a74d7859 SHA512 9229747fcdb34fefe14a89e70cc41f476cadc491245d7bc50ff7ca8b484b41f94bd900f4910eba9b6183cb0ed872cafc8918bfde82975fed5c56612b545406e9 WHIRLPOOL 1af2fc985e59686b147d7506cafd9d9e8097f071a096af103c7ef7fd22a0f684abd6b6aa25b5e82edb488c7e901f5ee41d1f9d89998c9a6a65795884ca5e3979
+DIST NVIDIA-Linux-x86-96.43.23-pkg0.run 11504817 SHA256 51e6adf4ba73071622045fc37169f80db3ae3e784dff53b29d35146a04042142 SHA512 bed5726e57637481fe4e3c03a65ec14fe949f00860e729ebde408f4fd861d7bfdc296a78bc2f5d42e8b282db09f4bbde1e0545df7228fa20227080dc4b868ba7 WHIRLPOOL 6d4fd1786c11f4e326cc3101d0bb1a2f8b63c25c3dd59f10188f8355759e2861ce44fd53d60258b513d5a1d6124d0f91ba8edf4d3668b6feabfb3e8d585f14fe
+DIST NVIDIA-Linux-x86_64-173.14.39-pkg2.run 21100833 SHA256 15a953666d5681ba54c97498b578ffd286a1dc96d605f3b02110f3f99813100e SHA512 a65cd496e6ed57f771c3d99f37f616a1242d97844f6faef7a807825ad899c0e536a99fde397020839f0857883b934032f9491024f3047a6b06d3eea1f5d77713 WHIRLPOOL dc5f243b7d1de7e2d1b7f005e018a2940d63335b11a7c83c234b348b7a1839e9131169d2ea928bd8c2f549a4535149b03e16e6c94d59dfa745f7f904ff790a45
+DIST NVIDIA-Linux-x86_64-304.125.run 69108272 SHA256 c654889b85a18326f2c610260a8fbc3b1bb6f9b8be1c052a46a213f60bd62262 SHA512 75bd5700281b0aa4e19be5b779e3484711ce3db92641a32f3bf5e890601b353b23113f6218d5a2fa6b2c8d93702fac92810013c7c0f8efe484b0a39d09b1b073 WHIRLPOOL d8b9794253b1ab270680da7420f50df5ab6aa4d5123bad695be5b7891b2df55bf06ecdd0b221fd29e799077c0a64da8059df16ebea9a3535e402f2c0cf482dcf
+DIST NVIDIA-Linux-x86_64-331.113.run 60509547 SHA256 e9d5eb4394ef31825f7a86290b19b522851d1b599284095d81bac0f33a996219 SHA512 f71f3d20016bebe4e7f83704a7539f0d53c92a2598a34f9f48ad421e5743ef554aa97315f2a762f132b730b1f37c5811aa617fed3c5a90d3e2e9cc5320e366b7 WHIRLPOOL 2f06c45cb4750eb5c7d6a2ff4e4c3abaf813df135da13691f30238baf89c2fa1477d5694088f268d8681cf719889b9e2644fc1d707785113703cd2e4d7c0b27f
+DIST NVIDIA-Linux-x86_64-340.76.run 69955037 SHA256 3bf670e9a2bdb184648dec54ce06fab65e798a9a4c9dd5155e2be4efee3e0994 SHA512 59ad49a49f170ec971e2b5ee3a45b9f972521bc4b7ab6f02f46a5cfc5b1998841195cc5c91dffc417d2183de39c5a589eabf7b48864e0c6842363a75051db40c WHIRLPOOL 8c846f2b5b6f56bd2962fe4660751a4485e0ddd2186bde0affccece32271b03f4f3c226377c0b1877ea391ab130ed6f282c316f227205488a63e4f0a19db82cc
+DIST NVIDIA-Linux-x86_64-343.36.run 73775989 SHA256 2285efa2c0e6675d8724e47a09403630a674c32e514bdcfb54cec3c81810fc78 SHA512 6e76e54b24b0c1fa16e94eaf0f99d2e7dfd28e5aaae0bcb6df3e6d4e20c7a13d5d30902e2bc9bc7609c8d87e5ec8fbf16a5a2dd513bb9d761714176c4ce5e283 WHIRLPOOL 73040a3f3073486c5d6d0a5d84be7d478a3c15bb4aee21f3c590592afe2845f8e9c7064010ddc8f93b764e48940e523952abf9978d09cd32ec1ce8b644e59eb6
+DIST NVIDIA-Linux-x86_64-346.87.run 74056785 SHA256 908446b20c9992cc6a7700866d36c13d9f53646837842d096d91b35644ee4e31 SHA512 fa192cd5b1dc44bcf23abd188b3fa292ad04cf8cc6b10042c465f10371db55e7218bd37e3101309a9b4c7e58b863c26526d33966a57ea7761d75dc04d382a119 WHIRLPOOL 6666aedd8ceffa0694ecb884e548db32899f3372b14b4fefba05ff4361655c4a1b4ff5d6b9a3ac7f354f140511fb11be01e287cb7efcdee6dcbe95bf5d6f5a75
+DIST NVIDIA-Linux-x86_64-349.16.run 77513301 SHA256 f980b22729b20c9eb3a3a800af524da181afbc78e2409a3f83845894983f8322 SHA512 143999f5401ac8634049786073203fab7e8d23dc9e0d4d62d4c6ba9945c20f7d4034c37d0f721aae540503f6bcffbf200a0af70520ae7ee10a2529ed92a14866 WHIRLPOOL 9a6817c03d11253ed606294d2cc2b5f2c4c612af2f8b6f72228a9e21d4991f8bcf248a28ff70d6f477860a64bcf795ec0ee2f73c34904e5cdf0979d41e370042
+DIST NVIDIA-Linux-x86_64-352.30.run 77669309 SHA256 4c5fb75ba94c97b6d70ddb9ea2cb11b5ed01829b5f671d9e8abce7afba20aef5 SHA512 165d2053ffb6f9251b3dbff7516541f363c460397cb0c83e4e867a9df4202082e524c8afc25402bd97d7f7ec769ec00fbec041070ee59ea88908d9f55aaeb2b7 WHIRLPOOL dc9e6abee93c49be6096e86e68a880727dcfb92b311fefac3b2e5b88d17d795e615c6cba0e5db32ce4ed4ec462a46ca659516e707e378d30f4543e6a67975852
+DIST NVIDIA-Linux-x86_64-355.06.run 75926474 SHA256 898304e1455bbccad4a3da3520d7fe17db254413f3458d0a296b45fb9cf2bcd6 SHA512 e9c617c2877ba9049f1242664dc6796c09714c495dbe7ec7705fdaf788c0ab11f35cb7a48058670ab4a56d777b7e02bc1e1f7b90959e4f1dd687a8f2f805f8a4 WHIRLPOOL 909025e9a4705a6ae1be9d1572c0491fdeeb708b3746fd2b2b38ab7e34d37c54f279861c8b33d36a71dd173ec15937b050bbc4c8c554dbeb60174348e005f201
+DIST NVIDIA-Linux-x86_64-96.43.23-pkg2.run 15962375 SHA256 ce8d8253e7dab7da63fbdac449ebf190cd0c10cbfffea0f8d0165515f851bc64 SHA512 04bec1187a6024a2b9839f008ec829281f1f2602dae2e639030bc385943186506bcaa2b46a230b2ab87f9217190841abc62f9e2d6395ab5559623389c31c6563 WHIRLPOOL 0651c44a51a1a06fcff5bfddbf9c3e408977e03263c7fe806cb6c01f9fe92f716dfe4e5190ffe1048bde72fcffdc8bca8267e74dd43ba5c9dfb22b6201fcc2bb
diff --git a/x11-drivers/nvidia-drivers/files/50nvidia-prelink-blacklist b/x11-drivers/nvidia-drivers/files/50nvidia-prelink-blacklist
new file mode 100644
index 000000000000..5e139de33211
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/files/50nvidia-prelink-blacklist
@@ -0,0 +1 @@
+PRELINK_PATH_MASK="/usr/lib{,64}/tls/libnvidia-tls*:/usr/lib{,64}/libnvidia*:/usr/lib{,64}/libGL*:/usr/lib{,64}/opengl/nvidia/*:/usr/lib{,64}/OpenCL/vendors/nvidia/*:/usr/lib{,64}/xorg/modules/drivers/nvidia*:/usr/lib{,64}/libvdpau_nvidia*:/usr/lib{,64}/libXvMCNVIDIA*:/usr/lib{,64}/libcuda*:/usr/lib{,64}/libnvcuvid*"
diff --git a/x11-drivers/nvidia-drivers/files/95-nvidia-settings b/x11-drivers/nvidia-drivers/files/95-nvidia-settings
new file mode 100644
index 000000000000..e9d62742e1e9
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/files/95-nvidia-settings
@@ -0,0 +1,2 @@
+#!/bin/sh
+/opt/bin/nvidia-settings --load-config-only
diff --git a/x11-drivers/nvidia-drivers/files/NVIDIA_glx-defines.patch b/x11-drivers/nvidia-drivers/files/NVIDIA_glx-defines.patch
new file mode 100644
index 000000000000..da9933f6337c
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/files/NVIDIA_glx-defines.patch
@@ -0,0 +1,11 @@
+diff -ur NVIDIA_GLX-1.0-4191/usr/include/GL/glx.h NVIDIA_GLX-1.0-4191.new/usr/include/GL/glx.h
+--- NVIDIA_GLX-1.0-4191/usr/include/GL/glx.h 2002-12-09 21:26:55.000000000 +0100
++++ NVIDIA_GLX-1.0-4191.new/usr/include/GL/glx.h 2003-01-30 18:20:23.000000000 +0100
+@@ -39,6 +39,7 @@
+ typedef XID GLXPixmap;
+ typedef XID GLXDrawable;
+ typedef XID GLXPbuffer;
++typedef XID GLXPbufferSGIX;
+ typedef XID GLXWindow;
+ typedef XID GLXFBConfigID;
+
diff --git a/x11-drivers/nvidia-drivers/files/NVIDIA_glx-glheader.patch b/x11-drivers/nvidia-drivers/files/NVIDIA_glx-glheader.patch
new file mode 100644
index 000000000000..e0393e1b9ab0
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/files/NVIDIA_glx-glheader.patch
@@ -0,0 +1,13 @@
+--- usr/include/GL/gl.g.orig 2004-07-17 19:56:59.789410584 +1000
++++ usr/include/GL/gl.h 2004-07-17 19:59:08.844791184 +1000
+@@ -66,6 +66,10 @@
+ typedef double GLclampd;
+ typedef void GLvoid;
+
++/* Patching for some better defines in the global system */
++#ifndef GL_GLEXT_LEGACY
++#include <GL/glext.h>
++#endif
+
+ /*************************************************************/
+
diff --git a/x11-drivers/nvidia-drivers/files/nvidia-169.07 b/x11-drivers/nvidia-drivers/files/nvidia-169.07
new file mode 100644
index 000000000000..a96b0cd1e40f
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/files/nvidia-169.07
@@ -0,0 +1,14 @@
+# Nvidia drivers support
+alias char-major-195 nvidia
+alias /dev/nvidiactl char-major-195
+
+# To tweak the driver the following options can be used, note that
+# you should be careful, as it could cause instability!! For more
+# options see /usr/share/doc/PACKAGE/README
+#
+# !!! SECURITY WARNING !!!
+# DO NOT MODIFY OR REMOVE THE DEVICE FILE RELATED OPTIONS UNLESS YOU KNOW
+# WHAT YOU ARE DOING.
+# ONLY ADD TRUSTED USERS TO THE VIDEO GROUP, THESE USERS MAY BE ABLE TO CRASH,
+# COMPROMISE, OR IRREPARABLY DAMAGE THE MACHINE.
+options nvidia NVreg_DeviceFileMode=432 NVreg_DeviceFileUID=0 NVreg_DeviceFileGID=VIDEOGID NVreg_ModifyDeviceFiles=1
diff --git a/x11-drivers/nvidia-drivers/files/nvidia-drivers-331.13-pax-usercopy.patch b/x11-drivers/nvidia-drivers/files/nvidia-drivers-331.13-pax-usercopy.patch
new file mode 100644
index 000000000000..9777ce6c2d43
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/files/nvidia-drivers-331.13-pax-usercopy.patch
@@ -0,0 +1,52 @@
+--- a/kernel/nv-linux.h
++++ b/kernel/nv-linux.h
+@@ -757,16 +757,16 @@
+
+ #if defined(NV_KMEM_CACHE_CREATE_PRESENT)
+ #if (NV_KMEM_CACHE_CREATE_ARGUMENT_COUNT == 6)
+-#define NV_KMEM_CACHE_CREATE(kmem_cache, name, type) \
++#define NV_KMEM_CACHE_CREATE(kmem_cache, name, type, flags) \
+ { \
+ kmem_cache = kmem_cache_create(name, sizeof(type), \
+- 0, 0, NULL, NULL); \
++ 0, flags, NULL, NULL); \
+ }
+ #elif (NV_KMEM_CACHE_CREATE_ARGUMENT_COUNT == 5)
+-#define NV_KMEM_CACHE_CREATE(kmem_cache, name, type) \
++#define NV_KMEM_CACHE_CREATE(kmem_cache, name, type, flags) \
+ { \
+ kmem_cache = kmem_cache_create(name, sizeof(type), \
+- 0, 0, NULL); \
++ 0, flags, NULL); \
+ }
+ #else
+ #error "NV_KMEM_CACHE_CREATE_ARGUMENT_COUNT value unrecognized!"
+--- a/kernel/nv.c
++++ b/kernel/nv.c
+@@ -794,7 +794,7 @@
+ NV_SPIN_LOCK_INIT(&km_lock);
+ #endif
+
+- NV_KMEM_CACHE_CREATE(nv_stack_t_cache, NV_STACK_CACHE_STR, nv_stack_t);
++ NV_KMEM_CACHE_CREATE(nv_stack_t_cache, NV_STACK_CACHE_STR, nv_stack_t, SLAB_USERCOPY);
+ if (nv_stack_t_cache == NULL)
+ {
+ nv_printf(NV_DBG_ERRORS, "NVRM: stack cache allocation failed!\n");
+@@ -924,7 +924,7 @@
+ nv->os_state = (void *) &nv_ctl_device;
+ nv_lock_init_locks(nv);
+
+- NV_KMEM_CACHE_CREATE(nv_pte_t_cache, NV_PTE_CACHE_STR, nv_pte_t);
++ NV_KMEM_CACHE_CREATE(nv_pte_t_cache, NV_PTE_CACHE_STR, nv_pte_t, 0);
+ if (nv_pte_t_cache == NULL)
+ {
+ rc = -ENOMEM;
+@@ -935,7 +935,7 @@
+ if (NV_BUILD_MODULE_INSTANCES == 0)
+ {
+ NV_KMEM_CACHE_CREATE(nvidia_p2p_page_t_cache, "nvidia_p2p_page_t",
+- nvidia_p2p_page_t);
++ nvidia_p2p_page_t, 0);
+ if (nvidia_p2p_page_t_cache == NULL)
+ {
+ rc = -ENOMEM;
diff --git a/x11-drivers/nvidia-drivers/files/nvidia-drivers-337.12-pax-constify.patch b/x11-drivers/nvidia-drivers/files/nvidia-drivers-337.12-pax-constify.patch
new file mode 100644
index 000000000000..0ec9edf99cc8
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/files/nvidia-drivers-337.12-pax-constify.patch
@@ -0,0 +1,25 @@
+--- a/kernel/uvm/nvidia_uvm_common.c
++++ b/kernel/uvm/nvidia_uvm_common.c
+@@ -95,7 +95,6 @@ static RM_STATUS uvmnext_gpu_event_stop_
+ #endif // NVIDIA_UVM_NEXT_ENABLED
+
+ static dev_t g_uvmBaseDev;
+-struct UvmOpsUvmEvents g_exportedUvmOps;
+
+ // TODO: This would be easier if RM allowed for multiple registrations, since we
+ // could register UVM-Lite and UVM-Next separately (bug 1372835).
+@@ -147,9 +146,11 @@ static RM_STATUS uvmSetupGpuProvider(voi
+ RM_STATUS status = RM_OK;
+
+ #ifdef NVIDIA_UVM_RM_ENABLED
+- g_exportedUvmOps.startDevice = uvm_gpu_event_start_device;
+- g_exportedUvmOps.stopDevice = uvm_gpu_event_stop_device;
+- g_exportedUvmOps.isrTopHalf = uvmnext_isr_top_half;
++ static struct UvmOpsUvmEvents g_exportedUvmOps = {
++ .startDevice = uvm_gpu_event_start_device,
++ .stopDevice = uvm_gpu_event_stop_device,
++ .isrTopHalf = uvmnext_isr_top_half,
++ };
+
+ // call RM to exchange the function pointers.
+ status = nvUvmInterfaceRegisterUvmCallbacks(&g_exportedUvmOps);
diff --git a/x11-drivers/nvidia-drivers/files/nvidia-drivers-346.16-pax-constify.patch b/x11-drivers/nvidia-drivers/files/nvidia-drivers-346.16-pax-constify.patch
new file mode 100644
index 000000000000..9b9f53e45dcc
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/files/nvidia-drivers-346.16-pax-constify.patch
@@ -0,0 +1,25 @@
+--- a/kernel/uvm/uvm_common.c
++++ b/kernel/uvm/uvm_common.c
+@@ -95,7 +95,6 @@ static RM_STATUS uvmnext_gpu_event_stop_
+ #endif // NVIDIA_UVM_NEXT_ENABLED
+
+ static dev_t g_uvmBaseDev;
+-struct UvmOpsUvmEvents g_exportedUvmOps;
+
+ // TODO: This would be easier if RM allowed for multiple registrations, since we
+ // could register UVM-Lite and UVM-Next separately (bug 1372835).
+@@ -147,9 +146,11 @@ static RM_STATUS uvmSetupGpuProvider(voi
+ RM_STATUS status = RM_OK;
+
+ #ifdef NVIDIA_UVM_RM_ENABLED
+- g_exportedUvmOps.startDevice = uvm_gpu_event_start_device;
+- g_exportedUvmOps.stopDevice = uvm_gpu_event_stop_device;
+- g_exportedUvmOps.isrTopHalf = uvmnext_isr_top_half;
++ static struct UvmOpsUvmEvents g_exportedUvmOps = {
++ .startDevice = uvm_gpu_event_start_device,
++ .stopDevice = uvm_gpu_event_stop_device,
++ .isrTopHalf = uvmnext_isr_top_half,
++ };
+
+ // call RM to exchange the function pointers.
+ status = nvUvmInterfaceRegisterUvmCallbacks(&g_exportedUvmOps);
diff --git a/x11-drivers/nvidia-drivers/files/nvidia-drivers-346.16-pax-usercopy.patch b/x11-drivers/nvidia-drivers/files/nvidia-drivers-346.16-pax-usercopy.patch
new file mode 100644
index 000000000000..d1a440c94aae
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/files/nvidia-drivers-346.16-pax-usercopy.patch
@@ -0,0 +1,47 @@
+--- a/kernel/nv.c
++++ b/kernel/nv.c
+@@ -705,7 +705,7 @@ int __init nvidia_init_module(void)
+ #endif
+
+ nvidia_stack_t_cache = NV_KMEM_CACHE_CREATE(nvidia_stack_cache_name,
+- nvidia_stack_t);
++ nvidia_stack_t, SLAB_USERCOPY);
+ if (nvidia_stack_t_cache == NULL)
+ {
+ nv_printf(NV_DBG_ERRORS, "NVRM: stack cache allocation failed!\n");
+@@ -846,7 +846,7 @@ int __init nvidia_init_module(void)
+ nv_lock_init_locks(nv);
+
+ nvidia_pte_t_cache = NV_KMEM_CACHE_CREATE(nvidia_pte_cache_name,
+- nvidia_pte_t);
++ nvidia_pte_t, 0);
+ if (nvidia_pte_t_cache == NULL)
+ {
+ rc = -ENOMEM;
+@@ -857,7 +857,7 @@ int __init nvidia_init_module(void)
+ if (!nv_multiple_kernel_modules)
+ {
+ nvidia_p2p_page_t_cache = NV_KMEM_CACHE_CREATE(nvidia_p2p_page_cache_name,
+- nvidia_p2p_page_t);
++ nvidia_p2p_page_t, 0);
+ if (nvidia_p2p_page_t_cache == NULL)
+ {
+ rc = -ENOMEM;
+--- a/kernel/nv-linux.h
++++ b/kernel/nv-linux.h
+@@ -1431,11 +1431,11 @@ extern void *nvidia_stack_t_cache;
+
+ #if !defined(NV_VMWARE)
+ #if (NV_KMEM_CACHE_CREATE_ARGUMENT_COUNT == 5)
+-#define NV_KMEM_CACHE_CREATE(name, type) \
+- kmem_cache_create(name, sizeof(type), 0, 0, NULL)
++#define NV_KMEM_CACHE_CREATE(name, type, flags) \
++ kmem_cache_create(name, sizeof(type), 0, flags, NULL)
+ #else
+-#define NV_KMEM_CACHE_CREATE(name, type) \
+- kmem_cache_create(name, sizeof(type), 0, 0, NULL, \
++#define NV_KMEM_CACHE_CREATE(name, type, flags) \
++ kmem_cache_create(name, sizeof(type), 0, flags, NULL, \
+ NULL)
+ #endif
+ #define NV_KMEM_CACHE_DESTROY(kmem_cache) \
diff --git a/x11-drivers/nvidia-drivers/files/nvidia-drivers-pax-const.patch b/x11-drivers/nvidia-drivers/files/nvidia-drivers-pax-const.patch
new file mode 100644
index 000000000000..f3b82593570e
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/files/nvidia-drivers-pax-const.patch
@@ -0,0 +1,17 @@
+Binary files kernel.orig/.nv-procfs.c.swp and kernel/.nv-procfs.c.swp differ
+diff -urp kernel.orig/nv-procfs.c kernel/nv-procfs.c
+--- kernel.orig/nv-procfs.c 2011-07-13 03:29:30.000000000 +0200
++++ kernel/nv-procfs.c 2011-07-19 15:45:27.982993911 +0200
+@@ -707,8 +707,10 @@ int nv_register_procfs(void)
+ * However, in preparation for this, we need to preserve
+ * the procfs read() and write() operations.
+ */
+- nv_procfs_registry_fops.read = entry->proc_fops->read;
+- nv_procfs_registry_fops.write = entry->proc_fops->write;
++ pax_open_kernel();
++ *(void **)&nv_procfs_registry_fops.read = entry->proc_fops->read;
++ *(void **)&nv_procfs_registry_fops.write = entry->proc_fops->write;
++ pax_close_kernel();
+
+ entry = NV_CREATE_PROC_FILE("registry", proc_nvidia,
+ nv_procfs_read_registry,
diff --git a/x11-drivers/nvidia-drivers/files/nvidia-drivers-pax-usercopy.patch b/x11-drivers/nvidia-drivers/files/nvidia-drivers-pax-usercopy.patch
new file mode 100644
index 000000000000..ce8c201b8e05
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/files/nvidia-drivers-pax-usercopy.patch
@@ -0,0 +1,54 @@
+diff -urp kernel.orig/nv.c kernel/nv.c
+--- kernel.orig/nv.c 2011-09-24 02:32:09.000000000 +0200
++++ kernel/nv.c 2011-10-05 19:13:41.474242252 +0200
+@@ -1105,7 +1105,7 @@ static int __init nvidia_init_module(voi
+ NV_SPIN_LOCK_INIT(&km_lock);
+ #endif
+
+- NV_KMEM_CACHE_CREATE(nv_stack_t_cache, "nv_stack_t", nv_stack_t);
++ NV_KMEM_CACHE_CREATE(nv_stack_t_cache, "nv_stack_t", nv_stack_t, SLAB_USERCOPY);
+ if (nv_stack_t_cache == NULL)
+ {
+ nv_printf(NV_DBG_ERRORS, "NVRM: stack cache allocation failed!\n");
+@@ -1220,7 +1220,7 @@ static int __init nvidia_init_module(voi
+ }
+ #endif
+
+- NV_KMEM_CACHE_CREATE(nv_pte_t_cache, "nv_pte_t", nv_pte_t);
++ NV_KMEM_CACHE_CREATE(nv_pte_t_cache, "nv_pte_t", nv_pte_t, 0);
+ if (nv_pte_t_cache == NULL)
+ {
+ rc = -ENOMEM;
+@@ -1229,7 +1229,7 @@ static int __init nvidia_init_module(voi
+ }
+
+ NV_KMEM_CACHE_CREATE(nvidia_p2p_page_t_cache, "nvidia_p2p_page_t",
+- nvidia_p2p_page_t);
++ nvidia_p2p_page_t, 0);
+ if (nvidia_p2p_page_t_cache == NULL)
+ {
+ rc = -ENOMEM;
+diff -urp kernel.orig/nv-linux.h kernel/nv-linux.h
+--- kernel.orig/nv-linux.h 2011-09-24 02:32:09.000000000 +0200
++++ kernel/nv-linux.h 2011-10-05 19:14:42.522238996 +0200
+@@ -695,16 +695,16 @@ extern nv_spinlock_t km_lock;
+
+ #if defined(NV_KMEM_CACHE_CREATE_PRESENT)
+ #if (NV_KMEM_CACHE_CREATE_ARGUMENT_COUNT == 6)
+-#define NV_KMEM_CACHE_CREATE(kmem_cache, name, type) \
++#define NV_KMEM_CACHE_CREATE(kmem_cache, name, type, flags) \
+ { \
+ kmem_cache = kmem_cache_create(name, sizeof(type), \
+- 0, 0, NULL, NULL); \
++ 0, flags, NULL, NULL); \
+ }
+ #elif (NV_KMEM_CACHE_CREATE_ARGUMENT_COUNT == 5)
+-#define NV_KMEM_CACHE_CREATE(kmem_cache, name, type) \
++#define NV_KMEM_CACHE_CREATE(kmem_cache, name, type, flags) \
+ { \
+ kmem_cache = kmem_cache_create(name, sizeof(type), \
+- 0, 0, NULL); \
++ 0, flags, NULL); \
+ }
+ #else
+ #error "NV_KMEM_CACHE_CREATE_ARGUMENT_COUNT value unrecognized!"
diff --git a/x11-drivers/nvidia-drivers/files/nvidia-drivers-settings.desktop b/x11-drivers/nvidia-drivers/files/nvidia-drivers-settings.desktop
new file mode 100644
index 000000000000..773a5af24668
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/files/nvidia-drivers-settings.desktop
@@ -0,0 +1,7 @@
+[Desktop Entry]
+Type=Application
+Name=NVIDIA X Server Settings
+Comment=Configure NVIDIA X Server Settings
+Exec=/opt/bin/nvidia-settings
+Icon=nvidia-drivers-settings
+Categories=System;Settings;
diff --git a/x11-drivers/nvidia-drivers/files/nvidia-persistenced.conf b/x11-drivers/nvidia-drivers/files/nvidia-persistenced.conf
new file mode 100644
index 000000000000..637ac1afb415
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/files/nvidia-persistenced.conf
@@ -0,0 +1,8 @@
+# run-time configuration file for /etc/init.d/nvidia-persistenced
+
+# NVPD_USER: The user nvidia-persistenced is intended to run for
+NVPD_USER=""
+
+# ARGS: Additional arguments to set the default persistence mode
+# (see nvidia-persistenced(1))
+ARGS=""
diff --git a/x11-drivers/nvidia-drivers/files/nvidia-persistenced.init b/x11-drivers/nvidia-drivers/files/nvidia-persistenced.init
new file mode 100755
index 000000000000..07f690547b42
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/files/nvidia-persistenced.init
@@ -0,0 +1,25 @@
+#!/sbin/runscript
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+pidfile="/var/run/nvidia-persistenced/nvidia-persistenced.pid"
+
+start() {
+ if ! [ "${NVPD_USER}x" = x ]; then
+ ebegin "Starting nvidia-persistenced for ${NVPD_USER}"
+ NVPD_USER_ARG="--user ${NVPD_USER}"
+ else
+ ebegin "Starting nvidia-persistenced"
+ fi
+ start-stop-daemon --start --quiet --pidfile ${pidfile} \
+ --background --exec /opt/bin/nvidia-persistenced \
+ -- ${NVPD_USER_ARG} ${ARGS}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping nvidia-persistenced"
+ start-stop-daemon --stop --quiet --pidfile ${pidfile}
+ eend $?
+}
diff --git a/x11-drivers/nvidia-drivers/files/nvidia-smi.init b/x11-drivers/nvidia-drivers/files/nvidia-smi.init
new file mode 100644
index 000000000000..6dce4e846394
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/files/nvidia-smi.init
@@ -0,0 +1,25 @@
+#!/sbin/runscript
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+pidfile="/run/nvidia-smi.pid"
+
+depend() {
+ after modules
+}
+
+start() {
+ ebegin "Starting NVIDIA System Management Interface"
+ rm -f ${pidfile}
+ start-stop-daemon --start --quiet --pidfile ${pidfile} \
+ --make-pidfile --background --exec /opt/bin/nvidia-smi -- \
+ -q -l 300
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping NVIDIA System Management Interface"
+ start-stop-daemon --stop --quiet --pidfile ${pidfile}
+ eend $?
+}
diff --git a/x11-drivers/nvidia-drivers/files/nvidia-udev.sh b/x11-drivers/nvidia-drivers/files/nvidia-udev.sh
new file mode 100644
index 000000000000..9487b08e7a5e
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/files/nvidia-udev.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+if [ $# -ne 1 ]; then
+ echo "Invalid args" >&2
+ exit 1
+fi
+
+case $1 in
+ add|ADD)
+ /opt/bin/nvidia-smi > /dev/null
+ ;;
+ remove|REMOVE)
+ rm -f /dev/nvidia*
+ ;;
+esac
+
+exit 0
diff --git a/x11-drivers/nvidia-drivers/files/nvidia-uvm.conf b/x11-drivers/nvidia-drivers/files/nvidia-uvm.conf
new file mode 100644
index 000000000000..222c5ba39265
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/files/nvidia-uvm.conf
@@ -0,0 +1,3 @@
+# Nvidia UVM support
+
+remove nvidia modprobe -r --ignore-remove nvidia-uvm nvidia
diff --git a/x11-drivers/nvidia-drivers/files/nvidia.udev-rule b/x11-drivers/nvidia-drivers/files/nvidia.udev-rule
new file mode 100644
index 000000000000..2eb30bb0eba5
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/files/nvidia.udev-rule
@@ -0,0 +1,6 @@
+ACTION=="add", DEVPATH=="/module/nvidia", SUBSYSTEM=="module", RUN+="nvidia-udev.sh $env{ACTION}"
+# Previously the ACTION was "add|remove" but one user on bug #376527 had a
+# problem until he recompiled udev-171-r5, which is one of the versions I
+# tested with and it was fine. I'm breaking the rules out just to be safe
+# so someone else doesn't have an issue
+ACTION=="remove", DEVPATH=="/module/nvidia", SUBSYSTEM=="module", RUN+="nvidia-udev.sh $env{ACTION}"
diff --git a/x11-drivers/nvidia-drivers/metadata.xml b/x11-drivers/nvidia-drivers/metadata.xml
new file mode 100644
index 000000000000..d4fc77506799
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/metadata.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<maintainer>
+ <email>jer@gentoo.org</email>
+</maintainer>
+<use>
+ <flag name='X'>Install the X.org driver, OpenGL libraries, XvMC libraries, and VDPAU libraries</flag>
+ <flag name='gtk2'>Install nvidia-settings with support for GTK+ 2</flag>
+ <flag name='gtk3'>Install nvidia-settings with support for GTK+ 3</flag>
+ <flag name='pax_kernel'>PaX patches from the PaX project</flag>
+ <flag name='tools'>Install additional tools such as nvidia-settings</flag>
+ <flag name='uvm'>Install the Unified Memory kernel module (nvidia-uvm) for sharing memory between CPU and GPU in CUDA programs</flag>
+</use>
+</pkgmetadata>
diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-173.14.39.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-173.14.39.ebuild
new file mode 100644
index 000000000000..b1a361d5fa92
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/nvidia-drivers-173.14.39.ebuild
@@ -0,0 +1,546 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils flag-o-matic linux-mod multilib nvidia-driver portability \
+ unpacker user versionator
+
+X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
+AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
+X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
+
+DESCRIPTION="NVIDIA Accelerated Graphics Driver"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="x86? ( http://us.download.nvidia.com/XFree86/Linux-x86/${PV}/${X86_NV_PACKAGE}-pkg0.run )
+ amd64? ( http://us.download.nvidia.com/XFree86/Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}-pkg2.run )
+ x86-fbsd? ( http://us.download.nvidia.com/freebsd/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )"
+
+LICENSE="GPL-2 NVIDIA-r1"
+SLOT="0"
+KEYWORDS="-* amd64 x86 ~x86-fbsd"
+IUSE="acpi multilib kernel_linux tools"
+RESTRICT="bindist mirror strip"
+EMULTILIB_PKG="true"
+
+COMMON="
+ >=app-eselect/eselect-opengl-1.0.9
+ kernel_linux? ( >=sys-libs/glibc-2.6.1 )
+"
+DEPEND="
+ ${COMMON}
+ kernel_linux? ( virtual/linux-sources )
+"
+RDEPEND="
+ ${COMMON}
+ <x11-base/xorg-server-1.15.99:=
+ acpi? ( sys-power/acpid )
+ multilib? (
+ >=x11-libs/libX11-1.6.2[abi_x86_32]
+ >=x11-libs/libXext-1.3.2[abi_x86_32]
+ )
+ tools? (
+ dev-libs/atk
+ dev-libs/glib:2
+ x11-libs/gdk-pixbuf
+ x11-libs/gtk+:2
+ x11-libs/libX11
+ x11-libs/libXext
+ x11-libs/pango[X]
+ )
+"
+
+QA_TEXTRELS_x86="usr/lib/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+ usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+ usr/lib/opengl/nvidia/lib/libGLcore.so.${PV}
+ usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+ usr/lib/xorg/modules/drivers/nvidia_drv.so
+ usr/lib/libcuda.so.${PV}
+ usr/lib/libnvidia-cfg.so.${PV}
+ usr/lib/libvdpau_nvidia.so.${PV}
+ usr/lib/libXvMCNVIDIA.so.${PV}"
+
+QA_TEXTRELS_x86_fbsd="boot/modules/nvidia.ko
+ usr/lib/opengl/nvidia/lib/libGL.so.1
+ usr/lib/opengl/nvidia/lib/libGLcore.so.1
+ usr/lib/libnvidia-cfg.so.1
+ usr/lib/opengl/nvidia/extensions/libglx.so.1
+ usr/lib/xorg/modules/drivers/nvidia_drv.so"
+
+QA_TEXTRELS_amd64="usr/lib32/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+ usr/lib32/opengl/nvidia/lib/libGLcore.so.${PV}
+ usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+ usr/lib32/libcuda.so.${PV}
+ usr/lib32/libvdpau_nvidia.so.${PV}"
+
+QA_EXECSTACK_x86="usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+ usr/lib/opengl/nvidia/lib/libGLcore.so.${PV}
+ usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+ usr/lib/xorg/modules/drivers/nvidia_drv.so
+ usr/lib/libXvMCNVIDIA.a:NVXVMC.o"
+
+QA_EXECSTACK_amd64="usr/lib32/opengl/nvidia/lib/libGLcore.so.${PV}
+ usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+ usr/lib64/libnvcompiler.so.${PV}
+ usr/lib64/libXvMCNVIDIA.so.${PV}
+ usr/lib64/libXvMCNVIDIA.a:NVXVMC.o
+ usr/lib64/libnvidia-cfg.so.${PV}
+ usr/lib64/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+ usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
+ usr/lib64/opengl/nvidia/lib/libGLcore.so.${PV}
+ usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}
+ usr/lib64/xorg/modules/drivers/nvidia_drv.so
+ opt/bin/nvidia-settings
+ opt/bin/nvidia-smi
+ opt/bin/nvidia-xconfig"
+
+QA_WX_LOAD_x86="usr/lib/opengl/nvidia/lib/libGLcore.so.${PV}
+ usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+ usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+ usr/lib/libXvMCNVIDIA.a"
+
+QA_WX_LOAD_amd64="usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+ usr/lib32/opengl/nvidia/lib/libGLcore.so.${PV}
+ usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
+ usr/lib64/opengl/nvidia/lib/libGLcore.so.${PV}
+ usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}"
+
+QA_SONAME_amd64="usr/lib64/libnvcompiler.so.${PV}"
+
+QA_FLAGS_IGNORED_amd64="usr/lib32/libcuda.so.${PV}
+ usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+ usr/lib32/opengl/nvidia/lib/libGLcore.so.${PV}
+ usr/lib32/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+ usr/lib32/libvdpau_nvidia.so.${PV}
+ usr/lib64/libXvMCNVIDIA.so.${PV}
+ usr/lib64/libcuda.so.${PV}
+ usr/lib64/libnvidia-cfg.so.${PV}
+ usr/lib64/opengl/nvidia/lib/libGLcore.so.${PV}
+ usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
+ usr/lib64/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+ usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}
+ usr/lib64/xorg/modules/drivers/nvidia_drv.so
+ usr/lib64/libvdpau_nvidia.so.${PV}
+ opt/bin/nvidia-settings
+ opt/bin/nvidia-smi
+ opt/bin/nvidia-xconfig"
+
+QA_FLAGS_IGNORED_x86="usr/lib/libcuda.so.${PV}
+ usr/lib/libnvidia-cfg.so.${PV}
+ usr/lib/opengl/nvidia/lib/libGLcore.so.${PV}
+ usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+ usr/lib/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+ usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+ usr/lib/xorg/modules/drivers/nvidia_drv.so
+ usr/lib/libXvMCNVIDIA.so.${PV}
+ usr/lib/libvdpau_nvidia.so.${PV}
+ opt/bin/nvidia-settings
+ opt/bin/nvidia-smi
+ opt/bin/nvidia-xconfig"
+
+S="${WORKDIR}/"
+
+mtrr_check() {
+ ebegin "Checking for MTRR support"
+ linux_chkconfig_present MTRR
+ eend $?
+
+ if [[ $? -ne 0 ]] ; then
+ eerror "Please enable MTRR support in your kernel config, found at:"
+ eerror
+ eerror " Processor type and features"
+ eerror " [*] MTRR (Memory Type Range Register) support"
+ eerror
+ eerror "and recompile your kernel ..."
+ die "MTRR support not detected!"
+ fi
+}
+
+lockdep_check() {
+ if linux_chkconfig_present LOCKDEP; then
+ eerror "You've enabled LOCKDEP -- lock tracking -- in the kernel."
+ eerror "Unfortunately, this option exports the symbol 'lockdep_init_map' as GPL-only"
+ eerror "which will prevent ${P} from compiling."
+ eerror "Please make sure the following options have been unset:"
+ eerror " Kernel hacking --->"
+ eerror " [ ] Lock debugging: detect incorrect freeing of live locks"
+ eerror " [ ] Lock debugging: prove locking correctness"
+ eerror " [ ] Lock usage statistics"
+ eerror "in 'menuconfig'"
+ die "LOCKDEP enabled"
+ fi
+}
+
+pkg_setup() {
+ # try to turn off distcc and ccache for people that have a problem with it
+ export DISTCC_DISABLE=1
+ export CCACHE_DISABLE=1
+
+ if use amd64 && has_multilib_profile && [ "${DEFAULT_ABI}" != "amd64" ]; then
+ eerror "This ebuild doesn't currently support changing your default abi."
+ die "Unexpected \${DEFAULT_ABI} = ${DEFAULT_ABI}"
+ fi
+
+ if use kernel_linux; then
+ linux-mod_pkg_setup
+ MODULE_NAMES="nvidia(video:${S}/usr/src/nv)"
+ BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} \
+ SYSOUT=${KV_OUT_DIR} CC=$(tc-getBUILD_CC)"
+ # linux-mod_src_compile calls set_arch_to_kernel, which
+ # sets the ARCH to x86 but NVIDIA's wrapping Makefile
+ # expects x86_64 or i386 and then converts it to x86
+ # later on in the build process
+ BUILD_FIXES="ARCH=$(uname -m | sed -e 's/i.86/i386/')"
+ mtrr_check
+ lockdep_check
+ fi
+
+ # On BSD userland it wants real make command
+ use userland_BSD && MAKE="$(get_bmake)"
+
+ export _POSIX2_VERSION="199209"
+
+ if use kernel_linux && kernel_is ge 3 13 ; then
+ ewarn "Gentoo supports kernels which are supported by NVIDIA"
+ ewarn "which are limited to the following kernels:"
+ ewarn "<sys-kernel/gentoo-sources-3.13"
+ ewarn "<sys-kernel/vanilla-sources-3.13"
+ ewarn ""
+ ewarn "You are free to utilize epatch_user to provide whatever"
+ ewarn "support you feel is appropriate, but will not receive"
+ ewarn "support as a result of those changes."
+ ewarn ""
+ ewarn "Do not file a bug report about this."
+ fi
+
+ # Since Nvidia ships 3 different series of drivers, we need to give the user
+ # some kind of guidance as to what version they should install. This tries
+ # to point the user in the right direction but can't be perfect. check
+ # nvidia-driver.eclass
+ nvidia-driver-check-warning
+
+ # set variables to where files are in the package structure
+ if use kernel_FreeBSD; then
+ use x86-fbsd && S="${WORKDIR}/${X86_FBSD_NV_PACKAGE}"
+ NV_DOC="${S}/doc"
+ NV_EXEC="${S}/obj"
+ NV_LIB="${S}/obj"
+ NV_SRC="${S}/src"
+ NV_MAN="${S}/x11/man"
+ NV_X11="${S}/obj"
+ NV_X11_DRV="${NV_X11}"
+ NV_X11_EXT="${NV_X11}"
+ NV_SOVER=1
+ elif use kernel_linux; then
+ NV_DOC="${S}/usr/share/doc"
+ NV_EXEC="${S}/usr/bin"
+ NV_LIB="${S}/usr/lib"
+ NV_SRC="${S}/usr/src/nv"
+ NV_MAN="${S}/usr/share/man/man1"
+ NV_X11="${S}/usr/X11R6/lib"
+ NV_X11_DRV="${NV_X11}/modules/drivers"
+ NV_X11_EXT="${NV_X11}/modules/extensions"
+ NV_SOVER=${PV}
+ else
+ die "Could not determine proper NVIDIA package"
+ fi
+}
+
+src_unpack() {
+ if use kernel_linux && kernel_is lt 2 6 7; then
+ echo
+ ewarn "Your kernel version is ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}"
+ ewarn "This is not officially supported for ${P}. It is likely you"
+ ewarn "will not be able to compile or use the kernel module."
+ ewarn "It is recommended that you upgrade your kernel to a version >= 2.6.7"
+ echo
+ ewarn "DO NOT file bug reports for kernel versions less than 2.6.7 as they will be ignored."
+ fi
+
+ if ! use x86-fbsd; then
+ mkdir "${S}"
+ cd "${S}"
+ unpack_makeself
+ else
+ unpack ${A}
+ fi
+}
+
+src_prepare() {
+ # Please add a brief description for every added patch
+ use x86-fbsd && cd doc
+
+ # Use the correct defines to make gtkglext build work
+ epatch "${FILESDIR}"/NVIDIA_glx-defines.patch
+ # Use some more sensible gl headers and make way for new glext.h
+ epatch "${FILESDIR}"/NVIDIA_glx-glheader.patch
+
+ if use kernel_linux; then
+ # Quiet down warnings the user does not need to see
+ sed -i \
+ -e 's:-Wpointer-arith::g' \
+ -e 's:-Wsign-compare::g' \
+ "${NV_SRC}"/Makefile.kbuild
+
+ # If greater than 2.6.5 use M= instead of SUBDIR=
+ convert_to_m "${NV_SRC}"/Makefile.kbuild
+ fi
+
+ epatch_user
+}
+
+src_compile() {
+ # This is already the default on Linux, as there's no toplevel Makefile, but
+ # on FreeBSD there's one and triggers the kernel module build, as we install
+ # it by itself, pass this.
+
+ cd "${NV_SRC}"
+ if use x86-fbsd; then
+ MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
+ LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)"
+ elif use kernel_linux; then
+ linux-mod_src_compile
+ fi
+}
+
+src_install() {
+ if use kernel_linux; then
+ linux-mod_src_install
+
+ # Add the aliases
+ # This file is tweaked with the appropriate video group in
+ # pkg_preinst, see bug #491414
+ insinto /etc/modprobe.d
+ newins "${FILESDIR}"/nvidia-169.07 nvidia.conf
+ elif use kernel_FreeBSD; then
+ insinto /boot/modules
+ doins "${WORKDIR}/${NV_PACKAGE}/src/nvidia.kld"
+
+ exeinto /boot/modules
+ doexe "${WORKDIR}/${NV_PACKAGE}/src/nvidia.ko"
+ fi
+
+ # NVIDIA kernel <-> userspace driver config lib
+ dolib.so ${NV_LIB}/libnvidia-cfg.so.${NV_SOVER} || \
+ die "failed to install libnvidia-cfg"
+ dosym libnvidia-cfg.so.${NV_SOVER} \
+ /usr/$(get_libdir)/libnvidia-cfg.so.1 || \
+ die "failed to create libnvidia-cfg.so.1 symlink"
+ dosym libnvidia-cfg.so.1 \
+ /usr/$(get_libdir)/libnvidia-cfg.so || \
+ die "failed to create libnvidia-cfg.so symlink"
+
+ # Xorg DDX driver
+ insinto /usr/$(get_libdir)/xorg/modules/drivers
+ doins ${NV_X11_DRV}/nvidia_drv.so
+
+ # Xorg GLX driver
+ insinto /usr/$(get_libdir)/opengl/nvidia/extensions
+ doins ${NV_X11_EXT}/libglx.so.${NV_SOVER} || \
+ die "failed to install libglx.so"
+ dosym /usr/$(get_libdir)/opengl/nvidia/extensions/libglx.so.${NV_SOVER} \
+ /usr/$(get_libdir)/opengl/nvidia/extensions/libglx.so || \
+ die "failed to create libglx.so symlink"
+
+ # XvMC driver
+ dolib.a ${NV_X11}/libXvMCNVIDIA.a || \
+ die "failed to install libXvMCNVIDIA.so"
+ dolib.so ${NV_X11}/libXvMCNVIDIA.so.${NV_SOVER} || \
+ die "failed to install libXvMCNVIDIA.so"
+ dosym libXvMCNVIDIA.so.${NV_SOVER} \
+ /usr/$(get_libdir)/libXvMCNVIDIA.so.1 || \
+ die "failed to create libXvMCNVIDIA.so.1 symlink"
+ dosym libXvMCNVIDIA.so.1 \
+ /usr/$(get_libdir)/libXvMCNVIDIA.so || \
+ die "failed to create libXvMCNVIDIA.so symlink"
+ dosym libXvMCNVIDIA.so.${NV_SOVER} \
+ /usr/$(get_libdir)/libXvMCNVIDIA_dynamic.so.1 || \
+ die "failed to create libXvMCNVIDIA_dynamic.so.1 symlink"
+
+ # CUDA headers (driver to come)
+ if use kernel_linux && [[ -d ${S}/usr/include/cuda ]]; then
+ dodir /usr/include/cuda
+ insinto /usr/include/cuda
+ doins usr/include/cuda/*.h
+ fi
+
+ # OpenCL headers (driver to come)
+ if [[ -d ${S}/usr/include/CL ]]; then
+ dodir /usr/include/CL
+ insinto /usr/include/CL
+ doins usr/include/CL/*.h
+ fi
+
+ # Documentation
+ dodoc ${NV_DOC}/XF86Config.sample
+ dohtml ${NV_DOC}/html/*
+ if use x86-fbsd; then
+ dodoc "${NV_DOC}/README"
+ doman "${NV_MAN}/nvidia-xconfig.1"
+ doman "${NV_MAN}/nvidia-settings.1"
+ else
+ # Docs
+ newdoc "${NV_DOC}/README.txt" README
+ dodoc "${NV_DOC}/NVIDIA_Changelog"
+ doman "${NV_MAN}/nvidia-xconfig.1.gz"
+ doman "${NV_MAN}/nvidia-settings.1.gz"
+ fi
+
+ # Helper Apps
+ exeinto /opt/bin/
+ doexe ${NV_EXEC}/nvidia-xconfig
+ doexe ${NV_EXEC}/nvidia-bug-report.sh
+ if use tools; then
+ doexe usr/bin/nvidia-settings
+ fi
+ if use kernel_linux; then
+ doexe ${NV_EXEC}/nvidia-smi
+ fi
+
+ # Desktop entry for nvidia-settings
+ if use tools && use kernel_linux; then
+ sed -e 's:__UTILS_PATH__:/opt/bin:' \
+ -e 's:__PIXMAP_PATH__:/usr/share/pixmaps:' \
+ -e '/^Categories/s|Application;||g' \
+ -i "${S}"/usr/share/applications//nvidia-settings.desktop
+ newmenu "${S}"/usr/share/applications/nvidia-settings.desktop \
+ nvidia-settings-opt.desktop
+ fi
+
+ if has_multilib_profile ; then
+ local OABI=${ABI}
+ for ABI in $(get_install_abis) ; do
+ src_install-libs
+ done
+ ABI=${OABI}
+ unset OABI
+ else
+ src_install-libs
+ fi
+
+ is_final_abi || die "failed to iterate through all ABIs"
+
+ readme.gentoo_create_doc
+}
+
+# Install nvidia library:
+# the first parameter is the place where to install it
+# the second parameter is the base name of the library
+# the third parameter is the provided soversion
+donvidia() {
+ dodir $1
+ exeinto $1
+
+ libname=$(basename $2)
+
+ doexe $2.$3
+ dosym ${libname}.$3 $1/${libname}
+ [[ $3 != "1" ]] && dosym ${libname}.$3 $1/${libname}.1
+}
+
+src_install-libs() {
+ local inslibdir=$(get_libdir)
+ local NV_ROOT="/usr/${inslibdir}/opengl/nvidia"
+ local libdir= sover=
+
+ if use kernel_linux; then
+ if has_multilib_profile && [[ ${ABI} == "x86" ]] ; then
+ libdir=usr/lib32
+ else
+ libdir=usr/lib
+ fi
+ sover=${PV}
+ else
+ libdir=obj
+ # on FreeBSD it has just .1 suffix
+ sover=1
+ fi
+
+ # The GLX libraries
+ donvidia ${NV_ROOT}/lib ${libdir}/libGL.so ${sover}
+ donvidia ${NV_ROOT}/lib ${libdir}/libGLcore.so ${sover}
+ if use x86-fbsd; then
+ donvidia ${NV_ROOT}/lib ${libdir}/libnvidia-tls.so ${sover}
+ else
+ donvidia ${NV_ROOT}/lib ${libdir}/tls/libnvidia-tls.so ${sover}
+ fi
+
+ #cuda
+ if [[ -f ${libdir}/libcuda.so.${sover} ]]; then
+ dolib.so ${libdir}/libcuda.so.${sover}
+ [[ "${sover}" != "1" ]] && dosym libcuda.so.${sover} /usr/${inslibdir}/libcuda.so.1
+ dosym libcuda.so.1 /usr/${inslibdir}/libcuda.so
+ fi
+
+ #vdpau
+ if [[ -f ${libdir}/libvdpau_nvidia.so.${sover} ]]; then
+ dolib.so ${libdir}/libvdpau_nvidia.so.${sover}
+ dosym libvdpau_nvidia.so.${sover} /usr/${inslibdir}/libvdpau_nvidia.so
+ fi
+
+ # OpenCL
+ # NOTE: This isn't currently available in the publicly released drivers.
+ if [[ -f ${libdir}/libOpenCL.so.1.0.0 ]]; then
+
+ dolib.so ${libdir}/libnvcompiler.so.${sover}
+ [[ "${sover}" != "1" ]] && dosym libnvcompiler.so.${sover} /usr/${inslibdir}/libnvcompiler.so.1
+ dosym libnvcompiler.so.1 /usr/${inslibdir}/libnvcompiler.so
+
+ dolib.so ${libdir}/libOpenCL.so.1.0.0
+ dosym libOpenCL.so.1.0.0 /usr/${inslibdir}/libOpenCL.so.1
+ dosym libOpenCL.so.1 /usr/${inslibdir}/libOpenCL.so
+ fi
+}
+
+pkg_preinst() {
+ if use kernel_linux; then
+ linux-mod_pkg_preinst
+
+ local videogroup="$(egetent group video | cut -d ':' -f 3)"
+ if [ -z "${videogroup}" ]; then
+ eerror "Failed to determine the video group gid"
+ die "Failed to determine the video group gid"
+ else
+ sed -i \
+ -e "s:PACKAGE:${PF}:g" \
+ -e "s:VIDEOGID:${videogroup}:" \
+ "${D}"/etc/modprobe.d/nvidia.conf || die
+ fi
+ fi
+
+ # Clean the dynamic libGL stuff's home to ensure
+ # we dont have stale libs floating around
+ if [ -d "${ROOT}"/usr/lib/opengl/nvidia ] ; then
+ rm -rf "${ROOT}"/usr/lib/opengl/nvidia/*
+ fi
+ # Make sure we nuke the old nvidia-glx's env.d file
+ if [ -e "${ROOT}"/etc/env.d/09nvidia ] ; then
+ rm -f "${ROOT}"/etc/env.d/09nvidia
+ fi
+}
+
+pkg_postinst() {
+ use kernel_linux && linux-mod_pkg_postinst
+
+ # Switch to the nvidia implementation
+ "${ROOT}"/usr/bin/eselect opengl set --use-old nvidia
+
+ readme.gentoo_print_elog
+
+ if ! use tools; then
+ elog "USE=tools controls whether the nvidia-settings application"
+ elog "is installed. If you would like to use it, enable that"
+ elog "flag and re-emerge this ebuild. Optionally you can install"
+ elog "media-video/nvidia-settings"
+ fi
+}
+
+pkg_prerm() {
+ "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
+
+pkg_postrm() {
+ use kernel_linux && linux-mod_pkg_postrm
+ "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-304.125.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-304.125.ebuild
new file mode 100644
index 000000000000..d3ed1ff85026
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/nvidia-drivers-304.125.ebuild
@@ -0,0 +1,457 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit eutils flag-o-matic linux-info linux-mod multilib nvidia-driver \
+ portability toolchain-funcs unpacker user versionator udev
+
+NV_URI="http://us.download.nvidia.com/XFree86/"
+X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
+AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
+X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
+AMD64_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86_64-${PV}"
+
+DESCRIPTION="NVIDIA Accelerated Graphics Driver"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="
+ amd64-fbsd? ( ${NV_URI}FreeBSD-x86_64/${PV}/${AMD64_FBSD_NV_PACKAGE}.tar.gz )
+ amd64? ( ${NV_URI}Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}.run )
+ x86-fbsd? ( ${NV_URI}FreeBSD-x86/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )
+ x86? ( ${NV_URI}Linux-x86/${PV}/${X86_NV_PACKAGE}.run )
+"
+
+LICENSE="GPL-2 NVIDIA-r1"
+SLOT="0"
+KEYWORDS="-* amd64 x86 ~amd64-fbsd ~x86-fbsd"
+IUSE="acpi multilib kernel_FreeBSD kernel_linux pax_kernel +tools +X"
+RESTRICT="bindist mirror strip"
+EMULTILIB_PKG="true"
+
+COMMON="app-eselect/eselect-opencl
+ kernel_linux? ( >=sys-libs/glibc-2.6.1 )
+ X? (
+ >=app-eselect/eselect-opengl-1.0.9
+ )"
+DEPEND="${COMMON}
+ kernel_linux? (
+ virtual/linux-sources
+ virtual/pkgconfig
+ )"
+RDEPEND="${COMMON}
+ acpi? ( sys-power/acpid )
+ tools? (
+ dev-libs/atk
+ dev-libs/glib:2
+ x11-libs/gdk-pixbuf
+ x11-libs/gtk+:2
+ x11-libs/libX11
+ x11-libs/libXext
+ x11-libs/pango[X]
+ x11-libs/pangox-compat
+ )
+ X? (
+ <x11-base/xorg-server-1.17.99:=
+ x11-libs/libXvMC
+ multilib? (
+ >=x11-libs/libX11-1.6.2[abi_x86_32]
+ >=x11-libs/libXext-1.3.2[abi_x86_32]
+ )
+ )
+"
+PDEPEND="X? ( >=x11-libs/libvdpau-0.3-r1 )"
+
+REQUIRED_USE="tools? ( X )"
+
+QA_PREBUILT="opt/* usr/lib*"
+
+S=${WORKDIR}/
+
+pkg_pretend() {
+
+ if use amd64 && has_multilib_profile && \
+ [ "${DEFAULT_ABI}" != "amd64" ]; then
+ eerror "This ebuild doesn't currently support changing your default ABI"
+ die "Unexpected \${DEFAULT_ABI} = ${DEFAULT_ABI}"
+ fi
+
+ if use kernel_linux && kernel_is ge 3 18 ; then
+ ewarn "Gentoo supports kernels which are supported by NVIDIA"
+ ewarn "which are limited to the following kernels:"
+ ewarn "<sys-kernel/gentoo-sources-3.18"
+ ewarn "<sys-kernel/vanilla-sources-3.18"
+ ewarn ""
+ ewarn "You are free to utilize epatch_user to provide whatever"
+ ewarn "support you feel is appropriate, but will not receive"
+ ewarn "support as a result of those changes."
+ ewarn ""
+ ewarn "Do not file a bug report about this."
+ fi
+
+ # Since Nvidia ships 3 different series of drivers, we need to give the user
+ # some kind of guidance as to what version they should install. This tries
+ # to point the user in the right direction but can't be perfect. check
+ # nvidia-driver.eclass
+ nvidia-driver-check-warning
+
+ # Kernel features/options to check for
+ CONFIG_CHECK="~ZONE_DMA ~MTRR ~SYSVIPC ~!LOCKDEP"
+ use x86 && CONFIG_CHECK+=" ~HIGHMEM"
+
+ # Now do the above checks
+ use kernel_linux && check_extra_config
+}
+
+pkg_setup() {
+ # try to turn off distcc and ccache for people that have a problem with it
+ export DISTCC_DISABLE=1
+ export CCACHE_DISABLE=1
+
+ if use kernel_linux; then
+ linux-mod_pkg_setup
+ MODULE_NAMES="nvidia(video:${S}/kernel)"
+ BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} \
+ SYSOUT=${KV_OUT_DIR} CC=$(tc-getBUILD_CC)"
+ # linux-mod_src_compile calls set_arch_to_kernel, which
+ # sets the ARCH to x86 but NVIDIA's wrapping Makefile
+ # expects x86_64 or i386 and then converts it to x86
+ # later on in the build process
+ BUILD_FIXES="ARCH=$(uname -m | sed -e 's/i.86/i386/')"
+ fi
+
+ # set variables to where files are in the package structure
+ if use kernel_FreeBSD; then
+ use x86-fbsd && S="${WORKDIR}/${X86_FBSD_NV_PACKAGE}"
+ use amd64-fbsd && S="${WORKDIR}/${AMD64_FBSD_NV_PACKAGE}"
+ NV_DOC="${S}/doc"
+ NV_OBJ="${S}/obj"
+ NV_SRC="${S}/src"
+ NV_MAN="${S}/x11/man"
+ NV_X11="${S}/obj"
+ NV_SOVER=1
+ elif use kernel_linux; then
+ NV_DOC="${S}"
+ NV_OBJ="${S}"
+ NV_SRC="${S}/kernel"
+ NV_MAN="${S}"
+ NV_X11="${S}"
+ NV_SOVER=${PV}
+ else
+ die "Could not determine proper NVIDIA package"
+ fi
+}
+
+src_unpack() {
+ if ! use kernel_FreeBSD; then
+ cd "${S}"
+ unpack_makeself
+ else
+ unpack ${A}
+ fi
+}
+
+src_prepare() {
+ # Please add a brief description for every added patch
+
+ if use kernel_linux; then
+ if kernel_is lt 2 6 9 ; then
+ eerror "You must build this against 2.6.9 or higher kernels."
+ fi
+
+ # If greater than 2.6.5 use M= instead of SUBDIR=
+ convert_to_m "${NV_SRC}"/Makefile.kbuild
+ fi
+
+ if use pax_kernel; then
+ ewarn "Using PAX patches is not supported. You will be asked to"
+ ewarn "use a standard kernel should you have issues. Should you"
+ ewarn "need support with these patches, contact the PaX team."
+ epatch "${FILESDIR}"/${PN}-pax-const.patch
+ epatch "${FILESDIR}"/${PN}-pax-usercopy.patch
+ fi
+
+ cat <<- EOF > "${S}"/nvidia.icd
+ /usr/$(get_libdir)/libnvidia-opencl.so
+ EOF
+
+ # Allow user patches so they can support RC kernels and whatever else
+ epatch_user
+}
+
+src_compile() {
+ # This is already the default on Linux, as there's no toplevel Makefile, but
+ # on FreeBSD there's one and triggers the kernel module build, as we install
+ # it by itself, pass this.
+
+ cd "${NV_SRC}"
+ if use kernel_FreeBSD; then
+ MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
+ LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
+ elif use kernel_linux; then
+ MAKEOPTS=-j1 linux-mod_src_compile
+ fi
+}
+
+# Install nvidia library:
+# the first parameter is the library to install
+# the second parameter is the provided soversion
+# the third parameter is the target directory if its not /usr/lib
+donvidia() {
+ # Full path to library minus SOVER
+ MY_LIB="$1"
+
+ # SOVER to use
+ MY_SOVER="$2"
+
+ # Where to install
+ MY_DEST="$3"
+
+ if [[ -z "${MY_DEST}" ]]; then
+ MY_DEST="/usr/$(get_libdir)"
+ action="dolib.so"
+ else
+ exeinto ${MY_DEST}
+ action="doexe"
+ fi
+
+ # Get just the library name
+ libname=$(basename $1)
+
+ # Install the library with the correct SOVER
+ ${action} ${MY_LIB}.${MY_SOVER} || \
+ die "failed to install ${libname}"
+
+ # If SOVER wasn't 1, then we need to create a .1 symlink
+ if [[ "${MY_SOVER}" != "1" ]]; then
+ dosym ${libname}.${MY_SOVER} \
+ ${MY_DEST}/${libname}.1 || \
+ die "failed to create ${libname} symlink"
+ fi
+
+ # Always create the symlink from the raw lib to the .1
+ dosym ${libname}.1 \
+ ${MY_DEST}/${libname} || \
+ die "failed to create ${libname} symlink"
+}
+
+src_install() {
+ if use kernel_linux; then
+ linux-mod_src_install
+
+ # Add the aliases
+ # This file is tweaked with the appropriate video group in
+ # pkg_preinst, see bug #491414
+ insinto /etc/modprobe.d
+ newins "${FILESDIR}"/nvidia-169.07 nvidia.conf
+
+ # Ensures that our device nodes are created when not using X
+ exeinto "$(get_udevdir)"
+ doexe "${FILESDIR}"/nvidia-udev.sh
+ udev_newrules "${FILESDIR}"/nvidia.udev-rule 99-nvidia.rules
+ elif use kernel_FreeBSD; then
+ if use x86-fbsd; then
+ insinto /boot/modules
+ doins "${S}/src/nvidia.kld"
+ fi
+
+ exeinto /boot/modules
+ doexe "${S}/src/nvidia.ko"
+ fi
+
+ # NVIDIA kernel <-> userspace driver config lib
+ donvidia ${NV_OBJ}/libnvidia-cfg.so ${NV_SOVER}
+
+ if use kernel_linux; then
+ # NVIDIA video decode <-> CUDA
+ donvidia ${NV_OBJ}/libnvcuvid.so ${NV_SOVER}
+ fi
+
+ if use X; then
+ # Xorg DDX driver
+ insinto /usr/$(get_libdir)/xorg/modules/drivers
+ doins ${NV_X11}/nvidia_drv.so
+
+ # Xorg GLX driver
+ donvidia ${NV_X11}/libglx.so ${NV_SOVER} \
+ /usr/$(get_libdir)/opengl/nvidia/extensions
+
+ # XvMC driver
+ dolib.a ${NV_X11}/libXvMCNVIDIA.a || \
+ die "failed to install libXvMCNVIDIA.so"
+ donvidia ${NV_X11}/libXvMCNVIDIA.so ${NV_SOVER}
+ dosym libXvMCNVIDIA.so.${NV_SOVER} \
+ /usr/$(get_libdir)/libXvMCNVIDIA_dynamic.so.1 || \
+ die "failed to create libXvMCNVIDIA_dynamic.so symlink"
+ fi
+
+ # OpenCL ICD for NVIDIA
+ if use kernel_linux; then
+ insinto /etc/OpenCL/vendors
+ doins nvidia.icd
+ donvidia ${NV_OBJ}/libnvidia-opencl.so ${NV_SOVER}
+ fi
+
+ # Documentation
+ dohtml ${NV_DOC}/html/*
+ if use kernel_FreeBSD; then
+ dodoc "${NV_DOC}/README"
+ use X && doman "${NV_MAN}/nvidia-xconfig.1"
+ use tools && doman "${NV_MAN}/nvidia-settings.1"
+ else
+ # Docs
+ newdoc "${NV_DOC}/README.txt" README
+ dodoc "${NV_DOC}/NVIDIA_Changelog"
+ doman "${NV_MAN}/nvidia-smi.1.gz"
+ use X && doman "${NV_MAN}/nvidia-xconfig.1.gz"
+ use tools && doman "${NV_MAN}/nvidia-settings.1.gz"
+ doman "${NV_MAN}/nvidia-cuda-proxy-control.1.gz"
+ fi
+
+ # Helper Apps
+ exeinto /opt/bin/
+
+ if use X; then
+ doexe ${NV_OBJ}/nvidia-xconfig
+ fi
+
+ if use kernel_linux ; then
+ doexe ${NV_OBJ}/nvidia-debugdump
+ doexe ${NV_OBJ}/nvidia-cuda-proxy-control
+ doexe ${NV_OBJ}/nvidia-cuda-proxy-server
+ doexe ${NV_OBJ}/nvidia-smi
+ newinitd "${FILESDIR}/nvidia-smi.init" nvidia-smi
+ fi
+
+ if use tools; then
+ doexe ${NV_OBJ}/nvidia-settings
+ fi
+
+ dobin ${NV_OBJ}/nvidia-bug-report.sh
+
+ # Desktop entries for nvidia-settings
+ if use tools ; then
+ # There is no icon in the FreeBSD tarball.
+ use kernel_FreeBSD || newicon ${NV_OBJ}/nvidia-settings.png ${PN}-settings.png
+ domenu "${FILESDIR}"/${PN}-settings.desktop
+ exeinto /etc/X11/xinit/xinitrc.d
+ doexe "${FILESDIR}"/95-nvidia-settings
+ fi
+
+ #doenvd "${FILESDIR}"/50nvidia-prelink-blacklist
+
+ if has_multilib_profile && use multilib ; then
+ local OABI=${ABI}
+ for ABI in $(get_install_abis) ; do
+ src_install-libs
+ done
+ ABI=${OABI}
+ unset OABI
+ else
+ src_install-libs
+ fi
+
+ is_final_abi || die "failed to iterate through all ABIs"
+
+ readme.gentoo_create_doc
+}
+
+src_install-libs() {
+ local inslibdir=$(get_libdir)
+ local GL_ROOT="/usr/$(get_libdir)/opengl/nvidia/lib"
+ local CL_ROOT="/usr/$(get_libdir)/OpenCL/vendors/nvidia"
+ local libdir=${NV_OBJ}
+
+ if use kernel_linux && has_multilib_profile && \
+ [[ ${ABI} == "x86" ]] ; then
+ libdir=${NV_OBJ}/32
+ fi
+
+ if use X; then
+ # The GLX libraries
+ donvidia ${libdir}/libGL.so ${NV_SOVER} ${GL_ROOT}
+ donvidia ${libdir}/libnvidia-glcore.so ${NV_SOVER}
+ if use kernel_FreeBSD; then
+ donvidia ${libdir}/libnvidia-tls.so ${NV_SOVER} ${GL_ROOT}
+ else
+ donvidia ${libdir}/tls/libnvidia-tls.so ${NV_SOVER} ${GL_ROOT}
+ fi
+
+ # VDPAU
+ donvidia ${libdir}/libvdpau_nvidia.so ${NV_SOVER}
+ fi
+
+ # NVIDIA monitoring library
+ if use kernel_linux ; then
+ donvidia ${libdir}/libnvidia-ml.so ${NV_SOVER}
+ fi
+
+ # CUDA & OpenCL
+ if use kernel_linux; then
+ donvidia ${libdir}/libcuda.so ${NV_SOVER}
+ donvidia ${libdir}/libnvidia-compiler.so ${NV_SOVER}
+ donvidia ${libdir}/libOpenCL.so 1.0.0 ${CL_ROOT}
+ fi
+}
+
+pkg_preinst() {
+ if use kernel_linux; then
+ linux-mod_pkg_preinst
+
+ local videogroup="$(egetent group video | cut -d ':' -f 3)"
+ if [ -z "${videogroup}" ]; then
+ eerror "Failed to determine the video group gid"
+ die "Failed to determine the video group gid"
+ else
+ sed -i \
+ -e "s:PACKAGE:${PF}:g" \
+ -e "s:VIDEOGID:${videogroup}:" \
+ "${D}"/etc/modprobe.d/nvidia.conf || die
+ fi
+ fi
+
+ # Clean the dynamic libGL stuff's home to ensure
+ # we dont have stale libs floating around
+ if [ -d "${ROOT}"/usr/lib/opengl/nvidia ] ; then
+ rm -rf "${ROOT}"/usr/lib/opengl/nvidia/*
+ fi
+ # Make sure we nuke the old nvidia-glx's env.d file
+ if [ -e "${ROOT}"/etc/env.d/09nvidia ] ; then
+ rm -f "${ROOT}"/etc/env.d/09nvidia
+ fi
+}
+
+pkg_postinst() {
+ use kernel_linux && linux-mod_pkg_postinst
+
+ # Switch to the nvidia implementation
+ use X && "${ROOT}"/usr/bin/eselect opengl set --use-old nvidia
+ "${ROOT}"/usr/bin/eselect opencl set --use-old nvidia
+
+ readme.gentoo_print_elog
+
+ if ! use X; then
+ elog "You have elected to not install the X.org driver. Along with"
+ elog "this the OpenGL libraries, XvMC, and VDPAU libraries were not"
+ elog "installed. Additionally, once the driver is loaded your card"
+ elog "and fan will run at max speed which may not be desirable."
+ elog "Use the 'nvidia-smi' init script to have your card and fan"
+ elog "speed scale appropriately."
+ elog
+ fi
+ if ! use tools; then
+ elog "USE=tools controls whether the nvidia-settings application"
+ elog "is installed. If you would like to use it, enable that"
+ elog "flag and re-emerge this ebuild. Optionally you can install"
+ elog "media-video/nvidia-settings"
+ elog
+ fi
+}
+
+pkg_prerm() {
+ use X && "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
+
+pkg_postrm() {
+ use kernel_linux && linux-mod_pkg_postrm
+ use X && "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-331.113.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-331.113.ebuild
new file mode 100644
index 000000000000..41d98c3ce48d
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/nvidia-drivers-331.113.ebuild
@@ -0,0 +1,474 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils flag-o-matic linux-info linux-mod multilib nvidia-driver \
+ portability toolchain-funcs unpacker user udev
+
+NV_URI="http://us.download.nvidia.com/XFree86/"
+X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
+AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
+X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
+AMD64_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86_64-${PV}"
+
+DESCRIPTION="NVIDIA Accelerated Graphics Driver"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="
+ amd64-fbsd? ( ${NV_URI}FreeBSD-x86_64/${PV}/${AMD64_FBSD_NV_PACKAGE}.tar.gz )
+ amd64? ( ${NV_URI}Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}.run )
+ x86-fbsd? ( ${NV_URI}FreeBSD-x86/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )
+ x86? ( ${NV_URI}Linux-x86/${PV}/${X86_NV_PACKAGE}.run )
+"
+
+LICENSE="GPL-2 NVIDIA-r2"
+SLOT="0"
+KEYWORDS="-* amd64 x86 ~amd64-fbsd ~x86-fbsd"
+IUSE="acpi multilib kernel_FreeBSD kernel_linux pax_kernel +tools +X uvm"
+RESTRICT="bindist mirror strip"
+EMULTILIB_PKG="true"
+
+COMMON="
+ app-eselect/eselect-opencl
+ kernel_linux? ( >=sys-libs/glibc-2.6.1 )
+ X? (
+ >=app-eselect/eselect-opengl-1.0.9
+ )
+"
+DEPEND="
+ ${COMMON}
+ app-arch/xz-utils
+ kernel_linux? ( virtual/linux-sources )
+"
+RDEPEND="
+ ${COMMON}
+ acpi? ( sys-power/acpid )
+ tools? (
+ dev-libs/atk
+ dev-libs/glib:2
+ x11-libs/gdk-pixbuf
+ x11-libs/gtk+:2
+ x11-libs/libX11
+ x11-libs/libXext
+ x11-libs/pango[X]
+ )
+ X? (
+ <x11-base/xorg-server-1.17.99:=
+ >=x11-libs/libvdpau-0.3-r1
+ multilib? (
+ >=x11-libs/libX11-1.6.2[abi_x86_32]
+ >=x11-libs/libXext-1.3.2[abi_x86_32]
+ )
+ )
+"
+
+REQUIRED_USE="tools? ( X )"
+
+QA_PREBUILT="opt/* usr/lib*"
+
+S=${WORKDIR}/
+
+pkg_pretend() {
+
+ if use amd64 && has_multilib_profile && \
+ [ "${DEFAULT_ABI}" != "amd64" ]; then
+ eerror "This ebuild doesn't currently support changing your default ABI"
+ die "Unexpected \${DEFAULT_ABI} = ${DEFAULT_ABI}"
+ fi
+
+ if use kernel_linux && kernel_is ge 3 18 ; then
+ ewarn "Gentoo supports kernels which are supported by NVIDIA"
+ ewarn "which are limited to the following kernels:"
+ ewarn "<sys-kernel/gentoo-sources-3.18"
+ ewarn "<sys-kernel/vanilla-sources-3.18"
+ ewarn ""
+ ewarn "You are free to utilize epatch_user to provide whatever"
+ ewarn "support you feel is appropriate, but will not receive"
+ ewarn "support as a result of those changes."
+ ewarn ""
+ ewarn "Do not file a bug report about this."
+ fi
+
+ # Since Nvidia ships 3 different series of drivers, we need to give the user
+ # some kind of guidance as to what version they should install. This tries
+ # to point the user in the right direction but can't be perfect. check
+ # nvidia-driver.eclass
+ nvidia-driver-check-warning
+
+ # Kernel features/options to check for
+ CONFIG_CHECK="~ZONE_DMA ~MTRR ~SYSVIPC ~!LOCKDEP"
+ use x86 && CONFIG_CHECK+=" ~HIGHMEM"
+
+ # Now do the above checks
+ use kernel_linux && check_extra_config
+}
+
+pkg_setup() {
+ # try to turn off distcc and ccache for people that have a problem with it
+ export DISTCC_DISABLE=1
+ export CCACHE_DISABLE=1
+
+ if use kernel_linux; then
+ MODULE_NAMES="nvidia(video:${S}/kernel)"
+ use uvm && MODULE_NAMES+=" nvidia-uvm(video:${S}/kernel/uvm)"
+
+ # This needs to run after MODULE_NAMES (so that the eclass checks
+ # whether the kernel supports loadable modules) but before BUILD_PARAMS
+ # is set (so that KV_DIR is populated).
+ linux-mod_pkg_setup
+
+ BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} \
+ SYSOUT=${KV_OUT_DIR} CC=$(tc-getBUILD_CC)"
+
+ # linux-mod_src_compile calls set_arch_to_kernel, which
+ # sets the ARCH to x86 but NVIDIA's wrapping Makefile
+ # expects x86_64 or i386 and then converts it to x86
+ # later on in the build process
+ BUILD_FIXES="ARCH=$(uname -m | sed -e 's/i.86/i386/')"
+ fi
+
+ # set variables to where files are in the package structure
+ if use kernel_FreeBSD; then
+ use x86-fbsd && S="${WORKDIR}/${X86_FBSD_NV_PACKAGE}"
+ use amd64-fbsd && S="${WORKDIR}/${AMD64_FBSD_NV_PACKAGE}"
+ NV_DOC="${S}/doc"
+ NV_OBJ="${S}/obj"
+ NV_SRC="${S}/src"
+ NV_MAN="${S}/x11/man"
+ NV_X11="${S}/obj"
+ NV_SOVER=1
+ elif use kernel_linux; then
+ NV_DOC="${S}"
+ NV_OBJ="${S}"
+ NV_SRC="${S}/kernel"
+ NV_MAN="${S}"
+ NV_X11="${S}"
+ NV_SOVER=${PV}
+ else
+ die "Could not determine proper NVIDIA package"
+ fi
+}
+
+src_unpack() {
+ if use kernel_FreeBSD; then
+ unpack ${A}
+ elif use kernel_linux; then
+ cd "${S}"
+ unpack_makeself
+ fi
+}
+
+src_prepare() {
+ # Please add a brief description for every added patch
+
+ if use kernel_linux; then
+ if kernel_is lt 2 6 9 ; then
+ eerror "You must build this against 2.6.9 or higher kernels."
+ fi
+
+ # If greater than 2.6.5 use M= instead of SUBDIR=
+# convert_to_m "${NV_SRC}"/Makefile.kbuild
+ fi
+
+ if use pax_kernel; then
+ ewarn "Using PAX patches is not supported. You will be asked to"
+ ewarn "use a standard kernel should you have issues. Should you"
+ ewarn "need support with these patches, contact the PaX team."
+ epatch "${FILESDIR}"/${PN}-331.13-pax-usercopy.patch
+ epatch "${FILESDIR}"/${PN}-337.12-pax-constify.patch
+ fi
+
+ # Allow user patches so they can support RC kernels and whatever else
+ epatch_user
+}
+
+src_compile() {
+ # This is already the default on Linux, as there's no toplevel Makefile, but
+ # on FreeBSD there's one and triggers the kernel module build, as we install
+ # it by itself, pass this.
+
+ cd "${NV_SRC}"
+ if use kernel_FreeBSD; then
+ MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
+ LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
+ elif use kernel_linux; then
+ use uvm && MAKEOPTS=-j1
+ linux-mod_src_compile
+ fi
+}
+
+# Install nvidia library:
+# the first parameter is the library to install
+# the second parameter is the provided soversion
+# the third parameter is the target directory if its not /usr/lib
+donvidia() {
+ # Full path to library minus SOVER
+ MY_LIB="$1"
+
+ # SOVER to use
+ MY_SOVER="$2"
+
+ # Where to install
+ MY_DEST="$3"
+
+ if [[ -z "${MY_DEST}" ]]; then
+ MY_DEST="/usr/$(get_libdir)"
+ action="dolib.so"
+ else
+ exeinto ${MY_DEST}
+ action="doexe"
+ fi
+
+ # Get just the library name
+ libname=$(basename $1)
+
+ # Install the library with the correct SOVER
+ ${action} ${MY_LIB}.${MY_SOVER} || \
+ die "failed to install ${libname}"
+
+ # If SOVER wasn't 1, then we need to create a .1 symlink
+ if [[ "${MY_SOVER}" != "1" ]]; then
+ dosym ${libname}.${MY_SOVER} \
+ ${MY_DEST}/${libname}.1 || \
+ die "failed to create ${libname} symlink"
+ fi
+
+ # Always create the symlink from the raw lib to the .1
+ dosym ${libname}.1 \
+ ${MY_DEST}/${libname} || \
+ die "failed to create ${libname} symlink"
+}
+
+src_install() {
+ if use kernel_linux; then
+ linux-mod_src_install
+
+ # Add the aliases
+ # This file is tweaked with the appropriate video group in
+ # pkg_preinst, see bug #491414
+ insinto /etc/modprobe.d
+ newins "${FILESDIR}"/nvidia-169.07 nvidia.conf
+ use uvm && doins "${FILESDIR}"/nvidia-uvm.conf
+
+ # Ensures that our device nodes are created when not using X
+ exeinto "$(get_udevdir)"
+ doexe "${FILESDIR}"/nvidia-udev.sh
+ udev_newrules "${FILESDIR}"/nvidia.udev-rule 99-nvidia.rules
+ elif use kernel_FreeBSD; then
+ if use x86-fbsd; then
+ insinto /boot/modules
+ doins "${S}/src/nvidia.kld"
+ fi
+
+ exeinto /boot/modules
+ doexe "${S}/src/nvidia.ko"
+ fi
+
+ # NVIDIA kernel <-> userspace driver config lib
+ donvidia ${NV_OBJ}/libnvidia-cfg.so ${NV_SOVER}
+
+ # NVIDIA framebuffer capture library
+ donvidia ${NV_OBJ}/libnvidia-fbc.so ${NV_SOVER}
+
+ # NVIDIA video encode/decode <-> CUDA
+ if use kernel_linux; then
+ donvidia ${NV_OBJ}/libnvcuvid.so ${NV_SOVER}
+ donvidia ${NV_OBJ}/libnvidia-encode.so ${NV_SOVER}
+ fi
+
+ if use X; then
+ # Xorg DDX driver
+ insinto /usr/$(get_libdir)/xorg/modules/drivers
+ doins ${NV_X11}/nvidia_drv.so
+
+ # Xorg GLX driver
+ donvidia ${NV_X11}/libglx.so ${NV_SOVER} \
+ /usr/$(get_libdir)/opengl/nvidia/extensions
+ fi
+
+ # OpenCL ICD for NVIDIA
+ if use kernel_linux; then
+ insinto /etc/OpenCL/vendors
+ doins ${NV_OBJ}/nvidia.icd
+ fi
+
+ # Documentation
+ dohtml ${NV_DOC}/html/*
+ if use kernel_FreeBSD; then
+ dodoc "${NV_DOC}/README"
+ use X && doman "${NV_MAN}/nvidia-xconfig.1"
+ use tools && doman "${NV_MAN}/nvidia-settings.1"
+ else
+ # Docs
+ newdoc "${NV_DOC}/README.txt" README
+ dodoc "${NV_DOC}/NVIDIA_Changelog"
+ doman "${NV_MAN}/nvidia-smi.1.gz"
+ use X && doman "${NV_MAN}/nvidia-xconfig.1.gz"
+ use tools && doman "${NV_MAN}/nvidia-settings.1.gz"
+ doman "${NV_MAN}/nvidia-cuda-mps-control.1.gz"
+ fi
+
+ # Helper Apps
+ exeinto /opt/bin/
+
+ if use X; then
+ doexe ${NV_OBJ}/nvidia-xconfig
+ fi
+
+ if use kernel_linux ; then
+ doexe ${NV_OBJ}/nvidia-cuda-mps-control
+ doexe ${NV_OBJ}/nvidia-cuda-mps-server
+ doexe ${NV_OBJ}/nvidia-debugdump
+ doexe ${NV_OBJ}/nvidia-persistenced
+ doexe ${NV_OBJ}/nvidia-smi
+
+ # install nvidia-modprobe setuid and symlink in /usr/bin (bug #505092)
+ doexe ${NV_OBJ}/nvidia-modprobe
+ fowners root:video /opt/bin/nvidia-modprobe
+ fperms 4710 /opt/bin/nvidia-modprobe
+ dosym /{opt,usr}/bin/nvidia-modprobe
+
+ doman nvidia-cuda-mps-control.1.gz
+ doman nvidia-modprobe.1.gz
+ doman nvidia-persistenced.1.gz
+ newinitd "${FILESDIR}/nvidia-smi.init" nvidia-smi
+ newconfd "${FILESDIR}/nvidia-persistenced.conf" nvidia-persistenced
+ newinitd "${FILESDIR}/nvidia-persistenced.init" nvidia-persistenced
+ fi
+
+ if use tools; then
+ doexe ${NV_OBJ}/nvidia-settings
+ fi
+
+ dobin ${NV_OBJ}/nvidia-bug-report.sh
+
+ # Desktop entries for nvidia-settings
+ if use tools ; then
+ # There is no icon in the FreeBSD tarball.
+ use kernel_FreeBSD || newicon ${NV_OBJ}/nvidia-settings.png ${PN}-settings.png
+ domenu "${FILESDIR}"/${PN}-settings.desktop
+ exeinto /etc/X11/xinit/xinitrc.d
+ doexe "${FILESDIR}"/95-nvidia-settings
+ fi
+
+ #doenvd "${FILESDIR}"/50nvidia-prelink-blacklist
+
+ if has_multilib_profile && use multilib ; then
+ local OABI=${ABI}
+ for ABI in $(get_install_abis) ; do
+ src_install-libs
+ done
+ ABI=${OABI}
+ unset OABI
+ else
+ src_install-libs
+ fi
+
+ is_final_abi || die "failed to iterate through all ABIs"
+
+ readme.gentoo_create_doc
+}
+
+src_install-libs() {
+ local inslibdir=$(get_libdir)
+ local GL_ROOT="/usr/$(get_libdir)/opengl/nvidia/lib"
+ local CL_ROOT="/usr/$(get_libdir)/OpenCL/vendors/nvidia"
+ local libdir=${NV_OBJ}
+
+ if use kernel_linux && has_multilib_profile && \
+ [[ ${ABI} == "x86" ]] ; then
+ libdir=${NV_OBJ}/32
+ fi
+
+ if use X; then
+ # The GLX libraries
+ donvidia ${libdir}/libGL.so ${NV_SOVER} ${GL_ROOT}
+ donvidia ${libdir}/libnvidia-glcore.so ${NV_SOVER}
+ donvidia ${libdir}/libnvidia-ifr.so ${NV_SOVER}
+ if use kernel_FreeBSD; then
+ donvidia ${libdir}/libnvidia-tls.so ${NV_SOVER}
+ else
+ donvidia ${libdir}/tls/libnvidia-tls.so ${NV_SOVER}
+ fi
+
+ # VDPAU
+ donvidia ${libdir}/libvdpau_nvidia.so ${NV_SOVER}
+ fi
+
+ # NVIDIA monitoring library
+ if use kernel_linux ; then
+ donvidia ${libdir}/libnvidia-ml.so ${NV_SOVER}
+ fi
+
+ # CUDA & OpenCL
+ if use kernel_linux; then
+ donvidia ${libdir}/libcuda.so ${NV_SOVER}
+ donvidia ${libdir}/libnvidia-compiler.so ${NV_SOVER}
+ donvidia ${libdir}/libOpenCL.so 1.0.0 ${CL_ROOT}
+ donvidia ${libdir}/libnvidia-opencl.so ${NV_SOVER}
+ fi
+}
+
+pkg_preinst() {
+ if use kernel_linux; then
+ linux-mod_pkg_preinst
+
+ local videogroup="$(egetent group video | cut -d ':' -f 3)"
+ if [ -z "${videogroup}" ]; then
+ eerror "Failed to determine the video group gid"
+ die "Failed to determine the video group gid"
+ else
+ sed -i \
+ -e "s:PACKAGE:${PF}:g" \
+ -e "s:VIDEOGID:${videogroup}:" \
+ "${D}"/etc/modprobe.d/nvidia.conf || die
+ fi
+ fi
+
+ # Clean the dynamic libGL stuff's home to ensure
+ # we dont have stale libs floating around
+ if [ -d "${ROOT}"/usr/lib/opengl/nvidia ] ; then
+ rm -rf "${ROOT}"/usr/lib/opengl/nvidia/*
+ fi
+ # Make sure we nuke the old nvidia-glx's env.d file
+ if [ -e "${ROOT}"/etc/env.d/09nvidia ] ; then
+ rm -f "${ROOT}"/etc/env.d/09nvidia
+ fi
+}
+
+pkg_postinst() {
+ use kernel_linux && linux-mod_pkg_postinst
+
+ # Switch to the nvidia implementation
+ use X && "${ROOT}"/usr/bin/eselect opengl set --use-old nvidia
+ "${ROOT}"/usr/bin/eselect opencl set --use-old nvidia
+
+ readme.gentoo_print_elog
+
+ if ! use X; then
+ elog "You have elected to not install the X.org driver. Along with"
+ elog "this the OpenGL libraries and VDPAU libraries were not"
+ elog "installed. Additionally, once the driver is loaded your card"
+ elog "and fan will run at max speed which may not be desirable."
+ elog "Use the 'nvidia-smi' init script to have your card and fan"
+ elog "speed scale appropriately."
+ elog
+ fi
+ if ! use tools; then
+ elog "USE=tools controls whether the nvidia-settings application"
+ elog "is installed. If you would like to use it, enable that"
+ elog "flag and re-emerge this ebuild. Optionally you can install"
+ elog "media-video/nvidia-settings"
+ elog
+ fi
+}
+
+pkg_prerm() {
+ use X && "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
+
+pkg_postrm() {
+ use kernel_linux && linux-mod_pkg_postrm
+ use X && "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-340.76.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-340.76.ebuild
new file mode 100644
index 000000000000..baf8a371834f
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/nvidia-drivers-340.76.ebuild
@@ -0,0 +1,479 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils flag-o-matic linux-info linux-mod multilib nvidia-driver \
+ portability toolchain-funcs unpacker user udev
+
+NV_URI="http://us.download.nvidia.com/XFree86/"
+X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
+AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
+X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
+AMD64_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86_64-${PV}"
+
+DESCRIPTION="NVIDIA Accelerated Graphics Driver"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="
+ amd64-fbsd? ( ${NV_URI}FreeBSD-x86_64/${PV}/${AMD64_FBSD_NV_PACKAGE}.tar.gz )
+ amd64? ( ${NV_URI}Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}.run )
+ x86-fbsd? ( ${NV_URI}FreeBSD-x86/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )
+ x86? ( ${NV_URI}Linux-x86/${PV}/${X86_NV_PACKAGE}.run )
+"
+
+LICENSE="GPL-2 NVIDIA-r2"
+SLOT="0"
+KEYWORDS="-* amd64 x86 ~amd64-fbsd ~x86-fbsd"
+IUSE="acpi multilib kernel_FreeBSD kernel_linux pax_kernel +tools +X uvm"
+RESTRICT="bindist mirror strip"
+EMULTILIB_PKG="true"
+
+COMMON="
+ app-eselect/eselect-opencl
+ kernel_linux? ( >=sys-libs/glibc-2.6.1 )
+ X? (
+ >=app-eselect/eselect-opengl-1.0.9
+ )
+"
+DEPEND="
+ ${COMMON}
+ app-arch/xz-utils
+ kernel_linux? ( virtual/linux-sources )
+"
+RDEPEND="
+ ${COMMON}
+ acpi? ( sys-power/acpid )
+ tools? (
+ dev-libs/atk
+ dev-libs/glib:2
+ x11-libs/gdk-pixbuf
+ >=x11-libs/gtk+-2.4:2
+ x11-libs/libX11
+ x11-libs/libXext
+ x11-libs/pango[X]
+ )
+ X? (
+ <x11-base/xorg-server-1.17.99:=
+ >=x11-libs/libvdpau-0.3-r1
+ multilib? (
+ >=x11-libs/libX11-1.6.2[abi_x86_32]
+ >=x11-libs/libXext-1.3.2[abi_x86_32]
+ )
+ )
+"
+
+REQUIRED_USE="tools? ( X )"
+
+QA_PREBUILT="opt/* usr/lib*"
+
+S=${WORKDIR}/
+
+pkg_pretend() {
+
+ if use amd64 && has_multilib_profile && \
+ [ "${DEFAULT_ABI}" != "amd64" ]; then
+ eerror "This ebuild doesn't currently support changing your default ABI"
+ die "Unexpected \${DEFAULT_ABI} = ${DEFAULT_ABI}"
+ fi
+
+ if use kernel_linux && kernel_is ge 3 18 ; then
+ ewarn "Gentoo supports kernels which are supported by NVIDIA"
+ ewarn "which are limited to the following kernels:"
+ ewarn "<sys-kernel/gentoo-sources-3.18"
+ ewarn "<sys-kernel/vanilla-sources-3.18"
+ ewarn ""
+ ewarn "You are free to utilize epatch_user to provide whatever"
+ ewarn "support you feel is appropriate, but will not receive"
+ ewarn "support as a result of those changes."
+ ewarn ""
+ ewarn "Do not file a bug report about this."
+ fi
+
+ # Since Nvidia ships 3 different series of drivers, we need to give the user
+ # some kind of guidance as to what version they should install. This tries
+ # to point the user in the right direction but can't be perfect. check
+ # nvidia-driver.eclass
+ nvidia-driver-check-warning
+
+ # Kernel features/options to check for
+ CONFIG_CHECK="~ZONE_DMA ~MTRR ~SYSVIPC ~!LOCKDEP"
+ use x86 && CONFIG_CHECK+=" ~HIGHMEM"
+
+ # Now do the above checks
+ use kernel_linux && check_extra_config
+}
+
+pkg_setup() {
+ # try to turn off distcc and ccache for people that have a problem with it
+ export DISTCC_DISABLE=1
+ export CCACHE_DISABLE=1
+
+ if use kernel_linux; then
+ MODULE_NAMES="nvidia(video:${S}/kernel)"
+ use uvm && MODULE_NAMES+=" nvidia-uvm(video:${S}/kernel/uvm)"
+
+ # This needs to run after MODULE_NAMES (so that the eclass checks
+ # whether the kernel supports loadable modules) but before BUILD_PARAMS
+ # is set (so that KV_DIR is populated).
+ linux-mod_pkg_setup
+
+ BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} \
+ SYSOUT=${KV_OUT_DIR} CC=$(tc-getBUILD_CC)"
+
+ # linux-mod_src_compile calls set_arch_to_kernel, which
+ # sets the ARCH to x86 but NVIDIA's wrapping Makefile
+ # expects x86_64 or i386 and then converts it to x86
+ # later on in the build process
+ BUILD_FIXES="ARCH=$(uname -m | sed -e 's/i.86/i386/')"
+ fi
+
+ # set variables to where files are in the package structure
+ if use kernel_FreeBSD; then
+ use x86-fbsd && S="${WORKDIR}/${X86_FBSD_NV_PACKAGE}"
+ use amd64-fbsd && S="${WORKDIR}/${AMD64_FBSD_NV_PACKAGE}"
+ NV_DOC="${S}/doc"
+ NV_OBJ="${S}/obj"
+ NV_SRC="${S}/src"
+ NV_MAN="${S}/x11/man"
+ NV_X11="${S}/obj"
+ NV_SOVER=1
+ elif use kernel_linux; then
+ NV_DOC="${S}"
+ NV_OBJ="${S}"
+ NV_SRC="${S}/kernel"
+ NV_MAN="${S}"
+ NV_X11="${S}"
+ NV_SOVER=${PV}
+ else
+ die "Could not determine proper NVIDIA package"
+ fi
+}
+
+src_prepare() {
+ # Please add a brief description for every added patch
+
+ if use kernel_linux; then
+ if kernel_is lt 2 6 9 ; then
+ eerror "You must build this against 2.6.9 or higher kernels."
+ fi
+
+ # If greater than 2.6.5 use M= instead of SUBDIR=
+# convert_to_m "${NV_SRC}"/Makefile.kbuild
+ fi
+
+ if use pax_kernel; then
+ ewarn "Using PAX patches is not supported. You will be asked to"
+ ewarn "use a standard kernel should you have issues. Should you"
+ ewarn "need support with these patches, contact the PaX team."
+ epatch "${FILESDIR}"/${PN}-331.13-pax-usercopy.patch
+ epatch "${FILESDIR}"/${PN}-337.12-pax-constify.patch
+ fi
+
+ # Allow user patches so they can support RC kernels and whatever else
+ epatch_user
+}
+
+src_compile() {
+ # This is already the default on Linux, as there's no toplevel Makefile, but
+ # on FreeBSD there's one and triggers the kernel module build, as we install
+ # it by itself, pass this.
+
+ cd "${NV_SRC}"
+ if use kernel_FreeBSD; then
+ MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
+ LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
+ elif use kernel_linux; then
+ use uvm && MAKEOPTS=-j1
+ linux-mod_src_compile
+ fi
+}
+
+# Install nvidia library:
+# the first parameter is the library to install
+# the second parameter is the provided soversion
+# the third parameter is the target directory if its not /usr/lib
+donvidia() {
+ # Full path to library minus SOVER
+ MY_LIB="$1"
+
+ # SOVER to use
+ MY_SOVER="$2"
+
+ # Where to install
+ MY_DEST="$3"
+
+ if [[ -z "${MY_DEST}" ]]; then
+ MY_DEST="/usr/$(get_libdir)"
+ action="dolib.so"
+ else
+ exeinto ${MY_DEST}
+ action="doexe"
+ fi
+
+ # Get just the library name
+ libname=$(basename $1)
+
+ # Install the library with the correct SOVER
+ ${action} ${MY_LIB}.${MY_SOVER} || \
+ die "failed to install ${libname}"
+
+ # If SOVER wasn't 1, then we need to create a .1 symlink
+ if [[ "${MY_SOVER}" != "1" ]]; then
+ dosym ${libname}.${MY_SOVER} \
+ ${MY_DEST}/${libname}.1 || \
+ die "failed to create ${libname} symlink"
+ fi
+
+ # Always create the symlink from the raw lib to the .1
+ dosym ${libname}.1 \
+ ${MY_DEST}/${libname} || \
+ die "failed to create ${libname} symlink"
+}
+
+src_install() {
+ if use kernel_linux; then
+ linux-mod_src_install
+
+ # Add the aliases
+ # This file is tweaked with the appropriate video group in
+ # pkg_preinst, see bug #491414
+ insinto /etc/modprobe.d
+ newins "${FILESDIR}"/nvidia-169.07 nvidia.conf
+ use uvm && doins "${FILESDIR}"/nvidia-uvm.conf
+
+ # Ensures that our device nodes are created when not using X
+ exeinto "$(get_udevdir)"
+ doexe "${FILESDIR}"/nvidia-udev.sh
+ udev_newrules "${FILESDIR}"/nvidia.udev-rule 99-nvidia.rules
+ elif use kernel_FreeBSD; then
+ if use x86-fbsd; then
+ insinto /boot/modules
+ doins "${S}/src/nvidia.kld"
+ fi
+
+ exeinto /boot/modules
+ doexe "${S}/src/nvidia.ko"
+ fi
+
+ # NVIDIA kernel <-> userspace driver config lib
+ donvidia ${NV_OBJ}/libnvidia-cfg.so ${NV_SOVER}
+
+ # NVIDIA framebuffer capture library
+ donvidia ${NV_OBJ}/libnvidia-fbc.so ${NV_SOVER}
+
+ # NVIDIA video encode/decode <-> CUDA
+ if use kernel_linux; then
+ donvidia ${NV_OBJ}/libnvcuvid.so ${NV_SOVER}
+ donvidia ${NV_OBJ}/libnvidia-encode.so ${NV_SOVER}
+ fi
+
+ if use X; then
+ # Xorg DDX driver
+ insinto /usr/$(get_libdir)/xorg/modules/drivers
+ doins ${NV_X11}/nvidia_drv.so
+
+ # Xorg GLX driver
+ donvidia ${NV_X11}/libglx.so ${NV_SOVER} \
+ /usr/$(get_libdir)/opengl/nvidia/extensions
+ fi
+
+ # OpenCL ICD for NVIDIA
+ if use kernel_linux; then
+ insinto /etc/OpenCL/vendors
+ doins ${NV_OBJ}/nvidia.icd
+ fi
+
+ # Documentation
+ dohtml ${NV_DOC}/html/*
+ if use kernel_FreeBSD; then
+ dodoc "${NV_DOC}/README"
+ use X && doman "${NV_MAN}/nvidia-xconfig.1"
+ use tools && doman "${NV_MAN}/nvidia-settings.1"
+ else
+ # Docs
+ newdoc "${NV_DOC}/README.txt" README
+ dodoc "${NV_DOC}/NVIDIA_Changelog"
+ doman "${NV_MAN}/nvidia-smi.1.gz"
+ use X && doman "${NV_MAN}/nvidia-xconfig.1.gz"
+ use tools && doman "${NV_MAN}/nvidia-settings.1.gz"
+ doman "${NV_MAN}/nvidia-cuda-mps-control.1.gz"
+ fi
+
+ # Helper Apps
+ exeinto /opt/bin/
+
+ if use X; then
+ doexe ${NV_OBJ}/nvidia-xconfig
+ fi
+
+ if use kernel_linux ; then
+ doexe ${NV_OBJ}/nvidia-cuda-mps-control
+ doexe ${NV_OBJ}/nvidia-cuda-mps-server
+ doexe ${NV_OBJ}/nvidia-debugdump
+ doexe ${NV_OBJ}/nvidia-persistenced
+ doexe ${NV_OBJ}/nvidia-smi
+
+ # install nvidia-modprobe setuid and symlink in /usr/bin (bug #505092)
+ doexe ${NV_OBJ}/nvidia-modprobe
+ fowners root:video /opt/bin/nvidia-modprobe
+ fperms 4710 /opt/bin/nvidia-modprobe
+ dosym /{opt,usr}/bin/nvidia-modprobe
+
+ doman nvidia-cuda-mps-control.1.gz
+ doman nvidia-modprobe.1.gz
+ doman nvidia-persistenced.1.gz
+ newinitd "${FILESDIR}/nvidia-smi.init" nvidia-smi
+ newconfd "${FILESDIR}/nvidia-persistenced.conf" nvidia-persistenced
+ newinitd "${FILESDIR}/nvidia-persistenced.init" nvidia-persistenced
+ fi
+
+ if use tools; then
+ doexe ${NV_OBJ}/nvidia-settings
+ insinto /usr/share/nvidia/
+ doins nvidia-application-profiles-${PV}-key-documentation
+ insinto /etc/nvidia
+ newins nvidia-application-profiles-${PV}-rc nvidia-application-profiles-rc
+ fi
+
+ dobin ${NV_OBJ}/nvidia-bug-report.sh
+
+ # Desktop entries for nvidia-settings
+ if use tools ; then
+ # There is no icon in the FreeBSD tarball.
+ use kernel_FreeBSD || newicon ${NV_OBJ}/nvidia-settings.png ${PN}-settings.png
+ domenu "${FILESDIR}"/${PN}-settings.desktop
+ exeinto /etc/X11/xinit/xinitrc.d
+ doexe "${FILESDIR}"/95-nvidia-settings
+ fi
+
+ #doenvd "${FILESDIR}"/50nvidia-prelink-blacklist
+
+ if has_multilib_profile && use multilib ; then
+ local OABI=${ABI}
+ for ABI in $(get_install_abis) ; do
+ src_install-libs
+ done
+ ABI=${OABI}
+ unset OABI
+ else
+ src_install-libs
+ fi
+
+ is_final_abi || die "failed to iterate through all ABIs"
+
+ readme.gentoo_create_doc
+}
+
+src_install-libs() {
+ local inslibdir=$(get_libdir)
+ local GL_ROOT="/usr/$(get_libdir)/opengl/nvidia/lib"
+ local CL_ROOT="/usr/$(get_libdir)/OpenCL/vendors/nvidia"
+ local libdir=${NV_OBJ}
+
+ if use kernel_linux && has_multilib_profile && \
+ [[ ${ABI} == "x86" ]] ; then
+ libdir=${NV_OBJ}/32
+ fi
+
+ if use X; then
+ # The GLX libraries
+ donvidia ${libdir}/libEGL.so ${NV_SOVER} ${GL_ROOT}
+ donvidia ${libdir}/libGL.so ${NV_SOVER} ${GL_ROOT}
+ donvidia ${libdir}/libGLESv1_CM.so ${NV_SOVER} ${GL_ROOT}
+ donvidia ${libdir}/libnvidia-eglcore.so ${NV_SOVER}
+ donvidia ${libdir}/libnvidia-glcore.so ${NV_SOVER}
+ donvidia ${libdir}/libnvidia-glsi.so ${NV_SOVER}
+ donvidia ${libdir}/libnvidia-ifr.so ${NV_SOVER}
+ if use kernel_FreeBSD; then
+ donvidia ${libdir}/libnvidia-tls.so ${NV_SOVER}
+ else
+ donvidia ${libdir}/tls/libnvidia-tls.so ${NV_SOVER}
+ fi
+
+ # VDPAU
+ donvidia ${libdir}/libvdpau_nvidia.so ${NV_SOVER}
+
+ # GLES v2 libraries
+ insinto ${GL_ROOT}
+ doexe ${libdir}/libGLESv2.so.${PV}
+ dosym libGLESv2.so.${PV} ${GL_ROOT}/libGLESv2.so.2
+ dosym libGLESv2.so.2 ${GL_ROOT}/libGLESv2.so
+ fi
+
+ # NVIDIA monitoring library
+ if use kernel_linux ; then
+ donvidia ${libdir}/libnvidia-ml.so ${NV_SOVER}
+ fi
+
+ # CUDA & OpenCL
+ if use kernel_linux; then
+ donvidia ${libdir}/libcuda.so ${NV_SOVER}
+ donvidia ${libdir}/libnvidia-compiler.so ${NV_SOVER}
+ donvidia ${libdir}/libOpenCL.so 1.0.0 ${CL_ROOT}
+ donvidia ${libdir}/libnvidia-opencl.so ${NV_SOVER}
+ fi
+}
+
+pkg_preinst() {
+ if use kernel_linux; then
+ linux-mod_pkg_preinst
+
+ local videogroup="$(egetent group video | cut -d ':' -f 3)"
+ if [ -z "${videogroup}" ]; then
+ eerror "Failed to determine the video group gid"
+ die "Failed to determine the video group gid"
+ else
+ sed -i \
+ -e "s:PACKAGE:${PF}:g" \
+ -e "s:VIDEOGID:${videogroup}:" \
+ "${D}"/etc/modprobe.d/nvidia.conf || die
+ fi
+ fi
+
+ # Clean the dynamic libGL stuff's home to ensure
+ # we dont have stale libs floating around
+ if [ -d "${ROOT}"/usr/lib/opengl/nvidia ] ; then
+ rm -rf "${ROOT}"/usr/lib/opengl/nvidia/*
+ fi
+ # Make sure we nuke the old nvidia-glx's env.d file
+ if [ -e "${ROOT}"/etc/env.d/09nvidia ] ; then
+ rm -f "${ROOT}"/etc/env.d/09nvidia
+ fi
+}
+
+pkg_postinst() {
+ use kernel_linux && linux-mod_pkg_postinst
+
+ # Switch to the nvidia implementation
+ use X && "${ROOT}"/usr/bin/eselect opengl set --use-old nvidia
+ "${ROOT}"/usr/bin/eselect opencl set --use-old nvidia
+
+ readme.gentoo_print_elog
+
+ if ! use X; then
+ elog "You have elected to not install the X.org driver. Along with"
+ elog "this the OpenGL libraries and VDPAU libraries were not"
+ elog "installed. Additionally, once the driver is loaded your card"
+ elog "and fan will run at max speed which may not be desirable."
+ elog "Use the 'nvidia-smi' init script to have your card and fan"
+ elog "speed scale appropriately."
+ elog
+ fi
+ if ! use tools; then
+ elog "USE=tools controls whether the nvidia-settings application"
+ elog "is installed. If you would like to use it, enable that"
+ elog "flag and re-emerge this ebuild. Optionally you can install"
+ elog "media-video/nvidia-settings"
+ elog
+ fi
+}
+
+pkg_prerm() {
+ use X && "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
+
+pkg_postrm() {
+ use kernel_linux && linux-mod_pkg_postrm
+ use X && "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-343.36.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-343.36.ebuild
new file mode 100644
index 000000000000..baf8a371834f
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/nvidia-drivers-343.36.ebuild
@@ -0,0 +1,479 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils flag-o-matic linux-info linux-mod multilib nvidia-driver \
+ portability toolchain-funcs unpacker user udev
+
+NV_URI="http://us.download.nvidia.com/XFree86/"
+X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
+AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
+X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
+AMD64_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86_64-${PV}"
+
+DESCRIPTION="NVIDIA Accelerated Graphics Driver"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="
+ amd64-fbsd? ( ${NV_URI}FreeBSD-x86_64/${PV}/${AMD64_FBSD_NV_PACKAGE}.tar.gz )
+ amd64? ( ${NV_URI}Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}.run )
+ x86-fbsd? ( ${NV_URI}FreeBSD-x86/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )
+ x86? ( ${NV_URI}Linux-x86/${PV}/${X86_NV_PACKAGE}.run )
+"
+
+LICENSE="GPL-2 NVIDIA-r2"
+SLOT="0"
+KEYWORDS="-* amd64 x86 ~amd64-fbsd ~x86-fbsd"
+IUSE="acpi multilib kernel_FreeBSD kernel_linux pax_kernel +tools +X uvm"
+RESTRICT="bindist mirror strip"
+EMULTILIB_PKG="true"
+
+COMMON="
+ app-eselect/eselect-opencl
+ kernel_linux? ( >=sys-libs/glibc-2.6.1 )
+ X? (
+ >=app-eselect/eselect-opengl-1.0.9
+ )
+"
+DEPEND="
+ ${COMMON}
+ app-arch/xz-utils
+ kernel_linux? ( virtual/linux-sources )
+"
+RDEPEND="
+ ${COMMON}
+ acpi? ( sys-power/acpid )
+ tools? (
+ dev-libs/atk
+ dev-libs/glib:2
+ x11-libs/gdk-pixbuf
+ >=x11-libs/gtk+-2.4:2
+ x11-libs/libX11
+ x11-libs/libXext
+ x11-libs/pango[X]
+ )
+ X? (
+ <x11-base/xorg-server-1.17.99:=
+ >=x11-libs/libvdpau-0.3-r1
+ multilib? (
+ >=x11-libs/libX11-1.6.2[abi_x86_32]
+ >=x11-libs/libXext-1.3.2[abi_x86_32]
+ )
+ )
+"
+
+REQUIRED_USE="tools? ( X )"
+
+QA_PREBUILT="opt/* usr/lib*"
+
+S=${WORKDIR}/
+
+pkg_pretend() {
+
+ if use amd64 && has_multilib_profile && \
+ [ "${DEFAULT_ABI}" != "amd64" ]; then
+ eerror "This ebuild doesn't currently support changing your default ABI"
+ die "Unexpected \${DEFAULT_ABI} = ${DEFAULT_ABI}"
+ fi
+
+ if use kernel_linux && kernel_is ge 3 18 ; then
+ ewarn "Gentoo supports kernels which are supported by NVIDIA"
+ ewarn "which are limited to the following kernels:"
+ ewarn "<sys-kernel/gentoo-sources-3.18"
+ ewarn "<sys-kernel/vanilla-sources-3.18"
+ ewarn ""
+ ewarn "You are free to utilize epatch_user to provide whatever"
+ ewarn "support you feel is appropriate, but will not receive"
+ ewarn "support as a result of those changes."
+ ewarn ""
+ ewarn "Do not file a bug report about this."
+ fi
+
+ # Since Nvidia ships 3 different series of drivers, we need to give the user
+ # some kind of guidance as to what version they should install. This tries
+ # to point the user in the right direction but can't be perfect. check
+ # nvidia-driver.eclass
+ nvidia-driver-check-warning
+
+ # Kernel features/options to check for
+ CONFIG_CHECK="~ZONE_DMA ~MTRR ~SYSVIPC ~!LOCKDEP"
+ use x86 && CONFIG_CHECK+=" ~HIGHMEM"
+
+ # Now do the above checks
+ use kernel_linux && check_extra_config
+}
+
+pkg_setup() {
+ # try to turn off distcc and ccache for people that have a problem with it
+ export DISTCC_DISABLE=1
+ export CCACHE_DISABLE=1
+
+ if use kernel_linux; then
+ MODULE_NAMES="nvidia(video:${S}/kernel)"
+ use uvm && MODULE_NAMES+=" nvidia-uvm(video:${S}/kernel/uvm)"
+
+ # This needs to run after MODULE_NAMES (so that the eclass checks
+ # whether the kernel supports loadable modules) but before BUILD_PARAMS
+ # is set (so that KV_DIR is populated).
+ linux-mod_pkg_setup
+
+ BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} \
+ SYSOUT=${KV_OUT_DIR} CC=$(tc-getBUILD_CC)"
+
+ # linux-mod_src_compile calls set_arch_to_kernel, which
+ # sets the ARCH to x86 but NVIDIA's wrapping Makefile
+ # expects x86_64 or i386 and then converts it to x86
+ # later on in the build process
+ BUILD_FIXES="ARCH=$(uname -m | sed -e 's/i.86/i386/')"
+ fi
+
+ # set variables to where files are in the package structure
+ if use kernel_FreeBSD; then
+ use x86-fbsd && S="${WORKDIR}/${X86_FBSD_NV_PACKAGE}"
+ use amd64-fbsd && S="${WORKDIR}/${AMD64_FBSD_NV_PACKAGE}"
+ NV_DOC="${S}/doc"
+ NV_OBJ="${S}/obj"
+ NV_SRC="${S}/src"
+ NV_MAN="${S}/x11/man"
+ NV_X11="${S}/obj"
+ NV_SOVER=1
+ elif use kernel_linux; then
+ NV_DOC="${S}"
+ NV_OBJ="${S}"
+ NV_SRC="${S}/kernel"
+ NV_MAN="${S}"
+ NV_X11="${S}"
+ NV_SOVER=${PV}
+ else
+ die "Could not determine proper NVIDIA package"
+ fi
+}
+
+src_prepare() {
+ # Please add a brief description for every added patch
+
+ if use kernel_linux; then
+ if kernel_is lt 2 6 9 ; then
+ eerror "You must build this against 2.6.9 or higher kernels."
+ fi
+
+ # If greater than 2.6.5 use M= instead of SUBDIR=
+# convert_to_m "${NV_SRC}"/Makefile.kbuild
+ fi
+
+ if use pax_kernel; then
+ ewarn "Using PAX patches is not supported. You will be asked to"
+ ewarn "use a standard kernel should you have issues. Should you"
+ ewarn "need support with these patches, contact the PaX team."
+ epatch "${FILESDIR}"/${PN}-331.13-pax-usercopy.patch
+ epatch "${FILESDIR}"/${PN}-337.12-pax-constify.patch
+ fi
+
+ # Allow user patches so they can support RC kernels and whatever else
+ epatch_user
+}
+
+src_compile() {
+ # This is already the default on Linux, as there's no toplevel Makefile, but
+ # on FreeBSD there's one and triggers the kernel module build, as we install
+ # it by itself, pass this.
+
+ cd "${NV_SRC}"
+ if use kernel_FreeBSD; then
+ MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
+ LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
+ elif use kernel_linux; then
+ use uvm && MAKEOPTS=-j1
+ linux-mod_src_compile
+ fi
+}
+
+# Install nvidia library:
+# the first parameter is the library to install
+# the second parameter is the provided soversion
+# the third parameter is the target directory if its not /usr/lib
+donvidia() {
+ # Full path to library minus SOVER
+ MY_LIB="$1"
+
+ # SOVER to use
+ MY_SOVER="$2"
+
+ # Where to install
+ MY_DEST="$3"
+
+ if [[ -z "${MY_DEST}" ]]; then
+ MY_DEST="/usr/$(get_libdir)"
+ action="dolib.so"
+ else
+ exeinto ${MY_DEST}
+ action="doexe"
+ fi
+
+ # Get just the library name
+ libname=$(basename $1)
+
+ # Install the library with the correct SOVER
+ ${action} ${MY_LIB}.${MY_SOVER} || \
+ die "failed to install ${libname}"
+
+ # If SOVER wasn't 1, then we need to create a .1 symlink
+ if [[ "${MY_SOVER}" != "1" ]]; then
+ dosym ${libname}.${MY_SOVER} \
+ ${MY_DEST}/${libname}.1 || \
+ die "failed to create ${libname} symlink"
+ fi
+
+ # Always create the symlink from the raw lib to the .1
+ dosym ${libname}.1 \
+ ${MY_DEST}/${libname} || \
+ die "failed to create ${libname} symlink"
+}
+
+src_install() {
+ if use kernel_linux; then
+ linux-mod_src_install
+
+ # Add the aliases
+ # This file is tweaked with the appropriate video group in
+ # pkg_preinst, see bug #491414
+ insinto /etc/modprobe.d
+ newins "${FILESDIR}"/nvidia-169.07 nvidia.conf
+ use uvm && doins "${FILESDIR}"/nvidia-uvm.conf
+
+ # Ensures that our device nodes are created when not using X
+ exeinto "$(get_udevdir)"
+ doexe "${FILESDIR}"/nvidia-udev.sh
+ udev_newrules "${FILESDIR}"/nvidia.udev-rule 99-nvidia.rules
+ elif use kernel_FreeBSD; then
+ if use x86-fbsd; then
+ insinto /boot/modules
+ doins "${S}/src/nvidia.kld"
+ fi
+
+ exeinto /boot/modules
+ doexe "${S}/src/nvidia.ko"
+ fi
+
+ # NVIDIA kernel <-> userspace driver config lib
+ donvidia ${NV_OBJ}/libnvidia-cfg.so ${NV_SOVER}
+
+ # NVIDIA framebuffer capture library
+ donvidia ${NV_OBJ}/libnvidia-fbc.so ${NV_SOVER}
+
+ # NVIDIA video encode/decode <-> CUDA
+ if use kernel_linux; then
+ donvidia ${NV_OBJ}/libnvcuvid.so ${NV_SOVER}
+ donvidia ${NV_OBJ}/libnvidia-encode.so ${NV_SOVER}
+ fi
+
+ if use X; then
+ # Xorg DDX driver
+ insinto /usr/$(get_libdir)/xorg/modules/drivers
+ doins ${NV_X11}/nvidia_drv.so
+
+ # Xorg GLX driver
+ donvidia ${NV_X11}/libglx.so ${NV_SOVER} \
+ /usr/$(get_libdir)/opengl/nvidia/extensions
+ fi
+
+ # OpenCL ICD for NVIDIA
+ if use kernel_linux; then
+ insinto /etc/OpenCL/vendors
+ doins ${NV_OBJ}/nvidia.icd
+ fi
+
+ # Documentation
+ dohtml ${NV_DOC}/html/*
+ if use kernel_FreeBSD; then
+ dodoc "${NV_DOC}/README"
+ use X && doman "${NV_MAN}/nvidia-xconfig.1"
+ use tools && doman "${NV_MAN}/nvidia-settings.1"
+ else
+ # Docs
+ newdoc "${NV_DOC}/README.txt" README
+ dodoc "${NV_DOC}/NVIDIA_Changelog"
+ doman "${NV_MAN}/nvidia-smi.1.gz"
+ use X && doman "${NV_MAN}/nvidia-xconfig.1.gz"
+ use tools && doman "${NV_MAN}/nvidia-settings.1.gz"
+ doman "${NV_MAN}/nvidia-cuda-mps-control.1.gz"
+ fi
+
+ # Helper Apps
+ exeinto /opt/bin/
+
+ if use X; then
+ doexe ${NV_OBJ}/nvidia-xconfig
+ fi
+
+ if use kernel_linux ; then
+ doexe ${NV_OBJ}/nvidia-cuda-mps-control
+ doexe ${NV_OBJ}/nvidia-cuda-mps-server
+ doexe ${NV_OBJ}/nvidia-debugdump
+ doexe ${NV_OBJ}/nvidia-persistenced
+ doexe ${NV_OBJ}/nvidia-smi
+
+ # install nvidia-modprobe setuid and symlink in /usr/bin (bug #505092)
+ doexe ${NV_OBJ}/nvidia-modprobe
+ fowners root:video /opt/bin/nvidia-modprobe
+ fperms 4710 /opt/bin/nvidia-modprobe
+ dosym /{opt,usr}/bin/nvidia-modprobe
+
+ doman nvidia-cuda-mps-control.1.gz
+ doman nvidia-modprobe.1.gz
+ doman nvidia-persistenced.1.gz
+ newinitd "${FILESDIR}/nvidia-smi.init" nvidia-smi
+ newconfd "${FILESDIR}/nvidia-persistenced.conf" nvidia-persistenced
+ newinitd "${FILESDIR}/nvidia-persistenced.init" nvidia-persistenced
+ fi
+
+ if use tools; then
+ doexe ${NV_OBJ}/nvidia-settings
+ insinto /usr/share/nvidia/
+ doins nvidia-application-profiles-${PV}-key-documentation
+ insinto /etc/nvidia
+ newins nvidia-application-profiles-${PV}-rc nvidia-application-profiles-rc
+ fi
+
+ dobin ${NV_OBJ}/nvidia-bug-report.sh
+
+ # Desktop entries for nvidia-settings
+ if use tools ; then
+ # There is no icon in the FreeBSD tarball.
+ use kernel_FreeBSD || newicon ${NV_OBJ}/nvidia-settings.png ${PN}-settings.png
+ domenu "${FILESDIR}"/${PN}-settings.desktop
+ exeinto /etc/X11/xinit/xinitrc.d
+ doexe "${FILESDIR}"/95-nvidia-settings
+ fi
+
+ #doenvd "${FILESDIR}"/50nvidia-prelink-blacklist
+
+ if has_multilib_profile && use multilib ; then
+ local OABI=${ABI}
+ for ABI in $(get_install_abis) ; do
+ src_install-libs
+ done
+ ABI=${OABI}
+ unset OABI
+ else
+ src_install-libs
+ fi
+
+ is_final_abi || die "failed to iterate through all ABIs"
+
+ readme.gentoo_create_doc
+}
+
+src_install-libs() {
+ local inslibdir=$(get_libdir)
+ local GL_ROOT="/usr/$(get_libdir)/opengl/nvidia/lib"
+ local CL_ROOT="/usr/$(get_libdir)/OpenCL/vendors/nvidia"
+ local libdir=${NV_OBJ}
+
+ if use kernel_linux && has_multilib_profile && \
+ [[ ${ABI} == "x86" ]] ; then
+ libdir=${NV_OBJ}/32
+ fi
+
+ if use X; then
+ # The GLX libraries
+ donvidia ${libdir}/libEGL.so ${NV_SOVER} ${GL_ROOT}
+ donvidia ${libdir}/libGL.so ${NV_SOVER} ${GL_ROOT}
+ donvidia ${libdir}/libGLESv1_CM.so ${NV_SOVER} ${GL_ROOT}
+ donvidia ${libdir}/libnvidia-eglcore.so ${NV_SOVER}
+ donvidia ${libdir}/libnvidia-glcore.so ${NV_SOVER}
+ donvidia ${libdir}/libnvidia-glsi.so ${NV_SOVER}
+ donvidia ${libdir}/libnvidia-ifr.so ${NV_SOVER}
+ if use kernel_FreeBSD; then
+ donvidia ${libdir}/libnvidia-tls.so ${NV_SOVER}
+ else
+ donvidia ${libdir}/tls/libnvidia-tls.so ${NV_SOVER}
+ fi
+
+ # VDPAU
+ donvidia ${libdir}/libvdpau_nvidia.so ${NV_SOVER}
+
+ # GLES v2 libraries
+ insinto ${GL_ROOT}
+ doexe ${libdir}/libGLESv2.so.${PV}
+ dosym libGLESv2.so.${PV} ${GL_ROOT}/libGLESv2.so.2
+ dosym libGLESv2.so.2 ${GL_ROOT}/libGLESv2.so
+ fi
+
+ # NVIDIA monitoring library
+ if use kernel_linux ; then
+ donvidia ${libdir}/libnvidia-ml.so ${NV_SOVER}
+ fi
+
+ # CUDA & OpenCL
+ if use kernel_linux; then
+ donvidia ${libdir}/libcuda.so ${NV_SOVER}
+ donvidia ${libdir}/libnvidia-compiler.so ${NV_SOVER}
+ donvidia ${libdir}/libOpenCL.so 1.0.0 ${CL_ROOT}
+ donvidia ${libdir}/libnvidia-opencl.so ${NV_SOVER}
+ fi
+}
+
+pkg_preinst() {
+ if use kernel_linux; then
+ linux-mod_pkg_preinst
+
+ local videogroup="$(egetent group video | cut -d ':' -f 3)"
+ if [ -z "${videogroup}" ]; then
+ eerror "Failed to determine the video group gid"
+ die "Failed to determine the video group gid"
+ else
+ sed -i \
+ -e "s:PACKAGE:${PF}:g" \
+ -e "s:VIDEOGID:${videogroup}:" \
+ "${D}"/etc/modprobe.d/nvidia.conf || die
+ fi
+ fi
+
+ # Clean the dynamic libGL stuff's home to ensure
+ # we dont have stale libs floating around
+ if [ -d "${ROOT}"/usr/lib/opengl/nvidia ] ; then
+ rm -rf "${ROOT}"/usr/lib/opengl/nvidia/*
+ fi
+ # Make sure we nuke the old nvidia-glx's env.d file
+ if [ -e "${ROOT}"/etc/env.d/09nvidia ] ; then
+ rm -f "${ROOT}"/etc/env.d/09nvidia
+ fi
+}
+
+pkg_postinst() {
+ use kernel_linux && linux-mod_pkg_postinst
+
+ # Switch to the nvidia implementation
+ use X && "${ROOT}"/usr/bin/eselect opengl set --use-old nvidia
+ "${ROOT}"/usr/bin/eselect opencl set --use-old nvidia
+
+ readme.gentoo_print_elog
+
+ if ! use X; then
+ elog "You have elected to not install the X.org driver. Along with"
+ elog "this the OpenGL libraries and VDPAU libraries were not"
+ elog "installed. Additionally, once the driver is loaded your card"
+ elog "and fan will run at max speed which may not be desirable."
+ elog "Use the 'nvidia-smi' init script to have your card and fan"
+ elog "speed scale appropriately."
+ elog
+ fi
+ if ! use tools; then
+ elog "USE=tools controls whether the nvidia-settings application"
+ elog "is installed. If you would like to use it, enable that"
+ elog "flag and re-emerge this ebuild. Optionally you can install"
+ elog "media-video/nvidia-settings"
+ elog
+ fi
+}
+
+pkg_prerm() {
+ use X && "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
+
+pkg_postrm() {
+ use kernel_linux && linux-mod_pkg_postrm
+ use X && "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-346.87.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-346.87.ebuild
new file mode 100644
index 000000000000..e7cd202f2919
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/nvidia-drivers-346.87.ebuild
@@ -0,0 +1,489 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils flag-o-matic linux-info linux-mod multilib nvidia-driver \
+ portability toolchain-funcs unpacker user udev
+
+NV_URI="http://us.download.nvidia.com/XFree86/"
+X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
+AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
+X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
+AMD64_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86_64-${PV}"
+
+DESCRIPTION="NVIDIA Accelerated Graphics Driver"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="
+ amd64-fbsd? ( ${NV_URI}FreeBSD-x86_64/${PV}/${AMD64_FBSD_NV_PACKAGE}.tar.gz )
+ amd64? ( ${NV_URI}Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}.run )
+ x86-fbsd? ( ${NV_URI}FreeBSD-x86/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )
+ x86? ( ${NV_URI}Linux-x86/${PV}/${X86_NV_PACKAGE}.run )
+"
+
+LICENSE="GPL-2 NVIDIA-r2"
+SLOT="0"
+KEYWORDS="-* amd64 x86 ~amd64-fbsd ~x86-fbsd"
+RESTRICT="bindist mirror strip"
+EMULTILIB_PKG="true"
+
+IUSE="acpi multilib kernel_FreeBSD kernel_linux pax_kernel +tools gtk2 gtk3 +X uvm"
+REQUIRED_USE="
+ tools? ( X || ( gtk2 gtk3 ) )
+"
+
+COMMON="
+ app-eselect/eselect-opencl
+ kernel_linux? ( >=sys-libs/glibc-2.6.1 )
+ X? (
+ >=app-eselect/eselect-opengl-1.0.9
+ )
+"
+DEPEND="
+ ${COMMON}
+ app-arch/xz-utils
+ kernel_linux? ( virtual/linux-sources )
+"
+RDEPEND="
+ ${COMMON}
+ acpi? ( sys-power/acpid )
+ tools? (
+ dev-libs/atk
+ dev-libs/glib:2
+ x11-libs/gdk-pixbuf
+ gtk2? ( >=x11-libs/gtk+-2.4:2 )
+ gtk3? ( x11-libs/gtk+:3 )
+ x11-libs/libX11
+ x11-libs/libXext
+ x11-libs/pango[X]
+ )
+ X? (
+ <x11-base/xorg-server-1.17.99:=
+ >=x11-libs/libvdpau-0.3-r1
+ multilib? (
+ >=x11-libs/libX11-1.6.2[abi_x86_32]
+ >=x11-libs/libXext-1.3.2[abi_x86_32]
+ )
+ )
+"
+
+QA_PREBUILT="opt/* usr/lib*"
+
+S=${WORKDIR}/
+
+pkg_pretend() {
+ if use amd64 && has_multilib_profile && \
+ [ "${DEFAULT_ABI}" != "amd64" ]; then
+ eerror "This ebuild doesn't currently support changing your default ABI"
+ die "Unexpected \${DEFAULT_ABI} = ${DEFAULT_ABI}"
+ fi
+
+ if use kernel_linux && kernel_is ge 4 2 ; then
+ ewarn "Gentoo supports kernels which are supported by NVIDIA"
+ ewarn "which are limited to the following kernels:"
+ ewarn "<sys-kernel/gentoo-sources-4.2"
+ ewarn "<sys-kernel/vanilla-sources-4.2"
+ ewarn ""
+ ewarn "You are free to utilize epatch_user to provide whatever"
+ ewarn "support you feel is appropriate, but will not receive"
+ ewarn "support as a result of those changes."
+ ewarn ""
+ ewarn "Do not file a bug report about this."
+ fi
+
+ # Since Nvidia ships 3 different series of drivers, we need to give the user
+ # some kind of guidance as to what version they should install. This tries
+ # to point the user in the right direction but can't be perfect. check
+ # nvidia-driver.eclass
+ nvidia-driver-check-warning
+
+ # Kernel features/options to check for
+ CONFIG_CHECK="~ZONE_DMA ~MTRR ~SYSVIPC ~!LOCKDEP"
+ use x86 && CONFIG_CHECK+=" ~HIGHMEM"
+
+ # Now do the above checks
+ use kernel_linux && check_extra_config
+}
+
+pkg_setup() {
+ # try to turn off distcc and ccache for people that have a problem with it
+ export DISTCC_DISABLE=1
+ export CCACHE_DISABLE=1
+
+ if use kernel_linux; then
+ MODULE_NAMES="nvidia(video:${S}/kernel)"
+ use uvm && MODULE_NAMES+=" nvidia-uvm(video:${S}/kernel/uvm)"
+
+ # This needs to run after MODULE_NAMES (so that the eclass checks
+ # whether the kernel supports loadable modules) but before BUILD_PARAMS
+ # is set (so that KV_DIR is populated).
+ linux-mod_pkg_setup
+
+ BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} \
+ SYSOUT=${KV_OUT_DIR} CC=$(tc-getBUILD_CC)"
+
+ # linux-mod_src_compile calls set_arch_to_kernel, which
+ # sets the ARCH to x86 but NVIDIA's wrapping Makefile
+ # expects x86_64 or i386 and then converts it to x86
+ # later on in the build process
+ BUILD_FIXES="ARCH=$(uname -m | sed -e 's/i.86/i386/')"
+ fi
+
+ # set variables to where files are in the package structure
+ if use kernel_FreeBSD; then
+ use x86-fbsd && S="${WORKDIR}/${X86_FBSD_NV_PACKAGE}"
+ use amd64-fbsd && S="${WORKDIR}/${AMD64_FBSD_NV_PACKAGE}"
+ NV_DOC="${S}/doc"
+ NV_OBJ="${S}/obj"
+ NV_SRC="${S}/src"
+ NV_MAN="${S}/x11/man"
+ NV_X11="${S}/obj"
+ NV_SOVER=1
+ elif use kernel_linux; then
+ NV_DOC="${S}"
+ NV_OBJ="${S}"
+ NV_SRC="${S}/kernel"
+ NV_MAN="${S}"
+ NV_X11="${S}"
+ NV_SOVER=${PV}
+ else
+ die "Could not determine proper NVIDIA package"
+ fi
+}
+
+src_prepare() {
+ # Please add a brief description for every added patch
+
+ if use kernel_linux; then
+ if kernel_is lt 2 6 9 ; then
+ eerror "You must build this against 2.6.9 or higher kernels."
+ fi
+
+ # If greater than 2.6.5 use M= instead of SUBDIR=
+# convert_to_m "${NV_SRC}"/Makefile.kbuild
+ fi
+
+ if use pax_kernel; then
+ ewarn "Using PAX patches is not supported. You will be asked to"
+ ewarn "use a standard kernel should you have issues. Should you"
+ ewarn "need support with these patches, contact the PaX team."
+ epatch "${FILESDIR}"/${PN}-346.16-pax-usercopy.patch
+ epatch "${FILESDIR}"/${PN}-346.16-pax-constify.patch
+ fi
+
+ # Allow user patches so they can support RC kernels and whatever else
+ epatch_user
+}
+
+src_compile() {
+ # This is already the default on Linux, as there's no toplevel Makefile, but
+ # on FreeBSD there's one and triggers the kernel module build, as we install
+ # it by itself, pass this.
+
+ cd "${NV_SRC}"
+ if use kernel_FreeBSD; then
+ MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
+ LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
+ elif use kernel_linux; then
+ MAKEOPTS=-j1
+ linux-mod_src_compile
+ fi
+}
+
+# Install nvidia library:
+# the first parameter is the library to install
+# the second parameter is the provided soversion
+# the third parameter is the target directory if its not /usr/lib
+donvidia() {
+ # Full path to library minus SOVER
+ MY_LIB="$1"
+
+ # SOVER to use
+ MY_SOVER="$2"
+
+ # Where to install
+ MY_DEST="$3"
+
+ if [[ -z "${MY_DEST}" ]]; then
+ MY_DEST="/usr/$(get_libdir)"
+ action="dolib.so"
+ else
+ exeinto ${MY_DEST}
+ action="doexe"
+ fi
+
+ # Get just the library name
+ libname=$(basename $1)
+
+ # Install the library with the correct SOVER
+ ${action} ${MY_LIB}.${MY_SOVER} || \
+ die "failed to install ${libname}"
+
+ # If SOVER wasn't 1, then we need to create a .1 symlink
+ if [[ "${MY_SOVER}" != "1" ]]; then
+ dosym ${libname}.${MY_SOVER} \
+ ${MY_DEST}/${libname}.1 || \
+ die "failed to create ${libname} symlink"
+ fi
+
+ # Always create the symlink from the raw lib to the .1
+ dosym ${libname}.1 \
+ ${MY_DEST}/${libname} || \
+ die "failed to create ${libname} symlink"
+}
+
+src_install() {
+ if use kernel_linux; then
+ linux-mod_src_install
+
+ # Add the aliases
+ # This file is tweaked with the appropriate video group in
+ # pkg_preinst, see bug #491414
+ insinto /etc/modprobe.d
+ newins "${FILESDIR}"/nvidia-169.07 nvidia.conf
+ use uvm && doins "${FILESDIR}"/nvidia-uvm.conf
+
+ # Ensures that our device nodes are created when not using X
+ exeinto "$(get_udevdir)"
+ doexe "${FILESDIR}"/nvidia-udev.sh
+ udev_newrules "${FILESDIR}"/nvidia.udev-rule 99-nvidia.rules
+ elif use kernel_FreeBSD; then
+ if use x86-fbsd; then
+ insinto /boot/modules
+ doins "${S}/src/nvidia.kld"
+ fi
+
+ exeinto /boot/modules
+ doexe "${S}/src/nvidia.ko"
+ fi
+
+ # NVIDIA kernel <-> userspace driver config lib
+ donvidia ${NV_OBJ}/libnvidia-cfg.so ${NV_SOVER}
+
+ # NVIDIA framebuffer capture library
+ donvidia ${NV_OBJ}/libnvidia-fbc.so ${NV_SOVER}
+
+ # NVIDIA video encode/decode <-> CUDA
+ if use kernel_linux; then
+ donvidia ${NV_OBJ}/libnvcuvid.so ${NV_SOVER}
+ donvidia ${NV_OBJ}/libnvidia-encode.so ${NV_SOVER}
+ fi
+
+ if use X; then
+ # Xorg DDX driver
+ insinto /usr/$(get_libdir)/xorg/modules/drivers
+ doins ${NV_X11}/nvidia_drv.so
+
+ # Xorg GLX driver
+ donvidia ${NV_X11}/libglx.so ${NV_SOVER} \
+ /usr/$(get_libdir)/opengl/nvidia/extensions
+
+ # Xorg nvidia.conf
+ if has_version '>=x11-base/xorg-server-1.16'; then
+ insinto /usr/share/X11/xorg.conf.d
+ newins {,50-}nvidia-drm-outputclass.conf
+ fi
+ fi
+
+ # OpenCL ICD for NVIDIA
+ if use kernel_linux; then
+ insinto /etc/OpenCL/vendors
+ doins ${NV_OBJ}/nvidia.icd
+ fi
+
+ # Documentation
+ dohtml ${NV_DOC}/html/*
+ if use kernel_FreeBSD; then
+ dodoc "${NV_DOC}/README"
+ use X && doman "${NV_MAN}/nvidia-xconfig.1"
+ use tools && doman "${NV_MAN}/nvidia-settings.1"
+ else
+ # Docs
+ newdoc "${NV_DOC}/README.txt" README
+ dodoc "${NV_DOC}/NVIDIA_Changelog"
+ doman "${NV_MAN}/nvidia-smi.1.gz"
+ use X && doman "${NV_MAN}/nvidia-xconfig.1.gz"
+ use tools && doman "${NV_MAN}/nvidia-settings.1.gz"
+ doman "${NV_MAN}/nvidia-cuda-mps-control.1.gz"
+ fi
+
+ # Helper Apps
+ exeinto /opt/bin/
+
+ if use X; then
+ doexe ${NV_OBJ}/nvidia-xconfig
+ fi
+
+ if use kernel_linux ; then
+ doexe ${NV_OBJ}/nvidia-cuda-mps-control
+ doexe ${NV_OBJ}/nvidia-cuda-mps-server
+ doexe ${NV_OBJ}/nvidia-debugdump
+ doexe ${NV_OBJ}/nvidia-persistenced
+ doexe ${NV_OBJ}/nvidia-smi
+
+ # install nvidia-modprobe setuid and symlink in /usr/bin (bug #505092)
+ doexe ${NV_OBJ}/nvidia-modprobe
+ fowners root:video /opt/bin/nvidia-modprobe
+ fperms 4710 /opt/bin/nvidia-modprobe
+ dosym /{opt,usr}/bin/nvidia-modprobe
+
+ doman nvidia-cuda-mps-control.1.gz
+ doman nvidia-modprobe.1.gz
+ doman nvidia-persistenced.1.gz
+ newinitd "${FILESDIR}/nvidia-smi.init" nvidia-smi
+ newconfd "${FILESDIR}/nvidia-persistenced.conf" nvidia-persistenced
+ newinitd "${FILESDIR}/nvidia-persistenced.init" nvidia-persistenced
+ fi
+
+ if use tools; then
+ doexe ${NV_OBJ}/nvidia-settings
+ use gtk2 && donvidia libnvidia-gtk2.so ${PV}
+ use gtk3 && donvidia libnvidia-gtk3.so ${PV}
+ insinto /usr/share/nvidia/
+ doins nvidia-application-profiles-${PV}-key-documentation
+ insinto /etc/nvidia
+ newins nvidia-application-profiles-${PV}-rc nvidia-application-profiles-rc
+ fi
+
+ dobin ${NV_OBJ}/nvidia-bug-report.sh
+
+ # Desktop entries for nvidia-settings
+ if use tools ; then
+ # There is no icon in the FreeBSD tarball.
+ use kernel_FreeBSD || newicon ${NV_OBJ}/nvidia-settings.png ${PN}-settings.png
+ domenu "${FILESDIR}"/${PN}-settings.desktop
+ exeinto /etc/X11/xinit/xinitrc.d
+ doexe "${FILESDIR}"/95-nvidia-settings
+ fi
+
+ #doenvd "${FILESDIR}"/50nvidia-prelink-blacklist
+
+ if has_multilib_profile && use multilib ; then
+ local OABI=${ABI}
+ for ABI in $(get_install_abis) ; do
+ src_install-libs
+ done
+ ABI=${OABI}
+ unset OABI
+ else
+ src_install-libs
+ fi
+
+ is_final_abi || die "failed to iterate through all ABIs"
+
+ readme.gentoo_create_doc
+}
+
+src_install-libs() {
+ local inslibdir=$(get_libdir)
+ local GL_ROOT="/usr/$(get_libdir)/opengl/nvidia/lib"
+ local CL_ROOT="/usr/$(get_libdir)/OpenCL/vendors/nvidia"
+ local libdir=${NV_OBJ}
+
+ if use kernel_linux && has_multilib_profile && \
+ [[ ${ABI} == "x86" ]] ; then
+ libdir=${NV_OBJ}/32
+ fi
+
+ if use X; then
+ # The GLX libraries
+ donvidia ${libdir}/libEGL.so ${NV_SOVER} ${GL_ROOT}
+ donvidia ${libdir}/libGL.so ${NV_SOVER} ${GL_ROOT}
+ donvidia ${libdir}/libGLESv1_CM.so ${NV_SOVER} ${GL_ROOT}
+ donvidia ${libdir}/libnvidia-eglcore.so ${NV_SOVER}
+ donvidia ${libdir}/libnvidia-glcore.so ${NV_SOVER}
+ donvidia ${libdir}/libnvidia-glsi.so ${NV_SOVER}
+ donvidia ${libdir}/libnvidia-ifr.so ${NV_SOVER}
+ if use kernel_FreeBSD; then
+ donvidia ${libdir}/libnvidia-tls.so ${NV_SOVER}
+ else
+ donvidia ${libdir}/tls/libnvidia-tls.so ${NV_SOVER}
+ fi
+
+ # VDPAU
+ donvidia ${libdir}/libvdpau_nvidia.so ${NV_SOVER}
+
+ # GLES v2 libraries
+ insinto ${GL_ROOT}
+ doexe ${libdir}/libGLESv2.so.${PV}
+ dosym libGLESv2.so.${PV} ${GL_ROOT}/libGLESv2.so.2
+ dosym libGLESv2.so.2 ${GL_ROOT}/libGLESv2.so
+ fi
+
+ # NVIDIA monitoring library
+ if use kernel_linux ; then
+ donvidia ${libdir}/libnvidia-ml.so ${NV_SOVER}
+ fi
+
+ # CUDA & OpenCL
+ if use kernel_linux; then
+ donvidia ${libdir}/libcuda.so ${NV_SOVER}
+ donvidia ${libdir}/libnvidia-compiler.so ${NV_SOVER}
+ donvidia ${libdir}/libOpenCL.so 1.0.0 ${CL_ROOT}
+ donvidia ${libdir}/libnvidia-opencl.so ${NV_SOVER}
+ fi
+}
+
+pkg_preinst() {
+ if use kernel_linux; then
+ linux-mod_pkg_preinst
+
+ local videogroup="$(egetent group video | cut -d ':' -f 3)"
+ if [ -z "${videogroup}" ]; then
+ eerror "Failed to determine the video group gid"
+ die "Failed to determine the video group gid"
+ else
+ sed -i \
+ -e "s:PACKAGE:${PF}:g" \
+ -e "s:VIDEOGID:${videogroup}:" \
+ "${D}"/etc/modprobe.d/nvidia.conf || die
+ fi
+ fi
+
+ # Clean the dynamic libGL stuff's home to ensure
+ # we dont have stale libs floating around
+ if [ -d "${ROOT}"/usr/lib/opengl/nvidia ] ; then
+ rm -rf "${ROOT}"/usr/lib/opengl/nvidia/*
+ fi
+ # Make sure we nuke the old nvidia-glx's env.d file
+ if [ -e "${ROOT}"/etc/env.d/09nvidia ] ; then
+ rm -f "${ROOT}"/etc/env.d/09nvidia
+ fi
+}
+
+pkg_postinst() {
+ use kernel_linux && linux-mod_pkg_postinst
+
+ # Switch to the nvidia implementation
+ use X && "${ROOT}"/usr/bin/eselect opengl set --use-old nvidia
+ "${ROOT}"/usr/bin/eselect opencl set --use-old nvidia
+
+ readme.gentoo_print_elog
+
+ if ! use X; then
+ elog "You have elected to not install the X.org driver. Along with"
+ elog "this the OpenGL libraries and VDPAU libraries were not"
+ elog "installed. Additionally, once the driver is loaded your card"
+ elog "and fan will run at max speed which may not be desirable."
+ elog "Use the 'nvidia-smi' init script to have your card and fan"
+ elog "speed scale appropriately."
+ elog
+ fi
+ if ! use tools; then
+ elog "USE=tools controls whether the nvidia-settings application"
+ elog "is installed. If you would like to use it, enable that"
+ elog "flag and re-emerge this ebuild. Optionally you can install"
+ elog "media-video/nvidia-settings"
+ elog
+ fi
+}
+
+pkg_prerm() {
+ use X && "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
+
+pkg_postrm() {
+ use kernel_linux && linux-mod_pkg_postrm
+ use X && "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-349.16.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-349.16.ebuild
new file mode 100644
index 000000000000..a7432941a883
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/nvidia-drivers-349.16.ebuild
@@ -0,0 +1,489 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils flag-o-matic linux-info linux-mod multilib nvidia-driver \
+ portability toolchain-funcs unpacker user udev
+
+NV_URI="http://us.download.nvidia.com/XFree86/"
+X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
+AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
+X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
+AMD64_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86_64-${PV}"
+
+DESCRIPTION="NVIDIA Accelerated Graphics Driver"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="
+ amd64-fbsd? ( ${NV_URI}FreeBSD-x86_64/${PV}/${AMD64_FBSD_NV_PACKAGE}.tar.gz )
+ amd64? ( ${NV_URI}Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}.run )
+ x86-fbsd? ( ${NV_URI}FreeBSD-x86/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )
+ x86? ( ${NV_URI}Linux-x86/${PV}/${X86_NV_PACKAGE}.run )
+"
+
+LICENSE="GPL-2 NVIDIA-r2"
+SLOT="0"
+KEYWORDS="-* amd64 x86 ~amd64-fbsd ~x86-fbsd"
+RESTRICT="bindist mirror strip"
+EMULTILIB_PKG="true"
+
+IUSE="acpi multilib kernel_FreeBSD kernel_linux pax_kernel +tools gtk2 gtk3 +X uvm"
+REQUIRED_USE="
+ tools? ( X || ( gtk2 gtk3 ) )
+"
+
+COMMON="
+ app-eselect/eselect-opencl
+ kernel_linux? ( >=sys-libs/glibc-2.6.1 )
+ X? (
+ >=app-eselect/eselect-opengl-1.0.9
+ )
+"
+DEPEND="
+ ${COMMON}
+ app-arch/xz-utils
+ kernel_linux? ( virtual/linux-sources )
+"
+RDEPEND="
+ ${COMMON}
+ acpi? ( sys-power/acpid )
+ tools? (
+ dev-libs/atk
+ dev-libs/glib:2
+ x11-libs/gdk-pixbuf
+ gtk2? ( >=x11-libs/gtk+-2.4:2 )
+ gtk3? ( x11-libs/gtk+:3 )
+ x11-libs/libX11
+ x11-libs/libXext
+ x11-libs/pango[X]
+ )
+ X? (
+ <x11-base/xorg-server-1.17.99:=
+ >=x11-libs/libvdpau-0.3-r1
+ multilib? (
+ >=x11-libs/libX11-1.6.2[abi_x86_32]
+ >=x11-libs/libXext-1.3.2[abi_x86_32]
+ )
+ )
+"
+
+QA_PREBUILT="opt/* usr/lib*"
+
+S=${WORKDIR}/
+
+pkg_pretend() {
+ if use amd64 && has_multilib_profile && \
+ [ "${DEFAULT_ABI}" != "amd64" ]; then
+ eerror "This ebuild doesn't currently support changing your default ABI"
+ die "Unexpected \${DEFAULT_ABI} = ${DEFAULT_ABI}"
+ fi
+
+ if use kernel_linux && kernel_is ge 4 1 ; then
+ ewarn "Gentoo supports kernels which are supported by NVIDIA"
+ ewarn "which are limited to the following kernels:"
+ ewarn "<sys-kernel/gentoo-sources-4.1"
+ ewarn "<sys-kernel/vanilla-sources-4.1"
+ ewarn ""
+ ewarn "You are free to utilize epatch_user to provide whatever"
+ ewarn "support you feel is appropriate, but will not receive"
+ ewarn "support as a result of those changes."
+ ewarn ""
+ ewarn "Do not file a bug report about this."
+ fi
+
+ # Since Nvidia ships 3 different series of drivers, we need to give the user
+ # some kind of guidance as to what version they should install. This tries
+ # to point the user in the right direction but can't be perfect. check
+ # nvidia-driver.eclass
+ nvidia-driver-check-warning
+
+ # Kernel features/options to check for
+ CONFIG_CHECK="~ZONE_DMA ~MTRR ~SYSVIPC ~!LOCKDEP"
+ use x86 && CONFIG_CHECK+=" ~HIGHMEM"
+
+ # Now do the above checks
+ use kernel_linux && check_extra_config
+}
+
+pkg_setup() {
+ # try to turn off distcc and ccache for people that have a problem with it
+ export DISTCC_DISABLE=1
+ export CCACHE_DISABLE=1
+
+ if use kernel_linux; then
+ MODULE_NAMES="nvidia(video:${S}/kernel)"
+ use uvm && MODULE_NAMES+=" nvidia-uvm(video:${S}/kernel/uvm)"
+
+ # This needs to run after MODULE_NAMES (so that the eclass checks
+ # whether the kernel supports loadable modules) but before BUILD_PARAMS
+ # is set (so that KV_DIR is populated).
+ linux-mod_pkg_setup
+
+ BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} \
+ SYSOUT=${KV_OUT_DIR} CC=$(tc-getBUILD_CC)"
+
+ # linux-mod_src_compile calls set_arch_to_kernel, which
+ # sets the ARCH to x86 but NVIDIA's wrapping Makefile
+ # expects x86_64 or i386 and then converts it to x86
+ # later on in the build process
+ BUILD_FIXES="ARCH=$(uname -m | sed -e 's/i.86/i386/')"
+ fi
+
+ # set variables to where files are in the package structure
+ if use kernel_FreeBSD; then
+ use x86-fbsd && S="${WORKDIR}/${X86_FBSD_NV_PACKAGE}"
+ use amd64-fbsd && S="${WORKDIR}/${AMD64_FBSD_NV_PACKAGE}"
+ NV_DOC="${S}/doc"
+ NV_OBJ="${S}/obj"
+ NV_SRC="${S}/src"
+ NV_MAN="${S}/x11/man"
+ NV_X11="${S}/obj"
+ NV_SOVER=1
+ elif use kernel_linux; then
+ NV_DOC="${S}"
+ NV_OBJ="${S}"
+ NV_SRC="${S}/kernel"
+ NV_MAN="${S}"
+ NV_X11="${S}"
+ NV_SOVER=${PV}
+ else
+ die "Could not determine proper NVIDIA package"
+ fi
+}
+
+src_prepare() {
+ # Please add a brief description for every added patch
+
+ if use kernel_linux; then
+ if kernel_is lt 2 6 9 ; then
+ eerror "You must build this against 2.6.9 or higher kernels."
+ fi
+
+ # If greater than 2.6.5 use M= instead of SUBDIR=
+# convert_to_m "${NV_SRC}"/Makefile.kbuild
+ fi
+
+ if use pax_kernel; then
+ ewarn "Using PAX patches is not supported. You will be asked to"
+ ewarn "use a standard kernel should you have issues. Should you"
+ ewarn "need support with these patches, contact the PaX team."
+ epatch "${FILESDIR}"/${PN}-346.16-pax-usercopy.patch
+ epatch "${FILESDIR}"/${PN}-346.16-pax-constify.patch
+ fi
+
+ # Allow user patches so they can support RC kernels and whatever else
+ epatch_user
+}
+
+src_compile() {
+ # This is already the default on Linux, as there's no toplevel Makefile, but
+ # on FreeBSD there's one and triggers the kernel module build, as we install
+ # it by itself, pass this.
+
+ cd "${NV_SRC}"
+ if use kernel_FreeBSD; then
+ MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
+ LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
+ elif use kernel_linux; then
+ MAKEOPTS=-j1
+ linux-mod_src_compile
+ fi
+}
+
+# Install nvidia library:
+# the first parameter is the library to install
+# the second parameter is the provided soversion
+# the third parameter is the target directory if its not /usr/lib
+donvidia() {
+ # Full path to library minus SOVER
+ MY_LIB="$1"
+
+ # SOVER to use
+ MY_SOVER="$2"
+
+ # Where to install
+ MY_DEST="$3"
+
+ if [[ -z "${MY_DEST}" ]]; then
+ MY_DEST="/usr/$(get_libdir)"
+ action="dolib.so"
+ else
+ exeinto ${MY_DEST}
+ action="doexe"
+ fi
+
+ # Get just the library name
+ libname=$(basename $1)
+
+ # Install the library with the correct SOVER
+ ${action} ${MY_LIB}.${MY_SOVER} || \
+ die "failed to install ${libname}"
+
+ # If SOVER wasn't 1, then we need to create a .1 symlink
+ if [[ "${MY_SOVER}" != "1" ]]; then
+ dosym ${libname}.${MY_SOVER} \
+ ${MY_DEST}/${libname}.1 || \
+ die "failed to create ${libname} symlink"
+ fi
+
+ # Always create the symlink from the raw lib to the .1
+ dosym ${libname}.1 \
+ ${MY_DEST}/${libname} || \
+ die "failed to create ${libname} symlink"
+}
+
+src_install() {
+ if use kernel_linux; then
+ linux-mod_src_install
+
+ # Add the aliases
+ # This file is tweaked with the appropriate video group in
+ # pkg_preinst, see bug #491414
+ insinto /etc/modprobe.d
+ newins "${FILESDIR}"/nvidia-169.07 nvidia.conf
+ use uvm && doins "${FILESDIR}"/nvidia-uvm.conf
+
+ # Ensures that our device nodes are created when not using X
+ exeinto "$(get_udevdir)"
+ doexe "${FILESDIR}"/nvidia-udev.sh
+ udev_newrules "${FILESDIR}"/nvidia.udev-rule 99-nvidia.rules
+ elif use kernel_FreeBSD; then
+ if use x86-fbsd; then
+ insinto /boot/modules
+ doins "${S}/src/nvidia.kld"
+ fi
+
+ exeinto /boot/modules
+ doexe "${S}/src/nvidia.ko"
+ fi
+
+ # NVIDIA kernel <-> userspace driver config lib
+ donvidia ${NV_OBJ}/libnvidia-cfg.so ${NV_SOVER}
+
+ # NVIDIA framebuffer capture library
+ donvidia ${NV_OBJ}/libnvidia-fbc.so ${NV_SOVER}
+
+ # NVIDIA video encode/decode <-> CUDA
+ if use kernel_linux; then
+ donvidia ${NV_OBJ}/libnvcuvid.so ${NV_SOVER}
+ donvidia ${NV_OBJ}/libnvidia-encode.so ${NV_SOVER}
+ fi
+
+ if use X; then
+ # Xorg DDX driver
+ insinto /usr/$(get_libdir)/xorg/modules/drivers
+ doins ${NV_X11}/nvidia_drv.so
+
+ # Xorg GLX driver
+ donvidia ${NV_X11}/libglx.so ${NV_SOVER} \
+ /usr/$(get_libdir)/opengl/nvidia/extensions
+
+ # Xorg nvidia.conf
+ if has_version '>=x11-base/xorg-server-1.16'; then
+ insinto /usr/share/X11/xorg.conf.d
+ newins {,50-}nvidia-drm-outputclass.conf
+ fi
+ fi
+
+ # OpenCL ICD for NVIDIA
+ if use kernel_linux; then
+ insinto /etc/OpenCL/vendors
+ doins ${NV_OBJ}/nvidia.icd
+ fi
+
+ # Documentation
+ dohtml ${NV_DOC}/html/*
+ if use kernel_FreeBSD; then
+ dodoc "${NV_DOC}/README"
+ use X && doman "${NV_MAN}/nvidia-xconfig.1"
+ use tools && doman "${NV_MAN}/nvidia-settings.1"
+ else
+ # Docs
+ newdoc "${NV_DOC}/README.txt" README
+ dodoc "${NV_DOC}/NVIDIA_Changelog"
+ doman "${NV_MAN}/nvidia-smi.1.gz"
+ use X && doman "${NV_MAN}/nvidia-xconfig.1.gz"
+ use tools && doman "${NV_MAN}/nvidia-settings.1.gz"
+ doman "${NV_MAN}/nvidia-cuda-mps-control.1.gz"
+ fi
+
+ # Helper Apps
+ exeinto /opt/bin/
+
+ if use X; then
+ doexe ${NV_OBJ}/nvidia-xconfig
+ fi
+
+ if use kernel_linux ; then
+ doexe ${NV_OBJ}/nvidia-cuda-mps-control
+ doexe ${NV_OBJ}/nvidia-cuda-mps-server
+ doexe ${NV_OBJ}/nvidia-debugdump
+ doexe ${NV_OBJ}/nvidia-persistenced
+ doexe ${NV_OBJ}/nvidia-smi
+
+ # install nvidia-modprobe setuid and symlink in /usr/bin (bug #505092)
+ doexe ${NV_OBJ}/nvidia-modprobe
+ fowners root:video /opt/bin/nvidia-modprobe
+ fperms 4710 /opt/bin/nvidia-modprobe
+ dosym /{opt,usr}/bin/nvidia-modprobe
+
+ doman nvidia-cuda-mps-control.1.gz
+ doman nvidia-modprobe.1.gz
+ doman nvidia-persistenced.1.gz
+ newinitd "${FILESDIR}/nvidia-smi.init" nvidia-smi
+ newconfd "${FILESDIR}/nvidia-persistenced.conf" nvidia-persistenced
+ newinitd "${FILESDIR}/nvidia-persistenced.init" nvidia-persistenced
+ fi
+
+ if use tools; then
+ doexe ${NV_OBJ}/nvidia-settings
+ use gtk2 && donvidia libnvidia-gtk2.so ${PV}
+ use gtk3 && donvidia libnvidia-gtk3.so ${PV}
+ insinto /usr/share/nvidia/
+ doins nvidia-application-profiles-${PV}-key-documentation
+ insinto /etc/nvidia
+ newins nvidia-application-profiles-${PV}-rc nvidia-application-profiles-rc
+ fi
+
+ dobin ${NV_OBJ}/nvidia-bug-report.sh
+
+ # Desktop entries for nvidia-settings
+ if use tools ; then
+ # There is no icon in the FreeBSD tarball.
+ use kernel_FreeBSD || newicon ${NV_OBJ}/nvidia-settings.png ${PN}-settings.png
+ domenu "${FILESDIR}"/${PN}-settings.desktop
+ exeinto /etc/X11/xinit/xinitrc.d
+ doexe "${FILESDIR}"/95-nvidia-settings
+ fi
+
+ #doenvd "${FILESDIR}"/50nvidia-prelink-blacklist
+
+ if has_multilib_profile && use multilib ; then
+ local OABI=${ABI}
+ for ABI in $(get_install_abis) ; do
+ src_install-libs
+ done
+ ABI=${OABI}
+ unset OABI
+ else
+ src_install-libs
+ fi
+
+ is_final_abi || die "failed to iterate through all ABIs"
+
+ readme.gentoo_create_doc
+}
+
+src_install-libs() {
+ local inslibdir=$(get_libdir)
+ local GL_ROOT="/usr/$(get_libdir)/opengl/nvidia/lib"
+ local CL_ROOT="/usr/$(get_libdir)/OpenCL/vendors/nvidia"
+ local libdir=${NV_OBJ}
+
+ if use kernel_linux && has_multilib_profile && \
+ [[ ${ABI} == "x86" ]] ; then
+ libdir=${NV_OBJ}/32
+ fi
+
+ if use X; then
+ # The GLX libraries
+ donvidia ${libdir}/libEGL.so ${NV_SOVER} ${GL_ROOT}
+ donvidia ${libdir}/libGL.so ${NV_SOVER} ${GL_ROOT}
+ donvidia ${libdir}/libGLESv1_CM.so ${NV_SOVER} ${GL_ROOT}
+ donvidia ${libdir}/libnvidia-eglcore.so ${NV_SOVER}
+ donvidia ${libdir}/libnvidia-glcore.so ${NV_SOVER}
+ donvidia ${libdir}/libnvidia-glsi.so ${NV_SOVER}
+ donvidia ${libdir}/libnvidia-ifr.so ${NV_SOVER}
+ if use kernel_FreeBSD; then
+ donvidia ${libdir}/libnvidia-tls.so ${NV_SOVER}
+ else
+ donvidia ${libdir}/tls/libnvidia-tls.so ${NV_SOVER}
+ fi
+
+ # VDPAU
+ donvidia ${libdir}/libvdpau_nvidia.so ${NV_SOVER}
+
+ # GLES v2 libraries
+ insinto ${GL_ROOT}
+ doexe ${libdir}/libGLESv2.so.${PV}
+ dosym libGLESv2.so.${PV} ${GL_ROOT}/libGLESv2.so.2
+ dosym libGLESv2.so.2 ${GL_ROOT}/libGLESv2.so
+ fi
+
+ # NVIDIA monitoring library
+ if use kernel_linux ; then
+ donvidia ${libdir}/libnvidia-ml.so ${NV_SOVER}
+ fi
+
+ # CUDA & OpenCL
+ if use kernel_linux; then
+ donvidia ${libdir}/libcuda.so ${NV_SOVER}
+ donvidia ${libdir}/libnvidia-compiler.so ${NV_SOVER}
+ donvidia ${libdir}/libOpenCL.so 1.0.0 ${CL_ROOT}
+ donvidia ${libdir}/libnvidia-opencl.so ${NV_SOVER}
+ fi
+}
+
+pkg_preinst() {
+ if use kernel_linux; then
+ linux-mod_pkg_preinst
+
+ local videogroup="$(egetent group video | cut -d ':' -f 3)"
+ if [ -z "${videogroup}" ]; then
+ eerror "Failed to determine the video group gid"
+ die "Failed to determine the video group gid"
+ else
+ sed -i \
+ -e "s:PACKAGE:${PF}:g" \
+ -e "s:VIDEOGID:${videogroup}:" \
+ "${D}"/etc/modprobe.d/nvidia.conf || die
+ fi
+ fi
+
+ # Clean the dynamic libGL stuff's home to ensure
+ # we dont have stale libs floating around
+ if [ -d "${ROOT}"/usr/lib/opengl/nvidia ] ; then
+ rm -rf "${ROOT}"/usr/lib/opengl/nvidia/*
+ fi
+ # Make sure we nuke the old nvidia-glx's env.d file
+ if [ -e "${ROOT}"/etc/env.d/09nvidia ] ; then
+ rm -f "${ROOT}"/etc/env.d/09nvidia
+ fi
+}
+
+pkg_postinst() {
+ use kernel_linux && linux-mod_pkg_postinst
+
+ # Switch to the nvidia implementation
+ use X && "${ROOT}"/usr/bin/eselect opengl set --use-old nvidia
+ "${ROOT}"/usr/bin/eselect opencl set --use-old nvidia
+
+ readme.gentoo_print_elog
+
+ if ! use X; then
+ elog "You have elected to not install the X.org driver. Along with"
+ elog "this the OpenGL libraries and VDPAU libraries were not"
+ elog "installed. Additionally, once the driver is loaded your card"
+ elog "and fan will run at max speed which may not be desirable."
+ elog "Use the 'nvidia-smi' init script to have your card and fan"
+ elog "speed scale appropriately."
+ elog
+ fi
+ if ! use tools; then
+ elog "USE=tools controls whether the nvidia-settings application"
+ elog "is installed. If you would like to use it, enable that"
+ elog "flag and re-emerge this ebuild. Optionally you can install"
+ elog "media-video/nvidia-settings"
+ elog
+ fi
+}
+
+pkg_prerm() {
+ use X && "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
+
+pkg_postrm() {
+ use kernel_linux && linux-mod_pkg_postrm
+ use X && "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-352.30.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-352.30.ebuild
new file mode 100644
index 000000000000..e7cd202f2919
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/nvidia-drivers-352.30.ebuild
@@ -0,0 +1,489 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils flag-o-matic linux-info linux-mod multilib nvidia-driver \
+ portability toolchain-funcs unpacker user udev
+
+NV_URI="http://us.download.nvidia.com/XFree86/"
+X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
+AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
+X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
+AMD64_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86_64-${PV}"
+
+DESCRIPTION="NVIDIA Accelerated Graphics Driver"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="
+ amd64-fbsd? ( ${NV_URI}FreeBSD-x86_64/${PV}/${AMD64_FBSD_NV_PACKAGE}.tar.gz )
+ amd64? ( ${NV_URI}Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}.run )
+ x86-fbsd? ( ${NV_URI}FreeBSD-x86/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )
+ x86? ( ${NV_URI}Linux-x86/${PV}/${X86_NV_PACKAGE}.run )
+"
+
+LICENSE="GPL-2 NVIDIA-r2"
+SLOT="0"
+KEYWORDS="-* amd64 x86 ~amd64-fbsd ~x86-fbsd"
+RESTRICT="bindist mirror strip"
+EMULTILIB_PKG="true"
+
+IUSE="acpi multilib kernel_FreeBSD kernel_linux pax_kernel +tools gtk2 gtk3 +X uvm"
+REQUIRED_USE="
+ tools? ( X || ( gtk2 gtk3 ) )
+"
+
+COMMON="
+ app-eselect/eselect-opencl
+ kernel_linux? ( >=sys-libs/glibc-2.6.1 )
+ X? (
+ >=app-eselect/eselect-opengl-1.0.9
+ )
+"
+DEPEND="
+ ${COMMON}
+ app-arch/xz-utils
+ kernel_linux? ( virtual/linux-sources )
+"
+RDEPEND="
+ ${COMMON}
+ acpi? ( sys-power/acpid )
+ tools? (
+ dev-libs/atk
+ dev-libs/glib:2
+ x11-libs/gdk-pixbuf
+ gtk2? ( >=x11-libs/gtk+-2.4:2 )
+ gtk3? ( x11-libs/gtk+:3 )
+ x11-libs/libX11
+ x11-libs/libXext
+ x11-libs/pango[X]
+ )
+ X? (
+ <x11-base/xorg-server-1.17.99:=
+ >=x11-libs/libvdpau-0.3-r1
+ multilib? (
+ >=x11-libs/libX11-1.6.2[abi_x86_32]
+ >=x11-libs/libXext-1.3.2[abi_x86_32]
+ )
+ )
+"
+
+QA_PREBUILT="opt/* usr/lib*"
+
+S=${WORKDIR}/
+
+pkg_pretend() {
+ if use amd64 && has_multilib_profile && \
+ [ "${DEFAULT_ABI}" != "amd64" ]; then
+ eerror "This ebuild doesn't currently support changing your default ABI"
+ die "Unexpected \${DEFAULT_ABI} = ${DEFAULT_ABI}"
+ fi
+
+ if use kernel_linux && kernel_is ge 4 2 ; then
+ ewarn "Gentoo supports kernels which are supported by NVIDIA"
+ ewarn "which are limited to the following kernels:"
+ ewarn "<sys-kernel/gentoo-sources-4.2"
+ ewarn "<sys-kernel/vanilla-sources-4.2"
+ ewarn ""
+ ewarn "You are free to utilize epatch_user to provide whatever"
+ ewarn "support you feel is appropriate, but will not receive"
+ ewarn "support as a result of those changes."
+ ewarn ""
+ ewarn "Do not file a bug report about this."
+ fi
+
+ # Since Nvidia ships 3 different series of drivers, we need to give the user
+ # some kind of guidance as to what version they should install. This tries
+ # to point the user in the right direction but can't be perfect. check
+ # nvidia-driver.eclass
+ nvidia-driver-check-warning
+
+ # Kernel features/options to check for
+ CONFIG_CHECK="~ZONE_DMA ~MTRR ~SYSVIPC ~!LOCKDEP"
+ use x86 && CONFIG_CHECK+=" ~HIGHMEM"
+
+ # Now do the above checks
+ use kernel_linux && check_extra_config
+}
+
+pkg_setup() {
+ # try to turn off distcc and ccache for people that have a problem with it
+ export DISTCC_DISABLE=1
+ export CCACHE_DISABLE=1
+
+ if use kernel_linux; then
+ MODULE_NAMES="nvidia(video:${S}/kernel)"
+ use uvm && MODULE_NAMES+=" nvidia-uvm(video:${S}/kernel/uvm)"
+
+ # This needs to run after MODULE_NAMES (so that the eclass checks
+ # whether the kernel supports loadable modules) but before BUILD_PARAMS
+ # is set (so that KV_DIR is populated).
+ linux-mod_pkg_setup
+
+ BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} \
+ SYSOUT=${KV_OUT_DIR} CC=$(tc-getBUILD_CC)"
+
+ # linux-mod_src_compile calls set_arch_to_kernel, which
+ # sets the ARCH to x86 but NVIDIA's wrapping Makefile
+ # expects x86_64 or i386 and then converts it to x86
+ # later on in the build process
+ BUILD_FIXES="ARCH=$(uname -m | sed -e 's/i.86/i386/')"
+ fi
+
+ # set variables to where files are in the package structure
+ if use kernel_FreeBSD; then
+ use x86-fbsd && S="${WORKDIR}/${X86_FBSD_NV_PACKAGE}"
+ use amd64-fbsd && S="${WORKDIR}/${AMD64_FBSD_NV_PACKAGE}"
+ NV_DOC="${S}/doc"
+ NV_OBJ="${S}/obj"
+ NV_SRC="${S}/src"
+ NV_MAN="${S}/x11/man"
+ NV_X11="${S}/obj"
+ NV_SOVER=1
+ elif use kernel_linux; then
+ NV_DOC="${S}"
+ NV_OBJ="${S}"
+ NV_SRC="${S}/kernel"
+ NV_MAN="${S}"
+ NV_X11="${S}"
+ NV_SOVER=${PV}
+ else
+ die "Could not determine proper NVIDIA package"
+ fi
+}
+
+src_prepare() {
+ # Please add a brief description for every added patch
+
+ if use kernel_linux; then
+ if kernel_is lt 2 6 9 ; then
+ eerror "You must build this against 2.6.9 or higher kernels."
+ fi
+
+ # If greater than 2.6.5 use M= instead of SUBDIR=
+# convert_to_m "${NV_SRC}"/Makefile.kbuild
+ fi
+
+ if use pax_kernel; then
+ ewarn "Using PAX patches is not supported. You will be asked to"
+ ewarn "use a standard kernel should you have issues. Should you"
+ ewarn "need support with these patches, contact the PaX team."
+ epatch "${FILESDIR}"/${PN}-346.16-pax-usercopy.patch
+ epatch "${FILESDIR}"/${PN}-346.16-pax-constify.patch
+ fi
+
+ # Allow user patches so they can support RC kernels and whatever else
+ epatch_user
+}
+
+src_compile() {
+ # This is already the default on Linux, as there's no toplevel Makefile, but
+ # on FreeBSD there's one and triggers the kernel module build, as we install
+ # it by itself, pass this.
+
+ cd "${NV_SRC}"
+ if use kernel_FreeBSD; then
+ MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
+ LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
+ elif use kernel_linux; then
+ MAKEOPTS=-j1
+ linux-mod_src_compile
+ fi
+}
+
+# Install nvidia library:
+# the first parameter is the library to install
+# the second parameter is the provided soversion
+# the third parameter is the target directory if its not /usr/lib
+donvidia() {
+ # Full path to library minus SOVER
+ MY_LIB="$1"
+
+ # SOVER to use
+ MY_SOVER="$2"
+
+ # Where to install
+ MY_DEST="$3"
+
+ if [[ -z "${MY_DEST}" ]]; then
+ MY_DEST="/usr/$(get_libdir)"
+ action="dolib.so"
+ else
+ exeinto ${MY_DEST}
+ action="doexe"
+ fi
+
+ # Get just the library name
+ libname=$(basename $1)
+
+ # Install the library with the correct SOVER
+ ${action} ${MY_LIB}.${MY_SOVER} || \
+ die "failed to install ${libname}"
+
+ # If SOVER wasn't 1, then we need to create a .1 symlink
+ if [[ "${MY_SOVER}" != "1" ]]; then
+ dosym ${libname}.${MY_SOVER} \
+ ${MY_DEST}/${libname}.1 || \
+ die "failed to create ${libname} symlink"
+ fi
+
+ # Always create the symlink from the raw lib to the .1
+ dosym ${libname}.1 \
+ ${MY_DEST}/${libname} || \
+ die "failed to create ${libname} symlink"
+}
+
+src_install() {
+ if use kernel_linux; then
+ linux-mod_src_install
+
+ # Add the aliases
+ # This file is tweaked with the appropriate video group in
+ # pkg_preinst, see bug #491414
+ insinto /etc/modprobe.d
+ newins "${FILESDIR}"/nvidia-169.07 nvidia.conf
+ use uvm && doins "${FILESDIR}"/nvidia-uvm.conf
+
+ # Ensures that our device nodes are created when not using X
+ exeinto "$(get_udevdir)"
+ doexe "${FILESDIR}"/nvidia-udev.sh
+ udev_newrules "${FILESDIR}"/nvidia.udev-rule 99-nvidia.rules
+ elif use kernel_FreeBSD; then
+ if use x86-fbsd; then
+ insinto /boot/modules
+ doins "${S}/src/nvidia.kld"
+ fi
+
+ exeinto /boot/modules
+ doexe "${S}/src/nvidia.ko"
+ fi
+
+ # NVIDIA kernel <-> userspace driver config lib
+ donvidia ${NV_OBJ}/libnvidia-cfg.so ${NV_SOVER}
+
+ # NVIDIA framebuffer capture library
+ donvidia ${NV_OBJ}/libnvidia-fbc.so ${NV_SOVER}
+
+ # NVIDIA video encode/decode <-> CUDA
+ if use kernel_linux; then
+ donvidia ${NV_OBJ}/libnvcuvid.so ${NV_SOVER}
+ donvidia ${NV_OBJ}/libnvidia-encode.so ${NV_SOVER}
+ fi
+
+ if use X; then
+ # Xorg DDX driver
+ insinto /usr/$(get_libdir)/xorg/modules/drivers
+ doins ${NV_X11}/nvidia_drv.so
+
+ # Xorg GLX driver
+ donvidia ${NV_X11}/libglx.so ${NV_SOVER} \
+ /usr/$(get_libdir)/opengl/nvidia/extensions
+
+ # Xorg nvidia.conf
+ if has_version '>=x11-base/xorg-server-1.16'; then
+ insinto /usr/share/X11/xorg.conf.d
+ newins {,50-}nvidia-drm-outputclass.conf
+ fi
+ fi
+
+ # OpenCL ICD for NVIDIA
+ if use kernel_linux; then
+ insinto /etc/OpenCL/vendors
+ doins ${NV_OBJ}/nvidia.icd
+ fi
+
+ # Documentation
+ dohtml ${NV_DOC}/html/*
+ if use kernel_FreeBSD; then
+ dodoc "${NV_DOC}/README"
+ use X && doman "${NV_MAN}/nvidia-xconfig.1"
+ use tools && doman "${NV_MAN}/nvidia-settings.1"
+ else
+ # Docs
+ newdoc "${NV_DOC}/README.txt" README
+ dodoc "${NV_DOC}/NVIDIA_Changelog"
+ doman "${NV_MAN}/nvidia-smi.1.gz"
+ use X && doman "${NV_MAN}/nvidia-xconfig.1.gz"
+ use tools && doman "${NV_MAN}/nvidia-settings.1.gz"
+ doman "${NV_MAN}/nvidia-cuda-mps-control.1.gz"
+ fi
+
+ # Helper Apps
+ exeinto /opt/bin/
+
+ if use X; then
+ doexe ${NV_OBJ}/nvidia-xconfig
+ fi
+
+ if use kernel_linux ; then
+ doexe ${NV_OBJ}/nvidia-cuda-mps-control
+ doexe ${NV_OBJ}/nvidia-cuda-mps-server
+ doexe ${NV_OBJ}/nvidia-debugdump
+ doexe ${NV_OBJ}/nvidia-persistenced
+ doexe ${NV_OBJ}/nvidia-smi
+
+ # install nvidia-modprobe setuid and symlink in /usr/bin (bug #505092)
+ doexe ${NV_OBJ}/nvidia-modprobe
+ fowners root:video /opt/bin/nvidia-modprobe
+ fperms 4710 /opt/bin/nvidia-modprobe
+ dosym /{opt,usr}/bin/nvidia-modprobe
+
+ doman nvidia-cuda-mps-control.1.gz
+ doman nvidia-modprobe.1.gz
+ doman nvidia-persistenced.1.gz
+ newinitd "${FILESDIR}/nvidia-smi.init" nvidia-smi
+ newconfd "${FILESDIR}/nvidia-persistenced.conf" nvidia-persistenced
+ newinitd "${FILESDIR}/nvidia-persistenced.init" nvidia-persistenced
+ fi
+
+ if use tools; then
+ doexe ${NV_OBJ}/nvidia-settings
+ use gtk2 && donvidia libnvidia-gtk2.so ${PV}
+ use gtk3 && donvidia libnvidia-gtk3.so ${PV}
+ insinto /usr/share/nvidia/
+ doins nvidia-application-profiles-${PV}-key-documentation
+ insinto /etc/nvidia
+ newins nvidia-application-profiles-${PV}-rc nvidia-application-profiles-rc
+ fi
+
+ dobin ${NV_OBJ}/nvidia-bug-report.sh
+
+ # Desktop entries for nvidia-settings
+ if use tools ; then
+ # There is no icon in the FreeBSD tarball.
+ use kernel_FreeBSD || newicon ${NV_OBJ}/nvidia-settings.png ${PN}-settings.png
+ domenu "${FILESDIR}"/${PN}-settings.desktop
+ exeinto /etc/X11/xinit/xinitrc.d
+ doexe "${FILESDIR}"/95-nvidia-settings
+ fi
+
+ #doenvd "${FILESDIR}"/50nvidia-prelink-blacklist
+
+ if has_multilib_profile && use multilib ; then
+ local OABI=${ABI}
+ for ABI in $(get_install_abis) ; do
+ src_install-libs
+ done
+ ABI=${OABI}
+ unset OABI
+ else
+ src_install-libs
+ fi
+
+ is_final_abi || die "failed to iterate through all ABIs"
+
+ readme.gentoo_create_doc
+}
+
+src_install-libs() {
+ local inslibdir=$(get_libdir)
+ local GL_ROOT="/usr/$(get_libdir)/opengl/nvidia/lib"
+ local CL_ROOT="/usr/$(get_libdir)/OpenCL/vendors/nvidia"
+ local libdir=${NV_OBJ}
+
+ if use kernel_linux && has_multilib_profile && \
+ [[ ${ABI} == "x86" ]] ; then
+ libdir=${NV_OBJ}/32
+ fi
+
+ if use X; then
+ # The GLX libraries
+ donvidia ${libdir}/libEGL.so ${NV_SOVER} ${GL_ROOT}
+ donvidia ${libdir}/libGL.so ${NV_SOVER} ${GL_ROOT}
+ donvidia ${libdir}/libGLESv1_CM.so ${NV_SOVER} ${GL_ROOT}
+ donvidia ${libdir}/libnvidia-eglcore.so ${NV_SOVER}
+ donvidia ${libdir}/libnvidia-glcore.so ${NV_SOVER}
+ donvidia ${libdir}/libnvidia-glsi.so ${NV_SOVER}
+ donvidia ${libdir}/libnvidia-ifr.so ${NV_SOVER}
+ if use kernel_FreeBSD; then
+ donvidia ${libdir}/libnvidia-tls.so ${NV_SOVER}
+ else
+ donvidia ${libdir}/tls/libnvidia-tls.so ${NV_SOVER}
+ fi
+
+ # VDPAU
+ donvidia ${libdir}/libvdpau_nvidia.so ${NV_SOVER}
+
+ # GLES v2 libraries
+ insinto ${GL_ROOT}
+ doexe ${libdir}/libGLESv2.so.${PV}
+ dosym libGLESv2.so.${PV} ${GL_ROOT}/libGLESv2.so.2
+ dosym libGLESv2.so.2 ${GL_ROOT}/libGLESv2.so
+ fi
+
+ # NVIDIA monitoring library
+ if use kernel_linux ; then
+ donvidia ${libdir}/libnvidia-ml.so ${NV_SOVER}
+ fi
+
+ # CUDA & OpenCL
+ if use kernel_linux; then
+ donvidia ${libdir}/libcuda.so ${NV_SOVER}
+ donvidia ${libdir}/libnvidia-compiler.so ${NV_SOVER}
+ donvidia ${libdir}/libOpenCL.so 1.0.0 ${CL_ROOT}
+ donvidia ${libdir}/libnvidia-opencl.so ${NV_SOVER}
+ fi
+}
+
+pkg_preinst() {
+ if use kernel_linux; then
+ linux-mod_pkg_preinst
+
+ local videogroup="$(egetent group video | cut -d ':' -f 3)"
+ if [ -z "${videogroup}" ]; then
+ eerror "Failed to determine the video group gid"
+ die "Failed to determine the video group gid"
+ else
+ sed -i \
+ -e "s:PACKAGE:${PF}:g" \
+ -e "s:VIDEOGID:${videogroup}:" \
+ "${D}"/etc/modprobe.d/nvidia.conf || die
+ fi
+ fi
+
+ # Clean the dynamic libGL stuff's home to ensure
+ # we dont have stale libs floating around
+ if [ -d "${ROOT}"/usr/lib/opengl/nvidia ] ; then
+ rm -rf "${ROOT}"/usr/lib/opengl/nvidia/*
+ fi
+ # Make sure we nuke the old nvidia-glx's env.d file
+ if [ -e "${ROOT}"/etc/env.d/09nvidia ] ; then
+ rm -f "${ROOT}"/etc/env.d/09nvidia
+ fi
+}
+
+pkg_postinst() {
+ use kernel_linux && linux-mod_pkg_postinst
+
+ # Switch to the nvidia implementation
+ use X && "${ROOT}"/usr/bin/eselect opengl set --use-old nvidia
+ "${ROOT}"/usr/bin/eselect opencl set --use-old nvidia
+
+ readme.gentoo_print_elog
+
+ if ! use X; then
+ elog "You have elected to not install the X.org driver. Along with"
+ elog "this the OpenGL libraries and VDPAU libraries were not"
+ elog "installed. Additionally, once the driver is loaded your card"
+ elog "and fan will run at max speed which may not be desirable."
+ elog "Use the 'nvidia-smi' init script to have your card and fan"
+ elog "speed scale appropriately."
+ elog
+ fi
+ if ! use tools; then
+ elog "USE=tools controls whether the nvidia-settings application"
+ elog "is installed. If you would like to use it, enable that"
+ elog "flag and re-emerge this ebuild. Optionally you can install"
+ elog "media-video/nvidia-settings"
+ elog
+ fi
+}
+
+pkg_prerm() {
+ use X && "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
+
+pkg_postrm() {
+ use kernel_linux && linux-mod_pkg_postrm
+ use X && "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-355.06.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-355.06.ebuild
new file mode 100644
index 000000000000..8391d8443eb3
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/nvidia-drivers-355.06.ebuild
@@ -0,0 +1,498 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils flag-o-matic linux-info linux-mod multilib nvidia-driver \
+ portability toolchain-funcs unpacker user udev
+
+NV_URI="http://us.download.nvidia.com/XFree86/"
+X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
+AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
+X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
+AMD64_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86_64-${PV}"
+
+DESCRIPTION="NVIDIA Accelerated Graphics Driver"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="
+ amd64-fbsd? ( ${NV_URI}FreeBSD-x86_64/${PV}/${AMD64_FBSD_NV_PACKAGE}.tar.gz )
+ amd64? ( ${NV_URI}Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}.run )
+ x86-fbsd? ( ${NV_URI}FreeBSD-x86/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )
+ x86? ( ${NV_URI}Linux-x86/${PV}/${X86_NV_PACKAGE}.run )
+"
+
+LICENSE="GPL-2 NVIDIA-r2"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86 ~amd64-fbsd ~x86-fbsd"
+RESTRICT="bindist mirror strip"
+EMULTILIB_PKG="true"
+
+IUSE="acpi multilib kernel_FreeBSD kernel_linux pax_kernel +tools gtk2 gtk3 +X"
+REQUIRED_USE="
+ tools? ( X || ( gtk2 gtk3 ) )
+"
+
+COMMON="
+ app-eselect/eselect-opencl
+ kernel_linux? ( >=sys-libs/glibc-2.6.1 )
+ X? (
+ >=app-eselect/eselect-opengl-1.0.9
+ )
+"
+DEPEND="
+ ${COMMON}
+ app-arch/xz-utils
+ kernel_linux? ( virtual/linux-sources )
+"
+RDEPEND="
+ ${COMMON}
+ acpi? ( sys-power/acpid )
+ tools? (
+ dev-libs/atk
+ dev-libs/glib:2
+ x11-libs/gdk-pixbuf
+ gtk2? ( >=x11-libs/gtk+-2.4:2 )
+ gtk3? ( x11-libs/gtk+:3 )
+ x11-libs/libX11
+ x11-libs/libXext
+ x11-libs/pango[X]
+ )
+ X? (
+ <x11-base/xorg-server-1.17.99:=
+ >=x11-libs/libvdpau-0.3-r1
+ multilib? (
+ >=x11-libs/libX11-1.6.2[abi_x86_32]
+ >=x11-libs/libXext-1.3.2[abi_x86_32]
+ )
+ )
+"
+
+QA_PREBUILT="opt/* usr/lib*"
+
+S=${WORKDIR}/
+
+pkg_pretend() {
+ if use amd64 && has_multilib_profile && \
+ [ "${DEFAULT_ABI}" != "amd64" ]; then
+ eerror "This ebuild doesn't currently support changing your default ABI"
+ die "Unexpected \${DEFAULT_ABI} = ${DEFAULT_ABI}"
+ fi
+
+ if use kernel_linux && kernel_is ge 4 2; then
+ ewarn "Gentoo supports kernels which are supported by NVIDIA"
+ ewarn "which are limited to the following kernels:"
+ ewarn "<sys-kernel/gentoo-sources-4.2"
+ ewarn "<sys-kernel/vanilla-sources-4.2"
+ ewarn ""
+ ewarn "You are free to utilize epatch_user to provide whatever"
+ ewarn "support you feel is appropriate, but will not receive"
+ ewarn "support as a result of those changes."
+ ewarn ""
+ ewarn "Do not file a bug report about this."
+ fi
+
+ # Since Nvidia ships 3 different series of drivers, we need to give the user
+ # some kind of guidance as to what version they should install. This tries
+ # to point the user in the right direction but can't be perfect. check
+ # nvidia-driver.eclass
+ nvidia-driver-check-warning
+
+ # Kernel features/options to check for
+ CONFIG_CHECK="~ZONE_DMA ~MTRR ~SYSVIPC ~!LOCKDEP"
+ use x86 && CONFIG_CHECK+=" ~HIGHMEM"
+
+ # Now do the above checks
+ use kernel_linux && check_extra_config
+}
+
+pkg_setup() {
+ # try to turn off distcc and ccache for people that have a problem with it
+ export DISTCC_DISABLE=1
+ export CCACHE_DISABLE=1
+
+ if use kernel_linux; then
+ MODULE_NAMES="nvidia(video:${S}/kernel)"
+
+ # This needs to run after MODULE_NAMES (so that the eclass checks
+ # whether the kernel supports loadable modules) but before BUILD_PARAMS
+ # is set (so that KV_DIR is populated).
+ linux-mod_pkg_setup
+
+ BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} \
+ SYSOUT=${KV_OUT_DIR} CC=$(tc-getBUILD_CC) NV_VERBOSE=1"
+
+ # linux-mod_src_compile calls set_arch_to_kernel, which
+ # sets the ARCH to x86 but NVIDIA's wrapping Makefile
+ # expects x86_64 or i386 and then converts it to x86
+ # later on in the build process
+ BUILD_FIXES="ARCH=$(uname -m | sed -e 's/i.86/i386/')"
+ fi
+
+ # set variables to where files are in the package structure
+ if use kernel_FreeBSD; then
+ use x86-fbsd && S="${WORKDIR}/${X86_FBSD_NV_PACKAGE}"
+ use amd64-fbsd && S="${WORKDIR}/${AMD64_FBSD_NV_PACKAGE}"
+ NV_DOC="${S}/doc"
+ NV_OBJ="${S}/obj"
+ NV_SRC="${S}/src"
+ NV_MAN="${S}/x11/man"
+ NV_X11="${S}/obj"
+ NV_SOVER=1
+ elif use kernel_linux; then
+ NV_DOC="${S}"
+ NV_OBJ="${S}"
+ NV_SRC="${S}/kernel"
+ NV_MAN="${S}"
+ NV_X11="${S}"
+ NV_SOVER=${PV}
+ else
+ die "Could not determine proper NVIDIA package"
+ fi
+}
+
+src_prepare() {
+ # Please add a brief description for every added patch
+
+ if use kernel_linux; then
+ if kernel_is lt 2 6 9; then
+ eerror "You must build this against 2.6.9 or higher kernels."
+ fi
+
+ # If greater than 2.6.5 use M= instead of SUBDIR=
+# convert_to_m "${NV_SRC}"/Makefile.kbuild
+ fi
+
+ if use pax_kernel; then
+ ewarn "Using PAX patches is not supported. You will be asked to"
+ ewarn "use a standard kernel should you have issues. Should you"
+ ewarn "need support with these patches, contact the PaX team."
+ epatch "${FILESDIR}"/${PN}-346.16-pax-usercopy.patch
+ epatch "${FILESDIR}"/${PN}-346.16-pax-constify.patch
+ fi
+
+ # Allow user patches so they can support RC kernels and whatever else
+ epatch_user
+}
+
+src_compile() {
+ # This is already the default on Linux, as there's no toplevel Makefile, but
+ # on FreeBSD there's one and triggers the kernel module build, as we install
+ # it by itself, pass this.
+
+ cd "${NV_SRC}"
+ if use kernel_FreeBSD; then
+ MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
+ LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
+ elif use kernel_linux; then
+ MAKEOPTS=-j1
+ linux-mod_src_compile
+ fi
+}
+
+# Install nvidia library:
+# the first parameter is the library to install
+# the second parameter is the provided soversion
+# the third parameter is the target directory if it is not /usr/lib
+donvidia() {
+ # Full path to library minus SOVER
+ MY_LIB="$1"
+
+ # SOVER to use
+ MY_SOVER="$2"
+
+ # Where to install
+ MY_DEST="$3"
+
+ if [[ -z "${MY_DEST}" ]]; then
+ MY_DEST="/usr/$(get_libdir)"
+ action="dolib.so"
+ else
+ exeinto ${MY_DEST}
+ action="doexe"
+ fi
+
+ # Get just the library name
+ libname=$(basename $1)
+
+ # Install the library with the correct SOVER
+ ${action} ${MY_LIB}.${MY_SOVER} || \
+ die "failed to install ${libname}"
+
+ # If SOVER wasn't 1, then we need to create a .1 symlink
+ if [[ "${MY_SOVER}" != "1" ]]; then
+ dosym ${libname}.${MY_SOVER} \
+ ${MY_DEST}/${libname}.1 || \
+ die "failed to create ${libname} symlink"
+ fi
+
+ # Always create the symlink from the raw lib to the .1
+ dosym ${libname}.1 \
+ ${MY_DEST}/${libname} || \
+ die "failed to create ${libname} symlink"
+}
+
+src_install() {
+ if use kernel_linux; then
+ linux-mod_src_install
+
+ # Add the aliases
+ # This file is tweaked with the appropriate video group in
+ # pkg_preinst, see bug #491414
+ insinto /etc/modprobe.d
+ newins "${FILESDIR}"/nvidia-169.07 nvidia.conf
+
+ # Ensures that our device nodes are created when not using X
+ exeinto "$(get_udevdir)"
+ doexe "${FILESDIR}"/nvidia-udev.sh
+ udev_newrules "${FILESDIR}"/nvidia.udev-rule 99-nvidia.rules
+ elif use kernel_FreeBSD; then
+ if use x86-fbsd; then
+ insinto /boot/modules
+ doins "${S}/src/nvidia.kld"
+ fi
+
+ exeinto /boot/modules
+ doexe "${S}/src/nvidia.ko"
+ fi
+
+ # NVIDIA kernel <-> userspace driver config lib
+ donvidia ${NV_OBJ}/libnvidia-cfg.so ${NV_SOVER}
+
+ # NVIDIA framebuffer capture library
+ donvidia ${NV_OBJ}/libnvidia-fbc.so ${NV_SOVER}
+
+ # NVIDIA video encode/decode <-> CUDA
+ if use kernel_linux; then
+ donvidia ${NV_OBJ}/libnvcuvid.so ${NV_SOVER}
+ donvidia ${NV_OBJ}/libnvidia-encode.so ${NV_SOVER}
+ fi
+
+ if use X; then
+ # Xorg DDX driver
+ insinto /usr/$(get_libdir)/xorg/modules/drivers
+ doins ${NV_X11}/nvidia_drv.so
+
+ # Xorg GLX driver
+ donvidia ${NV_X11}/libglx.so ${NV_SOVER} \
+ /usr/$(get_libdir)/opengl/nvidia/extensions
+
+ # Xorg nvidia.conf
+ if has_version '>=x11-base/xorg-server-1.16'; then
+ insinto /usr/share/X11/xorg.conf.d
+ newins {,50-}nvidia-drm-outputclass.conf
+ fi
+ fi
+
+ # OpenCL ICD for NVIDIA
+ if use kernel_linux; then
+ insinto /etc/OpenCL/vendors
+ doins ${NV_OBJ}/nvidia.icd
+ fi
+
+ # Documentation
+ dohtml ${NV_DOC}/html/*
+ if use kernel_FreeBSD; then
+ dodoc "${NV_DOC}/README"
+ use X && doman "${NV_MAN}/nvidia-xconfig.1"
+ use tools && doman "${NV_MAN}/nvidia-settings.1"
+ else
+ # Docs
+ newdoc "${NV_DOC}/README.txt" README
+ dodoc "${NV_DOC}/NVIDIA_Changelog"
+ doman "${NV_MAN}/nvidia-smi.1.gz"
+ use X && doman "${NV_MAN}/nvidia-xconfig.1.gz"
+ use tools && doman "${NV_MAN}/nvidia-settings.1.gz"
+ doman "${NV_MAN}/nvidia-cuda-mps-control.1.gz"
+ fi
+
+ # Helper Apps
+ exeinto /opt/bin/
+
+ if use X; then
+ doexe ${NV_OBJ}/nvidia-xconfig
+ fi
+
+ if use kernel_linux; then
+ doexe ${NV_OBJ}/nvidia-cuda-mps-control
+ doexe ${NV_OBJ}/nvidia-cuda-mps-server
+ doexe ${NV_OBJ}/nvidia-debugdump
+ doexe ${NV_OBJ}/nvidia-persistenced
+ doexe ${NV_OBJ}/nvidia-smi
+
+ # install nvidia-modprobe setuid and symlink in /usr/bin (bug #505092)
+ doexe ${NV_OBJ}/nvidia-modprobe
+ fowners root:video /opt/bin/nvidia-modprobe
+ fperms 4710 /opt/bin/nvidia-modprobe
+ dosym /{opt,usr}/bin/nvidia-modprobe
+
+ doman nvidia-cuda-mps-control.1.gz
+ doman nvidia-modprobe.1.gz
+ doman nvidia-persistenced.1.gz
+ newinitd "${FILESDIR}/nvidia-smi.init" nvidia-smi
+ newconfd "${FILESDIR}/nvidia-persistenced.conf" nvidia-persistenced
+ newinitd "${FILESDIR}/nvidia-persistenced.init" nvidia-persistenced
+ fi
+
+ if use tools; then
+ doexe ${NV_OBJ}/nvidia-settings
+ use gtk2 && donvidia libnvidia-gtk2.so ${PV}
+ use gtk3 && donvidia libnvidia-gtk3.so ${PV}
+ insinto /usr/share/nvidia/
+ doins nvidia-application-profiles-${PV}-key-documentation
+ insinto /etc/nvidia
+ newins nvidia-application-profiles-${PV}-rc nvidia-application-profiles-rc
+ fi
+
+ dobin ${NV_OBJ}/nvidia-bug-report.sh
+
+ # Desktop entries for nvidia-settings
+ if use tools; then
+ # There is no icon in the FreeBSD tarball.
+ use kernel_FreeBSD || newicon ${NV_OBJ}/nvidia-settings.png ${PN}-settings.png
+ domenu "${FILESDIR}"/${PN}-settings.desktop
+ exeinto /etc/X11/xinit/xinitrc.d
+ doexe "${FILESDIR}"/95-nvidia-settings
+ fi
+
+ #doenvd "${FILESDIR}"/50nvidia-prelink-blacklist
+
+ if has_multilib_profile && use multilib; then
+ local OABI=${ABI}
+ for ABI in $(get_install_abis); do
+ src_install-libs
+ done
+ ABI=${OABI}
+ unset OABI
+ else
+ src_install-libs
+ fi
+
+ is_final_abi || die "failed to iterate through all ABIs"
+
+ readme.gentoo_create_doc
+}
+
+src_install-libs() {
+ local inslibdir=$(get_libdir)
+ local GL_ROOT="/usr/$(get_libdir)/opengl/nvidia/lib"
+ local CL_ROOT="/usr/$(get_libdir)/OpenCL/vendors/nvidia"
+ local libdir=${NV_OBJ}
+
+ if use kernel_linux && has_multilib_profile && [[ ${ABI} == "x86" ]]; then
+ libdir=${NV_OBJ}/32
+ fi
+
+ if use X; then
+ NV_GLX_LIBRARIES=(
+ "libEGL.so 1 ${GL_ROOT}"
+ "libEGL_nvidia.so 0 ${GL_ROOT}"
+ "libGL.so ${NV_SOVER} ${GL_ROOT}"
+ "libGLESv1_CM.so ${NV_SOVER} ${GL_ROOT}"
+ "libGLdispatch.so 0 ${GL_ROOT}"
+ "libOpenCL.so 1.0.0 ${GL_ROOT}"
+ "libOpenGL.so 0 ${GL_ROOT}"
+ "libcuda.so ${NV_SOVER}"
+ "libnvcuvid.so ${NV_SOVER}"
+ "libnvidia-compiler.so ${NV_SOVER}"
+ "libnvidia-eglcore.so ${NV_SOVER}"
+ "libnvidia-encode.so ${NV_SOVER}"
+ "libnvidia-fbc.so ${NV_SOVER}"
+ "libnvidia-glcore.so ${NV_SOVER}"
+ "libnvidia-glsi.so ${NV_SOVER}"
+ "libnvidia-ifr.so ${NV_SOVER}"
+ "libnvidia-opencl.so ${NV_SOVER}"
+ "libvdpau.so ${NV_SOVER} ${GL_ROOT}"
+ "libvdpau_nvidia.so ${NV_SOVER}"
+ "libvdpau_trace.so ${NV_SOVER} ${GL_ROOT}"
+ )
+ if use kernel_linux && has_multilib_profile && [[ ${ABI} == "amd64" ]];
+ then
+ NV_GLX_LIBRARIES+=( "libnvidia-wfb.so ${NV_SOVER}" )
+ fi
+
+ if use kernel_FreeBSD; then
+ NV_GLX_LIBRARIES+=( "libnvidia-tls.so ${NV_SOVER}" )
+ fi
+
+ if use kernel_linux; then
+ NV_GLX_LIBRARIES+=(
+ "libnvidia-ml.so ${NV_SOVER}"
+ "tls/libnvidia-tls.so ${NV_SOVER}"
+ )
+ fi
+
+ for NV_LIB in "${NV_GLX_LIBRARIES[@]}"; do
+ donvidia ${libdir}/${NV_LIB}
+ done
+
+ # GLES v2 library is special
+ insinto ${GL_ROOT}
+ doexe ${libdir}/libGLESv2.so.${PV}
+ dosym libGLESv2.so.${PV} ${GL_ROOT}/libGLESv2.so.2
+ dosym libGLESv2.so.2 ${GL_ROOT}/libGLESv2.so
+ fi
+}
+
+pkg_preinst() {
+ if use kernel_linux; then
+ linux-mod_pkg_preinst
+
+ local videogroup="$(egetent group video | cut -d ':' -f 3)"
+ if [ -z "${videogroup}" ]; then
+ eerror "Failed to determine the video group gid"
+ die "Failed to determine the video group gid"
+ else
+ sed -i \
+ -e "s:PACKAGE:${PF}:g" \
+ -e "s:VIDEOGID:${videogroup}:" \
+ "${D}"/etc/modprobe.d/nvidia.conf || die
+ fi
+ fi
+
+ # Clean the dynamic libGL stuff's home to ensure
+ # we dont have stale libs floating around
+ if [ -d "${ROOT}"/usr/lib/opengl/nvidia ]; then
+ rm -rf "${ROOT}"/usr/lib/opengl/nvidia/*
+ fi
+ # Make sure we nuke the old nvidia-glx's env.d file
+ if [ -e "${ROOT}"/etc/env.d/09nvidia ]; then
+ rm -f "${ROOT}"/etc/env.d/09nvidia
+ fi
+}
+
+pkg_postinst() {
+ use kernel_linux && linux-mod_pkg_postinst
+
+ # Switch to the nvidia implementation
+ use X && "${ROOT}"/usr/bin/eselect opengl set --use-old nvidia
+ "${ROOT}"/usr/bin/eselect opencl set --use-old nvidia
+
+ readme.gentoo_print_elog
+
+ if ! use X; then
+ elog "You have elected to not install the X.org driver. Along with"
+ elog "this the OpenGL libraries and VDPAU libraries were not"
+ elog "installed. Additionally, once the driver is loaded your card"
+ elog "and fan will run at max speed which may not be desirable."
+ elog "Use the 'nvidia-smi' init script to have your card and fan"
+ elog "speed scale appropriately."
+ elog
+ fi
+ if ! use tools; then
+ elog "USE=tools controls whether the nvidia-settings application"
+ elog "is installed. If you would like to use it, enable that"
+ elog "flag and re-emerge this ebuild. Optionally you can install"
+ elog "media-video/nvidia-settings"
+ elog
+ fi
+}
+
+pkg_prerm() {
+ use X && "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
+
+pkg_postrm() {
+ use kernel_linux && linux-mod_pkg_postrm
+ use X && "${ROOT}"/usr/bin/eselect opengl set --use-old xorg-x11
+}
diff --git a/x11-drivers/nvidia-drivers/nvidia-drivers-96.43.23.ebuild b/x11-drivers/nvidia-drivers/nvidia-drivers-96.43.23.ebuild
new file mode 100644
index 000000000000..33db0dc47a26
--- /dev/null
+++ b/x11-drivers/nvidia-drivers/nvidia-drivers-96.43.23.ebuild
@@ -0,0 +1,519 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit eutils flag-o-matic linux-mod multilib nvidia-driver portability unpacker user versionator
+
+X86_NV_PACKAGE="NVIDIA-Linux-x86-${PV}"
+AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${PV}"
+X86_FBSD_NV_PACKAGE="NVIDIA-FreeBSD-x86-${PV}"
+
+DESCRIPTION="NVIDIA Accelerated Graphics Driver"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="x86? ( http://us.download.nvidia.com/XFree86/Linux-x86/${PV}/${X86_NV_PACKAGE}-pkg0.run )
+ amd64? ( http://us.download.nvidia.com/XFree86/Linux-x86_64/${PV}/${AMD64_NV_PACKAGE}-pkg2.run )
+ x86-fbsd? ( http://us.download.nvidia.com/freebsd/${PV}/${X86_FBSD_NV_PACKAGE}.tar.gz )"
+
+LICENSE="GPL-2 NVIDIA-r1"
+SLOT="0"
+KEYWORDS="-* amd64 x86 ~x86-fbsd"
+IUSE="acpi custom-cflags gtk multilib kernel_linux"
+RESTRICT="bindist mirror strip"
+EMULTILIB_PKG="true"
+
+COMMON="
+ kernel_linux? ( >=sys-libs/glibc-2.6.1 )
+ >=app-eselect/eselect-opengl-1.0.9
+"
+DEPEND="${COMMON}
+ kernel_linux? ( virtual/linux-sources )
+"
+RDEPEND="${COMMON}
+ <x11-base/xorg-server-1.12.99:=
+ acpi? ( sys-power/acpid )
+ gtk? (
+ !media-video/nvidia-settings
+ dev-libs/atk
+ dev-libs/glib:2
+ x11-libs/gdk-pixbuf
+ x11-libs/gtk+:2
+ x11-libs/libX11
+ x11-libs/libXext
+ x11-libs/pango[X]
+ x11-libs/pangox-compat
+ )
+ multilib? (
+ >=x11-libs/libX11-1.6.2[abi_x86_32]
+ >=x11-libs/libXext-1.3.2[abi_x86_32]
+ )
+"
+
+QA_TEXTRELS_x86="
+ usr/lib/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+ usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+ usr/lib/opengl/nvidia/lib/libGLcore.so.${PV}
+ usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+ usr/lib/xorg/modules/drivers/nvidia_drv.so
+ usr/lib/libcuda.so.${PV}
+ usr/lib/libnvidia-cfg.so.${PV}
+ usr/lib/libvdpau_nvidia.so.${PV}
+ usr/lib/libXvMCNVIDIA.so.${PV}
+"
+
+QA_TEXTRELS_x86_fbsd="
+ boot/modules/nvidia.ko
+ usr/lib/opengl/nvidia/lib/libGL.so.1
+ usr/lib/opengl/nvidia/lib/libGLcore.so.1
+ usr/lib/libnvidia-cfg.so.1
+ usr/lib/opengl/nvidia/extensions/libglx.so.1
+ usr/lib/xorg/modules/drivers/nvidia_drv.so
+"
+
+QA_TEXTRELS_amd64="
+ usr/lib32/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+ usr/lib32/opengl/nvidia/lib/libGLcore.so.${PV}
+ usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+ usr/lib32/libcuda.so.${PV}
+ usr/lib32/libvdpau_nvidia.so.${PV}
+"
+
+QA_EXECSTACK_x86="
+ usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+ usr/lib/opengl/nvidia/lib/libGLcore.so.${PV}
+ usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+ usr/lib/xorg/modules/drivers/nvidia_drv.so
+ usr/lib/libXvMCNVIDIA.a:NVXVMC.o
+"
+
+QA_EXECSTACK_amd64="
+ usr/lib32/opengl/nvidia/lib/libGLcore.so.${PV}
+ usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+ usr/lib64/libnvcompiler.so.${PV}
+ usr/lib64/libXvMCNVIDIA.so.${PV}
+ usr/lib64/libXvMCNVIDIA.a:NVXVMC.o
+ usr/lib64/libnvidia-cfg.so.${PV}
+ usr/lib64/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+ usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
+ usr/lib64/opengl/nvidia/lib/libGLcore.so.${PV}
+ usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}
+ usr/lib64/xorg/modules/drivers/nvidia_drv.so
+ usr/bin/nvidia-settings
+ usr/bin/nvidia-smi
+ usr/bin/nvidia-xconfig
+"
+
+QA_WX_LOAD_x86="
+ usr/lib/opengl/nvidia/lib/libGLcore.so.${PV}
+ usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+ usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+ usr/lib/libXvMCNVIDIA.a
+"
+
+QA_WX_LOAD_amd64="
+ usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+ usr/lib32/opengl/nvidia/lib/libGLcore.so.${PV}
+ usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
+ usr/lib64/opengl/nvidia/lib/libGLcore.so.${PV}
+ usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}
+"
+
+QA_SONAME_amd64="
+ usr/lib64/libnvcompiler.so.${PV}
+"
+
+QA_FLAGS_IGNORED_amd64="
+ usr/lib32/libcuda.so.${PV}
+ usr/lib32/opengl/nvidia/lib/libGL.so.${PV}
+ usr/lib32/opengl/nvidia/lib/libGLcore.so.${PV}
+ usr/lib32/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+ usr/lib32/libvdpau_nvidia.so.${PV}
+ usr/lib64/libXvMCNVIDIA.so.${PV}
+ usr/lib64/libcuda.so.${PV}
+ usr/lib64/libnvidia-cfg.so.${PV}
+ usr/lib64/opengl/nvidia/lib/libGLcore.so.${PV}
+ usr/lib64/opengl/nvidia/lib/libGL.so.${PV}
+ usr/lib64/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+ usr/lib64/opengl/nvidia/extensions/libglx.so.${PV}
+ usr/lib64/xorg/modules/drivers/nvidia_drv.so
+ usr/lib64/libvdpau_nvidia.so.${PV}
+ usr/bin/nvidia-settings
+ usr/bin/nvidia-smi
+ usr/bin/nvidia-xconfig
+"
+
+QA_FLAGS_IGNORED_x86="
+ usr/lib/libcuda.so.${PV}
+ usr/lib/libnvidia-cfg.so.${PV}
+ usr/lib/opengl/nvidia/lib/libGLcore.so.${PV}
+ usr/lib/opengl/nvidia/lib/libGL.so.${PV}
+ usr/lib/opengl/nvidia/lib/libnvidia-tls.so.${PV}
+ usr/lib/opengl/nvidia/extensions/libglx.so.${PV}
+ usr/lib/xorg/modules/drivers/nvidia_drv.so
+ usr/lib/libXvMCNVIDIA.so.${PV}
+ usr/lib/libvdpau_nvidia.so.${PV}
+ usr/bin/nvidia-settings
+ usr/bin/nvidia-smi
+ usr/bin/nvidia-xconfig
+"
+
+S="${WORKDIR}/"
+
+mtrr_check() {
+ ebegin "Checking for MTRR support"
+ linux_chkconfig_present MTRR
+ eend $?
+
+ if [[ $? -ne 0 ]] ; then
+ eerror "Please enable MTRR support in your kernel config, found at:"
+ eerror
+ eerror " Processor type and features"
+ eerror " [*] MTRR (Memory Type Range Register) support"
+ eerror
+ eerror "and recompile your kernel ..."
+ die "MTRR support not detected!"
+ fi
+}
+
+lockdep_check() {
+ if linux_chkconfig_present LOCKDEP; then
+ eerror "You've enabled LOCKDEP -- lock tracking -- in the kernel."
+ eerror "Unfortunately, this option exports the symbol 'lockdep_init_map' as GPL-only"
+ eerror "which will prevent ${P} from compiling."
+ eerror "Please make sure the following options have been unset:"
+ eerror " Kernel hacking --->"
+ eerror " [ ] Lock debugging: detect incorrect freeing of live locks"
+ eerror " [ ] Lock debugging: prove locking correctness"
+ eerror " [ ] Lock usage statistics"
+ eerror "in 'menuconfig'"
+ die "LOCKDEP enabled"
+ fi
+}
+
+pkg_setup() {
+ # try to turn off distcc and ccache for people that have a problem with it
+ export DISTCC_DISABLE=1
+ export CCACHE_DISABLE=1
+
+ if use amd64 && has_multilib_profile && [ "${DEFAULT_ABI}" != "amd64" ]; then
+ eerror "This ebuild doesn't currently support changing your default abi."
+ die "Unexpected \${DEFAULT_ABI} = ${DEFAULT_ABI}"
+ fi
+
+ if use kernel_linux; then
+ linux-mod_pkg_setup
+ MODULE_NAMES="nvidia(video:${S}/usr/src/nv)"
+ BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} \
+ SYSOUT=${KV_OUT_DIR} CC=$(tc-getBUILD_CC)"
+ mtrr_check
+ lockdep_check
+ fi
+
+ # On BSD userland it wants real make command
+ use userland_BSD && MAKE="$(get_bmake)"
+
+ export _POSIX2_VERSION="199209"
+
+ if use kernel_linux && kernel_is ge 3 7 ; then
+ ewarn "Gentoo supports kernels which are supported by NVIDIA"
+ ewarn "which are limited to the following kernels:"
+ ewarn "<sys-kernel/gentoo-sources-3.7"
+ ewarn "<sys-kernel/vanilla-sources-3.7"
+ ewarn ""
+ ewarn "You are free to utilize epatch_user to provide whatever"
+ ewarn "support you feel is appropriate, but will not receive"
+ ewarn "support as a result of those changes."
+ ewarn ""
+ ewarn "Do not file a bug report about this."
+ fi
+
+ # Since Nvidia ships 3 different series of drivers, we need to give the user
+ # some kind of guidance as to what version they should install. This tries
+ # to point the user in the right direction but can't be perfect. check
+ # nvidia-driver.eclass
+ nvidia-driver-check-warning
+
+ # set variables to where files are in the package structure
+ if use kernel_FreeBSD; then
+ use x86-fbsd && S="${WORKDIR}/${X86_FBSD_NV_PACKAGE}"
+ NV_DOC="${S}/doc"
+ NV_EXEC="${S}/obj"
+ NV_LIB="${S}/obj"
+ NV_SRC="${S}/src"
+ NV_MAN="${S}/x11/man"
+ NV_X11="${S}/obj"
+ NV_X11_DRV="${NV_X11}"
+ NV_X11_EXT="${NV_X11}"
+ NV_SOVER=1
+ elif use kernel_linux; then
+ NV_DOC="${S}/usr/share/doc"
+ NV_EXEC="${S}/usr/bin"
+ NV_LIB="${S}/usr/lib"
+ NV_SRC="${S}/usr/src/nv"
+ NV_MAN="${S}/usr/share/man/man1"
+ NV_X11="${S}/usr/X11R6/lib"
+ NV_X11_DRV="${NV_X11}/modules/drivers"
+ NV_X11_EXT="${NV_X11}/modules/extensions"
+ NV_SOVER=${PV}
+ else
+ die "Could not determine proper NVIDIA package"
+ fi
+}
+
+src_unpack() {
+ if use kernel_linux && kernel_is lt 2 6 7; then
+ echo
+ ewarn "Your kernel version is ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}"
+ ewarn "This is not officially supported for ${P}. It is likely you"
+ ewarn "will not be able to compile or use the kernel module."
+ ewarn "It is recommended that you upgrade your kernel to a version >= 2.6.7"
+ echo
+ ewarn "DO NOT file bug reports for kernel versions less than 2.6.7 as they will be ignored."
+ fi
+
+ if ! use x86-fbsd; then
+ mkdir "${S}"
+ cd "${S}"
+ unpack_makeself
+ else
+ unpack ${A}
+ fi
+}
+
+src_prepare() {
+ # Please add a brief description for every added patch
+ use x86-fbsd && cd doc
+
+ # Use the correct defines to make gtkglext build work
+ epatch "${FILESDIR}"/NVIDIA_glx-defines.patch
+ # Use some more sensible gl headers and make way for new glext.h
+ epatch "${FILESDIR}"/NVIDIA_glx-glheader.patch
+
+ if use kernel_linux; then
+ # Quiet down warnings the user does not need to see
+ sed -i \
+ -e 's:-Wpointer-arith::g' \
+ -e 's:-Wsign-compare::g' \
+ "${NV_SRC}"/Makefile.kbuild
+
+ # If you set this then it's your own fault when stuff breaks :)
+ use custom-cflags && sed -i "s:-O:${CFLAGS}:" "${NV_SRC}"/Makefile.*
+
+ # If greater than 2.6.5 use M= instead of SUBDIR=
+ convert_to_m "${NV_SRC}"/Makefile.kbuild
+ fi
+}
+
+src_compile() {
+ # This is already the default on Linux, as there's no toplevel Makefile, but
+ # on FreeBSD there's one and triggers the kernel module build, as we install
+ # it by itself, pass this.
+
+ cd "${NV_SRC}"
+ if use x86-fbsd; then
+ MAKE="$(get_bmake)" CFLAGS="-Wno-sign-compare" emake CC="$(tc-getCC)" \
+ LD="$(tc-getLD)" LDFLAGS="$(raw-ldflags)" || die
+ elif use kernel_linux; then
+ BUILD_PARAMS+=" PATCHLEVEL=not4"
+ linux-mod_src_compile
+ fi
+}
+
+src_install() {
+ if use kernel_linux; then
+ linux-mod_src_install
+
+ VIDEOGROUP="$(egetent group video | cut -d ':' -f 3)"
+ if [ -z "$VIDEOGROUP" ]; then
+ eerror "Failed to determine the video group gid."
+ die "Failed to determine the video group gid."
+ fi
+
+ # Add the aliases
+ sed -e 's:PACKAGE:'${PF}':g' \
+ -e 's:VIDEOGID:'${VIDEOGROUP}':' "${FILESDIR}"/nvidia-169.07 > \
+ "${WORKDIR}"/nvidia || die
+ insinto /etc/modprobe.d
+ newins "${WORKDIR}"/nvidia nvidia.conf
+ elif use x86-fbsd; then
+ insinto /boot/modules
+ doins "${WORKDIR}/${NV_PACKAGE}/src/nvidia.kld"
+
+ exeinto /boot/modules
+ doexe "${WORKDIR}/${NV_PACKAGE}/src/nvidia.ko"
+ fi
+
+ # NVIDIA kernel <-> userspace driver config lib
+ dolib.so ${NV_LIB}/libnvidia-cfg.so.${NV_SOVER}
+
+ # Xorg DDX driver
+ insinto /usr/$(get_libdir)/xorg/modules/drivers
+ doins ${NV_X11_DRV}/nvidia_drv.so
+
+ # Xorg GLX driver
+ insinto /usr/$(get_libdir)/opengl/nvidia/extensions
+ doins ${NV_X11_EXT}/libglx.so.${NV_SOVER}
+ dosym /usr/$(get_libdir)/opengl/nvidia/extensions/libglx.so.${NV_SOVER} \
+ /usr/$(get_libdir)/opengl/nvidia/extensions/libglx.so
+
+ # XvMC driver
+ dolib.a ${NV_X11}/libXvMCNVIDIA.a
+ dolib.so ${NV_X11}/libXvMCNVIDIA.so.${NV_SOVER}
+ dosym libXvMCNVIDIA.so.${NV_SOVER} /usr/$(get_libdir)/libXvMCNVIDIA.so
+
+ # CUDA headers (driver to come)
+ if [[ -d ${S}/usr/include/cuda ]]; then
+ dodir /usr/include/cuda
+ insinto /usr/include/cuda
+ doins usr/include/cuda/*.h
+ fi
+
+ # OpenCL headers (driver to come)
+ if [[ -d ${S}/usr/include/CL ]]; then
+ dodir /usr/include/CL
+ insinto /usr/include/CL
+ doins usr/include/CL/*.h
+ fi
+
+ # Documentation
+ dodoc ${NV_DOC}/XF86Config.sample
+ dohtml ${NV_DOC}/html/*
+ if use x86-fbsd; then
+ dodoc "${NV_DOC}/README"
+ doman "${NV_MAN}/nvidia-xconfig.1"
+ else
+ # Docs
+ newdoc "${NV_DOC}/README.txt" README
+ dodoc "${NV_DOC}/NVIDIA_Changelog"
+# doman "${NV_MAN}/nvidia-smi.1.gz"
+ doman "${NV_MAN}/nvidia-xconfig.1.gz"
+ fi
+
+ # Helper Apps
+ dobin ${NV_EXEC}/nvidia-xconfig
+ dobin ${NV_EXEC}/nvidia-bug-report.sh
+ if use gtk; then
+ dobin usr/bin/nvidia-settings
+ fi
+# if use kernel_linux; then
+# dobin ${NV_EXEC}/nvidia-smi || die
+# fi
+
+ if has_multilib_profile ; then
+ local OABI=${ABI}
+ for ABI in $(get_install_abis) ; do
+ src_install-libs
+ done
+ ABI=${OABI}
+ unset OABI
+ else
+ src_install-libs
+ fi
+
+ is_final_abi || die "failed to iterate through all ABIs"
+
+ readme.gentoo_create_doc
+}
+
+# Install nvidia library:
+# the first parameter is the place where to install it
+# the second parameter is the base name of the library
+# the third parameter is the provided soversion
+donvidia() {
+ dodir $1
+ exeinto $1
+
+ libname=$(basename $2)
+
+ doexe $2.$3
+ dosym ${libname}.$3 $1/${libname}
+ [[ $3 != "1" ]] && dosym ${libname}.$3 $1/${libname}.1
+}
+
+src_install-libs() {
+ local inslibdir=$(get_libdir)
+ local NV_ROOT="/usr/${inslibdir}/opengl/nvidia"
+ local libdir= sover=
+
+ if use kernel_linux; then
+ if has_multilib_profile && [[ ${ABI} == "x86" ]] ; then
+ libdir=usr/lib32
+ else
+ libdir=usr/lib
+ fi
+ sover=${PV}
+ else
+ libdir=obj
+ # on FreeBSD it has just .1 suffix
+ sover=1
+ fi
+
+ # The GLX libraries
+ donvidia ${NV_ROOT}/lib ${libdir}/libGL.so ${sover}
+ donvidia ${NV_ROOT}/lib ${libdir}/libGLcore.so ${sover}
+ if use x86-fbsd; then
+ donvidia ${NV_ROOT}/lib ${libdir}/libnvidia-tls.so ${sover}
+ else
+ donvidia ${NV_ROOT}/lib ${libdir}/tls/libnvidia-tls.so ${sover}
+ fi
+
+ #cuda
+ if [[ -f ${libdir}/libcuda.so.${sover} ]]; then
+ dolib.so ${libdir}/libcuda.so.${sover}
+ [[ "${sover}" != "1" ]] && dosym libcuda.so.${sover} /usr/${inslibdir}/libcuda.so.1
+ dosym libcuda.so.1 /usr/${inslibdir}/libcuda.so
+ fi
+
+ #vdpau
+ if [[ -f ${libdir}/libvdpau_nvidia.so.${sover} ]]; then
+ dolib.so ${libdir}/libvdpau_nvidia.so.${sover}
+ dosym libvdpau_nvidia.so.${sover} /usr/${inslibdir}/libvdpau_nvidia.so
+ fi
+
+ # OpenCL
+ # NOTE: This isn't currently available in the publicly released drivers.
+ if [[ -f ${libdir}/libOpenCL.so.1.0.0 ]]; then
+
+ dolib.so ${libdir}/libnvcompiler.so.${sover}
+ [[ "${sover}" != "1" ]] && dosym libnvcompiler.so.${sover} /usr/${inslibdir}/libnvcompiler.so.1
+ dosym libnvcompiler.so.1 /usr/${inslibdir}/libnvcompiler.so
+
+ dolib.so ${libdir}/libOpenCL.so.1.0.0
+ dosym libOpenCL.so.1.0.0 /usr/${inslibdir}/libOpenCL.so.1
+ dosym libOpenCL.so.1 /usr/${inslibdir}/libOpenCL.so
+ fi
+}
+
+pkg_preinst() {
+ if use kernel_linux; then
+ linux-mod_pkg_postinst
+ fi
+
+ # Clean the dynamic libGL stuff's home to ensure
+ # we dont have stale libs floating around
+ if [ -d "${ROOT}"/usr/lib/opengl/nvidia ] ; then
+ rm -rf "${ROOT}"/usr/lib/opengl/nvidia/*
+ fi
+ # Make sure we nuke the old nvidia-glx's env.d file
+ if [ -e "${ROOT}"/etc/env.d/09nvidia ] ; then
+ rm -f "${ROOT}"/etc/env.d/09nvidia
+ fi
+}
+
+pkg_postinst() {
+ if use kernel_linux; then
+ linux-mod_pkg_postinst
+ fi
+
+ # Switch to the nvidia implementation
+ eselect opengl set --use-old nvidia
+
+ readme.gentoo_print_elog
+}
+
+pkg_postrm() {
+ if use kernel_linux; then
+ linux-mod_pkg_postrm
+ fi
+ eselect opengl set --use-old xorg-x11
+}