summaryrefslogtreecommitdiff
path: root/sys-freebsd/freebsd-lib
diff options
context:
space:
mode:
Diffstat (limited to 'sys-freebsd/freebsd-lib')
-rw-r--r--sys-freebsd/freebsd-lib/Manifest77
-rw-r--r--sys-freebsd/freebsd-lib/files/bootpd.confd7
-rw-r--r--sys-freebsd/freebsd-lib/files/bootpd.initd27
-rw-r--r--sys-freebsd/freebsd-lib/files/freebsd-lib-10.0-atfcxx.patch49
-rw-r--r--sys-freebsd/freebsd-lib/files/freebsd-lib-10.0-liblink.patch98
-rw-r--r--sys-freebsd/freebsd-lib/files/freebsd-lib-10.0-libproc-libcxx.patch16
-rw-r--r--sys-freebsd/freebsd-lib/files/freebsd-lib-10.2-bsdxml2expat.patch39
-rw-r--r--sys-freebsd/freebsd-lib/files/freebsd-lib-10.2-liblink.patch26
-rw-r--r--sys-freebsd/freebsd-lib/files/freebsd-lib-10.3-libusb.patch13
-rw-r--r--sys-freebsd/freebsd-lib/files/freebsd-lib-11.0-bsdxml2expat.patch39
-rw-r--r--sys-freebsd/freebsd-lib/files/freebsd-lib-11.0-libproc-libcxx.patch13
-rw-r--r--sys-freebsd/freebsd-lib/files/freebsd-lib-11.0-libsysdecode.patch22
-rw-r--r--sys-freebsd/freebsd-lib/files/freebsd-lib-11.0-workaround.patch12
-rw-r--r--sys-freebsd/freebsd-lib/files/freebsd-lib-11.1-liblink.patch142
-rw-r--r--sys-freebsd/freebsd-lib/files/freebsd-lib-6.0-flex-2.5.31.patch13
-rw-r--r--sys-freebsd/freebsd-lib/files/freebsd-lib-6.0-gccfloat.patch16
-rw-r--r--sys-freebsd/freebsd-lib/files/freebsd-lib-6.0-pmc.patch13
-rw-r--r--sys-freebsd/freebsd-lib/files/freebsd-lib-6.1-csu.patch20
-rw-r--r--sys-freebsd/freebsd-lib/files/freebsd-lib-6.2-bluetooth.patch11
-rw-r--r--sys-freebsd/freebsd-lib/files/freebsd-lib-7.1-types.h-fix.patch15
-rw-r--r--sys-freebsd/freebsd-lib/files/freebsd-lib-8.0-gcc45.patch28
-rw-r--r--sys-freebsd/freebsd-lib/files/freebsd-lib-8.0-log2.patch21
-rw-r--r--sys-freebsd/freebsd-lib/files/freebsd-lib-8.0-rpcsec_gss.patch12
-rw-r--r--sys-freebsd/freebsd-lib/files/freebsd-lib-8.2-liblink.patch19
-rw-r--r--sys-freebsd/freebsd-lib/files/freebsd-lib-8.2-nlm_syscall.patch10
-rw-r--r--sys-freebsd/freebsd-lib/files/freebsd-lib-9.0-bluetooth.patch12
-rw-r--r--sys-freebsd/freebsd-lib/files/freebsd-lib-9.0-cve-2010-2632.patch215
-rw-r--r--sys-freebsd/freebsd-lib/files/freebsd-lib-9.0-liblink.patch21
-rw-r--r--sys-freebsd/freebsd-lib/files/freebsd-lib-9.0-netware.patch11
-rw-r--r--sys-freebsd/freebsd-lib/files/freebsd-lib-9.0-opieincludes.patch122
-rw-r--r--sys-freebsd/freebsd-lib/files/freebsd-lib-9.1-.eh_frame_hdr-fix.patch17
-rw-r--r--sys-freebsd/freebsd-lib/files/freebsd-lib-9.1-aligned_alloc.patch51
-rw-r--r--sys-freebsd/freebsd-lib/files/freebsd-lib-9.1-rmgssapi.patch16
-rw-r--r--sys-freebsd/freebsd-lib/files/freebsd-lib-add-nossp-cflags.patch30
-rw-r--r--sys-freebsd/freebsd-lib/files/freebsd-lib-bsdxml2expat.patch26
-rw-r--r--sys-freebsd/freebsd-lib/files/freebsd-lib-includes.patch13
-rw-r--r--sys-freebsd/freebsd-lib/files/freebsd-sources-9.0-sysctluint.patch13
-rw-r--r--sys-freebsd/freebsd-lib/files/ftpd.pamd8
-rw-r--r--sys-freebsd/freebsd-lib/files/libusb-1.0.pc.in11
-rw-r--r--sys-freebsd/freebsd-lib/files/libusb.pc.in11
-rw-r--r--sys-freebsd/freebsd-lib/files/rquotad.xinetd11
-rw-r--r--sys-freebsd/freebsd-lib/files/rstatd.xinetd11
-rw-r--r--sys-freebsd/freebsd-lib/files/rusersd.xinetd11
-rw-r--r--sys-freebsd/freebsd-lib/files/sprayd.xinetd11
-rw-r--r--sys-freebsd/freebsd-lib/files/walld.xinetd11
-rw-r--r--sys-freebsd/freebsd-lib/freebsd-lib-10.3-r3.ebuild648
-rw-r--r--sys-freebsd/freebsd-lib/freebsd-lib-11.0-r1.ebuild644
-rw-r--r--sys-freebsd/freebsd-lib/freebsd-lib-11.1.ebuild708
-rw-r--r--sys-freebsd/freebsd-lib/freebsd-lib-8.2-r1.ebuild438
-rw-r--r--sys-freebsd/freebsd-lib/freebsd-lib-9.1-r11.ebuild617
-rw-r--r--sys-freebsd/freebsd-lib/metadata.xml16
51 files changed, 4461 insertions, 0 deletions
diff --git a/sys-freebsd/freebsd-lib/Manifest b/sys-freebsd/freebsd-lib/Manifest
new file mode 100644
index 000000000000..162c3090e7a9
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/Manifest
@@ -0,0 +1,77 @@
+AUX bootpd.confd 183 SHA256 c70c6a7a99470354a5f61bfe5c0f71325f4896e41da150e782223a30f07a275c SHA512 3f097c1acb5547add8d12fcee0b4b55b03896cb3ba473214d1634804f3683e0dea4b3c9559b61b2366b7f264d7a3d878695e16f29acff076b8060ca1fd79757f WHIRLPOOL c6721ac9b3ba70268fdba8c81ad9225e26049a5eb5ef8ea9bccc5fbbe7a110defe15df1d27b1c4b54f92e19d7d8b2099f87e7972faa0e5ddf17b66d30e26e0ad
+AUX bootpd.initd 554 SHA256 a1b1160a3e3d8f068a446ba5c9210737e120130fe173e68026263b7d057efb7e SHA512 69bc8dc708d955e41d3e0cfb997f96b589e8a3d33b11b2728541082fc5ab0844d753ca036a6c70ddd23a2a0085c39a89340b0f7d332b1384c94671cf3fe09b66 WHIRLPOOL 4764e746340fa0ace0310880a8ac13852df14ca14ba077610b5bfea09a45c093d064b5a534ed6e3dd839c869cf0c8013bcfe022814793ecc5f6e38cc08335f92
+AUX freebsd-lib-10.0-atfcxx.patch 1545 SHA256 eef9680da13fb24adc01fab170d83787e8b9926ec2bbb89cd7933b3dd8b35306 SHA512 37d8fc83b97addef48807196738be511fdc74b002dce321c2eaf38db5b618ff4a2f8e8447677c60b96b8add8f1dc586a66a30992289fa95e20e2005589e83953 WHIRLPOOL 78096c4064b98cbb05617355c8c65c306f9d6ceb2a2c8f772cf39f20c81395da9a2d1e128f5b1382bdd65d7e6d7df2d08606933ac5fa8a9aa3d55ec8b76363e2
+AUX freebsd-lib-10.0-liblink.patch 2448 SHA256 cbdcca5cc893b0d0b1ff98d1c1046519cebe9877b4cddd180340cfafbbbd2726 SHA512 c77049fa170d08d6ce035a8b9ae799f6d8e0b899371c1644a7493543fc07511515f68d54c82c618064954e48023c09bfcff452bd93e69ac07b7f8c6fc0e5089d WHIRLPOOL 12a22aeb74491960bf12da6d0db67504f1f804e732d332fd607cf58a78f0fc291af7d6a3d9f65744fedc36daa9326b463b2ebbe545d88deccc29135b6be60dbf
+AUX freebsd-lib-10.0-libproc-libcxx.patch 393 SHA256 da065c458716e8a56a3c3aab87c9e5135287d6c8fa46eb26092c197e167b7acd SHA512 086d71467dcaccefdb2d9d31deab1905407aadca625853ff222610ea713e80dd8dd61caae3765107045b376f4162f73d12407d1d27aad29603b45b108c09cd8f WHIRLPOOL 3bed09ac5887736dcb15583b4d6cde50419d156bc12f1e1a55668ed85bfb0f502c79c760e8cde3db7172b72775786bb8968df811980ad046c677ff0aff176b33
+AUX freebsd-lib-10.2-bsdxml2expat.patch 982 SHA256 0dab6d4525cee88eb1d6ce6c1176100ff9271222d6c6cde20f894781c02eb075 SHA512 b65fd732825e2813d499bd519bc5ef69b4c603ad57b047d2716405cc47a221c6e137a1f2e890b79a23bc26036834f7696dc9ac5953400f26975a0139fedad7c5 WHIRLPOOL dd2bd2384e12ee5e978dfb284ecdee73ce07f32d16dd67302a8cfc0ca324d078ab8b6153e170753a2fbe22993e07a4240e848d7b00aad78b58a4fa5cd27d0c26
+AUX freebsd-lib-10.2-liblink.patch 653 SHA256 a252201ec74f0cf0940b28b626e72f909cfab04addcb86b8f9abe984265c074e SHA512 c75c1fd81bd826685db5258ce0cd2407e385990dd576973fad361206271eda678d1fbe95a406909904bfee22890c79eb0f4cbfab09ddbee579552d003df2e6b1 WHIRLPOOL 3a579e65e07d7b8b558004eae9923c249d9dbd13983e3e263cb5384734d4e8c739440baa95a67953a56d2c6b7ff0a2cb8d2d7d8f7a0fbb4366001d0ea990cc4d
+AUX freebsd-lib-10.3-libusb.patch 339 SHA256 64c737051839e430108c96914485bc200e83ea951832033ace683470da823791 SHA512 15ad67c805c34e5a67f21de0db9ec3826aa96fadb880f2cca8110d4b26ed3722eea8aa9ee2c8e1976288b5e9be5e6046e4bd60d515305fff283ad50cc01d3d0f WHIRLPOOL 59ad6cb93295a95f8bb94fb7d2b13e1a8bd83267a96bc816142f9254bbdf494fd17670a0e8634eaeebe93f7535467c1b388f044eb459e222eecb84a7e21745bc
+AUX freebsd-lib-11.0-bsdxml2expat.patch 1103 SHA256 fea5f9bb3f59bcf9277253d41763ccf415dcb5fb6fa88e49459102cecbb43e18 SHA512 a0e9d99ff47ce813a98a5c1fd3605dd757ceb6c4f68e3784f1b48192c9f0966cbf1c769387a808ae4511f004b00242fc47f7fd3a2971e371de587cac6827533e WHIRLPOOL 9d7cac8b4b1cc575ddb0a74657e3e228a2d9439d43e5a69b4863247838d9224fa7d26818992629fda0f6db07d08da433e012cb63f4516c62206f2d9d71bda1c1
+AUX freebsd-lib-11.0-libproc-libcxx.patch 350 SHA256 23f5d80d5fb5cf683f3b7990e4899612a82ab878af450423a0da4179d846ad40 SHA512 c9ace882ac2fb2a077839a02a4307ce7df1dd0699cef081e6a99f12f9c2b443e4a4e4f85415a59d208859442dc665d7b9cae22de8d61f80ab8a5875d423c5795 WHIRLPOOL f1dc721386c698c50e69b4b4bd4b82be0ac47ae63546b15ba421a5a7784ee3af33e852484bf8cf763897d646857924bdae5a6551e4585740ce06deb628bc8653
+AUX freebsd-lib-11.0-libsysdecode.patch 680 SHA256 7f458085c5cddaec8fb94053150803058f444513ba0f3bb528e0e654022e653b SHA512 2601924267ea0efc1fee4bb582fa22918aa83964cbe519eec69c6e6bf09b6943b025d65833982fdfea01b74726ee5fba3f78ecf6ed2877f22965141c78074fd8 WHIRLPOOL d5ec768349e1524a3416c522f0d108fc5f2f0c1622bfefbf7c2a5a3530bf452f1163d038a5416fe8607c3af6282ee0db45d864ab21586f6f7a48fe0a3ed3b7fe
+AUX freebsd-lib-11.0-workaround.patch 295 SHA256 5f09d646d7137649b8dc0e1736a81a4ab7f2599fc48f4f75ac3341a9cd817773 SHA512 5c7559dc1876e833f440bc85e23e601eaa5dd26484b1905a5a59e29345f83438208770671c248b4dfb5138c4dded1f08234c77070afadb5c6b54e2b6dc35e24a WHIRLPOOL 165245510300f2b5f75d4a0cbeefee4b56971da5ddb70324885506d8223a86ee0c866921f008225674d520bbdd9c9bc22c43bfc32d55cc2f6a1094e7d48bc7f9
+AUX freebsd-lib-11.1-liblink.patch 4233 SHA256 f9681e76d585709b22e80006641d041d53ae2423a8f703fa46a39bc9feb336fa SHA512 23a875fa84685c7a98ddb08b1bcf831613239a6079c1711362bbbd19f27b67e61eb203bafc48c9ad06b9344258005e4d04756d4f8caba7c9545f3f86dcb52830 WHIRLPOOL f239f9fa184066087c459209d0d3b59fc2f2ff43ff0036da6d0dfb9d6052e57ae880d6450582c4cb65a5b13877c82f09e4df62ca66c32719d9d8b81b1086d5d0
+AUX freebsd-lib-6.0-flex-2.5.31.patch 421 SHA256 1d46cf13e1059ae3731ba5555764e020fcf4de7db5abf039fac83423e05d53c4 SHA512 c16a99b85e7908e77915796245741cbfcfb30ab1f4f0a8d565c28256b25d1532209ed27328d8b1571f61677251830f1fb6bbec17a8104686f56afd87f3226dec WHIRLPOOL 177f7ee5764f79fcdab768b13016e809f677cfd57a06ebb5e1bbafc6520f309b328908716ee02a8155f35566faefa95b67b064dafa8de9a7d2a19bde92b386b0
+AUX freebsd-lib-6.0-gccfloat.patch 542 SHA256 d549125f174c86c2d5e7e1f1c99cf1303b84e91ce8ee51db8c962be48b7a7951 SHA512 810745085c601757397b6d0338dba1631e4f623c3bae8a588e9f0b5c7cd9a9416d832093f97925fcef27ffcf20929bef8a5bcbeecf7a583c0a7eb6ce71f39495 WHIRLPOOL dee1bcf99935ae9ead0d5f498049a46ee89416f06eb7361901c69f40d0151ae1d3647a7dbb1c58b1aca7f541169b20d622019bc20b12953ba0c06fba56fd375e
+AUX freebsd-lib-6.0-pmc.patch 338 SHA256 36ca464f0aa1ed8784c8f1edc4a3580704c9a7813963684305250d806000075f SHA512 33187ec853ddf0c39680af60b669e60d3e213eba20a2e1ba995c991f04c053c5adcc5169b92c5d1d4cfbc7e03b72af2df4a5349361b41c56ca4a9b91e81bb327 WHIRLPOOL 1744ed829c1775c01b5d1b827b5677b6b5d731cff376da4d8e7ab8facbb0c465131a34157d77186bfcf1a1097f515e3909d1e753aa2b8e72efaf7feae319361f
+AUX freebsd-lib-6.1-csu.patch 655 SHA256 e6fe72a4183227b275815a75eec9639321046dc1e02b80c507ae6bf902a58cf1 SHA512 926d8aafd6f517a0fb97af61746d53bafab7fe7003f71181c43b4f9b31e7652624d060a350cc23d83ca7da7c1be2dcc048bb00a581c3524f0f2b7b06de6100b4 WHIRLPOOL fada1ac622c48e1e5af34245bdb17507b2b317938265f722c8cbdbbce3d14bbe76f39a231c0e7237bd229a8c0687952643c6f56e65ffc56b18508969fad837f7
+AUX freebsd-lib-6.2-bluetooth.patch 243 SHA256 4c90cb6d45fa24a07e21255949f219cc561a94011f645c58bce2a68027db6658 SHA512 60d938a6f1162f106ec93c4122707a4dd9ca6afc73be4d90871db745ad084ca1d229e7460f4faa9885c4f6d192a41cb8be7cf671b0c8ec720eccd1c7af994bbc WHIRLPOOL df2ab6e6d9223c7e2369fb8baf19638cb897343b6ba571c7b9294be7d335068b7978690b2cd50174b4ee0215f2409322a9cc2a374140fc14dff460e181c05578
+AUX freebsd-lib-7.1-types.h-fix.patch 371 SHA256 9e745fcfe046c405a365d8d0db8763867f0a618952f7d6bab4c76a8c82273473 SHA512 133ab13e98c3f2dc5f96cd5e45cd11c4da9757f4ea64831a6e17b309bc4692e4213b48c7ab6dd634f1feb069ca2dfc3a8afe1585d0d1425b5304fd7494cd342f WHIRLPOOL d284dd82244a108e4677be143cfc302c18f18e5b39c39fcaa8915c61053d94bf7171e48028f40d25f8058f8ec910c3e55a3753ccecb46bbabbb0e5ba86e808e3
+AUX freebsd-lib-8.0-gcc45.patch 1264 SHA256 5288e313beffa0e50fc0301e859c59f1a95302d546d27eae50b97c4a98c81c4d SHA512 12b81def4e7690cf5b910f31466b06c3fdf58f38a41f63dd359582d8f480e8081b54fd4997c6595e9e1a8912f991ba1b8d04989e270f242dd547d72c9ad5ea57 WHIRLPOOL 0cb37d909a02492a1ca700a5b990e4b6ce42a7f7d55e14a5a3fe685d28f360a10e95d97bd489f1dae0b152e168e9d901bfc13bf08bc91d8dfa1d263d4dba9abf
+AUX freebsd-lib-8.0-log2.patch 667 SHA256 dc421c3d92790da46360225de2dd4d707c314e962ecb95650799ee12f166a214 SHA512 72f99ecc4632ba9b5ea8f26cbe7311a2ada1822c1c3ccf2c6690d72fb91748e7e70915f33e0f29087125c4027ef084c1d37638fc423bde533595e8d4910084c3 WHIRLPOOL dbe9a686efa26dab9ca129ed39ddab49556490fee22b43f6aa07bd9cbebfa24bd8ccb6e30f0d213bab857571a022bcd1b110d47bd85c6f70462441772bfeb243
+AUX freebsd-lib-8.0-rpcsec_gss.patch 298 SHA256 775ec2ee12c49f134938fa8264c04c6b2bf95f8001371f20b85058c25ff1c472 SHA512 2dd63be1a31a1e78fff38a3061469148b673423d958223a459d157accd3a2d1b1f4e568910c49979b0a214322c4e7371f2710ef78fab7d161545fec2a78dc702 WHIRLPOOL 884b76cd6d5d01f801b2fb13f53cfa6ed26dd0b9b2a5062ac9dbe63a6813bfe737e4c3f98b3d94c32dfb6ce3cc19cd5c8760c81250f4b2d5980a4f084d7dc54b
+AUX freebsd-lib-8.2-liblink.patch 510 SHA256 38f967683e9d335ff7860150b2e6ae4d749266937ba195c6747d42d64c8e31ee SHA512 52a050078dc71163709e6dbe6d1c3177adbc51cb9b30a6990194ddd32f5b54e107b758801f0ff5632c4fe800c6734d63d42e53378a78caa0072847060fbb0dee WHIRLPOOL c0b95cb074ff6fd7699a03dfe31572a5edbde2b59c8aac3431fb85a0a0d71ad28566500951e0fb96ed9a8d3081abca7ec507c26e12e988f0ff2ece51bb0df2d1
+AUX freebsd-lib-8.2-nlm_syscall.patch 385 SHA256 4b26be44718cb3deb7fb295d403e892ed73ceba7ba43499a889bd49a5e43852b SHA512 1c871dc00da4b6d1106720954014f60933c99508dfc34fe08ae37b2f67ca05f70ac5e1bb75d0d1d119c7750405871ee3fb6e95ebd3ec378fc84e819cc0c4c9fd WHIRLPOOL 4d335910c00f21d2d8d5f80cd99c5316e5c485f935eefb782398e2e308e20a2cd4da0e1acf74c07a2c6d8ff446b3757cc416c0bee7e1be9d9cae0843a45e0748
+AUX freebsd-lib-9.0-bluetooth.patch 318 SHA256 5b8810471bd57e1100cc7ee6eee3ed92799e1a5c0244f5ae42f3715189fb06c3 SHA512 71cba168c1530407840dde9e25ce374abb7e0d69800e85bf6f5aff28d1a777ff31f47a84ab763e1518d3492f604d1c09ca95cf8ec5b4e05e8bd5b85267ca4488 WHIRLPOOL eccb54dd10a01358aa7e8267e64f103b89c2981ab2475f27282d5ea0bfe8adb8a106c869ca661553c3d2eda0c1d3d9dec669da6cfe61c23d5749535bdcc8c28b
+AUX freebsd-lib-9.0-cve-2010-2632.patch 6963 SHA256 a6383bd3b59bb6a8989ba7746f89115b91e5082768d914bab169842144569c45 SHA512 bb7090a0acbf8ab431334245b1e767da60dcf8f2d23de97a4690e879ae5d528065f5462e2ad3647313662a906f139cfff04f15bce80efede2d2174f74792a07b WHIRLPOOL 6df4a824cd657e79cce984f9181f3e6b20e998f9b9bc1a233bbc5dd7f2e40c055e9f9d401453b49bffb3cc8ef6bb541400f486a966339e56584569c08b358ee4
+AUX freebsd-lib-9.0-liblink.patch 627 SHA256 41f0b7f92f2a8f0a3e422447b830d7dec70a068573086484d5efd6826b7c4c3c SHA512 0c570fea9cc386afe4b742985cf7de4d49370be3f34b2059dee76869d8e64bd52db0a07e61fac8924848d12d0e6d510ad6a266ce8ef76e2be885d81d909ab616 WHIRLPOOL b59e3bb0aaede34492d1940a77b11c7e5192643122f18ee6ad363053f9dec2600218ca416dd153e1d0b3bb6621d6f9e2ec50621e6e7f4b610abbd69993dc428a
+AUX freebsd-lib-9.0-netware.patch 400 SHA256 e83d43f5bf9461c3d332365cca12db7b041b765c79eef392970665740411c382 SHA512 07ebde5797480f37502e60db2a8c9ce9459bd55b176e79c0f20a859cf737f619559cb27706fb0e83fb501493677a3ffeaa9a98d45db3c0c539b71d2f18140246 WHIRLPOOL 2d78565fe0bc0dcdd61d028ba24b20d2db94f32b40536e7e8e1d5e7f485e0e2f3125807dbb6607d26e4366a6aa8ee89a8f0af7c9498f1fba9431f652c181a8f1
+AUX freebsd-lib-9.0-opieincludes.patch 4495 SHA256 0868e7454053170c3399f1a03a68f3e70410c79db865e7e2f2b51f5961b5718b SHA512 a3828985f7da9e72ad44d88640952d56079693024bc11b4e3cca86b6f455a9e4756ba76f9e6d4c15960898f39e1dac7bc833e3241082f532c7fbd6d7d6f9418b WHIRLPOOL e0180dd0086c054e9f6895ecfe34bfb21d0e1db483dfc63ad411c651954c4703996d9b537a9566133a01770f2cf0f331727865013413181728c3b21740735473
+AUX freebsd-lib-9.1-.eh_frame_hdr-fix.patch 695 SHA256 6c6d7a958c989edc6ee76c5b9c2146fa449adda11c3b89b550780c7a78d93190 SHA512 c40270e8890a1152a6f2e705461ac64f8cc44e6d0306d895a0d146017d4fe3553853de88178e0744fc1be4197a4eb35b578c68593c80467dd8cf15c35720413d WHIRLPOOL 1fa3c5cdba333951b918eb5c1eb793ab49921268a6a397e38f2adad383c2c03ccf382892ed8d44e2480f8ca891ce3c3a0b122a026cbf232058ac3bcf2f2d5133
+AUX freebsd-lib-9.1-aligned_alloc.patch 1355 SHA256 379880b3e1be34a145d6388481645af5212eea7830285a7660a56a02e47dc608 SHA512 d9ac6008650efcd02ff1a0f64ac486e413c926681082d4ab9c1cb5abfbf1070e44b723e685a0b5b0e7159ab9071d85c5ee08c9063c9dcda470dfaa06a29391bc WHIRLPOOL fd80089b4b31f0a0d4dcb912d5dde74b3eb9e0530a3dc145f40ac476ef89ae256a0847123b44a0a59966c28f7f7529c401ce0dab493400a7aa24513989853e36
+AUX freebsd-lib-9.1-rmgssapi.patch 699 SHA256 0dc94a565f140beca0800446c72bd874f99c56125181f7a037154dcd898d2615 SHA512 cb0b292cca0c321ed72b1a792a3975be239303b3990efc6665b0c960dfe17fdbb4529405286c0a956c4b4711462d2ee9d7d1c9d343ad3246b43c49edfc87dae0 WHIRLPOOL 55adff8c3436959b4545ba54c0eff3cd640dd4f0d0871bd66dad2501c04e84eb24f27b882dde9050b088dadecc9af6049493e848a1d508646149075180c8c414
+AUX freebsd-lib-add-nossp-cflags.patch 1193 SHA256 53a844511feca44a9db4ac19de336320398335d18617b39cbc4e66db3f88e861 SHA512 fcb290527381df5b91355ca7f36bb4c770378b014890e7a4d129b7cc28e7c18cb1f87ef9e1b308e0de61b54d767677865969c77a9877d8874f2bec223331f9f8 WHIRLPOOL 20e4a0cd017f9aee59f0e4fa809ae74c855fcb7c7a794e1e71b1e5900390d08a9bdfaf5a36a45b057d6211c056a5fb69adfc688fa2adb0586f115be0aea40219
+AUX freebsd-lib-bsdxml2expat.patch 708 SHA256 0c3ec3657155c5032479181119c488d43a479ab0dfe7a7d7ed0dabce16853e85 SHA512 d3b321062886ee636a09af4b8714ae90317c17eb954a3d491cd21ca90605e26491033df4d6f02a517eda423783db74dad16adf7ee1bdc5557392cc70218ee9c7 WHIRLPOOL 5c262c59aee9e642d3a8929a453b56c7a55ba60f3011d6ac07b750a30297eb992a564ba4db18714b7eac58bbe3ded1ff4249150128947d25dd1344e59e16c9cb
+AUX freebsd-lib-includes.patch 316 SHA256 be4dd4c905715c2d165be282cf377f799b32ccb76986947bc0bf1b5730b57b06 SHA512 31b7f368a4d3998e42486cb944a001a8371c365276eac94fa8712e29dbe9a13a7756a2fd77fbff87a1f7f4c19b32721c74bbb099f611d46a8c78b73f92d9255e WHIRLPOOL 8c4c2c6d1e9556303520c4cd8f6996f0f24c8b45985d4326db880c187b6db30e914a6e47b40ea4a79d7a309fdd579b39232329daf74758412ac518b0a9d0a317
+AUX freebsd-sources-9.0-sysctluint.patch 403 SHA256 884fbc5d6d3766ea3d4609946f56072f36f95368dc13ee316c330a46d42f0c9e SHA512 f3a87cb187858bc6fd1bafda3c3bd7bbda52b07239a50a7c1aa201df2c52a58d4809e196b8799b1949c8ca1a556519d454ad1789358540e3a96cd480fc0a504c WHIRLPOOL 1fd9852d59378b3fa8682886085f4f63ccd2a57806161b9a3ccb0cbe0c465be2e5620ed57942a8687656859e1a9df17c7d298ea66ec037514bbe7707783aa9f8
+AUX ftpd.pamd 192 SHA256 4b789fb18bc0d1f9b0a9b0f1bf5dac6d86166a7106e966e5f65ffd4faf5ce024 SHA512 d7e7f08ef05ccc63e63ddc65d79f96106dfa0ec2421ee9fbbb83966aaccb73d9868cb14467c1bdfaa9d12299a8ad27cbc725a33fec58e47b5b8212e52a7c18eb WHIRLPOOL 1d418e336dec5b6c34541c11068fd19ffe7546d338851f47359c50c18bc382c84230c0d751fa8185d48ca1c67250ba320fec895fc92f96c1d6909647db67a54a
+AUX libusb-1.0.pc.in 207 SHA256 edf35e887cbfed2df288825434c467e0a946eeb21e0d631f55940bb177c2ba15 SHA512 93289cecfc298a31fd4fd0848bf25a63048a7549bd81792d7bd158731246221c24ec9f469a918430da56873a0936fb2b372cedaaa32a38ccd5323de0f9a89b93 WHIRLPOOL 7c81b0df4548a9391b4e1420186f1e970aa9e2e73a89e817adbff9de52b8797cbd8a4d8b3ca01f782f86e4b1e48fad72a08b5bff49d5ee6ffaa5135c015ca5ae
+AUX libusb.pc.in 208 SHA256 9bfe398a335f8b9b1c3dd167ab0c9206fe3bdd4e1da318ece977e20f3c2d7c56 SHA512 e9c6d5f04057cf8c13f69a3d8e07bdd517fdb01d572a69a1beb397766311b3c53894b108caaaea740bfc27b227a9620621dac5846bff1a367fbf9954f38bb40c WHIRLPOOL e80e76a8a564655d924a7148a841c7c7cf0be0ea3bdbd76e95e5004124543826e5d925dfe791f4b040e042a10923865bb517499d9f5be39611fedbcceebe32d8
+AUX rquotad.xinetd 162 SHA256 3f73f86e5a6ab3b6d25698f6179cdbe169b2fd01c682b45a9c8711f36bb317e5 SHA512 2cf16514f18abe2aeaa273fabc2dc94b09f31d02001ece5c82d9336c02d921e03dff6f82a613a4bffe57b5e415add2b82ef883a306907dd20ffe1bbe332b011f WHIRLPOOL 237667cbff4807d703a3c4c4eb8c2c5863d024a6263e3addf8d96ffa1461a8d1cda6318deee1de72146d27305b670b501da9ad4035880551dee5138b6798f6c6
+AUX rstatd.xinetd 218 SHA256 7bf526babdd46f03a6ea9ed12b5df16e5c2abc8aeb567214c8edb8ac327d4381 SHA512 febca8ab8248b1c103dd7be0806e3d678c5b5cf165a7b3bd0305bc905da228bf92392d65d44a765b7692f772befeedcbc3df205d32bb62ad5aa307f71a1c1011 WHIRLPOOL 76f8b1f3f85e97f27950549f62dc411e0620b25eba68c161c96a5252617c7c4beb0fecf94af9bc9cf931dff8fc4c750e780c41143a50b39d7538a30b7c0bd322
+AUX rusersd.xinetd 220 SHA256 271de1cad33a65a2a0e81e8983cbb1b7ab6e2e75bbf4c6e99181408067a49cd3 SHA512 fdf4ef4e0b0dd11c64fb38d32c9fca2d378a69e4cff87523127089d7dc0db12b26f6399c7a61fc43d62ca8083b116440f6fffff9e3329f0548bf54f0f26699cd WHIRLPOOL 7517089e5ab5b3925b46908c22a929cb04c8390387ad075f17c2fa0213ab38cae833d9280cfe289915afe4c2ee0b3e0299cee42daa871c23507f5f96cc22f227
+AUX sprayd.xinetd 216 SHA256 5b2c0e14c40c3d14f16f6fbe7b1f00d133bbae8ea27e548273a16d104afea24e SHA512 a49824ab0421560699901f54d9faf3f38fb6f8d8f63f05e33eb11da053278838e80eaabf5963b1c2a7292ba2d2118e1efd90954b2f3b2dc01b945fbadc6ce101 WHIRLPOOL 3869a0e4a9f03aa3654729e611a020421ec0beef2686ca8857b5ac3d50f8db26d7c1a5eb16e90aaf5b2b33e992915f7e9e504ce6bca9fd5862c2051a7172495f
+AUX walld.xinetd 215 SHA256 b7d8cb4b69809a2ea2f479f942c3d7752c5cb1e4b3b4b7b7b590f15616a774f0 SHA512 ab78d32e48d660649d3415a4432a5f3e98f8a6a8854791d1d828b0dc678f58e9f24532c264c5f5b039ccd706e0bb70c369ba9fb55fc9af9d3ed9b28e10b9e830 WHIRLPOOL 013b60056a8f5fe46eb4e00182fe0f391a2dc915312fe7e47eb372697526ed05a53e156159fd5dd3dcbf3db44a6591461c789af31ca0e1dd967537b785462802
+DIST freebsd-cddl-9.1.tar.bz2 899348 SHA256 bcc79fb002052128e9e91b16beb3083ee152be0936494715c6c159bfc8d2ca3a SHA512 ae0a969e710785bbcf36a2ec22cc5b1dcdb25398be951e047a1237d0c977e38fc9e05504db51f8bf9ed83bc1f68b04fc88ce18fc48a93f785b8a3f8ef481bacd WHIRLPOOL 2c4a5baf162dbb698af45b9262f104e27c05e6a2630c3e7b1765e76c8987a330c315f741df69c8771d2509708d2934db2a07f2e0218aa59d0100dfc3f952bf72
+DIST freebsd-contrib-8.2.tar.bz2 40931651 SHA256 8b9cb688e81c2980b3fc66411d00ab277a24dadd50d5bdd5e0e6c63ac687b9b6 SHA512 4f7bf825b579fbb88f2aac531d07e531474179c63fa0b66c4e80821290a8c94bf611bb4dcaef51b762aacd25b11dfae798a4ec3bad3b9e3f6b3490ebfaa72476 WHIRLPOOL edd3d9e26e8d22d9028082e107ec1a44402e206dab8722f34b445676959305996c3f699152af42ace249b7f58498492787823b172fb6bcb273119c6bb50a35f0
+DIST freebsd-contrib-9.1.tar.bz2 54751432 SHA256 e7ffa056d4050ce03ee8e23e276e2a9a494326a98d60c43bee2afcc59576deb8 SHA512 71be13049258c6e6b5e4f63cc16da5d349a89d68f04d87446e4ad33ae8bf2a93ea67d9c256b7bec60b61e65db0487268070cfb77a484c3ac0f8ba368b48c2438 WHIRLPOOL a2a84423175499208d34809e802284d6ba649f317c3a9ad8b7312fa19efe142ebadab0048bac0db8e988e59f9a7468ac7c5d0d25e78b82bdb269a20d18153cee
+DIST freebsd-crypto-8.2.tar.bz2 5561428 SHA256 89ddda3dfad2d46abacc27c296d7d58c18463e0fe1ce2fac2c7a8fcafe181890 SHA512 3c8ed329f6ed67d6db622e2713e9a7b65f54f4d99191e00b133c0afb3dec94c5426542719002e9bd2d83a9a1856a5cb29f2117f1db250f3794e1b2234a1e8e08 WHIRLPOOL 4df14a825a888f925e66599b1a0d6a35981e4eea357da03fccfe50426def5da97ead21ffc782b4e3e45aec047549f11b6d5385cfafcc271d0d6293cdce8a9ad3
+DIST freebsd-crypto-9.1.tar.bz2 5682828 SHA256 5165156c52f21318634611e8a3965134f3b34c83f9aba23db5a93b37627c5c74 SHA512 40c7a8150fb3ddd93488502a976ce03e992e6f4fb28aa3e5e102d4915f8ff49fe9085995ccfecacefc3b665e23c85cc3a0cdeec20a32c79e04458f7cc88630d9 WHIRLPOOL 72db3b27a6bf3abec47525fa31dd3bd459d4da36b787dbf57ed11b4e676c0c200ec5a549d7e27cb0c66e1feead8fa8257c712fdd5b5568eba2b8ae8323228043
+DIST freebsd-etc-8.2.tar.bz2 188629 SHA256 6bc745fa259f9fa2b65df865d45443a7b23c24445195e33a4ac50bf1040ae238 SHA512 3e5c106754a6a1ac806bd46b711fba7ee9cb31a4eab5262c995a5d59dbeb02f756dd8b495640dda94189d204a5d2c5218de2bd23467172d6a4ebe1048986e89c WHIRLPOOL 23b658a214f1a64c43420351020e32b1182e9aac3ed5253f49ee86f9cee9166ce32bd556cd2a2b3c0e60a165462a8700f37dea19e57ad5716415e17f61da912e
+DIST freebsd-etc-9.1.tar.bz2 207776 SHA256 a317bf85532d6192f5506e8d7bd5d5c201fe24017700e3a974a7712c2c69cdb8 SHA512 4fbe56fde519cf2f44e39a8869efa26c34f703cf540f4a83389da8d170873d7c6fb18e4010e643b8d793cfc5c55d15eeb198057a5b2a8da9d9e8f791801bf314 WHIRLPOOL 0c27019fe140fe96f870697acbaa89ac2f281f55b892c5791b08abf1cfa4da94d9d42a1df1c2091317573ed7234253857aecb797065f911a0a5d57bbf64349a5
+DIST freebsd-gnu-8.2.tar.bz2 815379 SHA256 34be1326b8e188427ea4a59de5dd24049f99adb5e172d61a645db1b7124f7876 SHA512 8b278e386b22b22658eef18341073c1c757b86ecdef5c5b543fb781cfee295d71cef599544eda5f8cf273fc22d28a1ab14d912086ff8398c36ee2b71281617d4 WHIRLPOOL aaf91562f147095e09a9f6aa2d4c33494f430cbe7340377edff1b8a44cc60edfe4af7ef90350018f0c80e82f5518110689cb582bb227d2360488dfbdd7bcb7c8
+DIST freebsd-gnu-9.1.tar.bz2 795778 SHA256 3b99c1fa1087bf69549e0990a0d7997954533ac9d7938c4760ec2b01aa509a5f SHA512 b05f2a5a10bdaeef19dfd0e962bc09f1571288a831e9345f404b920037f47db5c0ca3d620d1cbdd138b18bca1c3feab5b211b57e3041727341e5238cb9feb4fd WHIRLPOOL 4f776b99296c4fcc0d6f4d30a12b0773f6704292e1361826b260ce34dcc8e537ef7eb7c6332c4988e0e03bc84ca07fb18e6b2785fe4c6f175c08865b72d6bb0b
+DIST freebsd-include-8.2.tar.bz2 138992 SHA256 fade90621a8e4880c9583c1ee49965400c88e53ac6c07cb5dcf320e4f069271d SHA512 6bc820dde866589ef75f9f0d1c469d815439bdd4c79f0e1a2482ec58f938b638cb9106969b321aa72492f933c95c76895ce489727a5e265798c93adc75dd64e3 WHIRLPOOL 64d3160c4ac46a62f5969058e07bd160c92284f08805ed917f2073ba1cb5907cfca16c5893daf30254d39b4fcdf641ab6afb9817607f65e7789d3049e8103947
+DIST freebsd-include-9.1.tar.bz2 146881 SHA256 861dce3f39e6806762b102361017cbe148f0e2b768b3fca152f8426f44a2942f SHA512 779c8315ce2b10b343bb62e331525d510b0d68ce5d665a1672bd6f4d1eff6445bc6b7a0f178b319828aa203c4e4c04c561ce793052703f4f936ce9711280a0c9 WHIRLPOOL e16ba45d380591ba007ca59579d45f61ffc1aa1a4c08fc11ed2794979b0a189a346c81b4f70a44ee199d50a72024930f28587ad62a9cd6854fc937eb466ec115
+DIST freebsd-lib-8.2.tar.bz2 3323878 SHA256 e3590c12794fcb5ba8eb7a1f58b497587cf19f9200b3254c194a793da3b5bfb0 SHA512 c059cfdd1099bb519b2a5c43fb7e7104c500ef8906229ed7eb9e420cb3a217cdaf8655e9e7a9f45cfadc5491f8115e0e738fd49251d9f0c3a83780845b09f007 WHIRLPOOL 95f98a372f44a89bc8ac3029ec065dbbfec338e6f889d057d75644bfcdfb9d27fdc0421d7e392cad5a823712b97f0857297ec3d321580254c63032c22b95792e
+DIST freebsd-lib-9.1.tar.bz2 3206685 SHA256 f31fa8107b4de711c548f6d0c1bb1f81d09f51bcc3b14a1e9e90bb0e7cc4a35d SHA512 40d0c36b6b889c404fa0e0afa38ba4e84a55bc88ffa2f98a70afbd7a32c4f32c158617ba770567d082a986d62c09b3ec8db3dc5ab853ee1c9bbe0b90bb82396e WHIRLPOOL 581878bf9c43184b043b4293409b85901c9ed1f9bd279e965414aca41ba50950848ebda3ee10a503a028135dfd2765e95a11acd4e62a11c528e104392bbbd8d0
+DIST freebsd-lib-EN-1606-libc.patch 249 SHA256 5ad0e95c5418ebd3edb06dc3f287b3fd84476a57766ca9984ffd98108e6930e6 SHA512 6dcfd00e646da0d3d8ad231786a8e422d319d8a1755e9f1d55f555999c5ccc0fdb7dca62fc1ced8686f6c3206044e75cd197d75843b1e9e6e83bef276c01d3d9 WHIRLPOOL e8d1c9f0e070e1b30443942543bcb6b0963a9566e3ff32e4d4592a268217547019ab133f1b477b3d772a206c4a275b01b1bb9784f16c4233894a7ad4dfc71ece
+DIST freebsd-lib-SA-1637-libc.patch 1567 SHA256 77923f6f7c754507db76e6ee13aed1a36b0e58691369baf8f2c9bff819787f0e SHA512 8eaea9e01a7b224138da2cec559d8e925af3ecda4bf7d29340394f57204cd2460c7418a33dcca3db445436ac2985dba42478ad5595c25b9d83305552a04965f7 WHIRLPOOL b15495b71aa72f56494e9efb55b7641224672f93442a075212269a180aac6ac705802afd90f40e192af72a975f05aa8d516355339722c741d565444cbc076a95
+DIST freebsd-lib-SA-1638-bhyve.patch 637 SHA256 e90962f3ad1f42c85cd251fc7af3400991acbecf262a0499ab07da53fce3c005 SHA512 4d8c45f4e2d729998a874023bf5bc8ca2904d3fd71e681180c3b4b2eabe2a34c086b806b86debcbc9ab24c6b5ab637f6ddae00fb577994359ed14edc3cac5aa4 WHIRLPOOL f30895ed4478165c914cd0a95a5e31f0e3175580ea753af39810cc9e2c6f5d0202fd771bac8f789ce52b73d88d536f95cd322e851c397f0087e66146cd412fbb
+DIST freebsd-libexec-8.2.tar.bz2 289147 SHA256 10b996d1d8cd044ee2e7a877e5e6ad2bf050cce9b3bd402a5e0dea7d290b595d SHA512 abe6cf5a268675d7dcb1c214c46fef47a3fb09b31947f5d8a0b938d352295efe0249beb5007649c52187bf4c221b6ebf074d18dfe9bafd168cae09ee02ab608d WHIRLPOOL 27e854fe465eb933dd8e27c5a09b063e4d3798b54e0914c79a9120dcdc34cc5d525a0c92da7b645ff7ab2ab4f34c7f7b2783012dfa5004407acd11150062b7ad
+DIST freebsd-libexec-9.1.tar.bz2 304592 SHA256 71e6e9e41328c2148c54b81ad9b59f912a1d5f0d52e17ac07f223aa7a94b82be SHA512 7baa4160dda2610250dd52f445e24478e0f1ea10bce21fcd0e5d1b856f399b896adc334114de0c7f61a5637e4349bb1688fdbe5c72798d8568ae791114710b92 WHIRLPOOL d800f477ac5c9ad6dae3e0091c83e107609b5a1e3aa79e9533fcd10a8dd34ff7733ab9523eae7c292310fe94f6a529209cae6b9e8bac6b47244e59834593e74b
+DIST freebsd-src-10.3.tar.xz 126900216 SHA256 f50763dcac88e9b7ec616b77d537bf338f470350e2c85e0cc7decfcc8372b54d SHA512 a0c95fc4bbc5ad7599d0a83651a497e85cd85a5c433e5e175c57480b466c9eb5aa0390804d6336da8301c75ad499484399d39b8f7efbcfda8cafb09b1aa12d8f WHIRLPOOL bf5320bc506fb73a63d0fb324b60667a196ca2fef5d0215637a657c613f2052d76d002deb205e258f6d4e2aaea15490b26679e59a102606a34b58ab1f6b755ad
+DIST freebsd-src-11.0.tar.xz 140252356 SHA256 0725a7f1d3e8985f4b2e31a2ad714334463a5016b203073a8fc196649f3d5a27 SHA512 ee1271bb38ee46fbab3d49b33f5b5afd76f9402b2e792581d63f02272df8e2a4011fac97ad550434f0c2fc5fe241940276629bde55e75f8638896a81339870cd WHIRLPOOL e1cda77189990c1d2187ab2d9e842ff3c619d8235f1ade56819fadc52f680a871de17cf05f8119614557c615ad19d41d1b6080c4b3768e7252889546b865d827
+DIST freebsd-src-11.1.tar.xz 147661560 SHA256 7e1186c2b3f6d070995b88bef5aded34089fed227c7b584c30b28cecaf428154 SHA512 b97707ec7a601ca6bcb682c45f6d94a38484301ac24630d7285eff6f88b027ce6900c93fc62f8ce36e0cf32c91f73a9d1c999db397b7f8782fd74a8551a03aca WHIRLPOOL 3f88b15153c25c7878d1a730213e5bc8c200c05427895ae97280c4412680bb8e67cf4f8170f9e2b0f21d63ec42365f44f7d5eafe614e9b8726f4bc3cc3825202
+DIST freebsd-sys-8.2.tar.bz2 25835329 SHA256 0c6c7b61aae94db2931f985d5899f3bca78fc8ffab6b598fbaa158142d676f16 SHA512 6ea4516a5c52e25c4f993f7acb875463a5caea93dbdf250c5d48eee95fff226956e9f030cab7e341b5e6a132325bc3dbf93dcb4b1185acb011918e50b1a22be3 WHIRLPOOL 870deeff877c6b9fc812a4260e4fdbb6715a5dc2065cab3bfbf2a42d876f6654703ccb124275a4e2c410cef48f3db02b63cc76059eccf9cf90244826f35b7a15
+DIST freebsd-sys-9.1.tar.bz2 32588103 SHA256 b93a7ac8334ac16cc9f60665048e5ef812c0a6c62f10d0b0a674aec3f56516a8 SHA512 7dc9d9e00dde8f592bb171f4386d02b655b73cb4f153fe5ec063d010a148ef0639eae0dcdb3eeb09ecd1e3653c69e49a2d261329fa6d0381d2ddabe258ddde6d WHIRLPOOL c8348344dfb14bad64bd3a78ee615ddd29203175b292233254f8ba175e7a3fb7218af6f95f7b4dbf394c0354bafe9d8bb0c21cdf0ceaeb697214964b280469b3
+DIST freebsd-usbin-8.2.tar.bz2 2443024 SHA256 aa7cabf10f5c3a9daabea32e4de24d04ec312247842981476da666eff5054603 SHA512 bcb8ff3df54848b9107bbb52e5ced7a91e24bb181f06769b6997221729b8064ec17652eaf7500de3268cbcb63ff5760beb54d15fc78c27b02687b5b1067c74a6 WHIRLPOOL 20f5278e2a1dd387a75b44f10507958d6c0e84a2faa1bddbf808c14ab86d8dd14a956192911bbc1880f5f5f7bd05972dcbb4aec85d241f0dcf91bf4246883f0a
+DIST freebsd-usbin-9.1.tar.bz2 2670916 SHA256 b938c20b8c09aa9a610e13b69b9afeea72f561ab3636a59fba2bdac290f4db75 SHA512 21c234312f70eb35cd2926519efc1f61592892f5d0940786dbeb959c3c5ec7819a51ae95c6e8a1a06aa01f669350fe0fd3dd7c4ec8a84dd6b90f24cb192356ca WHIRLPOOL 7f6ad2eb5410cc5e685881654a788807848af026b1277a974682755ab7c9db28f576bfd1576441ea10c5f1e9edb7d30a4a23fb8eccd6d69d86ecc9ce4c9adc7e
+EBUILD freebsd-lib-10.3-r3.ebuild 19468 SHA256 c9090f8098ed06d2defa7ea1ca989cc2f76cf84bf28f9aa8b39acaafc745ee76 SHA512 f908c3e6c7cfb2f7e87481eaf10f0ad19e7e45eb0c12498a138a43244e82a103ff1387f2c34984aa3b659daaeefb9228562e1bae8049fdf5a7a9016dda5f82aa WHIRLPOOL 26fcc8b6fb61ffb1d4f9ab925d1de0f236d2e81295f4a6b64457d9aee7be2a8e91ac337531c3de59087cf1daeb046af6113103283416d17ac3aea37ac8ea2635
+EBUILD freebsd-lib-11.0-r1.ebuild 19438 SHA256 515d09d9cd660c2654cb2f853dcd160b09e6fdcbf1c8571bd80028b23639ce1a SHA512 9e2651c1a3b3e781c291fe9c8627b6fb6f5549431ffc1f680f146ee5fb34680d2edaba7e50364e4aa2dabe2f34c4aa7a224f9cce2ad8e10e7dbb06677f7bd5c6 WHIRLPOOL bf728b0f0c4b7229a215e52b24ca098b300e21ed0a83c7f06d9438817439efb36dc604d02c26cf0166e296919da4304b50adbc9fbf3d284ea9c5e35b0452e852
+EBUILD freebsd-lib-11.1.ebuild 21778 SHA256 1f452c4e83293dba64903a1dc129b28d883ff03d760987e6b77f9aeb0f1c1bbf SHA512 d8a34d01ead4cca49c288f1604cda6dbbca57c2949d3f1eb48c1264f8b0f079fa77743f36c7212fdf1a67bf15ff57241ecd69d3c85469505847709ad9b87436e WHIRLPOOL 38c8816b84b6cf152bb9aa1de155ddf07c19a139ee469c1891a47f48650ee77a274ef90a33256683284caa5335a20a3c11cdd8f20b948ba8fe7e78165b47ae11
+EBUILD freebsd-lib-8.2-r1.ebuild 15675 SHA256 af261adc6e95b153ef279a0238faa93681f538918344711233796e3454aa15e1 SHA512 8ee3e2562a96f64cc2264bd315e0fc6faead639541fcb61c95a180f6d6283c8dee7d2289ee7efa477eb1324e0353be94f220c7909c34ac67bc5487892e007364 WHIRLPOOL 00b5d5f9936d82f521bb600db23b11bc35e8a34ee79760efef0de4b8a59b5241e6b0dbb879938cb2890e72610814255c618c16d482d0787df00a5e0e6fef4f43
+EBUILD freebsd-lib-9.1-r11.ebuild 18831 SHA256 2eab3f156521683e3970a23c6caa041501cb185551b727c1f7940d75d0211485 SHA512 5deb3676f9b97adf1a68dc252e4d7e7294f3eca8ff359492ec0a3ba7f5edf547270386d591be2df15935a96df7bbd2e7a4e0f8c59c13885ed224da30ef617b95 WHIRLPOOL 58a6b949bad4e99d0675575b96ed4affca9629eef0549970ac379455f43d1893464b45e7efc25e5b07d5687c5c49c67bb29145d5b5ba3fcba3bd029580b94a5b
+MISC ChangeLog 8745 SHA256 8fe13e4e710f1872870da000d3a19a06d77fabe8925a152b542a94abc0719b68 SHA512 4d9863368b4efebd94400c5a6d635957790257459ec2c2a2b156ad2c22f31d6b56157eac11e06302ab957db0a1eb5a028ef5f76bc718fc1437d5d8dbb67e6842 WHIRLPOOL 6abcbb36d1d79642c249ddcb84c4aeeb8721d1a34accee05ab986865fa959b38d238745e0d83200e55505f7e9210da08fc0e2bae331548043243eb07974ee27f
+MISC ChangeLog-2015 43636 SHA256 4b2a4210a8d2481a95500fe185baa3308c46691ec87e045a1767725e4ddd81c4 SHA512 6941a261fc0350dc78f402bb2dc8e0685c20aa3b80eca81dcf3fdfe5b20e05eb78806bdb79282dc15025594674e4d27606e2beba0d4cbba48029b0f5b954e117 WHIRLPOOL 89fe5175adcc0849537ee7501ec0a74a33c1ae518066f08fafcbd97a2277f8e1fe7078af05f9da75db06dd8e774876507ddf971b284f9f1d1f04e1bda66c6adf
+MISC metadata.xml 500 SHA256 82c704031ba7ec4dec7348c15d1188fad5e9df804c12f90c04afcb0a46eb5dd6 SHA512 a164ccc254879d798007a4fb1db376b0dd807b3b6ef628c7f65ff05560d92d742f315226fe4935eb8b142d6937d6cfb01f515d21664f171e94f1549b40815470 WHIRLPOOL 0837f442d3673e9bac470774a9868ad4992056a4edae8e07759248ec58830cb1a596cf39b347d04a3e33b16d88329084571df30f33bdc9c9e73073f32ca015ae
diff --git a/sys-freebsd/freebsd-lib/files/bootpd.confd b/sys-freebsd/freebsd-lib/files/bootpd.confd
new file mode 100644
index 000000000000..6d238e4d4853
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/bootpd.confd
@@ -0,0 +1,7 @@
+# Configuration file for /etc/init.d/bootpd
+
+# Name of the configuration file for bootpd
+# bootptab_file="/etc/bootptab"
+
+# Options to pass to bootpd. See bootpd(8).
+# bootpd_opts=""
diff --git a/sys-freebsd/freebsd-lib/files/bootpd.initd b/sys-freebsd/freebsd-lib/files/bootpd.initd
new file mode 100644
index 000000000000..82288ebf19c3
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/bootpd.initd
@@ -0,0 +1,27 @@
+#!/sbin/openrc-run
+# Copyright 2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+ need net
+}
+
+start() {
+ local bootptab=${bootptab_file:-/etc/bootptab}
+
+ if ! [ -f "${bootptab}" ]; then
+ eerror "Unable to find the bootptab file: ${bootptab}"
+ eend 1
+ return 1
+ fi
+
+ ebegin "Starting BOOTP server"
+ start-stop-daemon --start --exec /usr/libexec/bootpd -- ${bootpd_opts} ${bootptab}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping BOOTP server"
+ start-stop-daemon --stop --exec /usr/libexec/bootpd
+ eend $?
+}
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-10.0-atfcxx.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-10.0-atfcxx.patch
new file mode 100644
index 000000000000..42b64b572322
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-10.0-atfcxx.patch
@@ -0,0 +1,49 @@
+diff --git a/lib/atf/Makefile.inc b/lib/atf/Makefile.inc
+index 937187a..d5277f3 100644
+--- a/lib/atf/Makefile.inc
++++ b/lib/atf/Makefile.inc
+@@ -49,6 +49,24 @@ CFLAGS+= -DATF_PKGDATADIR='"${SHAREDIR}/atf"'
+ CFLAGS+= -DATF_SHELL='"/bin/sh"'
+ CFLAGS+= -DATF_WORKDIR='"/tmp"'
+
++CXXFLAGS+= -DHAVE_CONFIG_H
++CXXFLAGS+= -DATF_ARCH='"${MACHINE}"'
++CXXFLAGS+= -DATF_BUILD_CC='"${CC}"'
++CXXFLAGS+= -DATF_BUILD_CXXFLAGS='"${_CXXFLAGS}"'
++CXXFLAGS+= -DATF_BUILD_CPP='"${CPP}"'
++CXXFLAGS+= -DATF_BUILD_CPPFLAGS='"${_CPPFLAGS}"'
++CXXFLAGS+= -DATF_BUILD_CXX='"${CXX}"'
++CXXFLAGS+= -DATF_BUILD_CXXFLAGS='"${_CXXFLAGS}"'
++CXXFLAGS+= -DATF_CONFDIR='"${CONFDIR}/atf"'
++CXXFLAGS+= -DATF_INCLUDEDIR='"${INCLUDEDIR}"'
++CXXFLAGS+= -DATF_LIBDIR='"${LIBDIR}"'
++CXXFLAGS+= -DATF_LIBEXECDIR='"${LIBEXECDIR}"'
++CXXFLAGS+= -DATF_MACHINE='"${MACHINE_ARCH}"'
++CXXFLAGS+= -DATF_M4='"/usr/bin/m4"'
++CXXFLAGS+= -DATF_PKGDATADIR='"${SHAREDIR}/atf"'
++CXXFLAGS+= -DATF_SHELL='"/bin/sh"'
++CXXFLAGS+= -DATF_WORKDIR='"/tmp"'
++
+ WARNS?= 3
+
+ # vim: syntax=make
+diff --git a/lib/atf/libatf-c++/Makefile b/lib/atf/libatf-c++/Makefile
+index 37d6073..90a2687 100644
+--- a/lib/atf/libatf-c++/Makefile
++++ b/lib/atf/libatf-c++/Makefile
+@@ -40,11 +40,11 @@ LDFLAGS+= -L${.OBJDIR}/../libatf-c
+ .PATH: ${ATF}/atf-c++
+ .PATH: ${ATF}/atf-c++/detail
+
+-CFLAGS+= -I${ATF}
+-CFLAGS+= -I${.CURDIR}/../libatf-c
+-CFLAGS+= -I.
++CXXFLAGS+= -I${ATF}
++CXXFLAGS+= -I${.CURDIR}/../libatf-c
++CXXFLAGS+= -I.
+
+-CFLAGS+= -DHAVE_CONFIG_H
++CXXFLAGS+= -DHAVE_CONFIG_H
+
+ SRCS= application.cpp \
+ build.cpp \
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-10.0-liblink.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-10.0-liblink.patch
new file mode 100644
index 000000000000..6ef3f07de0fd
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-10.0-liblink.patch
@@ -0,0 +1,98 @@
+diff --git a/lib/libcam/Makefile b/lib/libcam/Makefile
+index 9a21dde..0815f0a 100644
+--- a/lib/libcam/Makefile
++++ b/lib/libcam/Makefile
+@@ -8,6 +8,7 @@ INCS= camlib.h
+
+ DPADD= ${LIBSBUF}
+ LDADD= -lsbuf
++LDFLAGS+= -L${.OBJDIR}/../libsbuf
+
+ MAN= cam.3 cam_cdbparse.3
+
+diff --git a/lib/libdwarf/Makefile b/lib/libdwarf/Makefile
+index dbd7895..607b1f6 100644
+--- a/lib/libdwarf/Makefile
++++ b/lib/libdwarf/Makefile
+@@ -21,6 +21,7 @@ SRCS= \
+ INCS= dwarf.h libdwarf.h
+
+ CFLAGS+= -I${.CURDIR}
++CFLAGS+= -I${.CURDIR}/../libelf
+
+ SHLIB_MAJOR= 3
+
+diff --git a/lib/libproc/Makefile b/lib/libproc/Makefile
+index 4449c06..f024cf0 100644
+--- a/lib/libproc/Makefile
++++ b/lib/libproc/Makefile
+@@ -14,6 +14,7 @@ SRCS= proc_bkpt.c \
+ INCS= libproc.h
+
+ CFLAGS+= -I${.CURDIR}
++CFLAGS+= -I${.CURDIR}/../libelf
+
+ .if ${MK_LIBCPLUSPLUS} != "no"
+ LDADD+= -lcxxrt
+@@ -27,4 +28,7 @@ SHLIB_MAJOR= 2
+
+ WITHOUT_MAN=
+
++LDADD+= -lelf
++LDFLAGS+= -L${.OBJDIR}/../libelf
++
+ .include <bsd.lib.mk>
+diff --git a/lib/libprocstat/Makefile b/lib/libprocstat/Makefile
+index af5a775..c01aa05 100644
+--- a/lib/libprocstat/Makefile
++++ b/lib/libprocstat/Makefile
+@@ -16,6 +16,8 @@ VERSION_DEF= ${.CURDIR}/Versions.def
+ SYMBOL_MAPS= ${.CURDIR}/Symbol.map
+
+ INCS= libprocstat.h
++CFLAGS+= -I${.CURDIR}/../libelf
++LDFLAGS+= -L${.OBJDIR}/../libelf
+ CFLAGS+= -I. -I${.CURDIR} -D_KVM_VNODE
+ SHLIB_MAJOR= 1
+
+diff --git a/lib/librtld_db/Makefile b/lib/librtld_db/Makefile
+index 2815a07..e992662 100644
+--- a/lib/librtld_db/Makefile
++++ b/lib/librtld_db/Makefile
+@@ -10,5 +10,8 @@ SRCS= rtld_db.c
+ INCS= rtld_db.h
+
+ CFLAGS+= -I${.CURDIR}
++CFLAGS+= -I${.CURDIR}/../libelf
++LDADD+= -lutil -lproc
++LDFLAGS+= -L${.OBJDIR}/../libutil -L${.OBJDIR}/../libproc
+
+ .include <bsd.lib.mk>
+diff --git a/lib/libtelnet/Makefile b/lib/libtelnet/Makefile
+index 1cf52a0..3d25fae 100644
+--- a/lib/libtelnet/Makefile
++++ b/lib/libtelnet/Makefile
+@@ -13,6 +13,8 @@ INTERNALLIB=
+ SRCS= genget.c getent.c misc.c
+ CFLAGS+= -I${TELNETDIR}
+
++CFLAGS+= -I${.CURDIR}/../libmp
++
+ WARNS?= 2
+
+ .if !defined(RELEASE_CRUNCH)
+diff --git a/lib/libexecinfo/Makefile b/lib/libexecinfo/Makefile
+index 30a1dfb..9f8a99c 100644
+--- a/lib/libexecinfo/Makefile
++++ b/lib/libexecinfo/Makefile
+@@ -10,8 +10,10 @@ SHLIB_MAJOR= 1
+ INCS= execinfo.h
+ SRCS= backtrace.c symtab.c unwind.c
+
++CFLAGS+= -I${.CURDIR}/../libelf
+ DPADD= ${LIBELF}
+ LDADD= -lelf
++LDFLAGS+= -L${.OBJDIR}/../libelf
+
+ MAN= backtrace.3
+
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-10.0-libproc-libcxx.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-10.0-libproc-libcxx.patch
new file mode 100644
index 000000000000..55987aa44fa1
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-10.0-libproc-libcxx.patch
@@ -0,0 +1,16 @@
+diff --git a/lib/libproc/Makefile b/lib/libproc/Makefile
+index f9e01ab..15b27d8 100644
+--- a/lib/libproc/Makefile
++++ b/lib/libproc/Makefile
+@@ -15,7 +15,10 @@ INCS= libproc.h
+
+ CFLAGS+= -I${.CURDIR}
+
+-.if ${MK_LIBCPLUSPLUS} != "no"
++.if ${CXX:T:M*-stdlib=libc++*}
++LDADD+= -lcxxrt
++DPADD+= ${LIBCXXRT}
++.elif ${CXXFLAGS:T:M*-stdlib=libc++*}
+ LDADD+= -lcxxrt
+ DPADD+= ${LIBCXXRT}
+ .else
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-10.2-bsdxml2expat.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-10.2-bsdxml2expat.patch
new file mode 100644
index 000000000000..303f422651f3
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-10.2-bsdxml2expat.patch
@@ -0,0 +1,39 @@
+diff --git a/lib/libgeom/Makefile b/lib/libgeom/Makefile
+index bbfb57b..a7c17e3 100644
+--- a/lib/libgeom/Makefile
++++ b/lib/libgeom/Makefile
+@@ -13,7 +13,7 @@ CFLAGS += -I${.CURDIR}
+
+ WARNS?= 3
+
+-DPADD= ${LIBBSDXML} ${LIBSBUF}
++DPADD= ${LIBSBUF}
+ LDADD= -lbsdxml -lsbuf
+
+ MAN= libgeom.3
+diff --git a/lib/libgeom/geom_xml2tree.c b/lib/libgeom/geom_xml2tree.c
+index 9dedb8e..d96420c 100644
+--- a/lib/libgeom/geom_xml2tree.c
++++ b/lib/libgeom/geom_xml2tree.c
+@@ -43,7 +43,7 @@
+ #include <sys/sbuf.h>
+ #include <sys/sysctl.h>
+ #include <err.h>
+-#include <bsdxml.h>
++#include <expat.h>
+ #include <libgeom.h>
+
+ struct mystate {
+diff --git a/lib/libmt/mtlib.c b/lib/libmt/mtlib.c
+index d1fc0b1..89ac55e 100644
+--- a/lib/libmt/mtlib.c
++++ b/lib/libmt/mtlib.c
+@@ -48,7 +48,7 @@ __FBSDID("$FreeBSD: stable/10/lib/libmt/mtlib.c 280438 2015-03-24 14:36:10Z ken
+ #include <unistd.h>
+ #include <stdint.h>
+ #include <errno.h>
+-#include <bsdxml.h>
++#include <expat.h>
+ #include <mtlib.h>
+
+ /*
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-10.2-liblink.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-10.2-liblink.patch
new file mode 100644
index 000000000000..b08d95f714f3
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-10.2-liblink.patch
@@ -0,0 +1,26 @@
+diff --git a/lib/libmt/Makefile b/lib/libmt/Makefile
+index cb1da71..43de5a5 100644
+--- a/lib/libmt/Makefile
++++ b/lib/libmt/Makefile
+@@ -5,6 +5,7 @@ SHLIBDIR?= /lib
+ SRCS= mtlib.c
+ INCS= mtlib.h
+
++CFLAGS+= -I${.CURDIR}
+ DPADD= ${LIBSBUF}
+ LDADD= -lsbuf
+
+diff --git a/lib/libdpv/Makefile b/lib/libdpv/Makefile
+index e9384b7..085ef62 100644
+--- a/lib/libdpv/Makefile
++++ b/lib/libdpv/Makefile
+@@ -11,7 +11,8 @@ LDADD= -ldialog -lfigpar -lncursesw -lutil
+
+ SRCS= dialog_util.c dialogrc.c dprompt.c dpv.c status.c util.c
+
+-CFLAGS+= -I${.CURDIR}
++CFLAGS+= -I${.CURDIR} -I${.CURDIR}/../libfigpar
++LDFLAGS+= -L${.OBJDIR}/../libfigpar
+
+ WARNS?= 6
+
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-10.3-libusb.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-10.3-libusb.patch
new file mode 100644
index 000000000000..813a42b50171
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-10.3-libusb.patch
@@ -0,0 +1,13 @@
+diff --git a/lib/libusb/Makefile b/lib/libusb/Makefile
+index 88ec3fe..076b8d4 100644
+--- a/lib/libusb/Makefile
++++ b/lib/libusb/Makefile
+@@ -38,7 +38,7 @@ SRCS+= libusb10_io.c
+ CFLAGS+= -DCOMPAT_32BIT
+ .else
+ FILES= libusb-0.1.pc libusb-1.0.pc libusb-2.0.pc
+-FILESDIR= ${LIBDATADIR}/pkgconfig
++FILESDIR= ${LIBDIR}/pkgconfig
+ .endif
+
+ #
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-11.0-bsdxml2expat.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-11.0-bsdxml2expat.patch
new file mode 100644
index 000000000000..41a394b815a0
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-11.0-bsdxml2expat.patch
@@ -0,0 +1,39 @@
+diff --git a/lib/libgeom/geom_xml2tree.c b/lib/libgeom/geom_xml2tree.c
+index 9dedb8e..d96420c 100644
+--- a/lib/libgeom/geom_xml2tree.c
++++ b/lib/libgeom/geom_xml2tree.c
+@@ -43,7 +43,7 @@
+ #include <sys/sbuf.h>
+ #include <sys/sysctl.h>
+ #include <err.h>
+-#include <bsdxml.h>
++#include <expat.h>
+ #include <libgeom.h>
+
+ struct mystate {
+diff --git a/lib/libmt/mtlib.c b/lib/libmt/mtlib.c
+index d1fc0b1..89ac55e 100644
+--- a/lib/libmt/mtlib.c
++++ b/lib/libmt/mtlib.c
+@@ -48,7 +48,7 @@ __FBSDID("$FreeBSD: stable/10/lib/libmt/mtlib.c 280438 2015-03-24 14:36:10Z ken
+ #include <unistd.h>
+ #include <stdint.h>
+ #include <errno.h>
+-#include <bsdxml.h>
++#include <expat.h>
+ #include <mtlib.h>
+
+ /*
+diff --git a/lib/lib80211/lib80211_regdomain.c b/lib/lib80211/lib80211_regdomain.c
+index c500d3f..fe1d37e 100644
+--- a/lib/lib80211/lib80211_regdomain.c
++++ b/lib/lib80211/lib80211_regdomain.c
+@@ -40,7 +40,7 @@ static const char rcsid[] = "$FreeBSD: stable/11/lib/lib80211/lib80211_regdomain
+ #include <err.h>
+ #include <unistd.h>
+
+-#include <bsdxml.h>
++#include <expat.h>
+
+ #include "lib80211_regdomain.h"
+
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-11.0-libproc-libcxx.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-11.0-libproc-libcxx.patch
new file mode 100644
index 000000000000..013ad20619e5
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-11.0-libproc-libcxx.patch
@@ -0,0 +1,13 @@
+diff --git a/lib/libproc/Makefile b/lib/libproc/Makefile
+index e3b2578..acd76e8 100644
+--- a/lib/libproc/Makefile
++++ b/lib/libproc/Makefile
+@@ -18,7 +18,7 @@ CFLAGS+= -I${.CURDIR}
+
+ .if ${MK_CXX} == "no"
+ CFLAGS+= -DNO_CXA_DEMANGLE
+-.elif ${MK_LIBCPLUSPLUS} != "no"
++.elif ${COMPILER_TYPE} == "clang"
+ LIBADD+= cxxrt
+ .else
+ LIBADD+= supcplusplus
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-11.0-libsysdecode.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-11.0-libsysdecode.patch
new file mode 100644
index 000000000000..d90aa3163dae
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-11.0-libsysdecode.patch
@@ -0,0 +1,22 @@
+diff --git a/lib/libsysdecode/Makefile b/lib/libsysdecode/Makefile
+index e3bfe00..51fc5f0 100644
+--- a/lib/libsysdecode/Makefile
++++ b/lib/libsysdecode/Makefile
+@@ -8,7 +8,7 @@ LIB= sysdecode
+ SRCS= errno.c ioctl.c syscallnames.c utrace.c
+ INCS= sysdecode.h
+
+-CFLAGS+= -I${.CURDIR}/../../sys
++CFLAGS+= -I${.CURDIR}/../../sys -I${.CURDIR}
+
+ MAN+= sysdecode.3 \
+ sysdecode_abi_to_freebsd_errno.3 \
+@@ -37,7 +37,7 @@ CFLAGS.gcc+= ${CFLAGS.gcc.${.IMPSRC}}
+
+ ioctl.c: mkioctls
+ env MACHINE=${MACHINE} CPP="${CPP}" \
+- /bin/sh ${.CURDIR}/mkioctls ${DESTDIR}${INCLUDEDIR} > ${.TARGET}
++ /bin/sh ${.CURDIR}/mkioctls ${.CURDIR}/../../include > ${.TARGET}
+
+ beforedepend: ioctl.c
+
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-11.0-workaround.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-11.0-workaround.patch
new file mode 100644
index 000000000000..05f817eeb032
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-11.0-workaround.patch
@@ -0,0 +1,12 @@
+diff --git a/lib/libdevdctl/event.cc b/lib/libdevdctl/event.cc
+index a8cb447..d56df2e 100644
+--- a/lib/libdevdctl/event.cc
++++ b/lib/libdevdctl/event.cc
+@@ -50,6 +50,7 @@
+ #include <syslog.h>
+ #include <unistd.h>
+
++#include <cstdio>
+ #include <cstdarg>
+ #include <cstring>
+ #include <iostream>
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-11.1-liblink.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-11.1-liblink.patch
new file mode 100644
index 000000000000..b1fe7035b120
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-11.1-liblink.patch
@@ -0,0 +1,142 @@
+diff --git a/lib/libmt/Makefile b/lib/libmt/Makefile
+index a6efe28..f60919a 100644
+--- a/lib/libmt/Makefile
++++ b/lib/libmt/Makefile
+@@ -6,6 +6,7 @@ SHLIBDIR?= /lib
+ SRCS= mtlib.c
+ INCS= mtlib.h
+
++CFLAGS+= -I${.CURDIR}
+ LIBADD= sbuf bsdxml
+
+ MAN= mt.3
+diff --git a/lib/libsysdecode/Makefile b/lib/libsysdecode/Makefile
+index ce89201..ba78ae4 100644
+--- a/lib/libsysdecode/Makefile
++++ b/lib/libsysdecode/Makefile
+@@ -9,7 +9,7 @@ SRCS= errno.c flags.c ioctl.c signal.c syscallnames.c utrace.c
+ INCS= sysdecode.h
+
+ CFLAGS+= -I${.OBJDIR}
+-CFLAGS+= -I${SRCTOP}/sys
++CFLAGS+= -I${SRCTOP}/sys -I${.CURDIR}
+ CFLAGS+= -I${SRCTOP}/libexec/rtld-elf
+
+ MAN= sysdecode.3 \
+
+diff --git a/lib/libdpv/Makefile b/lib/libdpv/Makefile
+index 280f7de..d0663b0 100644
+--- a/lib/libdpv/Makefile
++++ b/lib/libdpv/Makefile
+@@ -11,6 +11,7 @@ LIBADD= dialog figpar util ncursesw
+
+ SRCS= dialog_util.c dialogrc.c dprompt.c dpv.c status.c util.c
+
+-CFLAGS+= -I${.CURDIR}
++CFLAGS+= -I${.CURDIR} -I${.CURDIR}/../libfigpar
++LDFLAGS+= -L${.OBJDIR}/../libfigpar
+
+ .include <bsd.lib.mk>
+diff --git a/lib/libcasper/libcasper/Makefile b/lib/libcasper/libcasper/Makefile
+index 1064ada..32a2e66 100644
+--- a/lib/libcasper/libcasper/Makefile
++++ b/lib/libcasper/libcasper/Makefile
+@@ -18,6 +18,7 @@ INCS+= libcasper_service.h
+ LIBADD= nv
+
+ CFLAGS+=-I${.CURDIR}
++LDFLAGS+=-L${.OBJDIR}/../../libnv
+
+ MAN+= libcasper.3
+
+diff --git a/lib/libcasper/services/cap_dns/Makefile b/lib/libcasper/services/cap_dns/Makefile
+index bf6bed5..baeecbe 100644
+--- a/lib/libcasper/services/cap_dns/Makefile
++++ b/lib/libcasper/services/cap_dns/Makefile
+@@ -14,5 +14,6 @@ INCS= cap_dns.h
+ LIBADD= nv
+
+ CFLAGS+=-I${.CURDIR}
++LDFLAGS+=-L${.OBJDIR}/../../../libnv
+
+ .include <bsd.lib.mk>
+diff --git a/lib/libcasper/services/cap_grp/Makefile b/lib/libcasper/services/cap_grp/Makefile
+index 78a860a..dfb4911 100644
+--- a/lib/libcasper/services/cap_grp/Makefile
++++ b/lib/libcasper/services/cap_grp/Makefile
+@@ -14,5 +14,6 @@ INCS= cap_grp.h
+ LIBADD= nv
+
+ CFLAGS+=-I${.CURDIR}
++LDFLAGS+=-L${.OBJDIR}/../../../libnv
+
+ .include <bsd.lib.mk>
+diff --git a/lib/libcasper/services/cap_pwd/Makefile b/lib/libcasper/services/cap_pwd/Makefile
+index e4df38b..64d7709 100644
+--- a/lib/libcasper/services/cap_pwd/Makefile
++++ b/lib/libcasper/services/cap_pwd/Makefile
+@@ -14,5 +14,6 @@ INCS= cap_pwd.h
+ LIBADD= nv
+
+ CFLAGS+=-I${.CURDIR}
++LDFLAGS+=-L${.OBJDIR}/../../../libnv
+
+ .include <bsd.lib.mk>
+diff --git a/lib/libcasper/services/cap_random/Makefile b/lib/libcasper/services/cap_random/Makefile
+index d69c160..658be9c 100644
+--- a/lib/libcasper/services/cap_random/Makefile
++++ b/lib/libcasper/services/cap_random/Makefile
+@@ -14,5 +14,6 @@ INCS= cap_random.h
+ LIBADD= nv
+
+ CFLAGS+=-I${.CURDIR}
++LDFLAGS+=-L${.OBJDIR}/../../../libnv
+
+ .include <bsd.lib.mk>
+diff --git a/lib/libcasper/services/cap_sysctl/Makefile b/lib/libcasper/services/cap_sysctl/Makefile
+index 2471e65..b20a342 100644
+--- a/lib/libcasper/services/cap_sysctl/Makefile
++++ b/lib/libcasper/services/cap_sysctl/Makefile
+@@ -14,5 +14,6 @@ INCS= cap_sysctl.h
+ LIBADD= nv
+
+ CFLAGS+=-I${.CURDIR}
++LDFLAGS+=-L${.OBJDIR}/../../../libnv
+
+ .include <bsd.lib.mk>
+diff --git a/lib/libc/Makefile b/lib/libc/Makefile
+index 1cf73a7..f1c2bc8 100644
+--- a/lib/libc/Makefile
++++ b/lib/libc/Makefile
+@@ -51,6 +51,7 @@ CFLAGS+=${CANCELPOINTS_CFLAGS}
+ #
+ LDFLAGS+= -nodefaultlibs
+ LIBADD+= compiler_rt
++LDFLAGS+= -L${.OBJDIR}/../libcompiler_rt
+
+ .if ${MK_SSP} != "no"
+ LIBADD+= ssp_nonshared
+diff --git a/lib/libcompiler_rt/Makefile b/lib/libcompiler_rt/Makefile
+index 4da1166..b34297a 100644
+--- a/lib/libcompiler_rt/Makefile
++++ b/lib/libcompiler_rt/Makefile
+@@ -11,6 +11,7 @@ CFLAGS+= ${PICFLAG}
+ CFLAGS+= -fvisibility=hidden
+ CFLAGS+= -DVISIBILITY_HIDDEN
+ CFLAGS+= -I${SRCTOP}/contrib/libcxxrt
++LDFLAGS+= -L${.OBJDIR}/../libc
+
+ .if ${COMPILER_TYPE} == "clang"
+ CWARNFLAGS.gcc_personality_v0.c+= -Wno-typedef-redefinition
+diff --git a/lib/libcam/Makefile b/lib/libcam/Makefile
+index 310c9a2..86a5e8c 100644
+--- a/lib/libcam/Makefile
++++ b/lib/libcam/Makefile
+@@ -40,6 +40,7 @@ MLINKS+= cam.3 cam_open_device.3 \
+ ${SRCTOP}/sys/cam
+
+ CFLAGS+= -I${.CURDIR} -I${SRCTOP}/sys
++LDFLAGS+= -L${.OBJDIR}/../libsbuf
+
+ SHLIB_MAJOR= 7
+
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-6.0-flex-2.5.31.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-6.0-flex-2.5.31.patch
new file mode 100644
index 000000000000..00de8a6debb8
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-6.0-flex-2.5.31.patch
@@ -0,0 +1,13 @@
+Index: fbsd-6/lib/libipsec/policy_token.l
+===================================================================
+--- fbsd-6.orig/lib/libipsec/policy_token.l
++++ fbsd-6/lib/libipsec/policy_token.l
+@@ -138,8 +138,6 @@ void
+ __policy__strbuffer__init__(msg)
+ char *msg;
+ {
+- if (yy_current_buffer)
+- yy_delete_buffer(yy_current_buffer);
+ strbuffer = (YY_BUFFER_STATE)yy_scan_string(msg);
+ yy_switch_to_buffer(strbuffer);
+
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-6.0-gccfloat.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-6.0-gccfloat.patch
new file mode 100644
index 000000000000..a3e7d5e1b63c
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-6.0-gccfloat.patch
@@ -0,0 +1,16 @@
+This patch is needed to avoid inclusion of GCC's float.h that defines
+LDBL_MANT_DIG at 53 (while the source file checks for 113 or 64.
+
+Index: freebsd-6.0_beta4/lib/msun/src/s_fmal.c
+===================================================================
+--- freebsd-6.0_beta4.orig/lib/msun/src/s_fmal.c
++++ freebsd-6.0_beta4/lib/msun/src/s_fmal.c
+@@ -28,7 +28,7 @@
+ __FBSDID("$FreeBSD: src/lib/msun/src/s_fmal.c,v 1.2 2005/03/18 02:27:59 das Exp $");
+
+ #include <fenv.h>
+-#include <float.h>
++#include <machine/float.h>
+ #include <math.h>
+
+ /*
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-6.0-pmc.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-6.0-pmc.patch
new file mode 100644
index 000000000000..2f6de4652822
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-6.0-pmc.patch
@@ -0,0 +1,13 @@
+Index: freebsd-6.0_beta4/lib/libpmc/Makefile
+===================================================================
+--- freebsd-6.0_beta4.orig/lib/libpmc/Makefile
++++ freebsd-6.0_beta4/lib/libpmc/Makefile
+@@ -9,6 +9,8 @@ WARNS?= 6
+
+ MAN= pmc.3 pmclog.3
+
++CFLAGS+= -I${.CURDIR}
++
+ MLINKS+= \
+ pmc.3 pmc_allocate.3 \
+ pmc.3 pmc_attach.3 \
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-6.1-csu.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-6.1-csu.patch
new file mode 100644
index 000000000000..075f2780e693
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-6.1-csu.patch
@@ -0,0 +1,20 @@
+--- lib/csu/amd64/Makefile.orig 2006-07-04 07:49:58 -0300
++++ lib/csu/amd64/Makefile 2006-07-04 07:50:15 -0300
+@@ -16,6 +16,7 @@
+ ${CC} ${CFLAGS} -DGCRT -c -o gcrt1.o ${.CURDIR}/crt1.c
+
+ realinstall:
++ ${INSTALL} -d ${DESTDIR}${LIBDIR}
+ ${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
+ ${OBJS} ${DESTDIR}${LIBDIR}
+
+--- lib/csu/sparc64/Makefile.orig 2006-10-06 15:13:55 +0100
++++ lib/csu/sparc64/Makefile 2006-10-06 15:15:06 +0100
+@@ -15,6 +15,7 @@
+ ${CC} ${CFLAGS} -DGCRT -c -o gcrt1.o ${.ALLSRC}
+
+ realinstall:
++ ${INSTALL} -d ${DESTDIR}${LIBDIR}
+ ${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
+ ${OBJS} ${DESTDIR}${LIBDIR}
+
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-6.2-bluetooth.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-6.2-bluetooth.patch
new file mode 100644
index 000000000000..a9b8435eff66
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-6.2-bluetooth.patch
@@ -0,0 +1,11 @@
+--- lib/libsdp/Makefile 2007-06-15 12:04:37 +0200
++++ lib.sdp/libsdp/Makefile 2007-06-15 12:26:14 +0200
+@@ -5,7 +5,7 @@
+ MAN= sdp.3
+
+ WARNS?= 2
+-CFLAGS+= -I${.CURDIR}
++CFLAGS+= -I${.CURDIR} -I${.CURDIR}/../libbluetooth
+
+ SHLIB_MAJOR= 2
+
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-7.1-types.h-fix.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-7.1-types.h-fix.patch
new file mode 100644
index 000000000000..8de5df2d16a6
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-7.1-types.h-fix.patch
@@ -0,0 +1,15 @@
+Fixes a compile error if XOPEN_SOURCE 600 is defined.
+
+See: http://www.mailinglistarchive.com/freebsd-current@freebsd.org/msg15011.html
+
+--- sys/sys/types.h.orig
++++ sys/sys/types.h
+@@ -46,7 +46,7 @@
+
+ #include <sys/_pthreadtypes.h>
+
+-#if __BSD_VISIBLE
++#ifndef _POSIX_SOURCE
+ typedef unsigned char u_char;
+ typedef unsigned short u_short;
+ typedef unsigned int u_int;
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-8.0-gcc45.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-8.0-gcc45.patch
new file mode 100644
index 000000000000..2ddb9eadb909
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-8.0-gcc45.patch
@@ -0,0 +1,28 @@
+diff -Nur work.orig/include/rpcsvc/nis.x work/include/rpcsvc/nis.x
+--- work.orig/include/rpcsvc/nis.x 2009-10-25 10:10:29.000000000 +0900
++++ work/include/rpcsvc/nis.x 2011-04-13 21:25:13.000000000 +0900
+@@ -399,10 +399,7 @@
+ %#define OARIGHTS(d, n) (((d)->do_armask.do_armask_val+n)->oa_rights)
+ %#define WORLD_DEFAULT (NIS_READ_ACC)
+ %#define GROUP_DEFAULT (NIS_READ_ACC << 8)
+-%#define OWNER_DEFAULT ((NIS_READ_ACC +\
+- NIS_MODIFY_ACC +\
+- NIS_CREATE_ACC +\
+- NIS_DESTROY_ACC) << 16)
++%#define OWNER_DEFAULT ((NIS_READ_ACC + NIS_MODIFY_ACC + NIS_CREATE_ACC + NIS_DESTROY_ACC) << 16)
+ %#define DEFAULT_RIGHTS (WORLD_DEFAULT | GROUP_DEFAULT | OWNER_DEFAULT)
+ %
+ %/* Result manipulation defines ... */
+@@ -431,10 +428,8 @@
+ % * these definitions they take an nis_object *, and an int and return
+ % * a u_char * for Value, and an int for length.
+ % */
+-%#define ENTRY_VAL(obj, col) \
+- (obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_val
+-%#define ENTRY_LEN(obj, col) \
+- (obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_len
++%#define ENTRY_VAL(obj, col) (obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_val
++%#define ENTRY_LEN(obj, col) (obj)->EN_data.en_cols.en_cols_val[col].ec_value.ec_value_len
+ %
+ %#ifdef __cplusplus
+ %}
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-8.0-log2.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-8.0-log2.patch
new file mode 100644
index 000000000000..a9fd18998287
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-8.0-log2.patch
@@ -0,0 +1,21 @@
+log2 and log2f are required by C99 and are not implemented.
+Workaround the deficiency.
+
+--- lib/msun/src/math.h.old 2010-03-14 17:02:25.000000000 +0100
++++ lib/msun/src/math.h 2010-03-14 17:07:03.000000000 +0100
+@@ -203,6 +203,7 @@
+ double frexp(double, int *); /* fundamentally !__pure2 */
+ double ldexp(double, int);
+ double log(double);
++#define log2(x) log(x)/log(2.0)
+ double log10(double);
+ double modf(double, double *); /* fundamentally !__pure2 */
+
+@@ -319,6 +320,7 @@
+ float log10f(float);
+ float log1pf(float);
+ float logf(float);
++#define log2f(x) logf(x)/logf(2.0)
+ float modff(float, float *); /* fundamentally !__pure2 */
+
+ float powf(float, float);
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-8.0-rpcsec_gss.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-8.0-rpcsec_gss.patch
new file mode 100644
index 000000000000..a7de06fadf56
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-8.0-rpcsec_gss.patch
@@ -0,0 +1,12 @@
+Without this linking fails during a stage3 build.
+
+--- lib/librpcsec_gss/Makefile.orig
++++ lib/librpcsec_gss/Makefile
+@@ -8,6 +8,7 @@
+
+ DPADD+= ${LIBGSSAPI}
+ LDADD+= -lgssapi
++LDFLAGS+= -L${.OBJDIR}/../libgssapi
+
+ VERSION_DEF= ${.CURDIR}/../libc/Versions.def
+ SYMBOL_MAPS= ${.CURDIR}/Symbol.map
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-8.2-liblink.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-8.2-liblink.patch
new file mode 100644
index 000000000000..c8be7f48472e
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-8.2-liblink.patch
@@ -0,0 +1,19 @@
+--- lib/libproc/Makefile.old 2011-07-06 00:58:04.000000000 +0000
++++ lib/libproc/Makefile 2011-07-06 00:58:58.000000000 +0000
+@@ -18,5 +18,6 @@
+ WARNS?= 6
+
+ WITHOUT_MAN= yes
++LDADD=-lelf
+
+ .include <bsd.lib.mk>
+--- lib/librtld_db/Makefile.old 2011-07-06 00:58:12.000000000 +0000
++++ lib/librtld_db/Makefile 2011-07-06 00:59:27.000000000 +0000
+@@ -10,5 +10,7 @@
+ INCS= rtld_db.h
+
+ CFLAGS+= -I${.CURDIR}
++LDADD=-lutil -lproc
++LDFLAGS+=-L${.CURDIR}/../libutil -L${.CURDIR}/../libproc
+
+ .include <bsd.lib.mk>
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-8.2-nlm_syscall.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-8.2-nlm_syscall.patch
new file mode 100644
index 000000000000..556ade50b033
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-8.2-nlm_syscall.patch
@@ -0,0 +1,10 @@
+--- include/unistd.h 2010/12/20 20:39:49 216602
++++ include/unistd.h 2010/12/20 21:12:18 216603
+@@ -529,6 +529,7 @@
+ #define _MKTEMP_DECLARED
+ #endif
+ int nfssvc(int, void *);
++int nlm_syscall(int, int, int, char **);
+ int profil(char *, size_t, vm_offset_t, int);
+ int rcmd(char **, int, const char *, const char *, const char *, int *);
+ int rcmd_af(char **, int, const char *,
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-9.0-bluetooth.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-9.0-bluetooth.patch
new file mode 100644
index 000000000000..cf1172ab6335
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-9.0-bluetooth.patch
@@ -0,0 +1,12 @@
+diff -Nur lib.orig/libsdp/Makefile lib/libsdp/Makefile
+--- lib.orig/libsdp/Makefile 2012-12-25 20:28:50.000000000 +0900
++++ lib/libsdp/Makefile 2012-12-25 20:31:19.000000000 +0900
+@@ -5,7 +5,7 @@
+ MAN= sdp.3
+
+ WARNS?= 2
+-CFLAGS+= -I${.CURDIR}
++CFLAGS+= -I${.CURDIR} -I${.CURDIR}/../libbluetooth
+
+ SHLIB_MAJOR= 4
+
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-9.0-cve-2010-2632.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-9.0-cve-2010-2632.patch
new file mode 100644
index 000000000000..ad9b9608f42c
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-9.0-cve-2010-2632.patch
@@ -0,0 +1,215 @@
+Index: lib/libc/gen/glob.c
+===================================================================
+--- lib/libc/gen/glob.c (revision 246357)
++++ lib/libc/gen/glob.c (working copy)
+@@ -94,6 +94,25 @@ __FBSDID("$FreeBSD$");
+
+ #include "collate.h"
+
++/*
++ * glob(3) expansion limits. Stop the expansion if any of these limits
++ * is reached. This caps the runtime in the face of DoS attacks. See
++ * also CVE-2010-2632
++ */
++#define GLOB_LIMIT_BRACE 128 /* number of brace calls */
++#define GLOB_LIMIT_PATH 65536 /* number of path elements */
++#define GLOB_LIMIT_READDIR 16384 /* number of readdirs */
++#define GLOB_LIMIT_STAT 1024 /* number of stat system calls */
++#define GLOB_LIMIT_STRING ARG_MAX /* maximum total size for paths */
++
++struct glob_limit {
++ size_t l_brace_cnt;
++ size_t l_path_lim;
++ size_t l_readdir_cnt;
++ size_t l_stat_cnt;
++ size_t l_string_cnt;
++};
++
+ #define DOLLAR '$'
+ #define DOT '.'
+ #define EOS '\0'
+@@ -153,15 +172,18 @@ static const Char *g_strchr(const Char *, wchar_t)
+ static Char *g_strcat(Char *, const Char *);
+ #endif
+ static int g_stat(Char *, struct stat *, glob_t *);
+-static int glob0(const Char *, glob_t *, size_t *);
+-static int glob1(Char *, glob_t *, size_t *);
+-static int glob2(Char *, Char *, Char *, Char *, glob_t *, size_t *);
+-static int glob3(Char *, Char *, Char *, Char *, Char *, glob_t *, size_t *);
+-static int globextend(const Char *, glob_t *, size_t *);
+-static const Char *
++static int glob0(const Char *, glob_t *, struct glob_limit *);
++static int glob1(Char *, glob_t *, struct glob_limit *);
++static int glob2(Char *, Char *, Char *, Char *, glob_t *,
++ struct glob_limit *);
++static int glob3(Char *, Char *, Char *, Char *, Char *, glob_t *,
++ struct glob_limit *);
++static int globextend(const Char *, glob_t *, struct glob_limit *);
++static const Char *
+ globtilde(const Char *, Char *, size_t, glob_t *);
+-static int globexp1(const Char *, glob_t *, size_t *);
+-static int globexp2(const Char *, const Char *, glob_t *, int *, size_t *);
++static int globexp1(const Char *, glob_t *, struct glob_limit *);
++static int globexp2(const Char *, const Char *, glob_t *, int *,
++ struct glob_limit *);
+ static int match(Char *, Char *, Char *);
+ #ifdef DEBUG
+ static void qprintf(const char *, Char *);
+@@ -171,8 +193,8 @@ int
+ glob(const char * __restrict pattern, int flags,
+ int (*errfunc)(const char *, int), glob_t * __restrict pglob)
+ {
++ struct glob_limit limit = { 0, 0, 0, 0, 0 };
+ const char *patnext;
+- size_t limit;
+ Char *bufnext, *bufend, patbuf[MAXPATHLEN], prot;
+ mbstate_t mbs;
+ wchar_t wc;
+@@ -186,11 +208,10 @@ glob(const char * __restrict pattern, int flags,
+ pglob->gl_offs = 0;
+ }
+ if (flags & GLOB_LIMIT) {
+- limit = pglob->gl_matchc;
+- if (limit == 0)
+- limit = ARG_MAX;
+- } else
+- limit = 0;
++ limit.l_path_lim = pglob->gl_matchc;
++ if (limit.l_path_lim == 0)
++ limit.l_path_lim = GLOB_LIMIT_PATH;
++ }
+ pglob->gl_flags = flags & ~GLOB_MAGCHAR;
+ pglob->gl_errfunc = errfunc;
+ pglob->gl_matchc = 0;
+@@ -243,11 +264,17 @@ glob(const char * __restrict pattern, int flags,
+ * characters
+ */
+ static int
+-globexp1(const Char *pattern, glob_t *pglob, size_t *limit)
++globexp1(const Char *pattern, glob_t *pglob, struct glob_limit *limit)
+ {
+ const Char* ptr = pattern;
+ int rv;
+
++ if ((pglob->gl_flags & GLOB_LIMIT) &&
++ limit->l_brace_cnt++ >= GLOB_LIMIT_BRACE) {
++ errno = 0;
++ return (GLOB_NOSPACE);
++ }
++
+ /* Protect a single {}, for find(1), like csh */
+ if (pattern[0] == LBRACE && pattern[1] == RBRACE && pattern[2] == EOS)
+ return glob0(pattern, pglob, limit);
+@@ -266,7 +293,8 @@ static int
+ * If it fails then it tries to glob the rest of the pattern and returns.
+ */
+ static int
+-globexp2(const Char *ptr, const Char *pattern, glob_t *pglob, int *rv, size_t *limit)
++globexp2(const Char *ptr, const Char *pattern, glob_t *pglob, int *rv,
++ struct glob_limit *limit)
+ {
+ int i;
+ Char *lm, *ls;
+@@ -436,7 +464,7 @@ globtilde(const Char *pattern, Char *patbuf, size_
+ * if things went well, nonzero if errors occurred.
+ */
+ static int
+-glob0(const Char *pattern, glob_t *pglob, size_t *limit)
++glob0(const Char *pattern, glob_t *pglob, struct glob_limit *limit)
+ {
+ const Char *qpatnext;
+ int err;
+@@ -529,7 +557,7 @@ compare(const void *p, const void *q)
+ }
+
+ static int
+-glob1(Char *pattern, glob_t *pglob, size_t *limit)
++glob1(Char *pattern, glob_t *pglob, struct glob_limit *limit)
+ {
+ Char pathbuf[MAXPATHLEN];
+
+@@ -547,7 +575,7 @@ static int
+ */
+ static int
+ glob2(Char *pathbuf, Char *pathend, Char *pathend_last, Char *pattern,
+- glob_t *pglob, size_t *limit)
++ glob_t *pglob, struct glob_limit *limit)
+ {
+ struct stat sb;
+ Char *p, *q;
+@@ -563,6 +591,15 @@ glob2(Char *pathbuf, Char *pathend, Char *pathend_
+ if (g_lstat(pathbuf, &sb, pglob))
+ return(0);
+
++ if ((pglob->gl_flags & GLOB_LIMIT) &&
++ limit->l_stat_cnt++ >= GLOB_LIMIT_STAT) {
++ errno = 0;
++ if (pathend + 1 > pathend_last)
++ return (GLOB_ABORTED);
++ *pathend++ = SEP;
++ *pathend = EOS;
++ return (GLOB_NOSPACE);
++ }
+ if (((pglob->gl_flags & GLOB_MARK) &&
+ pathend[-1] != SEP) && (S_ISDIR(sb.st_mode)
+ || (S_ISLNK(sb.st_mode) &&
+@@ -606,7 +643,7 @@ glob2(Char *pathbuf, Char *pathend, Char *pathend_
+ static int
+ glob3(Char *pathbuf, Char *pathend, Char *pathend_last,
+ Char *pattern, Char *restpattern,
+- glob_t *pglob, size_t *limit)
++ glob_t *pglob, struct glob_limit *limit)
+ {
+ struct dirent *dp;
+ DIR *dirp;
+@@ -652,6 +689,19 @@ glob3(Char *pathbuf, Char *pathend, Char *pathend_
+ size_t clen;
+ mbstate_t mbs;
+
++ if ((pglob->gl_flags & GLOB_LIMIT) &&
++ limit->l_readdir_cnt++ >= GLOB_LIMIT_READDIR) {
++ errno = 0;
++ if (pathend + 1 > pathend_last)
++ err = GLOB_ABORTED;
++ else {
++ *pathend++ = SEP;
++ *pathend = EOS;
++ err = GLOB_NOSPACE;
++ }
++ break;
++ }
++
+ /* Initial DOT must be matched literally. */
+ if (dp->d_name[0] == DOT && *pattern != DOT)
+ continue;
+@@ -702,14 +752,15 @@ glob3(Char *pathbuf, Char *pathend, Char *pathend_
+ * gl_pathv points to (gl_offs + gl_pathc + 1) items.
+ */
+ static int
+-globextend(const Char *path, glob_t *pglob, size_t *limit)
++globextend(const Char *path, glob_t *pglob, struct glob_limit *limit)
+ {
+ char **pathv;
+ size_t i, newsize, len;
+ char *copy;
+ const Char *p;
+
+- if (*limit && pglob->gl_pathc > *limit) {
++ if ((pglob->gl_flags & GLOB_LIMIT) &&
++ pglob->gl_matchc > limit->l_path_lim) {
+ errno = 0;
+ return (GLOB_NOSPACE);
+ }
+@@ -737,6 +788,12 @@ static int
+ for (p = path; *p++;)
+ continue;
+ len = MB_CUR_MAX * (size_t)(p - path); /* XXX overallocation */
++ limit->l_string_cnt += len;
++ if ((pglob->gl_flags & GLOB_LIMIT) &&
++ limit->l_string_cnt >= GLOB_LIMIT_STRING) {
++ errno = 0;
++ return (GLOB_NOSPACE);
++ }
+ if ((copy = malloc(len)) != NULL) {
+ if (g_Ctoc(path, copy, len)) {
+ free(copy);
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-9.0-liblink.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-9.0-liblink.patch
new file mode 100644
index 000000000000..f8e470736c64
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-9.0-liblink.patch
@@ -0,0 +1,21 @@
+diff -uNr lib.ol/libproc/Makefile lib/libproc/Makefile
+--- lib.ol/libproc/Makefile 2011-11-02 14:02:17.000000000 +0000
++++ lib/libproc/Makefile 2011-11-02 14:03:09.000000000 +0000
+@@ -16,5 +16,6 @@
+ SHLIB_MAJOR= 2
+
+ WITHOUT_MAN=
++LDADD+=-lelf
+
+ .include <bsd.lib.mk>
+diff -uNr lib.ol/librtld_db/Makefile lib/librtld_db/Makefile
+--- lib.ol/librtld_db/Makefile 2011-11-02 14:02:13.000000000 +0000
++++ lib/librtld_db/Makefile 2011-11-02 14:04:00.000000000 +0000
+@@ -10,5 +10,7 @@
+ INCS= rtld_db.h
+
+ CFLAGS+= -I${.CURDIR}
++LDADD+=-lutil -lproc
++LDFLAGS+=-L${.OBJDIR}/../libutil -L${.OBJDIR}/../libproc
+
+ .include <bsd.lib.mk>
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-9.0-netware.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-9.0-netware.patch
new file mode 100644
index 000000000000..c1c2a0e04560
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-9.0-netware.patch
@@ -0,0 +1,11 @@
+diff -Nur lib.orig/libncp/Makefile lib/libncp/Makefile
+--- lib.orig/libncp/Makefile 2012-12-25 20:35:16.000000000 +0900
++++ lib/libncp/Makefile 2012-12-25 20:36:23.000000000 +0900
+@@ -6,6 +6,7 @@
+
+ DPADD= ${LIBIPX}
+ LDADD= -lipx
++LDFLAGS+=-L${.OBJDIR}/../libipx
+
+ SRCS= ncpl_subr.c ncpl_bind.c ncpl_queue.c ncpl_file.c ncpl_misc.c \
+ ncpl_net.c ncpl_rcfile.c ncpl_conn.c ncpl_nls.c ncpl_msg.c \
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-9.0-opieincludes.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-9.0-opieincludes.patch
new file mode 100644
index 000000000000..bf77a0a5219f
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-9.0-opieincludes.patch
@@ -0,0 +1,122 @@
+Fixes warnings like:
+/var/tmp/portage/sys-freebsd/freebsd-lib-9.0-r2/work/lib/libopie/../../contrib/opie/libopie/randomchallenge.c:43:5:
+warning: incompatible implicit declaration of built-in function ‘strcpy’
+
+diff -uNr contrib.old/opie/libopie/accessfile.c contrib/opie/libopie/accessfile.c
+--- contrib.old/opie/libopie/accessfile.c 2012-05-25 08:54:33.000000000 -0400
++++ contrib/opie/libopie/accessfile.c 2012-05-25 09:12:34.000000000 -0400
+@@ -46,6 +46,7 @@
+ #ifdef DEBUG
+ #include <syslog.h>
+ #endif /* DEBUG */
++#include <ctype.h>
+
+ #include "opie.h"
+
+diff -uNr contrib.old/opie/libopie/generator.c contrib/opie/libopie/generator.c
+--- contrib.old/opie/libopie/generator.c 2012-05-25 08:54:33.000000000 -0400
++++ contrib/opie/libopie/generator.c 2012-05-25 08:58:10.000000000 -0400
+@@ -50,6 +50,7 @@
+ #include <syslog.h>
+ #endif /* DEBUG */
+ #include "opie.h"
++#include <stdio.h>
+
+ static char *algids[] = { NULL, NULL, NULL, "sha1", "md4", "md5" };
+
+diff -uNr contrib.old/opie/libopie/lookup.c contrib/opie/libopie/lookup.c
+--- contrib.old/opie/libopie/lookup.c 2012-05-25 08:54:33.000000000 -0400
++++ contrib/opie/libopie/lookup.c 2012-05-25 09:15:08.000000000 -0400
+@@ -14,6 +14,7 @@
+ #include "opie_cfg.h"
+ #include <stdio.h>
+ #include "opie.h"
++#include <string.h>
+
+ int opielookup FUNCTION((opie, principal), struct opie *opie AND char *principal)
+ {
+diff -uNr contrib.old/opie/libopie/newseed.c contrib/opie/libopie/newseed.c
+--- contrib.old/opie/libopie/newseed.c 2012-05-25 08:54:33.000000000 -0400
++++ contrib/opie/libopie/newseed.c 2012-05-25 09:14:37.000000000 -0400
+@@ -36,6 +36,9 @@
+ #include <syslog.h>
+ #endif /* DEBUG */
+ #include "opie.h"
++#include <stdio.h>
++#include <stdlib.h>
++#include <time.h>
+
+ int opienewseed FUNCTION((seed), char *seed)
+ {
+diff -uNr contrib.old/opie/libopie/parsechallenge.c contrib/opie/libopie/parsechallenge.c
+--- contrib.old/opie/libopie/parsechallenge.c 2012-05-25 08:54:33.000000000 -0400
++++ contrib/opie/libopie/parsechallenge.c 2012-05-25 09:15:54.000000000 -0400
+@@ -20,6 +20,8 @@
+ #include <string.h>
+ #endif /* HAVE_STRING_H */
+ #include "opie.h"
++#include <stdlib.h>
++#include <ctype.h>
+
+ struct algorithm {
+ char *name;
+diff -uNr contrib.old/opie/libopie/passwd.c contrib/opie/libopie/passwd.c
+--- contrib.old/opie/libopie/passwd.c 2012-05-25 08:54:33.000000000 -0400
++++ contrib/opie/libopie/passwd.c 2012-05-25 09:13:45.000000000 -0400
+@@ -22,6 +22,7 @@
+
+ #include "opie_cfg.h"
+ #include "opie.h"
++#include <string.h>
+
+ int opiepasswd FUNCTION((old, flags, principal, n, seed, ks), struct opie *old AND int flags AND char *principal AND int n AND char *seed AND char *ks)
+ {
+diff -uNr contrib.old/opie/libopie/randomchallenge.c contrib/opie/libopie/randomchallenge.c
+--- contrib.old/opie/libopie/randomchallenge.c 2012-05-25 08:54:33.000000000 -0400
++++ contrib/opie/libopie/randomchallenge.c 2012-05-25 09:00:27.000000000 -0400
+@@ -28,6 +28,9 @@
+
+ #include "opie_cfg.h"
+ #include "opie.h"
++#include <stdio.h>
++#include <string.h>
++#include <stdlib.h>
+
+ static char *algids[] = { 0, 0, 0, "sha1", "md4", "md5" };
+
+diff -uNr contrib.old/opie/libopie/verify.c contrib/opie/libopie/verify.c
+--- contrib.old/opie/libopie/verify.c 2012-05-25 08:54:33.000000000 -0400
++++ contrib/opie/libopie/verify.c 2012-05-25 09:12:09.000000000 -0400
+@@ -25,6 +25,7 @@
+ #include <string.h>
+ #endif /* HAVE_STRING_H */
+ #include "opie.h"
++#include <ctype.h>
+
+ #define RESPONSE_STANDARD 0
+ #define RESPONSE_WORD 1
+diff -uNr contrib.old/opie/libopie/version.c contrib/opie/libopie/version.c
+--- contrib.old/opie/libopie/version.c 2012-05-25 08:54:33.000000000 -0400
++++ contrib/opie/libopie/version.c 2012-05-25 09:13:15.000000000 -0400
+@@ -19,6 +19,8 @@
+ */
+ #include "opie_cfg.h"
+ #include "opie.h"
++#include <stdio.h>
++#include <stdlib.h>
+
+ VOIDRET opieversion FUNCTION_NOARGS
+ {
+diff -uNr contrib.old/opie/opie.h contrib/opie/opie.h
+--- contrib.old/opie/opie.h 2012-05-25 08:54:33.000000000 -0400
++++ contrib/opie/opie.h 2012-05-25 09:21:28.000000000 -0400
+@@ -158,6 +158,9 @@
+ int __opiereadrec __P((struct opie *));
+ int __opiewriterec __P((struct opie *));
+ int __opieparsechallenge __P((char *buffer, int *algorithm, int *sequence, char **seed, int *exts));
++VOIDRET opiehashlen FUNCTION((algorithm, in, out, n), int algorithm AND VOIDPTR in AND struct opie_otpkey *out AND int n);
++int opieinsecure FUNCTION_NOARGS;
++int opienewseed FUNCTION((seed), char *seed);
+ __END_DECLS
+
+ #define opiestrncpy(dst, src, n) \
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-9.1-.eh_frame_hdr-fix.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-9.1-.eh_frame_hdr-fix.patch
new file mode 100644
index 000000000000..fdb7e16f6e08
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-9.1-.eh_frame_hdr-fix.patch
@@ -0,0 +1,17 @@
+Fix "no .eh_frame_hdr table will be created" error.
+
+http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47829
+http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/4a0e0cd7377c45dc21d5c71bcab931b5e5727e74
+
+diff -Nur lib.orig/csu/i386-elf/Makefile lib/csu/i386-elf/Makefile
+--- lib.orig/csu/i386-elf/Makefile 2013-03-06 01:07:57.000000000 +0900
++++ lib/csu/i386-elf/Makefile 2013-03-06 01:10:09.000000000 +0900
+@@ -10,6 +10,8 @@
+ FILESDIR= ${LIBDIR}
+ CFLAGS+= -I${.CURDIR}/../common \
+ -I${.CURDIR}/../../libc/include
++CFLAGS+= -fno-omit-frame-pointer
++CFLAGS+= -fno-asynchronous-unwind-tables
+ CLEANFILES= ${FILES} crt1_c.o crt1_s.o gcrt1_c.o Scrt1_c.o
+ CLEANFILES+= crt1_c.s gcrt1_c.s Scrt1_c.s
+
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-9.1-aligned_alloc.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-9.1-aligned_alloc.patch
new file mode 100644
index 000000000000..97ac14160b87
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-9.1-aligned_alloc.patch
@@ -0,0 +1,51 @@
+Backport aligned_alloc for C++11 support.
+
+http://lists.freebsd.org/pipermail/svn-src-stable-9/2012-November/003313.html
+
+diff -uNr lib.old/libc/stdlib/Symbol.map lib/libc/stdlib/Symbol.map
+--- lib.old/libc/stdlib/Symbol.map 2013-05-24 17:03:55.000000000 -0400
++++ lib/libc/stdlib/Symbol.map 2013-05-24 17:06:03.000000000 -0400
+@@ -97,6 +97,7 @@
+ atoi_l;
+ atol_l;
+ atoll_l;
++ aligned_alloc;
+ at_quick_exit;
+ quick_exit;
+ strtod_l;
+diff -uNr lib.old/libc/stdlib/malloc.c lib/libc/stdlib/malloc.c
+--- lib.old/libc/stdlib/malloc.c 2013-05-24 17:03:55.000000000 -0400
++++ lib/libc/stdlib/malloc.c 2013-05-24 17:05:40.000000000 -0400
+@@ -6046,6 +6046,21 @@
+ }
+
+ void *
++aligned_alloc(size_t alignment, size_t size)
++{
++ void *memptr;
++ int ret;
++
++ ret = posix_memalign(&memptr, alignment, size);
++ if (ret != 0) {
++ errno = ret;
++ return (NULL);
++ }
++ return (memptr);
++}
++
++
++void *
+ calloc(size_t num, size_t size)
+ {
+ void *ret;
+diff -uNr includeold/stdlib.h include/stdlib.h
+--- includeold/stdlib.h 2013-05-24 17:03:46.000000000 -0400
++++ include/stdlib.h 2013-05-24 17:04:46.000000000 -0400
+@@ -155,6 +155,7 @@
+ * If we're in a mode greater than C99, expose C1x functions.
+ */
+ #if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L
++void * aligned_alloc(size_t, size_t);
+ _Noreturn void
+ quick_exit(int);
+ int at_quick_exit(void (*)(void));
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-9.1-rmgssapi.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-9.1-rmgssapi.patch
new file mode 100644
index 000000000000..62357e0830db
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-9.1-rmgssapi.patch
@@ -0,0 +1,16 @@
+--- include/Makefile.orig 2013-06-16 10:47:52.000000000 +0200
++++ include/Makefile 2013-06-16 10:47:37.000000000 +0200
+@@ -6,11 +6,11 @@
+ .include <bsd.own.mk>
+
+ CLEANFILES= osreldate.h version vers.c
++SUBDIR= arpa protocols rpcsvc rpc xlocale
+-SUBDIR= arpa gssapi protocols rpcsvc rpc xlocale
+ INCS= a.out.h ar.h assert.h bitstring.h complex.h cpio.h _ctype.h ctype.h \
+ db.h \
+ dirent.h dlfcn.h elf.h elf-hints.h err.h fmtmsg.h fnmatch.h fstab.h \
++ fts.h ftw.h getopt.h glob.h grp.h \
+- fts.h ftw.h getopt.h glob.h grp.h gssapi.h \
+ ieeefp.h ifaddrs.h \
+ inttypes.h iso646.h kenv.h langinfo.h libgen.h limits.h link.h \
+ locale.h malloc.h malloc_np.h memory.h monetary.h mpool.h mqueue.h \
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-add-nossp-cflags.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-add-nossp-cflags.patch
new file mode 100644
index 000000000000..00b39f750ec1
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-add-nossp-cflags.patch
@@ -0,0 +1,30 @@
+Please do not disable this patch.
+All commands will be non-executable.
+Abort trap: 6 (core dumped) is displayed...
+
+Details see Gentoo Bug #511698.
+https://bugs.gentoo.org/show_bug.cgi?id=511698
+
+diff --git a/lib/libc/Makefile b/lib/libc/Makefile
+index 1cc23b7..7dd458e 100644
+--- a/lib/libc/Makefile
++++ b/lib/libc/Makefile
+@@ -149,6 +149,6 @@ CWARNFLAGS:= ${.IMPSRC:Ngdtoa_*.c:C/^.+$/${CWARNFLAGS}/:C/^$/-w/}
+ # in the future to circumvent this.
+ SSP_CFLAGS:= ${SSP_CFLAGS:S/^-fstack-protector-all$/-fstack-protector/}
+ # Disable stack protection for SSP symbols.
+-SSP_CFLAGS:= ${.IMPSRC:N*/stack_protector.c:C/^.+$/${SSP_CFLAGS}/}
++SSP_CFLAGS:= ${.IMPSRC:N*/stack_protector.c:C/^.+$/${SSP_CFLAGS}/:C/^$/-fno-stack-protector/}
+ # Generate stack unwinding tables for cancellation points
+ CANCELPOINTS_CFLAGS:= ${.IMPSRC:Mcancelpoints_*:C/^.+$/${CANCELPOINTS_CFLAGS}/:C/^$//}
+diff --git a/lib/csu/Makefile.inc b/lib/csu/Makefile.inc
+index f92d87d..7a3a2f3 100644
+--- a/lib/csu/Makefile.inc
++++ b/lib/csu/Makefile.inc
+@@ -1,5 +1,5 @@
+ # $FreeBSD: release/9.1.0/lib/csu/Makefile.inc 204757 2010-03-05 13:29:05Z uqs $
+
+-SSP_CFLAGS=
++SSP_CFLAGS= -fno-stack-protector
+
+ .include "../Makefile.inc"
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-bsdxml2expat.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-bsdxml2expat.patch
new file mode 100644
index 000000000000..1b4e79129bfc
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-bsdxml2expat.patch
@@ -0,0 +1,26 @@
+diff -ur lib/libgeom.old/Makefile lib/libgeom/Makefile
+--- lib/libgeom.old/Makefile 2011-07-10 14:23:51.000000000 +0000
++++ lib/libgeom/Makefile 2011-07-10 15:12:39.000000000 +0000
+@@ -13,8 +13,8 @@
+
+ WARNS?= 3
+
+-DPADD= ${LIBBSDXML} ${LIBSBUF}
+-LDADD= -lbsdxml -lsbuf
++DPADD= ${LIBSBUF}
++LDADD= -lexpat -lsbuf
+
+ MAN= libgeom.3
+
+diff -ur lib/libgeom.old/geom_xml2tree.c lib/libgeom/geom_xml2tree.c
+--- lib/libgeom.old/geom_xml2tree.c 2010-12-21 17:09:25.000000000 +0000
++++ lib/libgeom/geom_xml2tree.c 2011-07-10 15:12:52.000000000 +0000
+@@ -43,7 +43,7 @@
+ #include <sys/sbuf.h>
+ #include <sys/sysctl.h>
+ #include <err.h>
+-#include <bsdxml.h>
++#include <expat.h>
+ #include <libgeom.h>
+
+ struct mystate {
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-lib-includes.patch b/sys-freebsd/freebsd-lib/files/freebsd-lib-includes.patch
new file mode 100644
index 000000000000..c2cf1421ea9e
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/freebsd-lib-includes.patch
@@ -0,0 +1,13 @@
+Fix headers dependencies so that they can be included alone.
+
+--- include/ifaddrs.h.old 2009-05-15 13:50:10 +0000
++++ include/ifaddrs.h 2009-05-15 13:50:23 +0000
+@@ -28,6 +28,8 @@
+ #ifndef _IFADDRS_H_
+ #define _IFADDRS_H_
+
++#include <sys/types.h>
++
+ struct ifaddrs {
+ struct ifaddrs *ifa_next;
+ char *ifa_name;
diff --git a/sys-freebsd/freebsd-lib/files/freebsd-sources-9.0-sysctluint.patch b/sys-freebsd/freebsd-lib/files/freebsd-sources-9.0-sysctluint.patch
new file mode 100644
index 000000000000..751a77c843bb
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/freebsd-sources-9.0-sysctluint.patch
@@ -0,0 +1,13 @@
+u_int is defined in sys/types.h
+makes header usable alone.
+
+--- sys/sys/sysctl.h.old 2012-05-25 11:08:53.000000000 -0400
++++ sys/sys/sysctl.h 2012-05-25 11:09:16.000000000 -0400
+@@ -788,6 +788,7 @@
+ struct sysctl_req *);
+ #else /* !_KERNEL */
+ #include <sys/cdefs.h>
++#include <sys/types.h> /* for u_int */
+
+ __BEGIN_DECLS
+ int sysctl(const int *, u_int, void *, size_t *, const void *, size_t);
diff --git a/sys-freebsd/freebsd-lib/files/ftpd.pamd b/sys-freebsd/freebsd-lib/files/ftpd.pamd
new file mode 100644
index 000000000000..8e9082373f8f
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/ftpd.pamd
@@ -0,0 +1,8 @@
+# PAM configuration for the "ftpd" service
+#
+
+auth include system-auth
+account include system-auth
+password include system-auth
+session include system-auth
+
diff --git a/sys-freebsd/freebsd-lib/files/libusb-1.0.pc.in b/sys-freebsd/freebsd-lib/files/libusb-1.0.pc.in
new file mode 100644
index 000000000000..058ecb4384a3
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/libusb-1.0.pc.in
@@ -0,0 +1,11 @@
+prefix=/usr
+exec_prefix=${prefix}
+libdir=@LIBDIR@
+includedir=${prefix}/include
+
+Name: libusb
+Description: USB access library (FreeBSD version)
+Version: 1.0.1
+Libs: -L${libdir} -lusb
+Cflags: -I${includedir}
+
diff --git a/sys-freebsd/freebsd-lib/files/libusb.pc.in b/sys-freebsd/freebsd-lib/files/libusb.pc.in
new file mode 100644
index 000000000000..f63c6e399816
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/libusb.pc.in
@@ -0,0 +1,11 @@
+prefix=/usr
+exec_prefix=${prefix}
+libdir=@LIBDIR@
+includedir=${prefix}/include
+
+Name: libusb
+Description: USB access library (FreeBSD version)
+Version: 0.1.12
+Libs: -L${libdir} -lusb
+Cflags: -I${includedir}
+
diff --git a/sys-freebsd/freebsd-lib/files/rquotad.xinetd b/sys-freebsd/freebsd-lib/files/rquotad.xinetd
new file mode 100644
index 000000000000..876cd16c53c2
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/rquotad.xinetd
@@ -0,0 +1,11 @@
+service rquotad
+{
+ type = rpc
+ socket_type = dgram
+ protocol = udp
+ wait = yes
+ user = root
+ server = /usr/libexec/rpc.rquotad
+ rpc_version = 1
+ disabled = yes
+}
diff --git a/sys-freebsd/freebsd-lib/files/rstatd.xinetd b/sys-freebsd/freebsd-lib/files/rstatd.xinetd
new file mode 100644
index 000000000000..ba1b819851eb
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/rstatd.xinetd
@@ -0,0 +1,11 @@
+service rstatd
+{
+ type = rpc
+ socket_type = dgram
+ protocol = udp
+ wait = yes
+ user = root
+ server = /usr/libexec/rpc.rstatd
+ rpc_version = 1-3
+ disabled = yes
+}
diff --git a/sys-freebsd/freebsd-lib/files/rusersd.xinetd b/sys-freebsd/freebsd-lib/files/rusersd.xinetd
new file mode 100644
index 000000000000..5cbe091881e8
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/rusersd.xinetd
@@ -0,0 +1,11 @@
+service rusersd
+{
+ type = rpc
+ socket_type = dgram
+ protocol = udp
+ wait = yes
+ user = root
+ server = /usr/libexec/rpc.rusersd
+ rpc_version = 1-2
+ disabled = yes
+}
diff --git a/sys-freebsd/freebsd-lib/files/sprayd.xinetd b/sys-freebsd/freebsd-lib/files/sprayd.xinetd
new file mode 100644
index 000000000000..7be55771ac22
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/sprayd.xinetd
@@ -0,0 +1,11 @@
+service sprayd
+{
+ type = rpc
+ socket_type = dgram
+ protocol = udp
+ wait = yes
+ user = root
+ server = /usr/libexec/rpc.sprayd
+ rpc_version = 1
+ disabled = yes
+}
diff --git a/sys-freebsd/freebsd-lib/files/walld.xinetd b/sys-freebsd/freebsd-lib/files/walld.xinetd
new file mode 100644
index 000000000000..800b84fa21e6
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/files/walld.xinetd
@@ -0,0 +1,11 @@
+service walld
+{
+ type = rpc
+ socket_type = dgram
+ protocol = udp
+ wait = yes
+ user = root
+ server = /usr/libexec/rpc.rwalld
+ rpc_version = 1
+ disabled = yes
+}
diff --git a/sys-freebsd/freebsd-lib/freebsd-lib-10.3-r3.ebuild b/sys-freebsd/freebsd-lib/freebsd-lib-10.3-r3.ebuild
new file mode 100644
index 000000000000..96b625022684
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/freebsd-lib-10.3-r3.ebuild
@@ -0,0 +1,648 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+
+inherit bsdmk freebsd flag-o-matic multilib toolchain-funcs eutils multibuild multilib-build
+
+DESCRIPTION="FreeBSD's base system libraries"
+SLOT="0"
+LICENSE="BSD zfs? ( CDDL )"
+
+# Security Advisory and Errata patches.
+UPSTREAM_PATCHES=( "EN-16:06/libc.patch"
+ "SA-16:37/libc.patch"
+ "SA-16:38/bhyve.patch" )
+
+# Crypto is needed to have an internal OpenSSL header
+# sys is needed for libalias, probably we can just extract that instead of
+# extracting the whole tarball
+if [[ ${PV} != *9999* ]]; then
+ KEYWORDS="~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+ SRC_URI="${SRC_URI}
+ $(freebsd_upstream_patches)"
+fi
+
+EXTRACTONLY="
+ lib/
+ contrib/
+ crypto/
+ libexec/
+ etc/
+ include/
+ usr.sbin/
+ gnu/
+ secure/
+"
+
+if [ "${CATEGORY#*cross-}" = "${CATEGORY}" ]; then
+ RDEPEND="ssl? ( dev-libs/openssl:0= )
+ hesiod? ( net-dns/hesiod )
+ kerberos? ( app-crypt/heimdal )
+ usb? ( !dev-libs/libusb )
+ zfs? ( =sys-freebsd/freebsd-cddl-${RV}* )
+ >=dev-libs/expat-2.0.1
+ >=dev-util/dialog-1.2.20150225
+ =sys-freebsd/freebsd-libexec-${RV}*
+ !sys-libs/libutempter
+ !dev-libs/libelf
+ !dev-libs/libexecinfo
+ !dev-libs/libiconv
+ !sys-freebsd/freebsd-headers"
+ DEPEND="${RDEPEND}
+ >=sys-devel/flex-2.5.31-r2
+ >=sys-freebsd/freebsd-sources-10.3-r5"
+ RDEPEND="${RDEPEND}
+ =sys-freebsd/freebsd-share-${RV}*
+ >=virtual/libiconv-0-r2"
+else
+ EXTRACTONLY+="sys/ "
+fi
+
+DEPEND="${DEPEND}
+ userland_GNU? ( sys-apps/mtree )
+ =sys-freebsd/freebsd-mk-defs-${RV}*"
+
+S="${WORKDIR}/lib"
+
+export CTARGET=${CTARGET:-${CHOST}}
+if [ "${CTARGET}" = "${CHOST}" -a "${CATEGORY#*cross-}" != "${CATEGORY}" ]; then
+ export CTARGET=${CATEGORY/cross-}
+fi
+
+IUSE="atm bluetooth ssl hesiod ipv6 kerberos usb netware
+ build crosscompile_opts_headers-only zfs
+ userland_GNU userland_BSD"
+
+QA_DT_NEEDED="lib/libc.so.7 usr/lib32/libc.so.7"
+
+pkg_setup() {
+ # Add the required source files.
+ use build && EXTRACTONLY+="sys/ "
+ use zfs && EXTRACTONLY+="cddl/ "
+
+ [ -c /dev/zero ] || \
+ die "You forgot to mount /dev; the compiled libc would break."
+
+ if ! use ssl && use kerberos; then
+ eerror "If you want kerberos support you need to enable ssl support, too."
+ fi
+
+ use atm || mymakeopts="${mymakeopts} WITHOUT_ATM= "
+ use bluetooth || mymakeopts="${mymakeopts} WITHOUT_BLUETOOTH= "
+ use hesiod || mymakeopts="${mymakeopts} WITHOUT_HESIOD= "
+ use ipv6 || mymakeopts="${mymakeopts} WITHOUT_INET6_SUPPORT= "
+ use kerberos || mymakeopts="${mymakeopts} WITHOUT_KERBEROS_SUPPORT= WITHOUT_GSSAPI= "
+ use netware || mymakeopts="${mymakeopts} WITHOUT_IPX= WITHOUT_IPX_SUPPORT= WITHOUT_NCP= "
+ use ssl || mymakeopts="${mymakeopts} WITHOUT_OPENSSL= "
+ use usb || mymakeopts="${mymakeopts} WITHOUT_USB= "
+ use zfs || mymakeopts="${mymakeopts} WITHOUT_CDDL= "
+
+ mymakeopts="${mymakeopts} WITHOUT_SENDMAIL= WITHOUT_CLANG= WITHOUT_LIBCPLUSPLUS= WITHOUT_LDNS= WITHOUT_UNBOUND= "
+
+ if [ "${CTARGET}" != "${CHOST}" ]; then
+ mymakeopts="${mymakeopts} MACHINE=$(tc-arch-kernel ${CTARGET})"
+ mymakeopts="${mymakeopts} MACHINE_ARCH=$(tc-arch-kernel ${CTARGET})"
+ fi
+}
+
+PATCHES=(
+ "${FILESDIR}/${PN}-6.0-pmc.patch"
+ "${FILESDIR}/${PN}-6.1-csu.patch"
+ "${FILESDIR}/${PN}-10.0-liblink.patch"
+ "${FILESDIR}/${PN}-10.2-liblink.patch"
+ "${FILESDIR}/${PN}-10.0-atfcxx.patch"
+ "${FILESDIR}/${PN}-10.3-libusb.patch"
+ "${FILESDIR}/${PN}-10.0-libproc-libcxx.patch"
+ "${FILESDIR}/${PN}-10.2-bsdxml2expat.patch"
+ "${FILESDIR}/${PN}-9.0-bluetooth.patch"
+ "${FILESDIR}/${PN}-9.1-.eh_frame_hdr-fix.patch"
+ "${FILESDIR}/${PN}-add-nossp-cflags.patch"
+ )
+# Here we disable and remove source which we don't need or want
+# In order:
+# - ncurses stuff
+# - libexpat creates a bsdxml library which is the same as expat
+# - archiving libraries (have their own ebuild)
+# - sendmail libraries (they are installed by sendmail)
+# - SNMP library and dependency (have their own ebuilds)
+# - libstand: static library, 32bits on amd64 used for boot0, we build it from
+# boot0 instead.
+#
+# The rest are libraries we already have somewhere else because
+# they are contribution.
+REMOVE_SUBDIRS="ncurses \
+ libexpat \
+ libz libbz2 libarchive liblzma \
+ libsm libsmdb libsmutil \
+ libbegemot libbsnmp \
+ libpam libpcap libwrap libmagic \
+ libcom_err
+ libedit
+ libstand
+ libgssapi"
+
+# Are we building a cross-compiler?
+is_crosscompile() {
+ [ "${CATEGORY#*cross-}" != "${CATEGORY}" ]
+}
+
+src_prepare() {
+ # gcc-5.0 or later, Workaround for critical issue. bug 573358.
+ use x86-fbsd && [[ "$(gcc-major-version)" -ge 5 ]] && replace-flags -O? -O1
+
+ sed -i.bak -e 's:-o/dev/stdout:-t:' "${S}/libc/net/Makefile.inc"
+
+ # Upstream Display Managers default to using VT7
+ # We should make FreeBSD allow this by default
+ local x=
+ for x in "${WORKDIR}"/etc/etc.*/ttys ; do
+ sed -i.bak \
+ -e '/ttyv5[[:space:]]/ a\
+# Display Managers default to VT7.\
+# If you use the xdm init script, keep ttyv6 commented out\
+# unless you force a different VT for the DM being used.' \
+ -e '/^ttyv[678][[:space:]]/ s/^/# /' "${x}" \
+ || die "Failed to sed ${x}"
+ rm "${x}".bak
+ done
+
+ # This one is here because it also
+ # patches "${WORKDIR}/include"
+ cd "${WORKDIR}"
+ epatch "${FILESDIR}/${PN}-includes.patch"
+ epatch "${FILESDIR}/${PN}-8.0-gcc45.patch"
+ epatch "${FILESDIR}/${PN}-9.0-opieincludes.patch"
+
+ # Don't install the hesiod man page or header
+ rm "${WORKDIR}"/include/hesiod.h || die
+ sed -i.bak -e 's:hesiod.h::' "${WORKDIR}"/include/Makefile || die
+ sed -i.bak -e 's:hesiod.c::' -e 's:hesiod.3::' \
+ "${WORKDIR}"/lib/libc/net/Makefile.inc || die
+
+ # Fix the Makefiles of these few libraries that will overwrite our LDADD.
+ cd "${S}"
+ for dir in libradius libtacplus libcam libdevstat libfetch libgeom libmemstat libopie \
+ libsmb libprocstat libulog; do sed -i.bak -e 's:LDADD=:LDADD+=:g' "${dir}/Makefile" || \
+ die "Problem fixing \"${dir}/Makefile"
+ done
+ # Call LD with LDFLAGS, rename them to RAW_LDFLAGS
+ sed -e 's/LDFLAGS/RAW_LDFLAGS/g' \
+ -i "${S}/csu/i386-elf/Makefile" \
+ -i "${S}/csu/ia64/Makefile" || die
+
+ if install --version 2> /dev/null | grep -q GNU; then
+ sed -i.bak -e 's:${INSTALL} -C:${INSTALL}:' "${WORKDIR}/include/Makefile"
+ fi
+
+ # Try to fix sed calls for GNU sed. Do it only with GNU userland and force
+ # BSD's sed on BSD.
+ cd "${S}"
+ if [[ ${CBUILD:-${CHOST}} != *bsd* ]]; then
+ find . -name Makefile -exec sed -ibak 's/sed -i /sed -i/' {} \;
+ sed -i -e 's/-i ""/-i""/' "${S}/csu/Makefile.inc" || die
+ fi
+
+ if use build; then
+ cd "${WORKDIR}"
+ # This patch has to be applied on ${WORKDIR}/sys, so we do it here since it
+ # shouldn't be a symlink to /usr/src/sys (which should be already patched)
+ epatch "${FILESDIR}"/freebsd-sources-9.0-sysctluint.patch
+ return 0
+ fi
+
+ if ! is_crosscompile ; then
+ if [[ ! -e "${WORKDIR}/sys" ]]; then
+ ln -s "${SYSROOT}/usr/src/sys" "${WORKDIR}/sys" || die "Couldn't make sys symlink!"
+ fi
+ else
+ sed -i.bak -e "s:/usr/include:/usr/${CTARGET}/usr/include:g" \
+ "${S}/libc/rpc/Makefile.inc" \
+ "${S}/libc/yp/Makefile.inc"
+ fi
+}
+
+bootstrap_lib() {
+ for i ; do
+ cd "${WORKDIR}/${i}" || die "missing ${i}"
+ freebsd_src_compile
+ append-ldflags "-L${MAKEOBJDIRPREFIX}/${WORKDIR}/${i}"
+ done
+}
+
+get_csudir() {
+ if [ -d "${WORKDIR}/lib/csu/$1-elf" ]; then
+ echo "lib/csu/$1-elf"
+ else
+ echo "lib/csu/$1"
+ fi
+}
+
+bootstrap_csu() {
+ local csudir="$(get_csudir $(tc-arch-kernel ${CTARGET}))"
+ export RAW_LDFLAGS=$(raw-ldflags)
+ bootstrap_lib "${csudir}"
+
+ CFLAGS="${CFLAGS} -B ${MAKEOBJDIRPREFIX}/${WORKDIR}/${csudir}"
+ append-ldflags "-B ${MAKEOBJDIRPREFIX}/${WORKDIR}/${csudir}"
+
+ bootstrap_lib "gnu/lib/csu"
+
+ cd "${MAKEOBJDIRPREFIX}/${WORKDIR}/gnu/lib/csu"
+ for i in *.So ; do
+ ln -s $i ${i%.So}S.o
+ done
+ CFLAGS="${CFLAGS} -B ${MAKEOBJDIRPREFIX}/${WORKDIR}/gnu/lib/csu"
+ append-ldflags "-B ${MAKEOBJDIRPREFIX}/${WORKDIR}/gnu/lib/csu"
+}
+
+# Compile libssp_nonshared.a and add it's path to LDFLAGS.
+bootstrap_libssp_nonshared() {
+ bootstrap_lib "gnu/lib/libssp/libssp_nonshared"
+ export LDADD="-lssp_nonshared"
+}
+
+bootstrap_libgcc() {
+ bootstrap_lib "lib/libcompiler_rt"
+ cd "${MAKEOBJDIRPREFIX}/${WORKDIR}/lib/libcompiler_rt" || die
+ ln -s libcompiler_rt.a libgcc.a || die
+
+ bootstrap_lib "lib/libc" "gnu/lib/libgcc"
+}
+
+bootstrap_libthr() {
+ bootstrap_lib "lib/libthr"
+ cd "${MAKEOBJDIRPREFIX}/${WORKDIR}/lib/libthr" || die
+ ln -s libthr.so libpthread.so
+}
+
+# What to build for a cross-compiler.
+# We also need the csu but this has to be handled separately.
+CROSS_SUBDIRS="lib/libc lib/msun gnu/lib/libssp/libssp_nonshared lib/libthr lib/libutil lib/librt lib/libc_nonshared"
+
+# What to build for non-default ABIs.
+NON_NATIVE_SUBDIRS="${CROSS_SUBDIRS} gnu/lib/csu lib/libcompiler_rt gnu/lib/libgcc lib/libmd lib/libcrypt lib/libsbuf lib/libcam lib/libelf lib/libiconv_modules"
+
+# Subdirs for a native build:
+NATIVE_SUBDIRS="lib gnu/lib/libssp/libssp_nonshared gnu/lib/libregex gnu/lib/csu gnu/lib/libgcc lib/libiconv_modules"
+
+# Is my $ABI native ?
+is_native_abi() {
+ is_crosscompile && return 1
+ multilib_is_native_abi
+}
+
+# Do we need to bootstrap the csu and libssp_nonshared?
+need_bootstrap() {
+ is_crosscompile || use build || { ! is_native_abi && ! has_version '>=sys-freebsd/freebsd-lib-9.1-r8[multilib]' && ! has_version ">=sys-freebsd/freebsd-lib-9.1-r11[${MULTILIB_USEDEP}]" ; } || has_version "<${CATEGORY}/${P}"
+}
+
+# Get the subdirs we are building.
+get_subdirs() {
+ local ret=""
+ if is_native_abi ; then
+ # If we are building for the native ABI, build everything
+ ret="${NATIVE_SUBDIRS}"
+ elif is_crosscompile ; then
+ # With a cross-compiler we only build the very core parts.
+ ret="${CROSS_SUBDIRS}"
+ if [ "${EBUILD_PHASE}" = "install" ]; then
+ # Add the csu dir first when installing. We treat it separately for
+ # compiling.
+ ret="$(get_csudir $(tc-arch-kernel ${CTARGET})) ${ret}"
+ fi
+ else
+ # For the non-native ABIs we only build the csu parts and very core
+ # libraries for now.
+ ret="${NON_NATIVE_SUBDIRS} $(get_csudir $(tc-arch-kernel ${CHOST}))"
+ fi
+ echo "${ret}"
+}
+
+# Bootstrap the core libraries and setup the flags so that the other parts can
+# build against it.
+do_bootstrap() {
+ einfo "Bootstrapping on ${CHOST} for ${CTARGET}"
+ if ! is_crosscompile ; then
+ # Pre-install headers, but not when building a cross-compiler since we
+ # assume they have been installed in the previous pass.
+ einfo "Pre-installing includes in include_proper_${ABI}"
+ mkdir "${WORKDIR}/include_proper_${ABI}" || die
+ CTARGET="${CHOST}" install_includes "/include_proper_${ABI}"
+ CFLAGS="${CFLAGS} -isystem ${WORKDIR}/include_proper_${ABI}"
+ CXXFLAGS="${CXXFLAGS} -isystem ${WORKDIR}/include_proper_${ABI}"
+ mymakeopts="${mymakeopts} RPCDIR=${WORKDIR}/include_proper_${ABI}/rpcsvc"
+ fi
+ bootstrap_csu
+ bootstrap_libssp_nonshared
+ is_crosscompile && bootstrap_lib "lib/libc"
+ is_crosscompile || is_native_abi || bootstrap_libgcc
+ is_native_abi || bootstrap_libthr
+}
+
+# Compile it. Assume we have the toolchain setup correctly.
+do_compile() {
+ # Bootstrap if needed, otherwise assume the system headers are in
+ # /usr/include.
+ if need_bootstrap ; then
+ do_bootstrap
+ else
+ CFLAGS="${CFLAGS} -isystem /usr/include"
+ CXXFLAGS="${CXXFLAGS} -isystem /usr/include"
+ fi
+
+ export RAW_LDFLAGS=$(raw-ldflags)
+
+ # Everything is now setup, build it!
+ for i in $(get_subdirs) ; do
+ einfo "Building in ${i}... with CC=${CC} and CFLAGS=${CFLAGS}"
+ cd "${WORKDIR}/${i}/" || die "missing ${i}."
+ freebsd_src_compile || die "make ${i} failed"
+ done
+}
+
+src_compile() {
+ # Does not work with GNU sed
+ # Force BSD's sed on BSD.
+ if [[ ${CBUILD:-${CHOST}} == *bsd* ]]; then
+ export ESED=/usr/bin/sed
+ unalias sed
+ fi
+
+ use usb && export NON_NATIVE_SUBDIRS="${NON_NATIVE_SUBDIRS} lib/libusb lib/libusbhid"
+
+ cd "${WORKDIR}/include"
+ $(freebsd_get_bmake) CC="$(tc-getCC)" || die "make include failed"
+
+ use crosscompile_opts_headers-only && return 0
+
+ # Bug #270098
+ append-flags $(test-flags -fno-strict-aliasing)
+
+ # Bug #324445
+ append-flags $(test-flags -fno-strict-overflow)
+
+ # strip flags and do not do it later, we only add safe, and in fact
+ # needed flags after all
+ strip-flags
+ export NOFLAGSTRIP=yes
+ if is_crosscompile ; then
+ export YACC='yacc -by'
+ CHOST=${CTARGET} tc-export CC LD CXX RANLIB
+ mymakeopts="${mymakeopts} NLS="
+ CFLAGS="${CFLAGS} -isystem /usr/${CTARGET}/usr/include"
+ CXXFLAGS="${CXXFLAGS} -isystem /usr/${CTARGET}/usr/include"
+ append-ldflags "-L${WORKDIR}/${CHOST}/${WORKDIR}/lib/libc"
+ fi
+
+ if is_crosscompile ; then
+ do_compile
+ else
+ local MULTIBUILD_VARIANTS=( $(multilib_get_enabled_abis) )
+ multibuild_foreach_variant freebsd_multilib_multibuild_wrapper do_compile
+ fi
+}
+
+gen_libc_ldscript() {
+ # Parameters:
+ # $1 = target libdir
+ # $2 = source libc dir
+ # $3 = source libssp_nonshared dir
+
+ # Clear the symlink.
+ rm -f "${DESTDIR}/$2/libc.so" || die
+
+ # Move the library if needed
+ if [ "$1" != "$2" ] ; then
+ mv "${DESTDIR}/$2/libc.so.7" "${DESTDIR}/$1/" || die
+ fi
+
+ # Generate libc.so ldscript for inclusion of libssp_nonshared.a when linking
+ # this is done to avoid having to touch gcc spec file as it is currently
+ # done on FreeBSD upstream, mostly because their binutils aren't able to
+ # cope with linker scripts yet.
+ # Taken from toolchain-funcs.eclass:
+ local output_format
+ output_format=$($(tc-getCC) ${CFLAGS} ${LDFLAGS} -Wl,--verbose 2>&1 | sed -n 's/^OUTPUT_FORMAT("\([^"]*\)",.*/\1/p')
+ [[ -n ${output_format} ]] && output_format="OUTPUT_FORMAT ( ${output_format} )"
+
+ # iconv symbol provided by libc_nonshared.a.
+ # http://svnweb.freebsd.org/base?view=revision&amp;revision=258283
+ cat > "${DESTDIR}/$2/libc.so" <<-END_LDSCRIPT
+/* GNU ld script
+ SSP (-fstack-protector) requires __stack_chk_fail_local to be local.
+ GCC invokes this symbol in a non-PIC way, which results in TEXTRELs if
+ this symbol was provided by a shared libc. So we link in
+ libssp_nonshared.a from here.
+ */
+${output_format}
+GROUP ( /$1/libc.so.7 /$3/libc_nonshared.a /$3/libssp_nonshared.a )
+END_LDSCRIPT
+}
+
+header_list=""
+
+move_header() {
+ local dirname=$(dirname ${1})
+ local filename=$(basename ${1})
+
+ if [ ! -d "${dirname}/${ABI}" ] ; then
+ mkdir "${dirname}/${ABI}" || die
+ fi
+
+ mv "${1}" "${dirname}/${ABI}/" || die
+
+ export header_list="${header_list} ${1}"
+}
+
+make_header_template() {
+ cat <<-END_HEADER
+/*
+ * Wrapped header for multilib support.
+ * See the real headers included below.
+ */
+
+#if defined(__x86_64__)
+ @ABI_amd64_fbsd@
+#elif defined(__i386__)
+ @ABI_x86_fbsd@
+#else
+ @ABI_${DEFAULT_ABI}@
+#endif
+END_HEADER
+}
+
+wrap_header() {
+ local dirname=$(dirname ${1})
+ local filename=$(basename ${1})
+
+ if [ -n "${dirname#.}" ] ; then
+ dirname="${dirname}/${2}"
+ else
+ dirname="${2}"
+ fi
+
+ if [ -f "${dirname}/${filename}" ] ; then
+ sed -e "s:@ABI_${2}@:#include <${dirname}/${filename}>:" ${1}
+ else
+ cat ${1}
+ fi
+}
+
+wrap_header_end() {
+ sed -e "s:@ABI_.*@:#error \"Sorry, no support for your ABI.\":" ${1}
+}
+
+do_install() {
+ if is_crosscompile ; then
+ INCLUDEDIR="/usr/${CTARGET}/usr/include"
+ else
+ INCLUDEDIR="/usr/include"
+ fi
+
+ dodir ${INCLUDEDIR}
+ CTARGET="${CHOST}" \
+ install_includes ${INCLUDEDIR}
+
+ is_crosscompile && use crosscompile_opts_headers-only && return 0
+
+ # Install a libusb.pc for better compat with Linux's libusb
+ if use usb ; then
+ dodir /usr/$(get_libdir)/pkgconfig
+ sed -i.bkp "s:^libdir=.*:libdir=/usr/$(get_libdir):g" "${S}"/libusb/libusb-*.pc
+ fi
+
+ for i in $(get_subdirs) ; do
+ if [[ ${i} != *libiconv_modules* ]] ; then
+ einfo "Installing in ${i}..."
+ cd "${WORKDIR}/${i}/" || die "missing ${i}."
+ freebsd_src_install || die "Install ${i} failed"
+ fi
+ done
+
+ if ! is_crosscompile; then
+ local mymakeopts_save="${mymakeopts}"
+ mymakeopts="${mymakeopts} SHLIBDIR=/usr/$(get_libdir)/i18n LIBDIR=/usr/$(get_libdir)/i18n"
+
+ einfo "Installing in lib/libiconv_modules..."
+ cd "${WORKDIR}/lib/libiconv_modules/" || die "missing libiconv_modules."
+ freebsd_src_install || die "Install lib/libiconv_modules failed"
+
+ mymakeopts="${mymakeopts_save}"
+ fi
+
+ if ! is_crosscompile ; then
+ if ! multilib_is_native_abi ; then
+ DESTDIR="${D}" gen_libc_ldscript "usr/$(get_libdir)" "usr/$(get_libdir)" "usr/$(get_libdir)"
+ else
+ dodir "$(get_libdir)"
+ DESTDIR="${D}" gen_libc_ldscript "$(get_libdir)" "usr/$(get_libdir)" "usr/$(get_libdir)"
+ fi
+ else
+ CHOST=${CTARGET} DESTDIR="${D}/usr/${CTARGET}/" gen_libc_ldscript "usr/lib" "usr/lib" "usr/lib"
+ # We're done for the cross libc here.
+ return 0
+ fi
+
+ # Generate ldscripts for core libraries that will go in /
+ multilib_is_native_abi && \
+ gen_usr_ldscript -a alias cam geom ipsec jail kiconv \
+ kvm m md procstat sbuf thr ufs util elf
+
+ if [[ ${#MULTIBUILD_VARIANTS[@]} -gt 1 ]] ; then
+ cd "${D}/usr/include"
+ for i in machine/*.h fenv.h ; do
+ move_header ${i}
+ done
+ if multilib_is_native_abi ; then
+ # Supposedly the last one!
+ local uniq_headers="$(echo ${header_list} | tr ' ' '\n' | sort | uniq | tr '\n' ' ')"
+ for j in ${uniq_headers} ; do
+ make_header_template > ${j}
+ for i in $(get_all_abis) ; do
+ wrap_header ${j} ${i} > ${j}.new
+ cp ${j}.new ${j}
+ rm -f ${j}.new
+ done
+ wrap_header_end ${j} > ${j}.new
+ cp ${j}.new ${j}
+ rm -f ${j}.new
+ done
+ fi
+ fi
+}
+
+src_install() {
+ if is_crosscompile ; then
+ einfo "Installing for ${CTARGET} in ${CHOST}.."
+ # From this point we need to force: get stripped with the correct tools,
+ # get tc-arch-kernel to return the right value, etc.
+ export CHOST=${CTARGET}
+
+ mymakeopts="${mymakeopts} NO_MAN= \
+ INCLUDEDIR=/usr/${CTARGET}/usr/include \
+ SHLIBDIR=/usr/${CTARGET}/usr/lib \
+ LIBDIR=/usr/${CTARGET}/usr/lib"
+
+ dosym "usr/include" "/usr/${CTARGET}/sys-include"
+ do_install
+
+ return 0
+ else
+ export STRIP_MASK="*/usr/lib*/*crt*.o"
+ local MULTIBUILD_VARIANTS=( $(multilib_get_enabled_abis) )
+ multibuild_foreach_variant freebsd_multilib_multibuild_wrapper do_install
+ fi
+
+ cd "${WORKDIR}/etc/"
+ insinto /etc
+ doins nls.alias mac.conf netconfig
+
+ # Install ttys file
+ local MACHINE="$(tc-arch-kernel)"
+ doins "etc.${MACHINE}"/*
+}
+
+install_includes()
+{
+ local INCLUDEDIR="$1"
+
+ # The idea is to be called from either install or unpack.
+ # During unpack it's required to install them as portage's user.
+ if [[ "${EBUILD_PHASE}" == "install" ]]; then
+ local DESTDIR="${D}"
+ BINOWN="root"
+ BINGRP="wheel"
+ else
+ local DESTDIR="${WORKDIR}"
+ [[ -z "${USER}" ]] && USER="portage"
+ BINOWN="${USER}"
+ [[ -z "${GROUPS}" ]] && GROUPS="portage"
+ BINGRP="${GROUPS}"
+ fi
+
+ # Must exist before we use it.
+ [[ -d "${DESTDIR}${INCLUDEDIR}" ]] || die "dodir or mkdir ${INCLUDEDIR} before using install_includes."
+ cd "${WORKDIR}/include"
+
+ local MACHINE="$(tc-arch-kernel)"
+
+ einfo "Installing includes into ${INCLUDEDIR} as ${BINOWN}:${BINGRP}..."
+ $(freebsd_get_bmake) installincludes \
+ MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE} \
+ DESTDIR="${DESTDIR}" \
+ INCLUDEDIR="${INCLUDEDIR}" BINOWN="${BINOWN}" \
+ BINGRP="${BINGRP}" \
+ WITHOUT_GSSAPI= || die "install_includes() failed"
+ einfo "includes installed ok."
+ EXTRA_INCLUDES="lib/librtld_db lib/libutil lib/msun gnu/lib/libregex"
+ for i in $EXTRA_INCLUDES; do
+ einfo "Installing $i includes into ${INCLUDEDIR} as ${BINOWN}:${BINGRP}..."
+ cd "${WORKDIR}/$i" || die
+ $(freebsd_get_bmake) installincludes DESTDIR="${DESTDIR}" \
+ MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE} \
+ INCLUDEDIR="${INCLUDEDIR}" BINOWN="${BINOWN}" \
+ BINGRP="${BINGRP}" || die "problem installing $i includes."
+ einfo "$i includes installed ok."
+ done
+}
diff --git a/sys-freebsd/freebsd-lib/freebsd-lib-11.0-r1.ebuild b/sys-freebsd/freebsd-lib/freebsd-lib-11.0-r1.ebuild
new file mode 100644
index 000000000000..24c62627e2a2
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/freebsd-lib-11.0-r1.ebuild
@@ -0,0 +1,644 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+
+inherit bsdmk freebsd flag-o-matic multilib toolchain-funcs eutils multibuild multilib-build
+
+DESCRIPTION="FreeBSD's base system libraries"
+SLOT="0"
+LICENSE="BSD zfs? ( CDDL )"
+
+# Security Advisory and Errata patches.
+UPSTREAM_PATCHES=( "SA-16:37/libc.patch"
+ "SA-16:38/bhyve.patch" )
+
+# Crypto is needed to have an internal OpenSSL header
+# sys is needed for libalias, probably we can just extract that instead of
+# extracting the whole tarball
+if [[ ${PV} != *9999* ]]; then
+ KEYWORDS="~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+ SRC_URI="${SRC_URI}
+ $(freebsd_upstream_patches)"
+fi
+
+EXTRACTONLY="
+ lib/
+ contrib/
+ crypto/
+ libexec/
+ etc/
+ include/
+ usr.sbin/
+ gnu/
+ secure/
+"
+
+if [ "${CATEGORY#*cross-}" = "${CATEGORY}" ]; then
+ RDEPEND="ssl? ( dev-libs/openssl:0= )
+ hesiod? ( net-dns/hesiod )
+ kerberos? ( app-crypt/heimdal )
+ usb? ( !dev-libs/libusb )
+ zfs? ( =sys-freebsd/freebsd-cddl-${RV}* )
+ >=dev-libs/expat-2.0.1
+ >=dev-util/dialog-1.2.20150225
+ =sys-freebsd/freebsd-libexec-${RV}*
+ !sys-libs/libutempter
+ !dev-libs/libelf
+ !dev-libs/libexecinfo
+ !dev-libs/libiconv
+ !sys-freebsd/freebsd-headers"
+ DEPEND="${RDEPEND}
+ >=sys-devel/flex-2.5.31-r2
+ =sys-freebsd/freebsd-sources-${RV}*"
+ RDEPEND="${RDEPEND}
+ =sys-freebsd/freebsd-share-${RV}*
+ >=virtual/libiconv-0-r2"
+else
+ EXTRACTONLY+="sys/ "
+fi
+
+DEPEND="${DEPEND}
+ userland_GNU? ( sys-apps/mtree )
+ =sys-freebsd/freebsd-mk-defs-${RV}*"
+
+S="${WORKDIR}/lib"
+
+export CTARGET=${CTARGET:-${CHOST}}
+if [ "${CTARGET}" = "${CHOST}" -a "${CATEGORY#*cross-}" != "${CATEGORY}" ]; then
+ export CTARGET=${CATEGORY/cross-}
+fi
+
+IUSE="atm bluetooth ssl hesiod ipv6 kerberos usb netware
+ build crosscompile_opts_headers-only zfs
+ userland_GNU userland_BSD"
+
+QA_DT_NEEDED="lib/libc.so.7 usr/lib32/libc.so.7"
+
+pkg_setup() {
+ # Add the required source files.
+ use build && EXTRACTONLY+="sys/ "
+ use zfs && EXTRACTONLY+="cddl/ "
+
+ [ -c /dev/zero ] || \
+ die "You forgot to mount /dev; the compiled libc would break."
+
+ if ! use ssl && use kerberos; then
+ eerror "If you want kerberos support you need to enable ssl support, too."
+ fi
+
+ use atm || mymakeopts="${mymakeopts} WITHOUT_ATM= "
+ use bluetooth || mymakeopts="${mymakeopts} WITHOUT_BLUETOOTH= "
+ use hesiod || mymakeopts="${mymakeopts} WITHOUT_HESIOD= "
+ use ipv6 || mymakeopts="${mymakeopts} WITHOUT_INET6_SUPPORT= "
+ use kerberos || mymakeopts="${mymakeopts} WITHOUT_KERBEROS_SUPPORT= WITHOUT_GSSAPI= "
+ use netware || mymakeopts="${mymakeopts} WITHOUT_IPX= WITHOUT_IPX_SUPPORT= WITHOUT_NCP= "
+ use ssl || mymakeopts="${mymakeopts} WITHOUT_OPENSSL= "
+ use usb || mymakeopts="${mymakeopts} WITHOUT_USB= "
+ use zfs || mymakeopts="${mymakeopts} WITHOUT_CDDL= "
+
+ mymakeopts="${mymakeopts} WITHOUT_SENDMAIL= WITHOUT_CLANG= WITHOUT_LIBCPLUSPLUS= WITHOUT_LDNS= WITHOUT_UNBOUND= "
+
+ if [ "${CTARGET}" != "${CHOST}" ]; then
+ mymakeopts="${mymakeopts} MACHINE=$(tc-arch-kernel ${CTARGET})"
+ mymakeopts="${mymakeopts} MACHINE_ARCH=$(tc-arch-kernel ${CTARGET})"
+ fi
+}
+
+PATCHES=(
+ "${FILESDIR}/${PN}-6.0-pmc.patch"
+ "${FILESDIR}/${PN}-10.0-atfcxx.patch"
+ "${FILESDIR}/${PN}-9.0-bluetooth.patch"
+ "${FILESDIR}/${PN}-11.0-workaround.patch"
+ "${FILESDIR}/${PN}-11.0-bsdxml2expat.patch"
+ "${FILESDIR}/${PN}-11.0-libsysdecode.patch"
+ "${FILESDIR}/${PN}-11.0-libproc-libcxx.patch"
+ "${FILESDIR}/${PN}-add-nossp-cflags.patch"
+ )
+# Here we disable and remove source which we don't need or want
+# In order:
+# - ncurses stuff
+# - libexpat creates a bsdxml library which is the same as expat
+# - archiving libraries (have their own ebuild)
+# - sendmail libraries (they are installed by sendmail)
+# - SNMP library and dependency (have their own ebuilds)
+# - libstand: static library, 32bits on amd64 used for boot0, we build it from
+# boot0 instead.
+#
+# The rest are libraries we already have somewhere else because
+# they are contribution.
+REMOVE_SUBDIRS="ncurses \
+ libexpat \
+ libz libbz2 libarchive liblzma \
+ libsm libsmdb libsmutil \
+ libbegemot libbsnmp \
+ libpam libpcap libwrap libmagic \
+ libcom_err
+ libedit
+ libstand
+ libgssapi"
+
+# Are we building a cross-compiler?
+is_crosscompile() {
+ [ "${CATEGORY#*cross-}" != "${CATEGORY}" ]
+}
+
+src_prepare() {
+ # gcc-5.0 or later, Workaround for critical issue. bug 573358.
+ use x86-fbsd && [[ "$(gcc-major-version)" -ge 5 ]] && replace-flags -O? -O1
+
+ sed -i.bak -e 's:-o/dev/stdout:-t:' "${S}/libc/net/Makefile.inc"
+
+ # Upstream Display Managers default to using VT7
+ # We should make FreeBSD allow this by default
+ local x=
+ for x in "${WORKDIR}"/etc/etc.*/ttys ; do
+ sed -i.bak \
+ -e '/ttyv5[[:space:]]/ a\
+# Display Managers default to VT7.\
+# If you use the xdm init script, keep ttyv6 commented out\
+# unless you force a different VT for the DM being used.' \
+ -e '/^ttyv[678][[:space:]]/ s/^/# /' "${x}" \
+ || die "Failed to sed ${x}"
+ rm "${x}".bak
+ done
+
+ # This one is here because it also
+ # patches "${WORKDIR}/include"
+ cd "${WORKDIR}"
+ epatch "${FILESDIR}/${PN}-includes.patch"
+
+ # Don't install the hesiod man page or header
+ rm "${WORKDIR}"/include/hesiod.h || die
+ sed -i.bak -e 's:hesiod.h::' "${WORKDIR}"/include/Makefile || die
+ sed -i.bak -e 's:hesiod.c::' -e 's:hesiod.3::' \
+ "${WORKDIR}"/lib/libc/net/Makefile.inc || die
+
+ # Fix the Makefiles of these few libraries that will overwrite our LDADD.
+ cd "${S}"
+ for dir in libradius libtacplus libcam libdevstat libfetch libgeom libmemstat libopie \
+ libsmb libprocstat libulog; do sed -i.bak -e 's:LDADD=:LDADD+=:g' "${dir}/Makefile" || \
+ die "Problem fixing \"${dir}/Makefile"
+ done
+ # Call LD with LDFLAGS, rename them to RAW_LDFLAGS
+ sed -e 's/LDFLAGS/RAW_LDFLAGS/g' \
+ -i "${S}/csu/i386/Makefile" || die
+
+ if install --version 2> /dev/null | grep -q GNU; then
+ sed -i.bak -e 's:${INSTALL} -C:${INSTALL}:' "${WORKDIR}/include/Makefile"
+ fi
+
+ # Try to fix sed calls for GNU sed. Do it only with GNU userland and force
+ # BSD's sed on BSD.
+ cd "${S}"
+ if [[ ${CBUILD:-${CHOST}} != *bsd* ]]; then
+ find . -name Makefile -exec sed -ibak 's/sed -i /sed -i/' {} \;
+ sed -i -e 's/-i ""/-i""/' "${S}/csu/Makefile.inc" || die
+ fi
+
+ if use build; then
+ cd "${WORKDIR}"
+ # This patch has to be applied on ${WORKDIR}/sys, so we do it here since it
+ # shouldn't be a symlink to /usr/src/sys (which should be already patched)
+ epatch "${FILESDIR}"/freebsd-sources-9.0-sysctluint.patch
+ return 0
+ fi
+
+ if ! is_crosscompile ; then
+ if [[ ! -e "${WORKDIR}/sys" ]]; then
+ ln -s "${SYSROOT}/usr/src/sys" "${WORKDIR}/sys" || die "Couldn't make sys symlink!"
+ fi
+ else
+ sed -i.bak -e "s:/usr/include:/usr/${CTARGET}/usr/include:g" \
+ "${S}/libc/rpc/Makefile.inc" \
+ "${S}/libc/yp/Makefile.inc"
+ fi
+}
+
+bootstrap_lib() {
+ for i ; do
+ cd "${WORKDIR}/${i}" || die "missing ${i}"
+ freebsd_src_compile
+ append-ldflags "-L${MAKEOBJDIRPREFIX}/${WORKDIR}/${i}"
+ done
+}
+
+get_csudir() {
+ if [ -d "${WORKDIR}/lib/csu/$1-elf" ]; then
+ echo "lib/csu/$1-elf"
+ else
+ echo "lib/csu/$1"
+ fi
+}
+
+bootstrap_csu() {
+ local csudir="$(get_csudir $(tc-arch-kernel ${CTARGET}))"
+ export RAW_LDFLAGS=$(raw-ldflags)
+ bootstrap_lib "${csudir}"
+
+ CFLAGS="${CFLAGS} -B ${MAKEOBJDIRPREFIX}/${WORKDIR}/${csudir}"
+ append-ldflags "-B ${MAKEOBJDIRPREFIX}/${WORKDIR}/${csudir}"
+
+ bootstrap_lib "gnu/lib/csu"
+
+ cd "${MAKEOBJDIRPREFIX}/${WORKDIR}/gnu/lib/csu"
+ for i in *.So ; do
+ ln -s $i ${i%.So}S.o
+ done
+ CFLAGS="${CFLAGS} -B ${MAKEOBJDIRPREFIX}/${WORKDIR}/gnu/lib/csu"
+ append-ldflags "-B ${MAKEOBJDIRPREFIX}/${WORKDIR}/gnu/lib/csu"
+}
+
+# Compile libssp_nonshared.a and add it's path to LDFLAGS.
+bootstrap_libssp_nonshared() {
+ bootstrap_lib "gnu/lib/libssp/libssp_nonshared"
+}
+
+bootstrap_libgcc() {
+ bootstrap_lib "lib/libcompiler_rt"
+ cd "${MAKEOBJDIRPREFIX}/${WORKDIR}/lib/libcompiler_rt" || die
+ ln -s libcompiler_rt.a libgcc.a || die
+
+ bootstrap_lib "lib/libc" "gnu/lib/libgcc"
+}
+
+bootstrap_libthr() {
+ bootstrap_lib "lib/libthr"
+ cd "${MAKEOBJDIRPREFIX}/${WORKDIR}/lib/libthr" || die
+ ln -s libthr.so libpthread.so
+}
+
+# What to build for a cross-compiler.
+# We also need the csu but this has to be handled separately.
+CROSS_SUBDIRS="lib/libc lib/msun gnu/lib/libssp/libssp_nonshared lib/libthr lib/libutil lib/librt lib/libc_nonshared"
+
+# What to build for non-default ABIs.
+NON_NATIVE_SUBDIRS="${CROSS_SUBDIRS} gnu/lib/csu lib/libcompiler_rt gnu/lib/libgcc lib/libmd lib/libcrypt lib/libsbuf lib/libcam lib/libelf lib/libiconv_modules"
+
+# Subdirs for a native build:
+NATIVE_SUBDIRS="lib gnu/lib/libssp/libssp_nonshared gnu/lib/libregex gnu/lib/csu gnu/lib/libgcc lib/libiconv_modules"
+
+# Is my $ABI native ?
+is_native_abi() {
+ is_crosscompile && return 1
+ multilib_is_native_abi
+}
+
+# Do we need to bootstrap the csu and libssp_nonshared?
+need_bootstrap() {
+ is_crosscompile || use build || { ! is_native_abi && ! has_version '>=sys-freebsd/freebsd-lib-9.1-r8[multilib]' && ! has_version ">=sys-freebsd/freebsd-lib-9.1-r11[${MULTILIB_USEDEP}]" ; } || has_version "<${CATEGORY}/${P}"
+}
+
+# Get the subdirs we are building.
+get_subdirs() {
+ local ret=""
+ if is_native_abi ; then
+ # If we are building for the native ABI, build everything
+ ret="${NATIVE_SUBDIRS}"
+ elif is_crosscompile ; then
+ # With a cross-compiler we only build the very core parts.
+ ret="${CROSS_SUBDIRS}"
+ if [ "${EBUILD_PHASE}" = "install" ]; then
+ # Add the csu dir first when installing. We treat it separately for
+ # compiling.
+ ret="$(get_csudir $(tc-arch-kernel ${CTARGET})) ${ret}"
+ fi
+ else
+ # For the non-native ABIs we only build the csu parts and very core
+ # libraries for now.
+ ret="${NON_NATIVE_SUBDIRS} $(get_csudir $(tc-arch-kernel ${CHOST}))"
+ fi
+ echo "${ret}"
+}
+
+# Bootstrap the core libraries and setup the flags so that the other parts can
+# build against it.
+do_bootstrap() {
+ einfo "Bootstrapping on ${CHOST} for ${CTARGET}"
+ if ! is_crosscompile ; then
+ # Pre-install headers, but not when building a cross-compiler since we
+ # assume they have been installed in the previous pass.
+ einfo "Pre-installing includes in include_proper_${ABI}"
+ mkdir "${WORKDIR}/include_proper_${ABI}" || die
+ CTARGET="${CHOST}" install_includes "/include_proper_${ABI}"
+ CFLAGS="${CFLAGS} -isystem ${WORKDIR}/include_proper_${ABI}"
+ [[ $(tc-getCXX) = *clang++* ]] && CXXFLAGS="${CXXFLAGS} -isystem /usr/include/c++/v1"
+ CXXFLAGS="${CXXFLAGS} -isystem ${WORKDIR}/include_proper_${ABI}"
+ mymakeopts="${mymakeopts} RPCDIR=${WORKDIR}/include_proper_${ABI}/rpcsvc"
+ fi
+ bootstrap_csu
+ bootstrap_libssp_nonshared
+ is_crosscompile && bootstrap_lib "lib/libc"
+ is_crosscompile || is_native_abi || bootstrap_libgcc
+ is_native_abi || bootstrap_libthr
+}
+
+# Compile it. Assume we have the toolchain setup correctly.
+do_compile() {
+ # Bootstrap if needed, otherwise assume the system headers are in
+ # /usr/include.
+ if need_bootstrap ; then
+ do_bootstrap
+ else
+ CFLAGS="${CFLAGS} -isystem /usr/include"
+ [[ $(tc-getCXX) = *clang++* ]] && CXXFLAGS="${CXXFLAGS} -isystem /usr/include/c++/v1"
+ CXXFLAGS="${CXXFLAGS} -isystem /usr/include"
+ fi
+
+ export RAW_LDFLAGS=$(raw-ldflags)
+
+ # Everything is now setup, build it!
+ for i in $(get_subdirs) ; do
+ einfo "Building in ${i}... with CC=${CC} and CFLAGS=${CFLAGS}"
+ cd "${WORKDIR}/${i}/" || die "missing ${i}."
+ freebsd_src_compile || die "make ${i} failed"
+ done
+}
+
+src_compile() {
+ # Does not work with GNU sed
+ # Force BSD's sed on BSD.
+ if [[ ${CBUILD:-${CHOST}} == *bsd* ]]; then
+ export ESED=/usr/bin/sed
+ unalias sed
+ fi
+
+ use usb && export NON_NATIVE_SUBDIRS="${NON_NATIVE_SUBDIRS} lib/libusb lib/libusbhid"
+
+ cd "${WORKDIR}/include"
+ $(freebsd_get_bmake) CC="$(tc-getCC)" SRCTOP="${WORKDIR}" || die "make include failed"
+
+ use crosscompile_opts_headers-only && return 0
+
+ # Bug #270098
+ append-flags $(test-flags -fno-strict-aliasing)
+
+ # Bug #324445
+ append-flags $(test-flags -fno-strict-overflow)
+
+ # strip flags and do not do it later, we only add safe, and in fact
+ # needed flags after all
+ strip-flags
+ export NOFLAGSTRIP=yes
+ if is_crosscompile ; then
+ export YACC='yacc -by'
+ CHOST=${CTARGET} tc-export CC LD CXX RANLIB
+ mymakeopts="${mymakeopts} NLS="
+ CFLAGS="${CFLAGS} -isystem /usr/${CTARGET}/usr/include"
+ CXXFLAGS="${CXXFLAGS} -isystem /usr/${CTARGET}/usr/include"
+ append-ldflags "-L${WORKDIR}/${CHOST}/${WORKDIR}/lib/libc"
+ fi
+
+ if is_crosscompile ; then
+ do_compile
+ else
+ local MULTIBUILD_VARIANTS=( $(multilib_get_enabled_abis) )
+ multibuild_foreach_variant freebsd_multilib_multibuild_wrapper do_compile
+ fi
+}
+
+gen_libc_ldscript() {
+ # Parameters:
+ # $1 = target libdir
+ # $2 = source libc dir
+ # $3 = source libssp_nonshared dir
+
+ # Clear the symlink.
+ rm -f "${DESTDIR}/$2/libc.so" || die
+
+ # Move the library if needed
+ if [ "$1" != "$2" ] ; then
+ mv "${DESTDIR}/$2/libc.so.7" "${DESTDIR}/$1/" || die
+ fi
+
+ # Generate libc.so ldscript for inclusion of libssp_nonshared.a when linking
+ # this is done to avoid having to touch gcc spec file as it is currently
+ # done on FreeBSD upstream, mostly because their binutils aren't able to
+ # cope with linker scripts yet.
+ # Taken from toolchain-funcs.eclass:
+ local output_format
+ output_format=$($(tc-getCC) ${CFLAGS} ${LDFLAGS} -Wl,--verbose 2>&1 | sed -n 's/^OUTPUT_FORMAT("\([^"]*\)",.*/\1/p')
+ [[ -n ${output_format} ]] && output_format="OUTPUT_FORMAT ( ${output_format} )"
+
+ # iconv symbol provided by libc_nonshared.a.
+ # http://svnweb.freebsd.org/base?view=revision&amp;revision=258283
+ cat > "${DESTDIR}/$2/libc.so" <<-END_LDSCRIPT
+/* GNU ld script
+ SSP (-fstack-protector) requires __stack_chk_fail_local to be local.
+ GCC invokes this symbol in a non-PIC way, which results in TEXTRELs if
+ this symbol was provided by a shared libc. So we link in
+ libssp_nonshared.a from here.
+ */
+${output_format}
+GROUP ( /$1/libc.so.7 /$3/libc_nonshared.a /$3/libssp_nonshared.a )
+END_LDSCRIPT
+}
+
+header_list=""
+
+move_header() {
+ local dirname=$(dirname ${1})
+ local filename=$(basename ${1})
+
+ if [ ! -d "${dirname}/${ABI}" ] ; then
+ mkdir "${dirname}/${ABI}" || die
+ fi
+
+ mv "${1}" "${dirname}/${ABI}/" || die
+
+ export header_list="${header_list} ${1}"
+}
+
+make_header_template() {
+ cat <<-END_HEADER
+/*
+ * Wrapped header for multilib support.
+ * See the real headers included below.
+ */
+
+#if defined(__x86_64__)
+ @ABI_amd64_fbsd@
+#elif defined(__i386__)
+ @ABI_x86_fbsd@
+#else
+ @ABI_${DEFAULT_ABI}@
+#endif
+END_HEADER
+}
+
+wrap_header() {
+ local dirname=$(dirname ${1})
+ local filename=$(basename ${1})
+
+ if [ -n "${dirname#.}" ] ; then
+ dirname="${dirname}/${2}"
+ else
+ dirname="${2}"
+ fi
+
+ if [ -f "${dirname}/${filename}" ] ; then
+ sed -e "s:@ABI_${2}@:#include <${dirname}/${filename}>:" ${1}
+ else
+ cat ${1}
+ fi
+}
+
+wrap_header_end() {
+ sed -e "s:@ABI_.*@:#error \"Sorry, no support for your ABI.\":" ${1}
+}
+
+do_install() {
+ if is_crosscompile ; then
+ INCLUDEDIR="/usr/${CTARGET}/usr/include"
+ else
+ INCLUDEDIR="/usr/include"
+ fi
+
+ dodir ${INCLUDEDIR}
+ CTARGET="${CHOST}" \
+ install_includes ${INCLUDEDIR}
+
+ is_crosscompile && use crosscompile_opts_headers-only && return 0
+
+ # Install a libusb.pc for better compat with Linux's libusb
+ if use usb ; then
+ dodir /usr/$(get_libdir)/pkgconfig
+ sed -i.bkp "s:^libdir=.*:libdir=/usr/$(get_libdir):g" "${S}"/libusb/libusb-*.pc
+ fi
+
+ for i in $(get_subdirs) ; do
+ if [[ ${i} != *libiconv_modules* ]] ; then
+ einfo "Installing in ${i}..."
+ cd "${WORKDIR}/${i}/" || die "missing ${i}."
+ freebsd_src_install || die "Install ${i} failed"
+ fi
+ done
+
+ if ! is_crosscompile; then
+ local mymakeopts_save="${mymakeopts}"
+ mymakeopts="${mymakeopts} SHLIBDIR=/usr/$(get_libdir)/i18n LIBDIR=/usr/$(get_libdir)/i18n"
+
+ einfo "Installing in lib/libiconv_modules..."
+ cd "${WORKDIR}/lib/libiconv_modules/" || die "missing libiconv_modules."
+ freebsd_src_install || die "Install lib/libiconv_modules failed"
+
+ mymakeopts="${mymakeopts_save}"
+ fi
+
+ if ! is_crosscompile ; then
+ if ! multilib_is_native_abi ; then
+ DESTDIR="${D}" gen_libc_ldscript "usr/$(get_libdir)" "usr/$(get_libdir)" "usr/$(get_libdir)"
+ else
+ dodir "$(get_libdir)"
+ DESTDIR="${D}" gen_libc_ldscript "$(get_libdir)" "usr/$(get_libdir)" "usr/$(get_libdir)"
+ fi
+ else
+ CHOST=${CTARGET} DESTDIR="${D}/usr/${CTARGET}/" gen_libc_ldscript "usr/lib" "usr/lib" "usr/lib"
+ # We're done for the cross libc here.
+ return 0
+ fi
+
+ # Generate ldscripts for core libraries that will go in /
+ multilib_is_native_abi && \
+ gen_usr_ldscript -a alias cam geom ipsec jail kiconv \
+ kvm m md procstat sbuf thr ufs util elf
+
+ if [[ ${#MULTIBUILD_VARIANTS[@]} -gt 1 ]] ; then
+ cd "${D}/usr/include"
+ for i in machine/*.h fenv.h ; do
+ move_header ${i}
+ done
+ if multilib_is_native_abi ; then
+ # Supposedly the last one!
+ local uniq_headers="$(echo ${header_list} | tr ' ' '\n' | sort | uniq | tr '\n' ' ')"
+ for j in ${uniq_headers} ; do
+ make_header_template > ${j}
+ for i in $(get_all_abis) ; do
+ wrap_header ${j} ${i} > ${j}.new
+ cp ${j}.new ${j}
+ rm -f ${j}.new
+ done
+ wrap_header_end ${j} > ${j}.new
+ cp ${j}.new ${j}
+ rm -f ${j}.new
+ done
+ fi
+ fi
+}
+
+src_install() {
+ if is_crosscompile ; then
+ einfo "Installing for ${CTARGET} in ${CHOST}.."
+ # From this point we need to force: get stripped with the correct tools,
+ # get tc-arch-kernel to return the right value, etc.
+ export CHOST=${CTARGET}
+
+ mymakeopts="${mymakeopts} WITHOUT_MAN= \
+ INCLUDEDIR=/usr/${CTARGET}/usr/include \
+ SHLIBDIR=/usr/${CTARGET}/usr/lib \
+ LIBDIR=/usr/${CTARGET}/usr/lib"
+
+ dosym "usr/include" "/usr/${CTARGET}/sys-include"
+ do_install
+
+ return 0
+ else
+ export STRIP_MASK="*/usr/lib*/*crt*.o"
+ local MULTIBUILD_VARIANTS=( $(multilib_get_enabled_abis) )
+ multibuild_foreach_variant freebsd_multilib_multibuild_wrapper do_install
+ fi
+
+ cd "${WORKDIR}/etc/"
+ insinto /etc
+ doins nls.alias mac.conf netconfig
+
+ # Install ttys file
+ local MACHINE="$(tc-arch-kernel)"
+ doins "etc.${MACHINE}"/*
+}
+
+install_includes()
+{
+ local INCLUDEDIR="$1"
+
+ # The idea is to be called from either install or unpack.
+ # During unpack it's required to install them as portage's user.
+ if [[ "${EBUILD_PHASE}" == "install" ]]; then
+ local DESTDIR="${D}"
+ BINOWN="root"
+ BINGRP="wheel"
+ else
+ local DESTDIR="${WORKDIR}"
+ [[ -z "${USER}" ]] && USER="portage"
+ BINOWN="${USER}"
+ [[ -z "${GROUPS}" ]] && GROUPS="portage"
+ BINGRP="${GROUPS}"
+ fi
+
+ # Must exist before we use it.
+ [[ -d "${DESTDIR}${INCLUDEDIR}" ]] || die "dodir or mkdir ${INCLUDEDIR} before using install_includes."
+ cd "${WORKDIR}/include"
+
+ local MACHINE="$(tc-arch-kernel)"
+
+ einfo "Installing includes into ${INCLUDEDIR} as ${BINOWN}:${BINGRP}..."
+ $(freebsd_get_bmake) installincludes \
+ MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE} \
+ DESTDIR="${DESTDIR}" \
+ INCLUDEDIR="${INCLUDEDIR}" BINOWN="${BINOWN}" \
+ BINGRP="${BINGRP}" \
+ WITHOUT_GSSAPI= \
+ SRCTOP="${WORKDIR}"|| die "install_includes() failed"
+ einfo "includes installed ok."
+ EXTRA_INCLUDES="lib/librtld_db lib/libutil lib/msun gnu/lib/libregex lib/libcasper lib/libmp"
+ for i in $EXTRA_INCLUDES; do
+ einfo "Installing $i includes into ${INCLUDEDIR} as ${BINOWN}:${BINGRP}..."
+ cd "${WORKDIR}/$i" || die
+ $(freebsd_get_bmake) installincludes DESTDIR="${DESTDIR}" \
+ MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE} \
+ INCLUDEDIR="${INCLUDEDIR}" BINOWN="${BINOWN}" \
+ BINGRP="${BINGRP}" \
+ SRCTOP="${WORKDIR}" || die "problem installing $i includes."
+ einfo "$i includes installed ok."
+ done
+}
diff --git a/sys-freebsd/freebsd-lib/freebsd-lib-11.1.ebuild b/sys-freebsd/freebsd-lib/freebsd-lib-11.1.ebuild
new file mode 100644
index 000000000000..a1e2b461df4b
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/freebsd-lib-11.1.ebuild
@@ -0,0 +1,708 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+
+inherit bsdmk freebsd flag-o-matic multilib toolchain-funcs eutils multibuild multilib-build
+
+DESCRIPTION="FreeBSD's base system libraries"
+SLOT="0"
+LICENSE="BSD GPL-2 zfs? ( CDDL )"
+
+# Security Advisory and Errata patches.
+# UPSTREAM_PATCHES=()
+
+# Crypto is needed to have an internal OpenSSL header
+# sys is needed for libalias, probably we can just extract that instead of
+# extracting the whole tarball
+if [[ ${PV} != *9999* ]]; then
+ KEYWORDS="~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+ SRC_URI="${SRC_URI}
+ $(freebsd_upstream_patches)"
+fi
+
+EXTRACTONLY="
+ lib/
+ contrib/
+ crypto/
+ libexec/
+ etc/
+ include/
+ usr.bin/
+ usr.sbin/
+ gnu/
+ secure/
+"
+
+if [ "${CATEGORY#*cross-}" = "${CATEGORY}" ]; then
+ RDEPEND="ssl? ( dev-libs/openssl:0= )
+ hesiod? ( net-dns/hesiod )
+ kerberos? ( app-crypt/heimdal )
+ pam? ( virtual/pam )
+ usb? ( !dev-libs/libusb )
+ zfs? ( =sys-freebsd/freebsd-cddl-${RV}* )
+ >=dev-libs/expat-2.0.1
+ >=dev-util/dialog-1.2.20150225
+ !sys-freebsd/freebsd-libexec
+ !sys-libs/libutempter
+ !dev-libs/libelf
+ !dev-libs/libexecinfo
+ !dev-libs/libiconv
+ !sys-freebsd/freebsd-headers"
+ DEPEND="${RDEPEND}
+ >=sys-devel/flex-2.5.31-r2
+ =sys-freebsd/freebsd-sources-${RV}*"
+ RDEPEND="${RDEPEND}
+ =sys-freebsd/freebsd-share-${RV}*
+ xinetd? ( sys-apps/xinetd )
+ >=virtual/libiconv-0-r2"
+else
+ EXTRACTONLY+="sys/ "
+fi
+
+DEPEND="${DEPEND}
+ userland_GNU? ( sys-apps/mtree )
+ =sys-freebsd/freebsd-mk-defs-${RV}*"
+
+S="${WORKDIR}/lib"
+
+export CTARGET=${CTARGET:-${CHOST}}
+if [ "${CTARGET}" = "${CHOST}" -a "${CATEGORY#*cross-}" != "${CATEGORY}" ]; then
+ export CTARGET=${CATEGORY/cross-}
+fi
+
+IUSE="atm bluetooth ssl hesiod ipv6 kerberos usb netware
+ build crosscompile_opts_headers-only zfs pam xinetd
+ userland_GNU userland_BSD"
+
+QA_DT_NEEDED="lib/libc.so.7 usr/lib32/libc.so.7"
+
+pkg_setup() {
+ # Add the required source files.
+ use build && EXTRACTONLY+="sys/ "
+ use zfs && EXTRACTONLY+="cddl/ "
+
+ [ -c /dev/zero ] || \
+ die "You forgot to mount /dev; the compiled libc would break."
+
+ if ! use ssl && use kerberos; then
+ eerror "If you want kerberos support you need to enable ssl support, too."
+ fi
+
+ use atm || mymakeopts="${mymakeopts} WITHOUT_ATM= "
+ use bluetooth || mymakeopts="${mymakeopts} WITHOUT_BLUETOOTH= "
+ use hesiod || mymakeopts="${mymakeopts} WITHOUT_HESIOD= "
+ use ipv6 || mymakeopts="${mymakeopts} WITHOUT_INET6_SUPPORT= "
+ use kerberos || mymakeopts="${mymakeopts} WITHOUT_KERBEROS_SUPPORT= WITHOUT_GSSAPI= "
+ use netware || mymakeopts="${mymakeopts} WITHOUT_IPX= WITHOUT_IPX_SUPPORT= WITHOUT_NCP= "
+ use ssl || mymakeopts="${mymakeopts} WITHOUT_OPENSSL= "
+ use usb || mymakeopts="${mymakeopts} WITHOUT_USB= "
+ use zfs || mymakeopts="${mymakeopts} WITHOUT_CDDL= "
+
+ mymakeopts="${mymakeopts} WITHOUT_SENDMAIL= WITHOUT_CLANG= WITHOUT_LIBCPLUSPLUS= WITHOUT_LDNS= WITHOUT_UNBOUND= WITHOUT_BSNMP= "
+
+ if [ "${CTARGET}" != "${CHOST}" ]; then
+ mymakeopts="${mymakeopts} MACHINE=$(tc-arch-kernel ${CTARGET})"
+ mymakeopts="${mymakeopts} MACHINE_ARCH=$(tc-arch-kernel ${CTARGET})"
+ fi
+
+ # Taken from freebsd-libexec.
+ use pam || mymakeopts="${mymakeopts} WITHOUT_PAM_SUPPORT= "
+ if has_version "<sys-freebsd/freebsd-ubin-11.0"; then
+ mymakeopts="${mymakeopts} WITHOUT_MAN_UTILS= "
+ fi
+}
+
+PATCHES=(
+ "${FILESDIR}/${PN}-6.0-pmc.patch"
+ "${FILESDIR}/${PN}-9.0-bluetooth.patch"
+ "${FILESDIR}/${PN}-11.0-workaround.patch"
+ "${FILESDIR}/${PN}-11.0-bsdxml2expat.patch"
+ "${FILESDIR}/${PN}-11.0-libproc-libcxx.patch"
+ "${FILESDIR}/${PN}-11.1-liblink.patch"
+ "${FILESDIR}/${PN}-add-nossp-cflags.patch"
+ )
+# Here we disable and remove source which we don't need or want
+# In order:
+# - ncurses stuff
+# - libexpat creates a bsdxml library which is the same as expat
+# - archiving libraries (have their own ebuild)
+# - sendmail libraries (they are installed by sendmail)
+# - SNMP library and dependency (have their own ebuilds)
+# - libstand: static library, 32bits on amd64 used for boot0, we build it from
+# boot0 instead.
+#
+# The rest are libraries we already have somewhere else because
+# they are contribution.
+REMOVE_SUBDIRS="ncurses \
+ libexpat \
+ libz libbz2 libarchive liblzma \
+ libsm libsmdb libsmutil \
+ libbegemot libbsnmp \
+ libpam libpcap libwrap libmagic \
+ libcom_err
+ libedit
+ libstand
+ libgssapi"
+
+# Are we building a cross-compiler?
+is_crosscompile() {
+ [ "${CATEGORY#*cross-}" != "${CATEGORY}" ]
+}
+
+src_prepare() {
+ # If gcc-5.0 or later, apply a workaround to fix a critical issue. bug 573358
+ [[ "$(gcc-major-version)" -ge 5 ]] && replace-flags -O? -O1
+
+ sed -i.bak -e 's:-o/dev/stdout:-t:' "${S}/libc/net/Makefile.inc"
+
+ # Upstream Display Managers default to using VT7
+ # We should make FreeBSD allow this by default
+ local x=
+ for x in "${WORKDIR}"/etc/etc.*/ttys ; do
+ sed -i.bak \
+ -e '/ttyv5[[:space:]]/ a\
+# Display Managers default to VT7.\
+# If you use the xdm init script, keep ttyv6 commented out\
+# unless you force a different VT for the DM being used.' \
+ -e '/^ttyv[678][[:space:]]/ s/^/# /' "${x}" \
+ || die "Failed to sed ${x}"
+ rm "${x}".bak
+ done
+
+ # This one is here because it also
+ # patches "${WORKDIR}/include"
+ cd "${WORKDIR}"
+ epatch "${FILESDIR}/${PN}-includes.patch"
+
+ # Don't install the hesiod man page or header
+ rm "${WORKDIR}"/include/hesiod.h || die
+ sed -i.bak -e 's:hesiod.h::' "${WORKDIR}"/include/Makefile || die
+ sed -i.bak -e 's:hesiod.c::' -e 's:hesiod.3::' \
+ "${WORKDIR}"/lib/libc/net/Makefile.inc || die
+
+ # Fix the Makefiles of these few libraries that will overwrite our LDADD.
+ cd "${S}"
+ for dir in libradius libtacplus libcam libdevstat libfetch libgeom libmemstat libopie \
+ libsmb libprocstat libulog; do sed -i.bak -e 's:LDADD=:LDADD+=:g' "${dir}/Makefile" || \
+ die "Problem fixing \"${dir}/Makefile"
+ done
+ # Call LD with LDFLAGS, rename them to RAW_LDFLAGS
+ sed -e 's/LDFLAGS/RAW_LDFLAGS/g' \
+ -i "${S}/csu/i386/Makefile" || die
+
+ if install --version 2> /dev/null | grep -q GNU; then
+ sed -i.bak -e 's:${INSTALL} -C:${INSTALL}:' "${WORKDIR}/include/Makefile"
+ fi
+
+ # libsysdecode requires the latest headers.
+ need_bootstrap && \
+ sed -i "s:\${DESTDIR}\${INCLUDEDIR}:${WORKDIR}/include_proper_${ABI}:g" "${S}/libsysdecode/Makefile"
+
+ # Taken from freebsd-libexec.
+ cd "${WORKDIR}/libexec"
+ dummy_mk smrsh mail.local tcpd telnetd rshd rlogind ftpd
+ # The old version of yacc doesn't support YFLAGS="-i".
+ if has_version "<sys-freebsd/freebsd-ubin-11.0"; then
+ sed -i -e '/^YFLAGS/d' "${WORKDIR}/libexec/dma/dmagent/Makefile"
+ fi
+
+ # Try to fix sed calls for GNU sed. Do it only with GNU userland and force
+ # BSD's sed on BSD.
+ cd "${S}"
+ if [[ ${CBUILD:-${CHOST}} != *bsd* ]]; then
+ find . -name Makefile -exec sed -ibak 's/sed -i /sed -i/' {} \;
+ sed -i -e 's/-i ""/-i""/' "${S}/csu/Makefile.inc" || die
+ fi
+
+ if use build; then
+ cd "${WORKDIR}"
+ # This patch has to be applied on ${WORKDIR}/sys, so we do it here since it
+ # shouldn't be a symlink to /usr/src/sys (which should be already patched)
+ epatch "${FILESDIR}"/freebsd-sources-9.0-sysctluint.patch
+ return 0
+ fi
+
+ if ! is_crosscompile ; then
+ if [[ ! -e "${WORKDIR}/sys" ]]; then
+ ln -s "${SYSROOT}/usr/src/sys" "${WORKDIR}/sys" || die "Couldn't make sys symlink!"
+ fi
+ else
+ sed -i.bak -e "s:/usr/include:/usr/${CTARGET}/usr/include:g" \
+ "${S}/libc/rpc/Makefile.inc" \
+ "${S}/libc/yp/Makefile.inc"
+ fi
+}
+
+bootstrap_lib() {
+ for i ; do
+ cd "${WORKDIR}/${i}" || die "missing ${i}"
+ freebsd_src_compile
+ append-ldflags "-L${MAKEOBJDIRPREFIX}/${WORKDIR}/${i}"
+ done
+}
+
+get_csudir() {
+ if [ -d "${WORKDIR}/lib/csu/$1-elf" ]; then
+ echo "lib/csu/$1-elf"
+ else
+ echo "lib/csu/$1"
+ fi
+}
+
+bootstrap_csu() {
+ local csudir="$(get_csudir $(tc-arch-kernel ${CTARGET}))"
+ export RAW_LDFLAGS=$(raw-ldflags)
+ bootstrap_lib "${csudir}"
+
+ CFLAGS="${CFLAGS} -B ${MAKEOBJDIRPREFIX}/${WORKDIR}/${csudir}"
+ append-ldflags "-B ${MAKEOBJDIRPREFIX}/${WORKDIR}/${csudir}"
+
+ bootstrap_lib "gnu/lib/csu"
+
+ cd "${MAKEOBJDIRPREFIX}/${WORKDIR}/gnu/lib/csu"
+ for i in *.So ; do
+ ln -s $i ${i%.So}S.o
+ done
+ CFLAGS="${CFLAGS} -B ${MAKEOBJDIRPREFIX}/${WORKDIR}/gnu/lib/csu"
+ append-ldflags "-B ${MAKEOBJDIRPREFIX}/${WORKDIR}/gnu/lib/csu"
+}
+
+# Compile libssp_nonshared.a and add it's path to LDFLAGS.
+bootstrap_libssp_nonshared() {
+ bootstrap_lib "gnu/lib/libssp/libssp_nonshared"
+}
+
+# We should call this function to compile itself correctly.
+# A better solution is very welcome.
+bootstrap_libc() {
+ mkdir "${WORKDIR}/bootstrap_libc_${ABI}" || die
+ append-ldflags "-L${WORKDIR}/bootstrap_libc_${ABI}"
+
+ bootstrap_lib "lib/libc" "lib/libc_nonshared"
+ echo "GROUP ( ${MAKEOBJDIRPREFIX}/${WORKDIR}/lib/libc/libc.so.7 ${MAKEOBJDIRPREFIX}/${WORKDIR}/lib/libc_nonshared/libc_nonshared.a ${MAKEOBJDIRPREFIX}/${WORKDIR}/gnu/lib/libssp/libssp_nonshared/libssp_nonshared.a )" > "${WORKDIR}/bootstrap_libc_${ABI}/libc.so" || die
+}
+
+bootstrap_libgcc() {
+ bootstrap_lib "lib/libcompiler_rt"
+ cd "${MAKEOBJDIRPREFIX}/${WORKDIR}/lib/libcompiler_rt" || die
+ ln -s libcompiler_rt.a libgcc.a || die
+
+ bootstrap_libc
+ bootstrap_lib "gnu/lib/libgcc"
+}
+
+bootstrap_libthr() {
+ bootstrap_lib "lib/libthr"
+ cd "${MAKEOBJDIRPREFIX}/${WORKDIR}/lib/libthr" || die
+ ln -s libthr.so libpthread.so
+}
+
+# What to build for a cross-compiler.
+# We also need the csu but this has to be handled separately.
+CROSS_SUBDIRS="lib/libc lib/msun gnu/lib/libssp/libssp_nonshared lib/libthr lib/libutil lib/librt lib/libc_nonshared lib/libcompiler_rt"
+
+# What to build for non-default ABIs.
+NON_NATIVE_SUBDIRS="${CROSS_SUBDIRS} gnu/lib/csu gnu/lib/libgcc lib/libmd lib/libcrypt lib/libsbuf lib/libcam lib/libelf lib/libiconv_modules"
+
+# Subdirs for a native build:
+NATIVE_SUBDIRS="lib gnu/lib/libssp/libssp_nonshared gnu/lib/libregex gnu/lib/csu gnu/lib/libgcc lib/libiconv_modules"
+
+# Is my $ABI native ?
+is_native_abi() {
+ is_crosscompile && return 1
+ multilib_is_native_abi
+}
+
+# Do we need to bootstrap the csu and libssp_nonshared?
+need_bootstrap() {
+ is_crosscompile || use build || { ! is_native_abi && ! has_version '>=sys-freebsd/freebsd-lib-9.1-r8[multilib]' && ! has_version ">=sys-freebsd/freebsd-lib-9.1-r11[${MULTILIB_USEDEP}]" ; } || has_version "<${CATEGORY}/${P}"
+}
+
+# Get the subdirs we are building.
+get_subdirs() {
+ local ret=""
+ if is_native_abi ; then
+ # If we are building for the native ABI, build everything
+ ret="${NATIVE_SUBDIRS}"
+ elif is_crosscompile ; then
+ # With a cross-compiler we only build the very core parts.
+ ret="${CROSS_SUBDIRS}"
+ if [ "${EBUILD_PHASE}" = "install" ]; then
+ # Add the csu dir first when installing. We treat it separately for
+ # compiling.
+ ret="$(get_csudir $(tc-arch-kernel ${CTARGET})) ${ret}"
+ fi
+ else
+ # For the non-native ABIs we only build the csu parts and very core
+ # libraries for now.
+ ret="${NON_NATIVE_SUBDIRS} $(get_csudir $(tc-arch-kernel ${CHOST}))"
+ fi
+ echo "${ret}"
+}
+
+# Bootstrap the core libraries and setup the flags so that the other parts can
+# build against it.
+do_bootstrap() {
+ einfo "Bootstrapping on ${CHOST} for ${CTARGET}"
+ if ! is_crosscompile ; then
+ # Pre-install headers, but not when building a cross-compiler since we
+ # assume they have been installed in the previous pass.
+ einfo "Pre-installing includes in include_proper_${ABI}"
+ mkdir "${WORKDIR}/include_proper_${ABI}" || die
+ CTARGET="${CHOST}" install_includes "/include_proper_${ABI}"
+ CFLAGS="${CFLAGS} -isystem ${WORKDIR}/include_proper_${ABI}"
+ [[ $(tc-getCXX) = *clang++* ]] && CXXFLAGS="${CXXFLAGS} -isystem /usr/include/c++/v1"
+ CXXFLAGS="${CXXFLAGS} -isystem ${WORKDIR}/include_proper_${ABI}"
+ mymakeopts="${mymakeopts} RPCDIR=${WORKDIR}/include_proper_${ABI}/rpcsvc"
+ fi
+ bootstrap_csu
+ bootstrap_libssp_nonshared
+ if is_crosscompile ; then
+ bootstrap_lib "lib/libcompiler_rt"
+ bootstrap_libc
+ else
+ is_native_abi || bootstrap_libgcc
+ is_native_abi && has_version "<=sys-freebsd/freebsd-lib-10.0" && bootstrap_libgcc
+ fi
+ is_native_abi || bootstrap_libthr
+}
+
+# Taken from freebsd-libexec.
+libexec_setup_multilib_vars() {
+ export mymakeopts="${mymakeopts} WITHOUT_RCMDS= WITHOUT_PF= "
+ need_bootstrap && CFLAGS="${CFLAGS} -isystem ${WORKDIR}/include_proper_${ABI}"
+ append-ldflags "-L${MAKEOBJDIRPREFIX}/${WORKDIR}/lib/libc"
+ if ! multilib_is_native_abi ; then
+ cd "${WORKDIR}/libexec/rtld-elf" || die
+ export mymakeopts="${mymakeopts} PROG=ld-elf32.so.1 "
+ else
+ cd "${WORKDIR}/libexec" || die
+ fi
+ "$@"
+}
+
+# Compile it. Assume we have the toolchain setup correctly.
+do_compile() {
+ # Bootstrap if needed, otherwise assume the system headers are in
+ # /usr/include.
+ if need_bootstrap ; then
+ do_bootstrap
+ else
+ CFLAGS="${CFLAGS} -isystem /usr/include"
+ [[ $(tc-getCXX) = *clang++* ]] && CXXFLAGS="${CXXFLAGS} -isystem /usr/include/c++/v1"
+ fi
+
+ export RAW_LDFLAGS=$(raw-ldflags)
+
+ # Everything is now setup, build it!
+ for i in $(get_subdirs) ; do
+ einfo "Building in ${i}... with CC=${CC} and CFLAGS=${CFLAGS}"
+ cd "${WORKDIR}/${i}/" || die "missing ${i}."
+ freebsd_src_compile || die "make ${i} failed"
+ done
+}
+
+src_compile() {
+ # Does not work with GNU sed
+ # Force BSD's sed on BSD.
+ if [[ ${CBUILD:-${CHOST}} == *bsd* ]]; then
+ export ESED=/usr/bin/sed
+ unalias sed
+ fi
+
+ use usb && export NON_NATIVE_SUBDIRS="${NON_NATIVE_SUBDIRS} lib/libusb lib/libusbhid"
+
+ cd "${WORKDIR}/include"
+ $(freebsd_get_bmake) CC="$(tc-getCC)" SRCTOP="${WORKDIR}" || die "make include failed"
+
+ use crosscompile_opts_headers-only && return 0
+
+ # Bug #270098
+ append-flags $(test-flags -fno-strict-aliasing)
+
+ # Bug #324445
+ append-flags $(test-flags -fno-strict-overflow)
+
+ # strip flags and do not do it later, we only add safe, and in fact
+ # needed flags after all
+ strip-flags
+ export NOFLAGSTRIP=yes
+ if is_crosscompile ; then
+ export YACC='yacc -by'
+ CHOST=${CTARGET} tc-export CC LD CXX RANLIB
+ mymakeopts="${mymakeopts} NLS="
+ CFLAGS="${CFLAGS} -isystem /usr/${CTARGET}/usr/include"
+ CXXFLAGS="${CXXFLAGS} -isystem /usr/${CTARGET}/usr/include"
+ append-ldflags "-L${WORKDIR}/${CHOST}/${WORKDIR}/lib/libc"
+ fi
+
+ if is_crosscompile ; then
+ do_compile
+ else
+ local MULTIBUILD_VARIANTS=( $(multilib_get_enabled_abis) )
+ multibuild_foreach_variant freebsd_multilib_multibuild_wrapper do_compile
+ multibuild_foreach_variant freebsd_multilib_multibuild_wrapper libexec_setup_multilib_vars freebsd_src_compile
+ fi
+}
+
+gen_libc_ldscript() {
+ # Parameters:
+ # $1 = target libdir
+ # $2 = source libc dir
+ # $3 = source libssp_nonshared dir
+
+ # Clear the symlink.
+ rm -f "${DESTDIR}/$2/libc.so" || die
+
+ # Move the library if needed
+ if [ "$1" != "$2" ] ; then
+ mv "${DESTDIR}/$2/libc.so.7" "${DESTDIR}/$1/" || die
+ fi
+
+ # Generate libc.so ldscript for inclusion of libssp_nonshared.a when linking
+ # this is done to avoid having to touch gcc spec file as it is currently
+ # done on FreeBSD upstream, mostly because their binutils aren't able to
+ # cope with linker scripts yet.
+ # Taken from toolchain-funcs.eclass:
+ local output_format
+ output_format=$($(tc-getCC) ${CFLAGS} ${LDFLAGS} -Wl,--verbose 2>&1 | sed -n 's/^OUTPUT_FORMAT("\([^"]*\)",.*/\1/p')
+ [[ -n ${output_format} ]] && output_format="OUTPUT_FORMAT ( ${output_format} )"
+
+ # The iconv symbol is provided by libc_nonshared.a.
+ # http://svnweb.freebsd.org/base?view=revision&amp;revision=258283
+ cat > "${DESTDIR}/$2/libc.so" <<-END_LDSCRIPT
+/* GNU ld script
+ SSP (-fstack-protector) requires __stack_chk_fail_local to be local.
+ GCC invokes this symbol in a non-PIC way, which results in TEXTRELs if
+ this symbol was provided by a shared libc. So we link in
+ libssp_nonshared.a from here.
+ */
+${output_format}
+GROUP ( /$1/libc.so.7 /$3/libc_nonshared.a /$3/libssp_nonshared.a )
+END_LDSCRIPT
+}
+
+header_list=""
+
+move_header() {
+ local dirname=$(dirname ${1})
+ local filename=$(basename ${1})
+
+ if [ ! -d "${dirname}/${ABI}" ] ; then
+ mkdir "${dirname}/${ABI}" || die
+ fi
+
+ mv "${1}" "${dirname}/${ABI}/" || die
+
+ export header_list="${header_list} ${1}"
+}
+
+make_header_template() {
+ cat <<-END_HEADER
+/*
+ * Wrapped header for multilib support.
+ * See the real headers included below.
+ */
+
+#if defined(__x86_64__)
+ @ABI_amd64_fbsd@
+#elif defined(__i386__)
+ @ABI_x86_fbsd@
+#else
+ @ABI_${DEFAULT_ABI}@
+#endif
+END_HEADER
+}
+
+wrap_header() {
+ local dirname=$(dirname ${1})
+ local filename=$(basename ${1})
+
+ if [ -n "${dirname#.}" ] ; then
+ dirname="${dirname}/${2}"
+ else
+ dirname="${2}"
+ fi
+
+ if [ -f "${dirname}/${filename}" ] ; then
+ sed -e "s:@ABI_${2}@:#include <${dirname}/${filename}>:" ${1}
+ else
+ cat ${1}
+ fi
+}
+
+wrap_header_end() {
+ sed -e "s:@ABI_.*@:#error \"Sorry, no support for your ABI.\":" ${1}
+}
+
+do_install() {
+ if is_crosscompile ; then
+ INCLUDEDIR="/usr/${CTARGET}/usr/include"
+ else
+ INCLUDEDIR="/usr/include"
+ fi
+
+ dodir ${INCLUDEDIR}
+ CTARGET="${CHOST}" \
+ install_includes ${INCLUDEDIR}
+
+ is_crosscompile && use crosscompile_opts_headers-only && return 0
+
+ # Install a libusb.pc for better compat with Linux's libusb
+ if use usb ; then
+ dodir /usr/$(get_libdir)/pkgconfig
+ sed -i.bkp "s:^libdir=.*:libdir=/usr/$(get_libdir):g" "${S}"/libusb/libusb-*.pc
+ fi
+
+ for i in $(get_subdirs) ; do
+ if [[ ${i} != *libiconv_modules* ]] ; then
+ einfo "Installing in ${i}..."
+ cd "${WORKDIR}/${i}/" || die "missing ${i}."
+ freebsd_src_install || die "Install ${i} failed"
+ fi
+ done
+
+ if ! is_crosscompile; then
+ local mymakeopts_save="${mymakeopts}"
+ mymakeopts="${mymakeopts} SHLIBDIR=/usr/$(get_libdir)/i18n LIBDIR=/usr/$(get_libdir)/i18n"
+
+ einfo "Installing in lib/libiconv_modules..."
+ cd "${WORKDIR}/lib/libiconv_modules/" || die "missing libiconv_modules."
+ freebsd_src_install || die "Install lib/libiconv_modules failed"
+
+ mymakeopts="${mymakeopts_save}"
+ fi
+
+ if ! is_crosscompile ; then
+ if ! multilib_is_native_abi ; then
+ DESTDIR="${D}" gen_libc_ldscript "usr/$(get_libdir)" "usr/$(get_libdir)" "usr/$(get_libdir)"
+ else
+ dodir "$(get_libdir)"
+ DESTDIR="${D}" gen_libc_ldscript "$(get_libdir)" "usr/$(get_libdir)" "usr/$(get_libdir)"
+ fi
+ else
+ CHOST=${CTARGET} DESTDIR="${D}/usr/${CTARGET}/" gen_libc_ldscript "usr/lib" "usr/lib" "usr/lib"
+ # We're done for the cross libc here.
+ return 0
+ fi
+
+ # Generate ldscripts for core libraries that will go in /
+ multilib_is_native_abi && \
+ gen_usr_ldscript -a alias cam geom ipsec jail kiconv \
+ kvm m md procstat sbuf thr ufs util elf
+
+ if [[ ${#MULTIBUILD_VARIANTS[@]} -gt 1 ]] ; then
+ cd "${D}/usr/include"
+ for i in machine/*.h fenv.h ; do
+ move_header ${i}
+ done
+ if multilib_is_native_abi ; then
+ # Supposedly the last one!
+ local uniq_headers="$(echo ${header_list} | tr ' ' '\n' | sort | uniq | tr '\n' ' ')"
+ for j in ${uniq_headers} ; do
+ make_header_template > ${j}
+ for i in $(get_all_abis) ; do
+ wrap_header ${j} ${i} > ${j}.new
+ cp ${j}.new ${j}
+ rm -f ${j}.new
+ done
+ wrap_header_end ${j} > ${j}.new
+ cp ${j}.new ${j}
+ rm -f ${j}.new
+ done
+ fi
+ fi
+}
+
+src_install() {
+ if is_crosscompile ; then
+ einfo "Installing for ${CTARGET} in ${CHOST}.."
+ # From this point we need to force: get stripped with the correct tools,
+ # get tc-arch-kernel to return the right value, etc.
+ export CHOST=${CTARGET}
+
+ mymakeopts="${mymakeopts} WITHOUT_MAN= \
+ INCLUDEDIR=/usr/${CTARGET}/usr/include \
+ SHLIBDIR=/usr/${CTARGET}/usr/lib \
+ LIBDIR=/usr/${CTARGET}/usr/lib"
+
+ dosym "usr/include" "/usr/${CTARGET}/sys-include"
+ do_install
+
+ return 0
+ else
+ export STRIP_MASK="*/usr/lib*/*crt*.o"
+ local MULTIBUILD_VARIANTS=( $(multilib_get_enabled_abis) )
+ multibuild_foreach_variant freebsd_multilib_multibuild_wrapper do_install
+
+ # Taken from freebsd-libexec.
+ multibuild_foreach_variant freebsd_multilib_multibuild_wrapper libexec_setup_multilib_vars freebsd_src_install
+ insinto /etc
+ doins "${WORKDIR}/etc/gettytab"
+ newinitd "${FILESDIR}/bootpd.initd" bootpd
+ newconfd "${FILESDIR}/bootpd.confd" bootpd
+
+ if use xinetd; then
+ for rpcd in rstatd rusersd walld rquotad sprayd; do
+ insinto /etc/xinetd.d
+ newins "${FILESDIR}/${rpcd}.xinetd" ${rpcd}
+ done
+ fi
+ fi
+
+ cd "${WORKDIR}/etc/"
+ insinto /etc
+ doins nls.alias mac.conf netconfig
+
+ # Install ttys file
+ local MACHINE="$(tc-arch-kernel)"
+ doins "etc.${MACHINE}"/*
+}
+
+install_includes()
+{
+ local INCLUDEDIR="$1"
+
+ # The idea is to be called from either install or unpack.
+ # During unpack it's required to install them as portage's user.
+ if [[ "${EBUILD_PHASE}" == "install" ]]; then
+ local DESTDIR="${D}"
+ BINOWN="root"
+ BINGRP="wheel"
+ else
+ local DESTDIR="${WORKDIR}"
+ [[ -z "${USER}" ]] && USER="portage"
+ BINOWN="${USER}"
+ [[ -z "${GROUPS}" ]] && GROUPS="portage"
+ BINGRP="${GROUPS}"
+ fi
+
+ # Must exist before we use it.
+ [[ -d "${DESTDIR}${INCLUDEDIR}" ]] || die "dodir or mkdir ${INCLUDEDIR} before using install_includes."
+ cd "${WORKDIR}/include"
+
+ local MACHINE="$(tc-arch-kernel)"
+
+ einfo "Installing includes into ${INCLUDEDIR} as ${BINOWN}:${BINGRP}..."
+ $(freebsd_get_bmake) installincludes \
+ MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE} \
+ DESTDIR="${DESTDIR}" \
+ INCLUDEDIR="${INCLUDEDIR}" BINOWN="${BINOWN}" \
+ BINGRP="${BINGRP}" \
+ WITHOUT_GSSAPI= \
+ $(usex zfs "WITH_CDDL=" "WITHOUT_CDDL=") \
+ SRCTOP="${WORKDIR}"|| die "install_includes() failed"
+ einfo "includes installed ok."
+ EXTRA_INCLUDES="lib/librtld_db lib/libutil lib/msun gnu/lib/libregex lib/libcasper lib/libmp"
+ for i in $EXTRA_INCLUDES; do
+ einfo "Installing $i includes into ${INCLUDEDIR} as ${BINOWN}:${BINGRP}..."
+ cd "${WORKDIR}/$i" || die
+ $(freebsd_get_bmake) installincludes DESTDIR="${DESTDIR}" \
+ MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE} \
+ INCLUDEDIR="${INCLUDEDIR}" BINOWN="${BINOWN}" \
+ BINGRP="${BINGRP}" \
+ SRCTOP="${WORKDIR}" || die "problem installing $i includes."
+ einfo "$i includes installed ok."
+ done
+}
diff --git a/sys-freebsd/freebsd-lib/freebsd-lib-8.2-r1.ebuild b/sys-freebsd/freebsd-lib/freebsd-lib-8.2-r1.ebuild
new file mode 100644
index 000000000000..755c53b84971
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/freebsd-lib-8.2-r1.ebuild
@@ -0,0 +1,438 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=2
+
+inherit bsdmk freebsd flag-o-matic multilib toolchain-funcs eutils
+
+DESCRIPTION="FreeBSD's base system libraries"
+SLOT="0"
+KEYWORDS="~sparc-fbsd ~x86-fbsd"
+
+# Crypto is needed to have an internal OpenSSL header
+# sys is needed for libalias, probably we can just extract that instead of
+# extracting the whole tarball
+SRC_URI="mirror://gentoo/${LIB}.tar.bz2
+ mirror://gentoo/${CONTRIB}.tar.bz2
+ mirror://gentoo/${CRYPTO}.tar.bz2
+ mirror://gentoo/${LIBEXEC}.tar.bz2
+ mirror://gentoo/${ETC}.tar.bz2
+ mirror://gentoo/${INCLUDE}.tar.bz2
+ mirror://gentoo/${USBIN}.tar.bz2
+ mirror://gentoo/${GNU}.tar.bz2
+ build? (
+ mirror://gentoo/${SYS}.tar.bz2 )"
+
+if [ "${CATEGORY#*cross-}" = "${CATEGORY}" ]; then
+ RDEPEND="ssl? ( dev-libs/openssl )
+ hesiod? ( net-dns/hesiod )
+ kerberos? ( virtual/krb5 )
+ usb? ( !dev-libs/libusb )
+ userland_GNU? ( sys-apps/mtree )
+ >=dev-libs/expat-2.0.1
+ !sys-freebsd/freebsd-headers"
+ DEPEND="${RDEPEND}
+ >=sys-devel/flex-2.5.31-r2
+ =sys-freebsd/freebsd-sources-${RV}*
+ !bootstrap? ( app-arch/bzip2 )"
+else
+ SRC_URI="${SRC_URI}
+ mirror://gentoo/${SYS}.tar.bz2"
+fi
+
+DEPEND="${DEPEND}
+ =sys-freebsd/freebsd-mk-defs-${RV}*"
+
+S="${WORKDIR}/lib"
+
+export CTARGET=${CTARGET:-${CHOST}}
+if [ "${CTARGET}" = "${CHOST}" -a "${CATEGORY#*cross-}" != "${CATEGORY}" ]; then
+ export CTARGET=${CATEGORY/cross-}
+fi
+
+IUSE="atm bluetooth ssl hesiod ipv6 kerberos usb netware
+ build bootstrap crosscompile_opts_headers-only"
+
+pkg_setup() {
+ [ -c /dev/zero ] || \
+ die "You forgot to mount /dev; the compiled libc would break."
+
+ if ! use ssl && use kerberos; then
+ eerror "If you want kerberos support you need to enable ssl support, too."
+ fi
+
+ use atm || mymakeopts="${mymakeopts} WITHOUT_ATM= "
+ use bluetooth || mymakeopts="${mymakeopts} WITHOUT_BLUETOOTH= "
+ use hesiod || mymakeopts="${mymakeopts} WITHOUT_HESIOD= "
+ use ipv6 || mymakeopts="${mymakeopts} WITHOUT_INET6_SUPPORT= "
+ use kerberos || mymakeopts="${mymakeopts} WITHOUT_KERBEROS_SUPPORT= "
+ use netware || mymakeopts="${mymakeopts} WITHOUT_IPX= WITHOUT_IPX_SUPPORT= WITHOUT_NCP= "
+ use ssl || mymakeopts="${mymakeopts} WITHOUT_OPENSSL= "
+ use usb || mymakeopts="${mymakeopts} WITHOUT_USB= "
+
+ mymakeopts="${mymakeopts} WITHOUT_BIND= WITHOUT_BIND_LIBS= WITHOUT_SENDMAIL="
+
+ if [ "${CTARGET}" != "${CHOST}" ]; then
+ mymakeopts="${mymakeopts} MACHINE=$(tc-arch-kernel ${CTARGET})"
+ mymakeopts="${mymakeopts} MACHINE_ARCH=$(tc-arch-kernel ${CTARGET})"
+ fi
+}
+
+PATCHES=(
+ "${FILESDIR}/${PN}-6.0-pmc.patch"
+ "${FILESDIR}/${PN}-6.0-gccfloat.patch"
+ "${FILESDIR}/${PN}-6.0-flex-2.5.31.patch"
+ "${FILESDIR}/${PN}-6.1-csu.patch"
+ "${FILESDIR}/${PN}-6.2-bluetooth.patch"
+ "${FILESDIR}/${PN}-8.0-log2.patch"
+ "${FILESDIR}/${PN}-8.0-rpcsec_gss.patch"
+ "${FILESDIR}/${PN}-8.2-liblink.patch"
+ "${FILESDIR}/${PN}-bsdxml2expat.patch" )
+
+# Here we disable and remove source which we don't need or want
+# In order:
+# - ncurses stuff
+# - libexpat creates a bsdxml library which is the same as expat
+# - archiving libraries (have their own ebuild)
+# - sendmail libraries (they are installed by sendmail)
+# - SNMP library and dependency (have their own ebuilds)
+#
+# The rest are libraries we already have somewhere else because
+# they are contribution.
+# Note: libtelnet is an internal lib used by telnet and telnetd programs
+# as it's not used in freebsd-lib package itself, it's pointless building
+# it here.
+REMOVE_SUBDIRS="ncurses \
+ libexpat \
+ libz libbz2 libarchive liblzma \
+ libsm libsmdb libsmutil \
+ libbegemot libbsnmp \
+ libpam libpcap bind libwrap libmagic \
+ libcom_err libtelnet
+ libedit libelf"
+
+src_prepare() {
+ sed -i.bak -e 's:-o/dev/stdout:-t:' "${S}/libc/net/Makefile.inc"
+ sed -i.bak -e 's:histedit.h::' "${WORKDIR}/include/Makefile"
+
+ # Upstream Display Managers default to using VT7
+ # We should make FreeBSD allow this by default
+ local x=
+ for x in "${WORKDIR}"/etc/etc.*/ttys ; do
+ sed -i.bak \
+ -e '/ttyv5[[:space:]]/ a\
+# Display Managers default to VT7.\
+# If you use the xdm init script, keep ttyv6 commented out\
+# unless you force a different VT for the DM being used.' \
+ -e '/^ttyv[678][[:space:]]/ s/^/# /' "${x}" \
+ || die "Failed to sed ${x}"
+ rm "${x}".bak
+ done
+
+ # This one is here because it also
+ # patches "${WORKDIR}/include"
+ cd "${WORKDIR}"
+ epatch "${FILESDIR}/${PN}-includes.patch"
+ epatch "${FILESDIR}/${PN}-8.0-gcc45.patch"
+ epatch "${FILESDIR}/${PN}-8.2-nlm_syscall.patch"
+
+ # Don't install the hesiod man page or header
+ rm "${WORKDIR}"/include/hesiod.h || die
+ sed -i.bak -e 's:hesiod.h::' "${WORKDIR}"/include/Makefile || die
+ sed -i.bak -e 's:hesiod.c::' -e 's:hesiod.3::' \
+ "${WORKDIR}"/lib/libc/net/Makefile.inc || die
+
+ # Fix the Makefiles of these few libraries that will overwrite our LDADD.
+ cd "${S}"
+ for dir in libradius libtacplus libcam libdevstat libfetch libgeom libmemstat libopie \
+ libsmb; do sed -i.bak -e 's:LDADD=:LDADD+=:g' "${dir}/Makefile" || \
+ die "Problem fixing \"${dir}/Makefile"
+ done
+ if use build; then
+ cd "${WORKDIR}"
+ # This patch has to be applied on ${WORKDIR}/sys, so we do it here since it
+ # shouldn't be a symlink to /usr/src/sys (which should be already patched)
+ epatch "${FILESDIR}"/${PN}-7.1-types.h-fix.patch
+ # Preinstall includes so we don't use the system's ones.
+ mkdir "${WORKDIR}/include_proper" || die "Couldn't create ${WORKDIR}/include_proper"
+ install_includes "/include_proper"
+ return 0
+ fi
+
+ if [ "${CTARGET}" = "${CHOST}" ]; then
+ ln -s "/usr/src/sys-${RV}" "${WORKDIR}/sys" || die "Couldn't make sys symlink!"
+ else
+ sed -i.bak -e "s:/usr/include:/usr/${CTARGET}/usr/include:g" \
+ "${S}/libc/rpc/Makefile.inc" \
+ "${S}/libc/yp/Makefile.inc"
+ fi
+
+ if install --version 2> /dev/null | grep -q GNU; then
+ sed -i.bak -e 's:${INSTALL} -C:${INSTALL}:' "${WORKDIR}/include/Makefile"
+ fi
+
+ # Preinstall includes so we don't use the system's ones.
+ mkdir "${WORKDIR}/include_proper" || die "Couldn't create ${WORKDIR}/include_proper"
+ install_includes "/include_proper"
+
+ # Let arch-specific includes to be found
+ local machine
+ machine=$(tc-arch-kernel ${CTARGET})
+ ln -s "${WORKDIR}/sys/${machine}/include" "${WORKDIR}/include/machine" || \
+ die "Couldn't make ${machine}/include symlink."
+
+ cd "${S}"
+ use bootstrap && dummy_mk libstand
+ # Call LD with LDFLAGS, rename them to RAW_LDFLAGS
+ sed -e 's/LDFLAGS/RAW_LDFLAGS/g' \
+ -i "${S}/csu/i386-elf/Makefile" \
+ -i "${S}/csu/ia64/Makefile" || die
+}
+
+src_compile() {
+ cd "${WORKDIR}/include"
+ $(freebsd_get_bmake) CC="$(tc-getCC)" || die "make include failed"
+
+ use crosscompile_opts_headers-only && return 0
+
+ # Bug #270098
+ append-flags $(test-flags -fno-strict-aliasing)
+
+ # Bug #324445
+ append-flags $(test-flags -fno-strict-overflow)
+
+ strip-flags
+ if [ "${CTARGET}" != "${CHOST}" ]; then
+ export YACC='yacc -by'
+ CHOST=${CTARGET} tc-export CC LD CXX RANLIB
+ mymakeopts="${mymakeopts} NO_MANCOMPRESS= NO_INFOCOMPRESS= NLS="
+
+ local machine
+ machine=$(tc-arch-kernel ${CTARGET})
+
+ local csudir
+ if [ -d "${S}/csu/${machine}-elf" ]; then
+ csudir="${S}/csu/${machine}-elf"
+ else
+ csudir="${S}/csu/${machine}"
+ fi
+ export RAW_LDFLAGS=$(raw-ldflags)
+ cd "${csudir}"
+ $(freebsd_get_bmake) ${mymakeopts} || die "make csu failed"
+
+ append-flags "-isystem /usr/${CTARGET}/usr/include"
+ append-flags "-isystem ${WORKDIR}/lib/libutil"
+ append-flags "-isystem ${WORKDIR}/lib/msun/${machine/i386/i387}"
+ append-flags "-B ${csudir}"
+ append-ldflags "-B ${csudir}"
+
+ # First compile libssp_nonshared.a and add it's path to LDFLAGS.
+ cd "${WORKDIR}/gnu/lib/libssp/libssp_nonshared/" || die "missing libssp."
+ $(freebsd_get_bmake) ${mymakeopts} || die "make libssp failed"
+ append-ldflags "-L${WORKDIR}/gnu/lib/libssp/libssp_nonshared/"
+
+ export RAW_LDFLAGS=$(raw-ldflags)
+ cd "${S}/libc"
+ $(freebsd_get_bmake) ${mymakeopts} || die "make libc failed"
+ cd "${S}/msun"
+ append-ldflags "-L${WORKDIR}/lib/libc"
+ export RAW_LDFLAGS=$(raw-ldflags)
+ LDADD="-lssp_nonshared" $(freebsd_get_bmake) ${mymakeopts} || die "make libc failed"
+ cd "${WORKDIR}/gnu/lib/libssp/" || die "missing libssp."
+ $(freebsd_get_bmake) ${mymakeopts} || die "make libssp failed"
+ cd "${WORKDIR}/lib/libthr/" || die "missing libthr"
+ $(freebsd_get_bmake) ${mymakeopts} || die "make libthr failed"
+ else
+ # Forces to use the local copy of headers as they might be outdated in
+ # the system
+ append-flags "-isystem '${WORKDIR}/include_proper'"
+
+ # First compile libssp_nonshared.a and add it's path to LDFLAGS.
+ einfo "Compiling libssp in \"${WORKDIR}/gnu/lib/libssp/\"."
+ cd "${WORKDIR}/gnu/lib/libssp/" || die "missing libssp."
+ NOFLAGSTRIP=yes freebsd_src_compile
+ # Hack libssp_nonshared.a into libc & others since we don't have
+ # the linker script in place yet.
+ append-ldflags "-L${WORKDIR}/gnu/lib/libssp/libssp_nonshared/"
+ einfo "Compiling libc."
+ cd "${S}"
+ export RAW_LDFLAGS=$(raw-ldflags)
+ NOFLAGSTRIP=yes LDADD="-lssp_nonshared" freebsd_src_compile
+ fi
+}
+
+src_install() {
+ [ "${CTARGET}" = "${CHOST}" ] \
+ && INCLUDEDIR="/usr/include" \
+ || INCLUDEDIR="/usr/${CTARGET}/usr/include"
+ dodir ${INCLUDEDIR}
+ einfo "Installing for ${CTARGET} in ${CHOST}.."
+ install_includes ${INCLUDEDIR}
+
+ # Install math.h when crosscompiling, at this point
+ if [ "${CHOST}" != "${CTARGET}" ]; then
+ insinto "/usr/${CTARGET}/usr/include"
+ doins "${S}/msun/src/math.h"
+ fi
+
+ use crosscompile_opts_headers-only && return 0
+ local mylibdir=$(get_libdir)
+
+ if [ "${CTARGET}" != "${CHOST}" ]; then
+ local csudir
+ if [ -d "${S}/csu/$(tc-arch-kernel ${CTARGET})-elf" ]; then
+ csudir="${S}/csu/$(tc-arch-kernel ${CTARGET})-elf"
+ else
+ csudir="${S}/csu/$(tc-arch-kernel ${CTARGET})"
+ fi
+ cd "${csudir}"
+ $(freebsd_get_bmake) ${mymakeopts} DESTDIR="${D}" install \
+ FILESDIR="/usr/${CTARGET}/usr/lib" LIBDIR="/usr/${CTARGET}/usr/lib" || die "Install csu failed"
+
+ cd "${S}/libc"
+ $(freebsd_get_bmake) ${mymakeopts} DESTDIR="${D}" install NO_MAN= \
+ SHLIBDIR="/usr/${CTARGET}/lib" LIBDIR="/usr/${CTARGET}/usr/lib" || die "Install libc failed"
+
+ cd "${S}/msun"
+ $(freebsd_get_bmake) ${mymakeopts} DESTDIR="${D}" install NO_MAN= \
+ INCLUDEDIR="/usr/${CTARGET}/usr/include" \
+ SHLIBDIR="/usr/${CTARGET}/lib" LIBDIR="/usr/${CTARGET}/usr/lib" || die "Install msun failed"
+
+ cd "${WORKDIR}/gnu/lib/libssp/"
+ $(freebsd_get_bmake) ${mymakeopts} DESTDIR="${D}" install NO_MAN= \
+ INCLUDEDIR="/usr/${CTARGET}/usr/include" \
+ SHLIBDIR="/usr/${CTARGET}/lib" LIBDIR="/usr/${CTARGET}/usr/lib" || die "Install ssp failed"
+
+ cd "${WORKDIR}/lib/libthr/"
+ $(freebsd_get_bmake) ${mymakeopts} DESTDIR="${D}" install NO_MAN= \
+ INCLUDEDIR="/usr/${CTARGET}/usr/include" \
+ SHLIBDIR="/usr/${CTARGET}/lib" LIBDIR="/usr/${CTARGET}/usr/lib" || die "Install libthr failed"
+
+ dosym "usr/include" "/usr/${CTARGET}/sys-include"
+ else
+ # Set SHLIBDIR and LIBDIR for multilib
+ cd "${WORKDIR}/gnu/lib/libssp"
+ SHLIBDIR="/${mylibdir}" LIBDIR="/usr/${mylibdir}" mkinstall || die "Install ssp failed."
+ cd "${S}"
+ SHLIBDIR="/${mylibdir}" LIBDIR="/usr/${mylibdir}" mkinstall || die "Install failed"
+ fi
+
+ # Don't install the rest of the configuration files if crosscompiling
+ if [ "${CTARGET}" != "${CHOST}" ] ; then
+ # This is to get it stripped with the correct tools, otherwise it gets
+ # stripped with the host strip.
+ export CHOST=${CTARGET}
+ return 0
+ fi
+
+ # Symlink libbsdxml to libexpat as we use expat in favor of the renaming done
+ # on FreeBSD.
+ dosym libexpat.so /usr/${mylibdir}/libbsdxml.so
+
+ # install libstand files
+ dodir /usr/include/libstand
+ insinto /usr/include/libstand
+ doins "${S}"/libstand/*.h
+
+ cd "${WORKDIR}/etc/"
+ insinto /etc
+ doins auth.conf nls.alias mac.conf netconfig
+
+ # Install ttys file
+ local MACHINE="$(tc-arch-kernel)"
+ doins "etc.${MACHINE}"/*
+
+ # Generate ldscripts, otherwise bad thigs are supposed to happen
+ gen_usr_ldscript libalias_cuseeme.so libalias_dummy.so libalias_ftp.so \
+ libalias_irc.so libalias_nbt.so libalias_pptp.so libalias_skinny.so \
+ libalias_smedia.so libssp.so
+ # These show on QA warnings too, however they're pretty much bsd only,
+ # aka, no autotools for them.
+ # libbsdxml.so libcam.so libcrypt.so libdevstat.so libgeom.so \
+ # libipsec.so libipx.so libkiconv.so libkvm.so libmd.so libsbuf.so libufs.so \
+ # libutil.so
+
+ # Generate libc.so ldscript for inclusion of libssp_nonshared.a when linking
+ # this is done to avoid having to touch gcc spec file as it is currently
+ # done on FreeBSD upstream, mostly because their binutils aren't able to
+ # cope with linker scripts yet.
+ # Taken from toolchain-funcs.eclass:
+ local output_format
+ output_format=$($(tc-getCC) ${CFLAGS} ${LDFLAGS} -Wl,--verbose 2>&1 | sed -n 's/^OUTPUT_FORMAT("\([^"]*\)",.*/\1/p')
+ [[ -n ${output_format} ]] && output_format="OUTPUT_FORMAT ( ${output_format} )"
+ # Clear the symlink.
+ rm -f "${D}/usr/${mylibdir}/libc.so"
+ cat > "${D}/usr/${mylibdir}/libc.so" <<-END_LDSCRIPT
+/* GNU ld script
+ SSP (-fstack-protector) requires __stack_chk_fail_local to be local.
+ GCC invokes this symbol in a non-PIC way, which results in TEXTRELs if
+ this symbol was provided by a shared libc. So we link in
+ libssp_nonshared.a from here.
+ */
+${output_format}
+GROUP ( /${mylibdir}/libc.so.7 /usr/${mylibdir}/libssp_nonshared.a )
+END_LDSCRIPT
+
+ dodir /etc/sandbox.d
+ cat - > "${D}"/etc/sandbox.d/00freebsd <<EOF
+# /dev/crypto is used mostly by OpenSSL on *BSD platforms
+# leave it available as packages might use OpenSSL commands
+# during compile or install phase.
+SANDBOX_PREDICT="/dev/crypto"
+EOF
+
+ # Install a libusb.pc for better compat with Linux's libusb
+ if use usb ; then
+ dodir /usr/$(get_libdir)/pkgconfig
+ sed -e "s:@LIBDIR@:/usr/$(get_libdir):" "${FILESDIR}/libusb.pc.in" > "${D}/usr/$(get_libdir)/pkgconfig/libusb.pc" || die
+ fi
+}
+
+install_includes()
+{
+ local INCLUDEDIR="$1"
+
+ # The idea is to be called from either install or unpack.
+ # During unpack it's required to install them as portage's user.
+ if [[ "${EBUILD_PHASE}" == "install" ]]; then
+ local DESTDIR="${D}"
+ BINOWN="root"
+ BINGRP="wheel"
+ else
+ local DESTDIR="${WORKDIR}"
+ [[ -z "${USER}" ]] && USER="portage"
+ BINOWN="${USER}"
+ [[ -z "${GROUPS}" ]] && GROUPS="portage"
+ BINGRP="${GROUPS}"
+ fi
+
+ # This is for ssp/ssp.h.
+ einfo "Building ssp.h"
+ cd "${WORKDIR}/gnu/lib/libssp/" || die "missing libssp"
+ $(freebsd_get_bmake) ssp.h || die "problem building ssp.h"
+
+ # Must exist before we use it.
+ [[ -d "${DESTDIR}${INCLUDEDIR}" ]] || die "dodir or mkdir ${INCLUDEDIR} before using install_includes."
+ cd "${WORKDIR}/include"
+
+ local MACHINE="$(tc-arch-kernel)"
+
+ einfo "Installing includes into ${INCLUDEDIR} as ${BINOWN}:${BINGRP}..."
+ $(freebsd_get_bmake) installincludes \
+ MACHINE=${MACHINE} DESTDIR="${DESTDIR}" \
+ INCLUDEDIR="${INCLUDEDIR}" BINOWN="${BINOWN}" \
+ BINGRP="${BINGRP}" || die "install_includes() failed"
+ einfo "includes installed ok."
+ einfo "Installing ssp includes into ${INCLUDEDIR} as ${BINOWN}:${BINGRP}..."
+ cd "${WORKDIR}/gnu/lib/libssp"
+ $(freebsd_get_bmake) installincludes DESTDIR="${DESTDIR}" \
+ MACHINE=${MACHINE} INCLUDEDIR="${INCLUDEDIR}" BINOWN="${BINOWN}" \
+ BINGRP="${BINGRP}" || die "problem installing ssp includes."
+ einfo "ssp includes installed ok."
+ einfo "Installing librtld_db includes into ${INCLUDEDIR} as ${BINOWN}:${BINGRP}..."
+ cd "${S}/librtld_db" || die "missing librtld_db"
+ $(freebsd_get_bmake) installincludes DESTDIR="${DESTDIR}" \
+ MACHINE=${MACHINE} INCLUDEDIR="${INCLUDEDIR}" BINOWN="${BINOWN}" \
+ BINGRP="${BINGRP}" || die "problem installing librtld_db includes."
+ einfo "librtld_db includes installed ok."
+}
diff --git a/sys-freebsd/freebsd-lib/freebsd-lib-9.1-r11.ebuild b/sys-freebsd/freebsd-lib/freebsd-lib-9.1-r11.ebuild
new file mode 100644
index 000000000000..8eee4f7d190c
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/freebsd-lib-9.1-r11.ebuild
@@ -0,0 +1,617 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+
+inherit bsdmk freebsd flag-o-matic multilib toolchain-funcs eutils multibuild multilib-build
+
+DESCRIPTION="FreeBSD's base system libraries"
+SLOT="0"
+KEYWORDS="~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+
+# Crypto is needed to have an internal OpenSSL header
+# sys is needed for libalias, probably we can just extract that instead of
+# extracting the whole tarball
+SRC_URI="mirror://gentoo/${LIB}.tar.bz2
+ mirror://gentoo/${CONTRIB}.tar.bz2
+ mirror://gentoo/${CRYPTO}.tar.bz2
+ mirror://gentoo/${LIBEXEC}.tar.bz2
+ mirror://gentoo/${ETC}.tar.bz2
+ mirror://gentoo/${INCLUDE}.tar.bz2
+ mirror://gentoo/${USBIN}.tar.bz2
+ mirror://gentoo/${GNU}.tar.bz2
+ build? (
+ mirror://gentoo/${SYS}.tar.bz2 )
+ zfs? (
+ mirror://gentoo/${CDDL}.tar.bz2 )"
+
+if [ "${CATEGORY#*cross-}" = "${CATEGORY}" ]; then
+ RDEPEND="ssl? ( dev-libs/openssl )
+ hesiod? ( net-dns/hesiod )
+ kerberos? ( app-crypt/heimdal )
+ usb? ( !dev-libs/libusb )
+ zfs? ( =sys-freebsd/freebsd-cddl-${RV}* )
+ >=dev-libs/expat-2.0.1
+ !sys-libs/libutempter
+ !sys-freebsd/freebsd-headers"
+ DEPEND="${RDEPEND}
+ >=sys-devel/flex-2.5.31-r2
+ =sys-freebsd/freebsd-sources-${RV}*"
+else
+ SRC_URI="${SRC_URI}
+ mirror://gentoo/${SYS}.tar.bz2"
+fi
+
+DEPEND="${DEPEND}
+ userland_GNU? ( sys-apps/mtree )
+ =sys-freebsd/freebsd-mk-defs-${RV}*"
+
+S="${WORKDIR}/lib"
+
+export CTARGET=${CTARGET:-${CHOST}}
+if [ "${CTARGET}" = "${CHOST}" -a "${CATEGORY#*cross-}" != "${CATEGORY}" ]; then
+ export CTARGET=${CATEGORY/cross-}
+fi
+
+IUSE="atm bluetooth ssl hesiod ipv6 kerberos usb netware
+ build crosscompile_opts_headers-only zfs
+ userland_GNU userland_BSD"
+
+QA_DT_NEEDED="lib/libc.so.7 usr/lib32/libc.so.7"
+
+pkg_setup() {
+ [ -c /dev/zero ] || \
+ die "You forgot to mount /dev; the compiled libc would break."
+
+ if ! use ssl && use kerberos; then
+ eerror "If you want kerberos support you need to enable ssl support, too."
+ fi
+
+ use atm || mymakeopts="${mymakeopts} WITHOUT_ATM= "
+ use bluetooth || mymakeopts="${mymakeopts} WITHOUT_BLUETOOTH= "
+ use hesiod || mymakeopts="${mymakeopts} WITHOUT_HESIOD= "
+ use ipv6 || mymakeopts="${mymakeopts} WITHOUT_INET6_SUPPORT= "
+ use kerberos || mymakeopts="${mymakeopts} WITHOUT_KERBEROS_SUPPORT= WITHOUT_GSSAPI= "
+ use netware || mymakeopts="${mymakeopts} WITHOUT_IPX= WITHOUT_IPX_SUPPORT= WITHOUT_NCP= "
+ use ssl || mymakeopts="${mymakeopts} WITHOUT_OPENSSL= "
+ use usb || mymakeopts="${mymakeopts} WITHOUT_USB= "
+ use zfs || mymakeopts="${mymakeopts} WITHOUT_CDDL= "
+
+ mymakeopts="${mymakeopts} WITHOUT_BIND= WITHOUT_BIND_LIBS= WITHOUT_SENDMAIL= WITHOUT_CLANG= "
+
+ if [ "${CTARGET}" != "${CHOST}" ]; then
+ mymakeopts="${mymakeopts} MACHINE=$(tc-arch-kernel ${CTARGET})"
+ mymakeopts="${mymakeopts} MACHINE_ARCH=$(tc-arch-kernel ${CTARGET})"
+ fi
+}
+
+PATCHES=(
+ "${FILESDIR}/${PN}-6.0-pmc.patch"
+ "${FILESDIR}/${PN}-6.0-flex-2.5.31.patch"
+ "${FILESDIR}/${PN}-6.1-csu.patch"
+ "${FILESDIR}/${PN}-9.0-liblink.patch"
+ "${FILESDIR}/${PN}-bsdxml2expat.patch"
+ "${FILESDIR}/${PN}-9.0-netware.patch"
+ "${FILESDIR}/${PN}-9.0-cve-2010-2632.patch"
+ "${FILESDIR}/${PN}-9.0-bluetooth.patch"
+ "${FILESDIR}/${PN}-9.1-.eh_frame_hdr-fix.patch"
+ "${FILESDIR}/${PN}-add-nossp-cflags.patch"
+ )
+
+# Here we disable and remove source which we don't need or want
+# In order:
+# - ncurses stuff
+# - libexpat creates a bsdxml library which is the same as expat
+# - archiving libraries (have their own ebuild)
+# - sendmail libraries (they are installed by sendmail)
+# - SNMP library and dependency (have their own ebuilds)
+# - libstand: static library, 32bits on amd64 used for boot0, we build it from
+# boot0 instead.
+#
+# The rest are libraries we already have somewhere else because
+# they are contribution.
+# Note: libtelnet is an internal lib used by telnet and telnetd programs
+# as it's not used in freebsd-lib package itself, it's pointless building
+# it here.
+REMOVE_SUBDIRS="ncurses \
+ libexpat \
+ libz libbz2 libarchive liblzma \
+ libsm libsmdb libsmutil \
+ libbegemot libbsnmp \
+ libpam libpcap bind libwrap libmagic \
+ libcom_err libtelnet
+ libelf libedit
+ libstand
+ libgssapi"
+
+# Are we building a cross-compiler?
+is_crosscompile() {
+ [ "${CATEGORY#*cross-}" != "${CATEGORY}" ]
+}
+
+src_prepare() {
+ sed -i.bak -e 's:-o/dev/stdout:-t:' "${S}/libc/net/Makefile.inc"
+
+ # Upstream Display Managers default to using VT7
+ # We should make FreeBSD allow this by default
+ local x=
+ for x in "${WORKDIR}"/etc/etc.*/ttys ; do
+ sed -i.bak \
+ -e '/ttyv5[[:space:]]/ a\
+# Display Managers default to VT7.\
+# If you use the xdm init script, keep ttyv6 commented out\
+# unless you force a different VT for the DM being used.' \
+ -e '/^ttyv[678][[:space:]]/ s/^/# /' "${x}" \
+ || die "Failed to sed ${x}"
+ rm "${x}".bak
+ done
+
+ # This one is here because it also
+ # patches "${WORKDIR}/include"
+ cd "${WORKDIR}"
+ epatch "${FILESDIR}/${PN}-includes.patch"
+ epatch "${FILESDIR}/${PN}-8.0-gcc45.patch"
+ epatch "${FILESDIR}/${PN}-9.0-opieincludes.patch"
+ epatch "${FILESDIR}/${PN}-9.1-aligned_alloc.patch"
+ epatch "${FILESDIR}/${PN}-9.1-rmgssapi.patch"
+
+ # Don't install the hesiod man page or header
+ rm "${WORKDIR}"/include/hesiod.h || die
+ sed -i.bak -e 's:hesiod.h::' "${WORKDIR}"/include/Makefile || die
+ sed -i.bak -e 's:hesiod.c::' -e 's:hesiod.3::' \
+ "${WORKDIR}"/lib/libc/net/Makefile.inc || die
+
+ # Fix the Makefiles of these few libraries that will overwrite our LDADD.
+ cd "${S}"
+ for dir in libradius libtacplus libcam libdevstat libfetch libgeom libmemstat libopie \
+ libsmb libprocstat libulog; do sed -i.bak -e 's:LDADD=:LDADD+=:g' "${dir}/Makefile" || \
+ die "Problem fixing \"${dir}/Makefile"
+ done
+ # Call LD with LDFLAGS, rename them to RAW_LDFLAGS
+ sed -e 's/LDFLAGS/RAW_LDFLAGS/g' \
+ -i "${S}/csu/i386-elf/Makefile" \
+ -i "${S}/csu/ia64/Makefile" || die
+ if use build; then
+ cd "${WORKDIR}"
+ # This patch has to be applied on ${WORKDIR}/sys, so we do it here since it
+ # shouldn't be a symlink to /usr/src/sys (which should be already patched)
+ epatch "${FILESDIR}"/${PN}-7.1-types.h-fix.patch
+ epatch "${FILESDIR}"/freebsd-sources-9.0-sysctluint.patch
+ return 0
+ fi
+
+ if ! is_crosscompile ; then
+ ln -s "/usr/src/sys-${RV}" "${WORKDIR}/sys" || die "Couldn't make sys symlink!"
+ else
+ sed -i.bak -e "s:/usr/include:/usr/${CTARGET}/usr/include:g" \
+ "${S}/libc/rpc/Makefile.inc" \
+ "${S}/libc/yp/Makefile.inc"
+ fi
+
+ if install --version 2> /dev/null | grep -q GNU; then
+ sed -i.bak -e 's:${INSTALL} -C:${INSTALL}:' "${WORKDIR}/include/Makefile"
+ fi
+
+ # Try to fix sed calls for GNU sed. Do it only with GNU userland and force
+ # BSD's sed on BSD.
+ cd "${S}"
+ if use userland_GNU; then
+ find . -name Makefile -exec sed -ibak 's/sed -i /sed -i/' {} \;
+ fi
+}
+
+get_csudir() {
+ if [ -d "${WORKDIR}/lib/csu/$1-elf" ]; then
+ echo "lib/csu/$1-elf"
+ else
+ echo "lib/csu/$1"
+ fi
+}
+
+bootstrap_csu() {
+ local csudir="$(get_csudir $(tc-arch-kernel ${CTARGET}))"
+ export RAW_LDFLAGS=$(raw-ldflags)
+ cd "${WORKDIR}/${csudir}" || die "Missing ${csudir}."
+ freebsd_src_compile
+
+ CFLAGS="${CFLAGS} -B ${MAKEOBJDIRPREFIX}/${WORKDIR}/${csudir}"
+ append-ldflags "-B ${MAKEOBJDIRPREFIX}/${WORKDIR}/${csudir}"
+
+ cd "${WORKDIR}/gnu/lib/csu" || die
+ freebsd_src_compile
+ cd "${MAKEOBJDIRPREFIX}/${WORKDIR}/gnu/lib/csu"
+ for i in *.So ; do
+ ln -s $i ${i%.So}S.o
+ done
+ CFLAGS="${CFLAGS} -B ${MAKEOBJDIRPREFIX}/${WORKDIR}/gnu/lib/csu"
+ append-ldflags "-B ${MAKEOBJDIRPREFIX}/${WORKDIR}/gnu/lib/csu"
+}
+
+# Compile libssp_nonshared.a and add it's path to LDFLAGS.
+bootstrap_libssp_nonshared() {
+ cd "${WORKDIR}/gnu/lib/libssp/libssp_nonshared/" || die "missing libssp."
+ freebsd_src_compile
+ append-ldflags "-L${MAKEOBJDIRPREFIX}/${WORKDIR}/gnu/lib/libssp/libssp_nonshared/"
+ export LDADD="-lssp_nonshared"
+}
+
+bootstrap_libc() {
+ cd "${WORKDIR}/lib/libc" || die
+ freebsd_src_compile
+ append-ldflags "-L${MAKEOBJDIRPREFIX}/${WORKDIR}/lib/libc"
+}
+
+bootstrap_libgcc() {
+ cd "${WORKDIR}/lib/libcompiler_rt" || die
+ freebsd_src_compile
+ cd "${MAKEOBJDIRPREFIX}/${WORKDIR}/lib/libcompiler_rt" || die
+ ln -s libcompiler_rt.a libgcc.a || die
+ append-ldflags "-L${MAKEOBJDIRPREFIX}/${WORKDIR}/lib/libcompiler_rt"
+
+ bootstrap_libc
+
+ cd "${WORKDIR}/gnu/lib/libgcc" || die
+ freebsd_src_compile
+ append-ldflags "-L${MAKEOBJDIRPREFIX}/${WORKDIR}/gnu/lib/libgcc"
+}
+
+bootstrap_libthr() {
+ cd "${WORKDIR}/lib/libthr" || die
+ freebsd_src_compile
+ append-ldflags "-L${MAKEOBJDIRPREFIX}/${WORKDIR}/lib/libthr"
+ cd "${MAKEOBJDIRPREFIX}/${WORKDIR}/lib/libthr" || die
+ ln -s libthr.so libpthread.so
+}
+
+# What to build for a cross-compiler.
+# We also need the csu but this has to be handled separately.
+CROSS_SUBDIRS="lib/libc lib/msun gnu/lib/libssp/libssp_nonshared lib/libthr lib/libutil lib/librt"
+
+# What to build for non-default ABIs.
+NON_NATIVE_SUBDIRS="${CROSS_SUBDIRS} gnu/lib/csu lib/libcompiler_rt gnu/lib/libgcc lib/libmd lib/libcrypt"
+
+# Subdirs for a native build:
+NATIVE_SUBDIRS="lib gnu/lib/libssp/libssp_nonshared gnu/lib/libregex gnu/lib/csu gnu/lib/libgcc"
+
+# Is my $ABI native ?
+is_native_abi() {
+ is_crosscompile && return 1
+ multilib_is_native_abi
+}
+
+# Do we need to bootstrap the csu and libssp_nonshared?
+need_bootstrap() {
+ is_crosscompile || use build || { ! is_native_abi && ! has_version '>=sys-freebsd/freebsd-lib-9.1-r8[multilib]' && ! has_version ">=sys-freebsd/freebsd-lib-9.1-r11[${MULTILIB_USEDEP}]" ; } || has_version "<${CATEGORY}/${P}"
+}
+
+# Get the subdirs we are building.
+get_subdirs() {
+ local ret=""
+ if is_native_abi ; then
+ # If we are building for the native ABI, build everything
+ ret="${NATIVE_SUBDIRS}"
+ elif is_crosscompile ; then
+ # With a cross-compiler we only build the very core parts.
+ ret="${CROSS_SUBDIRS}"
+ if [ "${EBUILD_PHASE}" = "install" ]; then
+ # Add the csu dir first when installing. We treat it separately for
+ # compiling.
+ ret="$(get_csudir $(tc-arch-kernel ${CTARGET})) ${ret}"
+ fi
+ else
+ # For the non-native ABIs we only build the csu parts and very core
+ # libraries for now.
+ ret="${NON_NATIVE_SUBDIRS} $(get_csudir $(tc-arch-kernel ${CHOST}))"
+ fi
+ echo "${ret}"
+}
+
+# Bootstrap the core libraries and setup the flags so that the other parts can
+# build against it.
+do_bootstrap() {
+ einfo "Bootstrapping on ${CHOST} for ${CTARGET}"
+ if ! is_crosscompile ; then
+ # Pre-install headers, but not when building a cross-compiler since we
+ # assume they have been installed in the previous pass.
+ einfo "Pre-installing includes in include_proper_${ABI}"
+ mkdir "${WORKDIR}/include_proper_${ABI}" || die
+ CTARGET="${CHOST}" install_includes "/include_proper_${ABI}"
+ CFLAGS="${CFLAGS} -isystem ${WORKDIR}/include_proper_${ABI}"
+ fi
+ bootstrap_csu
+ bootstrap_libssp_nonshared
+ is_crosscompile && bootstrap_libc
+ is_crosscompile || is_native_abi || bootstrap_libgcc
+ is_native_abi || bootstrap_libthr
+}
+
+# Compile it. Assume we have the toolchain setup correctly.
+do_compile() {
+ # Bootstrap if needed, otherwise assume the system headers are in
+ # /usr/include.
+ if need_bootstrap ; then
+ do_bootstrap
+ else
+ CFLAGS="${CFLAGS} -isystem /usr/include"
+ fi
+
+ export RAW_LDFLAGS=$(raw-ldflags)
+
+ # Everything is now setup, build it!
+ for i in $(get_subdirs) ; do
+ einfo "Building in ${i}... with CC=${CC} and CFLAGS=${CFLAGS}"
+ cd "${WORKDIR}/${i}/" || die "missing ${i}."
+ freebsd_src_compile || die "make ${i} failed"
+ done
+}
+
+src_compile() {
+ # Does not work with GNU sed
+ # Force BSD's sed on BSD.
+ if use userland_BSD ; then
+ export ESED=/usr/bin/sed
+ unalias sed
+ fi
+
+ use usb && export NON_NATIVE_SUBDIRS="${NON_NATIVE_SUBDIRS} lib/libusb lib/libusbhid"
+
+ cd "${WORKDIR}/include"
+ $(freebsd_get_bmake) CC="$(tc-getCC)" || die "make include failed"
+
+ use crosscompile_opts_headers-only && return 0
+
+ # Bug #270098
+ append-flags $(test-flags -fno-strict-aliasing)
+
+ # Bug #324445
+ append-flags $(test-flags -fno-strict-overflow)
+
+ # strip flags and do not do it later, we only add safe, and in fact
+ # needed flags after all
+ strip-flags
+ export NOFLAGSTRIP=yes
+ if is_crosscompile ; then
+ export YACC='yacc -by'
+ CHOST=${CTARGET} tc-export CC LD CXX RANLIB
+ mymakeopts="${mymakeopts} NLS="
+ CFLAGS="${CFLAGS} -isystem /usr/${CTARGET}/usr/include"
+ append-ldflags "-L${WORKDIR}/${CHOST}/${WORKDIR}/lib/libc"
+ fi
+
+ if is_crosscompile ; then
+ do_compile
+ else
+ local MULTIBUILD_VARIANTS=( $(multilib_get_enabled_abis) )
+ multibuild_foreach_variant freebsd_multilib_multibuild_wrapper do_compile
+ fi
+}
+
+gen_libc_ldscript() {
+ # Parameters:
+ # $1 = target libdir
+ # $2 = source libc dir
+ # $3 = source libssp_nonshared dir
+
+ # Clear the symlink.
+ rm -f "${D}/$2/libc.so" || die
+
+ # Move the library if needed
+ if [ "$1" != "$2" ] ; then
+ mv "${D}/$2/libc.so.7" "${D}/$1/" || die
+ fi
+
+ # Generate libc.so ldscript for inclusion of libssp_nonshared.a when linking
+ # this is done to avoid having to touch gcc spec file as it is currently
+ # done on FreeBSD upstream, mostly because their binutils aren't able to
+ # cope with linker scripts yet.
+ # Taken from toolchain-funcs.eclass:
+ local output_format
+ output_format=$($(tc-getCC) ${CFLAGS} ${LDFLAGS} -Wl,--verbose 2>&1 | sed -n 's/^OUTPUT_FORMAT("\([^"]*\)",.*/\1/p')
+ [[ -n ${output_format} ]] && output_format="OUTPUT_FORMAT ( ${output_format} )"
+
+ cat > "${D}/$2/libc.so" <<-END_LDSCRIPT
+/* GNU ld script
+ SSP (-fstack-protector) requires __stack_chk_fail_local to be local.
+ GCC invokes this symbol in a non-PIC way, which results in TEXTRELs if
+ this symbol was provided by a shared libc. So we link in
+ libssp_nonshared.a from here.
+ */
+${output_format}
+GROUP ( /$1/libc.so.7 /$3/libssp_nonshared.a )
+END_LDSCRIPT
+}
+
+header_list=""
+
+move_header() {
+ local dirname=$(dirname ${1})
+ local filename=$(basename ${1})
+
+ if [ ! -d "${dirname}/${ABI}" ] ; then
+ mkdir "${dirname}/${ABI}" || die
+ fi
+
+ mv "${1}" "${dirname}/${ABI}/" || die
+
+ export header_list="${header_list} ${1}"
+}
+
+make_header_template() {
+ cat <<-END_HEADER
+/*
+ * Wrapped header for multilib support.
+ * See the real headers included below.
+ */
+
+#if defined(__x86_64__)
+ @ABI_amd64_fbsd@
+#elif defined(__i386__)
+ @ABI_x86_fbsd@
+#else
+ @ABI_${DEFAULT_ABI}@
+#endif
+END_HEADER
+}
+
+wrap_header() {
+ local dirname=$(dirname ${1})
+ local filename=$(basename ${1})
+
+ if [ -n "${dirname#.}" ] ; then
+ dirname="${dirname}/${2}"
+ else
+ dirname="${2}"
+ fi
+
+ if [ -f "${dirname}/${filename}" ] ; then
+ sed -e "s:@ABI_${2}@:#include <${dirname}/${filename}>:" ${1}
+ else
+ cat ${1}
+ fi
+}
+
+wrap_header_end() {
+ sed -e "s:@ABI_.*@:#error \"Sorry, no support for your ABI.\":" ${1}
+}
+
+do_install() {
+ if is_crosscompile ; then
+ INCLUDEDIR="/usr/${CTARGET}/usr/include"
+ else
+ INCLUDEDIR="/usr/include"
+ fi
+
+ dodir ${INCLUDEDIR}
+ CTARGET="${CHOST}" \
+ install_includes ${INCLUDEDIR}
+
+ is_crosscompile && use crosscompile_opts_headers-only && return 0
+
+ for i in $(get_subdirs) ; do
+ einfo "Installing in ${i}..."
+ cd "${WORKDIR}/${i}/" || die "missing ${i}."
+ freebsd_src_install || die "Install ${i} failed"
+ done
+
+ if ! is_crosscompile ; then
+ if ! multilib_is_native_abi ; then
+ gen_libc_ldscript "usr/$(get_libdir)" "usr/$(get_libdir)" "usr/$(get_libdir)"
+ else
+ dodir "$(get_libdir)"
+ gen_libc_ldscript "$(get_libdir)" "usr/$(get_libdir)" "usr/$(get_libdir)"
+ fi
+ else
+ CHOST=${CTARGET} gen_libc_ldscript "usr/${CTARGET}/usr/lib" "usr/${CTARGET}/usr/lib" "usr/${CTARGET}/usr/lib"
+ fi
+
+ # Install a libusb.pc for better compat with Linux's libusb
+ if use usb ; then
+ dodir /usr/$(get_libdir)/pkgconfig
+ sed -e "s:@LIBDIR@:/usr/$(get_libdir):" "${FILESDIR}/libusb.pc.in" > "${D}/usr/$(get_libdir)/pkgconfig/libusb.pc" || die
+ sed -e "s:@LIBDIR@:/usr/$(get_libdir):" "${FILESDIR}/libusb-1.0.pc.in" > "${D}/usr/$(get_libdir)/pkgconfig/libusb-1.0.pc" || die
+ fi
+
+ # Generate ldscripts for core libraries that will go in /
+ multilib_is_native_abi && \
+ gen_usr_ldscript -a alias cam geom ipsec jail kiconv \
+ kvm m md procstat sbuf thr ufs util
+
+ if [[ ${#MULTIBUILD_VARIANTS[@]} -gt 1 ]] ; then
+ cd "${D}/usr/include"
+ for i in machine/*.h fenv.h ; do
+ move_header ${i}
+ done
+ if multilib_is_native_abi ; then
+ # Supposedly the last one!
+ local uniq_headers="$(echo ${header_list} | tr ' ' '\n' | sort | uniq | tr '\n' ' ')"
+ for j in ${uniq_headers} ; do
+ make_header_template > ${j}
+ for i in $(get_all_abis) ; do
+ wrap_header ${j} ${i} > ${j}.new
+ cp ${j}.new ${j}
+ rm -f ${j}.new
+ done
+ wrap_header_end ${j} > ${j}.new
+ cp ${j}.new ${j}
+ rm -f ${j}.new
+ done
+ fi
+ fi
+}
+
+src_install() {
+ if is_crosscompile ; then
+ einfo "Installing for ${CTARGET} in ${CHOST}.."
+ # From this point we need to force: get stripped with the correct tools,
+ # get tc-arch-kernel to return the right value, etc.
+ export CHOST=${CTARGET}
+
+ mymakeopts="${mymakeopts} NO_MAN= \
+ INCLUDEDIR=/usr/${CTARGET}/usr/include \
+ SHLIBDIR=/usr/${CTARGET}/usr/lib \
+ LIBDIR=/usr/${CTARGET}/usr/lib"
+
+ dosym "usr/include" "/usr/${CTARGET}/sys-include"
+ do_install
+
+ return 0
+ else
+ export STRIP_MASK="*/usr/lib*/*crt*.o"
+ local MULTIBUILD_VARIANTS=( $(multilib_get_enabled_abis) )
+ multibuild_foreach_variant freebsd_multilib_multibuild_wrapper do_install
+ fi
+
+ cd "${WORKDIR}/etc/"
+ insinto /etc
+ doins nls.alias mac.conf netconfig
+
+ # Install ttys file
+ local MACHINE="$(tc-arch-kernel)"
+ doins "etc.${MACHINE}"/*
+
+ # unset to run QA check properly
+ unset ESED
+}
+
+install_includes()
+{
+ local INCLUDEDIR="$1"
+
+ # The idea is to be called from either install or unpack.
+ # During unpack it's required to install them as portage's user.
+ if [[ "${EBUILD_PHASE}" == "install" ]]; then
+ local DESTDIR="${D}"
+ BINOWN="root"
+ BINGRP="wheel"
+ else
+ local DESTDIR="${WORKDIR}"
+ [[ -z "${USER}" ]] && USER="portage"
+ BINOWN="${USER}"
+ [[ -z "${GROUPS}" ]] && GROUPS="portage"
+ BINGRP="${GROUPS}"
+ fi
+
+ # Must exist before we use it.
+ [[ -d "${DESTDIR}${INCLUDEDIR}" ]] || die "dodir or mkdir ${INCLUDEDIR} before using install_includes."
+ cd "${WORKDIR}/include"
+
+ local MACHINE="$(tc-arch-kernel)"
+
+ einfo "Installing includes into ${INCLUDEDIR} as ${BINOWN}:${BINGRP}..."
+ $(freebsd_get_bmake) installincludes \
+ MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE} \
+ DESTDIR="${DESTDIR}" \
+ INCLUDEDIR="${INCLUDEDIR}" BINOWN="${BINOWN}" \
+ BINGRP="${BINGRP}" || die "install_includes() failed"
+ einfo "includes installed ok."
+ EXTRA_INCLUDES="lib/librtld_db lib/libutil lib/msun gnu/lib/libregex"
+ for i in $EXTRA_INCLUDES; do
+ einfo "Installing $i includes into ${INCLUDEDIR} as ${BINOWN}:${BINGRP}..."
+ cd "${WORKDIR}/$i" || die
+ $(freebsd_get_bmake) installincludes DESTDIR="${DESTDIR}" \
+ MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE} \
+ INCLUDEDIR="${INCLUDEDIR}" BINOWN="${BINOWN}" \
+ BINGRP="${BINGRP}" || die "problem installing $i includes."
+ einfo "$i includes installed ok."
+ done
+}
diff --git a/sys-freebsd/freebsd-lib/metadata.xml b/sys-freebsd/freebsd-lib/metadata.xml
new file mode 100644
index 000000000000..24ca54034a3f
--- /dev/null
+++ b/sys-freebsd/freebsd-lib/metadata.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="project">
+ <email>bsd@gentoo.org</email>
+ <name>BSD Project</name>
+ </maintainer>
+ <use>
+ <flag name="hesiod">Enable support for net-dns/hesiod</flag>
+ <flag name="netware">
+ Build libraries and tools to work with NetWare protocols (IPX
+ and NCP).
+ </flag>
+ <flag name="zfs">Enable ZFS support.</flag>
+ </use>
+</pkgmetadata>