aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNP-Hardass <NP-Hardass@gentoo.org>2017-11-21 17:21:17 -0500
committerNP-Hardass <NP-Hardass@gentoo.org>2017-11-21 17:25:44 -0500
commite44fc71e5b02ffc2b8fa438052cff2ba5ab66203 (patch)
treeba405fe66fe2799105947d123eb8fb8e0e47feb2
parentInitial Commit (diff)
downloadwine-e44fc71e5b02ffc2b8fa438052cff2ba5ab66203.tar.gz
wine-e44fc71e5b02ffc2b8fa438052cff2ba5ab66203.tar.bz2
wine-e44fc71e5b02ffc2b8fa438052cff2ba5ab66203.zip
Import all from ::gentoo
-rw-r--r--app-emulation/wine-any/Manifest61
-rw-r--r--app-emulation/wine-any/metadata.xml51
-rw-r--r--app-emulation/wine-any/wine-any-2.0-r1.ebuild636
-rw-r--r--app-emulation/wine-any/wine-any-2.1-r1.ebuild636
-rw-r--r--app-emulation/wine-any/wine-any-2.10-r1.ebuild638
-rw-r--r--app-emulation/wine-any/wine-any-2.11-r1.ebuild638
-rw-r--r--app-emulation/wine-any/wine-any-2.12-r1.ebuild638
-rw-r--r--app-emulation/wine-any/wine-any-2.13-r1.ebuild638
-rw-r--r--app-emulation/wine-any/wine-any-2.14-r1.ebuild638
-rw-r--r--app-emulation/wine-any/wine-any-2.15-r1.ebuild638
-rw-r--r--app-emulation/wine-any/wine-any-2.16-r1.ebuild638
-rw-r--r--app-emulation/wine-any/wine-any-2.17-r1.ebuild638
-rw-r--r--app-emulation/wine-any/wine-any-2.18.ebuild634
-rw-r--r--app-emulation/wine-any/wine-any-2.19.ebuild634
-rw-r--r--app-emulation/wine-any/wine-any-2.2-r1.ebuild636
-rw-r--r--app-emulation/wine-any/wine-any-2.3-r1.ebuild636
-rw-r--r--app-emulation/wine-any/wine-any-2.4-r1.ebuild636
-rw-r--r--app-emulation/wine-any/wine-any-2.5-r1.ebuild636
-rw-r--r--app-emulation/wine-any/wine-any-2.6-r1.ebuild636
-rw-r--r--app-emulation/wine-any/wine-any-2.7-r1.ebuild636
-rw-r--r--app-emulation/wine-any/wine-any-2.8-r1.ebuild636
-rw-r--r--app-emulation/wine-any/wine-any-2.9-r1.ebuild638
-rw-r--r--app-emulation/wine-any/wine-any-9999.ebuild634
-rw-r--r--app-emulation/wine-d3d9/Manifest41
-rw-r--r--app-emulation/wine-d3d9/metadata.xml46
-rw-r--r--app-emulation/wine-d3d9/wine-d3d9-2.0-r1.ebuild570
-rw-r--r--app-emulation/wine-d3d9/wine-d3d9-2.1-r1.ebuild570
-rw-r--r--app-emulation/wine-d3d9/wine-d3d9-2.10-r1.ebuild572
-rw-r--r--app-emulation/wine-d3d9/wine-d3d9-2.11-r1.ebuild572
-rw-r--r--app-emulation/wine-d3d9/wine-d3d9-2.12-r1.ebuild572
-rw-r--r--app-emulation/wine-d3d9/wine-d3d9-2.13-r1.ebuild572
-rw-r--r--app-emulation/wine-d3d9/wine-d3d9-2.14-r1.ebuild572
-rw-r--r--app-emulation/wine-d3d9/wine-d3d9-2.15-r1.ebuild572
-rw-r--r--app-emulation/wine-d3d9/wine-d3d9-2.16-r1.ebuild572
-rw-r--r--app-emulation/wine-d3d9/wine-d3d9-2.17-r1.ebuild572
-rw-r--r--app-emulation/wine-d3d9/wine-d3d9-2.18.ebuild568
-rw-r--r--app-emulation/wine-d3d9/wine-d3d9-2.19.ebuild568
-rw-r--r--app-emulation/wine-d3d9/wine-d3d9-2.2-r1.ebuild570
-rw-r--r--app-emulation/wine-d3d9/wine-d3d9-2.3-r1.ebuild570
-rw-r--r--app-emulation/wine-d3d9/wine-d3d9-2.4-r1.ebuild570
-rw-r--r--app-emulation/wine-d3d9/wine-d3d9-2.5-r1.ebuild570
-rw-r--r--app-emulation/wine-d3d9/wine-d3d9-2.6-r1.ebuild570
-rw-r--r--app-emulation/wine-d3d9/wine-d3d9-2.7-r1.ebuild570
-rw-r--r--app-emulation/wine-d3d9/wine-d3d9-2.8-r1.ebuild570
-rw-r--r--app-emulation/wine-d3d9/wine-d3d9-2.9-r1.ebuild572
-rw-r--r--app-emulation/wine-d3d9/wine-d3d9-9999.ebuild568
-rw-r--r--app-emulation/wine-desktop-common/Manifest1
-rw-r--r--app-emulation/wine-desktop-common/metadata.xml15
-rw-r--r--app-emulation/wine-desktop-common/wine-desktop-common-20150204.ebuild45
-rw-r--r--app-emulation/wine-gecko/Manifest2
-rw-r--r--app-emulation/wine-gecko/metadata.xml14
-rw-r--r--app-emulation/wine-gecko/wine-gecko-2.47-r1.ebuild28
-rw-r--r--app-emulation/wine-mono/Manifest3
-rw-r--r--app-emulation/wine-mono/metadata.xml14
-rw-r--r--app-emulation/wine-mono/wine-mono-4.6.4.ebuild21
-rw-r--r--app-emulation/wine-mono/wine-mono-4.7.0.ebuild21
-rw-r--r--app-emulation/wine-mono/wine-mono-4.7.1.ebuild21
-rw-r--r--app-emulation/wine-staging/Manifest41
-rw-r--r--app-emulation/wine-staging/metadata.xml44
-rw-r--r--app-emulation/wine-staging/wine-staging-2.0-r1.ebuild607
-rw-r--r--app-emulation/wine-staging/wine-staging-2.1-r1.ebuild607
-rw-r--r--app-emulation/wine-staging/wine-staging-2.10-r1.ebuild609
-rw-r--r--app-emulation/wine-staging/wine-staging-2.11-r1.ebuild609
-rw-r--r--app-emulation/wine-staging/wine-staging-2.12-r1.ebuild609
-rw-r--r--app-emulation/wine-staging/wine-staging-2.13-r1.ebuild609
-rw-r--r--app-emulation/wine-staging/wine-staging-2.14-r1.ebuild609
-rw-r--r--app-emulation/wine-staging/wine-staging-2.15-r1.ebuild609
-rw-r--r--app-emulation/wine-staging/wine-staging-2.16-r1.ebuild609
-rw-r--r--app-emulation/wine-staging/wine-staging-2.17-r1.ebuild609
-rw-r--r--app-emulation/wine-staging/wine-staging-2.18.ebuild605
-rw-r--r--app-emulation/wine-staging/wine-staging-2.19.ebuild605
-rw-r--r--app-emulation/wine-staging/wine-staging-2.2-r1.ebuild607
-rw-r--r--app-emulation/wine-staging/wine-staging-2.3-r1.ebuild607
-rw-r--r--app-emulation/wine-staging/wine-staging-2.4-r1.ebuild607
-rw-r--r--app-emulation/wine-staging/wine-staging-2.5-r1.ebuild607
-rw-r--r--app-emulation/wine-staging/wine-staging-2.6-r1.ebuild607
-rw-r--r--app-emulation/wine-staging/wine-staging-2.7-r1.ebuild607
-rw-r--r--app-emulation/wine-staging/wine-staging-2.8-r1.ebuild607
-rw-r--r--app-emulation/wine-staging/wine-staging-2.9-r1.ebuild609
-rw-r--r--app-emulation/wine-staging/wine-staging-9999.ebuild605
-rw-r--r--app-emulation/wine-vanilla/.wine-vanilla-9999.ebuild.swpbin0 -> 16384 bytes
-rw-r--r--app-emulation/wine-vanilla/Manifest25
-rw-r--r--app-emulation/wine-vanilla/metadata.xml40
-rw-r--r--app-emulation/wine-vanilla/wine-vanilla-2.0-r1.ebuild527
-rw-r--r--app-emulation/wine-vanilla/wine-vanilla-2.0.1-r1.ebuild527
-rw-r--r--app-emulation/wine-vanilla/wine-vanilla-2.0.1.ebuild518
-rw-r--r--app-emulation/wine-vanilla/wine-vanilla-2.0.2-r1.ebuild527
-rw-r--r--app-emulation/wine-vanilla/wine-vanilla-2.0.2.ebuild518
-rw-r--r--app-emulation/wine-vanilla/wine-vanilla-2.0.3.ebuild523
-rw-r--r--app-emulation/wine-vanilla/wine-vanilla-2.0.ebuild518
-rw-r--r--app-emulation/wine-vanilla/wine-vanilla-2.1-r1.ebuild527
-rw-r--r--app-emulation/wine-vanilla/wine-vanilla-2.10-r1.ebuild529
-rw-r--r--app-emulation/wine-vanilla/wine-vanilla-2.11-r1.ebuild529
-rw-r--r--app-emulation/wine-vanilla/wine-vanilla-2.12-r1.ebuild529
-rw-r--r--app-emulation/wine-vanilla/wine-vanilla-2.13-r1.ebuild529
-rw-r--r--app-emulation/wine-vanilla/wine-vanilla-2.14-r1.ebuild529
-rw-r--r--app-emulation/wine-vanilla/wine-vanilla-2.15-r1.ebuild529
-rw-r--r--app-emulation/wine-vanilla/wine-vanilla-2.16-r1.ebuild529
-rw-r--r--app-emulation/wine-vanilla/wine-vanilla-2.17-r1.ebuild529
-rw-r--r--app-emulation/wine-vanilla/wine-vanilla-2.18-r2.ebuild525
-rw-r--r--app-emulation/wine-vanilla/wine-vanilla-2.19-r1.ebuild525
-rw-r--r--app-emulation/wine-vanilla/wine-vanilla-2.2-r1.ebuild527
-rw-r--r--app-emulation/wine-vanilla/wine-vanilla-2.20.ebuild527
-rw-r--r--app-emulation/wine-vanilla/wine-vanilla-2.3-r1.ebuild527
-rw-r--r--app-emulation/wine-vanilla/wine-vanilla-2.4-r1.ebuild527
-rw-r--r--app-emulation/wine-vanilla/wine-vanilla-2.5-r1.ebuild527
-rw-r--r--app-emulation/wine-vanilla/wine-vanilla-2.6-r1.ebuild527
-rw-r--r--app-emulation/wine-vanilla/wine-vanilla-2.7-r1.ebuild527
-rw-r--r--app-emulation/wine-vanilla/wine-vanilla-2.8-r1.ebuild527
-rw-r--r--app-emulation/wine-vanilla/wine-vanilla-2.9-r1.ebuild529
-rw-r--r--app-emulation/wine-vanilla/wine-vanilla-9999.ebuild527
-rw-r--r--app-emulation/wine/.wine-9999.ebuild.swpbin0 -> 16384 bytes
-rw-r--r--app-emulation/wine/Manifest14
-rw-r--r--app-emulation/wine/files/builtin_ms_va_list.c9
-rw-r--r--app-emulation/wine/files/pr66838.c36
-rw-r--r--app-emulation/wine/files/pr69140.c37
-rw-r--r--app-emulation/wine/files/wine-1.5.26-winegcc.patch59
-rw-r--r--app-emulation/wine/files/wine-1.6-memset-O3.patch21
-rw-r--r--app-emulation/wine/files/wine-1.7.12-osmesa-check.patch38
-rw-r--r--app-emulation/wine/files/wine-1.9.5-multilib-portage.patch31
-rw-r--r--app-emulation/wine/metadata.xml49
-rw-r--r--app-emulation/wine/wine-2.0.ebuild453
-rw-r--r--app-emulation/wine/wine-2.1.ebuild582
-rw-r--r--app-emulation/wine/wine-2.2.ebuild582
-rw-r--r--app-emulation/wine/wine-2.3.ebuild582
-rw-r--r--app-emulation/wine/wine-9999.ebuild581
-rw-r--r--app-emulation/winetricks/Manifest2
-rw-r--r--app-emulation/winetricks/metadata.xml26
-rw-r--r--app-emulation/winetricks/winetricks-20170823.ebuild87
-rw-r--r--app-emulation/winetricks/winetricks-99999999.ebuild87
-rw-r--r--virtual/wine/metadata.xml16
-rw-r--r--virtual/wine/wine-0-r5.ebuild33
-rw-r--r--virtual/wine/wine-0-r6.ebuild33
133 files changed, 56740 insertions, 0 deletions
diff --git a/app-emulation/wine-any/Manifest b/app-emulation/wine-any/Manifest
new file mode 100644
index 0000000..d6fe8c7
--- /dev/null
+++ b/app-emulation/wine-any/Manifest
@@ -0,0 +1,61 @@
+DIST gentoo-wine-patches-20170830.tar.xz 58456 SHA256 fb7781d0ae360cbc3860c2d2e81527a1b903da824c01f5d5040e95aaf99a3970 SHA512 5e5159e3252b246bba0ef7fdba345db3ab1071c5b8b8b625f98eda18779d4024c5b76bdbf49ce7bd5c6b01b422807adf76820beddb2b4a6ee9e67d13052cc575 WHIRLPOOL a79be264bab3fcdeee06fef47efd28e6e1125254ac7f82300cb6ba2591ef69cd76b5fed8f778b1849a0659e680e9fc785f0273d55cb2ed95648a74dffa5e22d2
+DIST wine-2.0.tar.bz2 23662707 SHA256 9756f5a2129b6a83ba701e546173cbff86caa671b0af73eb8f72c03b20c066c6 SHA512 b0a57ba8202d9fc396e5bfb7a7718d6bababbed8f3351e7fdc36afa37f35a871e04903757618f73427aeb71a52b2d323977d79e48f8b38d636f23fd404441186 WHIRLPOOL fa9f774d87dae73c7d1f3b86dc3b03ea27065eb6140f1cac13c82fe16f7ebff8f8365ed447220cf5c2788b9f4aae7c482e4f9e2e69f47e5435209e148f5dbdfe
+DIST wine-2.1.tar.xz 18887032 SHA256 bfb9abf63691c93df28d9599aaa866dc2b4e27209b3b7b546df8a37d7d9d1e6e SHA512 03d678ee6e89c2804813f2827255fcf59e96ca9a45b7d8ac441cfc84f835e5e5689c70a79a41a04c631e1add7807fa4a5758acef3bd7aadfb2e92e68958c6ef6 WHIRLPOOL 063d935f1ff0922100641f2f53cdac23d2993a83182d45e028e485fd7d0a13bc5cfb77bca76550b1537b3f42fecacef7fd64785adbf6425af823f56f96973b54
+DIST wine-2.10.tar.xz 19209580 SHA256 488df7ffd2e81da455bf428fc9eb784bb4273a890334500895665711bd52f179 SHA512 8807e16a571bf45d99097ad5fdfb9fe755f6dbe84010a330fed82f1d48c76b7f19589bfc0e5dde0b9e49a608fd0501db3f7e3e129e4d9d34bcae03bc51a73139 WHIRLPOOL e9a8248aac31593fbac28a3d8d4e62bfce14a7c41cc416ebfca8606518d28efd31b32196133da211f75f48bd228bd5d21fcbbc0479293e813ed99b258b37126e
+DIST wine-2.11.tar.xz 19251116 SHA256 efa96dade206aa21accf0da195335a805d38209d6a14320607c6308ebde4cc3c SHA512 691f329c47af5e51498287029988b8ca0777bfc3902ed80fd315004aba2337a938e79177e752efe86423c9b34544df3952b8c443bf43149356575fac75a779ac WHIRLPOOL 4933e1ce640b0abeebccd6969b5eaf4eec76cd135d9cfc1d904a902219f776a68f72e2bd1ae9019d69f0d0d81fd8ead0084785d1b9710590349365977f9c1817
+DIST wine-2.12.tar.xz 19301968 SHA256 496c11af841487e6ec4e1953ac19b05a7f48e397da502653ffbd9fe9004213a7 SHA512 d44c1937d7d2d797150381f70317b810616d61355a59be096366d3507f59b678cffaf6d841cecf02bf9d2afa3dbf4d19270f80fb1d3ba5f0f93787d40c328f62 WHIRLPOOL 6f4b9baa6fcfe86f3d195fe603c2b9450a72a593c8f7042959b42a76880cb4ae680fde7beb70a8e823150849fda36c42985035de891ebf0088c8ffc2bceb15bf
+DIST wine-2.13.tar.xz 19439328 SHA256 6fbca3ddd19b061ce65a267639efae93cf38cfabbe4a9c148a17a44703587ef8 SHA512 71873b9ec1605dd5f7502b87b0f3429c3d14a4196543d7304df455854b58ef82b8fafdcea91450cbfc01434a44886a0e0c4c4cf289ffb53167dde0f969cddc48 WHIRLPOOL 6faf1e6aeea2ab7ccc496ed85834f98eb25111c8f541c24d4876a142ad4acf7d9a4c08c2716e11fb6c92fe7aad29980cab912eb9dbb6759bdbdeca2f2f8e78a7
+DIST wine-2.14.tar.xz 19447812 SHA256 03f934d95181f728600ca04d395f10e821ee38cfa31655e872e4d27d2a8795c6 SHA512 ff43d386d46c0c74449e667b61d8cebd5fa768c88e6220aa2f13df03d80b71b6c0bdf8cbab023aed96f7c88b9787a3be4989da892fa1778412534ae82a7279bb WHIRLPOOL 2d2784e1b2ddeac39a3cea4cb08a62d99d1d062d8d801874e8bf4f56d2538a4cb019418c60299556548028e2362dd533d9ea0956014a65ac7a367ed489c0c392
+DIST wine-2.15.tar.xz 19463720 SHA256 d82d500cbf81fb08c711d3619bd52373138a05574d044f089af89707274868b3 SHA512 a52a42dd1f20fe68213c55a07ac5b2455150806e534f0ab77a8e9ae3d2f12840983fa92290dac569207d3640c7f45cda83801e9f2e80294863ffa854c6c89171 WHIRLPOOL 99c9497a44859ce310c764b3cd172d83ca1a2dce13633fee930ddbf1c40651ee4470f6bc9cfcb407ce65298a2afd73dc9edc536c2ba6f076631e5cf2085b8e61
+DIST wine-2.16.tar.xz 19484716 SHA256 a561edcabecd6c44948e5b2ef11941b2ba047275240418fa2c98c1fdceda2c21 SHA512 749a36b536506c4b63ff7512e316f44503cdb0db46e38a124da86df638f3e8ff9c404b034ece5cbb95cf20c09bc46be9a38f2ee66480aa6a4f2385e2a7a7eea4 WHIRLPOOL 92ae0a427d89b24d41d4565e333cf3b7499c1dfedb6d2a204f934975c35cb589d38b4f669890c1fd6a37b9fe8f34d98be3e7d0986e9ff99516fe00a004574520
+DIST wine-2.17.tar.xz 19505528 SHA256 7edc95739043ccc55957af663fb910318283dc5d1db42cd7f0224e30acfcea69 SHA512 cb10c876e689aa601c68673aab32c0514dd174692a01bdb3afc78d5e6079b0e77f48783af2f54245f397c762da3b4e5f2c1d39d2ce7fdb3b117d338b95c24810 WHIRLPOOL 196427a68ab3b1261cb63bafd7f82b7a688ad439fa82ae3fc04b18c9da14cc8e95b827ca8ddd07124e1179c55ed0e0aba3bdcb4639b724a6dacf4952e8827e16
+DIST wine-2.18.tar.xz 19546360 SHA256 9f0931129878157d717cb39f16cd33bf49f40aac77331c93d0ad30f2ccac4f50 SHA512 61cc39fa3d2b0a0ab3c5d17579865e6aea76dd9513a4b3c45975a2d5c05f2b4ba952b97eef547131a014763c7f692a08df29bc2ebf7e4ac7e2616e6a7822ddb9 WHIRLPOOL e864dd1705c0480d3f3095aa02ab1e7bc5b41693cd6b791cdf05e636c7099562020ac3adcba6421653efdf5dbe232b5abe9071792785e008ea30dedbb63e080e
+DIST wine-2.19.tar.xz 19549464 SHA256 487131e69875ae9c2d042798f954160146e603e449c3c97981f29b42f4a66095 SHA512 83558231bdc592b1f69cfedf6c689063df7bd9fecdfafba6fb7f6a2c7fa7783973efb85a6a49305afc18b1aa268209ee5b9c0655756e05d7550468698dfa51ae WHIRLPOOL 123aec3a367e67353655d940ba2ffe9386a583afbd0961dd3f446a00b0cf82ad4ed590508e03bf2a4e60b11753f8f430e748e6614f476675423f3bdaf7089288
+DIST wine-2.2.tar.xz 18916364 SHA256 64cb57e1d8aa07f5c89ef26743b494f2d3ef9c0f4e50d3ee896a93535f7751f4 SHA512 0700868244d397c1442948716321e5ff030c667edce464570f76aa4340199489a422872aa3975bc0a57b8285c9d59fc04e223a4bde094169fc6db460acb626c4 WHIRLPOOL ffc3d357a76592651b589c6ac6608720d0258474890faf8fe3e20ac29cdd1496d569721256f9389d347bf2734a556099154fd18ef1b56f45bb46c4c15771d6ca
+DIST wine-2.3.tar.xz 18931732 SHA256 afc95c7a87cc8f0730b462c50a5dfc9c462eb02c6bf5874b4fa99946f49e067e SHA512 bea78e8468555ff9e08dedf3918da5ea82721549c43984869989bbdafeea00e454820ff9558aa29925c97a165a9b01e5cd1fd397f133833c58824984a6686171 WHIRLPOOL 1f5ec8e5c32d124277e4c71d95726d3a5337575757c3029567c77165d65fcfec2ddf33d3863b4bf55c9eff7c3582c1ec7dbd76d84ed8bbbe89dd16db6b0128c1
+DIST wine-2.4.tar.xz 18953748 SHA256 87b5df07e4781fecce2f92415a4717208ea253a20a0df8b36b9f90b69b72748e SHA512 15ae7e97dc72a8636b2c15c93803ed430fa456d673add61457cf3e479e769559c682b40949b5d38828f6681f13183e560fcb4a2eb0f0ba25e6eade46f7d3d7c0 WHIRLPOOL 558ab7b7517ad5e03366b4db974047eba776585e958a5b71bb2e93993e21bc725ea7a8bcf2a4354f34ca38c94ba99ccd15f2f8b5e4b58066bf339d3517eec56c
+DIST wine-2.5.tar.xz 18993176 SHA256 13f92b7ab483323aaabbc6519851e688ad4372ea30569961c831d40d6d3bccd2 SHA512 7b6faf6d8aa3d41465ad93ebae055581136f736c7eb8b4c61682e5a05589c83a0ff2c85e0f9abbca016f31b6f1c1435617c4994f1913f715a8707ebee3f28467 WHIRLPOOL 5acd2ac65df5dee1c860ddca72b8df8e021a0b95a3a1870d15468ce4591d569fa15bf8a0a6d341bcd3a624d13d0affe5b0263e67f9dfcbbf3ae7b59218dcded9
+DIST wine-2.6.tar.xz 19023352 SHA256 e6ff64758f437647e99a36c1275e41adf54f0432907172d3bba22b070a97aac0 SHA512 2aa55413ac090e011725566d004e42ee46323cd4c6961b9faa63e3de422ba60bb657bf224a4d7e8aa712a8e26e11977d07acb7c088ffeef8c37310e8cc698970 WHIRLPOOL 82e6a06cc342c7d6eace64a97bae10cc39c120c5776170b059700542b8b6fef56be9a697f05b3bc21ae82621f4bf50f3ab478311c9a3a55d86ed7c0a009766b0
+DIST wine-2.7.tar.xz 19101108 SHA256 e55a43088e313c45f7ab49272b7cb441c06f5659fb4220b2325dc060db0ee14c SHA512 1e61b9a4aa1f5f42fb27d11d5254a9ba90f348ad9c4d1ddd4b5da47cd7de638290a20accf7447db9c0e4ced4c2144497cdf5fc906a5eac60e923dabb61f65d3a WHIRLPOOL 133426a0313facc856eebad3d16d199948b780ce4c4561e5784845c119fe462b8942ed86fa5e823e729a997d704bd3c70f44a64ce3eef965b4f3eb92587dfa4d
+DIST wine-2.8.tar.xz 19120740 SHA256 83e9607af66d86020dc27a368ebba28fa7e8ffecfdf8f149da06b3531ac3e579 SHA512 4d0b167b1e5add31ed0ed05b328d16fc13cd268285c03a9100e7ddc53864aa07f6b216a555ef0c2e51dee550e3f4abf0c7c20db2cbca177bb38e8c3e11f05b97 WHIRLPOOL 568cf46caf7322eb5e26b364bd15f9e80c41a65340952a1ee0fa80514bbee3c5adfa72af40809a978a5d4202f5e8d3da3e4581767bab9fa08ab441cdd5d1da31
+DIST wine-2.9.tar.xz 19154668 SHA256 ac46f7bbbbc1dc135c95e4f98d28bf6e3d7a78fb7f9ba6caa7354a3e8786545f SHA512 6d06e511d8f338297ed0ddb7bf2ffb501f528209eaecbbee3d4e5d53db649dd5ea0aeb78bba661a9bcfda5f97e170ca10eb8fab355e229bfe7db6a5feb7ec4e8 WHIRLPOOL 7355166aeaac54abb6e1d25da6f87a4814d37764044e95462bc2a83f8d5a9b7a3bb10730bb5506516e130a4fc9ee35e3656d1106939bbbc1310c6aff0d798a1c
+DIST wine-d3d9-2.0.tar.gz 48373 SHA256 7bfac23706723c6d51a7a95e416e47fb2678cd4d0945b990f74eba2b059e6206 SHA512 a9e2d1c9f2784128e4c53a8dc923070a5057b5ff3d83c2b536a2d2df0bc8433ac92b8ab1c3cdf34158c0e7bfe497ddb5974605fbc1736a92307639d59450c7a1 WHIRLPOOL 53044c0a4b7159c3af75fc935d1ac45030e80dbfd70d787f64885ddc025cfcd62f724c3256e389a7fde680670e594101955f52301cf6b9bbf23ebc64552790c2
+DIST wine-d3d9-2.1.tar.gz 48385 SHA256 9fd80e3e2ea905272c42dbc14679e94c8e2f955101ae098c84060d4c62ffc9c6 SHA512 9234d8227412d940a6befcf79433f1d5ab0634d5e829f3771ffeea235af05be29ffc40438818b1976c77d1e2e79da8a67c4dab2b7d2e822b502fb6e4a1a7f8b7 WHIRLPOOL 790e482850a13c5bf0967e900620c36d71c4d6673106f8f5c2848550ed574d326d3945d9906de88d847bb5644a520aab7fe6d460b3c3afd49a396798dd253392
+DIST wine-d3d9-2.10.tar.gz 48713 SHA256 62a199a239fca4f172f9ff871086196f8eeb35483d7bcab4acb144c05e60debb SHA512 808241f545e60c0546ff3918cac28e2abb6fe8496e8ade3cfa8bf81612724e827d31787d1d320cbac80b71a5d6180bcc8e51249c12c099e44637e0bb9f4875cd WHIRLPOOL a8c58c5321107b958780348aebad41d57ac0a3a307e176715950e1ed1eae7d19d858db3f9b0e5cb86484919d683321ff6fc19ec1696ba5418e0d2dd861bfaff4
+DIST wine-d3d9-2.11.tar.gz 48714 SHA256 3432863940fdb9ea6f36688d670c6fe800e7359d7b18723828447bedf694b786 SHA512 716dad66fce962246e57a29c239d6b69b78656a11d01a421b490ad61c2c3dd9850b34e2346319a6a35c2a01e0c28193adf78f21b9de1ffde95a06d5fae51fe0d WHIRLPOOL eeef55dca716a68e03b84d4f916955c4194810c1c460a55a30ac2c4257e256b8fc709837d7b35aa86ce3f523f2b9c11222b9096ae4d87979f1fee4a8257ddabb
+DIST wine-d3d9-2.12.tar.gz 48716 SHA256 544e8b901b2fe1e0da90828f07683abf45794a3a41fdfae20eb5d29b5ee7d22b SHA512 8fe9b37ff54372984a234b18037bc736f69f2adf41478f037bc93e3d72893c46174fc3fbff78042ac66bb03d31ea85d293dbadc2b32630218ae53be8e360425d WHIRLPOOL 17f28bafb20c559424945ff92041a5c634b8775a8e97ed8aa940308fa815f2b3cfa48499a58a511fc5c33bde47db07008d168d8b0c103eec379ba27b33b8ffdd
+DIST wine-d3d9-2.13.tar.gz 48711 SHA256 738583d1ad80ddeff5d437ef07885e25a2bba7da9d161ee01e45fef246edd327 SHA512 75481c73c88757c4f15eb00dc427d873ea71109f18fd64c758e858bb2fc2dc1ee7cc29ee912ec93f254186f2055277d07e2e4f1d2ee3c537c76601aa009cf632 WHIRLPOOL 57c5cd0903151eed7c2b719831581aa3216c0fc49a257f7fb9e872ca698a330b5a10d50c945937924c7efefa497dc14117a35c5b39fbccf14cb1fb711e5bbe98
+DIST wine-d3d9-2.14.tar.gz 48718 SHA256 71a3aff0b348f033d4ca610e34ce6faa02eb2b5c822fa2e00b372de66541ffd4 SHA512 77aa93ac9b1a81581c27e74641722666026e2e6e03def57955a05fc76c6c02730271a562130dc87ed1caefc9b00b3e0421b2640fa17165aef2f8be5da0cf07d3 WHIRLPOOL 1319fdfb4426a0a294702a5c43641008654a1352d91d23b9bd422d83fb5cd50053110052eef09ae128dfb570523d9208272abd21cb5975adff060fe7d31ac5ad
+DIST wine-d3d9-2.15.tar.gz 48717 SHA256 c0aa58e7fa3b595c38cf06fe72b54a096e43e526142a7576f839ed8aaa85cabf SHA512 5298de273fc95f65ee481416f8ed16059f244e3781058cb76ee60b6a85aaf8d977a619c75cccd08aadeac9aae9ad2e08b49c5b52ab141cbff351a4b001e7c434 WHIRLPOOL 63337e2c86be5ff2fc16ff0817719ed668360ad2258b095e88b98b1f31e382593b14cabdcb8be58a6dc0cc047cd67a3eb1f14d3ecb806ba2ac9c6f7102368c94
+DIST wine-d3d9-2.16.tar.gz 48728 SHA256 2a681d28a4e042437c32ecf3f92c7abaadc862feba6aacf0df76469acab98f3e SHA512 f3950d7e34ec537b95b963fb3b35ee3729c1b3f9d8c225e96ae9ab9cf8011571ba22105a17309c481f3a504a8aa4d5ae04270691c49098924aa2f72463b79e08 WHIRLPOOL c1f3cb0922cb381f6e2aa7fd54538b98dbd04daa7f36f66742af4c544c80e894e33ebf4866520af35faec27519f0015cd5cc1139fe191bb0b3192cb2134035c3
+DIST wine-d3d9-2.17.tar.gz 48722 SHA256 557ae75a68529f282f1f5e7e9991892d7d994f199060ced43db22291ec66fe71 SHA512 530d44a968a68e06449da2286b8c9740a80b681ff610f6ddc87e6fb569e6c29181341266a04238965a7bfc209e20c1521847b70daa8d3532c2a269db0d200154 WHIRLPOOL 0c70a88949eaa27ebbc28a6951651e4b55166c1d54a8db6d9fdfe3f516d2f4e24ba0f08defddf637b9c2ed0702b250af4d41146684b79e90d84aefe284351059
+DIST wine-d3d9-2.18.tar.gz 48722 SHA256 d1b5210d4228ddcc60f76b4a8694d5feb4e3c68ca4436666ee182c8b14f25356 SHA512 0e66c51e1957b27ccb9f326b0aaf2b0d09b7bbc9d03e1d321aa1789d2560b8e60fd83c4e86999d96a03aa73a37c96f34d93245763969a314150900741aa03933 WHIRLPOOL c879d7ca20e2b339ab1ad862274320ceced84693311dfc02652a83304d0beb263a59e8978fae65ad50bbb51eaac51988ab2a0105c50dafa9176caf1baa791506
+DIST wine-d3d9-2.19.tar.gz 48818 SHA256 54b5fbda45585304e65665e5b2da96a8dc30398c3f8ee12b77a613970b5af9f9 SHA512 be43435cd53f367ca57080c08218db302a90bf85ec6e917e89375904c456b585b61fb6053f9b4366b7e844f8246cabe83460a9866f614dbb5df3edfb43b2f54a WHIRLPOOL bec78732ad8b0036999c4e481e2d6f50d2ec4002590f15fbebab740bbddbc5069f77853993a122ccc03b24cf2b6c76b80117b000648a97fec09eba988c792f57
+DIST wine-d3d9-2.2.tar.gz 48387 SHA256 203ed60980ec584c09b413266728e3a93e2d980dbff9b4f65375a4e9744b5042 SHA512 6e9e031b51afc8ec200bbd252ff0d768c29af23907f782409834de593f896afb128f86fe012c95dc18e5f3c7267f170eb343d2a2c53d639933a337f0c1e04fab WHIRLPOOL 6b32c0dfd3068e87d94bbcd83718dd75a14b36d69b151e9257e04793d2d3ae78ce7da10b80cbc824ccefb6c11666241593f91963ddee6a58301f95bbde35285d
+DIST wine-d3d9-2.3.tar.gz 48510 SHA256 fc17488a782def19fc02bf967128ab43236db49509e31771361a60fa3d17dd60 SHA512 58449f6b7ed7fd8182e2cce92e1d1195bf64a567c1cc92fd3f46af195e7e4039c3b2a128be9d3572d9067be6c1bb020f417c6d558bb551c60096c107067177b8 WHIRLPOOL f648a921cf4cd257a3a7dfbd3abf45d58c07782f329ec11c3a1eff3afe32e8040adb351d4a60e1b1f78c7cae0379f23468764ad162a101179d0f5b0e2c6d9413
+DIST wine-d3d9-2.4.tar.gz 48502 SHA256 4c7084e733d95545b894b152b2c6c9564dfb8df594cfeb1512dad80743b39ae0 SHA512 623b1720b8cd79ab6ad2a177b9beb174f31e6fc402d6885fa2006223c855919c6f5d4267c64212ecf8cf1746430c9715c506343fb740828fc99910f916b10ebe WHIRLPOOL 9c0ea34dedc2e39ce36f1539a6d761ba07429b316a1f7fad49067eec5c28a5c60b33b3d2473cbf66b009d9772c1fb123414bfa201eb8df3e61f8efc38aa1f3fa
+DIST wine-d3d9-2.5.tar.gz 48692 SHA256 8b28c16701ec1cefab11d41d00954a92a5ced9a63f1ede81e96f247d2f498f94 SHA512 8b5ebec6341f70ec977aabee35decbe2d22fe43e111c1fd6015066a2b0e4fd259cd964fdb79306a489be4406078cb1e241d90ed636222174ed4abcc8026e7d03 WHIRLPOOL d5fcc5fbea4c4a4900235d33cb5de8f2a7cbf2b51b1a5c47d75ab765aa88ce1f8f81a61eefe0a742a55bb2ca210747b345589628fd1020430e4d962319b1c6fe
+DIST wine-d3d9-2.6.tar.gz 48702 SHA256 06ed18f2d5fff04613ea1401c37ad70e163135c159528745ff1063d617f31e2d SHA512 17df692df8ff3c1419258a3faf9ddacde67f185a797dce76cd07c07e6f4fa2040b981662d311329a80921c039bfba0da5fed3ee53f8c36e34eeaa92af1c7b755 WHIRLPOOL e614b4af0f3c92113617f533255fd67a4b322bdaf0939fb98e09bf77e3b0437cb2b813032e33300e45294a60d5c3586a302669c28c293e180c775666cddc2581
+DIST wine-d3d9-2.7.tar.gz 48708 SHA256 df6ed1e50d8af0624b8f4f658705f75102094f6e17fec53ec8461991ce5dca2a SHA512 d258e81a942f905255a637aa80dd647878691caa79adc52fd79f66ce1320d42d7d36ea776876d6a26a2c711a168da4c64f27fa8744ca6d8318c5526f8a8af75a WHIRLPOOL 2d62cab5e3b14eaf29ecc96ac97555f48845a78c751040a850750d3b19fbc64efb3f3589dd3475a03cb1e3dff3e200528dabd2952b1ee8d0520a5db0d7db154b
+DIST wine-d3d9-2.8.tar.gz 48700 SHA256 c67de9fee6e97859896aa2326fbc245e8b0f7393a1c6341126607b03afebc964 SHA512 bb933b51d0022ce616331f2550faedeff3058007525b4519833b925c57999ab08b08380b8967d48ad7c56458e812342428388a5eac2ed8fcdd8cfbfee74a8e8c WHIRLPOOL 52c8538e3f4b3be3412ee544efebae69c3de781255e12298d544f47523aba3afaadbffa8dedc463c207b0ae8a0a92599beca17017f266648b9b229847990ae2e
+DIST wine-d3d9-2.9.tar.gz 48693 SHA256 32b847adf74c293e858800248aa1b164688f98cde89ca4d2cd0808fae7f94340 SHA512 89d06587481f7702b6884c83627a27c7b38a078e2b333bea2612a58840695211c19ab4ca02669c983580f95ae42ef114020f6b6bbb1a17d72449c0ed2212dc49 WHIRLPOOL e32b261f6e87580eec2c2ee57848b08b2487d1f280b8b257403e0722ec1b44cb31dcb240d89757599be2c3c6d958c48f92510bc625e5c05fc08116d13c303168
+DIST wine-staging-2.0.tar.gz 10182575 SHA256 22a43cb50c1fff9c6f233a965247056e3321533aa73a6419aa34a22de7180039 SHA512 51412299259d6e92c8993543d5fdb3239ebe31e0d1d715e0a9e8ce94b3139c0567b08ff1600d41be94f12427cbfccc2f6b6b2ed030535445c95618aaf6578580 WHIRLPOOL 9879174bc3a7c8ece156c822b7a7b870908e51335702a78e6f04ea1496125a2018a879bfc53d1302e4825138d22af526308ba7f656d683a535be44d4515f1bac
+DIST wine-staging-2.1.tar.gz 10101781 SHA256 1d193be2734ea495df2cae1dc54ce89204ca68699979174b0bd726d2e5e0576b SHA512 c64c48b265f0779c621a643ddbd2d12aaa548e4bff3b2b728280cdb9613214989911ee8ba5e46c7770f5f6430014a5da1c98e95d5008c1174bd14bf9ce5250db WHIRLPOOL ecf970ef436089bbcd0088e1608b22e808d54560e905c7d8046b3e21508166a595c3ef7b69819c45e4b13183bd9134a2bd7016d29c4da52985701d392eb35a0a
+DIST wine-staging-2.10.tar.gz 10091114 SHA256 b361ec92b2e40de983b987f6564dbb75dcb121c6e2f0123fe1ae234fd81a591b SHA512 c3bf7027ddfd1405263cce844a7cbeb923e9de56cffdb296384449c0cc600b3c9a37c7fe09b62fb9ae0b47f97a2d4f208cc589f0e4205fa84ce5d112953ac2e7 WHIRLPOOL 01c5436179bcbd29ee0468f2f4d839ba805c064d80835fcd1d5e6eba562881c65ac576657a733c726ccf4b37473da6724ae06ebc023fb988d8810ed1f8096c6b
+DIST wine-staging-2.11.tar.gz 10083147 SHA256 45c40fbca76cab987e7adfe47fc8e24692f896805c8a6dc6030da28e3bd842bc SHA512 e2d05ee88e1cc932c2890f1db867a9382f2c62a00ea7d63fc6bd7b3fab57ea2f0e4908313cbed08b92e48d5bc17753b0b78f6cdf2cb64e81aa5725fd86cbc695 WHIRLPOOL e2d13ed7d258b1ee442c8c87f852c1564ce5f262bd7cd31710b975882ab8cb454a1e2ec308c6c17e5bd0a691b0492fdea22a182323cb963c055592ce538db690
+DIST wine-staging-2.12.tar.gz 10105899 SHA256 0f186d2268011c12094ecac8747378ad8f4ee7152e8854cb00496ba9565b7974 SHA512 a8c21c923153a42609e3ea9065b84208b01f3b14d55b7e68e548ebf6d27df956051b29dc2f053aec6287422c13eed5b6ec71e667ae6f46b1c80ae7c84a51b648 WHIRLPOOL 01cf39fa257e9975cfd16976e680117dac3d0ea3f9bc41e2d0a636023bd4afba0676587e41c55d4417cff97080b90eb11b3fe475970eec70be64f5c788c1cf88
+DIST wine-staging-2.13.tar.gz 10137549 SHA256 0796440ebfa2aa651051e7081cc64f83774f966f26353876e024e42c59e24b46 SHA512 86077747d8a4f6e56dc1b0dda1688810defa9bcebaaadbf2419ce56e4590d4249881105e1dda24236f861baf0b1cc42019b2538de5d24a6d3c4f27c7a8248086 WHIRLPOOL e0c147519fde14f74031fcb7ba154c39583a9c817460d21ec50fdae40039136d46b8cc0ce9a8fb558ddbf8b62c6f0a572ad04a887c47046c0e921e6f08c4b44d
+DIST wine-staging-2.14.tar.gz 10179829 SHA256 cd4c8e400a808cbfa5c5cf088ea874c761d09db897f25bc33eab840101020b19 SHA512 1e794f77309e94612f822b72872ac2726e37d219a40c4a45feb2fb56f4413c34eae966a4ae8708d502c837cd47db22979e9a05cb73b681703cd729f701cdb210 WHIRLPOOL 63f9ff9cd4d54d6ff91997a904e7cd612bb8bca905399e9c6950b274cd8218c0c04a40dca9f4e12180e1080f1631bfec38e3633fcd457e688e8f8883661a4e59
+DIST wine-staging-2.15.tar.gz 10190900 SHA256 f2b5c43fbc185a6fd6399f4c351b83a172737977b2ebb1cbdeddd1838d044bc2 SHA512 75d64d103839da2daed6e5b2400185c0a5274d0e50b675283bbadff70cafe712e573701207d80c8e8af7f68d1d273efec3c0d705dc982c74b8574929daadecfa WHIRLPOOL 13239aa636fc102fb374ab8724b7dbce8e9b95f16797a4f5faf8a5e7789d60e6b485c7495ccef4568edbbb0549d657a6758642de2e98b449b0ced2725136e444
+DIST wine-staging-2.16.tar.gz 10220855 SHA256 da0ef4b0eafe9cd1b9cf26a5b950088adf1308e17a0d6f4ae62516b6ee64248e SHA512 96585caf77569a31f516aefe230a8907ef91db29759f75075593b751985f294bf292a1c146d287a3f0859a6b6273560670c4bc734ef0fbecb0809574eb3f09ba WHIRLPOOL 66128c8d59593243e95d6765b9fd8ace59e85e365a5e8a41eeb17d370464005aef060ddf3d862d0a3638048fd92189860e69a3cbf7d24d3ce1e420200d4b3cf5
+DIST wine-staging-2.17.tar.gz 10211107 SHA256 f511bf3438dc418b4f667513bf1ae419255e4ee62229e9205c0c64b047222183 SHA512 b652f6a852a1382c1b8275e172b7ac7608749c34aef5c0c5387cf262bf0da8db67a77ce397d49e53f3e2a8f210a3dbea1a9b3f3feb15c7d5bad8952b6fb7b53c WHIRLPOOL c45dc5fc91bc774f9f28bb06dff959391829fafac398bef198755395afe5a65bb2d32ba3ce157607a6040481955926866ed8f0760850bfca821be8599f4d7b64
+DIST wine-staging-2.18.tar.gz 10243957 SHA256 69c75d3ca17b1c3617cd0934a9e9ad6fca37c6679900d2cb63f6981aa1026cc8 SHA512 fe18b53d4160596d134ceed392f6459e9c183381f4712add43d8422e77d7d5d89ff34a3bb3afbd7740f250d85dfda0f3501e9600a41270790ae02138ed6d7dc7 WHIRLPOOL 2dc1429a7a4f13ee01b1317f1937ef7ec6b42c3cfdd78ff78bb8273e1056751edb2ac119904ba48ab645b430f269a9361a6d42bcbb5dfb46bd15a129569d3194
+DIST wine-staging-2.19.tar.gz 10241240 SHA256 2fdb083a484708362433000f92b54a5d648df190b2ab084647c45f5624063bd2 SHA512 90916cb096bbfec35514eff4c1b6e2090b6e68e3e7af1164715f5abb1d255c5cfd6411f53c27cb277adcf0982fa6d6e508a7cdbc1404dcca6c2700b05c2c5483 WHIRLPOOL 3ed1a5d39d0ec186538e04ca09e4fa2729f356385523177b753e7c7183416f666f336bec7d4b606f29266cd227cf5e72f707c79adf510bc3899adb76ce3df84f
+DIST wine-staging-2.2.tar.gz 10078327 SHA256 9d3cbf7e5f12c623d275457b910a158e0b176fcf50c09a5f8425864de604bc1d SHA512 8ad3f8ba4c6439a9ec4884a55018a67c9e2c2384830074646aac7b70cb9f4f5a20f760247ab42dc3d2f697cdac7ea5322be8ed12c435cb0bc185ac08fdd4dd91 WHIRLPOOL a34c19aaace64307de56d935cb0cef17d7c066c39b83c51e70ea76a20083f928bea55fe38d62b7a8250b0a9e8f00e0d2b744f43fcab433069ffb96625d955303
+DIST wine-staging-2.3.tar.gz 10071742 SHA256 9a81be606836fab6203857f7937ff97575947f75d52c80fb5489418efb8b87e1 SHA512 8e8af1e36cc69c63ec3542f0ec4db18b6d8c16b5c9077eb211297f3a886519da71bcf72934bf8d6d72e44c7c9f765e1d00203d0d75cab8544f69f9b0c10a7133 WHIRLPOOL 50738a6e20890748d7eb01152244d34b259759f61b3587ba39815dc066fc8e2b66ce182e1ddbc912f50076a3599aa060ec6a94eeaab4513ce3a776711929b9b1
+DIST wine-staging-2.4.tar.gz 10067020 SHA256 709cab12c0ebf7cf9504fd4a67eb851272309e00066ad81f184b0f55c63e9deb SHA512 55d11851697836b582ba54696cadc812ef6b14872440f5c3ed6fbe30a05abcb8abe2ab31a11ea4daeb354854c7c0e6549401d4b26b26621808bdeb89aeb206f9 WHIRLPOOL 8d344b7e6e89322c8dbbe6fd211851c90a45a33b514c182609cc60dc21939f791abc71d8665cd66e5c5161f159fe24c4772b99405833e3d11985a644e1335eaf
+DIST wine-staging-2.5.tar.gz 10062025 SHA256 b5cf6fa38151ff47ab6d725077693b02b37bb07b2ab7fda55290bb1f63ac54ad SHA512 6ab981886776f624c6478230aad18870f55b7252f1c6df90bfe1a248f7ea76cbb181f8e0780fdd4bb5e3c589a785baa7cf126a2c838adf65db2a67f873ed1698 WHIRLPOOL 7045b1642a3b14e5a507854cb8bf910c7cfb3c64ada4ee3534175c75b03cd604206617a55fb870e47fb248a4db8a9ca2abc0b4688005c1c0de0d542fec8cbc57
+DIST wine-staging-2.6.tar.gz 10034709 SHA256 ff86ddcceb7f6857bd415db3842ddf216a5cb301452e2a08053a9378cbf5580a SHA512 dc199b5345985d261b708ac811b02253ab9fbc4966889f2382ce518d991fe43b7c771c1d56d055c6234c9329d5c571cd9cf0b16587b77124b9c46917ddd066d2 WHIRLPOOL 375f484c6c50645c605994eb08c38c649ca6c8b47430e2f2f285a63fc24eca81588d0496a8c32074f90e4ea8f4330f76854bf8874f042e27581a7eee19aedf98
+DIST wine-staging-2.7.tar.gz 10018082 SHA256 3095f9c634f00b143c2407dce8c3f29c629ec95074cf14c8e8dc2e0cdba45b6d SHA512 0abc89af701ae1b95c0eb08e72894c7bc40bdfe792e05b8af9282eab8407bb90b7dfcd4eb3a193a88759ce5d6ea6c2aa9696cac2d744f543c92529bb0d2636ee WHIRLPOOL 6cc666f702ef1bd574ede54a7f6755e07d768c9fa549b9bdb9b5416288619347e0c1b9c70893b6300800d8e6c94e8d2396937f639d1e821945ba9fe144b32c95
+DIST wine-staging-2.8.tar.gz 10043842 SHA256 8680614be6c3b01c7c577eb6924fc05cc3de92394384939dd5b2e12e08235fff SHA512 af1707fe3119664a0d97d94fc4c955612d80cb76eae8c4248a268c0f6be9e659fccf7c26899c9e9ae5822f74474c0db5283b598dd4d9d69a3b108f947653217a WHIRLPOOL 7e9aa61a7666404475abb442304e63c76c2e6df26479711b7c08ebe7c15b9b53017e7a1d2dca4f9f8aeba78290df03f06076c99ac06c30d5ed893cfc3842107a
+DIST wine-staging-2.9.tar.gz 10062408 SHA256 cde0895142c0ca0be5b532560ec0546d6e4f655615572d80cfcce663f92c57f6 SHA512 7862a403817791c54c5c1b8f233b06a850500305c46283bccb9026fb6db041a8fba619d145ab21fe2fdc5f25ed3bbb75fde05245fbbbd67139a5f64b547b1196 WHIRLPOOL 52c0b9065cfa54f6b86b74f9a98c9d232e3a88aa9d61d06c6e01044122fab8b01a567e99f93014042031e9eb991fd9234c4a02ebe3d2aa8c042e5e769269095c
diff --git a/app-emulation/wine-any/metadata.xml b/app-emulation/wine-any/metadata.xml
new file mode 100644
index 0000000..2abb35c
--- /dev/null
+++ b/app-emulation/wine-any/metadata.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="project">
+ <email>wine@gentoo.org</email>
+ <name>Wine</name>
+ </maintainer>
+ <maintainer type="person">
+ <description>Only CC on bugs that involve USE="d3d9"</description>
+ <email>commendsarnex@gmail.com</email>
+ <name>Nick Sarnie</name>
+ </maintainer>
+ <longdescription>
+Wine is an Open Source implementation of the Windows API on top of X and Unix.
+
+Think of Wine as a compatibility layer for running Windows programs. Wine does not require Microsoft Windows, as it is a completely free alternative implementation of the Windows API consisting of 100% non-Microsoft code, however Wine can optionally use native Windows DLLs if they are available. Wine provides both a development toolkit for porting Windows source code to Unix as well as a program loader, allowing many unmodified Windows programs to run on x86-based Unixes, including Linux, FreeBSD, and Solaris.
+
+This variant of the wine packaging allows for the use of the Wine-Staging patchset and the Gallium Nine patchset.
+ </longdescription>
+ <use>
+ <flag name="capi">Enable ISDN support via CAPI</flag>
+ <flag name="custom-cflags">Bypass strip-flags; use at your own peril</flag>
+ <flag name="d3d9">Apply highly experimental patches for Gallium Nine support.
+ This patch may break some applications.</flag>
+ <flag name="dos">Pull in <pkg>games-emulation/dosbox</pkg> to run DOS applications</flag>
+ <flag name="gecko">Add support for the Gecko engine when using iexplore</flag>
+ <flag name="gstreamer">Use <pkg>media-libs/gstreamer</pkg> to provide DirectShow functionality;</flag>
+ <flag name="mono">Add support for .NET using Wine's Mono add-on</flag>
+ <flag name="netapi">Use libnetapi from <pkg>net-fs/samba</pkg> to support Windows networks in netapi32.dll</flag>
+ <flag name="opencl">Enable OpenCL support</flag>
+ <flag name="osmesa">Add support for OpenGL in bitmaps using libOSMesa</flag>
+ <flag name="pcap">Support packet capture software (e.g. wireshark)</flag>
+ <flag name="perl">Install helpers written in perl (winedump/winemaker)</flag>
+ <flag name="pipelight">Apply Wine-Staging patches for Pipelight/Silverlight support</flag>
+ <flag name="prelink">Run prelink on DLLs during build;
+ For versions before wine-1.7.55 or hardened, do not disable if you do not know what this means as it can break things at runtime</flag>
+ <flag name="realtime">Pull in <pkg>sys-auth/rtkit</pkg> for low-latency pulseaudio support</flag>
+ <flag name="run-exes">Use Wine to open and run .EXE and .MSI files</flag>
+ <flag name="s3tc">Pull in <pkg>media-libs/libtxc_dxtn</pkg> for DXTn texture compression, needed for many games</flag>
+ <flag name="samba">Add support for NTLM auth. see
+ http://wiki.winehq.org/NtlmAuthSetupGuide and
+ http://wiki.winehq.org/NtlmSigningAndSealing</flag>
+ <flag name="staging">Apply Wine-Staging patches for advanced feature support that haven't made it into upstream Wine yet</flag>
+ <flag name="themes">Support GTK+:3 window theming through Wine-Staging</flag>
+ <flag name="udev">Use <pkg>virtual/libudev</pkg> to provide plug and play support</flag>
+ </use>
+ <upstream>
+ <remote-id type="github">wine-compholio/wine-staging</remote-id>
+ <remote-id type="sourceforge">wine</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/app-emulation/wine-any/wine-any-2.0-r1.ebuild b/app-emulation/wine-any/wine-any-2.0-r1.ebuild
new file mode 100644
index 0000000..0716517
--- /dev/null
+++ b/app-emulation/wine-any/wine-any-2.0-r1.ebuild
@@ -0,0 +1,636 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.0/${MY_P}.tar.bz2"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+STAGING_P="wine-staging-${PV}"
+STAGING_DIR="${WORKDIR}/${STAGING_P}"
+D3D9_P="wine-d3d9-${PV}"
+D3D9_DIR="${WORKDIR}/wine-d3d9-patches-${D3D9_P}"
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, with optional external patchsets"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+if [[ ${PV} == "9999" ]] ; then
+ STAGING_EGIT_REPO_URI="https://github.com/wine-compholio/wine-staging.git"
+ D3D9_EGIT_REPO_URI="https://github.com/sarnex/wine-d3d9-patches.git"
+else
+ SRC_URI="${SRC_URI}
+ staging? ( https://github.com/wine-compholio/wine-staging/archive/v${PV}.tar.gz -> ${STAGING_P}.tar.gz )
+ d3d9? ( https://github.com/sarnex/wine-d3d9-patches/archive/${D3D9_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags d3d9 dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap pipelight +png prelink pulseaudio +realtime +run-exes s3tc samba scanner selinux +ssl staging test themes +threads +truetype udev +udisks v4l vaapi +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ pipelight? ( staging )
+ s3tc? ( staging )
+ test? ( abi_x86_32 )
+ themes? ( staging )
+ vaapi? ( staging )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ d3d9? (
+ media-libs/mesa[d3d9,egl,${MULTILIB_USEDEP}]
+ x11-libs/libX11[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libxcb[${MULTILIB_USEDEP}]
+ )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ staging? ( sys-apps/attr[${MULTILIB_USEDEP}] )
+ themes? (
+ dev-libs/glib:2[${MULTILIB_USEDEP}]
+ x11-libs/cairo[${MULTILIB_USEDEP}]
+ x11-libs/gtk+:3[${MULTILIB_USEDEP}]
+ )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ vaapi? ( x11-libs/libva[X,${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.6.4 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ s3tc? ( >=media-libs/libtxc_dxtn-1.0.1-r1[${MULTILIB_USEDEP}] )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ staging? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use staging || use d3d9; then
+ eerror "Because of the multi-repo nature of ${MY_PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use staging; then
+ local CURRENT_WINE_COMMIT=${EGIT_VERSION}
+
+ git-r3_fetch "${STAGING_EGIT_REPO_URI}" "${STAGING_COMMIT}"
+ git-r3_checkout "${STAGING_EGIT_REPO_URI}" "${STAGING_DIR}"
+
+ local COMPAT_WINE_COMMIT=$("${STAGING_DIR}/patches/patchinstall.sh" --upstream-commit) || die
+
+ if [[ "${CURRENT_WINE_COMMIT}" != "${COMPAT_WINE_COMMIT}" ]]; then
+ einfo "The current Staging patchset is not guaranteed to apply on this WINE commit."
+ einfo "If src_prepare fails, try emerging with the env var WINE_COMMIT."
+ einfo "Example: WINE_COMMIT=${COMPAT_WINE_COMMIT} emerge -1 wine"
+ fi
+ fi
+ if use d3d9; then
+ git-r3_fetch "${D3D9_EGIT_REPO_URI}" "${D3D9_COMMIT}"
+ git-r3_checkout "${D3D9_EGIT_REPO_URI}" "${D3D9_DIR}"
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ if use staging; then
+ ewarn "Applying the Wine-Staging patchset. Any bug reports to the"
+ ewarn "Wine bugzilla should explicitly state that staging was used."
+
+ local STAGING_EXCLUDE=""
+ STAGING_EXCLUDE="${STAGING_EXCLUDE} -W winhlp32-Flex_Workaround" # Avoid double patching https://bugs.winehq.org/show_bug.cgi?id=42132
+ use pipelight || STAGING_EXCLUDE="${STAGING_EXCLUDE} -W Pipelight"
+
+ # Launch wine-staging patcher in a subshell, using eapply as a backend, and gitapply.sh as a backend for binary patches
+ ebegin "Running Wine-Staging patch installer"
+ (
+ set -- DESTDIR="${S}" --backend=eapply --no-autoconf --all ${STAGING_EXCLUDE}
+ cd "${STAGING_DIR}/patches"
+ source "${STAGING_DIR}/patches/patchinstall.sh"
+ )
+ eend $? || die "Failed to apply Wine-Staging patches"
+ fi
+ if use d3d9; then
+ if use staging; then
+ PATCHES+=( "${D3D9_DIR}/staging-helper.patch" )
+ else
+ PATCHES+=( "${D3D9_DIR}/d3d9-helper.patch" )
+ fi
+ PATCHES+=( "${D3D9_DIR}/wine-d3d9.patch" )
+ fi
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use staging && myconf+=(
+ --with-xattr
+ $(use_with themes gtk3)
+ $(use_with vaapi va)
+ )
+ use d3d9 && myconf+=( $(use_with d3d9 d3d9-nine) )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine register --staging ${P} || die
+ fi
+ if use d3d9; then
+ eselect wine register --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine deregister --staging ${P} || die
+ fi
+ if use d3d9; then
+ eselect wine deregister --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-any/wine-any-2.1-r1.ebuild b/app-emulation/wine-any/wine-any-2.1-r1.ebuild
new file mode 100644
index 0000000..046c4b3
--- /dev/null
+++ b/app-emulation/wine-any/wine-any-2.1-r1.ebuild
@@ -0,0 +1,636 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+STAGING_P="wine-staging-${PV}"
+STAGING_DIR="${WORKDIR}/${STAGING_P}"
+D3D9_P="wine-d3d9-${PV}"
+D3D9_DIR="${WORKDIR}/wine-d3d9-patches-${D3D9_P}"
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, with optional external patchsets"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+if [[ ${PV} == "9999" ]] ; then
+ STAGING_EGIT_REPO_URI="https://github.com/wine-compholio/wine-staging.git"
+ D3D9_EGIT_REPO_URI="https://github.com/sarnex/wine-d3d9-patches.git"
+else
+ SRC_URI="${SRC_URI}
+ staging? ( https://github.com/wine-compholio/wine-staging/archive/v${PV}.tar.gz -> ${STAGING_P}.tar.gz )
+ d3d9? ( https://github.com/sarnex/wine-d3d9-patches/archive/${D3D9_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags d3d9 dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap pipelight +png prelink pulseaudio +realtime +run-exes s3tc samba scanner selinux +ssl staging test themes +threads +truetype udev +udisks v4l vaapi +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ pipelight? ( staging )
+ s3tc? ( staging )
+ test? ( abi_x86_32 )
+ themes? ( staging )
+ vaapi? ( staging )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ d3d9? (
+ media-libs/mesa[d3d9,egl,${MULTILIB_USEDEP}]
+ x11-libs/libX11[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libxcb[${MULTILIB_USEDEP}]
+ )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ staging? ( sys-apps/attr[${MULTILIB_USEDEP}] )
+ themes? (
+ dev-libs/glib:2[${MULTILIB_USEDEP}]
+ x11-libs/cairo[${MULTILIB_USEDEP}]
+ x11-libs/gtk+:3[${MULTILIB_USEDEP}]
+ )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ vaapi? ( x11-libs/libva[X,${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.6.4 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ s3tc? ( >=media-libs/libtxc_dxtn-1.0.1-r1[${MULTILIB_USEDEP}] )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ staging? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use staging || use d3d9; then
+ eerror "Because of the multi-repo nature of ${MY_PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use staging; then
+ local CURRENT_WINE_COMMIT=${EGIT_VERSION}
+
+ git-r3_fetch "${STAGING_EGIT_REPO_URI}" "${STAGING_COMMIT}"
+ git-r3_checkout "${STAGING_EGIT_REPO_URI}" "${STAGING_DIR}"
+
+ local COMPAT_WINE_COMMIT=$("${STAGING_DIR}/patches/patchinstall.sh" --upstream-commit) || die
+
+ if [[ "${CURRENT_WINE_COMMIT}" != "${COMPAT_WINE_COMMIT}" ]]; then
+ einfo "The current Staging patchset is not guaranteed to apply on this WINE commit."
+ einfo "If src_prepare fails, try emerging with the env var WINE_COMMIT."
+ einfo "Example: WINE_COMMIT=${COMPAT_WINE_COMMIT} emerge -1 wine"
+ fi
+ fi
+ if use d3d9; then
+ git-r3_fetch "${D3D9_EGIT_REPO_URI}" "${D3D9_COMMIT}"
+ git-r3_checkout "${D3D9_EGIT_REPO_URI}" "${D3D9_DIR}"
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ if use staging; then
+ ewarn "Applying the Wine-Staging patchset. Any bug reports to the"
+ ewarn "Wine bugzilla should explicitly state that staging was used."
+
+ local STAGING_EXCLUDE=""
+ STAGING_EXCLUDE="${STAGING_EXCLUDE} -W winhlp32-Flex_Workaround" # Avoid double patching https://bugs.winehq.org/show_bug.cgi?id=42132
+ use pipelight || STAGING_EXCLUDE="${STAGING_EXCLUDE} -W Pipelight"
+
+ # Launch wine-staging patcher in a subshell, using eapply as a backend, and gitapply.sh as a backend for binary patches
+ ebegin "Running Wine-Staging patch installer"
+ (
+ set -- DESTDIR="${S}" --backend=eapply --no-autoconf --all ${STAGING_EXCLUDE}
+ cd "${STAGING_DIR}/patches"
+ source "${STAGING_DIR}/patches/patchinstall.sh"
+ )
+ eend $? || die "Failed to apply Wine-Staging patches"
+ fi
+ if use d3d9; then
+ if use staging; then
+ PATCHES+=( "${D3D9_DIR}/staging-helper.patch" )
+ else
+ PATCHES+=( "${D3D9_DIR}/d3d9-helper.patch" )
+ fi
+ PATCHES+=( "${D3D9_DIR}/wine-d3d9.patch" )
+ fi
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use staging && myconf+=(
+ --with-xattr
+ $(use_with themes gtk3)
+ $(use_with vaapi va)
+ )
+ use d3d9 && myconf+=( $(use_with d3d9 d3d9-nine) )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine register --staging ${P} || die
+ fi
+ if use d3d9; then
+ eselect wine register --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine deregister --staging ${P} || die
+ fi
+ if use d3d9; then
+ eselect wine deregister --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-any/wine-any-2.10-r1.ebuild b/app-emulation/wine-any/wine-any-2.10-r1.ebuild
new file mode 100644
index 0000000..61c306c
--- /dev/null
+++ b/app-emulation/wine-any/wine-any-2.10-r1.ebuild
@@ -0,0 +1,638 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+STAGING_P="wine-staging-${PV}"
+STAGING_DIR="${WORKDIR}/${STAGING_P}"
+D3D9_P="wine-d3d9-${PV}"
+D3D9_DIR="${WORKDIR}/wine-d3d9-patches-${D3D9_P}"
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, with optional external patchsets"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+if [[ ${PV} == "9999" ]] ; then
+ STAGING_EGIT_REPO_URI="https://github.com/wine-compholio/wine-staging.git"
+ D3D9_EGIT_REPO_URI="https://github.com/sarnex/wine-d3d9-patches.git"
+else
+ SRC_URI="${SRC_URI}
+ staging? ( https://github.com/wine-compholio/wine-staging/archive/v${PV}.tar.gz -> ${STAGING_P}.tar.gz )
+ d3d9? ( https://github.com/sarnex/wine-d3d9-patches/archive/${D3D9_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags d3d9 dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap pipelight +png prelink pulseaudio +realtime +run-exes s3tc samba scanner selinux +ssl staging test themes +threads +truetype udev +udisks v4l vaapi +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ pipelight? ( staging )
+ s3tc? ( staging )
+ test? ( abi_x86_32 )
+ themes? ( staging )
+ vaapi? ( staging )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXfixes[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ d3d9? (
+ media-libs/mesa[d3d9,egl,${MULTILIB_USEDEP}]
+ x11-libs/libX11[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libxcb[${MULTILIB_USEDEP}]
+ )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ staging? ( sys-apps/attr[${MULTILIB_USEDEP}] )
+ themes? (
+ dev-libs/glib:2[${MULTILIB_USEDEP}]
+ x11-libs/cairo[${MULTILIB_USEDEP}]
+ x11-libs/gtk+:3[${MULTILIB_USEDEP}]
+ )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ vaapi? ( x11-libs/libva[X,${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.0 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ s3tc? ( >=media-libs/libtxc_dxtn-1.0.1-r1[${MULTILIB_USEDEP}] )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ staging? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use staging || use d3d9; then
+ eerror "Because of the multi-repo nature of ${MY_PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use staging; then
+ local CURRENT_WINE_COMMIT=${EGIT_VERSION}
+
+ git-r3_fetch "${STAGING_EGIT_REPO_URI}" "${STAGING_COMMIT}"
+ git-r3_checkout "${STAGING_EGIT_REPO_URI}" "${STAGING_DIR}"
+
+ local COMPAT_WINE_COMMIT=$("${STAGING_DIR}/patches/patchinstall.sh" --upstream-commit) || die
+
+ if [[ "${CURRENT_WINE_COMMIT}" != "${COMPAT_WINE_COMMIT}" ]]; then
+ einfo "The current Staging patchset is not guaranteed to apply on this WINE commit."
+ einfo "If src_prepare fails, try emerging with the env var WINE_COMMIT."
+ einfo "Example: WINE_COMMIT=${COMPAT_WINE_COMMIT} emerge -1 wine"
+ fi
+ fi
+ if use d3d9; then
+ git-r3_fetch "${D3D9_EGIT_REPO_URI}" "${D3D9_COMMIT}"
+ git-r3_checkout "${D3D9_EGIT_REPO_URI}" "${D3D9_DIR}"
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ if use staging; then
+ ewarn "Applying the Wine-Staging patchset. Any bug reports to the"
+ ewarn "Wine bugzilla should explicitly state that staging was used."
+
+ local STAGING_EXCLUDE=""
+ STAGING_EXCLUDE="${STAGING_EXCLUDE} -W winhlp32-Flex_Workaround" # Avoid double patching https://bugs.winehq.org/show_bug.cgi?id=42132
+ use pipelight || STAGING_EXCLUDE="${STAGING_EXCLUDE} -W Pipelight"
+
+ # Launch wine-staging patcher in a subshell, using eapply as a backend, and gitapply.sh as a backend for binary patches
+ ebegin "Running Wine-Staging patch installer"
+ (
+ set -- DESTDIR="${S}" --backend=eapply --no-autoconf --all ${STAGING_EXCLUDE}
+ cd "${STAGING_DIR}/patches"
+ source "${STAGING_DIR}/patches/patchinstall.sh"
+ )
+ eend $? || die "Failed to apply Wine-Staging patches"
+ fi
+ if use d3d9; then
+ if use staging; then
+ PATCHES+=( "${D3D9_DIR}/staging-helper.patch" )
+ else
+ PATCHES+=( "${D3D9_DIR}/d3d9-helper.patch" )
+ fi
+ PATCHES+=( "${D3D9_DIR}/wine-d3d9.patch" )
+ fi
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with X xfixes)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use staging && myconf+=(
+ --with-xattr
+ $(use_with themes gtk3)
+ $(use_with vaapi va)
+ )
+ use d3d9 && myconf+=( $(use_with d3d9 d3d9-nine) )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine register --staging ${P} || die
+ fi
+ if use d3d9; then
+ eselect wine register --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine deregister --staging ${P} || die
+ fi
+ if use d3d9; then
+ eselect wine deregister --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-any/wine-any-2.11-r1.ebuild b/app-emulation/wine-any/wine-any-2.11-r1.ebuild
new file mode 100644
index 0000000..61c306c
--- /dev/null
+++ b/app-emulation/wine-any/wine-any-2.11-r1.ebuild
@@ -0,0 +1,638 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+STAGING_P="wine-staging-${PV}"
+STAGING_DIR="${WORKDIR}/${STAGING_P}"
+D3D9_P="wine-d3d9-${PV}"
+D3D9_DIR="${WORKDIR}/wine-d3d9-patches-${D3D9_P}"
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, with optional external patchsets"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+if [[ ${PV} == "9999" ]] ; then
+ STAGING_EGIT_REPO_URI="https://github.com/wine-compholio/wine-staging.git"
+ D3D9_EGIT_REPO_URI="https://github.com/sarnex/wine-d3d9-patches.git"
+else
+ SRC_URI="${SRC_URI}
+ staging? ( https://github.com/wine-compholio/wine-staging/archive/v${PV}.tar.gz -> ${STAGING_P}.tar.gz )
+ d3d9? ( https://github.com/sarnex/wine-d3d9-patches/archive/${D3D9_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags d3d9 dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap pipelight +png prelink pulseaudio +realtime +run-exes s3tc samba scanner selinux +ssl staging test themes +threads +truetype udev +udisks v4l vaapi +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ pipelight? ( staging )
+ s3tc? ( staging )
+ test? ( abi_x86_32 )
+ themes? ( staging )
+ vaapi? ( staging )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXfixes[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ d3d9? (
+ media-libs/mesa[d3d9,egl,${MULTILIB_USEDEP}]
+ x11-libs/libX11[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libxcb[${MULTILIB_USEDEP}]
+ )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ staging? ( sys-apps/attr[${MULTILIB_USEDEP}] )
+ themes? (
+ dev-libs/glib:2[${MULTILIB_USEDEP}]
+ x11-libs/cairo[${MULTILIB_USEDEP}]
+ x11-libs/gtk+:3[${MULTILIB_USEDEP}]
+ )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ vaapi? ( x11-libs/libva[X,${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.0 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ s3tc? ( >=media-libs/libtxc_dxtn-1.0.1-r1[${MULTILIB_USEDEP}] )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ staging? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use staging || use d3d9; then
+ eerror "Because of the multi-repo nature of ${MY_PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use staging; then
+ local CURRENT_WINE_COMMIT=${EGIT_VERSION}
+
+ git-r3_fetch "${STAGING_EGIT_REPO_URI}" "${STAGING_COMMIT}"
+ git-r3_checkout "${STAGING_EGIT_REPO_URI}" "${STAGING_DIR}"
+
+ local COMPAT_WINE_COMMIT=$("${STAGING_DIR}/patches/patchinstall.sh" --upstream-commit) || die
+
+ if [[ "${CURRENT_WINE_COMMIT}" != "${COMPAT_WINE_COMMIT}" ]]; then
+ einfo "The current Staging patchset is not guaranteed to apply on this WINE commit."
+ einfo "If src_prepare fails, try emerging with the env var WINE_COMMIT."
+ einfo "Example: WINE_COMMIT=${COMPAT_WINE_COMMIT} emerge -1 wine"
+ fi
+ fi
+ if use d3d9; then
+ git-r3_fetch "${D3D9_EGIT_REPO_URI}" "${D3D9_COMMIT}"
+ git-r3_checkout "${D3D9_EGIT_REPO_URI}" "${D3D9_DIR}"
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ if use staging; then
+ ewarn "Applying the Wine-Staging patchset. Any bug reports to the"
+ ewarn "Wine bugzilla should explicitly state that staging was used."
+
+ local STAGING_EXCLUDE=""
+ STAGING_EXCLUDE="${STAGING_EXCLUDE} -W winhlp32-Flex_Workaround" # Avoid double patching https://bugs.winehq.org/show_bug.cgi?id=42132
+ use pipelight || STAGING_EXCLUDE="${STAGING_EXCLUDE} -W Pipelight"
+
+ # Launch wine-staging patcher in a subshell, using eapply as a backend, and gitapply.sh as a backend for binary patches
+ ebegin "Running Wine-Staging patch installer"
+ (
+ set -- DESTDIR="${S}" --backend=eapply --no-autoconf --all ${STAGING_EXCLUDE}
+ cd "${STAGING_DIR}/patches"
+ source "${STAGING_DIR}/patches/patchinstall.sh"
+ )
+ eend $? || die "Failed to apply Wine-Staging patches"
+ fi
+ if use d3d9; then
+ if use staging; then
+ PATCHES+=( "${D3D9_DIR}/staging-helper.patch" )
+ else
+ PATCHES+=( "${D3D9_DIR}/d3d9-helper.patch" )
+ fi
+ PATCHES+=( "${D3D9_DIR}/wine-d3d9.patch" )
+ fi
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with X xfixes)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use staging && myconf+=(
+ --with-xattr
+ $(use_with themes gtk3)
+ $(use_with vaapi va)
+ )
+ use d3d9 && myconf+=( $(use_with d3d9 d3d9-nine) )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine register --staging ${P} || die
+ fi
+ if use d3d9; then
+ eselect wine register --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine deregister --staging ${P} || die
+ fi
+ if use d3d9; then
+ eselect wine deregister --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-any/wine-any-2.12-r1.ebuild b/app-emulation/wine-any/wine-any-2.12-r1.ebuild
new file mode 100644
index 0000000..61c306c
--- /dev/null
+++ b/app-emulation/wine-any/wine-any-2.12-r1.ebuild
@@ -0,0 +1,638 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+STAGING_P="wine-staging-${PV}"
+STAGING_DIR="${WORKDIR}/${STAGING_P}"
+D3D9_P="wine-d3d9-${PV}"
+D3D9_DIR="${WORKDIR}/wine-d3d9-patches-${D3D9_P}"
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, with optional external patchsets"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+if [[ ${PV} == "9999" ]] ; then
+ STAGING_EGIT_REPO_URI="https://github.com/wine-compholio/wine-staging.git"
+ D3D9_EGIT_REPO_URI="https://github.com/sarnex/wine-d3d9-patches.git"
+else
+ SRC_URI="${SRC_URI}
+ staging? ( https://github.com/wine-compholio/wine-staging/archive/v${PV}.tar.gz -> ${STAGING_P}.tar.gz )
+ d3d9? ( https://github.com/sarnex/wine-d3d9-patches/archive/${D3D9_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags d3d9 dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap pipelight +png prelink pulseaudio +realtime +run-exes s3tc samba scanner selinux +ssl staging test themes +threads +truetype udev +udisks v4l vaapi +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ pipelight? ( staging )
+ s3tc? ( staging )
+ test? ( abi_x86_32 )
+ themes? ( staging )
+ vaapi? ( staging )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXfixes[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ d3d9? (
+ media-libs/mesa[d3d9,egl,${MULTILIB_USEDEP}]
+ x11-libs/libX11[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libxcb[${MULTILIB_USEDEP}]
+ )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ staging? ( sys-apps/attr[${MULTILIB_USEDEP}] )
+ themes? (
+ dev-libs/glib:2[${MULTILIB_USEDEP}]
+ x11-libs/cairo[${MULTILIB_USEDEP}]
+ x11-libs/gtk+:3[${MULTILIB_USEDEP}]
+ )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ vaapi? ( x11-libs/libva[X,${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.0 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ s3tc? ( >=media-libs/libtxc_dxtn-1.0.1-r1[${MULTILIB_USEDEP}] )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ staging? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use staging || use d3d9; then
+ eerror "Because of the multi-repo nature of ${MY_PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use staging; then
+ local CURRENT_WINE_COMMIT=${EGIT_VERSION}
+
+ git-r3_fetch "${STAGING_EGIT_REPO_URI}" "${STAGING_COMMIT}"
+ git-r3_checkout "${STAGING_EGIT_REPO_URI}" "${STAGING_DIR}"
+
+ local COMPAT_WINE_COMMIT=$("${STAGING_DIR}/patches/patchinstall.sh" --upstream-commit) || die
+
+ if [[ "${CURRENT_WINE_COMMIT}" != "${COMPAT_WINE_COMMIT}" ]]; then
+ einfo "The current Staging patchset is not guaranteed to apply on this WINE commit."
+ einfo "If src_prepare fails, try emerging with the env var WINE_COMMIT."
+ einfo "Example: WINE_COMMIT=${COMPAT_WINE_COMMIT} emerge -1 wine"
+ fi
+ fi
+ if use d3d9; then
+ git-r3_fetch "${D3D9_EGIT_REPO_URI}" "${D3D9_COMMIT}"
+ git-r3_checkout "${D3D9_EGIT_REPO_URI}" "${D3D9_DIR}"
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ if use staging; then
+ ewarn "Applying the Wine-Staging patchset. Any bug reports to the"
+ ewarn "Wine bugzilla should explicitly state that staging was used."
+
+ local STAGING_EXCLUDE=""
+ STAGING_EXCLUDE="${STAGING_EXCLUDE} -W winhlp32-Flex_Workaround" # Avoid double patching https://bugs.winehq.org/show_bug.cgi?id=42132
+ use pipelight || STAGING_EXCLUDE="${STAGING_EXCLUDE} -W Pipelight"
+
+ # Launch wine-staging patcher in a subshell, using eapply as a backend, and gitapply.sh as a backend for binary patches
+ ebegin "Running Wine-Staging patch installer"
+ (
+ set -- DESTDIR="${S}" --backend=eapply --no-autoconf --all ${STAGING_EXCLUDE}
+ cd "${STAGING_DIR}/patches"
+ source "${STAGING_DIR}/patches/patchinstall.sh"
+ )
+ eend $? || die "Failed to apply Wine-Staging patches"
+ fi
+ if use d3d9; then
+ if use staging; then
+ PATCHES+=( "${D3D9_DIR}/staging-helper.patch" )
+ else
+ PATCHES+=( "${D3D9_DIR}/d3d9-helper.patch" )
+ fi
+ PATCHES+=( "${D3D9_DIR}/wine-d3d9.patch" )
+ fi
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with X xfixes)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use staging && myconf+=(
+ --with-xattr
+ $(use_with themes gtk3)
+ $(use_with vaapi va)
+ )
+ use d3d9 && myconf+=( $(use_with d3d9 d3d9-nine) )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine register --staging ${P} || die
+ fi
+ if use d3d9; then
+ eselect wine register --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine deregister --staging ${P} || die
+ fi
+ if use d3d9; then
+ eselect wine deregister --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-any/wine-any-2.13-r1.ebuild b/app-emulation/wine-any/wine-any-2.13-r1.ebuild
new file mode 100644
index 0000000..61c306c
--- /dev/null
+++ b/app-emulation/wine-any/wine-any-2.13-r1.ebuild
@@ -0,0 +1,638 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+STAGING_P="wine-staging-${PV}"
+STAGING_DIR="${WORKDIR}/${STAGING_P}"
+D3D9_P="wine-d3d9-${PV}"
+D3D9_DIR="${WORKDIR}/wine-d3d9-patches-${D3D9_P}"
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, with optional external patchsets"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+if [[ ${PV} == "9999" ]] ; then
+ STAGING_EGIT_REPO_URI="https://github.com/wine-compholio/wine-staging.git"
+ D3D9_EGIT_REPO_URI="https://github.com/sarnex/wine-d3d9-patches.git"
+else
+ SRC_URI="${SRC_URI}
+ staging? ( https://github.com/wine-compholio/wine-staging/archive/v${PV}.tar.gz -> ${STAGING_P}.tar.gz )
+ d3d9? ( https://github.com/sarnex/wine-d3d9-patches/archive/${D3D9_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags d3d9 dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap pipelight +png prelink pulseaudio +realtime +run-exes s3tc samba scanner selinux +ssl staging test themes +threads +truetype udev +udisks v4l vaapi +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ pipelight? ( staging )
+ s3tc? ( staging )
+ test? ( abi_x86_32 )
+ themes? ( staging )
+ vaapi? ( staging )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXfixes[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ d3d9? (
+ media-libs/mesa[d3d9,egl,${MULTILIB_USEDEP}]
+ x11-libs/libX11[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libxcb[${MULTILIB_USEDEP}]
+ )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ staging? ( sys-apps/attr[${MULTILIB_USEDEP}] )
+ themes? (
+ dev-libs/glib:2[${MULTILIB_USEDEP}]
+ x11-libs/cairo[${MULTILIB_USEDEP}]
+ x11-libs/gtk+:3[${MULTILIB_USEDEP}]
+ )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ vaapi? ( x11-libs/libva[X,${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.0 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ s3tc? ( >=media-libs/libtxc_dxtn-1.0.1-r1[${MULTILIB_USEDEP}] )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ staging? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use staging || use d3d9; then
+ eerror "Because of the multi-repo nature of ${MY_PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use staging; then
+ local CURRENT_WINE_COMMIT=${EGIT_VERSION}
+
+ git-r3_fetch "${STAGING_EGIT_REPO_URI}" "${STAGING_COMMIT}"
+ git-r3_checkout "${STAGING_EGIT_REPO_URI}" "${STAGING_DIR}"
+
+ local COMPAT_WINE_COMMIT=$("${STAGING_DIR}/patches/patchinstall.sh" --upstream-commit) || die
+
+ if [[ "${CURRENT_WINE_COMMIT}" != "${COMPAT_WINE_COMMIT}" ]]; then
+ einfo "The current Staging patchset is not guaranteed to apply on this WINE commit."
+ einfo "If src_prepare fails, try emerging with the env var WINE_COMMIT."
+ einfo "Example: WINE_COMMIT=${COMPAT_WINE_COMMIT} emerge -1 wine"
+ fi
+ fi
+ if use d3d9; then
+ git-r3_fetch "${D3D9_EGIT_REPO_URI}" "${D3D9_COMMIT}"
+ git-r3_checkout "${D3D9_EGIT_REPO_URI}" "${D3D9_DIR}"
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ if use staging; then
+ ewarn "Applying the Wine-Staging patchset. Any bug reports to the"
+ ewarn "Wine bugzilla should explicitly state that staging was used."
+
+ local STAGING_EXCLUDE=""
+ STAGING_EXCLUDE="${STAGING_EXCLUDE} -W winhlp32-Flex_Workaround" # Avoid double patching https://bugs.winehq.org/show_bug.cgi?id=42132
+ use pipelight || STAGING_EXCLUDE="${STAGING_EXCLUDE} -W Pipelight"
+
+ # Launch wine-staging patcher in a subshell, using eapply as a backend, and gitapply.sh as a backend for binary patches
+ ebegin "Running Wine-Staging patch installer"
+ (
+ set -- DESTDIR="${S}" --backend=eapply --no-autoconf --all ${STAGING_EXCLUDE}
+ cd "${STAGING_DIR}/patches"
+ source "${STAGING_DIR}/patches/patchinstall.sh"
+ )
+ eend $? || die "Failed to apply Wine-Staging patches"
+ fi
+ if use d3d9; then
+ if use staging; then
+ PATCHES+=( "${D3D9_DIR}/staging-helper.patch" )
+ else
+ PATCHES+=( "${D3D9_DIR}/d3d9-helper.patch" )
+ fi
+ PATCHES+=( "${D3D9_DIR}/wine-d3d9.patch" )
+ fi
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with X xfixes)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use staging && myconf+=(
+ --with-xattr
+ $(use_with themes gtk3)
+ $(use_with vaapi va)
+ )
+ use d3d9 && myconf+=( $(use_with d3d9 d3d9-nine) )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine register --staging ${P} || die
+ fi
+ if use d3d9; then
+ eselect wine register --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine deregister --staging ${P} || die
+ fi
+ if use d3d9; then
+ eselect wine deregister --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-any/wine-any-2.14-r1.ebuild b/app-emulation/wine-any/wine-any-2.14-r1.ebuild
new file mode 100644
index 0000000..759f602
--- /dev/null
+++ b/app-emulation/wine-any/wine-any-2.14-r1.ebuild
@@ -0,0 +1,638 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+STAGING_P="wine-staging-${PV}"
+STAGING_DIR="${WORKDIR}/${STAGING_P}"
+D3D9_P="wine-d3d9-${PV}"
+D3D9_DIR="${WORKDIR}/wine-d3d9-patches-${D3D9_P}"
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, with optional external patchsets"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+if [[ ${PV} == "9999" ]] ; then
+ STAGING_EGIT_REPO_URI="https://github.com/wine-compholio/wine-staging.git"
+ D3D9_EGIT_REPO_URI="https://github.com/sarnex/wine-d3d9-patches.git"
+else
+ SRC_URI="${SRC_URI}
+ staging? ( https://github.com/wine-compholio/wine-staging/archive/v${PV}.tar.gz -> ${STAGING_P}.tar.gz )
+ d3d9? ( https://github.com/sarnex/wine-d3d9-patches/archive/${D3D9_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags d3d9 dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap pipelight +png prelink pulseaudio +realtime +run-exes s3tc samba scanner selinux +ssl staging test themes +threads +truetype udev +udisks v4l vaapi +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ pipelight? ( staging )
+ s3tc? ( staging )
+ test? ( abi_x86_32 )
+ themes? ( staging )
+ vaapi? ( staging )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXfixes[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ d3d9? (
+ media-libs/mesa[d3d9,egl,${MULTILIB_USEDEP}]
+ x11-libs/libX11[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libxcb[${MULTILIB_USEDEP}]
+ )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ staging? ( sys-apps/attr[${MULTILIB_USEDEP}] )
+ themes? (
+ dev-libs/glib:2[${MULTILIB_USEDEP}]
+ x11-libs/cairo[${MULTILIB_USEDEP}]
+ x11-libs/gtk+:3[${MULTILIB_USEDEP}]
+ )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ vaapi? ( x11-libs/libva[X,${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.1 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ s3tc? ( >=media-libs/libtxc_dxtn-1.0.1-r1[${MULTILIB_USEDEP}] )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ staging? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use staging || use d3d9; then
+ eerror "Because of the multi-repo nature of ${MY_PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use staging; then
+ local CURRENT_WINE_COMMIT=${EGIT_VERSION}
+
+ git-r3_fetch "${STAGING_EGIT_REPO_URI}" "${STAGING_COMMIT}"
+ git-r3_checkout "${STAGING_EGIT_REPO_URI}" "${STAGING_DIR}"
+
+ local COMPAT_WINE_COMMIT=$("${STAGING_DIR}/patches/patchinstall.sh" --upstream-commit) || die
+
+ if [[ "${CURRENT_WINE_COMMIT}" != "${COMPAT_WINE_COMMIT}" ]]; then
+ einfo "The current Staging patchset is not guaranteed to apply on this WINE commit."
+ einfo "If src_prepare fails, try emerging with the env var WINE_COMMIT."
+ einfo "Example: WINE_COMMIT=${COMPAT_WINE_COMMIT} emerge -1 wine"
+ fi
+ fi
+ if use d3d9; then
+ git-r3_fetch "${D3D9_EGIT_REPO_URI}" "${D3D9_COMMIT}"
+ git-r3_checkout "${D3D9_EGIT_REPO_URI}" "${D3D9_DIR}"
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ if use staging; then
+ ewarn "Applying the Wine-Staging patchset. Any bug reports to the"
+ ewarn "Wine bugzilla should explicitly state that staging was used."
+
+ local STAGING_EXCLUDE=""
+ STAGING_EXCLUDE="${STAGING_EXCLUDE} -W winhlp32-Flex_Workaround" # Avoid double patching https://bugs.winehq.org/show_bug.cgi?id=42132
+ use pipelight || STAGING_EXCLUDE="${STAGING_EXCLUDE} -W Pipelight"
+
+ # Launch wine-staging patcher in a subshell, using eapply as a backend, and gitapply.sh as a backend for binary patches
+ ebegin "Running Wine-Staging patch installer"
+ (
+ set -- DESTDIR="${S}" --backend=eapply --no-autoconf --all ${STAGING_EXCLUDE}
+ cd "${STAGING_DIR}/patches"
+ source "${STAGING_DIR}/patches/patchinstall.sh"
+ )
+ eend $? || die "Failed to apply Wine-Staging patches"
+ fi
+ if use d3d9; then
+ if use staging; then
+ PATCHES+=( "${D3D9_DIR}/staging-helper.patch" )
+ else
+ PATCHES+=( "${D3D9_DIR}/d3d9-helper.patch" )
+ fi
+ PATCHES+=( "${D3D9_DIR}/wine-d3d9.patch" )
+ fi
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with X xfixes)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use staging && myconf+=(
+ --with-xattr
+ $(use_with themes gtk3)
+ $(use_with vaapi va)
+ )
+ use d3d9 && myconf+=( $(use_with d3d9 d3d9-nine) )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine register --staging ${P} || die
+ fi
+ if use d3d9; then
+ eselect wine register --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine deregister --staging ${P} || die
+ fi
+ if use d3d9; then
+ eselect wine deregister --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-any/wine-any-2.15-r1.ebuild b/app-emulation/wine-any/wine-any-2.15-r1.ebuild
new file mode 100644
index 0000000..759f602
--- /dev/null
+++ b/app-emulation/wine-any/wine-any-2.15-r1.ebuild
@@ -0,0 +1,638 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+STAGING_P="wine-staging-${PV}"
+STAGING_DIR="${WORKDIR}/${STAGING_P}"
+D3D9_P="wine-d3d9-${PV}"
+D3D9_DIR="${WORKDIR}/wine-d3d9-patches-${D3D9_P}"
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, with optional external patchsets"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+if [[ ${PV} == "9999" ]] ; then
+ STAGING_EGIT_REPO_URI="https://github.com/wine-compholio/wine-staging.git"
+ D3D9_EGIT_REPO_URI="https://github.com/sarnex/wine-d3d9-patches.git"
+else
+ SRC_URI="${SRC_URI}
+ staging? ( https://github.com/wine-compholio/wine-staging/archive/v${PV}.tar.gz -> ${STAGING_P}.tar.gz )
+ d3d9? ( https://github.com/sarnex/wine-d3d9-patches/archive/${D3D9_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags d3d9 dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap pipelight +png prelink pulseaudio +realtime +run-exes s3tc samba scanner selinux +ssl staging test themes +threads +truetype udev +udisks v4l vaapi +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ pipelight? ( staging )
+ s3tc? ( staging )
+ test? ( abi_x86_32 )
+ themes? ( staging )
+ vaapi? ( staging )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXfixes[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ d3d9? (
+ media-libs/mesa[d3d9,egl,${MULTILIB_USEDEP}]
+ x11-libs/libX11[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libxcb[${MULTILIB_USEDEP}]
+ )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ staging? ( sys-apps/attr[${MULTILIB_USEDEP}] )
+ themes? (
+ dev-libs/glib:2[${MULTILIB_USEDEP}]
+ x11-libs/cairo[${MULTILIB_USEDEP}]
+ x11-libs/gtk+:3[${MULTILIB_USEDEP}]
+ )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ vaapi? ( x11-libs/libva[X,${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.1 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ s3tc? ( >=media-libs/libtxc_dxtn-1.0.1-r1[${MULTILIB_USEDEP}] )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ staging? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use staging || use d3d9; then
+ eerror "Because of the multi-repo nature of ${MY_PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use staging; then
+ local CURRENT_WINE_COMMIT=${EGIT_VERSION}
+
+ git-r3_fetch "${STAGING_EGIT_REPO_URI}" "${STAGING_COMMIT}"
+ git-r3_checkout "${STAGING_EGIT_REPO_URI}" "${STAGING_DIR}"
+
+ local COMPAT_WINE_COMMIT=$("${STAGING_DIR}/patches/patchinstall.sh" --upstream-commit) || die
+
+ if [[ "${CURRENT_WINE_COMMIT}" != "${COMPAT_WINE_COMMIT}" ]]; then
+ einfo "The current Staging patchset is not guaranteed to apply on this WINE commit."
+ einfo "If src_prepare fails, try emerging with the env var WINE_COMMIT."
+ einfo "Example: WINE_COMMIT=${COMPAT_WINE_COMMIT} emerge -1 wine"
+ fi
+ fi
+ if use d3d9; then
+ git-r3_fetch "${D3D9_EGIT_REPO_URI}" "${D3D9_COMMIT}"
+ git-r3_checkout "${D3D9_EGIT_REPO_URI}" "${D3D9_DIR}"
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ if use staging; then
+ ewarn "Applying the Wine-Staging patchset. Any bug reports to the"
+ ewarn "Wine bugzilla should explicitly state that staging was used."
+
+ local STAGING_EXCLUDE=""
+ STAGING_EXCLUDE="${STAGING_EXCLUDE} -W winhlp32-Flex_Workaround" # Avoid double patching https://bugs.winehq.org/show_bug.cgi?id=42132
+ use pipelight || STAGING_EXCLUDE="${STAGING_EXCLUDE} -W Pipelight"
+
+ # Launch wine-staging patcher in a subshell, using eapply as a backend, and gitapply.sh as a backend for binary patches
+ ebegin "Running Wine-Staging patch installer"
+ (
+ set -- DESTDIR="${S}" --backend=eapply --no-autoconf --all ${STAGING_EXCLUDE}
+ cd "${STAGING_DIR}/patches"
+ source "${STAGING_DIR}/patches/patchinstall.sh"
+ )
+ eend $? || die "Failed to apply Wine-Staging patches"
+ fi
+ if use d3d9; then
+ if use staging; then
+ PATCHES+=( "${D3D9_DIR}/staging-helper.patch" )
+ else
+ PATCHES+=( "${D3D9_DIR}/d3d9-helper.patch" )
+ fi
+ PATCHES+=( "${D3D9_DIR}/wine-d3d9.patch" )
+ fi
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with X xfixes)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use staging && myconf+=(
+ --with-xattr
+ $(use_with themes gtk3)
+ $(use_with vaapi va)
+ )
+ use d3d9 && myconf+=( $(use_with d3d9 d3d9-nine) )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine register --staging ${P} || die
+ fi
+ if use d3d9; then
+ eselect wine register --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine deregister --staging ${P} || die
+ fi
+ if use d3d9; then
+ eselect wine deregister --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-any/wine-any-2.16-r1.ebuild b/app-emulation/wine-any/wine-any-2.16-r1.ebuild
new file mode 100644
index 0000000..759f602
--- /dev/null
+++ b/app-emulation/wine-any/wine-any-2.16-r1.ebuild
@@ -0,0 +1,638 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+STAGING_P="wine-staging-${PV}"
+STAGING_DIR="${WORKDIR}/${STAGING_P}"
+D3D9_P="wine-d3d9-${PV}"
+D3D9_DIR="${WORKDIR}/wine-d3d9-patches-${D3D9_P}"
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, with optional external patchsets"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+if [[ ${PV} == "9999" ]] ; then
+ STAGING_EGIT_REPO_URI="https://github.com/wine-compholio/wine-staging.git"
+ D3D9_EGIT_REPO_URI="https://github.com/sarnex/wine-d3d9-patches.git"
+else
+ SRC_URI="${SRC_URI}
+ staging? ( https://github.com/wine-compholio/wine-staging/archive/v${PV}.tar.gz -> ${STAGING_P}.tar.gz )
+ d3d9? ( https://github.com/sarnex/wine-d3d9-patches/archive/${D3D9_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags d3d9 dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap pipelight +png prelink pulseaudio +realtime +run-exes s3tc samba scanner selinux +ssl staging test themes +threads +truetype udev +udisks v4l vaapi +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ pipelight? ( staging )
+ s3tc? ( staging )
+ test? ( abi_x86_32 )
+ themes? ( staging )
+ vaapi? ( staging )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXfixes[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ d3d9? (
+ media-libs/mesa[d3d9,egl,${MULTILIB_USEDEP}]
+ x11-libs/libX11[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libxcb[${MULTILIB_USEDEP}]
+ )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ staging? ( sys-apps/attr[${MULTILIB_USEDEP}] )
+ themes? (
+ dev-libs/glib:2[${MULTILIB_USEDEP}]
+ x11-libs/cairo[${MULTILIB_USEDEP}]
+ x11-libs/gtk+:3[${MULTILIB_USEDEP}]
+ )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ vaapi? ( x11-libs/libva[X,${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.1 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ s3tc? ( >=media-libs/libtxc_dxtn-1.0.1-r1[${MULTILIB_USEDEP}] )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ staging? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use staging || use d3d9; then
+ eerror "Because of the multi-repo nature of ${MY_PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use staging; then
+ local CURRENT_WINE_COMMIT=${EGIT_VERSION}
+
+ git-r3_fetch "${STAGING_EGIT_REPO_URI}" "${STAGING_COMMIT}"
+ git-r3_checkout "${STAGING_EGIT_REPO_URI}" "${STAGING_DIR}"
+
+ local COMPAT_WINE_COMMIT=$("${STAGING_DIR}/patches/patchinstall.sh" --upstream-commit) || die
+
+ if [[ "${CURRENT_WINE_COMMIT}" != "${COMPAT_WINE_COMMIT}" ]]; then
+ einfo "The current Staging patchset is not guaranteed to apply on this WINE commit."
+ einfo "If src_prepare fails, try emerging with the env var WINE_COMMIT."
+ einfo "Example: WINE_COMMIT=${COMPAT_WINE_COMMIT} emerge -1 wine"
+ fi
+ fi
+ if use d3d9; then
+ git-r3_fetch "${D3D9_EGIT_REPO_URI}" "${D3D9_COMMIT}"
+ git-r3_checkout "${D3D9_EGIT_REPO_URI}" "${D3D9_DIR}"
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ if use staging; then
+ ewarn "Applying the Wine-Staging patchset. Any bug reports to the"
+ ewarn "Wine bugzilla should explicitly state that staging was used."
+
+ local STAGING_EXCLUDE=""
+ STAGING_EXCLUDE="${STAGING_EXCLUDE} -W winhlp32-Flex_Workaround" # Avoid double patching https://bugs.winehq.org/show_bug.cgi?id=42132
+ use pipelight || STAGING_EXCLUDE="${STAGING_EXCLUDE} -W Pipelight"
+
+ # Launch wine-staging patcher in a subshell, using eapply as a backend, and gitapply.sh as a backend for binary patches
+ ebegin "Running Wine-Staging patch installer"
+ (
+ set -- DESTDIR="${S}" --backend=eapply --no-autoconf --all ${STAGING_EXCLUDE}
+ cd "${STAGING_DIR}/patches"
+ source "${STAGING_DIR}/patches/patchinstall.sh"
+ )
+ eend $? || die "Failed to apply Wine-Staging patches"
+ fi
+ if use d3d9; then
+ if use staging; then
+ PATCHES+=( "${D3D9_DIR}/staging-helper.patch" )
+ else
+ PATCHES+=( "${D3D9_DIR}/d3d9-helper.patch" )
+ fi
+ PATCHES+=( "${D3D9_DIR}/wine-d3d9.patch" )
+ fi
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with X xfixes)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use staging && myconf+=(
+ --with-xattr
+ $(use_with themes gtk3)
+ $(use_with vaapi va)
+ )
+ use d3d9 && myconf+=( $(use_with d3d9 d3d9-nine) )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine register --staging ${P} || die
+ fi
+ if use d3d9; then
+ eselect wine register --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine deregister --staging ${P} || die
+ fi
+ if use d3d9; then
+ eselect wine deregister --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-any/wine-any-2.17-r1.ebuild b/app-emulation/wine-any/wine-any-2.17-r1.ebuild
new file mode 100644
index 0000000..759f602
--- /dev/null
+++ b/app-emulation/wine-any/wine-any-2.17-r1.ebuild
@@ -0,0 +1,638 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+STAGING_P="wine-staging-${PV}"
+STAGING_DIR="${WORKDIR}/${STAGING_P}"
+D3D9_P="wine-d3d9-${PV}"
+D3D9_DIR="${WORKDIR}/wine-d3d9-patches-${D3D9_P}"
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, with optional external patchsets"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+if [[ ${PV} == "9999" ]] ; then
+ STAGING_EGIT_REPO_URI="https://github.com/wine-compholio/wine-staging.git"
+ D3D9_EGIT_REPO_URI="https://github.com/sarnex/wine-d3d9-patches.git"
+else
+ SRC_URI="${SRC_URI}
+ staging? ( https://github.com/wine-compholio/wine-staging/archive/v${PV}.tar.gz -> ${STAGING_P}.tar.gz )
+ d3d9? ( https://github.com/sarnex/wine-d3d9-patches/archive/${D3D9_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags d3d9 dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap pipelight +png prelink pulseaudio +realtime +run-exes s3tc samba scanner selinux +ssl staging test themes +threads +truetype udev +udisks v4l vaapi +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ pipelight? ( staging )
+ s3tc? ( staging )
+ test? ( abi_x86_32 )
+ themes? ( staging )
+ vaapi? ( staging )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXfixes[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ d3d9? (
+ media-libs/mesa[d3d9,egl,${MULTILIB_USEDEP}]
+ x11-libs/libX11[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libxcb[${MULTILIB_USEDEP}]
+ )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ staging? ( sys-apps/attr[${MULTILIB_USEDEP}] )
+ themes? (
+ dev-libs/glib:2[${MULTILIB_USEDEP}]
+ x11-libs/cairo[${MULTILIB_USEDEP}]
+ x11-libs/gtk+:3[${MULTILIB_USEDEP}]
+ )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ vaapi? ( x11-libs/libva[X,${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.1 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ s3tc? ( >=media-libs/libtxc_dxtn-1.0.1-r1[${MULTILIB_USEDEP}] )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ staging? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use staging || use d3d9; then
+ eerror "Because of the multi-repo nature of ${MY_PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use staging; then
+ local CURRENT_WINE_COMMIT=${EGIT_VERSION}
+
+ git-r3_fetch "${STAGING_EGIT_REPO_URI}" "${STAGING_COMMIT}"
+ git-r3_checkout "${STAGING_EGIT_REPO_URI}" "${STAGING_DIR}"
+
+ local COMPAT_WINE_COMMIT=$("${STAGING_DIR}/patches/patchinstall.sh" --upstream-commit) || die
+
+ if [[ "${CURRENT_WINE_COMMIT}" != "${COMPAT_WINE_COMMIT}" ]]; then
+ einfo "The current Staging patchset is not guaranteed to apply on this WINE commit."
+ einfo "If src_prepare fails, try emerging with the env var WINE_COMMIT."
+ einfo "Example: WINE_COMMIT=${COMPAT_WINE_COMMIT} emerge -1 wine"
+ fi
+ fi
+ if use d3d9; then
+ git-r3_fetch "${D3D9_EGIT_REPO_URI}" "${D3D9_COMMIT}"
+ git-r3_checkout "${D3D9_EGIT_REPO_URI}" "${D3D9_DIR}"
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ if use staging; then
+ ewarn "Applying the Wine-Staging patchset. Any bug reports to the"
+ ewarn "Wine bugzilla should explicitly state that staging was used."
+
+ local STAGING_EXCLUDE=""
+ STAGING_EXCLUDE="${STAGING_EXCLUDE} -W winhlp32-Flex_Workaround" # Avoid double patching https://bugs.winehq.org/show_bug.cgi?id=42132
+ use pipelight || STAGING_EXCLUDE="${STAGING_EXCLUDE} -W Pipelight"
+
+ # Launch wine-staging patcher in a subshell, using eapply as a backend, and gitapply.sh as a backend for binary patches
+ ebegin "Running Wine-Staging patch installer"
+ (
+ set -- DESTDIR="${S}" --backend=eapply --no-autoconf --all ${STAGING_EXCLUDE}
+ cd "${STAGING_DIR}/patches"
+ source "${STAGING_DIR}/patches/patchinstall.sh"
+ )
+ eend $? || die "Failed to apply Wine-Staging patches"
+ fi
+ if use d3d9; then
+ if use staging; then
+ PATCHES+=( "${D3D9_DIR}/staging-helper.patch" )
+ else
+ PATCHES+=( "${D3D9_DIR}/d3d9-helper.patch" )
+ fi
+ PATCHES+=( "${D3D9_DIR}/wine-d3d9.patch" )
+ fi
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with X xfixes)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use staging && myconf+=(
+ --with-xattr
+ $(use_with themes gtk3)
+ $(use_with vaapi va)
+ )
+ use d3d9 && myconf+=( $(use_with d3d9 d3d9-nine) )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine register --staging ${P} || die
+ fi
+ if use d3d9; then
+ eselect wine register --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine deregister --staging ${P} || die
+ fi
+ if use d3d9; then
+ eselect wine deregister --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-any/wine-any-2.18.ebuild b/app-emulation/wine-any/wine-any-2.18.ebuild
new file mode 100644
index 0000000..5fb96a2
--- /dev/null
+++ b/app-emulation/wine-any/wine-any-2.18.ebuild
@@ -0,0 +1,634 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+STAGING_P="wine-staging-${PV}"
+STAGING_DIR="${WORKDIR}/${STAGING_P}"
+D3D9_P="wine-d3d9-${PV}"
+D3D9_DIR="${WORKDIR}/wine-d3d9-patches-${D3D9_P}"
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, with optional external patchsets"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+if [[ ${PV} == "9999" ]] ; then
+ STAGING_EGIT_REPO_URI="https://github.com/wine-compholio/wine-staging.git"
+ D3D9_EGIT_REPO_URI="https://github.com/sarnex/wine-d3d9-patches.git"
+else
+ SRC_URI="${SRC_URI}
+ staging? ( https://github.com/wine-compholio/wine-staging/archive/v${PV}.tar.gz -> ${STAGING_P}.tar.gz )
+ d3d9? ( https://github.com/sarnex/wine-d3d9-patches/archive/${D3D9_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags d3d9 dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap pipelight +png prelink pulseaudio +realtime +run-exes s3tc samba scanner selinux +ssl staging test themes +threads +truetype udev +udisks v4l vaapi +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ pipelight? ( staging )
+ s3tc? ( staging )
+ test? ( abi_x86_32 )
+ themes? ( staging )
+ vaapi? ( staging )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXfixes[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ d3d9? (
+ media-libs/mesa[d3d9,egl,${MULTILIB_USEDEP}]
+ x11-libs/libX11[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libxcb[${MULTILIB_USEDEP}]
+ )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ staging? ( sys-apps/attr[${MULTILIB_USEDEP}] )
+ themes? (
+ dev-libs/glib:2[${MULTILIB_USEDEP}]
+ x11-libs/cairo[${MULTILIB_USEDEP}]
+ x11-libs/gtk+:3[${MULTILIB_USEDEP}]
+ )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ vaapi? ( x11-libs/libva[X,${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.1 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ s3tc? ( >=media-libs/libtxc_dxtn-1.0.1-r1[${MULTILIB_USEDEP}] )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ staging? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+)
+PATCHES_BIN=()
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use staging || use d3d9; then
+ eerror "Because of the multi-repo nature of ${MY_PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use staging; then
+ local CURRENT_WINE_COMMIT=${EGIT_VERSION}
+
+ git-r3_fetch "${STAGING_EGIT_REPO_URI}" "${STAGING_COMMIT}"
+ git-r3_checkout "${STAGING_EGIT_REPO_URI}" "${STAGING_DIR}"
+
+ local COMPAT_WINE_COMMIT=$("${STAGING_DIR}/patches/patchinstall.sh" --upstream-commit) || die
+
+ if [[ "${CURRENT_WINE_COMMIT}" != "${COMPAT_WINE_COMMIT}" ]]; then
+ einfo "The current Staging patchset is not guaranteed to apply on this WINE commit."
+ einfo "If src_prepare fails, try emerging with the env var WINE_COMMIT."
+ einfo "Example: WINE_COMMIT=${COMPAT_WINE_COMMIT} emerge -1 wine"
+ fi
+ fi
+ if use d3d9; then
+ git-r3_fetch "${D3D9_EGIT_REPO_URI}" "${D3D9_COMMIT}"
+ git-r3_checkout "${D3D9_EGIT_REPO_URI}" "${D3D9_DIR}"
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ if use staging; then
+ ewarn "Applying the Wine-Staging patchset. Any bug reports to the"
+ ewarn "Wine bugzilla should explicitly state that staging was used."
+
+ local STAGING_EXCLUDE=""
+ STAGING_EXCLUDE="${STAGING_EXCLUDE} -W winhlp32-Flex_Workaround" # Avoid double patching https://bugs.winehq.org/show_bug.cgi?id=42132
+ use pipelight || STAGING_EXCLUDE="${STAGING_EXCLUDE} -W Pipelight"
+
+ # Launch wine-staging patcher in a subshell, using eapply as a backend, and gitapply.sh as a backend for binary patches
+ ebegin "Running Wine-Staging patch installer"
+ (
+ set -- DESTDIR="${S}" --backend=eapply --no-autoconf --all ${STAGING_EXCLUDE}
+ cd "${STAGING_DIR}/patches"
+ source "${STAGING_DIR}/patches/patchinstall.sh"
+ )
+ eend $? || die "Failed to apply Wine-Staging patches"
+ fi
+ if use d3d9; then
+ if use staging; then
+ PATCHES+=( "${D3D9_DIR}/staging-helper.patch" )
+ else
+ PATCHES+=( "${D3D9_DIR}/d3d9-helper.patch" )
+ fi
+ PATCHES+=( "${D3D9_DIR}/wine-d3d9.patch" )
+ fi
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with X xfixes)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use staging && myconf+=(
+ --with-xattr
+ $(use_with themes gtk3)
+ $(use_with vaapi va)
+ )
+ use d3d9 && myconf+=( $(use_with d3d9 d3d9-nine) )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine register --staging ${P} || die
+ fi
+ if use d3d9; then
+ eselect wine register --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine deregister --staging ${P} || die
+ fi
+ if use d3d9; then
+ eselect wine deregister --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-any/wine-any-2.19.ebuild b/app-emulation/wine-any/wine-any-2.19.ebuild
new file mode 100644
index 0000000..5fb96a2
--- /dev/null
+++ b/app-emulation/wine-any/wine-any-2.19.ebuild
@@ -0,0 +1,634 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+STAGING_P="wine-staging-${PV}"
+STAGING_DIR="${WORKDIR}/${STAGING_P}"
+D3D9_P="wine-d3d9-${PV}"
+D3D9_DIR="${WORKDIR}/wine-d3d9-patches-${D3D9_P}"
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, with optional external patchsets"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+if [[ ${PV} == "9999" ]] ; then
+ STAGING_EGIT_REPO_URI="https://github.com/wine-compholio/wine-staging.git"
+ D3D9_EGIT_REPO_URI="https://github.com/sarnex/wine-d3d9-patches.git"
+else
+ SRC_URI="${SRC_URI}
+ staging? ( https://github.com/wine-compholio/wine-staging/archive/v${PV}.tar.gz -> ${STAGING_P}.tar.gz )
+ d3d9? ( https://github.com/sarnex/wine-d3d9-patches/archive/${D3D9_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags d3d9 dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap pipelight +png prelink pulseaudio +realtime +run-exes s3tc samba scanner selinux +ssl staging test themes +threads +truetype udev +udisks v4l vaapi +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ pipelight? ( staging )
+ s3tc? ( staging )
+ test? ( abi_x86_32 )
+ themes? ( staging )
+ vaapi? ( staging )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXfixes[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ d3d9? (
+ media-libs/mesa[d3d9,egl,${MULTILIB_USEDEP}]
+ x11-libs/libX11[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libxcb[${MULTILIB_USEDEP}]
+ )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ staging? ( sys-apps/attr[${MULTILIB_USEDEP}] )
+ themes? (
+ dev-libs/glib:2[${MULTILIB_USEDEP}]
+ x11-libs/cairo[${MULTILIB_USEDEP}]
+ x11-libs/gtk+:3[${MULTILIB_USEDEP}]
+ )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ vaapi? ( x11-libs/libva[X,${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.1 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ s3tc? ( >=media-libs/libtxc_dxtn-1.0.1-r1[${MULTILIB_USEDEP}] )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ staging? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+)
+PATCHES_BIN=()
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use staging || use d3d9; then
+ eerror "Because of the multi-repo nature of ${MY_PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use staging; then
+ local CURRENT_WINE_COMMIT=${EGIT_VERSION}
+
+ git-r3_fetch "${STAGING_EGIT_REPO_URI}" "${STAGING_COMMIT}"
+ git-r3_checkout "${STAGING_EGIT_REPO_URI}" "${STAGING_DIR}"
+
+ local COMPAT_WINE_COMMIT=$("${STAGING_DIR}/patches/patchinstall.sh" --upstream-commit) || die
+
+ if [[ "${CURRENT_WINE_COMMIT}" != "${COMPAT_WINE_COMMIT}" ]]; then
+ einfo "The current Staging patchset is not guaranteed to apply on this WINE commit."
+ einfo "If src_prepare fails, try emerging with the env var WINE_COMMIT."
+ einfo "Example: WINE_COMMIT=${COMPAT_WINE_COMMIT} emerge -1 wine"
+ fi
+ fi
+ if use d3d9; then
+ git-r3_fetch "${D3D9_EGIT_REPO_URI}" "${D3D9_COMMIT}"
+ git-r3_checkout "${D3D9_EGIT_REPO_URI}" "${D3D9_DIR}"
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ if use staging; then
+ ewarn "Applying the Wine-Staging patchset. Any bug reports to the"
+ ewarn "Wine bugzilla should explicitly state that staging was used."
+
+ local STAGING_EXCLUDE=""
+ STAGING_EXCLUDE="${STAGING_EXCLUDE} -W winhlp32-Flex_Workaround" # Avoid double patching https://bugs.winehq.org/show_bug.cgi?id=42132
+ use pipelight || STAGING_EXCLUDE="${STAGING_EXCLUDE} -W Pipelight"
+
+ # Launch wine-staging patcher in a subshell, using eapply as a backend, and gitapply.sh as a backend for binary patches
+ ebegin "Running Wine-Staging patch installer"
+ (
+ set -- DESTDIR="${S}" --backend=eapply --no-autoconf --all ${STAGING_EXCLUDE}
+ cd "${STAGING_DIR}/patches"
+ source "${STAGING_DIR}/patches/patchinstall.sh"
+ )
+ eend $? || die "Failed to apply Wine-Staging patches"
+ fi
+ if use d3d9; then
+ if use staging; then
+ PATCHES+=( "${D3D9_DIR}/staging-helper.patch" )
+ else
+ PATCHES+=( "${D3D9_DIR}/d3d9-helper.patch" )
+ fi
+ PATCHES+=( "${D3D9_DIR}/wine-d3d9.patch" )
+ fi
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with X xfixes)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use staging && myconf+=(
+ --with-xattr
+ $(use_with themes gtk3)
+ $(use_with vaapi va)
+ )
+ use d3d9 && myconf+=( $(use_with d3d9 d3d9-nine) )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine register --staging ${P} || die
+ fi
+ if use d3d9; then
+ eselect wine register --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine deregister --staging ${P} || die
+ fi
+ if use d3d9; then
+ eselect wine deregister --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-any/wine-any-2.2-r1.ebuild b/app-emulation/wine-any/wine-any-2.2-r1.ebuild
new file mode 100644
index 0000000..046c4b3
--- /dev/null
+++ b/app-emulation/wine-any/wine-any-2.2-r1.ebuild
@@ -0,0 +1,636 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+STAGING_P="wine-staging-${PV}"
+STAGING_DIR="${WORKDIR}/${STAGING_P}"
+D3D9_P="wine-d3d9-${PV}"
+D3D9_DIR="${WORKDIR}/wine-d3d9-patches-${D3D9_P}"
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, with optional external patchsets"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+if [[ ${PV} == "9999" ]] ; then
+ STAGING_EGIT_REPO_URI="https://github.com/wine-compholio/wine-staging.git"
+ D3D9_EGIT_REPO_URI="https://github.com/sarnex/wine-d3d9-patches.git"
+else
+ SRC_URI="${SRC_URI}
+ staging? ( https://github.com/wine-compholio/wine-staging/archive/v${PV}.tar.gz -> ${STAGING_P}.tar.gz )
+ d3d9? ( https://github.com/sarnex/wine-d3d9-patches/archive/${D3D9_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags d3d9 dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap pipelight +png prelink pulseaudio +realtime +run-exes s3tc samba scanner selinux +ssl staging test themes +threads +truetype udev +udisks v4l vaapi +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ pipelight? ( staging )
+ s3tc? ( staging )
+ test? ( abi_x86_32 )
+ themes? ( staging )
+ vaapi? ( staging )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ d3d9? (
+ media-libs/mesa[d3d9,egl,${MULTILIB_USEDEP}]
+ x11-libs/libX11[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libxcb[${MULTILIB_USEDEP}]
+ )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ staging? ( sys-apps/attr[${MULTILIB_USEDEP}] )
+ themes? (
+ dev-libs/glib:2[${MULTILIB_USEDEP}]
+ x11-libs/cairo[${MULTILIB_USEDEP}]
+ x11-libs/gtk+:3[${MULTILIB_USEDEP}]
+ )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ vaapi? ( x11-libs/libva[X,${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.6.4 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ s3tc? ( >=media-libs/libtxc_dxtn-1.0.1-r1[${MULTILIB_USEDEP}] )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ staging? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use staging || use d3d9; then
+ eerror "Because of the multi-repo nature of ${MY_PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use staging; then
+ local CURRENT_WINE_COMMIT=${EGIT_VERSION}
+
+ git-r3_fetch "${STAGING_EGIT_REPO_URI}" "${STAGING_COMMIT}"
+ git-r3_checkout "${STAGING_EGIT_REPO_URI}" "${STAGING_DIR}"
+
+ local COMPAT_WINE_COMMIT=$("${STAGING_DIR}/patches/patchinstall.sh" --upstream-commit) || die
+
+ if [[ "${CURRENT_WINE_COMMIT}" != "${COMPAT_WINE_COMMIT}" ]]; then
+ einfo "The current Staging patchset is not guaranteed to apply on this WINE commit."
+ einfo "If src_prepare fails, try emerging with the env var WINE_COMMIT."
+ einfo "Example: WINE_COMMIT=${COMPAT_WINE_COMMIT} emerge -1 wine"
+ fi
+ fi
+ if use d3d9; then
+ git-r3_fetch "${D3D9_EGIT_REPO_URI}" "${D3D9_COMMIT}"
+ git-r3_checkout "${D3D9_EGIT_REPO_URI}" "${D3D9_DIR}"
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ if use staging; then
+ ewarn "Applying the Wine-Staging patchset. Any bug reports to the"
+ ewarn "Wine bugzilla should explicitly state that staging was used."
+
+ local STAGING_EXCLUDE=""
+ STAGING_EXCLUDE="${STAGING_EXCLUDE} -W winhlp32-Flex_Workaround" # Avoid double patching https://bugs.winehq.org/show_bug.cgi?id=42132
+ use pipelight || STAGING_EXCLUDE="${STAGING_EXCLUDE} -W Pipelight"
+
+ # Launch wine-staging patcher in a subshell, using eapply as a backend, and gitapply.sh as a backend for binary patches
+ ebegin "Running Wine-Staging patch installer"
+ (
+ set -- DESTDIR="${S}" --backend=eapply --no-autoconf --all ${STAGING_EXCLUDE}
+ cd "${STAGING_DIR}/patches"
+ source "${STAGING_DIR}/patches/patchinstall.sh"
+ )
+ eend $? || die "Failed to apply Wine-Staging patches"
+ fi
+ if use d3d9; then
+ if use staging; then
+ PATCHES+=( "${D3D9_DIR}/staging-helper.patch" )
+ else
+ PATCHES+=( "${D3D9_DIR}/d3d9-helper.patch" )
+ fi
+ PATCHES+=( "${D3D9_DIR}/wine-d3d9.patch" )
+ fi
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use staging && myconf+=(
+ --with-xattr
+ $(use_with themes gtk3)
+ $(use_with vaapi va)
+ )
+ use d3d9 && myconf+=( $(use_with d3d9 d3d9-nine) )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine register --staging ${P} || die
+ fi
+ if use d3d9; then
+ eselect wine register --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine deregister --staging ${P} || die
+ fi
+ if use d3d9; then
+ eselect wine deregister --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-any/wine-any-2.3-r1.ebuild b/app-emulation/wine-any/wine-any-2.3-r1.ebuild
new file mode 100644
index 0000000..046c4b3
--- /dev/null
+++ b/app-emulation/wine-any/wine-any-2.3-r1.ebuild
@@ -0,0 +1,636 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+STAGING_P="wine-staging-${PV}"
+STAGING_DIR="${WORKDIR}/${STAGING_P}"
+D3D9_P="wine-d3d9-${PV}"
+D3D9_DIR="${WORKDIR}/wine-d3d9-patches-${D3D9_P}"
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, with optional external patchsets"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+if [[ ${PV} == "9999" ]] ; then
+ STAGING_EGIT_REPO_URI="https://github.com/wine-compholio/wine-staging.git"
+ D3D9_EGIT_REPO_URI="https://github.com/sarnex/wine-d3d9-patches.git"
+else
+ SRC_URI="${SRC_URI}
+ staging? ( https://github.com/wine-compholio/wine-staging/archive/v${PV}.tar.gz -> ${STAGING_P}.tar.gz )
+ d3d9? ( https://github.com/sarnex/wine-d3d9-patches/archive/${D3D9_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags d3d9 dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap pipelight +png prelink pulseaudio +realtime +run-exes s3tc samba scanner selinux +ssl staging test themes +threads +truetype udev +udisks v4l vaapi +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ pipelight? ( staging )
+ s3tc? ( staging )
+ test? ( abi_x86_32 )
+ themes? ( staging )
+ vaapi? ( staging )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ d3d9? (
+ media-libs/mesa[d3d9,egl,${MULTILIB_USEDEP}]
+ x11-libs/libX11[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libxcb[${MULTILIB_USEDEP}]
+ )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ staging? ( sys-apps/attr[${MULTILIB_USEDEP}] )
+ themes? (
+ dev-libs/glib:2[${MULTILIB_USEDEP}]
+ x11-libs/cairo[${MULTILIB_USEDEP}]
+ x11-libs/gtk+:3[${MULTILIB_USEDEP}]
+ )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ vaapi? ( x11-libs/libva[X,${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.6.4 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ s3tc? ( >=media-libs/libtxc_dxtn-1.0.1-r1[${MULTILIB_USEDEP}] )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ staging? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use staging || use d3d9; then
+ eerror "Because of the multi-repo nature of ${MY_PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use staging; then
+ local CURRENT_WINE_COMMIT=${EGIT_VERSION}
+
+ git-r3_fetch "${STAGING_EGIT_REPO_URI}" "${STAGING_COMMIT}"
+ git-r3_checkout "${STAGING_EGIT_REPO_URI}" "${STAGING_DIR}"
+
+ local COMPAT_WINE_COMMIT=$("${STAGING_DIR}/patches/patchinstall.sh" --upstream-commit) || die
+
+ if [[ "${CURRENT_WINE_COMMIT}" != "${COMPAT_WINE_COMMIT}" ]]; then
+ einfo "The current Staging patchset is not guaranteed to apply on this WINE commit."
+ einfo "If src_prepare fails, try emerging with the env var WINE_COMMIT."
+ einfo "Example: WINE_COMMIT=${COMPAT_WINE_COMMIT} emerge -1 wine"
+ fi
+ fi
+ if use d3d9; then
+ git-r3_fetch "${D3D9_EGIT_REPO_URI}" "${D3D9_COMMIT}"
+ git-r3_checkout "${D3D9_EGIT_REPO_URI}" "${D3D9_DIR}"
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ if use staging; then
+ ewarn "Applying the Wine-Staging patchset. Any bug reports to the"
+ ewarn "Wine bugzilla should explicitly state that staging was used."
+
+ local STAGING_EXCLUDE=""
+ STAGING_EXCLUDE="${STAGING_EXCLUDE} -W winhlp32-Flex_Workaround" # Avoid double patching https://bugs.winehq.org/show_bug.cgi?id=42132
+ use pipelight || STAGING_EXCLUDE="${STAGING_EXCLUDE} -W Pipelight"
+
+ # Launch wine-staging patcher in a subshell, using eapply as a backend, and gitapply.sh as a backend for binary patches
+ ebegin "Running Wine-Staging patch installer"
+ (
+ set -- DESTDIR="${S}" --backend=eapply --no-autoconf --all ${STAGING_EXCLUDE}
+ cd "${STAGING_DIR}/patches"
+ source "${STAGING_DIR}/patches/patchinstall.sh"
+ )
+ eend $? || die "Failed to apply Wine-Staging patches"
+ fi
+ if use d3d9; then
+ if use staging; then
+ PATCHES+=( "${D3D9_DIR}/staging-helper.patch" )
+ else
+ PATCHES+=( "${D3D9_DIR}/d3d9-helper.patch" )
+ fi
+ PATCHES+=( "${D3D9_DIR}/wine-d3d9.patch" )
+ fi
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use staging && myconf+=(
+ --with-xattr
+ $(use_with themes gtk3)
+ $(use_with vaapi va)
+ )
+ use d3d9 && myconf+=( $(use_with d3d9 d3d9-nine) )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine register --staging ${P} || die
+ fi
+ if use d3d9; then
+ eselect wine register --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine deregister --staging ${P} || die
+ fi
+ if use d3d9; then
+ eselect wine deregister --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-any/wine-any-2.4-r1.ebuild b/app-emulation/wine-any/wine-any-2.4-r1.ebuild
new file mode 100644
index 0000000..26addaa
--- /dev/null
+++ b/app-emulation/wine-any/wine-any-2.4-r1.ebuild
@@ -0,0 +1,636 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+STAGING_P="wine-staging-${PV}"
+STAGING_DIR="${WORKDIR}/${STAGING_P}"
+D3D9_P="wine-d3d9-${PV}"
+D3D9_DIR="${WORKDIR}/wine-d3d9-patches-${D3D9_P}"
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, with optional external patchsets"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+if [[ ${PV} == "9999" ]] ; then
+ STAGING_EGIT_REPO_URI="https://github.com/wine-compholio/wine-staging.git"
+ D3D9_EGIT_REPO_URI="https://github.com/sarnex/wine-d3d9-patches.git"
+else
+ SRC_URI="${SRC_URI}
+ staging? ( https://github.com/wine-compholio/wine-staging/archive/v${PV}.tar.gz -> ${STAGING_P}.tar.gz )
+ d3d9? ( https://github.com/sarnex/wine-d3d9-patches/archive/${D3D9_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags d3d9 dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap pipelight +png prelink pulseaudio +realtime +run-exes s3tc samba scanner selinux +ssl staging test themes +threads +truetype udev +udisks v4l vaapi +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ pipelight? ( staging )
+ s3tc? ( staging )
+ test? ( abi_x86_32 )
+ themes? ( staging )
+ vaapi? ( staging )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ d3d9? (
+ media-libs/mesa[d3d9,egl,${MULTILIB_USEDEP}]
+ x11-libs/libX11[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libxcb[${MULTILIB_USEDEP}]
+ )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ staging? ( sys-apps/attr[${MULTILIB_USEDEP}] )
+ themes? (
+ dev-libs/glib:2[${MULTILIB_USEDEP}]
+ x11-libs/cairo[${MULTILIB_USEDEP}]
+ x11-libs/gtk+:3[${MULTILIB_USEDEP}]
+ )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ vaapi? ( x11-libs/libva[X,${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.0 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ s3tc? ( >=media-libs/libtxc_dxtn-1.0.1-r1[${MULTILIB_USEDEP}] )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ staging? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use staging || use d3d9; then
+ eerror "Because of the multi-repo nature of ${MY_PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use staging; then
+ local CURRENT_WINE_COMMIT=${EGIT_VERSION}
+
+ git-r3_fetch "${STAGING_EGIT_REPO_URI}" "${STAGING_COMMIT}"
+ git-r3_checkout "${STAGING_EGIT_REPO_URI}" "${STAGING_DIR}"
+
+ local COMPAT_WINE_COMMIT=$("${STAGING_DIR}/patches/patchinstall.sh" --upstream-commit) || die
+
+ if [[ "${CURRENT_WINE_COMMIT}" != "${COMPAT_WINE_COMMIT}" ]]; then
+ einfo "The current Staging patchset is not guaranteed to apply on this WINE commit."
+ einfo "If src_prepare fails, try emerging with the env var WINE_COMMIT."
+ einfo "Example: WINE_COMMIT=${COMPAT_WINE_COMMIT} emerge -1 wine"
+ fi
+ fi
+ if use d3d9; then
+ git-r3_fetch "${D3D9_EGIT_REPO_URI}" "${D3D9_COMMIT}"
+ git-r3_checkout "${D3D9_EGIT_REPO_URI}" "${D3D9_DIR}"
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ if use staging; then
+ ewarn "Applying the Wine-Staging patchset. Any bug reports to the"
+ ewarn "Wine bugzilla should explicitly state that staging was used."
+
+ local STAGING_EXCLUDE=""
+ STAGING_EXCLUDE="${STAGING_EXCLUDE} -W winhlp32-Flex_Workaround" # Avoid double patching https://bugs.winehq.org/show_bug.cgi?id=42132
+ use pipelight || STAGING_EXCLUDE="${STAGING_EXCLUDE} -W Pipelight"
+
+ # Launch wine-staging patcher in a subshell, using eapply as a backend, and gitapply.sh as a backend for binary patches
+ ebegin "Running Wine-Staging patch installer"
+ (
+ set -- DESTDIR="${S}" --backend=eapply --no-autoconf --all ${STAGING_EXCLUDE}
+ cd "${STAGING_DIR}/patches"
+ source "${STAGING_DIR}/patches/patchinstall.sh"
+ )
+ eend $? || die "Failed to apply Wine-Staging patches"
+ fi
+ if use d3d9; then
+ if use staging; then
+ PATCHES+=( "${D3D9_DIR}/staging-helper.patch" )
+ else
+ PATCHES+=( "${D3D9_DIR}/d3d9-helper.patch" )
+ fi
+ PATCHES+=( "${D3D9_DIR}/wine-d3d9.patch" )
+ fi
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use staging && myconf+=(
+ --with-xattr
+ $(use_with themes gtk3)
+ $(use_with vaapi va)
+ )
+ use d3d9 && myconf+=( $(use_with d3d9 d3d9-nine) )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine register --staging ${P} || die
+ fi
+ if use d3d9; then
+ eselect wine register --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine deregister --staging ${P} || die
+ fi
+ if use d3d9; then
+ eselect wine deregister --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-any/wine-any-2.5-r1.ebuild b/app-emulation/wine-any/wine-any-2.5-r1.ebuild
new file mode 100644
index 0000000..26addaa
--- /dev/null
+++ b/app-emulation/wine-any/wine-any-2.5-r1.ebuild
@@ -0,0 +1,636 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+STAGING_P="wine-staging-${PV}"
+STAGING_DIR="${WORKDIR}/${STAGING_P}"
+D3D9_P="wine-d3d9-${PV}"
+D3D9_DIR="${WORKDIR}/wine-d3d9-patches-${D3D9_P}"
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, with optional external patchsets"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+if [[ ${PV} == "9999" ]] ; then
+ STAGING_EGIT_REPO_URI="https://github.com/wine-compholio/wine-staging.git"
+ D3D9_EGIT_REPO_URI="https://github.com/sarnex/wine-d3d9-patches.git"
+else
+ SRC_URI="${SRC_URI}
+ staging? ( https://github.com/wine-compholio/wine-staging/archive/v${PV}.tar.gz -> ${STAGING_P}.tar.gz )
+ d3d9? ( https://github.com/sarnex/wine-d3d9-patches/archive/${D3D9_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags d3d9 dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap pipelight +png prelink pulseaudio +realtime +run-exes s3tc samba scanner selinux +ssl staging test themes +threads +truetype udev +udisks v4l vaapi +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ pipelight? ( staging )
+ s3tc? ( staging )
+ test? ( abi_x86_32 )
+ themes? ( staging )
+ vaapi? ( staging )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ d3d9? (
+ media-libs/mesa[d3d9,egl,${MULTILIB_USEDEP}]
+ x11-libs/libX11[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libxcb[${MULTILIB_USEDEP}]
+ )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ staging? ( sys-apps/attr[${MULTILIB_USEDEP}] )
+ themes? (
+ dev-libs/glib:2[${MULTILIB_USEDEP}]
+ x11-libs/cairo[${MULTILIB_USEDEP}]
+ x11-libs/gtk+:3[${MULTILIB_USEDEP}]
+ )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ vaapi? ( x11-libs/libva[X,${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.0 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ s3tc? ( >=media-libs/libtxc_dxtn-1.0.1-r1[${MULTILIB_USEDEP}] )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ staging? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use staging || use d3d9; then
+ eerror "Because of the multi-repo nature of ${MY_PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use staging; then
+ local CURRENT_WINE_COMMIT=${EGIT_VERSION}
+
+ git-r3_fetch "${STAGING_EGIT_REPO_URI}" "${STAGING_COMMIT}"
+ git-r3_checkout "${STAGING_EGIT_REPO_URI}" "${STAGING_DIR}"
+
+ local COMPAT_WINE_COMMIT=$("${STAGING_DIR}/patches/patchinstall.sh" --upstream-commit) || die
+
+ if [[ "${CURRENT_WINE_COMMIT}" != "${COMPAT_WINE_COMMIT}" ]]; then
+ einfo "The current Staging patchset is not guaranteed to apply on this WINE commit."
+ einfo "If src_prepare fails, try emerging with the env var WINE_COMMIT."
+ einfo "Example: WINE_COMMIT=${COMPAT_WINE_COMMIT} emerge -1 wine"
+ fi
+ fi
+ if use d3d9; then
+ git-r3_fetch "${D3D9_EGIT_REPO_URI}" "${D3D9_COMMIT}"
+ git-r3_checkout "${D3D9_EGIT_REPO_URI}" "${D3D9_DIR}"
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ if use staging; then
+ ewarn "Applying the Wine-Staging patchset. Any bug reports to the"
+ ewarn "Wine bugzilla should explicitly state that staging was used."
+
+ local STAGING_EXCLUDE=""
+ STAGING_EXCLUDE="${STAGING_EXCLUDE} -W winhlp32-Flex_Workaround" # Avoid double patching https://bugs.winehq.org/show_bug.cgi?id=42132
+ use pipelight || STAGING_EXCLUDE="${STAGING_EXCLUDE} -W Pipelight"
+
+ # Launch wine-staging patcher in a subshell, using eapply as a backend, and gitapply.sh as a backend for binary patches
+ ebegin "Running Wine-Staging patch installer"
+ (
+ set -- DESTDIR="${S}" --backend=eapply --no-autoconf --all ${STAGING_EXCLUDE}
+ cd "${STAGING_DIR}/patches"
+ source "${STAGING_DIR}/patches/patchinstall.sh"
+ )
+ eend $? || die "Failed to apply Wine-Staging patches"
+ fi
+ if use d3d9; then
+ if use staging; then
+ PATCHES+=( "${D3D9_DIR}/staging-helper.patch" )
+ else
+ PATCHES+=( "${D3D9_DIR}/d3d9-helper.patch" )
+ fi
+ PATCHES+=( "${D3D9_DIR}/wine-d3d9.patch" )
+ fi
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use staging && myconf+=(
+ --with-xattr
+ $(use_with themes gtk3)
+ $(use_with vaapi va)
+ )
+ use d3d9 && myconf+=( $(use_with d3d9 d3d9-nine) )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine register --staging ${P} || die
+ fi
+ if use d3d9; then
+ eselect wine register --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine deregister --staging ${P} || die
+ fi
+ if use d3d9; then
+ eselect wine deregister --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-any/wine-any-2.6-r1.ebuild b/app-emulation/wine-any/wine-any-2.6-r1.ebuild
new file mode 100644
index 0000000..26addaa
--- /dev/null
+++ b/app-emulation/wine-any/wine-any-2.6-r1.ebuild
@@ -0,0 +1,636 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+STAGING_P="wine-staging-${PV}"
+STAGING_DIR="${WORKDIR}/${STAGING_P}"
+D3D9_P="wine-d3d9-${PV}"
+D3D9_DIR="${WORKDIR}/wine-d3d9-patches-${D3D9_P}"
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, with optional external patchsets"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+if [[ ${PV} == "9999" ]] ; then
+ STAGING_EGIT_REPO_URI="https://github.com/wine-compholio/wine-staging.git"
+ D3D9_EGIT_REPO_URI="https://github.com/sarnex/wine-d3d9-patches.git"
+else
+ SRC_URI="${SRC_URI}
+ staging? ( https://github.com/wine-compholio/wine-staging/archive/v${PV}.tar.gz -> ${STAGING_P}.tar.gz )
+ d3d9? ( https://github.com/sarnex/wine-d3d9-patches/archive/${D3D9_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags d3d9 dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap pipelight +png prelink pulseaudio +realtime +run-exes s3tc samba scanner selinux +ssl staging test themes +threads +truetype udev +udisks v4l vaapi +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ pipelight? ( staging )
+ s3tc? ( staging )
+ test? ( abi_x86_32 )
+ themes? ( staging )
+ vaapi? ( staging )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ d3d9? (
+ media-libs/mesa[d3d9,egl,${MULTILIB_USEDEP}]
+ x11-libs/libX11[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libxcb[${MULTILIB_USEDEP}]
+ )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ staging? ( sys-apps/attr[${MULTILIB_USEDEP}] )
+ themes? (
+ dev-libs/glib:2[${MULTILIB_USEDEP}]
+ x11-libs/cairo[${MULTILIB_USEDEP}]
+ x11-libs/gtk+:3[${MULTILIB_USEDEP}]
+ )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ vaapi? ( x11-libs/libva[X,${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.0 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ s3tc? ( >=media-libs/libtxc_dxtn-1.0.1-r1[${MULTILIB_USEDEP}] )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ staging? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use staging || use d3d9; then
+ eerror "Because of the multi-repo nature of ${MY_PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use staging; then
+ local CURRENT_WINE_COMMIT=${EGIT_VERSION}
+
+ git-r3_fetch "${STAGING_EGIT_REPO_URI}" "${STAGING_COMMIT}"
+ git-r3_checkout "${STAGING_EGIT_REPO_URI}" "${STAGING_DIR}"
+
+ local COMPAT_WINE_COMMIT=$("${STAGING_DIR}/patches/patchinstall.sh" --upstream-commit) || die
+
+ if [[ "${CURRENT_WINE_COMMIT}" != "${COMPAT_WINE_COMMIT}" ]]; then
+ einfo "The current Staging patchset is not guaranteed to apply on this WINE commit."
+ einfo "If src_prepare fails, try emerging with the env var WINE_COMMIT."
+ einfo "Example: WINE_COMMIT=${COMPAT_WINE_COMMIT} emerge -1 wine"
+ fi
+ fi
+ if use d3d9; then
+ git-r3_fetch "${D3D9_EGIT_REPO_URI}" "${D3D9_COMMIT}"
+ git-r3_checkout "${D3D9_EGIT_REPO_URI}" "${D3D9_DIR}"
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ if use staging; then
+ ewarn "Applying the Wine-Staging patchset. Any bug reports to the"
+ ewarn "Wine bugzilla should explicitly state that staging was used."
+
+ local STAGING_EXCLUDE=""
+ STAGING_EXCLUDE="${STAGING_EXCLUDE} -W winhlp32-Flex_Workaround" # Avoid double patching https://bugs.winehq.org/show_bug.cgi?id=42132
+ use pipelight || STAGING_EXCLUDE="${STAGING_EXCLUDE} -W Pipelight"
+
+ # Launch wine-staging patcher in a subshell, using eapply as a backend, and gitapply.sh as a backend for binary patches
+ ebegin "Running Wine-Staging patch installer"
+ (
+ set -- DESTDIR="${S}" --backend=eapply --no-autoconf --all ${STAGING_EXCLUDE}
+ cd "${STAGING_DIR}/patches"
+ source "${STAGING_DIR}/patches/patchinstall.sh"
+ )
+ eend $? || die "Failed to apply Wine-Staging patches"
+ fi
+ if use d3d9; then
+ if use staging; then
+ PATCHES+=( "${D3D9_DIR}/staging-helper.patch" )
+ else
+ PATCHES+=( "${D3D9_DIR}/d3d9-helper.patch" )
+ fi
+ PATCHES+=( "${D3D9_DIR}/wine-d3d9.patch" )
+ fi
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use staging && myconf+=(
+ --with-xattr
+ $(use_with themes gtk3)
+ $(use_with vaapi va)
+ )
+ use d3d9 && myconf+=( $(use_with d3d9 d3d9-nine) )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine register --staging ${P} || die
+ fi
+ if use d3d9; then
+ eselect wine register --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine deregister --staging ${P} || die
+ fi
+ if use d3d9; then
+ eselect wine deregister --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-any/wine-any-2.7-r1.ebuild b/app-emulation/wine-any/wine-any-2.7-r1.ebuild
new file mode 100644
index 0000000..26addaa
--- /dev/null
+++ b/app-emulation/wine-any/wine-any-2.7-r1.ebuild
@@ -0,0 +1,636 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+STAGING_P="wine-staging-${PV}"
+STAGING_DIR="${WORKDIR}/${STAGING_P}"
+D3D9_P="wine-d3d9-${PV}"
+D3D9_DIR="${WORKDIR}/wine-d3d9-patches-${D3D9_P}"
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, with optional external patchsets"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+if [[ ${PV} == "9999" ]] ; then
+ STAGING_EGIT_REPO_URI="https://github.com/wine-compholio/wine-staging.git"
+ D3D9_EGIT_REPO_URI="https://github.com/sarnex/wine-d3d9-patches.git"
+else
+ SRC_URI="${SRC_URI}
+ staging? ( https://github.com/wine-compholio/wine-staging/archive/v${PV}.tar.gz -> ${STAGING_P}.tar.gz )
+ d3d9? ( https://github.com/sarnex/wine-d3d9-patches/archive/${D3D9_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags d3d9 dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap pipelight +png prelink pulseaudio +realtime +run-exes s3tc samba scanner selinux +ssl staging test themes +threads +truetype udev +udisks v4l vaapi +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ pipelight? ( staging )
+ s3tc? ( staging )
+ test? ( abi_x86_32 )
+ themes? ( staging )
+ vaapi? ( staging )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ d3d9? (
+ media-libs/mesa[d3d9,egl,${MULTILIB_USEDEP}]
+ x11-libs/libX11[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libxcb[${MULTILIB_USEDEP}]
+ )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ staging? ( sys-apps/attr[${MULTILIB_USEDEP}] )
+ themes? (
+ dev-libs/glib:2[${MULTILIB_USEDEP}]
+ x11-libs/cairo[${MULTILIB_USEDEP}]
+ x11-libs/gtk+:3[${MULTILIB_USEDEP}]
+ )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ vaapi? ( x11-libs/libva[X,${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.0 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ s3tc? ( >=media-libs/libtxc_dxtn-1.0.1-r1[${MULTILIB_USEDEP}] )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ staging? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use staging || use d3d9; then
+ eerror "Because of the multi-repo nature of ${MY_PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use staging; then
+ local CURRENT_WINE_COMMIT=${EGIT_VERSION}
+
+ git-r3_fetch "${STAGING_EGIT_REPO_URI}" "${STAGING_COMMIT}"
+ git-r3_checkout "${STAGING_EGIT_REPO_URI}" "${STAGING_DIR}"
+
+ local COMPAT_WINE_COMMIT=$("${STAGING_DIR}/patches/patchinstall.sh" --upstream-commit) || die
+
+ if [[ "${CURRENT_WINE_COMMIT}" != "${COMPAT_WINE_COMMIT}" ]]; then
+ einfo "The current Staging patchset is not guaranteed to apply on this WINE commit."
+ einfo "If src_prepare fails, try emerging with the env var WINE_COMMIT."
+ einfo "Example: WINE_COMMIT=${COMPAT_WINE_COMMIT} emerge -1 wine"
+ fi
+ fi
+ if use d3d9; then
+ git-r3_fetch "${D3D9_EGIT_REPO_URI}" "${D3D9_COMMIT}"
+ git-r3_checkout "${D3D9_EGIT_REPO_URI}" "${D3D9_DIR}"
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ if use staging; then
+ ewarn "Applying the Wine-Staging patchset. Any bug reports to the"
+ ewarn "Wine bugzilla should explicitly state that staging was used."
+
+ local STAGING_EXCLUDE=""
+ STAGING_EXCLUDE="${STAGING_EXCLUDE} -W winhlp32-Flex_Workaround" # Avoid double patching https://bugs.winehq.org/show_bug.cgi?id=42132
+ use pipelight || STAGING_EXCLUDE="${STAGING_EXCLUDE} -W Pipelight"
+
+ # Launch wine-staging patcher in a subshell, using eapply as a backend, and gitapply.sh as a backend for binary patches
+ ebegin "Running Wine-Staging patch installer"
+ (
+ set -- DESTDIR="${S}" --backend=eapply --no-autoconf --all ${STAGING_EXCLUDE}
+ cd "${STAGING_DIR}/patches"
+ source "${STAGING_DIR}/patches/patchinstall.sh"
+ )
+ eend $? || die "Failed to apply Wine-Staging patches"
+ fi
+ if use d3d9; then
+ if use staging; then
+ PATCHES+=( "${D3D9_DIR}/staging-helper.patch" )
+ else
+ PATCHES+=( "${D3D9_DIR}/d3d9-helper.patch" )
+ fi
+ PATCHES+=( "${D3D9_DIR}/wine-d3d9.patch" )
+ fi
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use staging && myconf+=(
+ --with-xattr
+ $(use_with themes gtk3)
+ $(use_with vaapi va)
+ )
+ use d3d9 && myconf+=( $(use_with d3d9 d3d9-nine) )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine register --staging ${P} || die
+ fi
+ if use d3d9; then
+ eselect wine register --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine deregister --staging ${P} || die
+ fi
+ if use d3d9; then
+ eselect wine deregister --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-any/wine-any-2.8-r1.ebuild b/app-emulation/wine-any/wine-any-2.8-r1.ebuild
new file mode 100644
index 0000000..26addaa
--- /dev/null
+++ b/app-emulation/wine-any/wine-any-2.8-r1.ebuild
@@ -0,0 +1,636 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+STAGING_P="wine-staging-${PV}"
+STAGING_DIR="${WORKDIR}/${STAGING_P}"
+D3D9_P="wine-d3d9-${PV}"
+D3D9_DIR="${WORKDIR}/wine-d3d9-patches-${D3D9_P}"
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, with optional external patchsets"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+if [[ ${PV} == "9999" ]] ; then
+ STAGING_EGIT_REPO_URI="https://github.com/wine-compholio/wine-staging.git"
+ D3D9_EGIT_REPO_URI="https://github.com/sarnex/wine-d3d9-patches.git"
+else
+ SRC_URI="${SRC_URI}
+ staging? ( https://github.com/wine-compholio/wine-staging/archive/v${PV}.tar.gz -> ${STAGING_P}.tar.gz )
+ d3d9? ( https://github.com/sarnex/wine-d3d9-patches/archive/${D3D9_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags d3d9 dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap pipelight +png prelink pulseaudio +realtime +run-exes s3tc samba scanner selinux +ssl staging test themes +threads +truetype udev +udisks v4l vaapi +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ pipelight? ( staging )
+ s3tc? ( staging )
+ test? ( abi_x86_32 )
+ themes? ( staging )
+ vaapi? ( staging )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ d3d9? (
+ media-libs/mesa[d3d9,egl,${MULTILIB_USEDEP}]
+ x11-libs/libX11[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libxcb[${MULTILIB_USEDEP}]
+ )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ staging? ( sys-apps/attr[${MULTILIB_USEDEP}] )
+ themes? (
+ dev-libs/glib:2[${MULTILIB_USEDEP}]
+ x11-libs/cairo[${MULTILIB_USEDEP}]
+ x11-libs/gtk+:3[${MULTILIB_USEDEP}]
+ )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ vaapi? ( x11-libs/libva[X,${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.0 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ s3tc? ( >=media-libs/libtxc_dxtn-1.0.1-r1[${MULTILIB_USEDEP}] )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ staging? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use staging || use d3d9; then
+ eerror "Because of the multi-repo nature of ${MY_PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use staging; then
+ local CURRENT_WINE_COMMIT=${EGIT_VERSION}
+
+ git-r3_fetch "${STAGING_EGIT_REPO_URI}" "${STAGING_COMMIT}"
+ git-r3_checkout "${STAGING_EGIT_REPO_URI}" "${STAGING_DIR}"
+
+ local COMPAT_WINE_COMMIT=$("${STAGING_DIR}/patches/patchinstall.sh" --upstream-commit) || die
+
+ if [[ "${CURRENT_WINE_COMMIT}" != "${COMPAT_WINE_COMMIT}" ]]; then
+ einfo "The current Staging patchset is not guaranteed to apply on this WINE commit."
+ einfo "If src_prepare fails, try emerging with the env var WINE_COMMIT."
+ einfo "Example: WINE_COMMIT=${COMPAT_WINE_COMMIT} emerge -1 wine"
+ fi
+ fi
+ if use d3d9; then
+ git-r3_fetch "${D3D9_EGIT_REPO_URI}" "${D3D9_COMMIT}"
+ git-r3_checkout "${D3D9_EGIT_REPO_URI}" "${D3D9_DIR}"
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ if use staging; then
+ ewarn "Applying the Wine-Staging patchset. Any bug reports to the"
+ ewarn "Wine bugzilla should explicitly state that staging was used."
+
+ local STAGING_EXCLUDE=""
+ STAGING_EXCLUDE="${STAGING_EXCLUDE} -W winhlp32-Flex_Workaround" # Avoid double patching https://bugs.winehq.org/show_bug.cgi?id=42132
+ use pipelight || STAGING_EXCLUDE="${STAGING_EXCLUDE} -W Pipelight"
+
+ # Launch wine-staging patcher in a subshell, using eapply as a backend, and gitapply.sh as a backend for binary patches
+ ebegin "Running Wine-Staging patch installer"
+ (
+ set -- DESTDIR="${S}" --backend=eapply --no-autoconf --all ${STAGING_EXCLUDE}
+ cd "${STAGING_DIR}/patches"
+ source "${STAGING_DIR}/patches/patchinstall.sh"
+ )
+ eend $? || die "Failed to apply Wine-Staging patches"
+ fi
+ if use d3d9; then
+ if use staging; then
+ PATCHES+=( "${D3D9_DIR}/staging-helper.patch" )
+ else
+ PATCHES+=( "${D3D9_DIR}/d3d9-helper.patch" )
+ fi
+ PATCHES+=( "${D3D9_DIR}/wine-d3d9.patch" )
+ fi
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use staging && myconf+=(
+ --with-xattr
+ $(use_with themes gtk3)
+ $(use_with vaapi va)
+ )
+ use d3d9 && myconf+=( $(use_with d3d9 d3d9-nine) )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine register --staging ${P} || die
+ fi
+ if use d3d9; then
+ eselect wine register --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine deregister --staging ${P} || die
+ fi
+ if use d3d9; then
+ eselect wine deregister --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-any/wine-any-2.9-r1.ebuild b/app-emulation/wine-any/wine-any-2.9-r1.ebuild
new file mode 100644
index 0000000..61c306c
--- /dev/null
+++ b/app-emulation/wine-any/wine-any-2.9-r1.ebuild
@@ -0,0 +1,638 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+STAGING_P="wine-staging-${PV}"
+STAGING_DIR="${WORKDIR}/${STAGING_P}"
+D3D9_P="wine-d3d9-${PV}"
+D3D9_DIR="${WORKDIR}/wine-d3d9-patches-${D3D9_P}"
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, with optional external patchsets"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+if [[ ${PV} == "9999" ]] ; then
+ STAGING_EGIT_REPO_URI="https://github.com/wine-compholio/wine-staging.git"
+ D3D9_EGIT_REPO_URI="https://github.com/sarnex/wine-d3d9-patches.git"
+else
+ SRC_URI="${SRC_URI}
+ staging? ( https://github.com/wine-compholio/wine-staging/archive/v${PV}.tar.gz -> ${STAGING_P}.tar.gz )
+ d3d9? ( https://github.com/sarnex/wine-d3d9-patches/archive/${D3D9_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags d3d9 dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap pipelight +png prelink pulseaudio +realtime +run-exes s3tc samba scanner selinux +ssl staging test themes +threads +truetype udev +udisks v4l vaapi +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ pipelight? ( staging )
+ s3tc? ( staging )
+ test? ( abi_x86_32 )
+ themes? ( staging )
+ vaapi? ( staging )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXfixes[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ d3d9? (
+ media-libs/mesa[d3d9,egl,${MULTILIB_USEDEP}]
+ x11-libs/libX11[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libxcb[${MULTILIB_USEDEP}]
+ )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ staging? ( sys-apps/attr[${MULTILIB_USEDEP}] )
+ themes? (
+ dev-libs/glib:2[${MULTILIB_USEDEP}]
+ x11-libs/cairo[${MULTILIB_USEDEP}]
+ x11-libs/gtk+:3[${MULTILIB_USEDEP}]
+ )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ vaapi? ( x11-libs/libva[X,${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.0 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ s3tc? ( >=media-libs/libtxc_dxtn-1.0.1-r1[${MULTILIB_USEDEP}] )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ staging? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use staging || use d3d9; then
+ eerror "Because of the multi-repo nature of ${MY_PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use staging; then
+ local CURRENT_WINE_COMMIT=${EGIT_VERSION}
+
+ git-r3_fetch "${STAGING_EGIT_REPO_URI}" "${STAGING_COMMIT}"
+ git-r3_checkout "${STAGING_EGIT_REPO_URI}" "${STAGING_DIR}"
+
+ local COMPAT_WINE_COMMIT=$("${STAGING_DIR}/patches/patchinstall.sh" --upstream-commit) || die
+
+ if [[ "${CURRENT_WINE_COMMIT}" != "${COMPAT_WINE_COMMIT}" ]]; then
+ einfo "The current Staging patchset is not guaranteed to apply on this WINE commit."
+ einfo "If src_prepare fails, try emerging with the env var WINE_COMMIT."
+ einfo "Example: WINE_COMMIT=${COMPAT_WINE_COMMIT} emerge -1 wine"
+ fi
+ fi
+ if use d3d9; then
+ git-r3_fetch "${D3D9_EGIT_REPO_URI}" "${D3D9_COMMIT}"
+ git-r3_checkout "${D3D9_EGIT_REPO_URI}" "${D3D9_DIR}"
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ if use staging; then
+ ewarn "Applying the Wine-Staging patchset. Any bug reports to the"
+ ewarn "Wine bugzilla should explicitly state that staging was used."
+
+ local STAGING_EXCLUDE=""
+ STAGING_EXCLUDE="${STAGING_EXCLUDE} -W winhlp32-Flex_Workaround" # Avoid double patching https://bugs.winehq.org/show_bug.cgi?id=42132
+ use pipelight || STAGING_EXCLUDE="${STAGING_EXCLUDE} -W Pipelight"
+
+ # Launch wine-staging patcher in a subshell, using eapply as a backend, and gitapply.sh as a backend for binary patches
+ ebegin "Running Wine-Staging patch installer"
+ (
+ set -- DESTDIR="${S}" --backend=eapply --no-autoconf --all ${STAGING_EXCLUDE}
+ cd "${STAGING_DIR}/patches"
+ source "${STAGING_DIR}/patches/patchinstall.sh"
+ )
+ eend $? || die "Failed to apply Wine-Staging patches"
+ fi
+ if use d3d9; then
+ if use staging; then
+ PATCHES+=( "${D3D9_DIR}/staging-helper.patch" )
+ else
+ PATCHES+=( "${D3D9_DIR}/d3d9-helper.patch" )
+ fi
+ PATCHES+=( "${D3D9_DIR}/wine-d3d9.patch" )
+ fi
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with X xfixes)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use staging && myconf+=(
+ --with-xattr
+ $(use_with themes gtk3)
+ $(use_with vaapi va)
+ )
+ use d3d9 && myconf+=( $(use_with d3d9 d3d9-nine) )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine register --staging ${P} || die
+ fi
+ if use d3d9; then
+ eselect wine register --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine deregister --staging ${P} || die
+ fi
+ if use d3d9; then
+ eselect wine deregister --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-any/wine-any-9999.ebuild b/app-emulation/wine-any/wine-any-9999.ebuild
new file mode 100644
index 0000000..5fb96a2
--- /dev/null
+++ b/app-emulation/wine-any/wine-any-9999.ebuild
@@ -0,0 +1,634 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+STAGING_P="wine-staging-${PV}"
+STAGING_DIR="${WORKDIR}/${STAGING_P}"
+D3D9_P="wine-d3d9-${PV}"
+D3D9_DIR="${WORKDIR}/wine-d3d9-patches-${D3D9_P}"
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, with optional external patchsets"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+if [[ ${PV} == "9999" ]] ; then
+ STAGING_EGIT_REPO_URI="https://github.com/wine-compholio/wine-staging.git"
+ D3D9_EGIT_REPO_URI="https://github.com/sarnex/wine-d3d9-patches.git"
+else
+ SRC_URI="${SRC_URI}
+ staging? ( https://github.com/wine-compholio/wine-staging/archive/v${PV}.tar.gz -> ${STAGING_P}.tar.gz )
+ d3d9? ( https://github.com/sarnex/wine-d3d9-patches/archive/${D3D9_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags d3d9 dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap pipelight +png prelink pulseaudio +realtime +run-exes s3tc samba scanner selinux +ssl staging test themes +threads +truetype udev +udisks v4l vaapi +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ pipelight? ( staging )
+ s3tc? ( staging )
+ test? ( abi_x86_32 )
+ themes? ( staging )
+ vaapi? ( staging )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXfixes[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ d3d9? (
+ media-libs/mesa[d3d9,egl,${MULTILIB_USEDEP}]
+ x11-libs/libX11[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libxcb[${MULTILIB_USEDEP}]
+ )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ staging? ( sys-apps/attr[${MULTILIB_USEDEP}] )
+ themes? (
+ dev-libs/glib:2[${MULTILIB_USEDEP}]
+ x11-libs/cairo[${MULTILIB_USEDEP}]
+ x11-libs/gtk+:3[${MULTILIB_USEDEP}]
+ )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ vaapi? ( x11-libs/libva[X,${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.1 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ s3tc? ( >=media-libs/libtxc_dxtn-1.0.1-r1[${MULTILIB_USEDEP}] )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ staging? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+)
+PATCHES_BIN=()
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use staging || use d3d9; then
+ eerror "Because of the multi-repo nature of ${MY_PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use staging; then
+ local CURRENT_WINE_COMMIT=${EGIT_VERSION}
+
+ git-r3_fetch "${STAGING_EGIT_REPO_URI}" "${STAGING_COMMIT}"
+ git-r3_checkout "${STAGING_EGIT_REPO_URI}" "${STAGING_DIR}"
+
+ local COMPAT_WINE_COMMIT=$("${STAGING_DIR}/patches/patchinstall.sh" --upstream-commit) || die
+
+ if [[ "${CURRENT_WINE_COMMIT}" != "${COMPAT_WINE_COMMIT}" ]]; then
+ einfo "The current Staging patchset is not guaranteed to apply on this WINE commit."
+ einfo "If src_prepare fails, try emerging with the env var WINE_COMMIT."
+ einfo "Example: WINE_COMMIT=${COMPAT_WINE_COMMIT} emerge -1 wine"
+ fi
+ fi
+ if use d3d9; then
+ git-r3_fetch "${D3D9_EGIT_REPO_URI}" "${D3D9_COMMIT}"
+ git-r3_checkout "${D3D9_EGIT_REPO_URI}" "${D3D9_DIR}"
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ if use staging; then
+ ewarn "Applying the Wine-Staging patchset. Any bug reports to the"
+ ewarn "Wine bugzilla should explicitly state that staging was used."
+
+ local STAGING_EXCLUDE=""
+ STAGING_EXCLUDE="${STAGING_EXCLUDE} -W winhlp32-Flex_Workaround" # Avoid double patching https://bugs.winehq.org/show_bug.cgi?id=42132
+ use pipelight || STAGING_EXCLUDE="${STAGING_EXCLUDE} -W Pipelight"
+
+ # Launch wine-staging patcher in a subshell, using eapply as a backend, and gitapply.sh as a backend for binary patches
+ ebegin "Running Wine-Staging patch installer"
+ (
+ set -- DESTDIR="${S}" --backend=eapply --no-autoconf --all ${STAGING_EXCLUDE}
+ cd "${STAGING_DIR}/patches"
+ source "${STAGING_DIR}/patches/patchinstall.sh"
+ )
+ eend $? || die "Failed to apply Wine-Staging patches"
+ fi
+ if use d3d9; then
+ if use staging; then
+ PATCHES+=( "${D3D9_DIR}/staging-helper.patch" )
+ else
+ PATCHES+=( "${D3D9_DIR}/d3d9-helper.patch" )
+ fi
+ PATCHES+=( "${D3D9_DIR}/wine-d3d9.patch" )
+ fi
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with X xfixes)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use staging && myconf+=(
+ --with-xattr
+ $(use_with themes gtk3)
+ $(use_with vaapi va)
+ )
+ use d3d9 && myconf+=( $(use_with d3d9 d3d9-nine) )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine register --staging ${P} || die
+ fi
+ if use d3d9; then
+ eselect wine register --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine deregister --staging ${P} || die
+ fi
+ if use d3d9; then
+ eselect wine deregister --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-d3d9/Manifest b/app-emulation/wine-d3d9/Manifest
new file mode 100644
index 0000000..f23136d
--- /dev/null
+++ b/app-emulation/wine-d3d9/Manifest
@@ -0,0 +1,41 @@
+DIST gentoo-wine-patches-20170830.tar.xz 58456 SHA256 fb7781d0ae360cbc3860c2d2e81527a1b903da824c01f5d5040e95aaf99a3970 SHA512 5e5159e3252b246bba0ef7fdba345db3ab1071c5b8b8b625f98eda18779d4024c5b76bdbf49ce7bd5c6b01b422807adf76820beddb2b4a6ee9e67d13052cc575 WHIRLPOOL a79be264bab3fcdeee06fef47efd28e6e1125254ac7f82300cb6ba2591ef69cd76b5fed8f778b1849a0659e680e9fc785f0273d55cb2ed95648a74dffa5e22d2
+DIST wine-2.0.tar.bz2 23662707 SHA256 9756f5a2129b6a83ba701e546173cbff86caa671b0af73eb8f72c03b20c066c6 SHA512 b0a57ba8202d9fc396e5bfb7a7718d6bababbed8f3351e7fdc36afa37f35a871e04903757618f73427aeb71a52b2d323977d79e48f8b38d636f23fd404441186 WHIRLPOOL fa9f774d87dae73c7d1f3b86dc3b03ea27065eb6140f1cac13c82fe16f7ebff8f8365ed447220cf5c2788b9f4aae7c482e4f9e2e69f47e5435209e148f5dbdfe
+DIST wine-2.1.tar.xz 18887032 SHA256 bfb9abf63691c93df28d9599aaa866dc2b4e27209b3b7b546df8a37d7d9d1e6e SHA512 03d678ee6e89c2804813f2827255fcf59e96ca9a45b7d8ac441cfc84f835e5e5689c70a79a41a04c631e1add7807fa4a5758acef3bd7aadfb2e92e68958c6ef6 WHIRLPOOL 063d935f1ff0922100641f2f53cdac23d2993a83182d45e028e485fd7d0a13bc5cfb77bca76550b1537b3f42fecacef7fd64785adbf6425af823f56f96973b54
+DIST wine-2.10.tar.xz 19209580 SHA256 488df7ffd2e81da455bf428fc9eb784bb4273a890334500895665711bd52f179 SHA512 8807e16a571bf45d99097ad5fdfb9fe755f6dbe84010a330fed82f1d48c76b7f19589bfc0e5dde0b9e49a608fd0501db3f7e3e129e4d9d34bcae03bc51a73139 WHIRLPOOL e9a8248aac31593fbac28a3d8d4e62bfce14a7c41cc416ebfca8606518d28efd31b32196133da211f75f48bd228bd5d21fcbbc0479293e813ed99b258b37126e
+DIST wine-2.11.tar.xz 19251116 SHA256 efa96dade206aa21accf0da195335a805d38209d6a14320607c6308ebde4cc3c SHA512 691f329c47af5e51498287029988b8ca0777bfc3902ed80fd315004aba2337a938e79177e752efe86423c9b34544df3952b8c443bf43149356575fac75a779ac WHIRLPOOL 4933e1ce640b0abeebccd6969b5eaf4eec76cd135d9cfc1d904a902219f776a68f72e2bd1ae9019d69f0d0d81fd8ead0084785d1b9710590349365977f9c1817
+DIST wine-2.12.tar.xz 19301968 SHA256 496c11af841487e6ec4e1953ac19b05a7f48e397da502653ffbd9fe9004213a7 SHA512 d44c1937d7d2d797150381f70317b810616d61355a59be096366d3507f59b678cffaf6d841cecf02bf9d2afa3dbf4d19270f80fb1d3ba5f0f93787d40c328f62 WHIRLPOOL 6f4b9baa6fcfe86f3d195fe603c2b9450a72a593c8f7042959b42a76880cb4ae680fde7beb70a8e823150849fda36c42985035de891ebf0088c8ffc2bceb15bf
+DIST wine-2.13.tar.xz 19439328 SHA256 6fbca3ddd19b061ce65a267639efae93cf38cfabbe4a9c148a17a44703587ef8 SHA512 71873b9ec1605dd5f7502b87b0f3429c3d14a4196543d7304df455854b58ef82b8fafdcea91450cbfc01434a44886a0e0c4c4cf289ffb53167dde0f969cddc48 WHIRLPOOL 6faf1e6aeea2ab7ccc496ed85834f98eb25111c8f541c24d4876a142ad4acf7d9a4c08c2716e11fb6c92fe7aad29980cab912eb9dbb6759bdbdeca2f2f8e78a7
+DIST wine-2.14.tar.xz 19447812 SHA256 03f934d95181f728600ca04d395f10e821ee38cfa31655e872e4d27d2a8795c6 SHA512 ff43d386d46c0c74449e667b61d8cebd5fa768c88e6220aa2f13df03d80b71b6c0bdf8cbab023aed96f7c88b9787a3be4989da892fa1778412534ae82a7279bb WHIRLPOOL 2d2784e1b2ddeac39a3cea4cb08a62d99d1d062d8d801874e8bf4f56d2538a4cb019418c60299556548028e2362dd533d9ea0956014a65ac7a367ed489c0c392
+DIST wine-2.15.tar.xz 19463720 SHA256 d82d500cbf81fb08c711d3619bd52373138a05574d044f089af89707274868b3 SHA512 a52a42dd1f20fe68213c55a07ac5b2455150806e534f0ab77a8e9ae3d2f12840983fa92290dac569207d3640c7f45cda83801e9f2e80294863ffa854c6c89171 WHIRLPOOL 99c9497a44859ce310c764b3cd172d83ca1a2dce13633fee930ddbf1c40651ee4470f6bc9cfcb407ce65298a2afd73dc9edc536c2ba6f076631e5cf2085b8e61
+DIST wine-2.16.tar.xz 19484716 SHA256 a561edcabecd6c44948e5b2ef11941b2ba047275240418fa2c98c1fdceda2c21 SHA512 749a36b536506c4b63ff7512e316f44503cdb0db46e38a124da86df638f3e8ff9c404b034ece5cbb95cf20c09bc46be9a38f2ee66480aa6a4f2385e2a7a7eea4 WHIRLPOOL 92ae0a427d89b24d41d4565e333cf3b7499c1dfedb6d2a204f934975c35cb589d38b4f669890c1fd6a37b9fe8f34d98be3e7d0986e9ff99516fe00a004574520
+DIST wine-2.17.tar.xz 19505528 SHA256 7edc95739043ccc55957af663fb910318283dc5d1db42cd7f0224e30acfcea69 SHA512 cb10c876e689aa601c68673aab32c0514dd174692a01bdb3afc78d5e6079b0e77f48783af2f54245f397c762da3b4e5f2c1d39d2ce7fdb3b117d338b95c24810 WHIRLPOOL 196427a68ab3b1261cb63bafd7f82b7a688ad439fa82ae3fc04b18c9da14cc8e95b827ca8ddd07124e1179c55ed0e0aba3bdcb4639b724a6dacf4952e8827e16
+DIST wine-2.18.tar.xz 19546360 SHA256 9f0931129878157d717cb39f16cd33bf49f40aac77331c93d0ad30f2ccac4f50 SHA512 61cc39fa3d2b0a0ab3c5d17579865e6aea76dd9513a4b3c45975a2d5c05f2b4ba952b97eef547131a014763c7f692a08df29bc2ebf7e4ac7e2616e6a7822ddb9 WHIRLPOOL e864dd1705c0480d3f3095aa02ab1e7bc5b41693cd6b791cdf05e636c7099562020ac3adcba6421653efdf5dbe232b5abe9071792785e008ea30dedbb63e080e
+DIST wine-2.19.tar.xz 19549464 SHA256 487131e69875ae9c2d042798f954160146e603e449c3c97981f29b42f4a66095 SHA512 83558231bdc592b1f69cfedf6c689063df7bd9fecdfafba6fb7f6a2c7fa7783973efb85a6a49305afc18b1aa268209ee5b9c0655756e05d7550468698dfa51ae WHIRLPOOL 123aec3a367e67353655d940ba2ffe9386a583afbd0961dd3f446a00b0cf82ad4ed590508e03bf2a4e60b11753f8f430e748e6614f476675423f3bdaf7089288
+DIST wine-2.2.tar.xz 18916364 SHA256 64cb57e1d8aa07f5c89ef26743b494f2d3ef9c0f4e50d3ee896a93535f7751f4 SHA512 0700868244d397c1442948716321e5ff030c667edce464570f76aa4340199489a422872aa3975bc0a57b8285c9d59fc04e223a4bde094169fc6db460acb626c4 WHIRLPOOL ffc3d357a76592651b589c6ac6608720d0258474890faf8fe3e20ac29cdd1496d569721256f9389d347bf2734a556099154fd18ef1b56f45bb46c4c15771d6ca
+DIST wine-2.3.tar.xz 18931732 SHA256 afc95c7a87cc8f0730b462c50a5dfc9c462eb02c6bf5874b4fa99946f49e067e SHA512 bea78e8468555ff9e08dedf3918da5ea82721549c43984869989bbdafeea00e454820ff9558aa29925c97a165a9b01e5cd1fd397f133833c58824984a6686171 WHIRLPOOL 1f5ec8e5c32d124277e4c71d95726d3a5337575757c3029567c77165d65fcfec2ddf33d3863b4bf55c9eff7c3582c1ec7dbd76d84ed8bbbe89dd16db6b0128c1
+DIST wine-2.4.tar.xz 18953748 SHA256 87b5df07e4781fecce2f92415a4717208ea253a20a0df8b36b9f90b69b72748e SHA512 15ae7e97dc72a8636b2c15c93803ed430fa456d673add61457cf3e479e769559c682b40949b5d38828f6681f13183e560fcb4a2eb0f0ba25e6eade46f7d3d7c0 WHIRLPOOL 558ab7b7517ad5e03366b4db974047eba776585e958a5b71bb2e93993e21bc725ea7a8bcf2a4354f34ca38c94ba99ccd15f2f8b5e4b58066bf339d3517eec56c
+DIST wine-2.5.tar.xz 18993176 SHA256 13f92b7ab483323aaabbc6519851e688ad4372ea30569961c831d40d6d3bccd2 SHA512 7b6faf6d8aa3d41465ad93ebae055581136f736c7eb8b4c61682e5a05589c83a0ff2c85e0f9abbca016f31b6f1c1435617c4994f1913f715a8707ebee3f28467 WHIRLPOOL 5acd2ac65df5dee1c860ddca72b8df8e021a0b95a3a1870d15468ce4591d569fa15bf8a0a6d341bcd3a624d13d0affe5b0263e67f9dfcbbf3ae7b59218dcded9
+DIST wine-2.6.tar.xz 19023352 SHA256 e6ff64758f437647e99a36c1275e41adf54f0432907172d3bba22b070a97aac0 SHA512 2aa55413ac090e011725566d004e42ee46323cd4c6961b9faa63e3de422ba60bb657bf224a4d7e8aa712a8e26e11977d07acb7c088ffeef8c37310e8cc698970 WHIRLPOOL 82e6a06cc342c7d6eace64a97bae10cc39c120c5776170b059700542b8b6fef56be9a697f05b3bc21ae82621f4bf50f3ab478311c9a3a55d86ed7c0a009766b0
+DIST wine-2.7.tar.xz 19101108 SHA256 e55a43088e313c45f7ab49272b7cb441c06f5659fb4220b2325dc060db0ee14c SHA512 1e61b9a4aa1f5f42fb27d11d5254a9ba90f348ad9c4d1ddd4b5da47cd7de638290a20accf7447db9c0e4ced4c2144497cdf5fc906a5eac60e923dabb61f65d3a WHIRLPOOL 133426a0313facc856eebad3d16d199948b780ce4c4561e5784845c119fe462b8942ed86fa5e823e729a997d704bd3c70f44a64ce3eef965b4f3eb92587dfa4d
+DIST wine-2.8.tar.xz 19120740 SHA256 83e9607af66d86020dc27a368ebba28fa7e8ffecfdf8f149da06b3531ac3e579 SHA512 4d0b167b1e5add31ed0ed05b328d16fc13cd268285c03a9100e7ddc53864aa07f6b216a555ef0c2e51dee550e3f4abf0c7c20db2cbca177bb38e8c3e11f05b97 WHIRLPOOL 568cf46caf7322eb5e26b364bd15f9e80c41a65340952a1ee0fa80514bbee3c5adfa72af40809a978a5d4202f5e8d3da3e4581767bab9fa08ab441cdd5d1da31
+DIST wine-2.9.tar.xz 19154668 SHA256 ac46f7bbbbc1dc135c95e4f98d28bf6e3d7a78fb7f9ba6caa7354a3e8786545f SHA512 6d06e511d8f338297ed0ddb7bf2ffb501f528209eaecbbee3d4e5d53db649dd5ea0aeb78bba661a9bcfda5f97e170ca10eb8fab355e229bfe7db6a5feb7ec4e8 WHIRLPOOL 7355166aeaac54abb6e1d25da6f87a4814d37764044e95462bc2a83f8d5a9b7a3bb10730bb5506516e130a4fc9ee35e3656d1106939bbbc1310c6aff0d798a1c
+DIST wine-d3d9-2.0.tar.gz 48373 SHA256 7bfac23706723c6d51a7a95e416e47fb2678cd4d0945b990f74eba2b059e6206 SHA512 a9e2d1c9f2784128e4c53a8dc923070a5057b5ff3d83c2b536a2d2df0bc8433ac92b8ab1c3cdf34158c0e7bfe497ddb5974605fbc1736a92307639d59450c7a1 WHIRLPOOL 53044c0a4b7159c3af75fc935d1ac45030e80dbfd70d787f64885ddc025cfcd62f724c3256e389a7fde680670e594101955f52301cf6b9bbf23ebc64552790c2
+DIST wine-d3d9-2.1.tar.gz 48385 SHA256 9fd80e3e2ea905272c42dbc14679e94c8e2f955101ae098c84060d4c62ffc9c6 SHA512 9234d8227412d940a6befcf79433f1d5ab0634d5e829f3771ffeea235af05be29ffc40438818b1976c77d1e2e79da8a67c4dab2b7d2e822b502fb6e4a1a7f8b7 WHIRLPOOL 790e482850a13c5bf0967e900620c36d71c4d6673106f8f5c2848550ed574d326d3945d9906de88d847bb5644a520aab7fe6d460b3c3afd49a396798dd253392
+DIST wine-d3d9-2.10.tar.gz 48713 SHA256 62a199a239fca4f172f9ff871086196f8eeb35483d7bcab4acb144c05e60debb SHA512 808241f545e60c0546ff3918cac28e2abb6fe8496e8ade3cfa8bf81612724e827d31787d1d320cbac80b71a5d6180bcc8e51249c12c099e44637e0bb9f4875cd WHIRLPOOL a8c58c5321107b958780348aebad41d57ac0a3a307e176715950e1ed1eae7d19d858db3f9b0e5cb86484919d683321ff6fc19ec1696ba5418e0d2dd861bfaff4
+DIST wine-d3d9-2.11.tar.gz 48714 SHA256 3432863940fdb9ea6f36688d670c6fe800e7359d7b18723828447bedf694b786 SHA512 716dad66fce962246e57a29c239d6b69b78656a11d01a421b490ad61c2c3dd9850b34e2346319a6a35c2a01e0c28193adf78f21b9de1ffde95a06d5fae51fe0d WHIRLPOOL eeef55dca716a68e03b84d4f916955c4194810c1c460a55a30ac2c4257e256b8fc709837d7b35aa86ce3f523f2b9c11222b9096ae4d87979f1fee4a8257ddabb
+DIST wine-d3d9-2.12.tar.gz 48716 SHA256 544e8b901b2fe1e0da90828f07683abf45794a3a41fdfae20eb5d29b5ee7d22b SHA512 8fe9b37ff54372984a234b18037bc736f69f2adf41478f037bc93e3d72893c46174fc3fbff78042ac66bb03d31ea85d293dbadc2b32630218ae53be8e360425d WHIRLPOOL 17f28bafb20c559424945ff92041a5c634b8775a8e97ed8aa940308fa815f2b3cfa48499a58a511fc5c33bde47db07008d168d8b0c103eec379ba27b33b8ffdd
+DIST wine-d3d9-2.13.tar.gz 48711 SHA256 738583d1ad80ddeff5d437ef07885e25a2bba7da9d161ee01e45fef246edd327 SHA512 75481c73c88757c4f15eb00dc427d873ea71109f18fd64c758e858bb2fc2dc1ee7cc29ee912ec93f254186f2055277d07e2e4f1d2ee3c537c76601aa009cf632 WHIRLPOOL 57c5cd0903151eed7c2b719831581aa3216c0fc49a257f7fb9e872ca698a330b5a10d50c945937924c7efefa497dc14117a35c5b39fbccf14cb1fb711e5bbe98
+DIST wine-d3d9-2.14.tar.gz 48718 SHA256 71a3aff0b348f033d4ca610e34ce6faa02eb2b5c822fa2e00b372de66541ffd4 SHA512 77aa93ac9b1a81581c27e74641722666026e2e6e03def57955a05fc76c6c02730271a562130dc87ed1caefc9b00b3e0421b2640fa17165aef2f8be5da0cf07d3 WHIRLPOOL 1319fdfb4426a0a294702a5c43641008654a1352d91d23b9bd422d83fb5cd50053110052eef09ae128dfb570523d9208272abd21cb5975adff060fe7d31ac5ad
+DIST wine-d3d9-2.15.tar.gz 48717 SHA256 c0aa58e7fa3b595c38cf06fe72b54a096e43e526142a7576f839ed8aaa85cabf SHA512 5298de273fc95f65ee481416f8ed16059f244e3781058cb76ee60b6a85aaf8d977a619c75cccd08aadeac9aae9ad2e08b49c5b52ab141cbff351a4b001e7c434 WHIRLPOOL 63337e2c86be5ff2fc16ff0817719ed668360ad2258b095e88b98b1f31e382593b14cabdcb8be58a6dc0cc047cd67a3eb1f14d3ecb806ba2ac9c6f7102368c94
+DIST wine-d3d9-2.16.tar.gz 48728 SHA256 2a681d28a4e042437c32ecf3f92c7abaadc862feba6aacf0df76469acab98f3e SHA512 f3950d7e34ec537b95b963fb3b35ee3729c1b3f9d8c225e96ae9ab9cf8011571ba22105a17309c481f3a504a8aa4d5ae04270691c49098924aa2f72463b79e08 WHIRLPOOL c1f3cb0922cb381f6e2aa7fd54538b98dbd04daa7f36f66742af4c544c80e894e33ebf4866520af35faec27519f0015cd5cc1139fe191bb0b3192cb2134035c3
+DIST wine-d3d9-2.17.tar.gz 48722 SHA256 557ae75a68529f282f1f5e7e9991892d7d994f199060ced43db22291ec66fe71 SHA512 530d44a968a68e06449da2286b8c9740a80b681ff610f6ddc87e6fb569e6c29181341266a04238965a7bfc209e20c1521847b70daa8d3532c2a269db0d200154 WHIRLPOOL 0c70a88949eaa27ebbc28a6951651e4b55166c1d54a8db6d9fdfe3f516d2f4e24ba0f08defddf637b9c2ed0702b250af4d41146684b79e90d84aefe284351059
+DIST wine-d3d9-2.18.tar.gz 48722 SHA256 d1b5210d4228ddcc60f76b4a8694d5feb4e3c68ca4436666ee182c8b14f25356 SHA512 0e66c51e1957b27ccb9f326b0aaf2b0d09b7bbc9d03e1d321aa1789d2560b8e60fd83c4e86999d96a03aa73a37c96f34d93245763969a314150900741aa03933 WHIRLPOOL c879d7ca20e2b339ab1ad862274320ceced84693311dfc02652a83304d0beb263a59e8978fae65ad50bbb51eaac51988ab2a0105c50dafa9176caf1baa791506
+DIST wine-d3d9-2.19.tar.gz 48818 SHA256 54b5fbda45585304e65665e5b2da96a8dc30398c3f8ee12b77a613970b5af9f9 SHA512 be43435cd53f367ca57080c08218db302a90bf85ec6e917e89375904c456b585b61fb6053f9b4366b7e844f8246cabe83460a9866f614dbb5df3edfb43b2f54a WHIRLPOOL bec78732ad8b0036999c4e481e2d6f50d2ec4002590f15fbebab740bbddbc5069f77853993a122ccc03b24cf2b6c76b80117b000648a97fec09eba988c792f57
+DIST wine-d3d9-2.2.tar.gz 48387 SHA256 203ed60980ec584c09b413266728e3a93e2d980dbff9b4f65375a4e9744b5042 SHA512 6e9e031b51afc8ec200bbd252ff0d768c29af23907f782409834de593f896afb128f86fe012c95dc18e5f3c7267f170eb343d2a2c53d639933a337f0c1e04fab WHIRLPOOL 6b32c0dfd3068e87d94bbcd83718dd75a14b36d69b151e9257e04793d2d3ae78ce7da10b80cbc824ccefb6c11666241593f91963ddee6a58301f95bbde35285d
+DIST wine-d3d9-2.3.tar.gz 48510 SHA256 fc17488a782def19fc02bf967128ab43236db49509e31771361a60fa3d17dd60 SHA512 58449f6b7ed7fd8182e2cce92e1d1195bf64a567c1cc92fd3f46af195e7e4039c3b2a128be9d3572d9067be6c1bb020f417c6d558bb551c60096c107067177b8 WHIRLPOOL f648a921cf4cd257a3a7dfbd3abf45d58c07782f329ec11c3a1eff3afe32e8040adb351d4a60e1b1f78c7cae0379f23468764ad162a101179d0f5b0e2c6d9413
+DIST wine-d3d9-2.4.tar.gz 48502 SHA256 4c7084e733d95545b894b152b2c6c9564dfb8df594cfeb1512dad80743b39ae0 SHA512 623b1720b8cd79ab6ad2a177b9beb174f31e6fc402d6885fa2006223c855919c6f5d4267c64212ecf8cf1746430c9715c506343fb740828fc99910f916b10ebe WHIRLPOOL 9c0ea34dedc2e39ce36f1539a6d761ba07429b316a1f7fad49067eec5c28a5c60b33b3d2473cbf66b009d9772c1fb123414bfa201eb8df3e61f8efc38aa1f3fa
+DIST wine-d3d9-2.5.tar.gz 48692 SHA256 8b28c16701ec1cefab11d41d00954a92a5ced9a63f1ede81e96f247d2f498f94 SHA512 8b5ebec6341f70ec977aabee35decbe2d22fe43e111c1fd6015066a2b0e4fd259cd964fdb79306a489be4406078cb1e241d90ed636222174ed4abcc8026e7d03 WHIRLPOOL d5fcc5fbea4c4a4900235d33cb5de8f2a7cbf2b51b1a5c47d75ab765aa88ce1f8f81a61eefe0a742a55bb2ca210747b345589628fd1020430e4d962319b1c6fe
+DIST wine-d3d9-2.6.tar.gz 48702 SHA256 06ed18f2d5fff04613ea1401c37ad70e163135c159528745ff1063d617f31e2d SHA512 17df692df8ff3c1419258a3faf9ddacde67f185a797dce76cd07c07e6f4fa2040b981662d311329a80921c039bfba0da5fed3ee53f8c36e34eeaa92af1c7b755 WHIRLPOOL e614b4af0f3c92113617f533255fd67a4b322bdaf0939fb98e09bf77e3b0437cb2b813032e33300e45294a60d5c3586a302669c28c293e180c775666cddc2581
+DIST wine-d3d9-2.7.tar.gz 48708 SHA256 df6ed1e50d8af0624b8f4f658705f75102094f6e17fec53ec8461991ce5dca2a SHA512 d258e81a942f905255a637aa80dd647878691caa79adc52fd79f66ce1320d42d7d36ea776876d6a26a2c711a168da4c64f27fa8744ca6d8318c5526f8a8af75a WHIRLPOOL 2d62cab5e3b14eaf29ecc96ac97555f48845a78c751040a850750d3b19fbc64efb3f3589dd3475a03cb1e3dff3e200528dabd2952b1ee8d0520a5db0d7db154b
+DIST wine-d3d9-2.8.tar.gz 48700 SHA256 c67de9fee6e97859896aa2326fbc245e8b0f7393a1c6341126607b03afebc964 SHA512 bb933b51d0022ce616331f2550faedeff3058007525b4519833b925c57999ab08b08380b8967d48ad7c56458e812342428388a5eac2ed8fcdd8cfbfee74a8e8c WHIRLPOOL 52c8538e3f4b3be3412ee544efebae69c3de781255e12298d544f47523aba3afaadbffa8dedc463c207b0ae8a0a92599beca17017f266648b9b229847990ae2e
+DIST wine-d3d9-2.9.tar.gz 48693 SHA256 32b847adf74c293e858800248aa1b164688f98cde89ca4d2cd0808fae7f94340 SHA512 89d06587481f7702b6884c83627a27c7b38a078e2b333bea2612a58840695211c19ab4ca02669c983580f95ae42ef114020f6b6bbb1a17d72449c0ed2212dc49 WHIRLPOOL e32b261f6e87580eec2c2ee57848b08b2487d1f280b8b257403e0722ec1b44cb31dcb240d89757599be2c3c6d958c48f92510bc625e5c05fc08116d13c303168
diff --git a/app-emulation/wine-d3d9/metadata.xml b/app-emulation/wine-d3d9/metadata.xml
new file mode 100644
index 0000000..44e32fc
--- /dev/null
+++ b/app-emulation/wine-d3d9/metadata.xml
@@ -0,0 +1,46 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="project">
+ <email>wine@gentoo.org</email>
+ <name>Wine</name>
+ </maintainer>
+ <maintainer type="person">
+ <email>commendsarnex@gmail.com</email>
+ <name>Nick Sarnie</name>
+ </maintainer>
+ <longdescription>
+Wine is an Open Source implementation of the Windows API on top of X and Unix.
+
+Think of Wine as a compatibility layer for running Windows programs. Wine does not require Microsoft Windows, as it is a completely free alternative implementation of the Windows API consisting of 100% non-Microsoft code, however Wine can optionally use native Windows DLLs if they are available. Wine provides both a development toolkit for porting Windows source code to Unix as well as a program loader, allowing many unmodified Windows programs to run on x86-based Unixes, including Linux, FreeBSD, and Solaris.
+
+This variant of the Wine packaging includes the Gallium Nine patchset.
+ </longdescription>
+ <use>
+ <flag name="capi">Enable ISDN support via CAPI</flag>
+ <flag name="custom-cflags">Bypass strip-flags; use at your own peril</flag>
+ <flag name="d3d9">Apply highly experimental patches for Gallium Nine support.
+ This patch may break some applications.</flag>
+ <flag name="dos">Pull in <pkg>games-emulation/dosbox</pkg> to run DOS applications</flag>
+ <flag name="gecko">Add support for the Gecko engine when using iexplore</flag>
+ <flag name="gstreamer">Use <pkg>media-libs/gstreamer</pkg> to provide DirectShow functionality;</flag>
+ <flag name="mono">Add support for .NET using Wine's Mono add-on</flag>
+ <flag name="netapi">Use libnetapi from <pkg>net-fs/samba</pkg> to support Windows networks in netapi32.dll</flag>
+ <flag name="opencl">Enable OpenCL support</flag>
+ <flag name="osmesa">Add support for OpenGL in bitmaps using libOSMesa</flag>
+ <flag name="pcap">Support packet capture software (e.g. wireshark)</flag>
+ <flag name="perl">Install helpers written in perl (winedump/winemaker)</flag>
+ <flag name="prelink">Run prelink on DLLs during build;
+ For versions before wine-1.7.55 or hardened, do not disable if you do not know what this means as it can break things at runtime</flag>
+ <flag name="realtime">Pull in <pkg>sys-auth/rtkit</pkg> for low-latency pulseaudio support</flag>
+ <flag name="run-exes">Use Wine to open and run .EXE and .MSI files</flag>
+ <flag name="samba">Add support for NTLM auth. see
+ http://wiki.winehq.org/NtlmAuthSetupGuide and
+ http://wiki.winehq.org/NtlmSigningAndSealing</flag>
+ <flag name="udev">Use <pkg>virtual/libudev</pkg> to provide plug and play support</flag>
+ </use>
+ <upstream>
+ <remote-id type="sourceforge">wine</remote-id>
+ <remote-id type="github">NP-Hardass/wine-desktop-common</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/app-emulation/wine-d3d9/wine-d3d9-2.0-r1.ebuild b/app-emulation/wine-d3d9/wine-d3d9-2.0-r1.ebuild
new file mode 100644
index 0000000..9f69437
--- /dev/null
+++ b/app-emulation/wine-d3d9/wine-d3d9-2.0-r1.ebuild
@@ -0,0 +1,570 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.0/${MY_P}.tar.bz2"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+D3D9_P="wine-d3d9-${PV}"
+D3D9_DIR="${WORKDIR}/wine-d3d9-patches-${D3D9_P}"
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, with Gallium Nine patchset"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+if [[ ${PV} == "9999" ]] ; then
+ D3D9_EGIT_REPO_URI="https://github.com/sarnex/wine-d3d9-patches.git"
+else
+ SRC_URI="${SRC_URI}
+ d3d9? ( https://github.com/sarnex/wine-d3d9-patches/archive/${D3D9_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags d3d9 dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap +png prelink pulseaudio +realtime +run-exes samba scanner selinux +ssl test +threads +truetype udev +udisks v4l +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ test? ( abi_x86_32 )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ d3d9? (
+ media-libs/mesa[d3d9,egl,${MULTILIB_USEDEP}]
+ x11-libs/libX11[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libxcb[${MULTILIB_USEDEP}]
+ )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.6.4 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use d3d9; then
+ eerror "Because of the multi-repo nature of ${MY_PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, and D3D9_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use d3d9; then
+ git-r3_fetch "${D3D9_EGIT_REPO_URI}" "${D3D9_COMMIT}"
+ git-r3_checkout "${D3D9_EGIT_REPO_URI}" "${D3D9_DIR}"
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ if use d3d9; then
+ PATCHES+=( "${D3D9_DIR}/d3d9-helper.patch" )
+ PATCHES+=( "${D3D9_DIR}/wine-d3d9.patch" )
+ fi
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use d3d9 && myconf+=( $(use_with d3d9 d3d9-nine) )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ else
+ if use d3d9; then
+ eselect wine register --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ else
+ if use d3d9; then
+ eselect wine deregister --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-d3d9/wine-d3d9-2.1-r1.ebuild b/app-emulation/wine-d3d9/wine-d3d9-2.1-r1.ebuild
new file mode 100644
index 0000000..e975492
--- /dev/null
+++ b/app-emulation/wine-d3d9/wine-d3d9-2.1-r1.ebuild
@@ -0,0 +1,570 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+D3D9_P="wine-d3d9-${PV}"
+D3D9_DIR="${WORKDIR}/wine-d3d9-patches-${D3D9_P}"
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, with Gallium Nine patchset"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+if [[ ${PV} == "9999" ]] ; then
+ D3D9_EGIT_REPO_URI="https://github.com/sarnex/wine-d3d9-patches.git"
+else
+ SRC_URI="${SRC_URI}
+ d3d9? ( https://github.com/sarnex/wine-d3d9-patches/archive/${D3D9_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags d3d9 dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap +png prelink pulseaudio +realtime +run-exes samba scanner selinux +ssl test +threads +truetype udev +udisks v4l +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ test? ( abi_x86_32 )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ d3d9? (
+ media-libs/mesa[d3d9,egl,${MULTILIB_USEDEP}]
+ x11-libs/libX11[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libxcb[${MULTILIB_USEDEP}]
+ )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.6.4 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use d3d9; then
+ eerror "Because of the multi-repo nature of ${MY_PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, and D3D9_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use d3d9; then
+ git-r3_fetch "${D3D9_EGIT_REPO_URI}" "${D3D9_COMMIT}"
+ git-r3_checkout "${D3D9_EGIT_REPO_URI}" "${D3D9_DIR}"
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ if use d3d9; then
+ PATCHES+=( "${D3D9_DIR}/d3d9-helper.patch" )
+ PATCHES+=( "${D3D9_DIR}/wine-d3d9.patch" )
+ fi
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use d3d9 && myconf+=( $(use_with d3d9 d3d9-nine) )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ else
+ if use d3d9; then
+ eselect wine register --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ else
+ if use d3d9; then
+ eselect wine deregister --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-d3d9/wine-d3d9-2.10-r1.ebuild b/app-emulation/wine-d3d9/wine-d3d9-2.10-r1.ebuild
new file mode 100644
index 0000000..71db470
--- /dev/null
+++ b/app-emulation/wine-d3d9/wine-d3d9-2.10-r1.ebuild
@@ -0,0 +1,572 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+D3D9_P="wine-d3d9-${PV}"
+D3D9_DIR="${WORKDIR}/wine-d3d9-patches-${D3D9_P}"
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, with Gallium Nine patchset"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+if [[ ${PV} == "9999" ]] ; then
+ D3D9_EGIT_REPO_URI="https://github.com/sarnex/wine-d3d9-patches.git"
+else
+ SRC_URI="${SRC_URI}
+ d3d9? ( https://github.com/sarnex/wine-d3d9-patches/archive/${D3D9_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags d3d9 dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap +png prelink pulseaudio +realtime +run-exes samba scanner selinux +ssl test +threads +truetype udev +udisks v4l +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ test? ( abi_x86_32 )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXfixes[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ d3d9? (
+ media-libs/mesa[d3d9,egl,${MULTILIB_USEDEP}]
+ x11-libs/libX11[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libxcb[${MULTILIB_USEDEP}]
+ )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.0 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use d3d9; then
+ eerror "Because of the multi-repo nature of ${MY_PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, and D3D9_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use d3d9; then
+ git-r3_fetch "${D3D9_EGIT_REPO_URI}" "${D3D9_COMMIT}"
+ git-r3_checkout "${D3D9_EGIT_REPO_URI}" "${D3D9_DIR}"
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ if use d3d9; then
+ PATCHES+=( "${D3D9_DIR}/d3d9-helper.patch" )
+ PATCHES+=( "${D3D9_DIR}/wine-d3d9.patch" )
+ fi
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with X xfixes)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use d3d9 && myconf+=( $(use_with d3d9 d3d9-nine) )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ else
+ if use d3d9; then
+ eselect wine register --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ else
+ if use d3d9; then
+ eselect wine deregister --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-d3d9/wine-d3d9-2.11-r1.ebuild b/app-emulation/wine-d3d9/wine-d3d9-2.11-r1.ebuild
new file mode 100644
index 0000000..71db470
--- /dev/null
+++ b/app-emulation/wine-d3d9/wine-d3d9-2.11-r1.ebuild
@@ -0,0 +1,572 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+D3D9_P="wine-d3d9-${PV}"
+D3D9_DIR="${WORKDIR}/wine-d3d9-patches-${D3D9_P}"
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, with Gallium Nine patchset"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+if [[ ${PV} == "9999" ]] ; then
+ D3D9_EGIT_REPO_URI="https://github.com/sarnex/wine-d3d9-patches.git"
+else
+ SRC_URI="${SRC_URI}
+ d3d9? ( https://github.com/sarnex/wine-d3d9-patches/archive/${D3D9_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags d3d9 dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap +png prelink pulseaudio +realtime +run-exes samba scanner selinux +ssl test +threads +truetype udev +udisks v4l +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ test? ( abi_x86_32 )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXfixes[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ d3d9? (
+ media-libs/mesa[d3d9,egl,${MULTILIB_USEDEP}]
+ x11-libs/libX11[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libxcb[${MULTILIB_USEDEP}]
+ )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.0 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use d3d9; then
+ eerror "Because of the multi-repo nature of ${MY_PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, and D3D9_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use d3d9; then
+ git-r3_fetch "${D3D9_EGIT_REPO_URI}" "${D3D9_COMMIT}"
+ git-r3_checkout "${D3D9_EGIT_REPO_URI}" "${D3D9_DIR}"
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ if use d3d9; then
+ PATCHES+=( "${D3D9_DIR}/d3d9-helper.patch" )
+ PATCHES+=( "${D3D9_DIR}/wine-d3d9.patch" )
+ fi
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with X xfixes)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use d3d9 && myconf+=( $(use_with d3d9 d3d9-nine) )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ else
+ if use d3d9; then
+ eselect wine register --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ else
+ if use d3d9; then
+ eselect wine deregister --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-d3d9/wine-d3d9-2.12-r1.ebuild b/app-emulation/wine-d3d9/wine-d3d9-2.12-r1.ebuild
new file mode 100644
index 0000000..71db470
--- /dev/null
+++ b/app-emulation/wine-d3d9/wine-d3d9-2.12-r1.ebuild
@@ -0,0 +1,572 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+D3D9_P="wine-d3d9-${PV}"
+D3D9_DIR="${WORKDIR}/wine-d3d9-patches-${D3D9_P}"
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, with Gallium Nine patchset"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+if [[ ${PV} == "9999" ]] ; then
+ D3D9_EGIT_REPO_URI="https://github.com/sarnex/wine-d3d9-patches.git"
+else
+ SRC_URI="${SRC_URI}
+ d3d9? ( https://github.com/sarnex/wine-d3d9-patches/archive/${D3D9_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags d3d9 dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap +png prelink pulseaudio +realtime +run-exes samba scanner selinux +ssl test +threads +truetype udev +udisks v4l +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ test? ( abi_x86_32 )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXfixes[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ d3d9? (
+ media-libs/mesa[d3d9,egl,${MULTILIB_USEDEP}]
+ x11-libs/libX11[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libxcb[${MULTILIB_USEDEP}]
+ )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.0 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use d3d9; then
+ eerror "Because of the multi-repo nature of ${MY_PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, and D3D9_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use d3d9; then
+ git-r3_fetch "${D3D9_EGIT_REPO_URI}" "${D3D9_COMMIT}"
+ git-r3_checkout "${D3D9_EGIT_REPO_URI}" "${D3D9_DIR}"
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ if use d3d9; then
+ PATCHES+=( "${D3D9_DIR}/d3d9-helper.patch" )
+ PATCHES+=( "${D3D9_DIR}/wine-d3d9.patch" )
+ fi
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with X xfixes)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use d3d9 && myconf+=( $(use_with d3d9 d3d9-nine) )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ else
+ if use d3d9; then
+ eselect wine register --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ else
+ if use d3d9; then
+ eselect wine deregister --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-d3d9/wine-d3d9-2.13-r1.ebuild b/app-emulation/wine-d3d9/wine-d3d9-2.13-r1.ebuild
new file mode 100644
index 0000000..71db470
--- /dev/null
+++ b/app-emulation/wine-d3d9/wine-d3d9-2.13-r1.ebuild
@@ -0,0 +1,572 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+D3D9_P="wine-d3d9-${PV}"
+D3D9_DIR="${WORKDIR}/wine-d3d9-patches-${D3D9_P}"
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, with Gallium Nine patchset"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+if [[ ${PV} == "9999" ]] ; then
+ D3D9_EGIT_REPO_URI="https://github.com/sarnex/wine-d3d9-patches.git"
+else
+ SRC_URI="${SRC_URI}
+ d3d9? ( https://github.com/sarnex/wine-d3d9-patches/archive/${D3D9_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags d3d9 dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap +png prelink pulseaudio +realtime +run-exes samba scanner selinux +ssl test +threads +truetype udev +udisks v4l +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ test? ( abi_x86_32 )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXfixes[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ d3d9? (
+ media-libs/mesa[d3d9,egl,${MULTILIB_USEDEP}]
+ x11-libs/libX11[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libxcb[${MULTILIB_USEDEP}]
+ )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.0 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use d3d9; then
+ eerror "Because of the multi-repo nature of ${MY_PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, and D3D9_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use d3d9; then
+ git-r3_fetch "${D3D9_EGIT_REPO_URI}" "${D3D9_COMMIT}"
+ git-r3_checkout "${D3D9_EGIT_REPO_URI}" "${D3D9_DIR}"
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ if use d3d9; then
+ PATCHES+=( "${D3D9_DIR}/d3d9-helper.patch" )
+ PATCHES+=( "${D3D9_DIR}/wine-d3d9.patch" )
+ fi
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with X xfixes)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use d3d9 && myconf+=( $(use_with d3d9 d3d9-nine) )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ else
+ if use d3d9; then
+ eselect wine register --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ else
+ if use d3d9; then
+ eselect wine deregister --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-d3d9/wine-d3d9-2.14-r1.ebuild b/app-emulation/wine-d3d9/wine-d3d9-2.14-r1.ebuild
new file mode 100644
index 0000000..c3bf9b8
--- /dev/null
+++ b/app-emulation/wine-d3d9/wine-d3d9-2.14-r1.ebuild
@@ -0,0 +1,572 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+D3D9_P="wine-d3d9-${PV}"
+D3D9_DIR="${WORKDIR}/wine-d3d9-patches-${D3D9_P}"
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, with Gallium Nine patchset"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+if [[ ${PV} == "9999" ]] ; then
+ D3D9_EGIT_REPO_URI="https://github.com/sarnex/wine-d3d9-patches.git"
+else
+ SRC_URI="${SRC_URI}
+ d3d9? ( https://github.com/sarnex/wine-d3d9-patches/archive/${D3D9_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags d3d9 dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap +png prelink pulseaudio +realtime +run-exes samba scanner selinux +ssl test +threads +truetype udev +udisks v4l +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ test? ( abi_x86_32 )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXfixes[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ d3d9? (
+ media-libs/mesa[d3d9,egl,${MULTILIB_USEDEP}]
+ x11-libs/libX11[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libxcb[${MULTILIB_USEDEP}]
+ )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.1 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use d3d9; then
+ eerror "Because of the multi-repo nature of ${MY_PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, and D3D9_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use d3d9; then
+ git-r3_fetch "${D3D9_EGIT_REPO_URI}" "${D3D9_COMMIT}"
+ git-r3_checkout "${D3D9_EGIT_REPO_URI}" "${D3D9_DIR}"
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ if use d3d9; then
+ PATCHES+=( "${D3D9_DIR}/d3d9-helper.patch" )
+ PATCHES+=( "${D3D9_DIR}/wine-d3d9.patch" )
+ fi
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with X xfixes)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use d3d9 && myconf+=( $(use_with d3d9 d3d9-nine) )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ else
+ if use d3d9; then
+ eselect wine register --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ else
+ if use d3d9; then
+ eselect wine deregister --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-d3d9/wine-d3d9-2.15-r1.ebuild b/app-emulation/wine-d3d9/wine-d3d9-2.15-r1.ebuild
new file mode 100644
index 0000000..c3bf9b8
--- /dev/null
+++ b/app-emulation/wine-d3d9/wine-d3d9-2.15-r1.ebuild
@@ -0,0 +1,572 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+D3D9_P="wine-d3d9-${PV}"
+D3D9_DIR="${WORKDIR}/wine-d3d9-patches-${D3D9_P}"
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, with Gallium Nine patchset"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+if [[ ${PV} == "9999" ]] ; then
+ D3D9_EGIT_REPO_URI="https://github.com/sarnex/wine-d3d9-patches.git"
+else
+ SRC_URI="${SRC_URI}
+ d3d9? ( https://github.com/sarnex/wine-d3d9-patches/archive/${D3D9_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags d3d9 dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap +png prelink pulseaudio +realtime +run-exes samba scanner selinux +ssl test +threads +truetype udev +udisks v4l +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ test? ( abi_x86_32 )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXfixes[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ d3d9? (
+ media-libs/mesa[d3d9,egl,${MULTILIB_USEDEP}]
+ x11-libs/libX11[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libxcb[${MULTILIB_USEDEP}]
+ )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.1 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use d3d9; then
+ eerror "Because of the multi-repo nature of ${MY_PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, and D3D9_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use d3d9; then
+ git-r3_fetch "${D3D9_EGIT_REPO_URI}" "${D3D9_COMMIT}"
+ git-r3_checkout "${D3D9_EGIT_REPO_URI}" "${D3D9_DIR}"
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ if use d3d9; then
+ PATCHES+=( "${D3D9_DIR}/d3d9-helper.patch" )
+ PATCHES+=( "${D3D9_DIR}/wine-d3d9.patch" )
+ fi
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with X xfixes)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use d3d9 && myconf+=( $(use_with d3d9 d3d9-nine) )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ else
+ if use d3d9; then
+ eselect wine register --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ else
+ if use d3d9; then
+ eselect wine deregister --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-d3d9/wine-d3d9-2.16-r1.ebuild b/app-emulation/wine-d3d9/wine-d3d9-2.16-r1.ebuild
new file mode 100644
index 0000000..c3bf9b8
--- /dev/null
+++ b/app-emulation/wine-d3d9/wine-d3d9-2.16-r1.ebuild
@@ -0,0 +1,572 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+D3D9_P="wine-d3d9-${PV}"
+D3D9_DIR="${WORKDIR}/wine-d3d9-patches-${D3D9_P}"
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, with Gallium Nine patchset"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+if [[ ${PV} == "9999" ]] ; then
+ D3D9_EGIT_REPO_URI="https://github.com/sarnex/wine-d3d9-patches.git"
+else
+ SRC_URI="${SRC_URI}
+ d3d9? ( https://github.com/sarnex/wine-d3d9-patches/archive/${D3D9_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags d3d9 dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap +png prelink pulseaudio +realtime +run-exes samba scanner selinux +ssl test +threads +truetype udev +udisks v4l +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ test? ( abi_x86_32 )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXfixes[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ d3d9? (
+ media-libs/mesa[d3d9,egl,${MULTILIB_USEDEP}]
+ x11-libs/libX11[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libxcb[${MULTILIB_USEDEP}]
+ )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.1 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use d3d9; then
+ eerror "Because of the multi-repo nature of ${MY_PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, and D3D9_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use d3d9; then
+ git-r3_fetch "${D3D9_EGIT_REPO_URI}" "${D3D9_COMMIT}"
+ git-r3_checkout "${D3D9_EGIT_REPO_URI}" "${D3D9_DIR}"
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ if use d3d9; then
+ PATCHES+=( "${D3D9_DIR}/d3d9-helper.patch" )
+ PATCHES+=( "${D3D9_DIR}/wine-d3d9.patch" )
+ fi
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with X xfixes)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use d3d9 && myconf+=( $(use_with d3d9 d3d9-nine) )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ else
+ if use d3d9; then
+ eselect wine register --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ else
+ if use d3d9; then
+ eselect wine deregister --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-d3d9/wine-d3d9-2.17-r1.ebuild b/app-emulation/wine-d3d9/wine-d3d9-2.17-r1.ebuild
new file mode 100644
index 0000000..c3bf9b8
--- /dev/null
+++ b/app-emulation/wine-d3d9/wine-d3d9-2.17-r1.ebuild
@@ -0,0 +1,572 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+D3D9_P="wine-d3d9-${PV}"
+D3D9_DIR="${WORKDIR}/wine-d3d9-patches-${D3D9_P}"
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, with Gallium Nine patchset"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+if [[ ${PV} == "9999" ]] ; then
+ D3D9_EGIT_REPO_URI="https://github.com/sarnex/wine-d3d9-patches.git"
+else
+ SRC_URI="${SRC_URI}
+ d3d9? ( https://github.com/sarnex/wine-d3d9-patches/archive/${D3D9_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags d3d9 dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap +png prelink pulseaudio +realtime +run-exes samba scanner selinux +ssl test +threads +truetype udev +udisks v4l +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ test? ( abi_x86_32 )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXfixes[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ d3d9? (
+ media-libs/mesa[d3d9,egl,${MULTILIB_USEDEP}]
+ x11-libs/libX11[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libxcb[${MULTILIB_USEDEP}]
+ )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.1 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use d3d9; then
+ eerror "Because of the multi-repo nature of ${MY_PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, and D3D9_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use d3d9; then
+ git-r3_fetch "${D3D9_EGIT_REPO_URI}" "${D3D9_COMMIT}"
+ git-r3_checkout "${D3D9_EGIT_REPO_URI}" "${D3D9_DIR}"
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ if use d3d9; then
+ PATCHES+=( "${D3D9_DIR}/d3d9-helper.patch" )
+ PATCHES+=( "${D3D9_DIR}/wine-d3d9.patch" )
+ fi
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with X xfixes)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use d3d9 && myconf+=( $(use_with d3d9 d3d9-nine) )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ else
+ if use d3d9; then
+ eselect wine register --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ else
+ if use d3d9; then
+ eselect wine deregister --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-d3d9/wine-d3d9-2.18.ebuild b/app-emulation/wine-d3d9/wine-d3d9-2.18.ebuild
new file mode 100644
index 0000000..ec6c3d6
--- /dev/null
+++ b/app-emulation/wine-d3d9/wine-d3d9-2.18.ebuild
@@ -0,0 +1,568 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+D3D9_P="wine-d3d9-${PV}"
+D3D9_DIR="${WORKDIR}/wine-d3d9-patches-${D3D9_P}"
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, with Gallium Nine patchset"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+if [[ ${PV} == "9999" ]] ; then
+ D3D9_EGIT_REPO_URI="https://github.com/sarnex/wine-d3d9-patches.git"
+else
+ SRC_URI="${SRC_URI}
+ d3d9? ( https://github.com/sarnex/wine-d3d9-patches/archive/${D3D9_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags d3d9 dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap +png prelink pulseaudio +realtime +run-exes samba scanner selinux +ssl test +threads +truetype udev +udisks v4l +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ test? ( abi_x86_32 )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXfixes[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ d3d9? (
+ media-libs/mesa[d3d9,egl,${MULTILIB_USEDEP}]
+ x11-libs/libX11[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libxcb[${MULTILIB_USEDEP}]
+ )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.1 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+)
+PATCHES_BIN=()
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use d3d9; then
+ eerror "Because of the multi-repo nature of ${MY_PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, and D3D9_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use d3d9; then
+ git-r3_fetch "${D3D9_EGIT_REPO_URI}" "${D3D9_COMMIT}"
+ git-r3_checkout "${D3D9_EGIT_REPO_URI}" "${D3D9_DIR}"
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ if use d3d9; then
+ PATCHES+=( "${D3D9_DIR}/d3d9-helper.patch" )
+ PATCHES+=( "${D3D9_DIR}/wine-d3d9.patch" )
+ fi
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with X xfixes)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use d3d9 && myconf+=( $(use_with d3d9 d3d9-nine) )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ else
+ if use d3d9; then
+ eselect wine register --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ else
+ if use d3d9; then
+ eselect wine deregister --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-d3d9/wine-d3d9-2.19.ebuild b/app-emulation/wine-d3d9/wine-d3d9-2.19.ebuild
new file mode 100644
index 0000000..ec6c3d6
--- /dev/null
+++ b/app-emulation/wine-d3d9/wine-d3d9-2.19.ebuild
@@ -0,0 +1,568 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+D3D9_P="wine-d3d9-${PV}"
+D3D9_DIR="${WORKDIR}/wine-d3d9-patches-${D3D9_P}"
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, with Gallium Nine patchset"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+if [[ ${PV} == "9999" ]] ; then
+ D3D9_EGIT_REPO_URI="https://github.com/sarnex/wine-d3d9-patches.git"
+else
+ SRC_URI="${SRC_URI}
+ d3d9? ( https://github.com/sarnex/wine-d3d9-patches/archive/${D3D9_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags d3d9 dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap +png prelink pulseaudio +realtime +run-exes samba scanner selinux +ssl test +threads +truetype udev +udisks v4l +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ test? ( abi_x86_32 )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXfixes[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ d3d9? (
+ media-libs/mesa[d3d9,egl,${MULTILIB_USEDEP}]
+ x11-libs/libX11[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libxcb[${MULTILIB_USEDEP}]
+ )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.1 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+)
+PATCHES_BIN=()
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use d3d9; then
+ eerror "Because of the multi-repo nature of ${MY_PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, and D3D9_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use d3d9; then
+ git-r3_fetch "${D3D9_EGIT_REPO_URI}" "${D3D9_COMMIT}"
+ git-r3_checkout "${D3D9_EGIT_REPO_URI}" "${D3D9_DIR}"
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ if use d3d9; then
+ PATCHES+=( "${D3D9_DIR}/d3d9-helper.patch" )
+ PATCHES+=( "${D3D9_DIR}/wine-d3d9.patch" )
+ fi
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with X xfixes)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use d3d9 && myconf+=( $(use_with d3d9 d3d9-nine) )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ else
+ if use d3d9; then
+ eselect wine register --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ else
+ if use d3d9; then
+ eselect wine deregister --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-d3d9/wine-d3d9-2.2-r1.ebuild b/app-emulation/wine-d3d9/wine-d3d9-2.2-r1.ebuild
new file mode 100644
index 0000000..e975492
--- /dev/null
+++ b/app-emulation/wine-d3d9/wine-d3d9-2.2-r1.ebuild
@@ -0,0 +1,570 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+D3D9_P="wine-d3d9-${PV}"
+D3D9_DIR="${WORKDIR}/wine-d3d9-patches-${D3D9_P}"
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, with Gallium Nine patchset"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+if [[ ${PV} == "9999" ]] ; then
+ D3D9_EGIT_REPO_URI="https://github.com/sarnex/wine-d3d9-patches.git"
+else
+ SRC_URI="${SRC_URI}
+ d3d9? ( https://github.com/sarnex/wine-d3d9-patches/archive/${D3D9_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags d3d9 dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap +png prelink pulseaudio +realtime +run-exes samba scanner selinux +ssl test +threads +truetype udev +udisks v4l +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ test? ( abi_x86_32 )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ d3d9? (
+ media-libs/mesa[d3d9,egl,${MULTILIB_USEDEP}]
+ x11-libs/libX11[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libxcb[${MULTILIB_USEDEP}]
+ )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.6.4 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use d3d9; then
+ eerror "Because of the multi-repo nature of ${MY_PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, and D3D9_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use d3d9; then
+ git-r3_fetch "${D3D9_EGIT_REPO_URI}" "${D3D9_COMMIT}"
+ git-r3_checkout "${D3D9_EGIT_REPO_URI}" "${D3D9_DIR}"
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ if use d3d9; then
+ PATCHES+=( "${D3D9_DIR}/d3d9-helper.patch" )
+ PATCHES+=( "${D3D9_DIR}/wine-d3d9.patch" )
+ fi
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use d3d9 && myconf+=( $(use_with d3d9 d3d9-nine) )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ else
+ if use d3d9; then
+ eselect wine register --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ else
+ if use d3d9; then
+ eselect wine deregister --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-d3d9/wine-d3d9-2.3-r1.ebuild b/app-emulation/wine-d3d9/wine-d3d9-2.3-r1.ebuild
new file mode 100644
index 0000000..e975492
--- /dev/null
+++ b/app-emulation/wine-d3d9/wine-d3d9-2.3-r1.ebuild
@@ -0,0 +1,570 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+D3D9_P="wine-d3d9-${PV}"
+D3D9_DIR="${WORKDIR}/wine-d3d9-patches-${D3D9_P}"
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, with Gallium Nine patchset"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+if [[ ${PV} == "9999" ]] ; then
+ D3D9_EGIT_REPO_URI="https://github.com/sarnex/wine-d3d9-patches.git"
+else
+ SRC_URI="${SRC_URI}
+ d3d9? ( https://github.com/sarnex/wine-d3d9-patches/archive/${D3D9_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags d3d9 dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap +png prelink pulseaudio +realtime +run-exes samba scanner selinux +ssl test +threads +truetype udev +udisks v4l +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ test? ( abi_x86_32 )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ d3d9? (
+ media-libs/mesa[d3d9,egl,${MULTILIB_USEDEP}]
+ x11-libs/libX11[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libxcb[${MULTILIB_USEDEP}]
+ )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.6.4 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use d3d9; then
+ eerror "Because of the multi-repo nature of ${MY_PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, and D3D9_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use d3d9; then
+ git-r3_fetch "${D3D9_EGIT_REPO_URI}" "${D3D9_COMMIT}"
+ git-r3_checkout "${D3D9_EGIT_REPO_URI}" "${D3D9_DIR}"
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ if use d3d9; then
+ PATCHES+=( "${D3D9_DIR}/d3d9-helper.patch" )
+ PATCHES+=( "${D3D9_DIR}/wine-d3d9.patch" )
+ fi
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use d3d9 && myconf+=( $(use_with d3d9 d3d9-nine) )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ else
+ if use d3d9; then
+ eselect wine register --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ else
+ if use d3d9; then
+ eselect wine deregister --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-d3d9/wine-d3d9-2.4-r1.ebuild b/app-emulation/wine-d3d9/wine-d3d9-2.4-r1.ebuild
new file mode 100644
index 0000000..6f8a34c
--- /dev/null
+++ b/app-emulation/wine-d3d9/wine-d3d9-2.4-r1.ebuild
@@ -0,0 +1,570 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+D3D9_P="wine-d3d9-${PV}"
+D3D9_DIR="${WORKDIR}/wine-d3d9-patches-${D3D9_P}"
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, with Gallium Nine patchset"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+if [[ ${PV} == "9999" ]] ; then
+ D3D9_EGIT_REPO_URI="https://github.com/sarnex/wine-d3d9-patches.git"
+else
+ SRC_URI="${SRC_URI}
+ d3d9? ( https://github.com/sarnex/wine-d3d9-patches/archive/${D3D9_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags d3d9 dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap +png prelink pulseaudio +realtime +run-exes samba scanner selinux +ssl test +threads +truetype udev +udisks v4l +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ test? ( abi_x86_32 )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ d3d9? (
+ media-libs/mesa[d3d9,egl,${MULTILIB_USEDEP}]
+ x11-libs/libX11[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libxcb[${MULTILIB_USEDEP}]
+ )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.0 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use d3d9; then
+ eerror "Because of the multi-repo nature of ${MY_PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, and D3D9_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use d3d9; then
+ git-r3_fetch "${D3D9_EGIT_REPO_URI}" "${D3D9_COMMIT}"
+ git-r3_checkout "${D3D9_EGIT_REPO_URI}" "${D3D9_DIR}"
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ if use d3d9; then
+ PATCHES+=( "${D3D9_DIR}/d3d9-helper.patch" )
+ PATCHES+=( "${D3D9_DIR}/wine-d3d9.patch" )
+ fi
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use d3d9 && myconf+=( $(use_with d3d9 d3d9-nine) )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ else
+ if use d3d9; then
+ eselect wine register --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ else
+ if use d3d9; then
+ eselect wine deregister --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-d3d9/wine-d3d9-2.5-r1.ebuild b/app-emulation/wine-d3d9/wine-d3d9-2.5-r1.ebuild
new file mode 100644
index 0000000..6f8a34c
--- /dev/null
+++ b/app-emulation/wine-d3d9/wine-d3d9-2.5-r1.ebuild
@@ -0,0 +1,570 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+D3D9_P="wine-d3d9-${PV}"
+D3D9_DIR="${WORKDIR}/wine-d3d9-patches-${D3D9_P}"
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, with Gallium Nine patchset"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+if [[ ${PV} == "9999" ]] ; then
+ D3D9_EGIT_REPO_URI="https://github.com/sarnex/wine-d3d9-patches.git"
+else
+ SRC_URI="${SRC_URI}
+ d3d9? ( https://github.com/sarnex/wine-d3d9-patches/archive/${D3D9_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags d3d9 dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap +png prelink pulseaudio +realtime +run-exes samba scanner selinux +ssl test +threads +truetype udev +udisks v4l +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ test? ( abi_x86_32 )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ d3d9? (
+ media-libs/mesa[d3d9,egl,${MULTILIB_USEDEP}]
+ x11-libs/libX11[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libxcb[${MULTILIB_USEDEP}]
+ )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.0 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use d3d9; then
+ eerror "Because of the multi-repo nature of ${MY_PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, and D3D9_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use d3d9; then
+ git-r3_fetch "${D3D9_EGIT_REPO_URI}" "${D3D9_COMMIT}"
+ git-r3_checkout "${D3D9_EGIT_REPO_URI}" "${D3D9_DIR}"
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ if use d3d9; then
+ PATCHES+=( "${D3D9_DIR}/d3d9-helper.patch" )
+ PATCHES+=( "${D3D9_DIR}/wine-d3d9.patch" )
+ fi
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use d3d9 && myconf+=( $(use_with d3d9 d3d9-nine) )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ else
+ if use d3d9; then
+ eselect wine register --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ else
+ if use d3d9; then
+ eselect wine deregister --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-d3d9/wine-d3d9-2.6-r1.ebuild b/app-emulation/wine-d3d9/wine-d3d9-2.6-r1.ebuild
new file mode 100644
index 0000000..6f8a34c
--- /dev/null
+++ b/app-emulation/wine-d3d9/wine-d3d9-2.6-r1.ebuild
@@ -0,0 +1,570 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+D3D9_P="wine-d3d9-${PV}"
+D3D9_DIR="${WORKDIR}/wine-d3d9-patches-${D3D9_P}"
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, with Gallium Nine patchset"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+if [[ ${PV} == "9999" ]] ; then
+ D3D9_EGIT_REPO_URI="https://github.com/sarnex/wine-d3d9-patches.git"
+else
+ SRC_URI="${SRC_URI}
+ d3d9? ( https://github.com/sarnex/wine-d3d9-patches/archive/${D3D9_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags d3d9 dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap +png prelink pulseaudio +realtime +run-exes samba scanner selinux +ssl test +threads +truetype udev +udisks v4l +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ test? ( abi_x86_32 )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ d3d9? (
+ media-libs/mesa[d3d9,egl,${MULTILIB_USEDEP}]
+ x11-libs/libX11[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libxcb[${MULTILIB_USEDEP}]
+ )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.0 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use d3d9; then
+ eerror "Because of the multi-repo nature of ${MY_PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, and D3D9_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use d3d9; then
+ git-r3_fetch "${D3D9_EGIT_REPO_URI}" "${D3D9_COMMIT}"
+ git-r3_checkout "${D3D9_EGIT_REPO_URI}" "${D3D9_DIR}"
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ if use d3d9; then
+ PATCHES+=( "${D3D9_DIR}/d3d9-helper.patch" )
+ PATCHES+=( "${D3D9_DIR}/wine-d3d9.patch" )
+ fi
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use d3d9 && myconf+=( $(use_with d3d9 d3d9-nine) )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ else
+ if use d3d9; then
+ eselect wine register --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ else
+ if use d3d9; then
+ eselect wine deregister --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-d3d9/wine-d3d9-2.7-r1.ebuild b/app-emulation/wine-d3d9/wine-d3d9-2.7-r1.ebuild
new file mode 100644
index 0000000..6f8a34c
--- /dev/null
+++ b/app-emulation/wine-d3d9/wine-d3d9-2.7-r1.ebuild
@@ -0,0 +1,570 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+D3D9_P="wine-d3d9-${PV}"
+D3D9_DIR="${WORKDIR}/wine-d3d9-patches-${D3D9_P}"
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, with Gallium Nine patchset"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+if [[ ${PV} == "9999" ]] ; then
+ D3D9_EGIT_REPO_URI="https://github.com/sarnex/wine-d3d9-patches.git"
+else
+ SRC_URI="${SRC_URI}
+ d3d9? ( https://github.com/sarnex/wine-d3d9-patches/archive/${D3D9_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags d3d9 dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap +png prelink pulseaudio +realtime +run-exes samba scanner selinux +ssl test +threads +truetype udev +udisks v4l +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ test? ( abi_x86_32 )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ d3d9? (
+ media-libs/mesa[d3d9,egl,${MULTILIB_USEDEP}]
+ x11-libs/libX11[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libxcb[${MULTILIB_USEDEP}]
+ )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.0 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use d3d9; then
+ eerror "Because of the multi-repo nature of ${MY_PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, and D3D9_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use d3d9; then
+ git-r3_fetch "${D3D9_EGIT_REPO_URI}" "${D3D9_COMMIT}"
+ git-r3_checkout "${D3D9_EGIT_REPO_URI}" "${D3D9_DIR}"
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ if use d3d9; then
+ PATCHES+=( "${D3D9_DIR}/d3d9-helper.patch" )
+ PATCHES+=( "${D3D9_DIR}/wine-d3d9.patch" )
+ fi
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use d3d9 && myconf+=( $(use_with d3d9 d3d9-nine) )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ else
+ if use d3d9; then
+ eselect wine register --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ else
+ if use d3d9; then
+ eselect wine deregister --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-d3d9/wine-d3d9-2.8-r1.ebuild b/app-emulation/wine-d3d9/wine-d3d9-2.8-r1.ebuild
new file mode 100644
index 0000000..6f8a34c
--- /dev/null
+++ b/app-emulation/wine-d3d9/wine-d3d9-2.8-r1.ebuild
@@ -0,0 +1,570 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+D3D9_P="wine-d3d9-${PV}"
+D3D9_DIR="${WORKDIR}/wine-d3d9-patches-${D3D9_P}"
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, with Gallium Nine patchset"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+if [[ ${PV} == "9999" ]] ; then
+ D3D9_EGIT_REPO_URI="https://github.com/sarnex/wine-d3d9-patches.git"
+else
+ SRC_URI="${SRC_URI}
+ d3d9? ( https://github.com/sarnex/wine-d3d9-patches/archive/${D3D9_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags d3d9 dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap +png prelink pulseaudio +realtime +run-exes samba scanner selinux +ssl test +threads +truetype udev +udisks v4l +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ test? ( abi_x86_32 )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ d3d9? (
+ media-libs/mesa[d3d9,egl,${MULTILIB_USEDEP}]
+ x11-libs/libX11[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libxcb[${MULTILIB_USEDEP}]
+ )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.0 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use d3d9; then
+ eerror "Because of the multi-repo nature of ${MY_PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, and D3D9_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use d3d9; then
+ git-r3_fetch "${D3D9_EGIT_REPO_URI}" "${D3D9_COMMIT}"
+ git-r3_checkout "${D3D9_EGIT_REPO_URI}" "${D3D9_DIR}"
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ if use d3d9; then
+ PATCHES+=( "${D3D9_DIR}/d3d9-helper.patch" )
+ PATCHES+=( "${D3D9_DIR}/wine-d3d9.patch" )
+ fi
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use d3d9 && myconf+=( $(use_with d3d9 d3d9-nine) )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ else
+ if use d3d9; then
+ eselect wine register --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ else
+ if use d3d9; then
+ eselect wine deregister --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-d3d9/wine-d3d9-2.9-r1.ebuild b/app-emulation/wine-d3d9/wine-d3d9-2.9-r1.ebuild
new file mode 100644
index 0000000..71db470
--- /dev/null
+++ b/app-emulation/wine-d3d9/wine-d3d9-2.9-r1.ebuild
@@ -0,0 +1,572 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+D3D9_P="wine-d3d9-${PV}"
+D3D9_DIR="${WORKDIR}/wine-d3d9-patches-${D3D9_P}"
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, with Gallium Nine patchset"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+if [[ ${PV} == "9999" ]] ; then
+ D3D9_EGIT_REPO_URI="https://github.com/sarnex/wine-d3d9-patches.git"
+else
+ SRC_URI="${SRC_URI}
+ d3d9? ( https://github.com/sarnex/wine-d3d9-patches/archive/${D3D9_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags d3d9 dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap +png prelink pulseaudio +realtime +run-exes samba scanner selinux +ssl test +threads +truetype udev +udisks v4l +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ test? ( abi_x86_32 )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXfixes[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ d3d9? (
+ media-libs/mesa[d3d9,egl,${MULTILIB_USEDEP}]
+ x11-libs/libX11[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libxcb[${MULTILIB_USEDEP}]
+ )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.0 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use d3d9; then
+ eerror "Because of the multi-repo nature of ${MY_PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, and D3D9_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use d3d9; then
+ git-r3_fetch "${D3D9_EGIT_REPO_URI}" "${D3D9_COMMIT}"
+ git-r3_checkout "${D3D9_EGIT_REPO_URI}" "${D3D9_DIR}"
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ if use d3d9; then
+ PATCHES+=( "${D3D9_DIR}/d3d9-helper.patch" )
+ PATCHES+=( "${D3D9_DIR}/wine-d3d9.patch" )
+ fi
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with X xfixes)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use d3d9 && myconf+=( $(use_with d3d9 d3d9-nine) )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ else
+ if use d3d9; then
+ eselect wine register --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ else
+ if use d3d9; then
+ eselect wine deregister --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-d3d9/wine-d3d9-9999.ebuild b/app-emulation/wine-d3d9/wine-d3d9-9999.ebuild
new file mode 100644
index 0000000..ec6c3d6
--- /dev/null
+++ b/app-emulation/wine-d3d9/wine-d3d9-9999.ebuild
@@ -0,0 +1,568 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+D3D9_P="wine-d3d9-${PV}"
+D3D9_DIR="${WORKDIR}/wine-d3d9-patches-${D3D9_P}"
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, with Gallium Nine patchset"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+if [[ ${PV} == "9999" ]] ; then
+ D3D9_EGIT_REPO_URI="https://github.com/sarnex/wine-d3d9-patches.git"
+else
+ SRC_URI="${SRC_URI}
+ d3d9? ( https://github.com/sarnex/wine-d3d9-patches/archive/${D3D9_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags d3d9 dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap +png prelink pulseaudio +realtime +run-exes samba scanner selinux +ssl test +threads +truetype udev +udisks v4l +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ test? ( abi_x86_32 )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXfixes[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ d3d9? (
+ media-libs/mesa[d3d9,egl,${MULTILIB_USEDEP}]
+ x11-libs/libX11[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libxcb[${MULTILIB_USEDEP}]
+ )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.1 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+)
+PATCHES_BIN=()
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use d3d9; then
+ eerror "Because of the multi-repo nature of ${MY_PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, and D3D9_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use d3d9; then
+ git-r3_fetch "${D3D9_EGIT_REPO_URI}" "${D3D9_COMMIT}"
+ git-r3_checkout "${D3D9_EGIT_REPO_URI}" "${D3D9_DIR}"
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ if use d3d9; then
+ PATCHES+=( "${D3D9_DIR}/d3d9-helper.patch" )
+ PATCHES+=( "${D3D9_DIR}/wine-d3d9.patch" )
+ fi
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with X xfixes)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use d3d9 && myconf+=( $(use_with d3d9 d3d9-nine) )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ else
+ if use d3d9; then
+ eselect wine register --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ else
+ if use d3d9; then
+ eselect wine deregister --d3d9 ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-desktop-common/Manifest b/app-emulation/wine-desktop-common/Manifest
new file mode 100644
index 0000000..e51e126
--- /dev/null
+++ b/app-emulation/wine-desktop-common/Manifest
@@ -0,0 +1 @@
+DIST wine-desktop-common-20150204.tar.gz 99491 SHA256 444ad6b52b5290ec7d160e2cc40e4ba0910b4c4983dba1ceb054b81b09b24b5e SHA512 1f3d7022c5cff87ed3b8fd3b7cd14397c6f23b98fe6a7c583ac0d2f439ff29d943f57375f23687aa6519ff1d84ff07624a9a712d6f19fa207fd26d01edcb6688 WHIRLPOOL e9810b2952d25c05d831000e00e423de86809ec31b9a033fd4c64a70709da7338a9afc9e632e678f49c789a8a3702fbd0113226770cdb806623f2de371a16f54
diff --git a/app-emulation/wine-desktop-common/metadata.xml b/app-emulation/wine-desktop-common/metadata.xml
new file mode 100644
index 0000000..751c88a
--- /dev/null
+++ b/app-emulation/wine-desktop-common/metadata.xml
@@ -0,0 +1,15 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="person">
+ <email>NP-Hardass@gentoo.org</email>
+ <name>NP-Hardass</name>
+ </maintainer>
+ <maintainer type="project">
+ <email>wine@gentoo.org</email>
+ <name>Wine</name>
+ </maintainer>
+ <upstream>
+ <remote-id type="github">NP-Hardass/wine-desktop-common</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/app-emulation/wine-desktop-common/wine-desktop-common-20150204.ebuild b/app-emulation/wine-desktop-common/wine-desktop-common-20150204.ebuild
new file mode 100644
index 0000000..66ba3ca
--- /dev/null
+++ b/app-emulation/wine-desktop-common/wine-desktop-common-20150204.ebuild
@@ -0,0 +1,45 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+
+inherit gnome2-utils
+
+DESCRIPTION="Various desktop menu items and icons for wine"
+HOMEPAGE="https://github.com/NP-Hardass/wine-desktop-common
+ https://dev.gentoo.org/~tetromino/distfiles/wine
+ https://bazaar.launchpad.net/~ubuntu-wine/wine/ubuntu-debian-dir/files/head:/debian/"
+SRC_URI="https://github.com/NP-Hardass/${PN}/archive/${PV//./}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="-* amd64 x86 ~x86-fbsd"
+IUSE=""
+
+RDEPEND="!!app-emulation/wine:0"
+PDEPEND="app-eselect/eselect-wine"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+S=${WORKDIR}/${PN}-${PV//./}
+
+src_install() {
+ emake install DESTDIR="${D}" EPREFIX="${EPREFIX}"
+}
+
+pkg_preinst() {
+ gnome2_icon_savelist
+}
+
+pkg_postinst() {
+ gnome2_icon_cache_update
+}
+
+pkg_postrm() {
+ gnome2_icon_cache_update
+}
diff --git a/app-emulation/wine-gecko/Manifest b/app-emulation/wine-gecko/Manifest
new file mode 100644
index 0000000..8ffa01f
--- /dev/null
+++ b/app-emulation/wine-gecko/Manifest
@@ -0,0 +1,2 @@
+DIST wine_gecko-2.47-x86.msi 49266176 SHA256 3b8a361f5d63952d21caafd74e849a774994822fb96c5922b01d554f1677643a SHA512 e0d06102dcb8ec2d24e8c8c3f5c2ee5cb47c18e203dfb43d85de008d682ff874fb664fef1df909a5a7857de39c7e8ce5175e734a11964ec4cd35f8fbacaea3a4 WHIRLPOOL 2b4e3e88d530106d942200e5cdc67e51fc529c51864dee687ff1d6ae4cc94557481f74797a5ca7c1de8ca5ad00f7d9cb71e484ab24d73867d1032ccd88c0c376
+DIST wine_gecko-2.47-x86_64.msi 50806272 SHA256 c565ea25e50ea953937d4ab01299e4306da4a556946327d253ea9b28357e4a7d SHA512 7c2496b15a06bc6906bc60afb3ac082e3f9931207fa624e60297020211d66aa9b420a61e95730a0dbdcefbe4b26c811d0c896ecd9c363b5107d08c3fa22fef41 WHIRLPOOL c7619954da22a47dae86ef4c6c0cfbece41943edcceb2c21babe610e0a0b2197b244ebbddd2f3986ee4d5251b062e5f3b8e079426ec77c311b928d18c8451677
diff --git a/app-emulation/wine-gecko/metadata.xml b/app-emulation/wine-gecko/metadata.xml
new file mode 100644
index 0000000..41e683d
--- /dev/null
+++ b/app-emulation/wine-gecko/metadata.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="project">
+ <email>wine@gentoo.org</email>
+ <name>Wine</name>
+ </maintainer>
+ <longdescription>
+ A Mozilla Gecko based version of Internet Explorer for Wine
+ </longdescription>
+ <upstream>
+ <remote-id type="sourceforge">wine/wine-gecko</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/app-emulation/wine-gecko/wine-gecko-2.47-r1.ebuild b/app-emulation/wine-gecko/wine-gecko-2.47-r1.ebuild
new file mode 100644
index 0000000..598b063
--- /dev/null
+++ b/app-emulation/wine-gecko/wine-gecko-2.47-r1.ebuild
@@ -0,0 +1,28 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+MY_PN=${PN/-/_}
+
+DESCRIPTION="A Mozilla Gecko based version of Internet Explorer for Wine"
+HOMEPAGE="https://winehq.org"
+SRC_URI="
+ abi_x86_32? ( https://dl.winehq.org/wine/${PN}/${PV}/${MY_PN}-${PV}-x86.msi )
+ abi_x86_64? ( https://dl.winehq.org/wine/${PN}/${PV}/${MY_PN}-${PV}-x86_64.msi )
+"
+
+LICENSE="Apache-2.0 BSD BSD-2 MIT MPL-2.0"
+SLOT="${PV}"
+KEYWORDS="amd64 x86"
+IUSE="abi_x86_32 abi_x86_64"
+
+DEPEND="!!app-emulation/wine:0"
+
+S="${WORKDIR}"
+
+src_install(){
+ insinto /usr/share/wine/gecko
+ use abi_x86_32 && doins "${DISTDIR}/${MY_PN}-${PV}-x86.msi"
+ use abi_x86_64 && doins "${DISTDIR}/${MY_PN}-${PV}-x86_64.msi"
+}
diff --git a/app-emulation/wine-mono/Manifest b/app-emulation/wine-mono/Manifest
new file mode 100644
index 0000000..0a61437
--- /dev/null
+++ b/app-emulation/wine-mono/Manifest
@@ -0,0 +1,3 @@
+DIST wine-mono-4.6.4.msi 45592064 SHA256 91b7d58177b9a9355edf007dab94535471aebdddae12734ceb4a219d2ecc4152 SHA512 1d50df5d4d000998c74fbee79b8ffc691d88ee3b34db9fd7124e0df68d6f84768ece489ac8c3f5f3141c2073c8666b93ae23ca6cd652a6542a821df3d1b66b6d WHIRLPOOL 54b77eabdb357822a89f3ff0d318755d0bae60a4a1df44ad33e663138d3f874f2bd271368df86e350ecc96908e77e82cc9ff7eef6cd80e20998b5cfc068703df
+DIST wine-mono-4.7.0.msi 64625152 SHA256 7698474dd9cb9eb80796b5812dff37386ba97b78b21ca23b20079ca5ad6ca5a1 SHA512 07cd2b26f3bfe6fc796a126b83e9c0aa655d3e8152af536ae2e8ae419013742706ddae6f93cc2341c94a2f3b8ae7d1b27d12f891d371928189291428f9ed877c WHIRLPOOL 9cdc9e4f680b0c7b6e46938a88c665f7702472c524521135ada7791e31c36a8ecbe95ed8720e2d67b53aa65c16e87c0fb85b654059ce0e146d401f99bcd5f0df
+DIST wine-mono-4.7.1.msi 56470528 SHA256 2c8d5db7f833c3413b2519991f5af1f433d59a927564ec6f38a3f1f8b2c629aa SHA512 d47f21fa3ddb31522366056a2062cf7b77eec0a12f96dc05326561c9d2604405128441ff40d1b9567a6e6cd1c19ee03444d2ba02dd3b8dd2d150030dfb52f765 WHIRLPOOL fb0bd7af90924e20389f1d63c5089961a3f8cc23295b19820920347d3092a25bacea1838e5fb789dc0660896e5caedf6cff8629e96f3ab9055fa45ac444ecaf3
diff --git a/app-emulation/wine-mono/metadata.xml b/app-emulation/wine-mono/metadata.xml
new file mode 100644
index 0000000..a64284b
--- /dev/null
+++ b/app-emulation/wine-mono/metadata.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="project">
+ <email>wine@gentoo.org</email>
+ <name>Wine</name>
+ </maintainer>
+ <longdescription>
+ Wine Mono is a package containing Mono and other projects, intended as a replacement for the .NET runtime and class libraries in Wine. It works in conjunction with Wine's builtin mscoree.dll, and it is not intended to be useful for any other purpose.
+ </longdescription>
+ <upstream>
+ <remote-id type="github">madewokherd/wine-mono</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/app-emulation/wine-mono/wine-mono-4.6.4.ebuild b/app-emulation/wine-mono/wine-mono-4.6.4.ebuild
new file mode 100644
index 0000000..a9f2ddc
--- /dev/null
+++ b/app-emulation/wine-mono/wine-mono-4.6.4.ebuild
@@ -0,0 +1,21 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+DESCRIPTION="Wine Mono is a replacement for the .NET runtime and class libraries in Wine"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="https://dl.winehq.org/wine/${PN}/${PV}/${P}.msi"
+
+LICENSE="BSD-2 GPL-2 LGPL-2.1 MIT MPL-1.1"
+SLOT="${PV}"
+KEYWORDS="amd64 x86"
+
+DEPEND="!!app-emulation/wine:0"
+
+S="${WORKDIR}"
+
+src_install() {
+ insinto /usr/share/wine/mono
+ doins "${DISTDIR}/${P}.msi"
+}
diff --git a/app-emulation/wine-mono/wine-mono-4.7.0.ebuild b/app-emulation/wine-mono/wine-mono-4.7.0.ebuild
new file mode 100644
index 0000000..2479dca
--- /dev/null
+++ b/app-emulation/wine-mono/wine-mono-4.7.0.ebuild
@@ -0,0 +1,21 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+DESCRIPTION="Wine Mono is a replacement for the .NET runtime and class libraries in Wine"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="https://dl.winehq.org/wine/${PN}/${PV}/${P}.msi"
+
+LICENSE="BSD-2 GPL-2 LGPL-2.1 MIT MPL-1.1"
+SLOT="${PV}"
+KEYWORDS="~amd64 ~x86"
+
+DEPEND="!!app-emulation/wine:0"
+
+S="${WORKDIR}"
+
+src_install() {
+ insinto /usr/share/wine/mono
+ doins "${DISTDIR}/${P}.msi"
+}
diff --git a/app-emulation/wine-mono/wine-mono-4.7.1.ebuild b/app-emulation/wine-mono/wine-mono-4.7.1.ebuild
new file mode 100644
index 0000000..2479dca
--- /dev/null
+++ b/app-emulation/wine-mono/wine-mono-4.7.1.ebuild
@@ -0,0 +1,21 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+DESCRIPTION="Wine Mono is a replacement for the .NET runtime and class libraries in Wine"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="https://dl.winehq.org/wine/${PN}/${PV}/${P}.msi"
+
+LICENSE="BSD-2 GPL-2 LGPL-2.1 MIT MPL-1.1"
+SLOT="${PV}"
+KEYWORDS="~amd64 ~x86"
+
+DEPEND="!!app-emulation/wine:0"
+
+S="${WORKDIR}"
+
+src_install() {
+ insinto /usr/share/wine/mono
+ doins "${DISTDIR}/${P}.msi"
+}
diff --git a/app-emulation/wine-staging/Manifest b/app-emulation/wine-staging/Manifest
new file mode 100644
index 0000000..8be7b53
--- /dev/null
+++ b/app-emulation/wine-staging/Manifest
@@ -0,0 +1,41 @@
+DIST gentoo-wine-patches-20170830.tar.xz 58456 SHA256 fb7781d0ae360cbc3860c2d2e81527a1b903da824c01f5d5040e95aaf99a3970 SHA512 5e5159e3252b246bba0ef7fdba345db3ab1071c5b8b8b625f98eda18779d4024c5b76bdbf49ce7bd5c6b01b422807adf76820beddb2b4a6ee9e67d13052cc575 WHIRLPOOL a79be264bab3fcdeee06fef47efd28e6e1125254ac7f82300cb6ba2591ef69cd76b5fed8f778b1849a0659e680e9fc785f0273d55cb2ed95648a74dffa5e22d2
+DIST wine-2.0.tar.bz2 23662707 SHA256 9756f5a2129b6a83ba701e546173cbff86caa671b0af73eb8f72c03b20c066c6 SHA512 b0a57ba8202d9fc396e5bfb7a7718d6bababbed8f3351e7fdc36afa37f35a871e04903757618f73427aeb71a52b2d323977d79e48f8b38d636f23fd404441186 WHIRLPOOL fa9f774d87dae73c7d1f3b86dc3b03ea27065eb6140f1cac13c82fe16f7ebff8f8365ed447220cf5c2788b9f4aae7c482e4f9e2e69f47e5435209e148f5dbdfe
+DIST wine-2.1.tar.xz 18887032 SHA256 bfb9abf63691c93df28d9599aaa866dc2b4e27209b3b7b546df8a37d7d9d1e6e SHA512 03d678ee6e89c2804813f2827255fcf59e96ca9a45b7d8ac441cfc84f835e5e5689c70a79a41a04c631e1add7807fa4a5758acef3bd7aadfb2e92e68958c6ef6 WHIRLPOOL 063d935f1ff0922100641f2f53cdac23d2993a83182d45e028e485fd7d0a13bc5cfb77bca76550b1537b3f42fecacef7fd64785adbf6425af823f56f96973b54
+DIST wine-2.10.tar.xz 19209580 SHA256 488df7ffd2e81da455bf428fc9eb784bb4273a890334500895665711bd52f179 SHA512 8807e16a571bf45d99097ad5fdfb9fe755f6dbe84010a330fed82f1d48c76b7f19589bfc0e5dde0b9e49a608fd0501db3f7e3e129e4d9d34bcae03bc51a73139 WHIRLPOOL e9a8248aac31593fbac28a3d8d4e62bfce14a7c41cc416ebfca8606518d28efd31b32196133da211f75f48bd228bd5d21fcbbc0479293e813ed99b258b37126e
+DIST wine-2.11.tar.xz 19251116 SHA256 efa96dade206aa21accf0da195335a805d38209d6a14320607c6308ebde4cc3c SHA512 691f329c47af5e51498287029988b8ca0777bfc3902ed80fd315004aba2337a938e79177e752efe86423c9b34544df3952b8c443bf43149356575fac75a779ac WHIRLPOOL 4933e1ce640b0abeebccd6969b5eaf4eec76cd135d9cfc1d904a902219f776a68f72e2bd1ae9019d69f0d0d81fd8ead0084785d1b9710590349365977f9c1817
+DIST wine-2.12.tar.xz 19301968 SHA256 496c11af841487e6ec4e1953ac19b05a7f48e397da502653ffbd9fe9004213a7 SHA512 d44c1937d7d2d797150381f70317b810616d61355a59be096366d3507f59b678cffaf6d841cecf02bf9d2afa3dbf4d19270f80fb1d3ba5f0f93787d40c328f62 WHIRLPOOL 6f4b9baa6fcfe86f3d195fe603c2b9450a72a593c8f7042959b42a76880cb4ae680fde7beb70a8e823150849fda36c42985035de891ebf0088c8ffc2bceb15bf
+DIST wine-2.13.tar.xz 19439328 SHA256 6fbca3ddd19b061ce65a267639efae93cf38cfabbe4a9c148a17a44703587ef8 SHA512 71873b9ec1605dd5f7502b87b0f3429c3d14a4196543d7304df455854b58ef82b8fafdcea91450cbfc01434a44886a0e0c4c4cf289ffb53167dde0f969cddc48 WHIRLPOOL 6faf1e6aeea2ab7ccc496ed85834f98eb25111c8f541c24d4876a142ad4acf7d9a4c08c2716e11fb6c92fe7aad29980cab912eb9dbb6759bdbdeca2f2f8e78a7
+DIST wine-2.14.tar.xz 19447812 SHA256 03f934d95181f728600ca04d395f10e821ee38cfa31655e872e4d27d2a8795c6 SHA512 ff43d386d46c0c74449e667b61d8cebd5fa768c88e6220aa2f13df03d80b71b6c0bdf8cbab023aed96f7c88b9787a3be4989da892fa1778412534ae82a7279bb WHIRLPOOL 2d2784e1b2ddeac39a3cea4cb08a62d99d1d062d8d801874e8bf4f56d2538a4cb019418c60299556548028e2362dd533d9ea0956014a65ac7a367ed489c0c392
+DIST wine-2.15.tar.xz 19463720 SHA256 d82d500cbf81fb08c711d3619bd52373138a05574d044f089af89707274868b3 SHA512 a52a42dd1f20fe68213c55a07ac5b2455150806e534f0ab77a8e9ae3d2f12840983fa92290dac569207d3640c7f45cda83801e9f2e80294863ffa854c6c89171 WHIRLPOOL 99c9497a44859ce310c764b3cd172d83ca1a2dce13633fee930ddbf1c40651ee4470f6bc9cfcb407ce65298a2afd73dc9edc536c2ba6f076631e5cf2085b8e61
+DIST wine-2.16.tar.xz 19484716 SHA256 a561edcabecd6c44948e5b2ef11941b2ba047275240418fa2c98c1fdceda2c21 SHA512 749a36b536506c4b63ff7512e316f44503cdb0db46e38a124da86df638f3e8ff9c404b034ece5cbb95cf20c09bc46be9a38f2ee66480aa6a4f2385e2a7a7eea4 WHIRLPOOL 92ae0a427d89b24d41d4565e333cf3b7499c1dfedb6d2a204f934975c35cb589d38b4f669890c1fd6a37b9fe8f34d98be3e7d0986e9ff99516fe00a004574520
+DIST wine-2.17.tar.xz 19505528 SHA256 7edc95739043ccc55957af663fb910318283dc5d1db42cd7f0224e30acfcea69 SHA512 cb10c876e689aa601c68673aab32c0514dd174692a01bdb3afc78d5e6079b0e77f48783af2f54245f397c762da3b4e5f2c1d39d2ce7fdb3b117d338b95c24810 WHIRLPOOL 196427a68ab3b1261cb63bafd7f82b7a688ad439fa82ae3fc04b18c9da14cc8e95b827ca8ddd07124e1179c55ed0e0aba3bdcb4639b724a6dacf4952e8827e16
+DIST wine-2.18.tar.xz 19546360 SHA256 9f0931129878157d717cb39f16cd33bf49f40aac77331c93d0ad30f2ccac4f50 SHA512 61cc39fa3d2b0a0ab3c5d17579865e6aea76dd9513a4b3c45975a2d5c05f2b4ba952b97eef547131a014763c7f692a08df29bc2ebf7e4ac7e2616e6a7822ddb9 WHIRLPOOL e864dd1705c0480d3f3095aa02ab1e7bc5b41693cd6b791cdf05e636c7099562020ac3adcba6421653efdf5dbe232b5abe9071792785e008ea30dedbb63e080e
+DIST wine-2.19.tar.xz 19549464 SHA256 487131e69875ae9c2d042798f954160146e603e449c3c97981f29b42f4a66095 SHA512 83558231bdc592b1f69cfedf6c689063df7bd9fecdfafba6fb7f6a2c7fa7783973efb85a6a49305afc18b1aa268209ee5b9c0655756e05d7550468698dfa51ae WHIRLPOOL 123aec3a367e67353655d940ba2ffe9386a583afbd0961dd3f446a00b0cf82ad4ed590508e03bf2a4e60b11753f8f430e748e6614f476675423f3bdaf7089288
+DIST wine-2.2.tar.xz 18916364 SHA256 64cb57e1d8aa07f5c89ef26743b494f2d3ef9c0f4e50d3ee896a93535f7751f4 SHA512 0700868244d397c1442948716321e5ff030c667edce464570f76aa4340199489a422872aa3975bc0a57b8285c9d59fc04e223a4bde094169fc6db460acb626c4 WHIRLPOOL ffc3d357a76592651b589c6ac6608720d0258474890faf8fe3e20ac29cdd1496d569721256f9389d347bf2734a556099154fd18ef1b56f45bb46c4c15771d6ca
+DIST wine-2.3.tar.xz 18931732 SHA256 afc95c7a87cc8f0730b462c50a5dfc9c462eb02c6bf5874b4fa99946f49e067e SHA512 bea78e8468555ff9e08dedf3918da5ea82721549c43984869989bbdafeea00e454820ff9558aa29925c97a165a9b01e5cd1fd397f133833c58824984a6686171 WHIRLPOOL 1f5ec8e5c32d124277e4c71d95726d3a5337575757c3029567c77165d65fcfec2ddf33d3863b4bf55c9eff7c3582c1ec7dbd76d84ed8bbbe89dd16db6b0128c1
+DIST wine-2.4.tar.xz 18953748 SHA256 87b5df07e4781fecce2f92415a4717208ea253a20a0df8b36b9f90b69b72748e SHA512 15ae7e97dc72a8636b2c15c93803ed430fa456d673add61457cf3e479e769559c682b40949b5d38828f6681f13183e560fcb4a2eb0f0ba25e6eade46f7d3d7c0 WHIRLPOOL 558ab7b7517ad5e03366b4db974047eba776585e958a5b71bb2e93993e21bc725ea7a8bcf2a4354f34ca38c94ba99ccd15f2f8b5e4b58066bf339d3517eec56c
+DIST wine-2.5.tar.xz 18993176 SHA256 13f92b7ab483323aaabbc6519851e688ad4372ea30569961c831d40d6d3bccd2 SHA512 7b6faf6d8aa3d41465ad93ebae055581136f736c7eb8b4c61682e5a05589c83a0ff2c85e0f9abbca016f31b6f1c1435617c4994f1913f715a8707ebee3f28467 WHIRLPOOL 5acd2ac65df5dee1c860ddca72b8df8e021a0b95a3a1870d15468ce4591d569fa15bf8a0a6d341bcd3a624d13d0affe5b0263e67f9dfcbbf3ae7b59218dcded9
+DIST wine-2.6.tar.xz 19023352 SHA256 e6ff64758f437647e99a36c1275e41adf54f0432907172d3bba22b070a97aac0 SHA512 2aa55413ac090e011725566d004e42ee46323cd4c6961b9faa63e3de422ba60bb657bf224a4d7e8aa712a8e26e11977d07acb7c088ffeef8c37310e8cc698970 WHIRLPOOL 82e6a06cc342c7d6eace64a97bae10cc39c120c5776170b059700542b8b6fef56be9a697f05b3bc21ae82621f4bf50f3ab478311c9a3a55d86ed7c0a009766b0
+DIST wine-2.7.tar.xz 19101108 SHA256 e55a43088e313c45f7ab49272b7cb441c06f5659fb4220b2325dc060db0ee14c SHA512 1e61b9a4aa1f5f42fb27d11d5254a9ba90f348ad9c4d1ddd4b5da47cd7de638290a20accf7447db9c0e4ced4c2144497cdf5fc906a5eac60e923dabb61f65d3a WHIRLPOOL 133426a0313facc856eebad3d16d199948b780ce4c4561e5784845c119fe462b8942ed86fa5e823e729a997d704bd3c70f44a64ce3eef965b4f3eb92587dfa4d
+DIST wine-2.8.tar.xz 19120740 SHA256 83e9607af66d86020dc27a368ebba28fa7e8ffecfdf8f149da06b3531ac3e579 SHA512 4d0b167b1e5add31ed0ed05b328d16fc13cd268285c03a9100e7ddc53864aa07f6b216a555ef0c2e51dee550e3f4abf0c7c20db2cbca177bb38e8c3e11f05b97 WHIRLPOOL 568cf46caf7322eb5e26b364bd15f9e80c41a65340952a1ee0fa80514bbee3c5adfa72af40809a978a5d4202f5e8d3da3e4581767bab9fa08ab441cdd5d1da31
+DIST wine-2.9.tar.xz 19154668 SHA256 ac46f7bbbbc1dc135c95e4f98d28bf6e3d7a78fb7f9ba6caa7354a3e8786545f SHA512 6d06e511d8f338297ed0ddb7bf2ffb501f528209eaecbbee3d4e5d53db649dd5ea0aeb78bba661a9bcfda5f97e170ca10eb8fab355e229bfe7db6a5feb7ec4e8 WHIRLPOOL 7355166aeaac54abb6e1d25da6f87a4814d37764044e95462bc2a83f8d5a9b7a3bb10730bb5506516e130a4fc9ee35e3656d1106939bbbc1310c6aff0d798a1c
+DIST wine-staging-2.0.tar.gz 10182575 SHA256 22a43cb50c1fff9c6f233a965247056e3321533aa73a6419aa34a22de7180039 SHA512 51412299259d6e92c8993543d5fdb3239ebe31e0d1d715e0a9e8ce94b3139c0567b08ff1600d41be94f12427cbfccc2f6b6b2ed030535445c95618aaf6578580 WHIRLPOOL 9879174bc3a7c8ece156c822b7a7b870908e51335702a78e6f04ea1496125a2018a879bfc53d1302e4825138d22af526308ba7f656d683a535be44d4515f1bac
+DIST wine-staging-2.1.tar.gz 10101781 SHA256 1d193be2734ea495df2cae1dc54ce89204ca68699979174b0bd726d2e5e0576b SHA512 c64c48b265f0779c621a643ddbd2d12aaa548e4bff3b2b728280cdb9613214989911ee8ba5e46c7770f5f6430014a5da1c98e95d5008c1174bd14bf9ce5250db WHIRLPOOL ecf970ef436089bbcd0088e1608b22e808d54560e905c7d8046b3e21508166a595c3ef7b69819c45e4b13183bd9134a2bd7016d29c4da52985701d392eb35a0a
+DIST wine-staging-2.10.tar.gz 10091114 SHA256 b361ec92b2e40de983b987f6564dbb75dcb121c6e2f0123fe1ae234fd81a591b SHA512 c3bf7027ddfd1405263cce844a7cbeb923e9de56cffdb296384449c0cc600b3c9a37c7fe09b62fb9ae0b47f97a2d4f208cc589f0e4205fa84ce5d112953ac2e7 WHIRLPOOL 01c5436179bcbd29ee0468f2f4d839ba805c064d80835fcd1d5e6eba562881c65ac576657a733c726ccf4b37473da6724ae06ebc023fb988d8810ed1f8096c6b
+DIST wine-staging-2.11.tar.gz 10083147 SHA256 45c40fbca76cab987e7adfe47fc8e24692f896805c8a6dc6030da28e3bd842bc SHA512 e2d05ee88e1cc932c2890f1db867a9382f2c62a00ea7d63fc6bd7b3fab57ea2f0e4908313cbed08b92e48d5bc17753b0b78f6cdf2cb64e81aa5725fd86cbc695 WHIRLPOOL e2d13ed7d258b1ee442c8c87f852c1564ce5f262bd7cd31710b975882ab8cb454a1e2ec308c6c17e5bd0a691b0492fdea22a182323cb963c055592ce538db690
+DIST wine-staging-2.12.tar.gz 10105899 SHA256 0f186d2268011c12094ecac8747378ad8f4ee7152e8854cb00496ba9565b7974 SHA512 a8c21c923153a42609e3ea9065b84208b01f3b14d55b7e68e548ebf6d27df956051b29dc2f053aec6287422c13eed5b6ec71e667ae6f46b1c80ae7c84a51b648 WHIRLPOOL 01cf39fa257e9975cfd16976e680117dac3d0ea3f9bc41e2d0a636023bd4afba0676587e41c55d4417cff97080b90eb11b3fe475970eec70be64f5c788c1cf88
+DIST wine-staging-2.13.tar.gz 10137549 SHA256 0796440ebfa2aa651051e7081cc64f83774f966f26353876e024e42c59e24b46 SHA512 86077747d8a4f6e56dc1b0dda1688810defa9bcebaaadbf2419ce56e4590d4249881105e1dda24236f861baf0b1cc42019b2538de5d24a6d3c4f27c7a8248086 WHIRLPOOL e0c147519fde14f74031fcb7ba154c39583a9c817460d21ec50fdae40039136d46b8cc0ce9a8fb558ddbf8b62c6f0a572ad04a887c47046c0e921e6f08c4b44d
+DIST wine-staging-2.14.tar.gz 10179829 SHA256 cd4c8e400a808cbfa5c5cf088ea874c761d09db897f25bc33eab840101020b19 SHA512 1e794f77309e94612f822b72872ac2726e37d219a40c4a45feb2fb56f4413c34eae966a4ae8708d502c837cd47db22979e9a05cb73b681703cd729f701cdb210 WHIRLPOOL 63f9ff9cd4d54d6ff91997a904e7cd612bb8bca905399e9c6950b274cd8218c0c04a40dca9f4e12180e1080f1631bfec38e3633fcd457e688e8f8883661a4e59
+DIST wine-staging-2.15.tar.gz 10190900 SHA256 f2b5c43fbc185a6fd6399f4c351b83a172737977b2ebb1cbdeddd1838d044bc2 SHA512 75d64d103839da2daed6e5b2400185c0a5274d0e50b675283bbadff70cafe712e573701207d80c8e8af7f68d1d273efec3c0d705dc982c74b8574929daadecfa WHIRLPOOL 13239aa636fc102fb374ab8724b7dbce8e9b95f16797a4f5faf8a5e7789d60e6b485c7495ccef4568edbbb0549d657a6758642de2e98b449b0ced2725136e444
+DIST wine-staging-2.16.tar.gz 10220855 SHA256 da0ef4b0eafe9cd1b9cf26a5b950088adf1308e17a0d6f4ae62516b6ee64248e SHA512 96585caf77569a31f516aefe230a8907ef91db29759f75075593b751985f294bf292a1c146d287a3f0859a6b6273560670c4bc734ef0fbecb0809574eb3f09ba WHIRLPOOL 66128c8d59593243e95d6765b9fd8ace59e85e365a5e8a41eeb17d370464005aef060ddf3d862d0a3638048fd92189860e69a3cbf7d24d3ce1e420200d4b3cf5
+DIST wine-staging-2.17.tar.gz 10211107 SHA256 f511bf3438dc418b4f667513bf1ae419255e4ee62229e9205c0c64b047222183 SHA512 b652f6a852a1382c1b8275e172b7ac7608749c34aef5c0c5387cf262bf0da8db67a77ce397d49e53f3e2a8f210a3dbea1a9b3f3feb15c7d5bad8952b6fb7b53c WHIRLPOOL c45dc5fc91bc774f9f28bb06dff959391829fafac398bef198755395afe5a65bb2d32ba3ce157607a6040481955926866ed8f0760850bfca821be8599f4d7b64
+DIST wine-staging-2.18.tar.gz 10243957 SHA256 69c75d3ca17b1c3617cd0934a9e9ad6fca37c6679900d2cb63f6981aa1026cc8 SHA512 fe18b53d4160596d134ceed392f6459e9c183381f4712add43d8422e77d7d5d89ff34a3bb3afbd7740f250d85dfda0f3501e9600a41270790ae02138ed6d7dc7 WHIRLPOOL 2dc1429a7a4f13ee01b1317f1937ef7ec6b42c3cfdd78ff78bb8273e1056751edb2ac119904ba48ab645b430f269a9361a6d42bcbb5dfb46bd15a129569d3194
+DIST wine-staging-2.19.tar.gz 10241240 SHA256 2fdb083a484708362433000f92b54a5d648df190b2ab084647c45f5624063bd2 SHA512 90916cb096bbfec35514eff4c1b6e2090b6e68e3e7af1164715f5abb1d255c5cfd6411f53c27cb277adcf0982fa6d6e508a7cdbc1404dcca6c2700b05c2c5483 WHIRLPOOL 3ed1a5d39d0ec186538e04ca09e4fa2729f356385523177b753e7c7183416f666f336bec7d4b606f29266cd227cf5e72f707c79adf510bc3899adb76ce3df84f
+DIST wine-staging-2.2.tar.gz 10078327 SHA256 9d3cbf7e5f12c623d275457b910a158e0b176fcf50c09a5f8425864de604bc1d SHA512 8ad3f8ba4c6439a9ec4884a55018a67c9e2c2384830074646aac7b70cb9f4f5a20f760247ab42dc3d2f697cdac7ea5322be8ed12c435cb0bc185ac08fdd4dd91 WHIRLPOOL a34c19aaace64307de56d935cb0cef17d7c066c39b83c51e70ea76a20083f928bea55fe38d62b7a8250b0a9e8f00e0d2b744f43fcab433069ffb96625d955303
+DIST wine-staging-2.3.tar.gz 10071742 SHA256 9a81be606836fab6203857f7937ff97575947f75d52c80fb5489418efb8b87e1 SHA512 8e8af1e36cc69c63ec3542f0ec4db18b6d8c16b5c9077eb211297f3a886519da71bcf72934bf8d6d72e44c7c9f765e1d00203d0d75cab8544f69f9b0c10a7133 WHIRLPOOL 50738a6e20890748d7eb01152244d34b259759f61b3587ba39815dc066fc8e2b66ce182e1ddbc912f50076a3599aa060ec6a94eeaab4513ce3a776711929b9b1
+DIST wine-staging-2.4.tar.gz 10067020 SHA256 709cab12c0ebf7cf9504fd4a67eb851272309e00066ad81f184b0f55c63e9deb SHA512 55d11851697836b582ba54696cadc812ef6b14872440f5c3ed6fbe30a05abcb8abe2ab31a11ea4daeb354854c7c0e6549401d4b26b26621808bdeb89aeb206f9 WHIRLPOOL 8d344b7e6e89322c8dbbe6fd211851c90a45a33b514c182609cc60dc21939f791abc71d8665cd66e5c5161f159fe24c4772b99405833e3d11985a644e1335eaf
+DIST wine-staging-2.5.tar.gz 10062025 SHA256 b5cf6fa38151ff47ab6d725077693b02b37bb07b2ab7fda55290bb1f63ac54ad SHA512 6ab981886776f624c6478230aad18870f55b7252f1c6df90bfe1a248f7ea76cbb181f8e0780fdd4bb5e3c589a785baa7cf126a2c838adf65db2a67f873ed1698 WHIRLPOOL 7045b1642a3b14e5a507854cb8bf910c7cfb3c64ada4ee3534175c75b03cd604206617a55fb870e47fb248a4db8a9ca2abc0b4688005c1c0de0d542fec8cbc57
+DIST wine-staging-2.6.tar.gz 10034709 SHA256 ff86ddcceb7f6857bd415db3842ddf216a5cb301452e2a08053a9378cbf5580a SHA512 dc199b5345985d261b708ac811b02253ab9fbc4966889f2382ce518d991fe43b7c771c1d56d055c6234c9329d5c571cd9cf0b16587b77124b9c46917ddd066d2 WHIRLPOOL 375f484c6c50645c605994eb08c38c649ca6c8b47430e2f2f285a63fc24eca81588d0496a8c32074f90e4ea8f4330f76854bf8874f042e27581a7eee19aedf98
+DIST wine-staging-2.7.tar.gz 10018082 SHA256 3095f9c634f00b143c2407dce8c3f29c629ec95074cf14c8e8dc2e0cdba45b6d SHA512 0abc89af701ae1b95c0eb08e72894c7bc40bdfe792e05b8af9282eab8407bb90b7dfcd4eb3a193a88759ce5d6ea6c2aa9696cac2d744f543c92529bb0d2636ee WHIRLPOOL 6cc666f702ef1bd574ede54a7f6755e07d768c9fa549b9bdb9b5416288619347e0c1b9c70893b6300800d8e6c94e8d2396937f639d1e821945ba9fe144b32c95
+DIST wine-staging-2.8.tar.gz 10043842 SHA256 8680614be6c3b01c7c577eb6924fc05cc3de92394384939dd5b2e12e08235fff SHA512 af1707fe3119664a0d97d94fc4c955612d80cb76eae8c4248a268c0f6be9e659fccf7c26899c9e9ae5822f74474c0db5283b598dd4d9d69a3b108f947653217a WHIRLPOOL 7e9aa61a7666404475abb442304e63c76c2e6df26479711b7c08ebe7c15b9b53017e7a1d2dca4f9f8aeba78290df03f06076c99ac06c30d5ed893cfc3842107a
+DIST wine-staging-2.9.tar.gz 10062408 SHA256 cde0895142c0ca0be5b532560ec0546d6e4f655615572d80cfcce663f92c57f6 SHA512 7862a403817791c54c5c1b8f233b06a850500305c46283bccb9026fb6db041a8fba619d145ab21fe2fdc5f25ed3bbb75fde05245fbbbd67139a5f64b547b1196 WHIRLPOOL 52c0b9065cfa54f6b86b74f9a98c9d232e3a88aa9d61d06c6e01044122fab8b01a567e99f93014042031e9eb991fd9234c4a02ebe3d2aa8c042e5e769269095c
diff --git a/app-emulation/wine-staging/metadata.xml b/app-emulation/wine-staging/metadata.xml
new file mode 100644
index 0000000..aaf5b4f
--- /dev/null
+++ b/app-emulation/wine-staging/metadata.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="project">
+ <email>wine@gentoo.org</email>
+ <name>Wine</name>
+ </maintainer>
+ <longdescription>
+Wine is an Open Source implementation of the Windows API on top of X and Unix.
+
+Think of Wine as a compatibility layer for running Windows programs. Wine does not require Microsoft Windows, as it is a completely free alternative implementation of the Windows API consisting of 100% non-Microsoft code, however Wine can optionally use native Windows DLLs if they are available. Wine provides both a development toolkit for porting Windows source code to Unix as well as a program loader, allowing many unmodified Windows programs to run on x86-based Unixes, including Linux, FreeBSD, and Solaris.
+
+This variant of the Wine packaging includes the Wine-Staging patchset.
+ </longdescription>
+ <use>
+ <flag name="capi">Enable ISDN support via CAPI</flag>
+ <flag name="custom-cflags">Bypass strip-flags; use at your own peril</flag>
+ <flag name="dos">Pull in <pkg>games-emulation/dosbox</pkg> to run DOS applications</flag>
+ <flag name="gecko">Add support for the Gecko engine when using iexplore</flag>
+ <flag name="gstreamer">Use <pkg>media-libs/gstreamer</pkg> to provide DirectShow functionality;</flag>
+ <flag name="mono">Add support for .NET using Wine's Mono add-on</flag>
+ <flag name="netapi">Use libnetapi from <pkg>net-fs/samba</pkg> to support Windows networks in netapi32.dll</flag>
+ <flag name="opencl">Enable OpenCL support</flag>
+ <flag name="osmesa">Add support for OpenGL in bitmaps using libOSMesa</flag>
+ <flag name="pcap">Support packet capture software (e.g. wireshark)</flag>
+ <flag name="perl">Install helpers written in perl (winedump/winemaker)</flag>
+ <flag name="pipelight">Apply Wine-Staging patches for Pipelight/Silverlight support</flag>
+ <flag name="prelink">Run prelink on DLLs during build;
+ For versions before wine-1.7.55 or hardened, do not disable if you do not know what this means as it can break things at runtime</flag>
+ <flag name="realtime">Pull in <pkg>sys-auth/rtkit</pkg> for low-latency pulseaudio support</flag>
+ <flag name="run-exes">Use Wine to open and run .EXE and .MSI files</flag>
+ <flag name="s3tc">Pull in <pkg>media-libs/libtxc_dxtn</pkg> for DXTn texture compression, needed for many games</flag>
+ <flag name="samba">Add support for NTLM auth. see
+ http://wiki.winehq.org/NtlmAuthSetupGuide and
+ http://wiki.winehq.org/NtlmSigningAndSealing</flag>
+ <flag name="staging">Apply Wine-Staging patches for advanced feature support that haven't made it into upstream Wine yet</flag>
+ <flag name="themes">Support GTK+:3 window theming through Wine-Staging</flag>
+ <flag name="udev">Use <pkg>virtual/libudev</pkg> to provide plug and play support</flag>
+ </use>
+ <upstream>
+ <remote-id type="github">wine-compholio/wine-staging</remote-id>
+ <remote-id type="sourceforge">wine</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/app-emulation/wine-staging/wine-staging-2.0-r1.ebuild b/app-emulation/wine-staging/wine-staging-2.0-r1.ebuild
new file mode 100644
index 0000000..510cfb0
--- /dev/null
+++ b/app-emulation/wine-staging/wine-staging-2.0-r1.ebuild
@@ -0,0 +1,607 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.0/${MY_P}.tar.bz2"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+STAGING_P="wine-staging-${PV}"
+STAGING_DIR="${WORKDIR}/${STAGING_P}"
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, with Wine-Staging patchset"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+if [[ ${PV} == "9999" ]] ; then
+ STAGING_EGIT_REPO_URI="https://github.com/wine-compholio/wine-staging.git"
+else
+ SRC_URI="${SRC_URI}
+ staging? ( https://github.com/wine-compholio/wine-staging/archive/v${PV}.tar.gz -> ${STAGING_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap pipelight +png prelink pulseaudio +realtime +run-exes s3tc samba scanner selinux +ssl staging test themes +threads +truetype udev +udisks v4l vaapi +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ pipelight? ( staging )
+ s3tc? ( staging )
+ test? ( abi_x86_32 )
+ themes? ( staging )
+ vaapi? ( staging )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ staging? ( sys-apps/attr[${MULTILIB_USEDEP}] )
+ themes? (
+ dev-libs/glib:2[${MULTILIB_USEDEP}]
+ x11-libs/cairo[${MULTILIB_USEDEP}]
+ x11-libs/gtk+:3[${MULTILIB_USEDEP}]
+ )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ vaapi? ( x11-libs/libva[X,${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.6.4 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ s3tc? ( >=media-libs/libtxc_dxtn-1.0.1-r1[${MULTILIB_USEDEP}] )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ staging? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use staging; then
+ eerror "Because of the multi-repo nature of ${MY_PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, and STAGING_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use staging; then
+ local CURRENT_WINE_COMMIT=${EGIT_VERSION}
+
+ git-r3_fetch "${STAGING_EGIT_REPO_URI}" "${STAGING_COMMIT}"
+ git-r3_checkout "${STAGING_EGIT_REPO_URI}" "${STAGING_DIR}"
+
+ local COMPAT_WINE_COMMIT=$("${STAGING_DIR}/patches/patchinstall.sh" --upstream-commit) || die
+
+ if [[ "${CURRENT_WINE_COMMIT}" != "${COMPAT_WINE_COMMIT}" ]]; then
+ einfo "The current Staging patchset is not guaranteed to apply on this WINE commit."
+ einfo "If src_prepare fails, try emerging with the env var WINE_COMMIT."
+ einfo "Example: WINE_COMMIT=${COMPAT_WINE_COMMIT} emerge -1 wine"
+ fi
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ if use staging; then
+ ewarn "Applying the Wine-Staging patchset. Any bug reports to the"
+ ewarn "Wine bugzilla should explicitly state that staging was used."
+
+ local STAGING_EXCLUDE=""
+ STAGING_EXCLUDE="${STAGING_EXCLUDE} -W winhlp32-Flex_Workaround" # Avoid double patching https://bugs.winehq.org/show_bug.cgi?id=42132
+ use pipelight || STAGING_EXCLUDE="${STAGING_EXCLUDE} -W Pipelight"
+
+ # Launch wine-staging patcher in a subshell, using eapply as a backend, and gitapply.sh as a backend for binary patches
+ ebegin "Running Wine-Staging patch installer"
+ (
+ set -- DESTDIR="${S}" --backend=eapply --no-autoconf --all ${STAGING_EXCLUDE}
+ cd "${STAGING_DIR}/patches"
+ source "${STAGING_DIR}/patches/patchinstall.sh"
+ )
+ eend $? || die "Failed to apply Wine-Staging patches"
+ fi
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use staging && myconf+=(
+ --with-xattr
+ $(use_with themes gtk3)
+ $(use_with vaapi va)
+ )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine register --staging ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine deregister --staging ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-staging/wine-staging-2.1-r1.ebuild b/app-emulation/wine-staging/wine-staging-2.1-r1.ebuild
new file mode 100644
index 0000000..1177c55
--- /dev/null
+++ b/app-emulation/wine-staging/wine-staging-2.1-r1.ebuild
@@ -0,0 +1,607 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+STAGING_P="wine-staging-${PV}"
+STAGING_DIR="${WORKDIR}/${STAGING_P}"
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, with Wine-Staging patchset"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+if [[ ${PV} == "9999" ]] ; then
+ STAGING_EGIT_REPO_URI="https://github.com/wine-compholio/wine-staging.git"
+else
+ SRC_URI="${SRC_URI}
+ staging? ( https://github.com/wine-compholio/wine-staging/archive/v${PV}.tar.gz -> ${STAGING_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap pipelight +png prelink pulseaudio +realtime +run-exes s3tc samba scanner selinux +ssl staging test themes +threads +truetype udev +udisks v4l vaapi +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ pipelight? ( staging )
+ s3tc? ( staging )
+ test? ( abi_x86_32 )
+ themes? ( staging )
+ vaapi? ( staging )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ staging? ( sys-apps/attr[${MULTILIB_USEDEP}] )
+ themes? (
+ dev-libs/glib:2[${MULTILIB_USEDEP}]
+ x11-libs/cairo[${MULTILIB_USEDEP}]
+ x11-libs/gtk+:3[${MULTILIB_USEDEP}]
+ )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ vaapi? ( x11-libs/libva[X,${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.6.4 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ s3tc? ( >=media-libs/libtxc_dxtn-1.0.1-r1[${MULTILIB_USEDEP}] )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ staging? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use staging; then
+ eerror "Because of the multi-repo nature of ${MY_PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, and STAGING_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use staging; then
+ local CURRENT_WINE_COMMIT=${EGIT_VERSION}
+
+ git-r3_fetch "${STAGING_EGIT_REPO_URI}" "${STAGING_COMMIT}"
+ git-r3_checkout "${STAGING_EGIT_REPO_URI}" "${STAGING_DIR}"
+
+ local COMPAT_WINE_COMMIT=$("${STAGING_DIR}/patches/patchinstall.sh" --upstream-commit) || die
+
+ if [[ "${CURRENT_WINE_COMMIT}" != "${COMPAT_WINE_COMMIT}" ]]; then
+ einfo "The current Staging patchset is not guaranteed to apply on this WINE commit."
+ einfo "If src_prepare fails, try emerging with the env var WINE_COMMIT."
+ einfo "Example: WINE_COMMIT=${COMPAT_WINE_COMMIT} emerge -1 wine"
+ fi
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ if use staging; then
+ ewarn "Applying the Wine-Staging patchset. Any bug reports to the"
+ ewarn "Wine bugzilla should explicitly state that staging was used."
+
+ local STAGING_EXCLUDE=""
+ STAGING_EXCLUDE="${STAGING_EXCLUDE} -W winhlp32-Flex_Workaround" # Avoid double patching https://bugs.winehq.org/show_bug.cgi?id=42132
+ use pipelight || STAGING_EXCLUDE="${STAGING_EXCLUDE} -W Pipelight"
+
+ # Launch wine-staging patcher in a subshell, using eapply as a backend, and gitapply.sh as a backend for binary patches
+ ebegin "Running Wine-Staging patch installer"
+ (
+ set -- DESTDIR="${S}" --backend=eapply --no-autoconf --all ${STAGING_EXCLUDE}
+ cd "${STAGING_DIR}/patches"
+ source "${STAGING_DIR}/patches/patchinstall.sh"
+ )
+ eend $? || die "Failed to apply Wine-Staging patches"
+ fi
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use staging && myconf+=(
+ --with-xattr
+ $(use_with themes gtk3)
+ $(use_with vaapi va)
+ )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine register --staging ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine deregister --staging ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-staging/wine-staging-2.10-r1.ebuild b/app-emulation/wine-staging/wine-staging-2.10-r1.ebuild
new file mode 100644
index 0000000..b119a5c
--- /dev/null
+++ b/app-emulation/wine-staging/wine-staging-2.10-r1.ebuild
@@ -0,0 +1,609 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+STAGING_P="wine-staging-${PV}"
+STAGING_DIR="${WORKDIR}/${STAGING_P}"
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, with Wine-Staging patchset"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+if [[ ${PV} == "9999" ]] ; then
+ STAGING_EGIT_REPO_URI="https://github.com/wine-compholio/wine-staging.git"
+else
+ SRC_URI="${SRC_URI}
+ staging? ( https://github.com/wine-compholio/wine-staging/archive/v${PV}.tar.gz -> ${STAGING_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap pipelight +png prelink pulseaudio +realtime +run-exes s3tc samba scanner selinux +ssl staging test themes +threads +truetype udev +udisks v4l vaapi +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ pipelight? ( staging )
+ s3tc? ( staging )
+ test? ( abi_x86_32 )
+ themes? ( staging )
+ vaapi? ( staging )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXfixes[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ staging? ( sys-apps/attr[${MULTILIB_USEDEP}] )
+ themes? (
+ dev-libs/glib:2[${MULTILIB_USEDEP}]
+ x11-libs/cairo[${MULTILIB_USEDEP}]
+ x11-libs/gtk+:3[${MULTILIB_USEDEP}]
+ )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ vaapi? ( x11-libs/libva[X,${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.0 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ s3tc? ( >=media-libs/libtxc_dxtn-1.0.1-r1[${MULTILIB_USEDEP}] )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ staging? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use staging; then
+ eerror "Because of the multi-repo nature of ${MY_PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, and STAGING_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use staging; then
+ local CURRENT_WINE_COMMIT=${EGIT_VERSION}
+
+ git-r3_fetch "${STAGING_EGIT_REPO_URI}" "${STAGING_COMMIT}"
+ git-r3_checkout "${STAGING_EGIT_REPO_URI}" "${STAGING_DIR}"
+
+ local COMPAT_WINE_COMMIT=$("${STAGING_DIR}/patches/patchinstall.sh" --upstream-commit) || die
+
+ if [[ "${CURRENT_WINE_COMMIT}" != "${COMPAT_WINE_COMMIT}" ]]; then
+ einfo "The current Staging patchset is not guaranteed to apply on this WINE commit."
+ einfo "If src_prepare fails, try emerging with the env var WINE_COMMIT."
+ einfo "Example: WINE_COMMIT=${COMPAT_WINE_COMMIT} emerge -1 wine"
+ fi
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ if use staging; then
+ ewarn "Applying the Wine-Staging patchset. Any bug reports to the"
+ ewarn "Wine bugzilla should explicitly state that staging was used."
+
+ local STAGING_EXCLUDE=""
+ STAGING_EXCLUDE="${STAGING_EXCLUDE} -W winhlp32-Flex_Workaround" # Avoid double patching https://bugs.winehq.org/show_bug.cgi?id=42132
+ use pipelight || STAGING_EXCLUDE="${STAGING_EXCLUDE} -W Pipelight"
+
+ # Launch wine-staging patcher in a subshell, using eapply as a backend, and gitapply.sh as a backend for binary patches
+ ebegin "Running Wine-Staging patch installer"
+ (
+ set -- DESTDIR="${S}" --backend=eapply --no-autoconf --all ${STAGING_EXCLUDE}
+ cd "${STAGING_DIR}/patches"
+ source "${STAGING_DIR}/patches/patchinstall.sh"
+ )
+ eend $? || die "Failed to apply Wine-Staging patches"
+ fi
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with X xfixes)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use staging && myconf+=(
+ --with-xattr
+ $(use_with themes gtk3)
+ $(use_with vaapi va)
+ )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine register --staging ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine deregister --staging ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-staging/wine-staging-2.11-r1.ebuild b/app-emulation/wine-staging/wine-staging-2.11-r1.ebuild
new file mode 100644
index 0000000..b119a5c
--- /dev/null
+++ b/app-emulation/wine-staging/wine-staging-2.11-r1.ebuild
@@ -0,0 +1,609 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+STAGING_P="wine-staging-${PV}"
+STAGING_DIR="${WORKDIR}/${STAGING_P}"
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, with Wine-Staging patchset"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+if [[ ${PV} == "9999" ]] ; then
+ STAGING_EGIT_REPO_URI="https://github.com/wine-compholio/wine-staging.git"
+else
+ SRC_URI="${SRC_URI}
+ staging? ( https://github.com/wine-compholio/wine-staging/archive/v${PV}.tar.gz -> ${STAGING_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap pipelight +png prelink pulseaudio +realtime +run-exes s3tc samba scanner selinux +ssl staging test themes +threads +truetype udev +udisks v4l vaapi +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ pipelight? ( staging )
+ s3tc? ( staging )
+ test? ( abi_x86_32 )
+ themes? ( staging )
+ vaapi? ( staging )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXfixes[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ staging? ( sys-apps/attr[${MULTILIB_USEDEP}] )
+ themes? (
+ dev-libs/glib:2[${MULTILIB_USEDEP}]
+ x11-libs/cairo[${MULTILIB_USEDEP}]
+ x11-libs/gtk+:3[${MULTILIB_USEDEP}]
+ )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ vaapi? ( x11-libs/libva[X,${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.0 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ s3tc? ( >=media-libs/libtxc_dxtn-1.0.1-r1[${MULTILIB_USEDEP}] )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ staging? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use staging; then
+ eerror "Because of the multi-repo nature of ${MY_PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, and STAGING_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use staging; then
+ local CURRENT_WINE_COMMIT=${EGIT_VERSION}
+
+ git-r3_fetch "${STAGING_EGIT_REPO_URI}" "${STAGING_COMMIT}"
+ git-r3_checkout "${STAGING_EGIT_REPO_URI}" "${STAGING_DIR}"
+
+ local COMPAT_WINE_COMMIT=$("${STAGING_DIR}/patches/patchinstall.sh" --upstream-commit) || die
+
+ if [[ "${CURRENT_WINE_COMMIT}" != "${COMPAT_WINE_COMMIT}" ]]; then
+ einfo "The current Staging patchset is not guaranteed to apply on this WINE commit."
+ einfo "If src_prepare fails, try emerging with the env var WINE_COMMIT."
+ einfo "Example: WINE_COMMIT=${COMPAT_WINE_COMMIT} emerge -1 wine"
+ fi
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ if use staging; then
+ ewarn "Applying the Wine-Staging patchset. Any bug reports to the"
+ ewarn "Wine bugzilla should explicitly state that staging was used."
+
+ local STAGING_EXCLUDE=""
+ STAGING_EXCLUDE="${STAGING_EXCLUDE} -W winhlp32-Flex_Workaround" # Avoid double patching https://bugs.winehq.org/show_bug.cgi?id=42132
+ use pipelight || STAGING_EXCLUDE="${STAGING_EXCLUDE} -W Pipelight"
+
+ # Launch wine-staging patcher in a subshell, using eapply as a backend, and gitapply.sh as a backend for binary patches
+ ebegin "Running Wine-Staging patch installer"
+ (
+ set -- DESTDIR="${S}" --backend=eapply --no-autoconf --all ${STAGING_EXCLUDE}
+ cd "${STAGING_DIR}/patches"
+ source "${STAGING_DIR}/patches/patchinstall.sh"
+ )
+ eend $? || die "Failed to apply Wine-Staging patches"
+ fi
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with X xfixes)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use staging && myconf+=(
+ --with-xattr
+ $(use_with themes gtk3)
+ $(use_with vaapi va)
+ )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine register --staging ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine deregister --staging ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-staging/wine-staging-2.12-r1.ebuild b/app-emulation/wine-staging/wine-staging-2.12-r1.ebuild
new file mode 100644
index 0000000..b119a5c
--- /dev/null
+++ b/app-emulation/wine-staging/wine-staging-2.12-r1.ebuild
@@ -0,0 +1,609 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+STAGING_P="wine-staging-${PV}"
+STAGING_DIR="${WORKDIR}/${STAGING_P}"
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, with Wine-Staging patchset"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+if [[ ${PV} == "9999" ]] ; then
+ STAGING_EGIT_REPO_URI="https://github.com/wine-compholio/wine-staging.git"
+else
+ SRC_URI="${SRC_URI}
+ staging? ( https://github.com/wine-compholio/wine-staging/archive/v${PV}.tar.gz -> ${STAGING_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap pipelight +png prelink pulseaudio +realtime +run-exes s3tc samba scanner selinux +ssl staging test themes +threads +truetype udev +udisks v4l vaapi +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ pipelight? ( staging )
+ s3tc? ( staging )
+ test? ( abi_x86_32 )
+ themes? ( staging )
+ vaapi? ( staging )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXfixes[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ staging? ( sys-apps/attr[${MULTILIB_USEDEP}] )
+ themes? (
+ dev-libs/glib:2[${MULTILIB_USEDEP}]
+ x11-libs/cairo[${MULTILIB_USEDEP}]
+ x11-libs/gtk+:3[${MULTILIB_USEDEP}]
+ )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ vaapi? ( x11-libs/libva[X,${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.0 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ s3tc? ( >=media-libs/libtxc_dxtn-1.0.1-r1[${MULTILIB_USEDEP}] )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ staging? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use staging; then
+ eerror "Because of the multi-repo nature of ${MY_PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, and STAGING_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use staging; then
+ local CURRENT_WINE_COMMIT=${EGIT_VERSION}
+
+ git-r3_fetch "${STAGING_EGIT_REPO_URI}" "${STAGING_COMMIT}"
+ git-r3_checkout "${STAGING_EGIT_REPO_URI}" "${STAGING_DIR}"
+
+ local COMPAT_WINE_COMMIT=$("${STAGING_DIR}/patches/patchinstall.sh" --upstream-commit) || die
+
+ if [[ "${CURRENT_WINE_COMMIT}" != "${COMPAT_WINE_COMMIT}" ]]; then
+ einfo "The current Staging patchset is not guaranteed to apply on this WINE commit."
+ einfo "If src_prepare fails, try emerging with the env var WINE_COMMIT."
+ einfo "Example: WINE_COMMIT=${COMPAT_WINE_COMMIT} emerge -1 wine"
+ fi
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ if use staging; then
+ ewarn "Applying the Wine-Staging patchset. Any bug reports to the"
+ ewarn "Wine bugzilla should explicitly state that staging was used."
+
+ local STAGING_EXCLUDE=""
+ STAGING_EXCLUDE="${STAGING_EXCLUDE} -W winhlp32-Flex_Workaround" # Avoid double patching https://bugs.winehq.org/show_bug.cgi?id=42132
+ use pipelight || STAGING_EXCLUDE="${STAGING_EXCLUDE} -W Pipelight"
+
+ # Launch wine-staging patcher in a subshell, using eapply as a backend, and gitapply.sh as a backend for binary patches
+ ebegin "Running Wine-Staging patch installer"
+ (
+ set -- DESTDIR="${S}" --backend=eapply --no-autoconf --all ${STAGING_EXCLUDE}
+ cd "${STAGING_DIR}/patches"
+ source "${STAGING_DIR}/patches/patchinstall.sh"
+ )
+ eend $? || die "Failed to apply Wine-Staging patches"
+ fi
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with X xfixes)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use staging && myconf+=(
+ --with-xattr
+ $(use_with themes gtk3)
+ $(use_with vaapi va)
+ )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine register --staging ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine deregister --staging ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-staging/wine-staging-2.13-r1.ebuild b/app-emulation/wine-staging/wine-staging-2.13-r1.ebuild
new file mode 100644
index 0000000..b119a5c
--- /dev/null
+++ b/app-emulation/wine-staging/wine-staging-2.13-r1.ebuild
@@ -0,0 +1,609 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+STAGING_P="wine-staging-${PV}"
+STAGING_DIR="${WORKDIR}/${STAGING_P}"
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, with Wine-Staging patchset"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+if [[ ${PV} == "9999" ]] ; then
+ STAGING_EGIT_REPO_URI="https://github.com/wine-compholio/wine-staging.git"
+else
+ SRC_URI="${SRC_URI}
+ staging? ( https://github.com/wine-compholio/wine-staging/archive/v${PV}.tar.gz -> ${STAGING_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap pipelight +png prelink pulseaudio +realtime +run-exes s3tc samba scanner selinux +ssl staging test themes +threads +truetype udev +udisks v4l vaapi +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ pipelight? ( staging )
+ s3tc? ( staging )
+ test? ( abi_x86_32 )
+ themes? ( staging )
+ vaapi? ( staging )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXfixes[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ staging? ( sys-apps/attr[${MULTILIB_USEDEP}] )
+ themes? (
+ dev-libs/glib:2[${MULTILIB_USEDEP}]
+ x11-libs/cairo[${MULTILIB_USEDEP}]
+ x11-libs/gtk+:3[${MULTILIB_USEDEP}]
+ )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ vaapi? ( x11-libs/libva[X,${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.0 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ s3tc? ( >=media-libs/libtxc_dxtn-1.0.1-r1[${MULTILIB_USEDEP}] )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ staging? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use staging; then
+ eerror "Because of the multi-repo nature of ${MY_PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, and STAGING_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use staging; then
+ local CURRENT_WINE_COMMIT=${EGIT_VERSION}
+
+ git-r3_fetch "${STAGING_EGIT_REPO_URI}" "${STAGING_COMMIT}"
+ git-r3_checkout "${STAGING_EGIT_REPO_URI}" "${STAGING_DIR}"
+
+ local COMPAT_WINE_COMMIT=$("${STAGING_DIR}/patches/patchinstall.sh" --upstream-commit) || die
+
+ if [[ "${CURRENT_WINE_COMMIT}" != "${COMPAT_WINE_COMMIT}" ]]; then
+ einfo "The current Staging patchset is not guaranteed to apply on this WINE commit."
+ einfo "If src_prepare fails, try emerging with the env var WINE_COMMIT."
+ einfo "Example: WINE_COMMIT=${COMPAT_WINE_COMMIT} emerge -1 wine"
+ fi
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ if use staging; then
+ ewarn "Applying the Wine-Staging patchset. Any bug reports to the"
+ ewarn "Wine bugzilla should explicitly state that staging was used."
+
+ local STAGING_EXCLUDE=""
+ STAGING_EXCLUDE="${STAGING_EXCLUDE} -W winhlp32-Flex_Workaround" # Avoid double patching https://bugs.winehq.org/show_bug.cgi?id=42132
+ use pipelight || STAGING_EXCLUDE="${STAGING_EXCLUDE} -W Pipelight"
+
+ # Launch wine-staging patcher in a subshell, using eapply as a backend, and gitapply.sh as a backend for binary patches
+ ebegin "Running Wine-Staging patch installer"
+ (
+ set -- DESTDIR="${S}" --backend=eapply --no-autoconf --all ${STAGING_EXCLUDE}
+ cd "${STAGING_DIR}/patches"
+ source "${STAGING_DIR}/patches/patchinstall.sh"
+ )
+ eend $? || die "Failed to apply Wine-Staging patches"
+ fi
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with X xfixes)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use staging && myconf+=(
+ --with-xattr
+ $(use_with themes gtk3)
+ $(use_with vaapi va)
+ )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine register --staging ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine deregister --staging ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-staging/wine-staging-2.14-r1.ebuild b/app-emulation/wine-staging/wine-staging-2.14-r1.ebuild
new file mode 100644
index 0000000..9df84ca
--- /dev/null
+++ b/app-emulation/wine-staging/wine-staging-2.14-r1.ebuild
@@ -0,0 +1,609 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+STAGING_P="wine-staging-${PV}"
+STAGING_DIR="${WORKDIR}/${STAGING_P}"
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, with Wine-Staging patchset"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+if [[ ${PV} == "9999" ]] ; then
+ STAGING_EGIT_REPO_URI="https://github.com/wine-compholio/wine-staging.git"
+else
+ SRC_URI="${SRC_URI}
+ staging? ( https://github.com/wine-compholio/wine-staging/archive/v${PV}.tar.gz -> ${STAGING_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap pipelight +png prelink pulseaudio +realtime +run-exes s3tc samba scanner selinux +ssl staging test themes +threads +truetype udev +udisks v4l vaapi +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ pipelight? ( staging )
+ s3tc? ( staging )
+ test? ( abi_x86_32 )
+ themes? ( staging )
+ vaapi? ( staging )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXfixes[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ staging? ( sys-apps/attr[${MULTILIB_USEDEP}] )
+ themes? (
+ dev-libs/glib:2[${MULTILIB_USEDEP}]
+ x11-libs/cairo[${MULTILIB_USEDEP}]
+ x11-libs/gtk+:3[${MULTILIB_USEDEP}]
+ )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ vaapi? ( x11-libs/libva[X,${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.1 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ s3tc? ( >=media-libs/libtxc_dxtn-1.0.1-r1[${MULTILIB_USEDEP}] )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ staging? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use staging; then
+ eerror "Because of the multi-repo nature of ${MY_PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, and STAGING_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use staging; then
+ local CURRENT_WINE_COMMIT=${EGIT_VERSION}
+
+ git-r3_fetch "${STAGING_EGIT_REPO_URI}" "${STAGING_COMMIT}"
+ git-r3_checkout "${STAGING_EGIT_REPO_URI}" "${STAGING_DIR}"
+
+ local COMPAT_WINE_COMMIT=$("${STAGING_DIR}/patches/patchinstall.sh" --upstream-commit) || die
+
+ if [[ "${CURRENT_WINE_COMMIT}" != "${COMPAT_WINE_COMMIT}" ]]; then
+ einfo "The current Staging patchset is not guaranteed to apply on this WINE commit."
+ einfo "If src_prepare fails, try emerging with the env var WINE_COMMIT."
+ einfo "Example: WINE_COMMIT=${COMPAT_WINE_COMMIT} emerge -1 wine"
+ fi
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ if use staging; then
+ ewarn "Applying the Wine-Staging patchset. Any bug reports to the"
+ ewarn "Wine bugzilla should explicitly state that staging was used."
+
+ local STAGING_EXCLUDE=""
+ STAGING_EXCLUDE="${STAGING_EXCLUDE} -W winhlp32-Flex_Workaround" # Avoid double patching https://bugs.winehq.org/show_bug.cgi?id=42132
+ use pipelight || STAGING_EXCLUDE="${STAGING_EXCLUDE} -W Pipelight"
+
+ # Launch wine-staging patcher in a subshell, using eapply as a backend, and gitapply.sh as a backend for binary patches
+ ebegin "Running Wine-Staging patch installer"
+ (
+ set -- DESTDIR="${S}" --backend=eapply --no-autoconf --all ${STAGING_EXCLUDE}
+ cd "${STAGING_DIR}/patches"
+ source "${STAGING_DIR}/patches/patchinstall.sh"
+ )
+ eend $? || die "Failed to apply Wine-Staging patches"
+ fi
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with X xfixes)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use staging && myconf+=(
+ --with-xattr
+ $(use_with themes gtk3)
+ $(use_with vaapi va)
+ )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine register --staging ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine deregister --staging ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-staging/wine-staging-2.15-r1.ebuild b/app-emulation/wine-staging/wine-staging-2.15-r1.ebuild
new file mode 100644
index 0000000..9df84ca
--- /dev/null
+++ b/app-emulation/wine-staging/wine-staging-2.15-r1.ebuild
@@ -0,0 +1,609 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+STAGING_P="wine-staging-${PV}"
+STAGING_DIR="${WORKDIR}/${STAGING_P}"
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, with Wine-Staging patchset"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+if [[ ${PV} == "9999" ]] ; then
+ STAGING_EGIT_REPO_URI="https://github.com/wine-compholio/wine-staging.git"
+else
+ SRC_URI="${SRC_URI}
+ staging? ( https://github.com/wine-compholio/wine-staging/archive/v${PV}.tar.gz -> ${STAGING_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap pipelight +png prelink pulseaudio +realtime +run-exes s3tc samba scanner selinux +ssl staging test themes +threads +truetype udev +udisks v4l vaapi +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ pipelight? ( staging )
+ s3tc? ( staging )
+ test? ( abi_x86_32 )
+ themes? ( staging )
+ vaapi? ( staging )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXfixes[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ staging? ( sys-apps/attr[${MULTILIB_USEDEP}] )
+ themes? (
+ dev-libs/glib:2[${MULTILIB_USEDEP}]
+ x11-libs/cairo[${MULTILIB_USEDEP}]
+ x11-libs/gtk+:3[${MULTILIB_USEDEP}]
+ )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ vaapi? ( x11-libs/libva[X,${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.1 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ s3tc? ( >=media-libs/libtxc_dxtn-1.0.1-r1[${MULTILIB_USEDEP}] )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ staging? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use staging; then
+ eerror "Because of the multi-repo nature of ${MY_PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, and STAGING_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use staging; then
+ local CURRENT_WINE_COMMIT=${EGIT_VERSION}
+
+ git-r3_fetch "${STAGING_EGIT_REPO_URI}" "${STAGING_COMMIT}"
+ git-r3_checkout "${STAGING_EGIT_REPO_URI}" "${STAGING_DIR}"
+
+ local COMPAT_WINE_COMMIT=$("${STAGING_DIR}/patches/patchinstall.sh" --upstream-commit) || die
+
+ if [[ "${CURRENT_WINE_COMMIT}" != "${COMPAT_WINE_COMMIT}" ]]; then
+ einfo "The current Staging patchset is not guaranteed to apply on this WINE commit."
+ einfo "If src_prepare fails, try emerging with the env var WINE_COMMIT."
+ einfo "Example: WINE_COMMIT=${COMPAT_WINE_COMMIT} emerge -1 wine"
+ fi
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ if use staging; then
+ ewarn "Applying the Wine-Staging patchset. Any bug reports to the"
+ ewarn "Wine bugzilla should explicitly state that staging was used."
+
+ local STAGING_EXCLUDE=""
+ STAGING_EXCLUDE="${STAGING_EXCLUDE} -W winhlp32-Flex_Workaround" # Avoid double patching https://bugs.winehq.org/show_bug.cgi?id=42132
+ use pipelight || STAGING_EXCLUDE="${STAGING_EXCLUDE} -W Pipelight"
+
+ # Launch wine-staging patcher in a subshell, using eapply as a backend, and gitapply.sh as a backend for binary patches
+ ebegin "Running Wine-Staging patch installer"
+ (
+ set -- DESTDIR="${S}" --backend=eapply --no-autoconf --all ${STAGING_EXCLUDE}
+ cd "${STAGING_DIR}/patches"
+ source "${STAGING_DIR}/patches/patchinstall.sh"
+ )
+ eend $? || die "Failed to apply Wine-Staging patches"
+ fi
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with X xfixes)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use staging && myconf+=(
+ --with-xattr
+ $(use_with themes gtk3)
+ $(use_with vaapi va)
+ )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine register --staging ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine deregister --staging ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-staging/wine-staging-2.16-r1.ebuild b/app-emulation/wine-staging/wine-staging-2.16-r1.ebuild
new file mode 100644
index 0000000..9df84ca
--- /dev/null
+++ b/app-emulation/wine-staging/wine-staging-2.16-r1.ebuild
@@ -0,0 +1,609 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+STAGING_P="wine-staging-${PV}"
+STAGING_DIR="${WORKDIR}/${STAGING_P}"
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, with Wine-Staging patchset"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+if [[ ${PV} == "9999" ]] ; then
+ STAGING_EGIT_REPO_URI="https://github.com/wine-compholio/wine-staging.git"
+else
+ SRC_URI="${SRC_URI}
+ staging? ( https://github.com/wine-compholio/wine-staging/archive/v${PV}.tar.gz -> ${STAGING_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap pipelight +png prelink pulseaudio +realtime +run-exes s3tc samba scanner selinux +ssl staging test themes +threads +truetype udev +udisks v4l vaapi +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ pipelight? ( staging )
+ s3tc? ( staging )
+ test? ( abi_x86_32 )
+ themes? ( staging )
+ vaapi? ( staging )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXfixes[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ staging? ( sys-apps/attr[${MULTILIB_USEDEP}] )
+ themes? (
+ dev-libs/glib:2[${MULTILIB_USEDEP}]
+ x11-libs/cairo[${MULTILIB_USEDEP}]
+ x11-libs/gtk+:3[${MULTILIB_USEDEP}]
+ )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ vaapi? ( x11-libs/libva[X,${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.1 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ s3tc? ( >=media-libs/libtxc_dxtn-1.0.1-r1[${MULTILIB_USEDEP}] )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ staging? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use staging; then
+ eerror "Because of the multi-repo nature of ${MY_PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, and STAGING_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use staging; then
+ local CURRENT_WINE_COMMIT=${EGIT_VERSION}
+
+ git-r3_fetch "${STAGING_EGIT_REPO_URI}" "${STAGING_COMMIT}"
+ git-r3_checkout "${STAGING_EGIT_REPO_URI}" "${STAGING_DIR}"
+
+ local COMPAT_WINE_COMMIT=$("${STAGING_DIR}/patches/patchinstall.sh" --upstream-commit) || die
+
+ if [[ "${CURRENT_WINE_COMMIT}" != "${COMPAT_WINE_COMMIT}" ]]; then
+ einfo "The current Staging patchset is not guaranteed to apply on this WINE commit."
+ einfo "If src_prepare fails, try emerging with the env var WINE_COMMIT."
+ einfo "Example: WINE_COMMIT=${COMPAT_WINE_COMMIT} emerge -1 wine"
+ fi
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ if use staging; then
+ ewarn "Applying the Wine-Staging patchset. Any bug reports to the"
+ ewarn "Wine bugzilla should explicitly state that staging was used."
+
+ local STAGING_EXCLUDE=""
+ STAGING_EXCLUDE="${STAGING_EXCLUDE} -W winhlp32-Flex_Workaround" # Avoid double patching https://bugs.winehq.org/show_bug.cgi?id=42132
+ use pipelight || STAGING_EXCLUDE="${STAGING_EXCLUDE} -W Pipelight"
+
+ # Launch wine-staging patcher in a subshell, using eapply as a backend, and gitapply.sh as a backend for binary patches
+ ebegin "Running Wine-Staging patch installer"
+ (
+ set -- DESTDIR="${S}" --backend=eapply --no-autoconf --all ${STAGING_EXCLUDE}
+ cd "${STAGING_DIR}/patches"
+ source "${STAGING_DIR}/patches/patchinstall.sh"
+ )
+ eend $? || die "Failed to apply Wine-Staging patches"
+ fi
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with X xfixes)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use staging && myconf+=(
+ --with-xattr
+ $(use_with themes gtk3)
+ $(use_with vaapi va)
+ )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine register --staging ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine deregister --staging ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-staging/wine-staging-2.17-r1.ebuild b/app-emulation/wine-staging/wine-staging-2.17-r1.ebuild
new file mode 100644
index 0000000..9df84ca
--- /dev/null
+++ b/app-emulation/wine-staging/wine-staging-2.17-r1.ebuild
@@ -0,0 +1,609 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+STAGING_P="wine-staging-${PV}"
+STAGING_DIR="${WORKDIR}/${STAGING_P}"
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, with Wine-Staging patchset"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+if [[ ${PV} == "9999" ]] ; then
+ STAGING_EGIT_REPO_URI="https://github.com/wine-compholio/wine-staging.git"
+else
+ SRC_URI="${SRC_URI}
+ staging? ( https://github.com/wine-compholio/wine-staging/archive/v${PV}.tar.gz -> ${STAGING_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap pipelight +png prelink pulseaudio +realtime +run-exes s3tc samba scanner selinux +ssl staging test themes +threads +truetype udev +udisks v4l vaapi +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ pipelight? ( staging )
+ s3tc? ( staging )
+ test? ( abi_x86_32 )
+ themes? ( staging )
+ vaapi? ( staging )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXfixes[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ staging? ( sys-apps/attr[${MULTILIB_USEDEP}] )
+ themes? (
+ dev-libs/glib:2[${MULTILIB_USEDEP}]
+ x11-libs/cairo[${MULTILIB_USEDEP}]
+ x11-libs/gtk+:3[${MULTILIB_USEDEP}]
+ )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ vaapi? ( x11-libs/libva[X,${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.1 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ s3tc? ( >=media-libs/libtxc_dxtn-1.0.1-r1[${MULTILIB_USEDEP}] )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ staging? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use staging; then
+ eerror "Because of the multi-repo nature of ${MY_PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, and STAGING_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use staging; then
+ local CURRENT_WINE_COMMIT=${EGIT_VERSION}
+
+ git-r3_fetch "${STAGING_EGIT_REPO_URI}" "${STAGING_COMMIT}"
+ git-r3_checkout "${STAGING_EGIT_REPO_URI}" "${STAGING_DIR}"
+
+ local COMPAT_WINE_COMMIT=$("${STAGING_DIR}/patches/patchinstall.sh" --upstream-commit) || die
+
+ if [[ "${CURRENT_WINE_COMMIT}" != "${COMPAT_WINE_COMMIT}" ]]; then
+ einfo "The current Staging patchset is not guaranteed to apply on this WINE commit."
+ einfo "If src_prepare fails, try emerging with the env var WINE_COMMIT."
+ einfo "Example: WINE_COMMIT=${COMPAT_WINE_COMMIT} emerge -1 wine"
+ fi
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ if use staging; then
+ ewarn "Applying the Wine-Staging patchset. Any bug reports to the"
+ ewarn "Wine bugzilla should explicitly state that staging was used."
+
+ local STAGING_EXCLUDE=""
+ STAGING_EXCLUDE="${STAGING_EXCLUDE} -W winhlp32-Flex_Workaround" # Avoid double patching https://bugs.winehq.org/show_bug.cgi?id=42132
+ use pipelight || STAGING_EXCLUDE="${STAGING_EXCLUDE} -W Pipelight"
+
+ # Launch wine-staging patcher in a subshell, using eapply as a backend, and gitapply.sh as a backend for binary patches
+ ebegin "Running Wine-Staging patch installer"
+ (
+ set -- DESTDIR="${S}" --backend=eapply --no-autoconf --all ${STAGING_EXCLUDE}
+ cd "${STAGING_DIR}/patches"
+ source "${STAGING_DIR}/patches/patchinstall.sh"
+ )
+ eend $? || die "Failed to apply Wine-Staging patches"
+ fi
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with X xfixes)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use staging && myconf+=(
+ --with-xattr
+ $(use_with themes gtk3)
+ $(use_with vaapi va)
+ )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine register --staging ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine deregister --staging ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-staging/wine-staging-2.18.ebuild b/app-emulation/wine-staging/wine-staging-2.18.ebuild
new file mode 100644
index 0000000..7fc52bb
--- /dev/null
+++ b/app-emulation/wine-staging/wine-staging-2.18.ebuild
@@ -0,0 +1,605 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+STAGING_P="wine-staging-${PV}"
+STAGING_DIR="${WORKDIR}/${STAGING_P}"
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, with Wine-Staging patchset"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+if [[ ${PV} == "9999" ]] ; then
+ STAGING_EGIT_REPO_URI="https://github.com/wine-compholio/wine-staging.git"
+else
+ SRC_URI="${SRC_URI}
+ staging? ( https://github.com/wine-compholio/wine-staging/archive/v${PV}.tar.gz -> ${STAGING_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap pipelight +png prelink pulseaudio +realtime +run-exes s3tc samba scanner selinux +ssl staging test themes +threads +truetype udev +udisks v4l vaapi +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ pipelight? ( staging )
+ s3tc? ( staging )
+ test? ( abi_x86_32 )
+ themes? ( staging )
+ vaapi? ( staging )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXfixes[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ staging? ( sys-apps/attr[${MULTILIB_USEDEP}] )
+ themes? (
+ dev-libs/glib:2[${MULTILIB_USEDEP}]
+ x11-libs/cairo[${MULTILIB_USEDEP}]
+ x11-libs/gtk+:3[${MULTILIB_USEDEP}]
+ )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ vaapi? ( x11-libs/libva[X,${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.1 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ s3tc? ( >=media-libs/libtxc_dxtn-1.0.1-r1[${MULTILIB_USEDEP}] )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ staging? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+)
+PATCHES_BIN=()
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use staging; then
+ eerror "Because of the multi-repo nature of ${MY_PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, and STAGING_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use staging; then
+ local CURRENT_WINE_COMMIT=${EGIT_VERSION}
+
+ git-r3_fetch "${STAGING_EGIT_REPO_URI}" "${STAGING_COMMIT}"
+ git-r3_checkout "${STAGING_EGIT_REPO_URI}" "${STAGING_DIR}"
+
+ local COMPAT_WINE_COMMIT=$("${STAGING_DIR}/patches/patchinstall.sh" --upstream-commit) || die
+
+ if [[ "${CURRENT_WINE_COMMIT}" != "${COMPAT_WINE_COMMIT}" ]]; then
+ einfo "The current Staging patchset is not guaranteed to apply on this WINE commit."
+ einfo "If src_prepare fails, try emerging with the env var WINE_COMMIT."
+ einfo "Example: WINE_COMMIT=${COMPAT_WINE_COMMIT} emerge -1 wine"
+ fi
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ if use staging; then
+ ewarn "Applying the Wine-Staging patchset. Any bug reports to the"
+ ewarn "Wine bugzilla should explicitly state that staging was used."
+
+ local STAGING_EXCLUDE=""
+ STAGING_EXCLUDE="${STAGING_EXCLUDE} -W winhlp32-Flex_Workaround" # Avoid double patching https://bugs.winehq.org/show_bug.cgi?id=42132
+ use pipelight || STAGING_EXCLUDE="${STAGING_EXCLUDE} -W Pipelight"
+
+ # Launch wine-staging patcher in a subshell, using eapply as a backend, and gitapply.sh as a backend for binary patches
+ ebegin "Running Wine-Staging patch installer"
+ (
+ set -- DESTDIR="${S}" --backend=eapply --no-autoconf --all ${STAGING_EXCLUDE}
+ cd "${STAGING_DIR}/patches"
+ source "${STAGING_DIR}/patches/patchinstall.sh"
+ )
+ eend $? || die "Failed to apply Wine-Staging patches"
+ fi
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with X xfixes)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use staging && myconf+=(
+ --with-xattr
+ $(use_with themes gtk3)
+ $(use_with vaapi va)
+ )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine register --staging ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine deregister --staging ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-staging/wine-staging-2.19.ebuild b/app-emulation/wine-staging/wine-staging-2.19.ebuild
new file mode 100644
index 0000000..7fc52bb
--- /dev/null
+++ b/app-emulation/wine-staging/wine-staging-2.19.ebuild
@@ -0,0 +1,605 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+STAGING_P="wine-staging-${PV}"
+STAGING_DIR="${WORKDIR}/${STAGING_P}"
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, with Wine-Staging patchset"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+if [[ ${PV} == "9999" ]] ; then
+ STAGING_EGIT_REPO_URI="https://github.com/wine-compholio/wine-staging.git"
+else
+ SRC_URI="${SRC_URI}
+ staging? ( https://github.com/wine-compholio/wine-staging/archive/v${PV}.tar.gz -> ${STAGING_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap pipelight +png prelink pulseaudio +realtime +run-exes s3tc samba scanner selinux +ssl staging test themes +threads +truetype udev +udisks v4l vaapi +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ pipelight? ( staging )
+ s3tc? ( staging )
+ test? ( abi_x86_32 )
+ themes? ( staging )
+ vaapi? ( staging )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXfixes[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ staging? ( sys-apps/attr[${MULTILIB_USEDEP}] )
+ themes? (
+ dev-libs/glib:2[${MULTILIB_USEDEP}]
+ x11-libs/cairo[${MULTILIB_USEDEP}]
+ x11-libs/gtk+:3[${MULTILIB_USEDEP}]
+ )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ vaapi? ( x11-libs/libva[X,${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.1 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ s3tc? ( >=media-libs/libtxc_dxtn-1.0.1-r1[${MULTILIB_USEDEP}] )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ staging? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+)
+PATCHES_BIN=()
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use staging; then
+ eerror "Because of the multi-repo nature of ${MY_PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, and STAGING_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use staging; then
+ local CURRENT_WINE_COMMIT=${EGIT_VERSION}
+
+ git-r3_fetch "${STAGING_EGIT_REPO_URI}" "${STAGING_COMMIT}"
+ git-r3_checkout "${STAGING_EGIT_REPO_URI}" "${STAGING_DIR}"
+
+ local COMPAT_WINE_COMMIT=$("${STAGING_DIR}/patches/patchinstall.sh" --upstream-commit) || die
+
+ if [[ "${CURRENT_WINE_COMMIT}" != "${COMPAT_WINE_COMMIT}" ]]; then
+ einfo "The current Staging patchset is not guaranteed to apply on this WINE commit."
+ einfo "If src_prepare fails, try emerging with the env var WINE_COMMIT."
+ einfo "Example: WINE_COMMIT=${COMPAT_WINE_COMMIT} emerge -1 wine"
+ fi
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ if use staging; then
+ ewarn "Applying the Wine-Staging patchset. Any bug reports to the"
+ ewarn "Wine bugzilla should explicitly state that staging was used."
+
+ local STAGING_EXCLUDE=""
+ STAGING_EXCLUDE="${STAGING_EXCLUDE} -W winhlp32-Flex_Workaround" # Avoid double patching https://bugs.winehq.org/show_bug.cgi?id=42132
+ use pipelight || STAGING_EXCLUDE="${STAGING_EXCLUDE} -W Pipelight"
+
+ # Launch wine-staging patcher in a subshell, using eapply as a backend, and gitapply.sh as a backend for binary patches
+ ebegin "Running Wine-Staging patch installer"
+ (
+ set -- DESTDIR="${S}" --backend=eapply --no-autoconf --all ${STAGING_EXCLUDE}
+ cd "${STAGING_DIR}/patches"
+ source "${STAGING_DIR}/patches/patchinstall.sh"
+ )
+ eend $? || die "Failed to apply Wine-Staging patches"
+ fi
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with X xfixes)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use staging && myconf+=(
+ --with-xattr
+ $(use_with themes gtk3)
+ $(use_with vaapi va)
+ )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine register --staging ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine deregister --staging ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-staging/wine-staging-2.2-r1.ebuild b/app-emulation/wine-staging/wine-staging-2.2-r1.ebuild
new file mode 100644
index 0000000..1177c55
--- /dev/null
+++ b/app-emulation/wine-staging/wine-staging-2.2-r1.ebuild
@@ -0,0 +1,607 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+STAGING_P="wine-staging-${PV}"
+STAGING_DIR="${WORKDIR}/${STAGING_P}"
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, with Wine-Staging patchset"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+if [[ ${PV} == "9999" ]] ; then
+ STAGING_EGIT_REPO_URI="https://github.com/wine-compholio/wine-staging.git"
+else
+ SRC_URI="${SRC_URI}
+ staging? ( https://github.com/wine-compholio/wine-staging/archive/v${PV}.tar.gz -> ${STAGING_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap pipelight +png prelink pulseaudio +realtime +run-exes s3tc samba scanner selinux +ssl staging test themes +threads +truetype udev +udisks v4l vaapi +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ pipelight? ( staging )
+ s3tc? ( staging )
+ test? ( abi_x86_32 )
+ themes? ( staging )
+ vaapi? ( staging )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ staging? ( sys-apps/attr[${MULTILIB_USEDEP}] )
+ themes? (
+ dev-libs/glib:2[${MULTILIB_USEDEP}]
+ x11-libs/cairo[${MULTILIB_USEDEP}]
+ x11-libs/gtk+:3[${MULTILIB_USEDEP}]
+ )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ vaapi? ( x11-libs/libva[X,${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.6.4 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ s3tc? ( >=media-libs/libtxc_dxtn-1.0.1-r1[${MULTILIB_USEDEP}] )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ staging? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use staging; then
+ eerror "Because of the multi-repo nature of ${MY_PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, and STAGING_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use staging; then
+ local CURRENT_WINE_COMMIT=${EGIT_VERSION}
+
+ git-r3_fetch "${STAGING_EGIT_REPO_URI}" "${STAGING_COMMIT}"
+ git-r3_checkout "${STAGING_EGIT_REPO_URI}" "${STAGING_DIR}"
+
+ local COMPAT_WINE_COMMIT=$("${STAGING_DIR}/patches/patchinstall.sh" --upstream-commit) || die
+
+ if [[ "${CURRENT_WINE_COMMIT}" != "${COMPAT_WINE_COMMIT}" ]]; then
+ einfo "The current Staging patchset is not guaranteed to apply on this WINE commit."
+ einfo "If src_prepare fails, try emerging with the env var WINE_COMMIT."
+ einfo "Example: WINE_COMMIT=${COMPAT_WINE_COMMIT} emerge -1 wine"
+ fi
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ if use staging; then
+ ewarn "Applying the Wine-Staging patchset. Any bug reports to the"
+ ewarn "Wine bugzilla should explicitly state that staging was used."
+
+ local STAGING_EXCLUDE=""
+ STAGING_EXCLUDE="${STAGING_EXCLUDE} -W winhlp32-Flex_Workaround" # Avoid double patching https://bugs.winehq.org/show_bug.cgi?id=42132
+ use pipelight || STAGING_EXCLUDE="${STAGING_EXCLUDE} -W Pipelight"
+
+ # Launch wine-staging patcher in a subshell, using eapply as a backend, and gitapply.sh as a backend for binary patches
+ ebegin "Running Wine-Staging patch installer"
+ (
+ set -- DESTDIR="${S}" --backend=eapply --no-autoconf --all ${STAGING_EXCLUDE}
+ cd "${STAGING_DIR}/patches"
+ source "${STAGING_DIR}/patches/patchinstall.sh"
+ )
+ eend $? || die "Failed to apply Wine-Staging patches"
+ fi
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use staging && myconf+=(
+ --with-xattr
+ $(use_with themes gtk3)
+ $(use_with vaapi va)
+ )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine register --staging ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine deregister --staging ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-staging/wine-staging-2.3-r1.ebuild b/app-emulation/wine-staging/wine-staging-2.3-r1.ebuild
new file mode 100644
index 0000000..1177c55
--- /dev/null
+++ b/app-emulation/wine-staging/wine-staging-2.3-r1.ebuild
@@ -0,0 +1,607 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+STAGING_P="wine-staging-${PV}"
+STAGING_DIR="${WORKDIR}/${STAGING_P}"
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, with Wine-Staging patchset"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+if [[ ${PV} == "9999" ]] ; then
+ STAGING_EGIT_REPO_URI="https://github.com/wine-compholio/wine-staging.git"
+else
+ SRC_URI="${SRC_URI}
+ staging? ( https://github.com/wine-compholio/wine-staging/archive/v${PV}.tar.gz -> ${STAGING_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap pipelight +png prelink pulseaudio +realtime +run-exes s3tc samba scanner selinux +ssl staging test themes +threads +truetype udev +udisks v4l vaapi +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ pipelight? ( staging )
+ s3tc? ( staging )
+ test? ( abi_x86_32 )
+ themes? ( staging )
+ vaapi? ( staging )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ staging? ( sys-apps/attr[${MULTILIB_USEDEP}] )
+ themes? (
+ dev-libs/glib:2[${MULTILIB_USEDEP}]
+ x11-libs/cairo[${MULTILIB_USEDEP}]
+ x11-libs/gtk+:3[${MULTILIB_USEDEP}]
+ )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ vaapi? ( x11-libs/libva[X,${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.6.4 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ s3tc? ( >=media-libs/libtxc_dxtn-1.0.1-r1[${MULTILIB_USEDEP}] )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ staging? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use staging; then
+ eerror "Because of the multi-repo nature of ${MY_PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, and STAGING_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use staging; then
+ local CURRENT_WINE_COMMIT=${EGIT_VERSION}
+
+ git-r3_fetch "${STAGING_EGIT_REPO_URI}" "${STAGING_COMMIT}"
+ git-r3_checkout "${STAGING_EGIT_REPO_URI}" "${STAGING_DIR}"
+
+ local COMPAT_WINE_COMMIT=$("${STAGING_DIR}/patches/patchinstall.sh" --upstream-commit) || die
+
+ if [[ "${CURRENT_WINE_COMMIT}" != "${COMPAT_WINE_COMMIT}" ]]; then
+ einfo "The current Staging patchset is not guaranteed to apply on this WINE commit."
+ einfo "If src_prepare fails, try emerging with the env var WINE_COMMIT."
+ einfo "Example: WINE_COMMIT=${COMPAT_WINE_COMMIT} emerge -1 wine"
+ fi
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ if use staging; then
+ ewarn "Applying the Wine-Staging patchset. Any bug reports to the"
+ ewarn "Wine bugzilla should explicitly state that staging was used."
+
+ local STAGING_EXCLUDE=""
+ STAGING_EXCLUDE="${STAGING_EXCLUDE} -W winhlp32-Flex_Workaround" # Avoid double patching https://bugs.winehq.org/show_bug.cgi?id=42132
+ use pipelight || STAGING_EXCLUDE="${STAGING_EXCLUDE} -W Pipelight"
+
+ # Launch wine-staging patcher in a subshell, using eapply as a backend, and gitapply.sh as a backend for binary patches
+ ebegin "Running Wine-Staging patch installer"
+ (
+ set -- DESTDIR="${S}" --backend=eapply --no-autoconf --all ${STAGING_EXCLUDE}
+ cd "${STAGING_DIR}/patches"
+ source "${STAGING_DIR}/patches/patchinstall.sh"
+ )
+ eend $? || die "Failed to apply Wine-Staging patches"
+ fi
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use staging && myconf+=(
+ --with-xattr
+ $(use_with themes gtk3)
+ $(use_with vaapi va)
+ )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine register --staging ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine deregister --staging ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-staging/wine-staging-2.4-r1.ebuild b/app-emulation/wine-staging/wine-staging-2.4-r1.ebuild
new file mode 100644
index 0000000..f4d14b2
--- /dev/null
+++ b/app-emulation/wine-staging/wine-staging-2.4-r1.ebuild
@@ -0,0 +1,607 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+STAGING_P="wine-staging-${PV}"
+STAGING_DIR="${WORKDIR}/${STAGING_P}"
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, with Wine-Staging patchset"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+if [[ ${PV} == "9999" ]] ; then
+ STAGING_EGIT_REPO_URI="https://github.com/wine-compholio/wine-staging.git"
+else
+ SRC_URI="${SRC_URI}
+ staging? ( https://github.com/wine-compholio/wine-staging/archive/v${PV}.tar.gz -> ${STAGING_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap pipelight +png prelink pulseaudio +realtime +run-exes s3tc samba scanner selinux +ssl staging test themes +threads +truetype udev +udisks v4l vaapi +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ pipelight? ( staging )
+ s3tc? ( staging )
+ test? ( abi_x86_32 )
+ themes? ( staging )
+ vaapi? ( staging )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ staging? ( sys-apps/attr[${MULTILIB_USEDEP}] )
+ themes? (
+ dev-libs/glib:2[${MULTILIB_USEDEP}]
+ x11-libs/cairo[${MULTILIB_USEDEP}]
+ x11-libs/gtk+:3[${MULTILIB_USEDEP}]
+ )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ vaapi? ( x11-libs/libva[X,${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.0 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ s3tc? ( >=media-libs/libtxc_dxtn-1.0.1-r1[${MULTILIB_USEDEP}] )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ staging? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use staging; then
+ eerror "Because of the multi-repo nature of ${MY_PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, and STAGING_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use staging; then
+ local CURRENT_WINE_COMMIT=${EGIT_VERSION}
+
+ git-r3_fetch "${STAGING_EGIT_REPO_URI}" "${STAGING_COMMIT}"
+ git-r3_checkout "${STAGING_EGIT_REPO_URI}" "${STAGING_DIR}"
+
+ local COMPAT_WINE_COMMIT=$("${STAGING_DIR}/patches/patchinstall.sh" --upstream-commit) || die
+
+ if [[ "${CURRENT_WINE_COMMIT}" != "${COMPAT_WINE_COMMIT}" ]]; then
+ einfo "The current Staging patchset is not guaranteed to apply on this WINE commit."
+ einfo "If src_prepare fails, try emerging with the env var WINE_COMMIT."
+ einfo "Example: WINE_COMMIT=${COMPAT_WINE_COMMIT} emerge -1 wine"
+ fi
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ if use staging; then
+ ewarn "Applying the Wine-Staging patchset. Any bug reports to the"
+ ewarn "Wine bugzilla should explicitly state that staging was used."
+
+ local STAGING_EXCLUDE=""
+ STAGING_EXCLUDE="${STAGING_EXCLUDE} -W winhlp32-Flex_Workaround" # Avoid double patching https://bugs.winehq.org/show_bug.cgi?id=42132
+ use pipelight || STAGING_EXCLUDE="${STAGING_EXCLUDE} -W Pipelight"
+
+ # Launch wine-staging patcher in a subshell, using eapply as a backend, and gitapply.sh as a backend for binary patches
+ ebegin "Running Wine-Staging patch installer"
+ (
+ set -- DESTDIR="${S}" --backend=eapply --no-autoconf --all ${STAGING_EXCLUDE}
+ cd "${STAGING_DIR}/patches"
+ source "${STAGING_DIR}/patches/patchinstall.sh"
+ )
+ eend $? || die "Failed to apply Wine-Staging patches"
+ fi
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use staging && myconf+=(
+ --with-xattr
+ $(use_with themes gtk3)
+ $(use_with vaapi va)
+ )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine register --staging ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine deregister --staging ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-staging/wine-staging-2.5-r1.ebuild b/app-emulation/wine-staging/wine-staging-2.5-r1.ebuild
new file mode 100644
index 0000000..f4d14b2
--- /dev/null
+++ b/app-emulation/wine-staging/wine-staging-2.5-r1.ebuild
@@ -0,0 +1,607 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+STAGING_P="wine-staging-${PV}"
+STAGING_DIR="${WORKDIR}/${STAGING_P}"
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, with Wine-Staging patchset"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+if [[ ${PV} == "9999" ]] ; then
+ STAGING_EGIT_REPO_URI="https://github.com/wine-compholio/wine-staging.git"
+else
+ SRC_URI="${SRC_URI}
+ staging? ( https://github.com/wine-compholio/wine-staging/archive/v${PV}.tar.gz -> ${STAGING_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap pipelight +png prelink pulseaudio +realtime +run-exes s3tc samba scanner selinux +ssl staging test themes +threads +truetype udev +udisks v4l vaapi +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ pipelight? ( staging )
+ s3tc? ( staging )
+ test? ( abi_x86_32 )
+ themes? ( staging )
+ vaapi? ( staging )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ staging? ( sys-apps/attr[${MULTILIB_USEDEP}] )
+ themes? (
+ dev-libs/glib:2[${MULTILIB_USEDEP}]
+ x11-libs/cairo[${MULTILIB_USEDEP}]
+ x11-libs/gtk+:3[${MULTILIB_USEDEP}]
+ )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ vaapi? ( x11-libs/libva[X,${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.0 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ s3tc? ( >=media-libs/libtxc_dxtn-1.0.1-r1[${MULTILIB_USEDEP}] )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ staging? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use staging; then
+ eerror "Because of the multi-repo nature of ${MY_PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, and STAGING_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use staging; then
+ local CURRENT_WINE_COMMIT=${EGIT_VERSION}
+
+ git-r3_fetch "${STAGING_EGIT_REPO_URI}" "${STAGING_COMMIT}"
+ git-r3_checkout "${STAGING_EGIT_REPO_URI}" "${STAGING_DIR}"
+
+ local COMPAT_WINE_COMMIT=$("${STAGING_DIR}/patches/patchinstall.sh" --upstream-commit) || die
+
+ if [[ "${CURRENT_WINE_COMMIT}" != "${COMPAT_WINE_COMMIT}" ]]; then
+ einfo "The current Staging patchset is not guaranteed to apply on this WINE commit."
+ einfo "If src_prepare fails, try emerging with the env var WINE_COMMIT."
+ einfo "Example: WINE_COMMIT=${COMPAT_WINE_COMMIT} emerge -1 wine"
+ fi
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ if use staging; then
+ ewarn "Applying the Wine-Staging patchset. Any bug reports to the"
+ ewarn "Wine bugzilla should explicitly state that staging was used."
+
+ local STAGING_EXCLUDE=""
+ STAGING_EXCLUDE="${STAGING_EXCLUDE} -W winhlp32-Flex_Workaround" # Avoid double patching https://bugs.winehq.org/show_bug.cgi?id=42132
+ use pipelight || STAGING_EXCLUDE="${STAGING_EXCLUDE} -W Pipelight"
+
+ # Launch wine-staging patcher in a subshell, using eapply as a backend, and gitapply.sh as a backend for binary patches
+ ebegin "Running Wine-Staging patch installer"
+ (
+ set -- DESTDIR="${S}" --backend=eapply --no-autoconf --all ${STAGING_EXCLUDE}
+ cd "${STAGING_DIR}/patches"
+ source "${STAGING_DIR}/patches/patchinstall.sh"
+ )
+ eend $? || die "Failed to apply Wine-Staging patches"
+ fi
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use staging && myconf+=(
+ --with-xattr
+ $(use_with themes gtk3)
+ $(use_with vaapi va)
+ )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine register --staging ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine deregister --staging ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-staging/wine-staging-2.6-r1.ebuild b/app-emulation/wine-staging/wine-staging-2.6-r1.ebuild
new file mode 100644
index 0000000..f4d14b2
--- /dev/null
+++ b/app-emulation/wine-staging/wine-staging-2.6-r1.ebuild
@@ -0,0 +1,607 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+STAGING_P="wine-staging-${PV}"
+STAGING_DIR="${WORKDIR}/${STAGING_P}"
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, with Wine-Staging patchset"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+if [[ ${PV} == "9999" ]] ; then
+ STAGING_EGIT_REPO_URI="https://github.com/wine-compholio/wine-staging.git"
+else
+ SRC_URI="${SRC_URI}
+ staging? ( https://github.com/wine-compholio/wine-staging/archive/v${PV}.tar.gz -> ${STAGING_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap pipelight +png prelink pulseaudio +realtime +run-exes s3tc samba scanner selinux +ssl staging test themes +threads +truetype udev +udisks v4l vaapi +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ pipelight? ( staging )
+ s3tc? ( staging )
+ test? ( abi_x86_32 )
+ themes? ( staging )
+ vaapi? ( staging )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ staging? ( sys-apps/attr[${MULTILIB_USEDEP}] )
+ themes? (
+ dev-libs/glib:2[${MULTILIB_USEDEP}]
+ x11-libs/cairo[${MULTILIB_USEDEP}]
+ x11-libs/gtk+:3[${MULTILIB_USEDEP}]
+ )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ vaapi? ( x11-libs/libva[X,${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.0 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ s3tc? ( >=media-libs/libtxc_dxtn-1.0.1-r1[${MULTILIB_USEDEP}] )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ staging? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use staging; then
+ eerror "Because of the multi-repo nature of ${MY_PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, and STAGING_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use staging; then
+ local CURRENT_WINE_COMMIT=${EGIT_VERSION}
+
+ git-r3_fetch "${STAGING_EGIT_REPO_URI}" "${STAGING_COMMIT}"
+ git-r3_checkout "${STAGING_EGIT_REPO_URI}" "${STAGING_DIR}"
+
+ local COMPAT_WINE_COMMIT=$("${STAGING_DIR}/patches/patchinstall.sh" --upstream-commit) || die
+
+ if [[ "${CURRENT_WINE_COMMIT}" != "${COMPAT_WINE_COMMIT}" ]]; then
+ einfo "The current Staging patchset is not guaranteed to apply on this WINE commit."
+ einfo "If src_prepare fails, try emerging with the env var WINE_COMMIT."
+ einfo "Example: WINE_COMMIT=${COMPAT_WINE_COMMIT} emerge -1 wine"
+ fi
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ if use staging; then
+ ewarn "Applying the Wine-Staging patchset. Any bug reports to the"
+ ewarn "Wine bugzilla should explicitly state that staging was used."
+
+ local STAGING_EXCLUDE=""
+ STAGING_EXCLUDE="${STAGING_EXCLUDE} -W winhlp32-Flex_Workaround" # Avoid double patching https://bugs.winehq.org/show_bug.cgi?id=42132
+ use pipelight || STAGING_EXCLUDE="${STAGING_EXCLUDE} -W Pipelight"
+
+ # Launch wine-staging patcher in a subshell, using eapply as a backend, and gitapply.sh as a backend for binary patches
+ ebegin "Running Wine-Staging patch installer"
+ (
+ set -- DESTDIR="${S}" --backend=eapply --no-autoconf --all ${STAGING_EXCLUDE}
+ cd "${STAGING_DIR}/patches"
+ source "${STAGING_DIR}/patches/patchinstall.sh"
+ )
+ eend $? || die "Failed to apply Wine-Staging patches"
+ fi
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use staging && myconf+=(
+ --with-xattr
+ $(use_with themes gtk3)
+ $(use_with vaapi va)
+ )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine register --staging ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine deregister --staging ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-staging/wine-staging-2.7-r1.ebuild b/app-emulation/wine-staging/wine-staging-2.7-r1.ebuild
new file mode 100644
index 0000000..f4d14b2
--- /dev/null
+++ b/app-emulation/wine-staging/wine-staging-2.7-r1.ebuild
@@ -0,0 +1,607 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+STAGING_P="wine-staging-${PV}"
+STAGING_DIR="${WORKDIR}/${STAGING_P}"
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, with Wine-Staging patchset"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+if [[ ${PV} == "9999" ]] ; then
+ STAGING_EGIT_REPO_URI="https://github.com/wine-compholio/wine-staging.git"
+else
+ SRC_URI="${SRC_URI}
+ staging? ( https://github.com/wine-compholio/wine-staging/archive/v${PV}.tar.gz -> ${STAGING_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap pipelight +png prelink pulseaudio +realtime +run-exes s3tc samba scanner selinux +ssl staging test themes +threads +truetype udev +udisks v4l vaapi +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ pipelight? ( staging )
+ s3tc? ( staging )
+ test? ( abi_x86_32 )
+ themes? ( staging )
+ vaapi? ( staging )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ staging? ( sys-apps/attr[${MULTILIB_USEDEP}] )
+ themes? (
+ dev-libs/glib:2[${MULTILIB_USEDEP}]
+ x11-libs/cairo[${MULTILIB_USEDEP}]
+ x11-libs/gtk+:3[${MULTILIB_USEDEP}]
+ )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ vaapi? ( x11-libs/libva[X,${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.0 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ s3tc? ( >=media-libs/libtxc_dxtn-1.0.1-r1[${MULTILIB_USEDEP}] )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ staging? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use staging; then
+ eerror "Because of the multi-repo nature of ${MY_PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, and STAGING_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use staging; then
+ local CURRENT_WINE_COMMIT=${EGIT_VERSION}
+
+ git-r3_fetch "${STAGING_EGIT_REPO_URI}" "${STAGING_COMMIT}"
+ git-r3_checkout "${STAGING_EGIT_REPO_URI}" "${STAGING_DIR}"
+
+ local COMPAT_WINE_COMMIT=$("${STAGING_DIR}/patches/patchinstall.sh" --upstream-commit) || die
+
+ if [[ "${CURRENT_WINE_COMMIT}" != "${COMPAT_WINE_COMMIT}" ]]; then
+ einfo "The current Staging patchset is not guaranteed to apply on this WINE commit."
+ einfo "If src_prepare fails, try emerging with the env var WINE_COMMIT."
+ einfo "Example: WINE_COMMIT=${COMPAT_WINE_COMMIT} emerge -1 wine"
+ fi
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ if use staging; then
+ ewarn "Applying the Wine-Staging patchset. Any bug reports to the"
+ ewarn "Wine bugzilla should explicitly state that staging was used."
+
+ local STAGING_EXCLUDE=""
+ STAGING_EXCLUDE="${STAGING_EXCLUDE} -W winhlp32-Flex_Workaround" # Avoid double patching https://bugs.winehq.org/show_bug.cgi?id=42132
+ use pipelight || STAGING_EXCLUDE="${STAGING_EXCLUDE} -W Pipelight"
+
+ # Launch wine-staging patcher in a subshell, using eapply as a backend, and gitapply.sh as a backend for binary patches
+ ebegin "Running Wine-Staging patch installer"
+ (
+ set -- DESTDIR="${S}" --backend=eapply --no-autoconf --all ${STAGING_EXCLUDE}
+ cd "${STAGING_DIR}/patches"
+ source "${STAGING_DIR}/patches/patchinstall.sh"
+ )
+ eend $? || die "Failed to apply Wine-Staging patches"
+ fi
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use staging && myconf+=(
+ --with-xattr
+ $(use_with themes gtk3)
+ $(use_with vaapi va)
+ )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine register --staging ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine deregister --staging ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-staging/wine-staging-2.8-r1.ebuild b/app-emulation/wine-staging/wine-staging-2.8-r1.ebuild
new file mode 100644
index 0000000..f4d14b2
--- /dev/null
+++ b/app-emulation/wine-staging/wine-staging-2.8-r1.ebuild
@@ -0,0 +1,607 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+STAGING_P="wine-staging-${PV}"
+STAGING_DIR="${WORKDIR}/${STAGING_P}"
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, with Wine-Staging patchset"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+if [[ ${PV} == "9999" ]] ; then
+ STAGING_EGIT_REPO_URI="https://github.com/wine-compholio/wine-staging.git"
+else
+ SRC_URI="${SRC_URI}
+ staging? ( https://github.com/wine-compholio/wine-staging/archive/v${PV}.tar.gz -> ${STAGING_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap pipelight +png prelink pulseaudio +realtime +run-exes s3tc samba scanner selinux +ssl staging test themes +threads +truetype udev +udisks v4l vaapi +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ pipelight? ( staging )
+ s3tc? ( staging )
+ test? ( abi_x86_32 )
+ themes? ( staging )
+ vaapi? ( staging )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ staging? ( sys-apps/attr[${MULTILIB_USEDEP}] )
+ themes? (
+ dev-libs/glib:2[${MULTILIB_USEDEP}]
+ x11-libs/cairo[${MULTILIB_USEDEP}]
+ x11-libs/gtk+:3[${MULTILIB_USEDEP}]
+ )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ vaapi? ( x11-libs/libva[X,${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.0 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ s3tc? ( >=media-libs/libtxc_dxtn-1.0.1-r1[${MULTILIB_USEDEP}] )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ staging? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use staging; then
+ eerror "Because of the multi-repo nature of ${MY_PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, and STAGING_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use staging; then
+ local CURRENT_WINE_COMMIT=${EGIT_VERSION}
+
+ git-r3_fetch "${STAGING_EGIT_REPO_URI}" "${STAGING_COMMIT}"
+ git-r3_checkout "${STAGING_EGIT_REPO_URI}" "${STAGING_DIR}"
+
+ local COMPAT_WINE_COMMIT=$("${STAGING_DIR}/patches/patchinstall.sh" --upstream-commit) || die
+
+ if [[ "${CURRENT_WINE_COMMIT}" != "${COMPAT_WINE_COMMIT}" ]]; then
+ einfo "The current Staging patchset is not guaranteed to apply on this WINE commit."
+ einfo "If src_prepare fails, try emerging with the env var WINE_COMMIT."
+ einfo "Example: WINE_COMMIT=${COMPAT_WINE_COMMIT} emerge -1 wine"
+ fi
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ if use staging; then
+ ewarn "Applying the Wine-Staging patchset. Any bug reports to the"
+ ewarn "Wine bugzilla should explicitly state that staging was used."
+
+ local STAGING_EXCLUDE=""
+ STAGING_EXCLUDE="${STAGING_EXCLUDE} -W winhlp32-Flex_Workaround" # Avoid double patching https://bugs.winehq.org/show_bug.cgi?id=42132
+ use pipelight || STAGING_EXCLUDE="${STAGING_EXCLUDE} -W Pipelight"
+
+ # Launch wine-staging patcher in a subshell, using eapply as a backend, and gitapply.sh as a backend for binary patches
+ ebegin "Running Wine-Staging patch installer"
+ (
+ set -- DESTDIR="${S}" --backend=eapply --no-autoconf --all ${STAGING_EXCLUDE}
+ cd "${STAGING_DIR}/patches"
+ source "${STAGING_DIR}/patches/patchinstall.sh"
+ )
+ eend $? || die "Failed to apply Wine-Staging patches"
+ fi
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use staging && myconf+=(
+ --with-xattr
+ $(use_with themes gtk3)
+ $(use_with vaapi va)
+ )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine register --staging ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine deregister --staging ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-staging/wine-staging-2.9-r1.ebuild b/app-emulation/wine-staging/wine-staging-2.9-r1.ebuild
new file mode 100644
index 0000000..b119a5c
--- /dev/null
+++ b/app-emulation/wine-staging/wine-staging-2.9-r1.ebuild
@@ -0,0 +1,609 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+STAGING_P="wine-staging-${PV}"
+STAGING_DIR="${WORKDIR}/${STAGING_P}"
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, with Wine-Staging patchset"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+if [[ ${PV} == "9999" ]] ; then
+ STAGING_EGIT_REPO_URI="https://github.com/wine-compholio/wine-staging.git"
+else
+ SRC_URI="${SRC_URI}
+ staging? ( https://github.com/wine-compholio/wine-staging/archive/v${PV}.tar.gz -> ${STAGING_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap pipelight +png prelink pulseaudio +realtime +run-exes s3tc samba scanner selinux +ssl staging test themes +threads +truetype udev +udisks v4l vaapi +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ pipelight? ( staging )
+ s3tc? ( staging )
+ test? ( abi_x86_32 )
+ themes? ( staging )
+ vaapi? ( staging )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXfixes[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ staging? ( sys-apps/attr[${MULTILIB_USEDEP}] )
+ themes? (
+ dev-libs/glib:2[${MULTILIB_USEDEP}]
+ x11-libs/cairo[${MULTILIB_USEDEP}]
+ x11-libs/gtk+:3[${MULTILIB_USEDEP}]
+ )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ vaapi? ( x11-libs/libva[X,${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.0 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ s3tc? ( >=media-libs/libtxc_dxtn-1.0.1-r1[${MULTILIB_USEDEP}] )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ staging? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use staging; then
+ eerror "Because of the multi-repo nature of ${MY_PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, and STAGING_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use staging; then
+ local CURRENT_WINE_COMMIT=${EGIT_VERSION}
+
+ git-r3_fetch "${STAGING_EGIT_REPO_URI}" "${STAGING_COMMIT}"
+ git-r3_checkout "${STAGING_EGIT_REPO_URI}" "${STAGING_DIR}"
+
+ local COMPAT_WINE_COMMIT=$("${STAGING_DIR}/patches/patchinstall.sh" --upstream-commit) || die
+
+ if [[ "${CURRENT_WINE_COMMIT}" != "${COMPAT_WINE_COMMIT}" ]]; then
+ einfo "The current Staging patchset is not guaranteed to apply on this WINE commit."
+ einfo "If src_prepare fails, try emerging with the env var WINE_COMMIT."
+ einfo "Example: WINE_COMMIT=${COMPAT_WINE_COMMIT} emerge -1 wine"
+ fi
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ if use staging; then
+ ewarn "Applying the Wine-Staging patchset. Any bug reports to the"
+ ewarn "Wine bugzilla should explicitly state that staging was used."
+
+ local STAGING_EXCLUDE=""
+ STAGING_EXCLUDE="${STAGING_EXCLUDE} -W winhlp32-Flex_Workaround" # Avoid double patching https://bugs.winehq.org/show_bug.cgi?id=42132
+ use pipelight || STAGING_EXCLUDE="${STAGING_EXCLUDE} -W Pipelight"
+
+ # Launch wine-staging patcher in a subshell, using eapply as a backend, and gitapply.sh as a backend for binary patches
+ ebegin "Running Wine-Staging patch installer"
+ (
+ set -- DESTDIR="${S}" --backend=eapply --no-autoconf --all ${STAGING_EXCLUDE}
+ cd "${STAGING_DIR}/patches"
+ source "${STAGING_DIR}/patches/patchinstall.sh"
+ )
+ eend $? || die "Failed to apply Wine-Staging patches"
+ fi
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with X xfixes)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use staging && myconf+=(
+ --with-xattr
+ $(use_with themes gtk3)
+ $(use_with vaapi va)
+ )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine register --staging ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine deregister --staging ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-staging/wine-staging-9999.ebuild b/app-emulation/wine-staging/wine-staging-9999.ebuild
new file mode 100644
index 0000000..7fc52bb
--- /dev/null
+++ b/app-emulation/wine-staging/wine-staging-9999.ebuild
@@ -0,0 +1,605 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+STAGING_P="wine-staging-${PV}"
+STAGING_DIR="${WORKDIR}/${STAGING_P}"
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, with Wine-Staging patchset"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+if [[ ${PV} == "9999" ]] ; then
+ STAGING_EGIT_REPO_URI="https://github.com/wine-compholio/wine-staging.git"
+else
+ SRC_URI="${SRC_URI}
+ staging? ( https://github.com/wine-compholio/wine-staging/archive/v${PV}.tar.gz -> ${STAGING_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap pipelight +png prelink pulseaudio +realtime +run-exes s3tc samba scanner selinux +ssl staging test themes +threads +truetype udev +udisks v4l vaapi +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ pipelight? ( staging )
+ s3tc? ( staging )
+ test? ( abi_x86_32 )
+ themes? ( staging )
+ vaapi? ( staging )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXfixes[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ staging? ( sys-apps/attr[${MULTILIB_USEDEP}] )
+ themes? (
+ dev-libs/glib:2[${MULTILIB_USEDEP}]
+ x11-libs/cairo[${MULTILIB_USEDEP}]
+ x11-libs/gtk+:3[${MULTILIB_USEDEP}]
+ )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ vaapi? ( x11-libs/libva[X,${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.1 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ s3tc? ( >=media-libs/libtxc_dxtn-1.0.1-r1[${MULTILIB_USEDEP}] )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ staging? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+)
+PATCHES_BIN=()
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use staging; then
+ eerror "Because of the multi-repo nature of ${MY_PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, and STAGING_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use staging; then
+ local CURRENT_WINE_COMMIT=${EGIT_VERSION}
+
+ git-r3_fetch "${STAGING_EGIT_REPO_URI}" "${STAGING_COMMIT}"
+ git-r3_checkout "${STAGING_EGIT_REPO_URI}" "${STAGING_DIR}"
+
+ local COMPAT_WINE_COMMIT=$("${STAGING_DIR}/patches/patchinstall.sh" --upstream-commit) || die
+
+ if [[ "${CURRENT_WINE_COMMIT}" != "${COMPAT_WINE_COMMIT}" ]]; then
+ einfo "The current Staging patchset is not guaranteed to apply on this WINE commit."
+ einfo "If src_prepare fails, try emerging with the env var WINE_COMMIT."
+ einfo "Example: WINE_COMMIT=${COMPAT_WINE_COMMIT} emerge -1 wine"
+ fi
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ if use staging; then
+ ewarn "Applying the Wine-Staging patchset. Any bug reports to the"
+ ewarn "Wine bugzilla should explicitly state that staging was used."
+
+ local STAGING_EXCLUDE=""
+ STAGING_EXCLUDE="${STAGING_EXCLUDE} -W winhlp32-Flex_Workaround" # Avoid double patching https://bugs.winehq.org/show_bug.cgi?id=42132
+ use pipelight || STAGING_EXCLUDE="${STAGING_EXCLUDE} -W Pipelight"
+
+ # Launch wine-staging patcher in a subshell, using eapply as a backend, and gitapply.sh as a backend for binary patches
+ ebegin "Running Wine-Staging patch installer"
+ (
+ set -- DESTDIR="${S}" --backend=eapply --no-autoconf --all ${STAGING_EXCLUDE}
+ cd "${STAGING_DIR}/patches"
+ source "${STAGING_DIR}/patches/patchinstall.sh"
+ )
+ eend $? || die "Failed to apply Wine-Staging patches"
+ fi
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with X xfixes)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use staging && myconf+=(
+ --with-xattr
+ $(use_with themes gtk3)
+ $(use_with vaapi va)
+ )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine register --staging ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ else
+ if use staging; then
+ eselect wine deregister --staging ${P} || die
+ fi
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-vanilla/.wine-vanilla-9999.ebuild.swp b/app-emulation/wine-vanilla/.wine-vanilla-9999.ebuild.swp
new file mode 100644
index 0000000..9e4f25b
--- /dev/null
+++ b/app-emulation/wine-vanilla/.wine-vanilla-9999.ebuild.swp
Binary files differ
diff --git a/app-emulation/wine-vanilla/Manifest b/app-emulation/wine-vanilla/Manifest
new file mode 100644
index 0000000..3fac2e2
--- /dev/null
+++ b/app-emulation/wine-vanilla/Manifest
@@ -0,0 +1,25 @@
+DIST gentoo-wine-patches-20170830.tar.xz 58456 SHA256 fb7781d0ae360cbc3860c2d2e81527a1b903da824c01f5d5040e95aaf99a3970 SHA512 5e5159e3252b246bba0ef7fdba345db3ab1071c5b8b8b625f98eda18779d4024c5b76bdbf49ce7bd5c6b01b422807adf76820beddb2b4a6ee9e67d13052cc575 WHIRLPOOL a79be264bab3fcdeee06fef47efd28e6e1125254ac7f82300cb6ba2591ef69cd76b5fed8f778b1849a0659e680e9fc785f0273d55cb2ed95648a74dffa5e22d2
+DIST wine-2.0.1.tar.xz 18845444 SHA256 6cfb4eaae566dc7afb7ac0f1f2db2c0d69969952acab0debf084ee8f7b071583 SHA512 b32d07443655898768383b7409c21093b60c028fef166a596dad5dfab5a329b9fce4552e612c6d182e4f67eb1f28ed497fe2ed6af55d0000d3e96a124547722d WHIRLPOOL 0fbaf53504e4e40db6227f45f5b92ac388c2bf23d4f573e4d3b60ccaaadeeccb5a696226d1bd4aa8b245f21c8d6a13aac423ead3f4692ebc1e8e613714168501
+DIST wine-2.0.2.tar.xz 18854952 SHA256 f71884f539928877f4b415309f582825d3d3c9976104e43d566944c710713c9a SHA512 3f37080a951819304cd3475f6012f1d6b5a94879b137cdf816cac4c8fde68ddc777905e92277ec5dce96437d8c32c43d55d3750b582781a9f9774b118f1a5b90 WHIRLPOOL cf21a899c60749c37353abc4ba974b3d6cc369769ace70fde899ff1cb5ac8a97828165cf2dbfbcf0915f5196ac58974948fe3e5b2c9854296a5eea75f8023ae5
+DIST wine-2.0.3.tar.xz 18864648 SHA256 a811c664f870a3a01449443a93a6fcee41aea2e912e58f72742eb7924962be56 SHA512 e20dbcb3a48ecb3526eba075d4baebab2529dfc50b7a6d5e18294704470f61db386013f457118c270274b911f9643d203110f46558d23e84e6a6c2d78e237dbb WHIRLPOOL 36928e816b6e4dec2173c424042c3e9da83be4a8fb3847bc90606d92858c66d4f1f41d4e1477d797e19d955d21a01710f1c3149f72da7011fae186705529f29c
+DIST wine-2.0.tar.bz2 23662707 SHA256 9756f5a2129b6a83ba701e546173cbff86caa671b0af73eb8f72c03b20c066c6 SHA512 b0a57ba8202d9fc396e5bfb7a7718d6bababbed8f3351e7fdc36afa37f35a871e04903757618f73427aeb71a52b2d323977d79e48f8b38d636f23fd404441186 WHIRLPOOL fa9f774d87dae73c7d1f3b86dc3b03ea27065eb6140f1cac13c82fe16f7ebff8f8365ed447220cf5c2788b9f4aae7c482e4f9e2e69f47e5435209e148f5dbdfe
+DIST wine-2.1.tar.xz 18887032 SHA256 bfb9abf63691c93df28d9599aaa866dc2b4e27209b3b7b546df8a37d7d9d1e6e SHA512 03d678ee6e89c2804813f2827255fcf59e96ca9a45b7d8ac441cfc84f835e5e5689c70a79a41a04c631e1add7807fa4a5758acef3bd7aadfb2e92e68958c6ef6 WHIRLPOOL 063d935f1ff0922100641f2f53cdac23d2993a83182d45e028e485fd7d0a13bc5cfb77bca76550b1537b3f42fecacef7fd64785adbf6425af823f56f96973b54
+DIST wine-2.10.tar.xz 19209580 SHA256 488df7ffd2e81da455bf428fc9eb784bb4273a890334500895665711bd52f179 SHA512 8807e16a571bf45d99097ad5fdfb9fe755f6dbe84010a330fed82f1d48c76b7f19589bfc0e5dde0b9e49a608fd0501db3f7e3e129e4d9d34bcae03bc51a73139 WHIRLPOOL e9a8248aac31593fbac28a3d8d4e62bfce14a7c41cc416ebfca8606518d28efd31b32196133da211f75f48bd228bd5d21fcbbc0479293e813ed99b258b37126e
+DIST wine-2.11.tar.xz 19251116 SHA256 efa96dade206aa21accf0da195335a805d38209d6a14320607c6308ebde4cc3c SHA512 691f329c47af5e51498287029988b8ca0777bfc3902ed80fd315004aba2337a938e79177e752efe86423c9b34544df3952b8c443bf43149356575fac75a779ac WHIRLPOOL 4933e1ce640b0abeebccd6969b5eaf4eec76cd135d9cfc1d904a902219f776a68f72e2bd1ae9019d69f0d0d81fd8ead0084785d1b9710590349365977f9c1817
+DIST wine-2.12.tar.xz 19301968 SHA256 496c11af841487e6ec4e1953ac19b05a7f48e397da502653ffbd9fe9004213a7 SHA512 d44c1937d7d2d797150381f70317b810616d61355a59be096366d3507f59b678cffaf6d841cecf02bf9d2afa3dbf4d19270f80fb1d3ba5f0f93787d40c328f62 WHIRLPOOL 6f4b9baa6fcfe86f3d195fe603c2b9450a72a593c8f7042959b42a76880cb4ae680fde7beb70a8e823150849fda36c42985035de891ebf0088c8ffc2bceb15bf
+DIST wine-2.13.tar.xz 19439328 SHA256 6fbca3ddd19b061ce65a267639efae93cf38cfabbe4a9c148a17a44703587ef8 SHA512 71873b9ec1605dd5f7502b87b0f3429c3d14a4196543d7304df455854b58ef82b8fafdcea91450cbfc01434a44886a0e0c4c4cf289ffb53167dde0f969cddc48 WHIRLPOOL 6faf1e6aeea2ab7ccc496ed85834f98eb25111c8f541c24d4876a142ad4acf7d9a4c08c2716e11fb6c92fe7aad29980cab912eb9dbb6759bdbdeca2f2f8e78a7
+DIST wine-2.14.tar.xz 19447812 SHA256 03f934d95181f728600ca04d395f10e821ee38cfa31655e872e4d27d2a8795c6 SHA512 ff43d386d46c0c74449e667b61d8cebd5fa768c88e6220aa2f13df03d80b71b6c0bdf8cbab023aed96f7c88b9787a3be4989da892fa1778412534ae82a7279bb WHIRLPOOL 2d2784e1b2ddeac39a3cea4cb08a62d99d1d062d8d801874e8bf4f56d2538a4cb019418c60299556548028e2362dd533d9ea0956014a65ac7a367ed489c0c392
+DIST wine-2.15.tar.xz 19463720 SHA256 d82d500cbf81fb08c711d3619bd52373138a05574d044f089af89707274868b3 SHA512 a52a42dd1f20fe68213c55a07ac5b2455150806e534f0ab77a8e9ae3d2f12840983fa92290dac569207d3640c7f45cda83801e9f2e80294863ffa854c6c89171 WHIRLPOOL 99c9497a44859ce310c764b3cd172d83ca1a2dce13633fee930ddbf1c40651ee4470f6bc9cfcb407ce65298a2afd73dc9edc536c2ba6f076631e5cf2085b8e61
+DIST wine-2.16.tar.xz 19484716 SHA256 a561edcabecd6c44948e5b2ef11941b2ba047275240418fa2c98c1fdceda2c21 SHA512 749a36b536506c4b63ff7512e316f44503cdb0db46e38a124da86df638f3e8ff9c404b034ece5cbb95cf20c09bc46be9a38f2ee66480aa6a4f2385e2a7a7eea4 WHIRLPOOL 92ae0a427d89b24d41d4565e333cf3b7499c1dfedb6d2a204f934975c35cb589d38b4f669890c1fd6a37b9fe8f34d98be3e7d0986e9ff99516fe00a004574520
+DIST wine-2.17.tar.xz 19505528 SHA256 7edc95739043ccc55957af663fb910318283dc5d1db42cd7f0224e30acfcea69 SHA512 cb10c876e689aa601c68673aab32c0514dd174692a01bdb3afc78d5e6079b0e77f48783af2f54245f397c762da3b4e5f2c1d39d2ce7fdb3b117d338b95c24810 WHIRLPOOL 196427a68ab3b1261cb63bafd7f82b7a688ad439fa82ae3fc04b18c9da14cc8e95b827ca8ddd07124e1179c55ed0e0aba3bdcb4639b724a6dacf4952e8827e16
+DIST wine-2.18.tar.xz 19546360 SHA256 9f0931129878157d717cb39f16cd33bf49f40aac77331c93d0ad30f2ccac4f50 SHA512 61cc39fa3d2b0a0ab3c5d17579865e6aea76dd9513a4b3c45975a2d5c05f2b4ba952b97eef547131a014763c7f692a08df29bc2ebf7e4ac7e2616e6a7822ddb9 WHIRLPOOL e864dd1705c0480d3f3095aa02ab1e7bc5b41693cd6b791cdf05e636c7099562020ac3adcba6421653efdf5dbe232b5abe9071792785e008ea30dedbb63e080e
+DIST wine-2.19.tar.xz 19549464 SHA256 487131e69875ae9c2d042798f954160146e603e449c3c97981f29b42f4a66095 SHA512 83558231bdc592b1f69cfedf6c689063df7bd9fecdfafba6fb7f6a2c7fa7783973efb85a6a49305afc18b1aa268209ee5b9c0655756e05d7550468698dfa51ae WHIRLPOOL 123aec3a367e67353655d940ba2ffe9386a583afbd0961dd3f446a00b0cf82ad4ed590508e03bf2a4e60b11753f8f430e748e6614f476675423f3bdaf7089288
+DIST wine-2.2.tar.xz 18916364 SHA256 64cb57e1d8aa07f5c89ef26743b494f2d3ef9c0f4e50d3ee896a93535f7751f4 SHA512 0700868244d397c1442948716321e5ff030c667edce464570f76aa4340199489a422872aa3975bc0a57b8285c9d59fc04e223a4bde094169fc6db460acb626c4 WHIRLPOOL ffc3d357a76592651b589c6ac6608720d0258474890faf8fe3e20ac29cdd1496d569721256f9389d347bf2734a556099154fd18ef1b56f45bb46c4c15771d6ca
+DIST wine-2.20.tar.xz 19597556 SHA256 b444826c69048932fd51ac00b791d18528a4d4abd4c397e5bd51ac60eda455a5 SHA512 d8d374d1e690ce9d3964fc81054fb7f4cd56cbae6bc44ebbf80b7dc7f04524baa2bd831e0be8f00de4cb0e14c1cb71780d424f5dcb9851fcaed9fb22f5ce5d23 WHIRLPOOL c5cfc20efdbb2a43433e93ffde8fe28507b1ad255d54cae36bf0268b18a629876b306127610bce298a47fa3fb8884ee902fd2ae41e22897d954383f0c5cd5bae
+DIST wine-2.3.tar.xz 18931732 SHA256 afc95c7a87cc8f0730b462c50a5dfc9c462eb02c6bf5874b4fa99946f49e067e SHA512 bea78e8468555ff9e08dedf3918da5ea82721549c43984869989bbdafeea00e454820ff9558aa29925c97a165a9b01e5cd1fd397f133833c58824984a6686171 WHIRLPOOL 1f5ec8e5c32d124277e4c71d95726d3a5337575757c3029567c77165d65fcfec2ddf33d3863b4bf55c9eff7c3582c1ec7dbd76d84ed8bbbe89dd16db6b0128c1
+DIST wine-2.4.tar.xz 18953748 SHA256 87b5df07e4781fecce2f92415a4717208ea253a20a0df8b36b9f90b69b72748e SHA512 15ae7e97dc72a8636b2c15c93803ed430fa456d673add61457cf3e479e769559c682b40949b5d38828f6681f13183e560fcb4a2eb0f0ba25e6eade46f7d3d7c0 WHIRLPOOL 558ab7b7517ad5e03366b4db974047eba776585e958a5b71bb2e93993e21bc725ea7a8bcf2a4354f34ca38c94ba99ccd15f2f8b5e4b58066bf339d3517eec56c
+DIST wine-2.5.tar.xz 18993176 SHA256 13f92b7ab483323aaabbc6519851e688ad4372ea30569961c831d40d6d3bccd2 SHA512 7b6faf6d8aa3d41465ad93ebae055581136f736c7eb8b4c61682e5a05589c83a0ff2c85e0f9abbca016f31b6f1c1435617c4994f1913f715a8707ebee3f28467 WHIRLPOOL 5acd2ac65df5dee1c860ddca72b8df8e021a0b95a3a1870d15468ce4591d569fa15bf8a0a6d341bcd3a624d13d0affe5b0263e67f9dfcbbf3ae7b59218dcded9
+DIST wine-2.6.tar.xz 19023352 SHA256 e6ff64758f437647e99a36c1275e41adf54f0432907172d3bba22b070a97aac0 SHA512 2aa55413ac090e011725566d004e42ee46323cd4c6961b9faa63e3de422ba60bb657bf224a4d7e8aa712a8e26e11977d07acb7c088ffeef8c37310e8cc698970 WHIRLPOOL 82e6a06cc342c7d6eace64a97bae10cc39c120c5776170b059700542b8b6fef56be9a697f05b3bc21ae82621f4bf50f3ab478311c9a3a55d86ed7c0a009766b0
+DIST wine-2.7.tar.xz 19101108 SHA256 e55a43088e313c45f7ab49272b7cb441c06f5659fb4220b2325dc060db0ee14c SHA512 1e61b9a4aa1f5f42fb27d11d5254a9ba90f348ad9c4d1ddd4b5da47cd7de638290a20accf7447db9c0e4ced4c2144497cdf5fc906a5eac60e923dabb61f65d3a WHIRLPOOL 133426a0313facc856eebad3d16d199948b780ce4c4561e5784845c119fe462b8942ed86fa5e823e729a997d704bd3c70f44a64ce3eef965b4f3eb92587dfa4d
+DIST wine-2.8.tar.xz 19120740 SHA256 83e9607af66d86020dc27a368ebba28fa7e8ffecfdf8f149da06b3531ac3e579 SHA512 4d0b167b1e5add31ed0ed05b328d16fc13cd268285c03a9100e7ddc53864aa07f6b216a555ef0c2e51dee550e3f4abf0c7c20db2cbca177bb38e8c3e11f05b97 WHIRLPOOL 568cf46caf7322eb5e26b364bd15f9e80c41a65340952a1ee0fa80514bbee3c5adfa72af40809a978a5d4202f5e8d3da3e4581767bab9fa08ab441cdd5d1da31
+DIST wine-2.9.tar.xz 19154668 SHA256 ac46f7bbbbc1dc135c95e4f98d28bf6e3d7a78fb7f9ba6caa7354a3e8786545f SHA512 6d06e511d8f338297ed0ddb7bf2ffb501f528209eaecbbee3d4e5d53db649dd5ea0aeb78bba661a9bcfda5f97e170ca10eb8fab355e229bfe7db6a5feb7ec4e8 WHIRLPOOL 7355166aeaac54abb6e1d25da6f87a4814d37764044e95462bc2a83f8d5a9b7a3bb10730bb5506516e130a4fc9ee35e3656d1106939bbbc1310c6aff0d798a1c
diff --git a/app-emulation/wine-vanilla/metadata.xml b/app-emulation/wine-vanilla/metadata.xml
new file mode 100644
index 0000000..990972b
--- /dev/null
+++ b/app-emulation/wine-vanilla/metadata.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="project">
+ <email>wine@gentoo.org</email>
+ <name>Wine</name>
+ </maintainer>
+ <longdescription>
+Wine is an Open Source implementation of the Windows API on top of X and Unix.
+
+Think of Wine as a compatibility layer for running Windows programs. Wine does not require Microsoft Windows, as it is a completely free alternative implementation of the Windows API consisting of 100% non-Microsoft code, however Wine can optionally use native Windows DLLs if they are available. Wine provides both a development toolkit for porting Windows source code to Unix as well as a program loader, allowing many unmodified Windows programs to run on x86-based Unixes, including Linux, FreeBSD, and Solaris.
+
+This variant of the Wine packaging does not include external patchsets
+ </longdescription>
+ <use>
+ <flag name="capi">Enable ISDN support via CAPI</flag>
+ <flag name="custom-cflags">Bypass strip-flags; use at your own peril</flag>
+ <flag name="dos">Pull in <pkg>games-emulation/dosbox</pkg> to run DOS applications</flag>
+ <flag name="gecko">Add support for the Gecko engine when using iexplore</flag>
+ <flag name="gstreamer">Use <pkg>media-libs/gstreamer</pkg> to provide DirectShow functionality;</flag>
+ <flag name="mono">Add support for .NET using Wine's Mono add-on</flag>
+ <flag name="netapi">Use libnetapi from <pkg>net-fs/samba</pkg> to support Windows networks in netapi32.dll</flag>
+ <flag name="opencl">Enable OpenCL support</flag>
+ <flag name="osmesa">Add support for OpenGL in bitmaps using libOSMesa</flag>
+ <flag name="pcap">Support packet capture software (e.g. wireshark)</flag>
+ <flag name="perl">Install helpers written in perl (winedump/winemaker)</flag>
+ <flag name="prelink">Run prelink on DLLs during build;
+ For versions before wine-1.7.55 or hardened, do not disable if you do not know what this means as it can break things at runtime</flag>
+ <flag name="realtime">Pull in <pkg>sys-auth/rtkit</pkg> for low-latency pulseaudio support</flag>
+ <flag name="run-exes">Use Wine to open and run .EXE and .MSI files</flag>
+ <flag name="samba">Add support for NTLM auth. see
+ http://wiki.winehq.org/NtlmAuthSetupGuide and
+ http://wiki.winehq.org/NtlmSigningAndSealing</flag>
+ <flag name="udev">Use <pkg>virtual/libudev</pkg> to provide plug and play support</flag>
+ </use>
+ <upstream>
+ <remote-id type="github">wine-compholio/wine-staging</remote-id>
+ <remote-id type="sourceforge">wine</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/app-emulation/wine-vanilla/wine-vanilla-2.0-r1.ebuild b/app-emulation/wine-vanilla/wine-vanilla-2.0-r1.ebuild
new file mode 100644
index 0000000..d9e20be
--- /dev/null
+++ b/app-emulation/wine-vanilla/wine-vanilla-2.0-r1.ebuild
@@ -0,0 +1,527 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.0/${MY_P}.tar.bz2"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, without external patchsets"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap +png prelink pulseaudio +realtime +run-exes samba scanner selinux +ssl test +threads +truetype udev +udisks v4l +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ test? ( abi_x86_32 )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.6.4 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-vanilla/wine-vanilla-2.0.1-r1.ebuild b/app-emulation/wine-vanilla/wine-vanilla-2.0.1-r1.ebuild
new file mode 100644
index 0000000..0a29750
--- /dev/null
+++ b/app-emulation/wine-vanilla/wine-vanilla-2.0.1-r1.ebuild
@@ -0,0 +1,527 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.0/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, without external patchsets"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap +png prelink pulseaudio +realtime +run-exes samba scanner selinux +ssl test +threads +truetype udev +udisks v4l +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ test? ( abi_x86_32 )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.6.4 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-vanilla/wine-vanilla-2.0.1.ebuild b/app-emulation/wine-vanilla/wine-vanilla-2.0.1.ebuild
new file mode 100644
index 0000000..4024b47
--- /dev/null
+++ b/app-emulation/wine-vanilla/wine-vanilla-2.0.1.ebuild
@@ -0,0 +1,518 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.0/${MY_P}.tar.xz"
+ KEYWORDS="-* amd64 x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, without external patchsets"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap +png prelink pulseaudio +realtime +run-exes samba scanner selinux +ssl test +threads +truetype udev +udisks v4l +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ test? ( abi_x86_32 )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.6.4 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+ local PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ )
+ local PATCHES_BIN=(
+ )
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-vanilla/wine-vanilla-2.0.2-r1.ebuild b/app-emulation/wine-vanilla/wine-vanilla-2.0.2-r1.ebuild
new file mode 100644
index 0000000..0a29750
--- /dev/null
+++ b/app-emulation/wine-vanilla/wine-vanilla-2.0.2-r1.ebuild
@@ -0,0 +1,527 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.0/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, without external patchsets"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap +png prelink pulseaudio +realtime +run-exes samba scanner selinux +ssl test +threads +truetype udev +udisks v4l +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ test? ( abi_x86_32 )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.6.4 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-vanilla/wine-vanilla-2.0.2.ebuild b/app-emulation/wine-vanilla/wine-vanilla-2.0.2.ebuild
new file mode 100644
index 0000000..4024b47
--- /dev/null
+++ b/app-emulation/wine-vanilla/wine-vanilla-2.0.2.ebuild
@@ -0,0 +1,518 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.0/${MY_P}.tar.xz"
+ KEYWORDS="-* amd64 x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, without external patchsets"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap +png prelink pulseaudio +realtime +run-exes samba scanner selinux +ssl test +threads +truetype udev +udisks v4l +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ test? ( abi_x86_32 )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.6.4 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+ local PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ )
+ local PATCHES_BIN=(
+ )
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-vanilla/wine-vanilla-2.0.3.ebuild b/app-emulation/wine-vanilla/wine-vanilla-2.0.3.ebuild
new file mode 100644
index 0000000..ffa8712
--- /dev/null
+++ b/app-emulation/wine-vanilla/wine-vanilla-2.0.3.ebuild
@@ -0,0 +1,523 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.0/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, without external patchsets"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap +png prelink pulseaudio +realtime +run-exes samba scanner selinux +ssl test +threads +truetype udev +udisks v4l +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ test? ( abi_x86_32 )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.6.4 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+)
+PATCHES_BIN=()
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-vanilla/wine-vanilla-2.0.ebuild b/app-emulation/wine-vanilla/wine-vanilla-2.0.ebuild
new file mode 100644
index 0000000..fec5b93
--- /dev/null
+++ b/app-emulation/wine-vanilla/wine-vanilla-2.0.ebuild
@@ -0,0 +1,518 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.0/${MY_P}.tar.bz2"
+ KEYWORDS="-* amd64 x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, without external patchsets"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap +png prelink pulseaudio +realtime +run-exes samba scanner selinux +ssl test +threads +truetype udev +udisks v4l +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ test? ( abi_x86_32 )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.6.4 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+ local PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ )
+ local PATCHES_BIN=(
+ )
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-vanilla/wine-vanilla-2.1-r1.ebuild b/app-emulation/wine-vanilla/wine-vanilla-2.1-r1.ebuild
new file mode 100644
index 0000000..c94a6cc
--- /dev/null
+++ b/app-emulation/wine-vanilla/wine-vanilla-2.1-r1.ebuild
@@ -0,0 +1,527 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, without external patchsets"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap +png prelink pulseaudio +realtime +run-exes samba scanner selinux +ssl test +threads +truetype udev +udisks v4l +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ test? ( abi_x86_32 )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.6.4 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-vanilla/wine-vanilla-2.10-r1.ebuild b/app-emulation/wine-vanilla/wine-vanilla-2.10-r1.ebuild
new file mode 100644
index 0000000..0cbbf7c
--- /dev/null
+++ b/app-emulation/wine-vanilla/wine-vanilla-2.10-r1.ebuild
@@ -0,0 +1,529 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, without external patchsets"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap +png prelink pulseaudio +realtime +run-exes samba scanner selinux +ssl test +threads +truetype udev +udisks v4l +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ test? ( abi_x86_32 )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXfixes[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.0 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with X xfixes)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-vanilla/wine-vanilla-2.11-r1.ebuild b/app-emulation/wine-vanilla/wine-vanilla-2.11-r1.ebuild
new file mode 100644
index 0000000..0cbbf7c
--- /dev/null
+++ b/app-emulation/wine-vanilla/wine-vanilla-2.11-r1.ebuild
@@ -0,0 +1,529 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, without external patchsets"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap +png prelink pulseaudio +realtime +run-exes samba scanner selinux +ssl test +threads +truetype udev +udisks v4l +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ test? ( abi_x86_32 )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXfixes[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.0 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with X xfixes)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-vanilla/wine-vanilla-2.12-r1.ebuild b/app-emulation/wine-vanilla/wine-vanilla-2.12-r1.ebuild
new file mode 100644
index 0000000..0cbbf7c
--- /dev/null
+++ b/app-emulation/wine-vanilla/wine-vanilla-2.12-r1.ebuild
@@ -0,0 +1,529 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, without external patchsets"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap +png prelink pulseaudio +realtime +run-exes samba scanner selinux +ssl test +threads +truetype udev +udisks v4l +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ test? ( abi_x86_32 )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXfixes[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.0 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with X xfixes)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-vanilla/wine-vanilla-2.13-r1.ebuild b/app-emulation/wine-vanilla/wine-vanilla-2.13-r1.ebuild
new file mode 100644
index 0000000..0cbbf7c
--- /dev/null
+++ b/app-emulation/wine-vanilla/wine-vanilla-2.13-r1.ebuild
@@ -0,0 +1,529 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, without external patchsets"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap +png prelink pulseaudio +realtime +run-exes samba scanner selinux +ssl test +threads +truetype udev +udisks v4l +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ test? ( abi_x86_32 )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXfixes[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.0 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with X xfixes)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-vanilla/wine-vanilla-2.14-r1.ebuild b/app-emulation/wine-vanilla/wine-vanilla-2.14-r1.ebuild
new file mode 100644
index 0000000..7a67404
--- /dev/null
+++ b/app-emulation/wine-vanilla/wine-vanilla-2.14-r1.ebuild
@@ -0,0 +1,529 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, without external patchsets"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap +png prelink pulseaudio +realtime +run-exes samba scanner selinux +ssl test +threads +truetype udev +udisks v4l +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ test? ( abi_x86_32 )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXfixes[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.1 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with X xfixes)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-vanilla/wine-vanilla-2.15-r1.ebuild b/app-emulation/wine-vanilla/wine-vanilla-2.15-r1.ebuild
new file mode 100644
index 0000000..7a67404
--- /dev/null
+++ b/app-emulation/wine-vanilla/wine-vanilla-2.15-r1.ebuild
@@ -0,0 +1,529 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, without external patchsets"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap +png prelink pulseaudio +realtime +run-exes samba scanner selinux +ssl test +threads +truetype udev +udisks v4l +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ test? ( abi_x86_32 )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXfixes[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.1 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with X xfixes)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-vanilla/wine-vanilla-2.16-r1.ebuild b/app-emulation/wine-vanilla/wine-vanilla-2.16-r1.ebuild
new file mode 100644
index 0000000..7a67404
--- /dev/null
+++ b/app-emulation/wine-vanilla/wine-vanilla-2.16-r1.ebuild
@@ -0,0 +1,529 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, without external patchsets"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap +png prelink pulseaudio +realtime +run-exes samba scanner selinux +ssl test +threads +truetype udev +udisks v4l +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ test? ( abi_x86_32 )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXfixes[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.1 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with X xfixes)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-vanilla/wine-vanilla-2.17-r1.ebuild b/app-emulation/wine-vanilla/wine-vanilla-2.17-r1.ebuild
new file mode 100644
index 0000000..7a67404
--- /dev/null
+++ b/app-emulation/wine-vanilla/wine-vanilla-2.17-r1.ebuild
@@ -0,0 +1,529 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, without external patchsets"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap +png prelink pulseaudio +realtime +run-exes samba scanner selinux +ssl test +threads +truetype udev +udisks v4l +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ test? ( abi_x86_32 )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXfixes[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.1 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with X xfixes)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-vanilla/wine-vanilla-2.18-r2.ebuild b/app-emulation/wine-vanilla/wine-vanilla-2.18-r2.ebuild
new file mode 100644
index 0000000..d8b9031
--- /dev/null
+++ b/app-emulation/wine-vanilla/wine-vanilla-2.18-r2.ebuild
@@ -0,0 +1,525 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, without external patchsets"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap +png prelink pulseaudio +realtime +run-exes samba scanner selinux +ssl test +threads +truetype udev +udisks v4l +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ test? ( abi_x86_32 )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXfixes[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.1 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+)
+PATCHES_BIN=()
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with X xfixes)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-vanilla/wine-vanilla-2.19-r1.ebuild b/app-emulation/wine-vanilla/wine-vanilla-2.19-r1.ebuild
new file mode 100644
index 0000000..d8b9031
--- /dev/null
+++ b/app-emulation/wine-vanilla/wine-vanilla-2.19-r1.ebuild
@@ -0,0 +1,525 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, without external patchsets"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap +png prelink pulseaudio +realtime +run-exes samba scanner selinux +ssl test +threads +truetype udev +udisks v4l +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ test? ( abi_x86_32 )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXfixes[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.1 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+)
+PATCHES_BIN=()
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with X xfixes)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-vanilla/wine-vanilla-2.2-r1.ebuild b/app-emulation/wine-vanilla/wine-vanilla-2.2-r1.ebuild
new file mode 100644
index 0000000..c94a6cc
--- /dev/null
+++ b/app-emulation/wine-vanilla/wine-vanilla-2.2-r1.ebuild
@@ -0,0 +1,527 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, without external patchsets"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap +png prelink pulseaudio +realtime +run-exes samba scanner selinux +ssl test +threads +truetype udev +udisks v4l +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ test? ( abi_x86_32 )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.6.4 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-vanilla/wine-vanilla-2.20.ebuild b/app-emulation/wine-vanilla/wine-vanilla-2.20.ebuild
new file mode 100644
index 0000000..d64e835
--- /dev/null
+++ b/app-emulation/wine-vanilla/wine-vanilla-2.20.ebuild
@@ -0,0 +1,527 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, without external patchsets"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kerberos kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap +png prelink pulseaudio +realtime +run-exes samba scanner selinux +ssl test +threads +truetype udev +udisks v4l +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ test? ( abi_x86_32 )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXfixes[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ kerberos? ( virtual/krb5[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.1 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+)
+PATCHES_BIN=()
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with kerberos krb5)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with X xfixes)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-vanilla/wine-vanilla-2.3-r1.ebuild b/app-emulation/wine-vanilla/wine-vanilla-2.3-r1.ebuild
new file mode 100644
index 0000000..c94a6cc
--- /dev/null
+++ b/app-emulation/wine-vanilla/wine-vanilla-2.3-r1.ebuild
@@ -0,0 +1,527 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, without external patchsets"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap +png prelink pulseaudio +realtime +run-exes samba scanner selinux +ssl test +threads +truetype udev +udisks v4l +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ test? ( abi_x86_32 )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.6.4 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-vanilla/wine-vanilla-2.4-r1.ebuild b/app-emulation/wine-vanilla/wine-vanilla-2.4-r1.ebuild
new file mode 100644
index 0000000..a69e75d
--- /dev/null
+++ b/app-emulation/wine-vanilla/wine-vanilla-2.4-r1.ebuild
@@ -0,0 +1,527 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, without external patchsets"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap +png prelink pulseaudio +realtime +run-exes samba scanner selinux +ssl test +threads +truetype udev +udisks v4l +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ test? ( abi_x86_32 )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.0 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-vanilla/wine-vanilla-2.5-r1.ebuild b/app-emulation/wine-vanilla/wine-vanilla-2.5-r1.ebuild
new file mode 100644
index 0000000..a69e75d
--- /dev/null
+++ b/app-emulation/wine-vanilla/wine-vanilla-2.5-r1.ebuild
@@ -0,0 +1,527 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, without external patchsets"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap +png prelink pulseaudio +realtime +run-exes samba scanner selinux +ssl test +threads +truetype udev +udisks v4l +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ test? ( abi_x86_32 )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.0 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-vanilla/wine-vanilla-2.6-r1.ebuild b/app-emulation/wine-vanilla/wine-vanilla-2.6-r1.ebuild
new file mode 100644
index 0000000..a69e75d
--- /dev/null
+++ b/app-emulation/wine-vanilla/wine-vanilla-2.6-r1.ebuild
@@ -0,0 +1,527 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, without external patchsets"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap +png prelink pulseaudio +realtime +run-exes samba scanner selinux +ssl test +threads +truetype udev +udisks v4l +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ test? ( abi_x86_32 )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.0 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-vanilla/wine-vanilla-2.7-r1.ebuild b/app-emulation/wine-vanilla/wine-vanilla-2.7-r1.ebuild
new file mode 100644
index 0000000..a69e75d
--- /dev/null
+++ b/app-emulation/wine-vanilla/wine-vanilla-2.7-r1.ebuild
@@ -0,0 +1,527 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, without external patchsets"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap +png prelink pulseaudio +realtime +run-exes samba scanner selinux +ssl test +threads +truetype udev +udisks v4l +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ test? ( abi_x86_32 )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.0 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-vanilla/wine-vanilla-2.8-r1.ebuild b/app-emulation/wine-vanilla/wine-vanilla-2.8-r1.ebuild
new file mode 100644
index 0000000..a69e75d
--- /dev/null
+++ b/app-emulation/wine-vanilla/wine-vanilla-2.8-r1.ebuild
@@ -0,0 +1,527 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, without external patchsets"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap +png prelink pulseaudio +realtime +run-exes samba scanner selinux +ssl test +threads +truetype udev +udisks v4l +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ test? ( abi_x86_32 )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.0 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-vanilla/wine-vanilla-2.9-r1.ebuild b/app-emulation/wine-vanilla/wine-vanilla-2.9-r1.ebuild
new file mode 100644
index 0000000..0cbbf7c
--- /dev/null
+++ b/app-emulation/wine-vanilla/wine-vanilla-2.9-r1.ebuild
@@ -0,0 +1,529 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, without external patchsets"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap +png prelink pulseaudio +realtime +run-exes samba scanner selinux +ssl test +threads +truetype udev +udisks v4l +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ test? ( abi_x86_32 )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXfixes[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.0 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+ "${PATCHDIR}/patches/freetype-2.8.1-segfault.patch" #631676
+ "${PATCHDIR}/patches/freetype-2.8.1-drop-glyphs.patch" #631376
+)
+PATCHES_BIN=(
+ "${PATCHDIR}/patches/freetype-2.8.1-patch-fonts.patch" #631376
+)
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with X xfixes)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine-vanilla/wine-vanilla-9999.ebuild b/app-emulation/wine-vanilla/wine-vanilla-9999.ebuild
new file mode 100644
index 0000000..d64e835
--- /dev/null
+++ b/app-emulation/wine-vanilla/wine-vanilla-9999.ebuild
@@ -0,0 +1,527 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator xdg-utils
+
+MY_PN="${PN%%-*}"
+MY_P="${MY_PN}-${PV}"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${MY_P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+S="${WORKDIR}/${MY_P}"
+
+GWP_V="20170830"
+PATCHDIR="${WORKDIR}/gentoo-wine-patches"
+
+DESCRIPTION="Free implementation of Windows(tm) on Unix, without external patchsets"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ https://dev.gentoo.org/~np-hardass/distfiles/wine/gentoo-wine-patches-${GWP_V}.tar.xz
+"
+
+LICENSE="LGPL-2.1"
+SLOT="${PV}"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kerberos kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap +png prelink pulseaudio +realtime +run-exes samba scanner selinux +ssl test +threads +truetype udev +udisks v4l +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ test? ( abi_x86_32 )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXfixes[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ kerberos? ( virtual/krb5[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( >=media-libs/mesa-13[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ app-emulation/wine-desktop-common
+ >app-eselect/eselect-wine-0.3
+ !app-emulation/wine:0
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ gecko? ( app-emulation/wine-gecko:2.47[abi_x86_32?,abi_x86_64?] )
+ mono? ( app-emulation/wine-mono:4.7.1 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+PATCHES=(
+ "${PATCHDIR}/patches/${MY_PN}-1.5.26-winegcc.patch" #260726
+ "${PATCHDIR}/patches/${MY_PN}-1.9.5-multilib-portage.patch" #395615
+ "${PATCHDIR}/patches/${MY_PN}-1.6-memset-O3.patch" #480508
+ "${PATCHDIR}/patches/${MY_PN}-2.0-multislot-apploader.patch"
+)
+PATCHES_BIN=()
+
+# https://bugs.gentoo.org/show_bug.cgi?id=635222
+if [[ ${#PATCHES_BIN[@]} -ge 1 ]] || [[ ${PV} == 9999 ]]; then
+ DEPEND+=" dev-util/patchbin"
+fi
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${PATCHDIR}/files/pr66838.c" -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${PATCHDIR}/files/pr69140.c" -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${PATCHDIR}/files/builtin_ms_va_list.c" -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+
+ WINE_VARIANT="${PN#wine}-${PV}"
+ WINE_VARIANT="${WINE_VARIANT#-}"
+
+ MY_PREFIX="${EPREFIX}/usr/lib/wine-${WINE_VARIANT}"
+ MY_DATAROOTDIR="${EPREFIX}/usr/share/wine-${WINE_VARIANT}"
+ MY_DATADIR="${MY_DATAROOTDIR}"
+ MY_DOCDIR="${EPREFIX}/usr/share/doc/${PF}"
+ MY_INCLUDEDIR="${EPREFIX}/usr/include/wine-${WINE_VARIANT}"
+ MY_LIBEXECDIR="${EPREFIX}/usr/libexec/wine-${WINE_VARIANT}"
+ MY_LOCALSTATEDIR="${EPREFIX}/var/wine-${WINE_VARIANT}"
+ MY_MANDIR="${MY_DATADIR}/man"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_CHECKOUT_DIR="${S}" EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+
+ eapply_bin(){
+ local patch
+ for patch in ${PATCHES_BIN[@]}; do
+ patchbin --nogit < "${patch}" || die
+ done
+ }
+
+ local md5="$(md5sum server/protocol.def)"
+
+ default
+ eapply_bin
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # Edit wine.desktop to work for specific variant
+ sed -e "/^Exec=/s/wine /wine-${WINE_VARIANT} /" -i loader/wine.desktop || die
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${PATCHDIR}/files/oic_winlogo.ico" dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --prefix="${MY_PREFIX}"
+ --datarootdir="${MY_DATAROOTDIR}"
+ --datadir="${MY_DATADIR}"
+ --docdir="${MY_DOCDIR}"
+ --includedir="${MY_INCLUDEDIR}"
+ --libdir="${EPREFIX}/usr/$(get_libdir)/wine-${WINE_VARIANT}"
+ --libexecdir="${MY_LIBEXECDIR}"
+ --localstatedir="${MY_LOCALSTATEDIR}"
+ --mandir="${MY_MANDIR}"
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with kerberos krb5)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with X xfixes)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${MY_PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D%/}${MY_PREFIX}"/bin/{wine{dump,maker},function_grep.pl} \
+ "${D%/}${MY_MANDIR}"/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D%/}${MY_PREFIX}"/bin/wineconsole* || die
+ rm "${D%/}${MY_MANDIR}"/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D%/}${MY_PREFIX}/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D%/}${MY_PREFIX}"/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 "${MY_PREFIX}"/bin/wine # 404331
+ dosym wine64-preloader "${MY_PREFIX}"/bin/wine-preloader
+ fi
+
+ # Failglob for bin and man loops
+ local glob_state=$(shopt -p failglob)
+ shopt -s failglob
+
+ # Make wrappers for binaries for handling multiple variants
+ # Note: wrappers instead of symlinks because some are shell which use basename
+ local b
+ for b in "${D%/}${MY_PREFIX}"/bin/*; do
+ make_wrapper "${b##*/}-${WINE_VARIANT}" "${MY_PREFIX}/bin/${b##*/}"
+ done
+
+ # respect LINGUAS when installing man pages, #469418
+ local l
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D%/}${MY_MANDIR}"/${l}*
+ done
+
+ eval "${glob_state}"
+}
+
+pkg_postinst() {
+ eselect wine register ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine register --vanilla ${P} || die
+ fi
+
+ eselect wine update --all --if-unset || die
+
+ xdg_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_prerm() {
+ eselect wine deregister ${P}
+ if [[ ${PN} == "wine-vanilla" ]]; then
+ eselect wine deregister --vanilla ${P} || die
+ fi
+
+ eselect wine update --all --if-unset || die
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+}
diff --git a/app-emulation/wine/.wine-9999.ebuild.swp b/app-emulation/wine/.wine-9999.ebuild.swp
new file mode 100644
index 0000000..e528643
--- /dev/null
+++ b/app-emulation/wine/.wine-9999.ebuild.swp
Binary files differ
diff --git a/app-emulation/wine/Manifest b/app-emulation/wine/Manifest
new file mode 100644
index 0000000..aefd0a0
--- /dev/null
+++ b/app-emulation/wine/Manifest
@@ -0,0 +1,14 @@
+DIST wine-2.0.tar.bz2 23662707 SHA256 9756f5a2129b6a83ba701e546173cbff86caa671b0af73eb8f72c03b20c066c6 SHA512 b0a57ba8202d9fc396e5bfb7a7718d6bababbed8f3351e7fdc36afa37f35a871e04903757618f73427aeb71a52b2d323977d79e48f8b38d636f23fd404441186 WHIRLPOOL fa9f774d87dae73c7d1f3b86dc3b03ea27065eb6140f1cac13c82fe16f7ebff8f8365ed447220cf5c2788b9f4aae7c482e4f9e2e69f47e5435209e148f5dbdfe
+DIST wine-2.1.tar.xz 18887032 SHA256 bfb9abf63691c93df28d9599aaa866dc2b4e27209b3b7b546df8a37d7d9d1e6e SHA512 03d678ee6e89c2804813f2827255fcf59e96ca9a45b7d8ac441cfc84f835e5e5689c70a79a41a04c631e1add7807fa4a5758acef3bd7aadfb2e92e68958c6ef6 WHIRLPOOL 063d935f1ff0922100641f2f53cdac23d2993a83182d45e028e485fd7d0a13bc5cfb77bca76550b1537b3f42fecacef7fd64785adbf6425af823f56f96973b54
+DIST wine-2.2.tar.xz 18916364 SHA256 64cb57e1d8aa07f5c89ef26743b494f2d3ef9c0f4e50d3ee896a93535f7751f4 SHA512 0700868244d397c1442948716321e5ff030c667edce464570f76aa4340199489a422872aa3975bc0a57b8285c9d59fc04e223a4bde094169fc6db460acb626c4 WHIRLPOOL ffc3d357a76592651b589c6ac6608720d0258474890faf8fe3e20ac29cdd1496d569721256f9389d347bf2734a556099154fd18ef1b56f45bb46c4c15771d6ca
+DIST wine-2.3.tar.xz 18931732 SHA256 afc95c7a87cc8f0730b462c50a5dfc9c462eb02c6bf5874b4fa99946f49e067e SHA512 bea78e8468555ff9e08dedf3918da5ea82721549c43984869989bbdafeea00e454820ff9558aa29925c97a165a9b01e5cd1fd397f133833c58824984a6686171 WHIRLPOOL 1f5ec8e5c32d124277e4c71d95726d3a5337575757c3029567c77165d65fcfec2ddf33d3863b4bf55c9eff7c3582c1ec7dbd76d84ed8bbbe89dd16db6b0128c1
+DIST wine-d3d9-2.1.tar.gz 48385 SHA256 9fd80e3e2ea905272c42dbc14679e94c8e2f955101ae098c84060d4c62ffc9c6 SHA512 9234d8227412d940a6befcf79433f1d5ab0634d5e829f3771ffeea235af05be29ffc40438818b1976c77d1e2e79da8a67c4dab2b7d2e822b502fb6e4a1a7f8b7 WHIRLPOOL 790e482850a13c5bf0967e900620c36d71c4d6673106f8f5c2848550ed574d326d3945d9906de88d847bb5644a520aab7fe6d460b3c3afd49a396798dd253392
+DIST wine-d3d9-2.2.tar.gz 48387 SHA256 203ed60980ec584c09b413266728e3a93e2d980dbff9b4f65375a4e9744b5042 SHA512 6e9e031b51afc8ec200bbd252ff0d768c29af23907f782409834de593f896afb128f86fe012c95dc18e5f3c7267f170eb343d2a2c53d639933a337f0c1e04fab WHIRLPOOL 6b32c0dfd3068e87d94bbcd83718dd75a14b36d69b151e9257e04793d2d3ae78ce7da10b80cbc824ccefb6c11666241593f91963ddee6a58301f95bbde35285d
+DIST wine-d3d9-2.3.tar.gz 48510 SHA256 fc17488a782def19fc02bf967128ab43236db49509e31771361a60fa3d17dd60 SHA512 58449f6b7ed7fd8182e2cce92e1d1195bf64a567c1cc92fd3f46af195e7e4039c3b2a128be9d3572d9067be6c1bb020f417c6d558bb551c60096c107067177b8 WHIRLPOOL f648a921cf4cd257a3a7dfbd3abf45d58c07782f329ec11c3a1eff3afe32e8040adb351d4a60e1b1f78c7cae0379f23468764ad162a101179d0f5b0e2c6d9413
+DIST wine-gentoo-2015.03.07.tar.bz2 85419 SHA256 f13f93dc49bbc33a294c4d511b6e01aec2d38bff77a1e44d07668291add1ab04 SHA512 bae1d2d5575d340d01f44008104f0e5ec0c4a4982995dec37d501594cd21d07a2b4ad4465c4273646d5bf6521996b4b82471097864be75342abe3e7d478a56bd WHIRLPOOL 0f254dd692e87a1f71dd19f6c1c8c59b8a91b994e75912a2e6e3ba5e875b85119fe497a331a95c2ce33bbf5f064143d23ee00275da92c494227de0807c9abb06
+DIST wine-mono-4.6.4.msi 45592064 SHA256 91b7d58177b9a9355edf007dab94535471aebdddae12734ceb4a219d2ecc4152 SHA512 1d50df5d4d000998c74fbee79b8ffc691d88ee3b34db9fd7124e0df68d6f84768ece489ac8c3f5f3141c2073c8666b93ae23ca6cd652a6542a821df3d1b66b6d WHIRLPOOL 54b77eabdb357822a89f3ff0d318755d0bae60a4a1df44ad33e663138d3f874f2bd271368df86e350ecc96908e77e82cc9ff7eef6cd80e20998b5cfc068703df
+DIST wine-staging-2.1.tar.gz 10101781 SHA256 1d193be2734ea495df2cae1dc54ce89204ca68699979174b0bd726d2e5e0576b SHA512 c64c48b265f0779c621a643ddbd2d12aaa548e4bff3b2b728280cdb9613214989911ee8ba5e46c7770f5f6430014a5da1c98e95d5008c1174bd14bf9ce5250db WHIRLPOOL ecf970ef436089bbcd0088e1608b22e808d54560e905c7d8046b3e21508166a595c3ef7b69819c45e4b13183bd9134a2bd7016d29c4da52985701d392eb35a0a
+DIST wine-staging-2.2.tar.gz 10078327 SHA256 9d3cbf7e5f12c623d275457b910a158e0b176fcf50c09a5f8425864de604bc1d SHA512 8ad3f8ba4c6439a9ec4884a55018a67c9e2c2384830074646aac7b70cb9f4f5a20f760247ab42dc3d2f697cdac7ea5322be8ed12c435cb0bc185ac08fdd4dd91 WHIRLPOOL a34c19aaace64307de56d935cb0cef17d7c066c39b83c51e70ea76a20083f928bea55fe38d62b7a8250b0a9e8f00e0d2b744f43fcab433069ffb96625d955303
+DIST wine-staging-2.3.tar.gz 10071742 SHA256 9a81be606836fab6203857f7937ff97575947f75d52c80fb5489418efb8b87e1 SHA512 8e8af1e36cc69c63ec3542f0ec4db18b6d8c16b5c9077eb211297f3a886519da71bcf72934bf8d6d72e44c7c9f765e1d00203d0d75cab8544f69f9b0c10a7133 WHIRLPOOL 50738a6e20890748d7eb01152244d34b259759f61b3587ba39815dc066fc8e2b66ce182e1ddbc912f50076a3599aa060ec6a94eeaab4513ce3a776711929b9b1
+DIST wine_gecko-2.47-x86.msi 49266176 SHA256 3b8a361f5d63952d21caafd74e849a774994822fb96c5922b01d554f1677643a SHA512 e0d06102dcb8ec2d24e8c8c3f5c2ee5cb47c18e203dfb43d85de008d682ff874fb664fef1df909a5a7857de39c7e8ce5175e734a11964ec4cd35f8fbacaea3a4 WHIRLPOOL 2b4e3e88d530106d942200e5cdc67e51fc529c51864dee687ff1d6ae4cc94557481f74797a5ca7c1de8ca5ad00f7d9cb71e484ab24d73867d1032ccd88c0c376
+DIST wine_gecko-2.47-x86_64.msi 50806272 SHA256 c565ea25e50ea953937d4ab01299e4306da4a556946327d253ea9b28357e4a7d SHA512 7c2496b15a06bc6906bc60afb3ac082e3f9931207fa624e60297020211d66aa9b420a61e95730a0dbdcefbe4b26c811d0c896ecd9c363b5107d08c3fa22fef41 WHIRLPOOL c7619954da22a47dae86ef4c6c0cfbece41943edcceb2c21babe610e0a0b2197b244ebbddd2f3986ee4d5251b062e5f3b8e079426ec77c311b928d18c8451677
diff --git a/app-emulation/wine/files/builtin_ms_va_list.c b/app-emulation/wine/files/builtin_ms_va_list.c
new file mode 100644
index 0000000..f36fc26
--- /dev/null
+++ b/app-emulation/wine/files/builtin_ms_va_list.c
@@ -0,0 +1,9 @@
+/* Taken from Wine's configure script. LGPL 2.1+ */
+
+#include <stdarg.h>
+
+int main(void)
+{
+ void func(__builtin_ms_va_list *args);
+ return 0;
+}
diff --git a/app-emulation/wine/files/pr66838.c b/app-emulation/wine/files/pr66838.c
new file mode 100644
index 0000000..cd61685
--- /dev/null
+++ b/app-emulation/wine/files/pr66838.c
@@ -0,0 +1,36 @@
+/* From gcc svn, /branches/gcc-5-branch/gcc/testsuite/gcc.target/i386/pr66838.c */
+/* Copyrighted and distributed under the same terms as gcc */
+
+void abort (void);
+
+char global;
+
+__attribute__((sysv_abi, noinline, noclone))
+void sysv_abi_func(char const *desc, void *local)
+{
+ register int esi asm ("esi");
+ register int edi asm ("edi");
+
+ if (local != &global)
+ abort ();
+
+ /* Clobber some of the extra SYSV ABI registers. */
+ asm volatile ("movl\t%2, %0\n\tmovl\t%2, %1"
+ : "=r" (esi), "=r" (edi)
+ : "i" (0xdeadbeef));
+}
+
+__attribute__((ms_abi, noinline, noclone))
+void ms_abi_func ()
+{
+ sysv_abi_func ("1st call", &global);
+ sysv_abi_func ("2nd call", &global);
+ sysv_abi_func ("3rd call", &global);
+}
+
+int
+main(void)
+{
+ ms_abi_func();
+ return 0;
+}
diff --git a/app-emulation/wine/files/pr69140.c b/app-emulation/wine/files/pr69140.c
new file mode 100644
index 0000000..7c9e001
--- /dev/null
+++ b/app-emulation/wine/files/pr69140.c
@@ -0,0 +1,37 @@
+/* { dg-do compile { target lp64 } } */
+/* { dg-options "-O2 -mincoming-stack-boundary=3" } */
+
+typedef struct {
+ unsigned int buf[4];
+ unsigned char in[64];
+} MD4_CTX;
+
+static void
+MD4Transform (unsigned int buf[4], const unsigned int in[16])
+{
+ unsigned int a, b, c, d;
+ (b) += ((((c)) & ((d))) | ((~(c)) & ((a)))) + (in[7]);
+ (a) += ((((b)) & ((c))) | ((~(b)) & ((d)))) + (in[8]);
+ (d) += ((((a)) & ((b))) | ((~(a)) & ((c)))) + (in[9]);
+ buf[3] += d;
+}
+
+void __attribute__((ms_abi))
+MD4Update (MD4_CTX *ctx, const unsigned char *buf)
+{
+ MD4Transform( ctx->buf, (unsigned int *)ctx->in);
+ MD4Transform( ctx->buf, (unsigned int *)ctx->in);
+}
+
+int
+main(void)
+{
+ MD4_CTX ctx_test =
+ {
+ { 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476 },
+ { 0, 0 }
+ };
+ unsigned char buf[64];
+
+ MD4Update(&ctx_test, (const unsigned char *) &buf);
+}
diff --git a/app-emulation/wine/files/wine-1.5.26-winegcc.patch b/app-emulation/wine/files/wine-1.5.26-winegcc.patch
new file mode 100644
index 0000000..2045e34
--- /dev/null
+++ b/app-emulation/wine/files/wine-1.5.26-winegcc.patch
@@ -0,0 +1,59 @@
+http://bugs.gentoo.org/260726
+
+diff --git a/tools/winebuild/main.c b/tools/winebuild/main.c
+index 16b4165..5c77267 100644
+--- a/tools/winebuild/main.c
++++ b/tools/winebuild/main.c
+@@ -48,10 +48,13 @@ int link_ext_symbols = 0;
+ int force_pointer_size = 0;
+ int unwind_tables = 0;
+
++#undef FORCE_POINTER_SIZE
+ #ifdef __i386__
+ enum target_cpu target_cpu = CPU_x86;
++#define FORCE_POINTER_SIZE
+ #elif defined(__x86_64__)
+ enum target_cpu target_cpu = CPU_x86_64;
++#define FORCE_POINTER_SIZE
+ #elif defined(__powerpc__)
+ enum target_cpu target_cpu = CPU_POWERPC;
+ #elif defined(__arm__)
+@@ -611,6 +614,10 @@ int main(int argc, char **argv)
+ signal( SIGTERM, exit_on_signal );
+ signal( SIGINT, exit_on_signal );
+
++#ifdef FORCE_POINTER_SIZE
++ force_pointer_size = sizeof(size_t);
++#endif
++
+ output_file = stdout;
+ argv = parse_options( argc, argv, spec );
+
+diff --git a/tools/winegcc/winegcc.c b/tools/winegcc/winegcc.c
+index 06aa200..c44d2e3 100644
+--- a/tools/winegcc/winegcc.c
++++ b/tools/winegcc/winegcc.c
+@@ -213,10 +213,13 @@ struct options
+ strarray* files;
+ };
+
++#undef FORCE_POINTER_SIZE
+ #ifdef __i386__
+ static const enum target_cpu build_cpu = CPU_x86;
++#define FORCE_POINTER_SIZE
+ #elif defined(__x86_64__)
+ static const enum target_cpu build_cpu = CPU_x86_64;
++#define FORCE_POINTER_SIZE
+ #elif defined(__powerpc__)
+ static const enum target_cpu build_cpu = CPU_POWERPC;
+ #elif defined(__arm__)
+@@ -1258,6 +1261,9 @@ int main(int argc, char **argv)
+ opts.linker_args = strarray_alloc();
+ opts.compiler_args = strarray_alloc();
+ opts.winebuild_args = strarray_alloc();
++#ifdef FORCE_POINTER_SIZE
++ opts.force_pointer_size = sizeof(size_t);
++#endif
+
+ /* determine the processor type */
+ if (strendswith(argv[0], "winecpp")) opts.processor = proc_cpp;
diff --git a/app-emulation/wine/files/wine-1.6-memset-O3.patch b/app-emulation/wine/files/wine-1.6-memset-O3.patch
new file mode 100644
index 0000000..75372f8
--- /dev/null
+++ b/app-emulation/wine/files/wine-1.6-memset-O3.patch
@@ -0,0 +1,21 @@
+Avoid "undefined reference to `memset'" error when building with
+USE=custom-cflags and -O3 in CFLAGS with gcc-4.8.
+
+See:
+
+http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56888
+http://bugs.winehq.org/show_bug.cgi?id=33521
+https://bugs.gentoo.org/show_bug.cgi?id=480508
+
+diff --git a/configure.ac b/configure.ac
+index d8033cf..fe7cc7d 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -1767,6 +1767,7 @@ then
+
+ dnl Check for some compiler flags
+ WINE_TRY_CFLAGS([-fno-builtin],[AC_SUBST(BUILTINFLAG,"-fno-builtin")])
++ WINE_TRY_CFLAGS([-fno-tree-loop-distribute-patterns])
+ WINE_TRY_CFLAGS([-fno-strict-aliasing])
+ dnl clang needs to be told to fail on unknown options
+ saved_CFLAGS=$CFLAGS
diff --git a/app-emulation/wine/files/wine-1.7.12-osmesa-check.patch b/app-emulation/wine/files/wine-1.7.12-osmesa-check.patch
new file mode 100644
index 0000000..7cafcd4
--- /dev/null
+++ b/app-emulation/wine/files/wine-1.7.12-osmesa-check.patch
@@ -0,0 +1,38 @@
+From 6932b9a17c4f64c13f7060895d46334bc7022430 Mon Sep 17 00:00:00 2001
+From: Alexandre Rostovtsev <tetromino@gentoo.org>
+Date: Tue, 7 Aug 2012 01:29:01 -0400
+Subject: [PATCH] Do not check for libGL symbols when checking libOSMesa
+
+If mesa had been built with shared glapi, glAccum is not available in
+libOSMesa without explicitly linking to libGL. In addition, in
+mesa-8.0.x and earlier, libOSMesa needs to be explicitly linked to
+libglapi if mesa was built with shared glapi, see
+https://bugs.gentoo.org/show_bug.cgi?id=399813
+And in mesa-8.1.x, libOSMesa in addition needs libdl, libpthread, and
+libstdc++, see https://bugs.gentoo.org/show_bug.cgi?id=431832
+---
+ configure.ac | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index de807d2..a2e8684 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -1233,7 +1233,13 @@ This probably prevents linking to OpenGL. Try deleting the file and restarting c
+
+ if test "x$with_osmesa" != "xno"
+ then
+- WINE_CHECK_SONAME(OSMesa,glAccum,,,[$X_LIBS -lm $X_EXTRA_LIBS])
++ WINE_CHECK_SONAME(OSMesa,OSMesaCreateContext,,,[$X_LIBS -lm $X_EXTRA_LIBS])
++ if test "x$ac_cv_lib_soname_OSMesa" = "x"; then
++ osmesa_save_CC=$CC
++ CC=$CXX
++ WINE_CHECK_SONAME(OSMesa,OSMesaCreateContext,,,[-lglapi -lpthread -ldl $X_LIBS -lm $X_EXTRA_LIBS])
++ CC=$osmesa_save_CC
++ fi
+ WINE_NOTICE_WITH(osmesa,[test "x$ac_cv_lib_soname_OSMesa" = "x"],
+ [libOSMesa ${notice_platform}development files not found (or too old), OpenGL rendering in bitmaps won't be supported.])
+ fi
+--
+1.8.5.3
+
diff --git a/app-emulation/wine/files/wine-1.9.5-multilib-portage.patch b/app-emulation/wine/files/wine-1.9.5-multilib-portage.patch
new file mode 100644
index 0000000..c19d0d8
--- /dev/null
+++ b/app-emulation/wine/files/wine-1.9.5-multilib-portage.patch
@@ -0,0 +1,31 @@
+https://bugs.gentoo.org/show_bug.cgi?id=395615
+
+Explicitly add the required -m32/m64 to *FLAGS; this overrides any
+arch-specific -m* flags that may have been appended by multilib-portage.
+
+Even though -m32/m64 is now added to *FLAGS, -m32/m64 still has to be
+explicitly added to CC and CXX due to wine's build system. For example,
+winegcc saves the build-time value of CC and uses it at runtime.
+
+--- a/configure.ac 2016-03-05 20:53:50.574628728 -0500
++++ b/configure.ac 2016-03-05 20:57:54.945617833 -0500
+@@ -141,6 +141,9 @@
+ then
+ CC="$CC -m32"
+ CXX="$CXX -m32"
++ CFLAGS="$CFLAGS -m32"
++ LDFLAGS="$LDFLAGS -m32"
++ CXXFLAGS="$CXXFLAGS -m32"
+ AC_MSG_CHECKING([whether $CC works])
+ AC_LINK_IFELSE([AC_LANG_PROGRAM()],AC_MSG_RESULT([yes]),
+ [AC_MSG_RESULT([no])
+@@ -160,6 +163,9 @@
+ fi
+ CC="$CC -m64"
+ CXX="$CXX -m64"
++ CFLAGS="$CFLAGS -m64"
++ LDFLAGS="$LDFLAGS -m64"
++ CXXFLAGS="$CXXFLAGS -m64"
+ host_cpu="x86_64"
+ notice_platform="64-bit "
+ AC_SUBST(TARGETFLAGS,"-m64")
diff --git a/app-emulation/wine/metadata.xml b/app-emulation/wine/metadata.xml
new file mode 100644
index 0000000..309f99b
--- /dev/null
+++ b/app-emulation/wine/metadata.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="project">
+ <email>wine@gentoo.org</email>
+ <name>Wine</name>
+ </maintainer>
+ <maintainer type="person">
+ <email>commendsarnex@gmail.com</email>
+ <name>Nick Sarnie</name>
+ <description>Only CC on bugs that involve USE="d3d9"</description>
+ </maintainer>
+ <longdescription>
+Wine is an Open Source implementation of the Windows API on top of X and Unix.
+
+Think of Wine as a compatibility layer for running Windows programs. Wine does not require Microsoft Windows, as it is a completely free alternative implementation of the Windows API consisting of 100% non-Microsoft code, however Wine can optionally use native Windows DLLs if they are available. Wine provides both a development toolkit for porting Windows source code to Unix as well as a program loader, allowing many unmodified Windows programs to run on x86-based Unixes, including Linux, FreeBSD, and Solaris.
+ </longdescription>
+ <use>
+ <flag name="capi">Enable ISDN support via CAPI</flag>
+ <flag name="custom-cflags">Bypass strip-flags; use at your own peril</flag>
+ <flag name="d3d9">Apply highly experimental patches for Gallium Nine support.
+ This patch may break some applications.</flag>
+ <flag name="dos">Pull in <pkg>games-emulation/dosbox</pkg> to run DOS applications</flag>
+ <flag name="gecko">Add support for the Gecko engine when using iexplore</flag>
+ <flag name="gstreamer">Use <pkg>media-libs/gstreamer</pkg> to provide DirectShow functionality;</flag>
+ <flag name="mono">Add support for .NET using Wine's Mono add-on</flag>
+ <flag name="netapi">Use libnetapi from <pkg>net-fs/samba</pkg> to support Windows networks in netapi32.dll</flag>
+ <flag name="opencl">Enable OpenCL support</flag>
+ <flag name="osmesa">Add support for OpenGL in bitmaps using libOSMesa</flag>
+ <flag name="pcap">Support packet capture software (e.g. wireshark)</flag>
+ <flag name="perl">Install helpers written in perl (winedump/winemaker)</flag>
+ <flag name="pipelight">Apply Wine-Staging patches for Pipelight/Silverlight support</flag>
+ <flag name="prelink">Run prelink on DLLs during build;
+ For versions before wine-1.7.55 or hardened, do not disable if you do not know what this means as it can break things at runtime</flag>
+ <flag name="realtime">Pull in <pkg>sys-auth/rtkit</pkg> for low-latency pulseaudio support</flag>
+ <flag name="run-exes">Use Wine to open and run .EXE and .MSI files</flag>
+ <flag name="s3tc">Pull in <pkg>media-libs/libtxc_dxtn</pkg> for DXTn texture compression, needed for many games</flag>
+ <flag name="samba">Add support for NTLM auth. see
+ http://wiki.winehq.org/NtlmAuthSetupGuide and
+ http://wiki.winehq.org/NtlmSigningAndSealing</flag>
+ <flag name="staging">Apply Wine-Staging patches for advanced feature support that haven't made it into upstream Wine yet</flag>
+ <flag name="themes">Support GTK+:3 window theming through Wine-Staging</flag>
+ <flag name="udev">Use <pkg>virtual/libudev</pkg> to provide plug and play support</flag>
+ </use>
+ <upstream>
+ <remote-id type="github">wine-compholio/wine-staging</remote-id>
+ <remote-id type="sourceforge">wine</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/app-emulation/wine/wine-2.0.ebuild b/app-emulation/wine/wine-2.0.ebuild
new file mode 100644
index 0000000..b2848da
--- /dev/null
+++ b/app-emulation/wine/wine-2.0.ebuild
@@ -0,0 +1,453 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils fdo-mime flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="git://source.winehq.org/git/wine.git http://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1-2)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}/${P}.tar.bz2"
+ KEYWORDS="-* amd64 x86 ~x86-fbsd"
+fi
+
+VANILLA_GV="2.47"
+VANILLA_MV="4.6.4"
+WINE_GENTOO="wine-gentoo-2015.03.07"
+DESCRIPTION="Free implementation of Windows(tm) on Unix"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ gecko? (
+ abi_x86_32? ( https://dl.winehq.org/wine/wine-gecko/${VANILLA_GV}/wine_gecko-${VANILLA_GV}-x86.msi )
+ abi_x86_64? ( https://dl.winehq.org/wine/wine-gecko/${VANILLA_GV}/wine_gecko-${VANILLA_GV}-x86_64.msi )
+ )
+ mono? ( https://dl.winehq.org/wine/wine-mono/${VANILLA_MV}/wine-mono-${VANILLA_MV}.msi )
+ https://dev.gentoo.org/~tetromino/distfiles/${PN}/${WINE_GENTOO}.tar.bz2"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap +png prelink pulseaudio +realtime +run-exes samba scanner selinux +ssl test +threads +truetype udev +udisks v4l +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ test? ( abi_x86_32 )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( media-libs/mesa[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${FILESDIR}"/pr66838.c -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${FILESDIR}"/pr69140.c -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${FILESDIR}"/builtin_ms_va_list.c -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ GV=${VANILLA_GV}
+ MV=${VANILLA_MV}
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+ local md5="$(md5sum server/protocol.def)"
+ local PATCHES=(
+ "${FILESDIR}"/${PN}-1.5.26-winegcc.patch #260726
+ "${FILESDIR}"/${PN}-1.9.5-multilib-portage.patch #395615
+ "${FILESDIR}"/${PN}-1.7.12-osmesa-check.patch #429386
+ "${FILESDIR}"/${PN}-1.6-memset-O3.patch #480508
+ )
+
+ default
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${WORKDIR}"/${WINE_GENTOO}/icons/oic_winlogo.ico dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ local l
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ emake -C "../${WINE_GENTOO}" install DESTDIR="${D}" EPREFIX="${EPREFIX}"
+ if use gecko ; then
+ insinto /usr/share/wine/gecko
+ use abi_x86_32 && doins "${DISTDIR}"/wine_gecko-${GV}-x86.msi
+ use abi_x86_64 && doins "${DISTDIR}"/wine_gecko-${GV}-x86_64.msi
+ fi
+ if use mono ; then
+ insinto /usr/share/wine/mono
+ doins "${DISTDIR}"/wine-mono-${MV}.msi
+ fi
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D}"usr/bin/{wine{dump,maker},function_grep.pl} "${D}"usr/share/man/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D}"/usr/bin/wineconsole* || die
+ rm "${D}"/usr/share/man/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D}usr/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D}"usr/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D}"usr/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 /usr/bin/wine # 404331
+ dosym wine64-preloader /usr/bin/wine-preloader
+ fi
+
+ # respect LINGUAS when installing man pages, #469418
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D}"usr/share/man/${l}*
+ done
+}
+
+pkg_preinst() {
+ gnome2_icon_savelist
+}
+
+pkg_postinst() {
+ gnome2_icon_cache_update
+ fdo-mime_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_postrm() {
+ gnome2_icon_cache_update
+ fdo-mime_desktop_database_update
+}
diff --git a/app-emulation/wine/wine-2.1.ebuild b/app-emulation/wine/wine-2.1.ebuild
new file mode 100644
index 0000000..f7450c2
--- /dev/null
+++ b/app-emulation/wine/wine-2.1.ebuild
@@ -0,0 +1,582 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils fdo-mime flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="git://source.winehq.org/git/wine.git http://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+
+VANILLA_GV="2.47"
+VANILLA_MV="4.6.4"
+STAGING_GV="2.47"
+STAGING_MV="4.6.4"
+[[ ${MAJOR_V} == "1.8" ]] && SUFFIX="-unofficial"
+STAGING_P="wine-staging-${PV}"
+STAGING_DIR="${WORKDIR}/${STAGING_P}${SUFFIX}"
+D3D9_P="wine-d3d9-${PV}"
+D3D9_DIR="${WORKDIR}/wine-d3d9-patches-${D3D9_P}"
+WINE_GENTOO="wine-gentoo-2015.03.07"
+DESCRIPTION="Free implementation of Windows(tm) on Unix"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ !staging? (
+ gecko? (
+ abi_x86_32? ( https://dl.winehq.org/wine/wine-gecko/${VANILLA_GV}/wine_gecko-${VANILLA_GV}-x86.msi )
+ abi_x86_64? ( https://dl.winehq.org/wine/wine-gecko/${VANILLA_GV}/wine_gecko-${VANILLA_GV}-x86_64.msi )
+ )
+ mono? ( https://dl.winehq.org/wine/wine-mono/${VANILLA_MV}/wine-mono-${VANILLA_MV}.msi )
+ )
+ staging? (
+ gecko? (
+ abi_x86_32? ( https://dl.winehq.org/wine/wine-gecko/${STAGING_GV}/wine_gecko-${STAGING_GV}-x86.msi )
+ abi_x86_64? ( https://dl.winehq.org/wine/wine-gecko/${STAGING_GV}/wine_gecko-${STAGING_GV}-x86_64.msi )
+ )
+ mono? ( https://dl.winehq.org/wine/wine-mono/${STAGING_MV}/wine-mono-${STAGING_MV}.msi )
+ )
+ https://dev.gentoo.org/~tetromino/distfiles/${PN}/${WINE_GENTOO}.tar.bz2"
+
+if [[ ${PV} == "9999" ]] ; then
+ STAGING_EGIT_REPO_URI="https://github.com/wine-compholio/wine-staging.git"
+ D3D9_EGIT_REPO_URI="https://github.com/sarnex/wine-d3d9-patches.git"
+else
+ SRC_URI="${SRC_URI}
+ staging? ( https://github.com/wine-compholio/wine-staging/archive/v${PV}${SUFFIX}.tar.gz -> ${STAGING_P}.tar.gz )
+ d3d9? ( https://github.com/sarnex/wine-d3d9-patches/archive/${D3D9_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags d3d9 dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap pipelight +png prelink pulseaudio +realtime +run-exes s3tc samba scanner selinux +ssl staging test themes +threads +truetype udev +udisks v4l vaapi +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ pipelight? ( staging )
+ s3tc? ( staging )
+ test? ( abi_x86_32 )
+ themes? ( staging )
+ vaapi? ( staging )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ d3d9? (
+ media-libs/mesa[d3d9,egl,${MULTILIB_USEDEP}]
+ x11-libs/libX11[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libxcb[${MULTILIB_USEDEP}]
+ )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( media-libs/mesa[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ staging? ( sys-apps/attr[${MULTILIB_USEDEP}] )
+ themes? (
+ dev-libs/glib:2[${MULTILIB_USEDEP}]
+ x11-libs/cairo[${MULTILIB_USEDEP}]
+ x11-libs/gtk+:3[${MULTILIB_USEDEP}]
+ )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ vaapi? ( x11-libs/libva[X,${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ s3tc? ( >=media-libs/libtxc_dxtn-1.0.1-r1[${MULTILIB_USEDEP}] )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ staging? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${FILESDIR}"/pr66838.c -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${FILESDIR}"/pr69140.c -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${FILESDIR}"/builtin_ms_va_list.c -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use staging || use d3d9; then
+ eerror "Because of the multi-repo nature of ${PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+ if ! use staging; then
+ GV=${VANILLA_GV}
+ MV=${VANILLA_MV}
+ else
+ GV=${STAGING_GV}
+ MV=${STAGING_MV}
+ fi
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use staging; then
+ local CURRENT_WINE_COMMIT=${EGIT_VERSION}
+
+ git-r3_fetch "${STAGING_EGIT_REPO_URI}" "${STAGING_COMMIT}"
+ git-r3_checkout "${STAGING_EGIT_REPO_URI}" "${STAGING_DIR}"
+
+ local COMPAT_WINE_COMMIT=$("${STAGING_DIR}/patches/patchinstall.sh" --upstream-commit) || die
+
+ if [[ "${CURRENT_WINE_COMMIT}" != "${COMPAT_WINE_COMMIT}" ]]; then
+ einfo "The current Staging patchset is not guaranteed to apply on this WINE commit."
+ einfo "If src_prepare fails, try emerging with the env var WINE_COMMIT."
+ einfo "Example: WINE_COMMIT=${COMPAT_WINE_COMMIT} emerge -1 wine"
+ fi
+ fi
+ if use d3d9; then
+ git-r3_fetch "${D3D9_EGIT_REPO_URI}" "${D3D9_COMMIT}"
+ git-r3_checkout "${D3D9_EGIT_REPO_URI}" "${D3D9_DIR}"
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+ local md5="$(md5sum server/protocol.def)"
+ local PATCHES=(
+ "${FILESDIR}"/${PN}-1.5.26-winegcc.patch #260726
+ "${FILESDIR}"/${PN}-1.9.5-multilib-portage.patch #395615
+ "${FILESDIR}"/${PN}-1.7.12-osmesa-check.patch #429386
+ "${FILESDIR}"/${PN}-1.6-memset-O3.patch #480508
+ )
+ if use staging; then
+ ewarn "Applying the Wine-Staging patchset. Any bug reports to the"
+ ewarn "Wine bugzilla should explicitly state that staging was used."
+
+ local STAGING_EXCLUDE=""
+ STAGING_EXCLUDE="${STAGING_EXCLUDE} -W winhlp32-Flex_Workaround" # Avoid double patching https://bugs.winehq.org/show_bug.cgi?id=42132
+ use pipelight || STAGING_EXCLUDE="${STAGING_EXCLUDE} -W Pipelight"
+
+ # Launch wine-staging patcher in a subshell, using eapply as a backend, and gitapply.sh as a backend for binary patches
+ ebegin "Running Wine-Staging patch installer"
+ (
+ set -- DESTDIR="${S}" --backend=eapply --no-autoconf --all ${STAGING_EXCLUDE}
+ cd "${STAGING_DIR}/patches"
+ source "${STAGING_DIR}/patches/patchinstall.sh"
+ )
+ eend $? || die "Failed to apply Wine-Staging patches"
+
+ # To differentiate unofficial staging releases
+ if [[ ! -z ${SUFFIX} ]]; then
+ sed -i "s/(Staging)/(Staging [Unofficial])/" libs/wine/Makefile.in || die
+ fi
+ fi
+ if use d3d9; then
+ if use staging; then
+ PATCHES+=( "${D3D9_DIR}/staging-helper.patch" )
+ else
+ PATCHES+=( "${D3D9_DIR}/d3d9-helper.patch" )
+ fi
+ PATCHES+=( "${D3D9_DIR}/wine-d3d9.patch" )
+ fi
+
+ default
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${WORKDIR}"/${WINE_GENTOO}/icons/oic_winlogo.ico dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use staging && myconf+=(
+ --with-xattr
+ $(use_with themes gtk3)
+ $(use_with vaapi va)
+ )
+ use d3d9 && myconf+=( $(use_with d3d9 d3d9-nine) )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ local l
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ emake -C "../${WINE_GENTOO}" install DESTDIR="${D}" EPREFIX="${EPREFIX}"
+ if use gecko ; then
+ insinto /usr/share/wine/gecko
+ use abi_x86_32 && doins "${DISTDIR}"/wine_gecko-${GV}-x86.msi
+ use abi_x86_64 && doins "${DISTDIR}"/wine_gecko-${GV}-x86_64.msi
+ fi
+ if use mono ; then
+ insinto /usr/share/wine/mono
+ doins "${DISTDIR}"/wine-mono-${MV}.msi
+ fi
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D}"usr/bin/{wine{dump,maker},function_grep.pl} "${D}"usr/share/man/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D}"/usr/bin/wineconsole* || die
+ rm "${D}"/usr/share/man/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D}usr/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D}"usr/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D}"usr/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 /usr/bin/wine # 404331
+ dosym wine64-preloader /usr/bin/wine-preloader
+ fi
+
+ # respect LINGUAS when installing man pages, #469418
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D}"usr/share/man/${l}*
+ done
+}
+
+pkg_preinst() {
+ gnome2_icon_savelist
+}
+
+pkg_postinst() {
+ gnome2_icon_cache_update
+ fdo-mime_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_postrm() {
+ gnome2_icon_cache_update
+ fdo-mime_desktop_database_update
+}
diff --git a/app-emulation/wine/wine-2.2.ebuild b/app-emulation/wine/wine-2.2.ebuild
new file mode 100644
index 0000000..f7450c2
--- /dev/null
+++ b/app-emulation/wine/wine-2.2.ebuild
@@ -0,0 +1,582 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils fdo-mime flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="git://source.winehq.org/git/wine.git http://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+
+VANILLA_GV="2.47"
+VANILLA_MV="4.6.4"
+STAGING_GV="2.47"
+STAGING_MV="4.6.4"
+[[ ${MAJOR_V} == "1.8" ]] && SUFFIX="-unofficial"
+STAGING_P="wine-staging-${PV}"
+STAGING_DIR="${WORKDIR}/${STAGING_P}${SUFFIX}"
+D3D9_P="wine-d3d9-${PV}"
+D3D9_DIR="${WORKDIR}/wine-d3d9-patches-${D3D9_P}"
+WINE_GENTOO="wine-gentoo-2015.03.07"
+DESCRIPTION="Free implementation of Windows(tm) on Unix"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ !staging? (
+ gecko? (
+ abi_x86_32? ( https://dl.winehq.org/wine/wine-gecko/${VANILLA_GV}/wine_gecko-${VANILLA_GV}-x86.msi )
+ abi_x86_64? ( https://dl.winehq.org/wine/wine-gecko/${VANILLA_GV}/wine_gecko-${VANILLA_GV}-x86_64.msi )
+ )
+ mono? ( https://dl.winehq.org/wine/wine-mono/${VANILLA_MV}/wine-mono-${VANILLA_MV}.msi )
+ )
+ staging? (
+ gecko? (
+ abi_x86_32? ( https://dl.winehq.org/wine/wine-gecko/${STAGING_GV}/wine_gecko-${STAGING_GV}-x86.msi )
+ abi_x86_64? ( https://dl.winehq.org/wine/wine-gecko/${STAGING_GV}/wine_gecko-${STAGING_GV}-x86_64.msi )
+ )
+ mono? ( https://dl.winehq.org/wine/wine-mono/${STAGING_MV}/wine-mono-${STAGING_MV}.msi )
+ )
+ https://dev.gentoo.org/~tetromino/distfiles/${PN}/${WINE_GENTOO}.tar.bz2"
+
+if [[ ${PV} == "9999" ]] ; then
+ STAGING_EGIT_REPO_URI="https://github.com/wine-compholio/wine-staging.git"
+ D3D9_EGIT_REPO_URI="https://github.com/sarnex/wine-d3d9-patches.git"
+else
+ SRC_URI="${SRC_URI}
+ staging? ( https://github.com/wine-compholio/wine-staging/archive/v${PV}${SUFFIX}.tar.gz -> ${STAGING_P}.tar.gz )
+ d3d9? ( https://github.com/sarnex/wine-d3d9-patches/archive/${D3D9_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags d3d9 dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap pipelight +png prelink pulseaudio +realtime +run-exes s3tc samba scanner selinux +ssl staging test themes +threads +truetype udev +udisks v4l vaapi +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ pipelight? ( staging )
+ s3tc? ( staging )
+ test? ( abi_x86_32 )
+ themes? ( staging )
+ vaapi? ( staging )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ d3d9? (
+ media-libs/mesa[d3d9,egl,${MULTILIB_USEDEP}]
+ x11-libs/libX11[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libxcb[${MULTILIB_USEDEP}]
+ )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( media-libs/mesa[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ staging? ( sys-apps/attr[${MULTILIB_USEDEP}] )
+ themes? (
+ dev-libs/glib:2[${MULTILIB_USEDEP}]
+ x11-libs/cairo[${MULTILIB_USEDEP}]
+ x11-libs/gtk+:3[${MULTILIB_USEDEP}]
+ )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ vaapi? ( x11-libs/libva[X,${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ s3tc? ( >=media-libs/libtxc_dxtn-1.0.1-r1[${MULTILIB_USEDEP}] )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ staging? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${FILESDIR}"/pr66838.c -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${FILESDIR}"/pr69140.c -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${FILESDIR}"/builtin_ms_va_list.c -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use staging || use d3d9; then
+ eerror "Because of the multi-repo nature of ${PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+ if ! use staging; then
+ GV=${VANILLA_GV}
+ MV=${VANILLA_MV}
+ else
+ GV=${STAGING_GV}
+ MV=${STAGING_MV}
+ fi
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use staging; then
+ local CURRENT_WINE_COMMIT=${EGIT_VERSION}
+
+ git-r3_fetch "${STAGING_EGIT_REPO_URI}" "${STAGING_COMMIT}"
+ git-r3_checkout "${STAGING_EGIT_REPO_URI}" "${STAGING_DIR}"
+
+ local COMPAT_WINE_COMMIT=$("${STAGING_DIR}/patches/patchinstall.sh" --upstream-commit) || die
+
+ if [[ "${CURRENT_WINE_COMMIT}" != "${COMPAT_WINE_COMMIT}" ]]; then
+ einfo "The current Staging patchset is not guaranteed to apply on this WINE commit."
+ einfo "If src_prepare fails, try emerging with the env var WINE_COMMIT."
+ einfo "Example: WINE_COMMIT=${COMPAT_WINE_COMMIT} emerge -1 wine"
+ fi
+ fi
+ if use d3d9; then
+ git-r3_fetch "${D3D9_EGIT_REPO_URI}" "${D3D9_COMMIT}"
+ git-r3_checkout "${D3D9_EGIT_REPO_URI}" "${D3D9_DIR}"
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+ local md5="$(md5sum server/protocol.def)"
+ local PATCHES=(
+ "${FILESDIR}"/${PN}-1.5.26-winegcc.patch #260726
+ "${FILESDIR}"/${PN}-1.9.5-multilib-portage.patch #395615
+ "${FILESDIR}"/${PN}-1.7.12-osmesa-check.patch #429386
+ "${FILESDIR}"/${PN}-1.6-memset-O3.patch #480508
+ )
+ if use staging; then
+ ewarn "Applying the Wine-Staging patchset. Any bug reports to the"
+ ewarn "Wine bugzilla should explicitly state that staging was used."
+
+ local STAGING_EXCLUDE=""
+ STAGING_EXCLUDE="${STAGING_EXCLUDE} -W winhlp32-Flex_Workaround" # Avoid double patching https://bugs.winehq.org/show_bug.cgi?id=42132
+ use pipelight || STAGING_EXCLUDE="${STAGING_EXCLUDE} -W Pipelight"
+
+ # Launch wine-staging patcher in a subshell, using eapply as a backend, and gitapply.sh as a backend for binary patches
+ ebegin "Running Wine-Staging patch installer"
+ (
+ set -- DESTDIR="${S}" --backend=eapply --no-autoconf --all ${STAGING_EXCLUDE}
+ cd "${STAGING_DIR}/patches"
+ source "${STAGING_DIR}/patches/patchinstall.sh"
+ )
+ eend $? || die "Failed to apply Wine-Staging patches"
+
+ # To differentiate unofficial staging releases
+ if [[ ! -z ${SUFFIX} ]]; then
+ sed -i "s/(Staging)/(Staging [Unofficial])/" libs/wine/Makefile.in || die
+ fi
+ fi
+ if use d3d9; then
+ if use staging; then
+ PATCHES+=( "${D3D9_DIR}/staging-helper.patch" )
+ else
+ PATCHES+=( "${D3D9_DIR}/d3d9-helper.patch" )
+ fi
+ PATCHES+=( "${D3D9_DIR}/wine-d3d9.patch" )
+ fi
+
+ default
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${WORKDIR}"/${WINE_GENTOO}/icons/oic_winlogo.ico dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use staging && myconf+=(
+ --with-xattr
+ $(use_with themes gtk3)
+ $(use_with vaapi va)
+ )
+ use d3d9 && myconf+=( $(use_with d3d9 d3d9-nine) )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ local l
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ emake -C "../${WINE_GENTOO}" install DESTDIR="${D}" EPREFIX="${EPREFIX}"
+ if use gecko ; then
+ insinto /usr/share/wine/gecko
+ use abi_x86_32 && doins "${DISTDIR}"/wine_gecko-${GV}-x86.msi
+ use abi_x86_64 && doins "${DISTDIR}"/wine_gecko-${GV}-x86_64.msi
+ fi
+ if use mono ; then
+ insinto /usr/share/wine/mono
+ doins "${DISTDIR}"/wine-mono-${MV}.msi
+ fi
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D}"usr/bin/{wine{dump,maker},function_grep.pl} "${D}"usr/share/man/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D}"/usr/bin/wineconsole* || die
+ rm "${D}"/usr/share/man/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D}usr/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D}"usr/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D}"usr/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 /usr/bin/wine # 404331
+ dosym wine64-preloader /usr/bin/wine-preloader
+ fi
+
+ # respect LINGUAS when installing man pages, #469418
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D}"usr/share/man/${l}*
+ done
+}
+
+pkg_preinst() {
+ gnome2_icon_savelist
+}
+
+pkg_postinst() {
+ gnome2_icon_cache_update
+ fdo-mime_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_postrm() {
+ gnome2_icon_cache_update
+ fdo-mime_desktop_database_update
+}
diff --git a/app-emulation/wine/wine-2.3.ebuild b/app-emulation/wine/wine-2.3.ebuild
new file mode 100644
index 0000000..f7450c2
--- /dev/null
+++ b/app-emulation/wine/wine-2.3.ebuild
@@ -0,0 +1,582 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils fdo-mime flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="git://source.winehq.org/git/wine.git http://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+
+VANILLA_GV="2.47"
+VANILLA_MV="4.6.4"
+STAGING_GV="2.47"
+STAGING_MV="4.6.4"
+[[ ${MAJOR_V} == "1.8" ]] && SUFFIX="-unofficial"
+STAGING_P="wine-staging-${PV}"
+STAGING_DIR="${WORKDIR}/${STAGING_P}${SUFFIX}"
+D3D9_P="wine-d3d9-${PV}"
+D3D9_DIR="${WORKDIR}/wine-d3d9-patches-${D3D9_P}"
+WINE_GENTOO="wine-gentoo-2015.03.07"
+DESCRIPTION="Free implementation of Windows(tm) on Unix"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ !staging? (
+ gecko? (
+ abi_x86_32? ( https://dl.winehq.org/wine/wine-gecko/${VANILLA_GV}/wine_gecko-${VANILLA_GV}-x86.msi )
+ abi_x86_64? ( https://dl.winehq.org/wine/wine-gecko/${VANILLA_GV}/wine_gecko-${VANILLA_GV}-x86_64.msi )
+ )
+ mono? ( https://dl.winehq.org/wine/wine-mono/${VANILLA_MV}/wine-mono-${VANILLA_MV}.msi )
+ )
+ staging? (
+ gecko? (
+ abi_x86_32? ( https://dl.winehq.org/wine/wine-gecko/${STAGING_GV}/wine_gecko-${STAGING_GV}-x86.msi )
+ abi_x86_64? ( https://dl.winehq.org/wine/wine-gecko/${STAGING_GV}/wine_gecko-${STAGING_GV}-x86_64.msi )
+ )
+ mono? ( https://dl.winehq.org/wine/wine-mono/${STAGING_MV}/wine-mono-${STAGING_MV}.msi )
+ )
+ https://dev.gentoo.org/~tetromino/distfiles/${PN}/${WINE_GENTOO}.tar.bz2"
+
+if [[ ${PV} == "9999" ]] ; then
+ STAGING_EGIT_REPO_URI="https://github.com/wine-compholio/wine-staging.git"
+ D3D9_EGIT_REPO_URI="https://github.com/sarnex/wine-d3d9-patches.git"
+else
+ SRC_URI="${SRC_URI}
+ staging? ( https://github.com/wine-compholio/wine-staging/archive/v${PV}${SUFFIX}.tar.gz -> ${STAGING_P}.tar.gz )
+ d3d9? ( https://github.com/sarnex/wine-d3d9-patches/archive/${D3D9_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags d3d9 dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap pipelight +png prelink pulseaudio +realtime +run-exes s3tc samba scanner selinux +ssl staging test themes +threads +truetype udev +udisks v4l vaapi +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ pipelight? ( staging )
+ s3tc? ( staging )
+ test? ( abi_x86_32 )
+ themes? ( staging )
+ vaapi? ( staging )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ d3d9? (
+ media-libs/mesa[d3d9,egl,${MULTILIB_USEDEP}]
+ x11-libs/libX11[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libxcb[${MULTILIB_USEDEP}]
+ )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( media-libs/mesa[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ staging? ( sys-apps/attr[${MULTILIB_USEDEP}] )
+ themes? (
+ dev-libs/glib:2[${MULTILIB_USEDEP}]
+ x11-libs/cairo[${MULTILIB_USEDEP}]
+ x11-libs/gtk+:3[${MULTILIB_USEDEP}]
+ )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ vaapi? ( x11-libs/libva[X,${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ s3tc? ( >=media-libs/libtxc_dxtn-1.0.1-r1[${MULTILIB_USEDEP}] )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ staging? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${FILESDIR}"/pr66838.c -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${FILESDIR}"/pr69140.c -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${FILESDIR}"/builtin_ms_va_list.c -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use staging || use d3d9; then
+ eerror "Because of the multi-repo nature of ${PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+ if ! use staging; then
+ GV=${VANILLA_GV}
+ MV=${VANILLA_MV}
+ else
+ GV=${STAGING_GV}
+ MV=${STAGING_MV}
+ fi
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use staging; then
+ local CURRENT_WINE_COMMIT=${EGIT_VERSION}
+
+ git-r3_fetch "${STAGING_EGIT_REPO_URI}" "${STAGING_COMMIT}"
+ git-r3_checkout "${STAGING_EGIT_REPO_URI}" "${STAGING_DIR}"
+
+ local COMPAT_WINE_COMMIT=$("${STAGING_DIR}/patches/patchinstall.sh" --upstream-commit) || die
+
+ if [[ "${CURRENT_WINE_COMMIT}" != "${COMPAT_WINE_COMMIT}" ]]; then
+ einfo "The current Staging patchset is not guaranteed to apply on this WINE commit."
+ einfo "If src_prepare fails, try emerging with the env var WINE_COMMIT."
+ einfo "Example: WINE_COMMIT=${COMPAT_WINE_COMMIT} emerge -1 wine"
+ fi
+ fi
+ if use d3d9; then
+ git-r3_fetch "${D3D9_EGIT_REPO_URI}" "${D3D9_COMMIT}"
+ git-r3_checkout "${D3D9_EGIT_REPO_URI}" "${D3D9_DIR}"
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+ local md5="$(md5sum server/protocol.def)"
+ local PATCHES=(
+ "${FILESDIR}"/${PN}-1.5.26-winegcc.patch #260726
+ "${FILESDIR}"/${PN}-1.9.5-multilib-portage.patch #395615
+ "${FILESDIR}"/${PN}-1.7.12-osmesa-check.patch #429386
+ "${FILESDIR}"/${PN}-1.6-memset-O3.patch #480508
+ )
+ if use staging; then
+ ewarn "Applying the Wine-Staging patchset. Any bug reports to the"
+ ewarn "Wine bugzilla should explicitly state that staging was used."
+
+ local STAGING_EXCLUDE=""
+ STAGING_EXCLUDE="${STAGING_EXCLUDE} -W winhlp32-Flex_Workaround" # Avoid double patching https://bugs.winehq.org/show_bug.cgi?id=42132
+ use pipelight || STAGING_EXCLUDE="${STAGING_EXCLUDE} -W Pipelight"
+
+ # Launch wine-staging patcher in a subshell, using eapply as a backend, and gitapply.sh as a backend for binary patches
+ ebegin "Running Wine-Staging patch installer"
+ (
+ set -- DESTDIR="${S}" --backend=eapply --no-autoconf --all ${STAGING_EXCLUDE}
+ cd "${STAGING_DIR}/patches"
+ source "${STAGING_DIR}/patches/patchinstall.sh"
+ )
+ eend $? || die "Failed to apply Wine-Staging patches"
+
+ # To differentiate unofficial staging releases
+ if [[ ! -z ${SUFFIX} ]]; then
+ sed -i "s/(Staging)/(Staging [Unofficial])/" libs/wine/Makefile.in || die
+ fi
+ fi
+ if use d3d9; then
+ if use staging; then
+ PATCHES+=( "${D3D9_DIR}/staging-helper.patch" )
+ else
+ PATCHES+=( "${D3D9_DIR}/d3d9-helper.patch" )
+ fi
+ PATCHES+=( "${D3D9_DIR}/wine-d3d9.patch" )
+ fi
+
+ default
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${WORKDIR}"/${WINE_GENTOO}/icons/oic_winlogo.ico dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use staging && myconf+=(
+ --with-xattr
+ $(use_with themes gtk3)
+ $(use_with vaapi va)
+ )
+ use d3d9 && myconf+=( $(use_with d3d9 d3d9-nine) )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ local l
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ emake -C "../${WINE_GENTOO}" install DESTDIR="${D}" EPREFIX="${EPREFIX}"
+ if use gecko ; then
+ insinto /usr/share/wine/gecko
+ use abi_x86_32 && doins "${DISTDIR}"/wine_gecko-${GV}-x86.msi
+ use abi_x86_64 && doins "${DISTDIR}"/wine_gecko-${GV}-x86_64.msi
+ fi
+ if use mono ; then
+ insinto /usr/share/wine/mono
+ doins "${DISTDIR}"/wine-mono-${MV}.msi
+ fi
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D}"usr/bin/{wine{dump,maker},function_grep.pl} "${D}"usr/share/man/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D}"/usr/bin/wineconsole* || die
+ rm "${D}"/usr/share/man/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D}usr/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D}"usr/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D}"usr/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 /usr/bin/wine # 404331
+ dosym wine64-preloader /usr/bin/wine-preloader
+ fi
+
+ # respect LINGUAS when installing man pages, #469418
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D}"usr/share/man/${l}*
+ done
+}
+
+pkg_preinst() {
+ gnome2_icon_savelist
+}
+
+pkg_postinst() {
+ gnome2_icon_cache_update
+ fdo-mime_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_postrm() {
+ gnome2_icon_cache_update
+ fdo-mime_desktop_database_update
+}
diff --git a/app-emulation/wine/wine-9999.ebuild b/app-emulation/wine/wine-9999.ebuild
new file mode 100644
index 0000000..bf71ab6
--- /dev/null
+++ b/app-emulation/wine/wine-9999.ebuild
@@ -0,0 +1,581 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+PLOCALES="ar bg ca cs da de el en en_US eo es fa fi fr he hi hr hu it ja ko lt ml nb_NO nl or pa pl pt_BR pt_PT rm ro ru sk sl sr_RS@cyrillic sr_RS@latin sv te th tr uk wa zh_CN zh_TW"
+PLOCALE_BACKUP="en"
+
+inherit autotools eutils fdo-mime flag-o-matic gnome2-utils l10n multilib multilib-minimal pax-utils toolchain-funcs virtualx versionator
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="git://source.winehq.org/git/wine.git http://source.winehq.org/git/wine.git"
+ EGIT_BRANCH="master"
+ inherit git-r3
+ SRC_URI=""
+ #KEYWORDS=""
+else
+ MAJOR_V=$(get_version_component_range 1)
+ SRC_URI="https://dl.winehq.org/wine/source/${MAJOR_V}.x/${P}.tar.xz"
+ KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd"
+fi
+
+VANILLA_GV="2.47"
+VANILLA_MV="4.6.4"
+STAGING_GV="2.47"
+STAGING_MV="4.6.4"
+[[ ${MAJOR_V} == "1.8" ]] && SUFFIX="-unofficial"
+STAGING_P="wine-staging-${PV}"
+STAGING_DIR="${WORKDIR}/${STAGING_P}${SUFFIX}"
+D3D9_P="wine-d3d9-${PV}"
+D3D9_DIR="${WORKDIR}/wine-d3d9-patches-${D3D9_P}"
+WINE_GENTOO="wine-gentoo-2015.03.07"
+DESCRIPTION="Free implementation of Windows(tm) on Unix"
+HOMEPAGE="https://www.winehq.org/"
+SRC_URI="${SRC_URI}
+ !staging? (
+ gecko? (
+ abi_x86_32? ( https://dl.winehq.org/wine/wine-gecko/${VANILLA_GV}/wine_gecko-${VANILLA_GV}-x86.msi )
+ abi_x86_64? ( https://dl.winehq.org/wine/wine-gecko/${VANILLA_GV}/wine_gecko-${VANILLA_GV}-x86_64.msi )
+ )
+ mono? ( https://dl.winehq.org/wine/wine-mono/${VANILLA_MV}/wine-mono-${VANILLA_MV}.msi )
+ )
+ staging? (
+ gecko? (
+ abi_x86_32? ( https://dl.winehq.org/wine/wine-gecko/${STAGING_GV}/wine_gecko-${STAGING_GV}-x86.msi )
+ abi_x86_64? ( https://dl.winehq.org/wine/wine-gecko/${STAGING_GV}/wine_gecko-${STAGING_GV}-x86_64.msi )
+ )
+ mono? ( https://dl.winehq.org/wine/wine-mono/${STAGING_MV}/wine-mono-${STAGING_MV}.msi )
+ )
+ https://dev.gentoo.org/~tetromino/distfiles/${PN}/${WINE_GENTOO}.tar.bz2"
+
+if [[ ${PV} == "9999" ]] ; then
+ STAGING_EGIT_REPO_URI="https://github.com/wine-compholio/wine-staging.git"
+ D3D9_EGIT_REPO_URI="https://github.com/sarnex/wine-d3d9-patches.git"
+else
+ SRC_URI="${SRC_URI}
+ staging? ( https://github.com/wine-compholio/wine-staging/archive/v${PV}${SUFFIX}.tar.gz -> ${STAGING_P}.tar.gz )
+ d3d9? ( https://github.com/sarnex/wine-d3d9-patches/archive/${D3D9_P}.tar.gz )"
+fi
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+IUSE="+abi_x86_32 +abi_x86_64 +alsa capi cups custom-cflags d3d9 dos elibc_glibc +fontconfig +gecko gphoto2 gsm gstreamer +jpeg kernel_FreeBSD +lcms ldap +mono mp3 ncurses netapi nls odbc openal opencl +opengl osmesa oss +perl pcap pipelight +png prelink pulseaudio +realtime +run-exes s3tc samba scanner selinux +ssl staging test themes +threads +truetype udev +udisks v4l vaapi +X +xcomposite xinerama +xml"
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )
+ X? ( truetype )
+ elibc_glibc? ( threads )
+ osmesa? ( opengl )
+ pipelight? ( staging )
+ s3tc? ( staging )
+ test? ( abi_x86_32 )
+ themes? ( staging )
+ vaapi? ( staging )" # osmesa-opengl #286560 # X-truetype #551124
+
+# FIXME: the test suite is unsuitable for us; many tests require net access
+# or fail due to Xvfb's opengl limitations.
+RESTRICT="test"
+
+COMMON_DEPEND="
+ X? (
+ x11-libs/libXcursor[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libXrandr[${MULTILIB_USEDEP}]
+ x11-libs/libXi[${MULTILIB_USEDEP}]
+ x11-libs/libXxf86vm[${MULTILIB_USEDEP}]
+ )
+ alsa? ( media-libs/alsa-lib[${MULTILIB_USEDEP}] )
+ capi? ( net-libs/libcapi[${MULTILIB_USEDEP}] )
+ cups? ( net-print/cups:=[${MULTILIB_USEDEP}] )
+ d3d9? (
+ media-libs/mesa[d3d9,egl,${MULTILIB_USEDEP}]
+ x11-libs/libX11[${MULTILIB_USEDEP}]
+ x11-libs/libXext[${MULTILIB_USEDEP}]
+ x11-libs/libxcb[${MULTILIB_USEDEP}]
+ )
+ fontconfig? ( media-libs/fontconfig:=[${MULTILIB_USEDEP}] )
+ gphoto2? ( media-libs/libgphoto2:=[${MULTILIB_USEDEP}] )
+ gsm? ( media-sound/gsm:=[${MULTILIB_USEDEP}] )
+ gstreamer? (
+ media-libs/gstreamer:1.0[${MULTILIB_USEDEP}]
+ media-plugins/gst-plugins-meta:1.0[${MULTILIB_USEDEP}]
+ )
+ jpeg? ( virtual/jpeg:0=[${MULTILIB_USEDEP}] )
+ lcms? ( media-libs/lcms:2=[${MULTILIB_USEDEP}] )
+ ldap? ( net-nds/openldap:=[${MULTILIB_USEDEP}] )
+ mp3? ( >=media-sound/mpg123-1.5.0[${MULTILIB_USEDEP}] )
+ ncurses? ( >=sys-libs/ncurses-5.2:0=[${MULTILIB_USEDEP}] )
+ netapi? ( net-fs/samba[netapi(+),${MULTILIB_USEDEP}] )
+ nls? ( sys-devel/gettext[${MULTILIB_USEDEP}] )
+ odbc? ( dev-db/unixODBC:=[${MULTILIB_USEDEP}] )
+ openal? ( media-libs/openal:=[${MULTILIB_USEDEP}] )
+ opencl? ( virtual/opencl[${MULTILIB_USEDEP}] )
+ opengl? (
+ virtual/glu[${MULTILIB_USEDEP}]
+ virtual/opengl[${MULTILIB_USEDEP}]
+ )
+ osmesa? ( media-libs/mesa[osmesa,${MULTILIB_USEDEP}] )
+ pcap? ( net-libs/libpcap[${MULTILIB_USEDEP}] )
+ png? ( media-libs/libpng:0=[${MULTILIB_USEDEP}] )
+ pulseaudio? ( media-sound/pulseaudio[${MULTILIB_USEDEP}] )
+ scanner? ( media-gfx/sane-backends:=[${MULTILIB_USEDEP}] )
+ ssl? ( net-libs/gnutls:=[${MULTILIB_USEDEP}] )
+ staging? ( sys-apps/attr[${MULTILIB_USEDEP}] )
+ themes? (
+ dev-libs/glib:2[${MULTILIB_USEDEP}]
+ x11-libs/cairo[${MULTILIB_USEDEP}]
+ x11-libs/gtk+:3[${MULTILIB_USEDEP}]
+ )
+ truetype? ( >=media-libs/freetype-2.0.0[${MULTILIB_USEDEP}] )
+ udev? ( virtual/libudev:=[${MULTILIB_USEDEP}] )
+ udisks? ( sys-apps/dbus[${MULTILIB_USEDEP}] )
+ v4l? ( media-libs/libv4l[${MULTILIB_USEDEP}] )
+ vaapi? ( x11-libs/libva[X,${MULTILIB_USEDEP}] )
+ xcomposite? ( x11-libs/libXcomposite[${MULTILIB_USEDEP}] )
+ xinerama? ( x11-libs/libXinerama[${MULTILIB_USEDEP}] )
+ xml? (
+ dev-libs/libxml2[${MULTILIB_USEDEP}]
+ dev-libs/libxslt[${MULTILIB_USEDEP}]
+ )
+ abi_x86_32? (
+ !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-baselibs-20140508-r14
+ !app-emulation/emul-linux-x86-db[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-db-20140508-r3
+ !app-emulation/emul-linux-x86-medialibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-medialibs-20140508-r6
+ !app-emulation/emul-linux-x86-opengl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-opengl-20140508-r1
+ !app-emulation/emul-linux-x86-sdl[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-sdl-20140508-r1
+ !app-emulation/emul-linux-x86-soundlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-soundlibs-20140508
+ !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)]
+ !<app-emulation/emul-linux-x86-xlibs-20140508
+ )"
+
+RDEPEND="${COMMON_DEPEND}
+ dos? ( >=games-emulation/dosbox-0.74_p20160629 )
+ perl? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ pulseaudio? (
+ realtime? ( sys-auth/rtkit )
+ )
+ s3tc? ( >=media-libs/libtxc_dxtn-1.0.1-r1[${MULTILIB_USEDEP}] )
+ samba? ( >=net-fs/samba-3.0.25[winbind] )
+ selinux? ( sec-policy/selinux-wine )
+ udisks? ( sys-fs/udisks:2 )"
+
+# tools/make_requests requires perl
+DEPEND="${COMMON_DEPEND}
+ sys-devel/flex
+ >=sys-kernel/linux-headers-2.6
+ virtual/pkgconfig
+ virtual/yacc
+ X? (
+ x11-proto/inputproto
+ x11-proto/xextproto
+ x11-proto/xf86vidmodeproto
+ )
+ prelink? ( sys-devel/prelink )
+ staging? (
+ dev-lang/perl
+ dev-perl/XML-Simple
+ )
+ xinerama? ( x11-proto/xineramaproto )"
+
+# These use a non-standard "Wine" category, which is provided by
+# /etc/xdg/applications-merged/wine.menu
+QA_DESKTOP_FILE="usr/share/applications/wine-browsedrive.desktop
+usr/share/applications/wine-notepad.desktop
+usr/share/applications/wine-uninstaller.desktop
+usr/share/applications/wine-winecfg.desktop"
+
+wine_compiler_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ # GCC-specific bugs
+ if tc-is-gcc; then
+ # bug #549768
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) -le 2 ]]; then
+ ebegin "Checking for gcc-5 ms_abi compiler bug"
+ $(tc-getCC) -O2 "${FILESDIR}"/pr66838.c -o "${T}"/pr66838 || die
+ # Run in subshell to prevent "Aborted" message
+ ( "${T}"/pr66838 || false ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "64-bit wine cannot be built with gcc-5.1 or initial patchset of 5.2.0"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.2.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/549768"
+ eerror
+ return 1
+ fi
+ fi
+ # bug #574044
+ if use abi_x86_64 && [[ $(gcc-major-version) = 5 && $(gcc-minor-version) = 3 ]]; then
+ ebegin "Checking for gcc-5-3 stack realignment compiler bug"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 -mincoming-stack-boundary=3 "${FILESDIR}"/pr69140.c -o "${T}"/pr69140 ) >/dev/null 2>&1
+ if ! eend $?; then
+ eerror "Wine cannot be built with this version of gcc-5.3"
+ eerror "due to compiler bugs; please re-emerge the latest gcc-5.3.x ebuild,"
+ eerror "or use gcc-config to select a different compiler version."
+ eerror "See https://bugs.gentoo.org/574044"
+ eerror
+ return 1
+ fi
+ fi
+ fi
+
+ # Ensure compiler support
+ if use abi_x86_64; then
+ ebegin "Checking for 64-bit compiler with builtin_ms_va_list support"
+ # Compile in subshell to prevent "Aborted" message
+ ( $(tc-getCC) -O2 "${FILESDIR}"/builtin_ms_va_list.c -o "${T}"/builtin_ms_va_list >/dev/null 2>&1)
+ if ! eend $?; then
+ eerror "This version of $(tc-getCC) does not support builtin_ms_va_list, can't enable 64-bit wine"
+ eerror
+ eerror "You need gcc-4.4+ or clang 3.8+ to build 64-bit wine"
+ eerror
+ return 1
+ fi
+ fi
+}
+
+wine_build_environment_check() {
+ [[ ${MERGE_TYPE} = "binary" ]] && return 0
+
+ if use abi_x86_64; then
+ if tc-is-gcc && [[ $(gcc-major-version) -lt 4 || ( $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ) ]]; then
+ eerror "You need gcc-4.4+ to compile 64-bit wine"
+ die
+ elif tc-is-clang && [[ $(clang-major-version) -lt 3 || ( $(clang-major-version) -eq 3 && $(clang-minor-version) -lt 8 ) ]]; then
+ eerror "You need clang-3.8+ to compile 64-bit wine"
+ die
+ fi
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -le 3 ]]; then
+ ewarn "GCC-5.0-5.3 suffered from compiler bugs and are no longer supported by"
+ ewarn "Gentoo's Toolchain Team. If your ebuild fails the compiler checks in"
+ ewarn "the configure phase, either update your compiler or switch to <5.0 || >=5.4"
+ fi
+ if tc-is-gcc && [[ $(gcc-major-version) -eq 5 && $(gcc-minor-version) -eq 4 ]]; then
+ if has "-march=i686" ${CFLAGS} && ! has "-mtune=generic" ${CFLAGS}; then
+ ewarn "Compilation can hang with CFLAGS=\"-march=i686\". You can temporarily work"
+ ewarn "around this by adding \"-mtune=generic\" to your CFLAGS for wine."
+ ewarn "See package.env in man 5 portage for more information on how to do this."
+ ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=613128 for more details"
+ fi
+ fi
+
+ if use abi_x86_32 && use opencl && [[ "$(eselect opencl show 2> /dev/null)" == "intel" ]]; then
+ eerror "You cannot build wine with USE=opencl because intel-ocl-sdk is 64-bit only."
+ eerror "See https://bugs.gentoo.org/487864 for more details."
+ eerror
+ return 1
+ fi
+}
+
+wine_env_vcs_vars() {
+ local pn_live_var="${PN//[-+]/_}_LIVE_COMMIT"
+ local pn_live_val="${pn_live_var}"
+ eval pn_live_val='$'${pn_live_val}
+ if [[ ! -z ${pn_live_val} ]]; then
+ if use staging || use d3d9; then
+ eerror "Because of the multi-repo nature of ${PN}, ${pn_live_var}"
+ eerror "cannot be used to set the commit. Instead, you may use the"
+ eerror "environmental variables WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT."
+ eerror
+ return 1
+ fi
+ fi
+ if [[ ! -z ${EGIT_COMMIT} ]]; then
+ eerror "Commits must now be specified using the environmental variables"
+ eerror "WINE_COMMIT, STAGING_COMMIT, and D3D9_COMMIT"
+ eerror
+ return 1
+ fi
+}
+
+pkg_pretend() {
+ wine_build_environment_check || die
+
+ # Verify OSS support
+ if use oss && ! use kernel_FreeBSD; then
+ if ! has_version ">=media-sound/oss-4"; then
+ eerror "You cannot build wine with USE=oss without having support from a"
+ eerror "FreeBSD kernel or >=media-sound/oss-4 (only available through external repos)"
+ eerror
+ die
+ fi
+ fi
+}
+
+pkg_setup() {
+ wine_build_environment_check || die
+ wine_env_vcs_vars || die
+ if ! use staging; then
+ GV=${VANILLA_GV}
+ MV=${VANILLA_MV}
+ else
+ GV=${STAGING_GV}
+ MV=${STAGING_MV}
+ fi
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ EGIT_COMMIT="${WINE_COMMIT}" git-r3_src_unpack
+ if use staging; then
+ local CURRENT_WINE_COMMIT=${EGIT_VERSION}
+
+ git-r3_fetch "${STAGING_EGIT_REPO_URI}" "${STAGING_COMMIT}"
+ git-r3_checkout "${STAGING_EGIT_REPO_URI}" "${STAGING_DIR}"
+
+ local COMPAT_WINE_COMMIT=$("${STAGING_DIR}/patches/patchinstall.sh" --upstream-commit) || die
+
+ if [[ "${CURRENT_WINE_COMMIT}" != "${COMPAT_WINE_COMMIT}" ]]; then
+ einfo "The current Staging patchset is not guaranteed to apply on this WINE commit."
+ einfo "If src_prepare fails, try emerging with the env var WINE_COMMIT."
+ einfo "Example: WINE_COMMIT=${COMPAT_WINE_COMMIT} emerge -1 wine"
+ fi
+ fi
+ if use d3d9; then
+ git-r3_fetch "${D3D9_EGIT_REPO_URI}" "${D3D9_COMMIT}"
+ git-r3_checkout "${D3D9_EGIT_REPO_URI}" "${D3D9_DIR}"
+ fi
+ fi
+
+ default
+
+ l10n_find_plocales_changes "${S}/po" "" ".po"
+}
+
+src_prepare() {
+ local md5="$(md5sum server/protocol.def)"
+ local PATCHES=(
+ "${FILESDIR}"/${PN}-1.5.26-winegcc.patch #260726
+ "${FILESDIR}"/${PN}-1.9.5-multilib-portage.patch #395615
+ "${FILESDIR}"/${PN}-1.6-memset-O3.patch #480508
+ )
+ if use staging; then
+ ewarn "Applying the Wine-Staging patchset. Any bug reports to the"
+ ewarn "Wine bugzilla should explicitly state that staging was used."
+
+ local STAGING_EXCLUDE=""
+ STAGING_EXCLUDE="${STAGING_EXCLUDE} -W winhlp32-Flex_Workaround" # Avoid double patching https://bugs.winehq.org/show_bug.cgi?id=42132
+ use pipelight || STAGING_EXCLUDE="${STAGING_EXCLUDE} -W Pipelight"
+
+ # Launch wine-staging patcher in a subshell, using eapply as a backend, and gitapply.sh as a backend for binary patches
+ ebegin "Running Wine-Staging patch installer"
+ (
+ set -- DESTDIR="${S}" --backend=eapply --no-autoconf --all ${STAGING_EXCLUDE}
+ cd "${STAGING_DIR}/patches"
+ source "${STAGING_DIR}/patches/patchinstall.sh"
+ )
+ eend $? || die "Failed to apply Wine-Staging patches"
+
+ # To differentiate unofficial staging releases
+ if [[ ! -z ${SUFFIX} ]]; then
+ sed -i "s/(Staging)/(Staging [Unofficial])/" libs/wine/Makefile.in || die
+ fi
+ fi
+ if use d3d9; then
+ if use staging; then
+ PATCHES+=( "${D3D9_DIR}/staging-helper.patch" )
+ else
+ PATCHES+=( "${D3D9_DIR}/d3d9-helper.patch" )
+ fi
+ PATCHES+=( "${D3D9_DIR}/wine-d3d9.patch" )
+ fi
+
+ default
+ eautoreconf
+
+ # Modification of the server protocol requires regenerating the server requests
+ if [[ "$(md5sum server/protocol.def)" != "${md5}" ]]; then
+ einfo "server/protocol.def was patched; running tools/make_requests"
+ tools/make_requests || die #432348
+ fi
+ sed -i '/^UPDATE_DESKTOP_DATABASE/s:=.*:=true:' tools/Makefile.in || die
+ if ! use run-exes; then
+ sed -i '/^MimeType/d' loader/wine.desktop || die #117785
+ fi
+
+ # hi-res default icon, #472990, https://bugs.winehq.org/show_bug.cgi?id=24652
+ cp "${WORKDIR}"/${WINE_GENTOO}/icons/oic_winlogo.ico dlls/user32/resources/ || die
+
+ l10n_get_locales > po/LINGUAS || die # otherwise wine doesn't respect LINGUAS
+}
+
+src_configure() {
+ wine_compiler_check || die
+
+ export LDCONFIG=/bin/true
+ use custom-cflags || strip-flags
+
+ multilib-minimal_src_configure
+}
+
+multilib_src_configure() {
+ local myconf=(
+ --sysconfdir=/etc/wine
+ $(use_with alsa)
+ $(use_with capi)
+ $(use_with lcms cms)
+ $(use_with cups)
+ $(use_with ncurses curses)
+ $(use_with udisks dbus)
+ $(use_with fontconfig)
+ $(use_with ssl gnutls)
+ $(use_enable gecko mshtml)
+ $(use_with gphoto2 gphoto)
+ $(use_with gsm)
+ $(use_with gstreamer)
+ --without-hal
+ $(use_with jpeg)
+ $(use_with ldap)
+ $(use_enable mono mscoree)
+ $(use_with mp3 mpg123)
+ $(use_with netapi)
+ $(use_with nls gettext)
+ $(use_with openal)
+ $(use_with opencl)
+ $(use_with opengl)
+ $(use_with osmesa)
+ $(use_with oss)
+ $(use_with pcap)
+ $(use_with png)
+ $(use_with pulseaudio pulse)
+ $(use_with threads pthread)
+ $(use_with scanner sane)
+ $(use_enable test tests)
+ $(use_with truetype freetype)
+ $(use_with udev)
+ $(use_with v4l)
+ $(use_with X x)
+ $(use_with xcomposite)
+ $(use_with xinerama)
+ $(use_with xml)
+ $(use_with xml xslt)
+ )
+
+ use staging && myconf+=(
+ --with-xattr
+ $(use_with themes gtk3)
+ $(use_with vaapi va)
+ )
+ use d3d9 && myconf+=( $(use_with d3d9 d3d9-nine) )
+
+ local PKG_CONFIG AR RANLIB
+ # Avoid crossdev's i686-pc-linux-gnu-pkg-config if building wine32 on amd64; #472038
+ # set AR and RANLIB to make QA scripts happy; #483342
+ tc-export PKG_CONFIG AR RANLIB
+
+ if use amd64; then
+ if [[ ${ABI} == amd64 ]]; then
+ myconf+=( --enable-win64 )
+ else
+ myconf+=( --disable-win64 )
+ fi
+
+ # Note: using --with-wine64 results in problems with multilib.eclass
+ # CC/LD hackery. We're using separate tools instead.
+ fi
+
+ ECONF_SOURCE=${S} \
+ econf "${myconf[@]}"
+ emake depend
+}
+
+multilib_src_test() {
+ # FIXME: win32-only; wine64 tests fail with "could not find the Wine loader"
+ if [[ ${ABI} == x86 ]]; then
+ if [[ $(id -u) == 0 ]]; then
+ ewarn "Skipping tests since they cannot be run under the root user."
+ ewarn "To run the test ${PN} suite, add userpriv to FEATURES in make.conf"
+ return
+ fi
+
+ WINEPREFIX="${T}/.wine-${ABI}" \
+ Xemake test
+ fi
+}
+
+multilib_src_install_all() {
+ local DOCS=( ANNOUNCE AUTHORS README )
+ local l
+ add_locale_docs() {
+ local locale_doc="documentation/README.$1"
+ [[ ! -e ${locale_doc} ]] || DOCS+=( ${locale_doc} )
+ }
+ l10n_for_each_locale_do add_locale_docs
+
+ einstalldocs
+ prune_libtool_files --all
+
+ emake -C "../${WINE_GENTOO}" install DESTDIR="${D}" EPREFIX="${EPREFIX}"
+ if use gecko ; then
+ insinto /usr/share/wine/gecko
+ use abi_x86_32 && doins "${DISTDIR}"/wine_gecko-${GV}-x86.msi
+ use abi_x86_64 && doins "${DISTDIR}"/wine_gecko-${GV}-x86_64.msi
+ fi
+ if use mono ; then
+ insinto /usr/share/wine/mono
+ doins "${DISTDIR}"/wine-mono-${MV}.msi
+ fi
+ if ! use perl ; then # winedump calls function_grep.pl, and winemaker is a perl script
+ rm "${D}"usr/bin/{wine{dump,maker},function_grep.pl} "${D}"usr/share/man/man1/wine{dump,maker}.1 || die
+ fi
+
+ # Remove wineconsole if neither backend is installed #551124
+ if ! use X && ! use ncurses; then
+ rm "${D}"/usr/bin/wineconsole* || die
+ rm "${D}"/usr/share/man/man1/wineconsole* || die
+ rm_wineconsole() {
+ rm "${D}usr/$(get_libdir)"/wine/{,fakedlls/}wineconsole.exe* || die
+ }
+ multilib_foreach_abi rm_wineconsole
+ fi
+
+ use abi_x86_32 && pax-mark psmr "${D}"usr/bin/wine{,-preloader} #255055
+ use abi_x86_64 && pax-mark psmr "${D}"usr/bin/wine64{,-preloader}
+
+ if use abi_x86_64 && ! use abi_x86_32; then
+ dosym wine64 /usr/bin/wine # 404331
+ dosym wine64-preloader /usr/bin/wine-preloader
+ fi
+
+ # respect LINGUAS when installing man pages, #469418
+ for l in de fr pl; do
+ use linguas_${l} || rm -r "${D}"usr/share/man/${l}*
+ done
+}
+
+pkg_preinst() {
+ gnome2_icon_savelist
+}
+
+pkg_postinst() {
+ gnome2_icon_cache_update
+ fdo-mime_desktop_database_update
+
+ if ! use gecko; then
+ ewarn "Without Wine Gecko, wine prefixes will not have a default"
+ ewarn "implementation of iexplore. Many older windows applications"
+ ewarn "rely upon the existence of an iexplore implementation, so"
+ ewarn "you will likely need to install an external one, like via winetricks"
+ fi
+ if ! use mono; then
+ ewarn "Without Wine Mono, wine prefixes will not have a default"
+ ewarn "implementation of .NET. Many windows applications rely upon"
+ ewarn "the existence of a .NET implementation, so you will likely need"
+ ewarn "to install an external one, like via winetricks"
+ fi
+}
+
+pkg_postrm() {
+ gnome2_icon_cache_update
+ fdo-mime_desktop_database_update
+}
diff --git a/app-emulation/winetricks/Manifest b/app-emulation/winetricks/Manifest
new file mode 100644
index 0000000..f0d9956
--- /dev/null
+++ b/app-emulation/winetricks/Manifest
@@ -0,0 +1,2 @@
+DIST winetricks-20170823.tar.gz 639027 SHA256 0e7e007b0dd39f773213a5540e7c44e4105d9435ef067c0efdcc6fda70c029de SHA512 edc805be1a1c4fa64ae16b14fdd46786e259b88a0cde7afdf24bf934fa79f4acf3d9e599727fa589f155ec265569953b9e419cda79d54057157cbb1510261e3a WHIRLPOOL f1d556a36b20982a1a41514aea60c2834f40bfb0cbb6512cfcbe3bdef5dc07fdc585c06acb0b8c372dfbc3b549ee0bb52b907fc818e598676b27e1f8669f3eba
+DIST winetricks-gentoo-2012.11.24.tar.bz2 6398 SHA256 dded8c294cc5c2e71e4a5d1531ab165178cf3d2d1d890d0656368c2e499bfeb9 SHA512 59c93b73f3a7b2d11aefcde2ff66659ff1de21ad4b5f232f4b60572f3a48b15a6c49f369b1696862bf1b33fde190bf5598945e9536fb41ddec42d8def4d2be2a WHIRLPOOL 268da9e06712a678fbbcfff8eac1fca364b5e46f0a9c48a591eb88f03260b1a55f203eb2908bfe1f0a534b77c866127ff6f7049b0e43fe8abeaaa26fe55de75b
diff --git a/app-emulation/winetricks/metadata.xml b/app-emulation/winetricks/metadata.xml
new file mode 100644
index 0000000..424fb74
--- /dev/null
+++ b/app-emulation/winetricks/metadata.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="person">
+ <email>Chiitoo@gentoo.org</email>
+ <name>Jimi Huotari</name>
+ <description>Proxied maintainer; assign all bugs to him</description>
+ </maintainer>
+ <maintainer type="person">
+ <email>NP-Hardass@gentoo.org</email>
+ <name>NP-Hardass</name>
+ <description>Proxy maintainer; CC on all bugs</description>
+ </maintainer>
+ <maintainer type="project">
+ <email>wine@gentoo.org</email>
+ <name>Wine</name>
+ </maintainer>
+ <upstream>
+ <remote-id type="google-code">winetricks</remote-id>
+ <remote-id type="github">Winetricks/winetricks</remote-id>
+ </upstream>
+ <use>
+ <flag name="rar">Pull in <pkg>app-arch/unrar</pkg> for extraction of
+ rar-compressed game files</flag>
+ </use>
+</pkgmetadata>
diff --git a/app-emulation/winetricks/winetricks-20170823.ebuild b/app-emulation/winetricks/winetricks-20170823.ebuild
new file mode 100644
index 0000000..b1e5c8b
--- /dev/null
+++ b/app-emulation/winetricks/winetricks-20170823.ebuild
@@ -0,0 +1,87 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit gnome2-utils eutils
+
+if [[ ${PV} == "99999999" ]] ; then
+ EGIT_REPO_URI="https://github.com/Winetricks/${PN}.git"
+ inherit git-r3
+ SRC_URI=""
+else
+ SRC_URI="https://github.com/Winetricks/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
+ KEYWORDS="amd64 x86"
+fi
+
+wtg=winetricks-gentoo-2012.11.24
+
+SRC_URI="${SRC_URI}
+ gtk? ( https://dev.gentoo.org/~tetromino/distfiles/wine/${wtg}.tar.bz2 )
+ kde? ( https://dev.gentoo.org/~tetromino/distfiles/wine/${wtg}.tar.bz2 )"
+
+DESCRIPTION="Easy way to install DLLs needed to work around problems in Wine"
+HOMEPAGE="https://github.com/Winetricks/winetricks https://wiki.winehq.org/Winetricks"
+
+LICENSE="LGPL-2.1+"
+SLOT="0"
+IUSE="gtk kde rar"
+
+DEPEND=""
+RDEPEND="app-arch/cabextract
+ app-arch/p7zip
+ app-arch/unzip
+ net-misc/wget
+ x11-misc/xdg-utils
+ || (
+ app-emulation/wine
+ virtual/wine
+ )
+ gtk? ( gnome-extra/zenity )
+ kde? ( kde-apps/kdialog )
+ rar? ( app-arch/unrar )"
+
+# Uses non-standard "Wine" category, which is provided by app-emulation/wine; #451552
+QA_DESKTOP_FILE="usr/share/applications/winetricks.desktop"
+
+# Tests require network access and run Wine, which is unreliable from a portage environment.
+RESTRICT="test"
+
+src_unpack() {
+ if [[ ${PV} == "99999999" ]] ; then
+ git-r3_src_unpack
+ if use gtk || use kde; then
+ unpack ${wtg}.tar.bz2
+ fi
+ else
+ default
+ fi
+}
+
+src_install() {
+ default
+ if use gtk || use kde; then
+ cd "${WORKDIR}/${wtg}" || die
+ domenu winetricks.desktop
+ insinto /usr/share/icons/hicolor/scalable/apps
+ doins wine-winetricks.svg
+ fi
+}
+
+pkg_preinst() {
+ if use gtk || use kde; then
+ gnome2_icon_savelist
+ fi
+}
+
+pkg_postinst() {
+ if use gtk || use kde; then
+ gnome2_icon_cache_update
+ fi
+}
+
+pkg_postrm() {
+ if use gtk || use kde; then
+ gnome2_icon_cache_update
+ fi
+}
diff --git a/app-emulation/winetricks/winetricks-99999999.ebuild b/app-emulation/winetricks/winetricks-99999999.ebuild
new file mode 100644
index 0000000..655af7a
--- /dev/null
+++ b/app-emulation/winetricks/winetricks-99999999.ebuild
@@ -0,0 +1,87 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit gnome2-utils eutils
+
+if [[ ${PV} == "99999999" ]] ; then
+ EGIT_REPO_URI="https://github.com/Winetricks/${PN}.git"
+ inherit git-r3
+ SRC_URI=""
+else
+ SRC_URI="https://github.com/Winetricks/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
+ KEYWORDS="~amd64 ~x86"
+fi
+
+wtg=winetricks-gentoo-2012.11.24
+
+SRC_URI="${SRC_URI}
+ gtk? ( https://dev.gentoo.org/~tetromino/distfiles/wine/${wtg}.tar.bz2 )
+ kde? ( https://dev.gentoo.org/~tetromino/distfiles/wine/${wtg}.tar.bz2 )"
+
+DESCRIPTION="Easy way to install DLLs needed to work around problems in Wine"
+HOMEPAGE="https://github.com/Winetricks/winetricks https://wiki.winehq.org/Winetricks"
+
+LICENSE="LGPL-2.1+"
+SLOT="0"
+IUSE="gtk kde rar"
+
+DEPEND=""
+RDEPEND="app-arch/cabextract
+ app-arch/p7zip
+ app-arch/unzip
+ net-misc/wget
+ x11-misc/xdg-utils
+ || (
+ app-emulation/wine
+ virtual/wine
+ )
+ gtk? ( gnome-extra/zenity )
+ kde? ( kde-apps/kdialog )
+ rar? ( app-arch/unrar )"
+
+# Uses non-standard "Wine" category, which is provided by app-emulation/wine; #451552
+QA_DESKTOP_FILE="usr/share/applications/winetricks.desktop"
+
+# Tests require network access and run Wine, which is unreliable from a portage environment.
+RESTRICT="test"
+
+src_unpack() {
+ if [[ ${PV} == "99999999" ]] ; then
+ git-r3_src_unpack
+ if use gtk || use kde; then
+ unpack ${wtg}.tar.bz2
+ fi
+ else
+ default
+ fi
+}
+
+src_install() {
+ default
+ if use gtk || use kde; then
+ cd "${WORKDIR}/${wtg}" || die
+ domenu winetricks.desktop
+ insinto /usr/share/icons/hicolor/scalable/apps
+ doins wine-winetricks.svg
+ fi
+}
+
+pkg_preinst() {
+ if use gtk || use kde; then
+ gnome2_icon_savelist
+ fi
+}
+
+pkg_postinst() {
+ if use gtk || use kde; then
+ gnome2_icon_cache_update
+ fi
+}
+
+pkg_postrm() {
+ if use gtk || use kde; then
+ gnome2_icon_cache_update
+ fi
+}
diff --git a/virtual/wine/metadata.xml b/virtual/wine/metadata.xml
new file mode 100644
index 0000000..de062ba
--- /dev/null
+++ b/virtual/wine/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>wine@gentoo.org</email>
+ <name>Wine</name>
+ </maintainer>
+ <use>
+ <flag name="d3d9">Enable Ixit's Gallium Nine Patchset</flag>
+ <flag name="staging">Enable Wine-Staging's Patchset</flag>
+ </use>
+ <longdescription lang="en">
+ Allows for any variant of Wine, regardless of slotting to fulfill the dependencies
+ traditionally fulfilled by the non-slotted, pre-variant, app-emulation/wine.
+ </longdescription>
+</pkgmetadata>
diff --git a/virtual/wine/wine-0-r5.ebuild b/virtual/wine/wine-0-r5.ebuild
new file mode 100644
index 0000000..ac3dcae
--- /dev/null
+++ b/virtual/wine/wine-0-r5.ebuild
@@ -0,0 +1,33 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+DESCRIPTION="Virtual for Wine that supports multiple variants and slotting"
+
+SLOT="0"
+KEYWORDS="amd64 x86 ~x86-fbsd"
+IUSE="+abi_x86_32 +abi_x86_64 d3d9 staging"
+
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )"
+
+# Note, the ordering here is intentional, to take advantage of the short-circuit
+# logic of portage, to enforce wine-vanilla as default for new users. The idea
+# behind this is that some USE flags may pull in 3rd-party patchsets, so default
+# of vanilla prevents that.
+RDEPEND="
+ staging? ( || (
+ app-emulation/wine-staging[staging]
+ app-emulation/wine-any[staging]
+ ) )
+ d3d9? ( || (
+ app-emulation/wine-d3d9[d3d9]
+ app-emulation/wine-any[d3d9]
+ ) )
+ || (
+ app-emulation/wine-vanilla[abi_x86_32=,abi_x86_64=]
+ app-emulation/wine-staging[abi_x86_32=,abi_x86_64=]
+ app-emulation/wine-d3d9[abi_x86_32=,abi_x86_64=]
+ app-emulation/wine-any[abi_x86_32=,abi_x86_64=]
+ )
+ !app-emulation/wine:0"
diff --git a/virtual/wine/wine-0-r6.ebuild b/virtual/wine/wine-0-r6.ebuild
new file mode 100644
index 0000000..5371654
--- /dev/null
+++ b/virtual/wine/wine-0-r6.ebuild
@@ -0,0 +1,33 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+DESCRIPTION="Virtual for Wine that supports multiple variants and slotting"
+
+SLOT="0"
+KEYWORDS="~amd64 ~x86 ~x86-fbsd"
+IUSE="+abi_x86_32 +abi_x86_64 d3d9 staging"
+
+REQUIRED_USE="|| ( abi_x86_32 abi_x86_64 )"
+
+# Note, the ordering here is intentional, to take advantage of the short-circuit
+# logic of portage, to enforce wine-vanilla as default for new users. The idea
+# behind this is that some USE flags may pull in 3rd-party patchsets, so default
+# of vanilla prevents that.
+RDEPEND="
+ staging? ( || (
+ app-emulation/wine-staging[staging]
+ app-emulation/wine-any[staging]
+ ) )
+ d3d9? ( || (
+ app-emulation/wine-d3d9[d3d9]
+ app-emulation/wine-any[d3d9]
+ ) )
+ || (
+ app-emulation/wine-vanilla[abi_x86_32=,abi_x86_64=]
+ app-emulation/wine-staging[abi_x86_32=,abi_x86_64=]
+ app-emulation/wine-d3d9[abi_x86_32=,abi_x86_64=]
+ app-emulation/wine-any[abi_x86_32=,abi_x86_64=]
+ )
+ !app-emulation/wine:0"