aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxor <davidhughes205@gmail.com>2020-11-08 12:58:52 -0500
committerJory Pratt <anarchy@gentoo.org>2020-11-08 12:22:07 -0600
commitc968b4ab1494e7d7b25a183252ce3932cbd13c0c (patch)
tree95c8b9013e7500265923e5f7f93486d9fb3aea9e /dev-java
parentsys-devel/gcc: sync with ::gentoo (diff)
downloadmusl-c968b4ab1494e7d7b25a183252ce3932cbd13c0c.tar.gz
musl-c968b4ab1494e7d7b25a183252ce3932cbd13c0c.tar.bz2
musl-c968b4ab1494e7d7b25a183252ce3932cbd13c0c.zip
OpenJDK: add musl patches to OpenJDK 8 + OpenJDK 11. Patches are hidden behind elibc_musl
Signed-off-by: Jory Pratt <anarchy@gentoo.org>
Diffstat (limited to 'dev-java')
-rw-r--r--dev-java/openjdk/Manifest34
-rw-r--r--dev-java/openjdk/files/bootcycle_jobs.patch26
-rw-r--r--dev-java/openjdk/files/musl/11/aarch64.patch15
-rw-r--r--dev-java/openjdk/files/musl/11/build.patch545
-rw-r--r--dev-java/openjdk/files/musl/11/fix-bootjdk-check.patch18
-rw-r--r--dev-java/openjdk/files/musl/11/ppc64le.patch226
-rw-r--r--dev-java/openjdk/files/musl/8/0001_musl_hotspot.patch116
-rw-r--r--dev-java/openjdk/files/musl/8/0002_musl_hotspot_ppc.patch24
-rw-r--r--dev-java/openjdk/files/musl/8/0003_musl_hotspot_aarch64.patch12
-rw-r--r--dev-java/openjdk/files/musl/8/0004_musl_hotspot_noagent.patch85
-rw-r--r--dev-java/openjdk/files/musl/8/0005_musl_fix_libjvm_load.patch12
-rw-r--r--dev-java/openjdk/files/musl/8/0006_musl_jdk.patch83
-rw-r--r--dev-java/openjdk/files/musl/8/0007_musl_jdk_includes.patch144
-rw-r--r--dev-java/openjdk/files/musl/8/0008_musl_jdk_execinfo.patch21
-rw-r--r--dev-java/openjdk/files/musl/8/0009_fix_jdk_ipv6_init.patch43
-rw-r--r--dev-java/openjdk/files/musl/8/0010_fix_jdk_close_fds.patch103
-rw-r--r--dev-java/openjdk/files/openjdk-11.env.sh16
-rw-r--r--dev-java/openjdk/files/openjdk-8.env.sh16
-rw-r--r--dev-java/openjdk/metadata.xml29
-rw-r--r--dev-java/openjdk/openjdk-11.0.8_p10.ebuild289
-rw-r--r--dev-java/openjdk/openjdk-11.0.9_p11.ebuild288
-rw-r--r--dev-java/openjdk/openjdk-8.265_p01.ebuild268
-rw-r--r--dev-java/openjdk/openjdk-8.272_p10.ebuild267
23 files changed, 2680 insertions, 0 deletions
diff --git a/dev-java/openjdk/Manifest b/dev-java/openjdk/Manifest
new file mode 100644
index 0000000..6fff35e
--- /dev/null
+++ b/dev-java/openjdk/Manifest
@@ -0,0 +1,34 @@
+DIST openjdk-11.0.8_p10.tar.bz2 91141175 BLAKE2B eeef0f6b6a8f804e043cde01de256c86ed35d5a391588100caea49c8c2b617c3f06aa37df894feaa89734e68c32fe28d8bc5337755050c457d657cf88fcff7f3 SHA512 f8fd26a11cb044197d3b04a1347e27e177e79cb58436e67116f63025a2a5c39c0083ac17362e7d2234caf89df530422ead088e3fc4546f8d9f68482fc75eb7a0
+DIST openjdk-11.0.9_p11.tar.bz2 91638327 BLAKE2B a04b7fb5ebde3b6c024e5f3931a2efe796e08ad66c0190cddfa4268d5181f46f24685d9d51ae328547916e8ece723967bf653feeac87347ee14ecbe213ad657a SHA512 a0a6726d5adbe95904b78d8b4319bc4386c594a563f80f63d59072cf72d00928b451163b91258b44193a80851400ce8b8d142fecfd2bd902ff7a5e47cb4a9976
+DIST openjdk-8.265_p01.tar.bz2 456095 BLAKE2B 8de4d0293f3062583654da99a29d5be02197c323772f663d37ab21bdfdf32a723412d301094e6f70cbba99883241f52406a799a91c3d7c2a69ab7b35932c0a38 SHA512 686b869f9278462c6cb52036c4c9261e1689b917ce0afd4e6b47bb3d3207b2e79b2d03c2d3808a5853ab2fa070ac2206877849f5837282cb6deb80f610ba67f5
+DIST openjdk-8.272_p10.tar.bz2 457222 BLAKE2B 51e487d36c1922c5fc04d8922f1000a776e4872142517933ef5e8d5fd825f221fa02325bd755bf3f48f7f3221a2da3ca182301fb303675cb7d712d7b2f1c7751 SHA512 488b7fa0ed725936d483efd54242dbf4409752c685f29277023fb47c4375b5700b34e743d819d7d7c2406a2f8845d1c3d4fc548c156b6c7c30e43574c1b51527
+DIST openjdk-aarch64-shenandoah-8.265_p01.tar.bz2 461443 BLAKE2B 169cc30062efd93e93a16c909494d5817e3f6108ed22d4cb09f618732b990091a47c1149fff0f3e5657c2e21443d357e5d11091ef1d4f8eb61a14bcc35d74951 SHA512 b85714731f9a102585308d2df5b271243b523daa7541635f5d4a22e7322890bc024f8abafbacbd1885c07cec479e00b5edb936936fcfefcfe0f6e2e6e2211689
+DIST openjdk-aarch64-shenandoah-8.272_p10.tar.bz2 462755 BLAKE2B abeabf704d2135da9df6746545209f5a658ec547be5852041bb9bd1dfc4546cef143541df61b4705b6d2181ae7ec91a8c64e2b27347c24d146da49bbf8c228ef SHA512 7cae0cf80e09e1d2ad3eef8bf6740942788d0af4d3c9821bb0785ea42d4b38319d0ec57a8d21add25a40eebdc5ecba8234c9f04e6922e87c80480f71b04e2e3d
+DIST openjdk-aarch64-shenandoah-corba-8.265_p01.tar.bz2 1050861 BLAKE2B 6803ee3ad1e3804cec3a1008f38538d793b2ae4f0a3c22d48d3c9885af37f4baf2ba94b91824e2e2bb170a5c9a59b28edc5d0c94646fd6265fe2b32fad759cb7 SHA512 859afe2ef587f7151a1fce4a43617a3afa0d8b9e04a07332c8a412b1b8deba4e00d7676cf1579cb2a8a18a307d094d22938ea9a3d70acb9094e268e701c35982
+DIST openjdk-aarch64-shenandoah-corba-8.272_p10.tar.bz2 1052989 BLAKE2B 8d6f79758ccf1719396fb56fd47c258c2440beea79516025b4911027a59b6cf4b5826c5eb01ba3a4c45847915531989c74665cbedf6349541df38732e7b828de SHA512 12547c8b5f1fe4efcc58f5b148977d519c954b964e814fc3fce717bd6d6221c2e7eda98a0e1e8157ed2f509f3b89e1e7b529da81cd1ee768daf4ad6369c57e8b
+DIST openjdk-aarch64-shenandoah-hotspot-8.265_p01.tar.bz2 8757379 BLAKE2B aefc9c9b9f5a369db14cc5a22ea54373518daf594b794f74533ea4365416b8adc91cdd6c79934d93f5e0f019d7b07723630f849ab93464d7416d15de54a5c65e SHA512 3f44dadc5a5d9a75d4b6b632991b9fbbcae499e19139e1d902f8f2df101141060bc063996e995b22c462c76962b1312e719495eae99b392da3080c7d875deae5
+DIST openjdk-aarch64-shenandoah-hotspot-8.272_p10.tar.bz2 8767088 BLAKE2B 85b2dcbd696c58db72a7aeb4dc9a4752d742ed90bfd2e06ce5ddd8ed4ec5c63ab2de40a41aab5747fa120d8865c1d57f02a99b27a6ebf7c68c0891e19f5a7f27 SHA512 7866495487b271228f1a2d95cecfa6b76bb912d8c1c63d3d92e7b2cda88dd151b3b6c4c3bc717e37a0bd972762620ae7fb456c1aee281772a145a1dd1b11758b
+DIST openjdk-aarch64-shenandoah-jaxp-8.265_p01.tar.bz2 2696501 BLAKE2B 1b1a459a4400d78c7921593a173059156b53a2cfc5fce695571e5c827bf609c08e02accdd56e1585723d50d93cae6ed0b5cef91f7597de21a16daa9b951046c5 SHA512 a377505e17299ba8fdd9e24fb9d3f786f1e6288e485319f2accf6abe9be957814ceb08c14867839bfd29690e91afb70f2aadfd9cc43db81e924960275792d61c
+DIST openjdk-aarch64-shenandoah-jaxp-8.272_p10.tar.bz2 2718084 BLAKE2B 1e6cc999d84a49c03731a2a2ca73dfe684940509a64199ad52571ef51b3da035e41b41bf262ea88af9f77418c7b1b5721724d86f67a5f737e53eaf3673f4eab8 SHA512 a73e5a4628c936cf9b19082ad49ed2134984d15a1165c45206c74dff45118c50922fd0a668efe93a46c3839775ec567d56eee19cd0e3a9f90e7995d1b6a42f11
+DIST openjdk-aarch64-shenandoah-jaxws-8.265_p01.tar.bz2 2556505 BLAKE2B 70a963e625b04717a7dfd8f913d8dad20158abb1c7d5ea474c53692181d5ba099c9c6ebec0efa28d6732275d02380fda613ba446f854052476fdb2b8cd80fbaf SHA512 db06c192bc6b753209870dddf43d896444a1dddb0f04ddec6ec4317034cf8b33173ccfeb6e50f18f76d6f28eb93ca08d8fade299416d3ed2ccb9d65e03d867f4
+DIST openjdk-aarch64-shenandoah-jaxws-8.272_p10.tar.bz2 2558262 BLAKE2B 3b00ca162f3b758ee65090011551f074f7675f499f179ae0d4c8c62b1d70c942d7d2082d48e84cece6cd2be7ea319c1707fc6239e82fd5e79297f796838688e4 SHA512 d64a15cf35df014c4dca2edddea2015905bafe252d3d2bdfd1bc8f72683ac827e5d0347e36d5d94cda354b31a6b0782017b1cea6571443e073caf9f26c7bebda
+DIST openjdk-aarch64-shenandoah-jdk-8.265_p01.tar.bz2 48064316 BLAKE2B 9623b5ea954dfd4c732b35683f859bdfe823e8fe3697f859e73c220e2931e2047271a6382c096d29bd357c5b9f681ce85053cd349c44332db77a53232f56e748 SHA512 9b90dc0d1e7ba0215628687d0594f2e1316bd190b4ff20b22cf0d20269180a160e46810c7ad2bca43603283d3140567a1cd2a1c222a6ffc8c4bc413ae4da5347
+DIST openjdk-aarch64-shenandoah-jdk-8.272_p10.tar.bz2 48370921 BLAKE2B 98026a28463ce3f520feab2b146830bf91acdccac5aa28488ffdbe4328b9a2cbbc17e95eeb36a60364cab470eeb26efcfa06a588e1bebcb6e978821459536feb SHA512 1bc5baa799282a2d7c0014d2cf55b350c7d99dbd129643d2cfeadebd467b2f6f9a8b8a97d34f66c656103db3ee3d5a57d6ff57dc45bc655258dd5093506d89b5
+DIST openjdk-aarch64-shenandoah-langtools-8.265_p01.tar.bz2 2396374 BLAKE2B 0aeb7c979824773a7de1ff3ae5f0b47ee965011ff29144a1ff83b84f33bfbfe850bea32aaede1ac174ee9d6850a5bfb88c194db7e4a10b6c800716d854871fb8 SHA512 f97b21a5e369239b11ccb122b6256f1b71edec3cbc6d41c0bd90c43b67126846917c795ba2e954a62d72285b50d9bfa74748488a95c2d51aacebe78575ffd833
+DIST openjdk-aarch64-shenandoah-langtools-8.272_p10.tar.bz2 2397200 BLAKE2B 1d985e852f07ab69e0af01a17cc3874cf903b1e3e2c4a909b7403087b3243beaf57a1e9b7792b52469a80764c7db614e3bb6ec4b43527d022219f3e79af21457 SHA512 76118b6c56481bcd3a6a709006d0d114faeef2b2a3c353e4a5ef2af5f03429dddd78d2d5951e9245fb5e41443e871e43634921825c0dbae8907f3f49fb3dea0c
+DIST openjdk-aarch64-shenandoah-nashorn-jdk8.265_p01.tar.bz2 2831216 BLAKE2B 02eb3f916feacaf32feb75e4c3a6bb8915e4247dd07bfd3085feb6575c5152c41d0bef46bf51a8465a2555990a7f63315d61e1733d2f36a09293ec8bab30330d SHA512 610b99e04e0afe3fa78907af20d6d297896b9ab7cfbb5bddeefeb2301e733078b147c1d547cb5c3cb08b6f208acfdbf3559ba561b8a3907cf2c6506bb7daf08e
+DIST openjdk-aarch64-shenandoah-nashorn-jdk8.272_p10.tar.bz2 2838876 BLAKE2B 40d011a11122b2dd19349282468c756a58afbc1ff2a33424d6c4e82cde1f664e3317eb1616533b0d2bc24604c68ffd0b1b92d3271dd633f3a39aad22c84ca781 SHA512 1f50c2c1a6a5d271d63906cb1cf3e87d7b6fe61e92c90cf2974ec40e956be0e8388c2694d189c85ec7072abfd21566671498b8652c2ae9cb2021c6ec4d548f66
+DIST openjdk-corba-8.265_p01.tar.bz2 1034140 BLAKE2B 4b176bf2d9ff461b5682ad7f4b994091acf017df2caabf292dcda9baa34abd7d8016f56f2aff0866508eac565f4079e6f8ba8cbd8167abf1e38cd1fac727e141 SHA512 d92b69ab33176c29c5b7c0a5a21947d5d28dafa32a5933414bea5d16d4e68e1a381b2a73114952d507e7ee76c132e70dc8234175edfd3a086c4775417eaa7d9a
+DIST openjdk-corba-8.272_p10.tar.bz2 1033649 BLAKE2B db9d72dabe4b1727dbbe1de01e46f62676c48668e7ec960e10643c19374a2553dee3c2b5b576f85d09b541b570756b20980e1307fc614e4b4bee9789affc650e SHA512 1426b3ce6983429fe6399da77fb102fb5d54ebf65ab83ad4e3c0ee789e33e2a0afc1bbfb7b8f942334ff9b03be0696494919c374ce1b793b179ecc43e2c4384a
+DIST openjdk-hotspot-8.265_p01.tar.bz2 8204133 BLAKE2B 3c574da38c9c787e2b40dafa6d7885f9632804a158de26fb4e6f9b5266c955adad8adb1917043eecba97fbb1e53c063da08231e806f5ba8f6c0ef762e88c45b6 SHA512 a3fbc527456aeb8566db24f910e6a64f976e3434fe3717058ee91e66e88d03d77641d342801002f7fa35fb8bb94ce397c95ac2abb86c0616ff25f167878b478b
+DIST openjdk-hotspot-8.272_p10.tar.bz2 8206390 BLAKE2B 6822635a29f919696c7a260bf7db20a749ec8598e6c751a8a5e3973c780c17f3ff16a1ed64eb44353be72136fd1ea945dc6620f18d0d876a5773c897bca8705f SHA512 48444d86bacaef503303fb160dca538546e74f7bd71fd34fc2b9faa4e0b1cf7710a6262e9ead161c1b0e8e02e8f96e56a6407d442bbfb01ff8ab835cd840d834
+DIST openjdk-jaxp-8.265_p01.tar.bz2 2735823 BLAKE2B 84a1248b4eb56f4afff62c5dc0f3517c98a6dc5c7e434012c667d59f05a1719372f68594d9d6b13c04e98887913a01b05eefcdadb3a028275555b2a9720502ba SHA512 d0f9da699d4141fa5535abbdf244b4da0fd466b8b5eca3fcaa7cc739326d79a5aa5ffac90988f8bedb39f80d7d4f1feaac3cf5fb1b019203cc96eae9746d9bbc
+DIST openjdk-jaxp-8.272_p10.tar.bz2 2692905 BLAKE2B e8fa9e6a7fd4c4ebeba82a3c55b17e4eba9cb03660baa8d478a8cfced1ab9673465faa1a0f690ebbe2634b2cf2741d7321f2c20c748339237eba7b772a2cea14 SHA512 15efb3db0dc28fd375d769037f248b3527e40d2c190fed57ca1d6a09e59aa79465c0e6516d2a122f6c7ee55f7cfeadaa76669884f74fa34b11ccfdfd76e71f6d
+DIST openjdk-jaxws-8.265_p01.tar.bz2 2543597 BLAKE2B c83256ab68837cc44d65414343d4bfa7d908926b1a092416cb16551593ed58eb4e28333a6e0417fdad7426ea2b648cffe9e8ef9531f76b7ff9a29851cb27918b SHA512 3a23ae92cbc1f5f47a1f2dffaaef1999acc34125176f67139040f17c3b6fe4cf78ee8c506a73c8fd38ddbb59bfb22c61f2e45ebf8739be7eb7df83cc65303433
+DIST openjdk-jaxws-8.272_p10.tar.bz2 2543199 BLAKE2B 3deae4cef17a5f3d513c1a748a72b50bacb3a0d9b6fb33e5ded121f4d209cc2eb2d59d7b7c182015811426e49eb3e2b463279fa201992c51a5c4a94a184931c9 SHA512 51c0ee76a7e0587ac9c2533d62717f24224ec8bc643df6af2e2fac89cd79cc4f228c7c57427e43f354a594568d16bb5bbf3295af9ce52717339c35b56d6c375a
+DIST openjdk-jdk-8.265_p01.tar.bz2 48017864 BLAKE2B b30a573a79a06abfe98e5963521f762e3517bda2bf6849af758285b7ea61cc57d89290ec47538b1082eea99646d3dd6295b98ad65edd62d1b1fd2480c0928a74 SHA512 44ad75bf3b3c6fd6b782ee5383edfa60fb49ac2e40493b18487bcb8a4dac926ffcf5b663adbb8d3267021bd47d5b60652771a88257fbaff77aa2e1f627252418
+DIST openjdk-jdk-8.272_p10.tar.bz2 48273590 BLAKE2B 80717a644df7d9741e5786708c816483f4fea1cfeb02438df17fb4183c0702fe6e3fcbeaefcee84a4f847d5cbafb0a9e80af63b56cf0c6381e0fbeb535d2f147 SHA512 85d20763f6cda66f2eac3b2a1e672e6b828c437386575d16a1c70b27a56c718fc0f44c712e6261eb89f6dd273fd2c21a2c4baa3f562cafa2911a5e2467d7ba13
+DIST openjdk-langtools-8.265_p01.tar.bz2 2399426 BLAKE2B 550a3dcee38b41feaf8c5b6b88f700c52f870ed0c3f25fa23f34bb3f40c333965e911ac126f4b038057472acea2b684917692a6881e46e4aa68b05cd7e4346da SHA512 24d0978a8e6254a96a5399420831d320ea2b2f5b7055ceba030802b85fcb9630031499504ca72305361fa3a386c2ca0a8c38082ee2b15b8569fdf7e815730be6
+DIST openjdk-langtools-8.272_p10.tar.bz2 2399755 BLAKE2B 34ffa30993fa9f42ed2fa96ae658c3c43ecbc54750c3b854cc90efdbd3c4d5abdda012d55c4e81d4ab805d9184b5ea7429fba5927bf3192fcce2a17d9ef11744 SHA512 54698e8a74119f39971024ee165707fa9e27cd0008b59801f05a194362d723ba67269b1f34c181e2a0b1ce9cd36f52cf3ad3ad980c4670f7cfa476a0fa78fec8
+DIST openjdk-nashorn-8.265_p01.tar.bz2 2852124 BLAKE2B 380202d487e62e08784b7fd5cb720c22a2b93d802898b90bf2686bac803fe2bc41d8d4b3d56b45bfb45686a2976d208359818b17b96ccce73fd55b389f4d04af SHA512 12522a06f16f1c63d6b6df525011d01ff91ba05f06ee7ade239faa31527ca9aaa9fa609c1ad261f0ae8d75cc195fe1af66e026815bdc0669fb6a286a49f86a5e
+DIST openjdk-nashorn-8.272_p10.tar.bz2 2850055 BLAKE2B 2348c0f45916101d9fcb4aaa283d2c03be5b28decf12248ec930b9d726e346d0884dd64a22627e2f2fd8260c8755d0bc46a1cf6fecf691a30a7f4b54f6a293a9 SHA512 754fcdca5e0ce523d73cbdfbdcaaa13677ed8c2b72c5ae04ff1cc77fd73469f3366e51add68b13bac3c43800fecfcbb93bf4fcf7469258c4adc57e414b105ef5
diff --git a/dev-java/openjdk/files/bootcycle_jobs.patch b/dev-java/openjdk/files/bootcycle_jobs.patch
new file mode 100644
index 0000000..9dfae98
--- /dev/null
+++ b/dev-java/openjdk/files/bootcycle_jobs.patch
@@ -0,0 +1,26 @@
+diff -r 21b063d75b3e make/Init.gmk
+--- jdk9/make/Init.gmk Thu Mar 16 16:34:33 2017 +0000
++++ jdk9/make/Init.gmk Tue Apr 04 13:49:37 2017 +0100
+@@ -303,7 +303,8 @@
+ $(call PrepareSmartJavac)
+ ( cd $(TOPDIR) && \
+ $(NICE) $(MAKE) $(MAKE_ARGS) $(OUTPUT_SYNC_FLAG) \
+- -j $(JOBS) -f make/Main.gmk $(USER_MAKE_VARS) \
++ $(if $(DISABLE_JOBS),, -j $(JOBS)) \
++ -f make/Main.gmk $(USER_MAKE_VARS) \
+ $(PARALLEL_TARGETS) $(COMPARE_BUILD_MAKE) $(BUILD_LOG_PIPE) || \
+ ( exitcode=$$? && \
+ $(PRINTF) "\nERROR: Build failed for $(TARGET_DESCRIPTION) (exit code $$exitcode) \n" \
+diff -r 21b063d75b3e make/Main.gmk
+--- jdk9/make/Main.gmk Thu Mar 16 16:34:33 2017 +0000
++++ jdk9/make/Main.gmk Tue Apr 04 13:49:37 2017 +0100
+@@ -320,7 +320,7 @@
+ ifneq ($(COMPILE_TYPE), cross)
+ $(call LogWarn, Boot cycle build step 2: Building a new JDK image using previously built image)
+ +$(MAKE) $(MAKE_ARGS) -f $(SRC_ROOT)/make/Init.gmk PARALLEL_TARGETS=$(BOOTCYCLE_TARGET) \
+- JOBS= SPEC=$(dir $(SPEC))bootcycle-spec.gmk main
++ DISABLE_JOBS=true SPEC=$(dir $(SPEC))bootcycle-spec.gmk main
+ else
+ $(call LogWarn, Boot cycle build disabled when cross compiling)
+ endif
+
diff --git a/dev-java/openjdk/files/musl/11/aarch64.patch b/dev-java/openjdk/files/musl/11/aarch64.patch
new file mode 100644
index 0000000..c0fa972
--- /dev/null
+++ b/dev-java/openjdk/files/musl/11/aarch64.patch
@@ -0,0 +1,15 @@
+Author: Simon Frankenberger <simon-alpine@fraho.eu>
+Upstream: no
+Reason: This file is not present when building on aarch64 alpine.
+ Furthermore, the build runs just fine without it.
+
+--- old/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp
++++ new/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp
+@@ -74,7 +74,6 @@
+ # include <pwd.h>
+ # include <poll.h>
+ # include <ucontext.h>
+-# include <fpu_control.h>
+
+ #define REG_FP 29
+ #define REG_LR 30
diff --git a/dev-java/openjdk/files/musl/11/build.patch b/dev-java/openjdk/files/musl/11/build.patch
new file mode 100644
index 0000000..58bd60d
--- /dev/null
+++ b/dev-java/openjdk/files/musl/11/build.patch
@@ -0,0 +1,545 @@
+Author: The portola team at https://openjdk.java.net/projects/portola/
+ With modifications by Simon Frankenberger <simon-alpine@fraho.eu>
+Upstream: somewhat
+Reason: This giant patch makes it possible to compile openjdk with musl libc.
+ The base was taken from a diff with the portola project and adjusted
+ for latest musl libc.
+
+--- old/make/ReleaseFile.gmk
++++ new/make/ReleaseFile.gmk
+@@ -53,6 +53,7 @@
+ $(call info-file-item, "JAVA_VERSION_DATE", "$(VERSION_DATE)")
+ $(call info-file-item, "OS_NAME", "$(RELEASE_FILE_OS_NAME)")
+ $(call info-file-item, "OS_ARCH", "$(RELEASE_FILE_OS_ARCH)")
++ $(call info-file-item, "LIBC", "musl")
+ endef
+
+ # Param 1 - The file containing the MODULES list
+--- old/make/autoconf/build-aux/config.guess
++++ new/make/autoconf/build-aux/config.guess
+@@ -30,6 +30,17 @@
+ DIR=`dirname $0`
+ OUT=`. $DIR/autoconf-config.guess`
+
++# config.guess doesn't identify systems running the musl C library, and will
++# instead return a string with a -gnu suffix. This block detects musl and
++# modifies the string to have a -musl suffix instead.
++echo $OUT | grep -- -linux- > /dev/null 2> /dev/null
++if test $? = 0; then
++ ldd_version=`ldd --version 2>&1 | head -1 | cut -f1 -d' '`
++ if [ x"${ldd_version}" = x"musl" ]; then
++ OUT=`echo $OUT | sed 's/-gnu/-musl/'`
++ fi
++fi
++
+ # Test and fix solaris on x86_64
+ echo $OUT | grep i386-pc-solaris > /dev/null 2> /dev/null
+ if test $? = 0; then
+--- old/make/hotspot/lib/CompileJvm.gmk
++++ new/make/hotspot/lib/CompileJvm.gmk
+@@ -79,6 +79,7 @@
+ -DHOTSPOT_BUILD_USER='"$(USERNAME)"' \
+ -DHOTSPOT_VM_DISTRO='"$(HOTSPOT_VM_DISTRO)"' \
+ -DCPU='"$(OPENJDK_TARGET_CPU_VM_VERSION)"' \
++ -DLIBC='"musl"' \
+ #
+
+ ################################################################################
+--- old/make/lib/CoreLibraries.gmk
++++ new/make/lib/CoreLibraries.gmk
+@@ -219,6 +219,7 @@
+ endif
+
+ LIBJLI_CFLAGS += $(LIBZ_CFLAGS)
++LIBJLI_CFLAGS += -DLIBC=\"musl\"
+
+ ifneq ($(USE_EXTERNAL_LIBZ), true)
+ LIBJLI_EXTRA_FILES += \
+--- old/src/hotspot/os/linux/os_linux.cpp
++++ new/src/hotspot/os/linux/os_linux.cpp
+@@ -101,7 +101,6 @@
+ # include <string.h>
+ # include <syscall.h>
+ # include <sys/sysinfo.h>
+-# include <gnu/libc-version.h>
+ # include <sys/ipc.h>
+ # include <sys/shm.h>
+ # include <link.h>
+@@ -594,6 +593,11 @@
+ // detecting pthread library
+
+ void os::Linux::libpthread_init() {
++#if !defined(__GLIBC__) && !defined(__UCLIBC__)
++ // Hard code Alpine Linux supported musl compatible settings
++ os::Linux::set_glibc_version("glibc 2.9");
++ os::Linux::set_libpthread_version("NPTL");
++#else
+ // Save glibc and pthread version strings.
+ #if !defined(_CS_GNU_LIBC_VERSION) || \
+ !defined(_CS_GNU_LIBPTHREAD_VERSION)
+@@ -611,6 +615,7 @@
+ str = (char *)malloc(n, mtInternal);
+ confstr(_CS_GNU_LIBPTHREAD_VERSION, str, n);
+ os::Linux::set_libpthread_version(str);
++#endif
+ }
+
+ /////////////////////////////////////////////////////////////////////////////
+@@ -3053,20 +3058,36 @@
+ extern "C" JNIEXPORT void numa_warn(int number, char *where, ...) { }
+ extern "C" JNIEXPORT void numa_error(char *where) { }
+
++static void* dlvsym_if_available(void* handle, const char* name, const char* version) {
++ typedef void* (*dlvsym_func_type)(void* handle, const char* name, const char* version);
++ static dlvsym_func_type dlvsym_func;
++ static bool initialized = false;
++
++ if (!initialized) {
++ dlvsym_func = (dlvsym_func_type)dlsym(RTLD_NEXT, "dlvsym");
++ initialized = true;
++ }
++
++ if (dlvsym_func != NULL) {
++ void *f = dlvsym_func(handle, name, version);
++ if (f != NULL) {
++ return f;
++ }
++ }
++
++ return dlsym(handle, name);
++}
++
+ // Handle request to load libnuma symbol version 1.1 (API v1). If it fails
+ // load symbol from base version instead.
+ void* os::Linux::libnuma_dlsym(void* handle, const char *name) {
+- void *f = dlvsym(handle, name, "libnuma_1.1");
+- if (f == NULL) {
+- f = dlsym(handle, name);
+- }
+- return f;
++ return dlvsym_if_available(handle, name, "libnuma_1.1");
+ }
+
+ // Handle request to load libnuma symbol version 1.2 (API v2) only.
+ // Return NULL if the symbol is not defined in this particular version.
+ void* os::Linux::libnuma_v2_dlsym(void* handle, const char* name) {
+- return dlvsym(handle, name, "libnuma_1.2");
++ return dlvsym_if_available(handle, name, "libnuma_1.2");
+ }
+
+ bool os::Linux::libnuma_init() {
+--- old/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
++++ new/src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp
+@@ -75,9 +75,6 @@
+ # include <pwd.h>
+ # include <poll.h>
+ # include <ucontext.h>
+-#ifndef AMD64
+-# include <fpu_control.h>
+-#endif
+
+ #ifdef AMD64
+ #define REG_SP REG_RSP
+--- old/src/hotspot/share/gc/shared/genCollectedHeap.cpp
++++ new/src/hotspot/share/gc/shared/genCollectedHeap.cpp
+@@ -1144,7 +1144,7 @@
+ static ScratchBlock *removeSmallestScratch(ScratchBlock **prev_ptr) {
+ bool first = true;
+ size_t min_size = 0; // "first" makes this conceptually infinite.
+- ScratchBlock **smallest_ptr, *smallest;
++ ScratchBlock **smallest_ptr = NULL, *smallest;
+ ScratchBlock *cur = *prev_ptr;
+ while (cur) {
+ assert(*prev_ptr == cur, "just checking");
+--- old/src/hotspot/share/runtime/vm_version.cpp
++++ new/src/hotspot/share/runtime/vm_version.cpp
+@@ -284,7 +284,7 @@
+ #endif
+
+ #define INTERNAL_VERSION_SUFFIX VM_RELEASE ")" \
+- " for " OS "-" CPU FLOAT_ARCH_STR \
++ " for " OS "-" CPU FLOAT_ARCH_STR LIBC \
+ " JRE (" VERSION_STRING "), built on " __DATE__ " " __TIME__ \
+ " by " XSTR(HOTSPOT_BUILD_USER) " with " HOTSPOT_BUILD_COMPILER
+
+--- old/src/hotspot/share/utilities/globalDefinitions_gcc.hpp
++++ new/src/hotspot/share/utilities/globalDefinitions_gcc.hpp
+@@ -204,7 +204,7 @@
+ #elif defined(__APPLE__)
+ inline int g_isnan(double f) { return isnan(f); }
+ #elif defined(LINUX) || defined(_ALLBSD_SOURCE)
+-inline int g_isnan(float f) { return isnanf(f); }
++inline int g_isnan(float f) { return isnan(f); }
+ inline int g_isnan(double f) { return isnan(f); }
+ #else
+ #error "missing platform-specific definition here"
+--- old/src/java.base/linux/native/libnet/linux_close.c
++++ new/src/java.base/linux/native/libnet/linux_close.c
+@@ -60,7 +60,7 @@
+ /*
+ * Signal to unblock thread
+ */
+-static int sigWakeup = (__SIGRTMAX - 2);
++static int sigWakeup;
+
+ /*
+ * fdTable holds one entry per file descriptor, up to a certain
+@@ -149,6 +149,7 @@
+ /*
+ * Setup the signal handler
+ */
++ sigWakeup = SIGRTMAX - 2;
+ sa.sa_handler = sig_wakeup;
+ sa.sa_flags = 0;
+ sigemptyset(&sa.sa_mask);
+--- old/src/java.base/unix/native/libjava/childproc.c
++++ new/src/java.base/unix/native/libjava/childproc.c
+@@ -237,7 +237,13 @@
+ {
+ if (envp == NULL || (char **) envp == environ) {
+ execvp(file, (char **) argv);
+- return;
++ // ENOEXEC indicates that the file header was not recognized. The musl C
++ // library does not implement the fallback to /bin/sh for that case, so fall
++ // through to the code below which implements that fallback using
++ // execve_with_shell_fallback.
++ if (errno != ENOEXEC) {
++ return;
++ }
+ }
+
+ if (*file == '\0') {
+--- old/src/java.base/unix/native/libjava/jdk_util_md.h
++++ new/src/java.base/unix/native/libjava/jdk_util_md.h
+@@ -37,7 +37,7 @@
+ #define ISNAND(d) isnan(d)
+ #elif defined(__linux__) || defined(_ALLBSD_SOURCE)
+ #include <math.h>
+-#define ISNANF(f) isnanf(f)
++#define ISNANF(f) isnan(f)
+ #define ISNAND(d) isnan(d)
+ #elif defined(_AIX)
+ #include <math.h>
+--- old/src/java.base/unix/native/libjli/java_md_solinux.c
++++ new/src/java.base/unix/native/libjli/java_md_solinux.c
+@@ -236,6 +236,39 @@
+ char *dmllp = NULL;
+ char *p; /* a utility pointer */
+
++#ifdef __linux
++#ifndef LIBC
++#error "LIBC not set"
++#endif
++
++ if (strcmp(LIBC, "musl") == 0) {
++ /*
++ * The musl library loader requires LD_LIBRARY_PATH to be set in
++ * order to correctly resolve the dependency libjava.so has on libjvm.so.
++ *
++ * Specifically, it differs from glibc in the sense that even if
++ * libjvm.so has already been loaded it will not be considered a
++ * candidate for resolving the dependency unless the *full* path
++ * of the already loaded library matches the dependency being loaded.
++ *
++ * libjvm.so is being loaded by the launcher using a long path to
++ * dlopen, not just the basename of the library. Typically this
++ * is something like "../lib/server/libjvm.so". However, if/when
++ * libjvm.so later tries to dlopen libjava.so (which it does in
++ * order to get access to a few functions implemented in
++ * libjava.so) the musl loader will, as part of loading
++ * dependent libraries, try to load libjvm.so using only its
++ * basename "libjvm.so". Since this does not match the longer
++ * path path it was first loaded with, the already loaded
++ * library is not considered a candidate, and the loader will
++ * instead look for libjvm.so elsewhere. If it's not in
++ * LD_LIBRARY_PATH the dependency load will fail, and libjava.so
++ * will therefore fail as well.
++ */
++ return JNI_TRUE;
++ }
++#endif
++
+ #ifdef AIX
+ /* We always have to set the LIBPATH on AIX because ld doesn't support $ORIGIN. */
+ return JNI_TRUE;
+--- old/src/java.base/unix/native/libnio/ch/NativeThread.c
++++ new/src/java.base/unix/native/libnio/ch/NativeThread.c
+@@ -36,7 +36,7 @@
+ #ifdef __linux__
+ #include <pthread.h>
+ /* Also defined in net/linux_close.c */
+- #define INTERRUPT_SIGNAL (__SIGRTMAX - 2)
++ #define INTERRUPT_SIGNAL (SIGRTMAX - 2)
+ #elif _AIX
+ #include <pthread.h>
+ /* Also defined in net/aix_close.c */
+--- old/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c
++++ new/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c
+@@ -27,9 +27,6 @@
+ #include <X11/Xutil.h>
+ #include <X11/Xos.h>
+ #include <X11/Xatom.h>
+-#ifdef __linux__
+-#include <execinfo.h>
+-#endif
+
+ #include <jvm.h>
+ #include <jni.h>
+@@ -790,26 +787,6 @@
+ }
+ return ret;
+ }
+-
+-#ifdef __linux__
+-void print_stack(void)
+-{
+- void *array[10];
+- size_t size;
+- char **strings;
+- size_t i;
+-
+- size = backtrace (array, 10);
+- strings = backtrace_symbols (array, size);
+-
+- fprintf (stderr, "Obtained %zd stack frames.\n", size);
+-
+- for (i = 0; i < size; i++)
+- fprintf (stderr, "%s\n", strings[i]);
+-
+- free (strings);
+-}
+-#endif
+
+ Window get_xawt_root_shell(JNIEnv *env) {
+ static jclass classXRootWindow = NULL;
+--- old/src/jdk.jdwp.agent/share/native/libjdwp/util.h
++++ new/src/jdk.jdwp.agent/share/native/libjdwp/util.h
+@@ -35,15 +35,15 @@
+ #ifdef DEBUG
+ /* Just to make sure these interfaces are not used here. */
+ #undef free
+- #define free(p) Do not use this interface.
++ #define free do_not_use_this_interface_free
+ #undef malloc
+- #define malloc(p) Do not use this interface.
++ #define malloc do_not_use_this_interface_malloc
+ #undef calloc
+- #define calloc(p) Do not use this interface.
++ #define calloc do_not_use_this_interface_calloc
+ #undef realloc
+- #define realloc(p) Do not use this interface.
++ #define realloc do_not_use_this_interface_realloc
+ #undef strdup
+- #define strdup(p) Do not use this interface.
++ #define strdup do_not_use_this_interface_strdup
+ #endif
+
+ #include "log_messages.h"
+--- old/test/hotspot/jtreg/runtime/StackGuardPages/exeinvoke.c
++++ new/test/hotspot/jtreg/runtime/StackGuardPages/exeinvoke.c
+@@ -33,6 +33,7 @@
+
+ #include <assert.h>
+ #include <jni.h>
++#include <jvm.h>
+ #include <alloca.h>
+ #include <signal.h>
+ #include <string.h>
+@@ -91,6 +92,20 @@
+ }
+ }
+
++int get_java_stacksize () {
++ size_t stacksize;
++ pthread_attr_t attr;
++ JDK1_1InitArgs jdk_args;
++
++ jdk_args.version = JNI_VERSION_1_1;
++ JNI_GetDefaultJavaVMInitArgs(&jdk_args);
++ if (jdk_args.javaStackSize <= 0) {
++ fprintf(stderr, "Test ERROR. Can't get a valid value for the default stacksize.\n");
++ exit(7);
++ }
++ return jdk_args.javaStackSize;
++}
++
+ void *run_java_overflow (void *p) {
+ JNIEnv *env;
+ jclass class_id;
+@@ -258,13 +273,19 @@
+ exit(7);
+ }
+
++ int stack_size = get_java_stacksize();
+ pthread_t thr;
++ pthread_attr_t thread_attr;
+
++ pthread_attr_init(&thread_attr);
++ pthread_attr_setstacksize(&thread_attr, stack_size);
++
+ if (argc > 1 && strcmp(argv[1], "test_java_overflow") == 0) {
+ printf("\nTesting JAVA_OVERFLOW\n");
+
+ printf("Testing stack guard page behaviour for other thread\n");
+- pthread_create (&thr, NULL, run_java_overflow, NULL);
++
++ pthread_create (&thr, &thread_attr, run_java_overflow, NULL);
+ pthread_join (thr, NULL);
+
+ printf("Testing stack guard page behaviour for initial thread\n");
+@@ -277,7 +298,7 @@
+ printf("\nTesting NATIVE_OVERFLOW\n");
+
+ printf("Testing stack guard page behaviour for other thread\n");
+- pthread_create (&thr, NULL, run_native_overflow, NULL);
++ pthread_create (&thr, &thread_attr, run_native_overflow, NULL);
+ pthread_join (thr, NULL);
+
+ printf("Testing stack guard page behaviour for initial thread\n");
+--- old/test/jdk/java/lang/ProcessBuilder/Basic.java
++++ new/test/jdk/java/lang/ProcessBuilder/Basic.java
+@@ -396,8 +396,8 @@
+ if (failed != 0) throw new Error("null PATH");
+ } else if (action.equals("PATH search algorithm")) {
+ equal(System.getenv("PATH"), "dir1:dir2:");
+- check(new File("/bin/true").exists());
+- check(new File("/bin/false").exists());
++ check(new File(TrueExe.path()).exists());
++ check(new File(FalseExe.path()).exists());
+ String[] cmd = {"prog"};
+ ProcessBuilder pb1 = new ProcessBuilder(cmd);
+ ProcessBuilder pb2 = new ProcessBuilder(cmd);
+@@ -438,13 +438,13 @@
+ checkPermissionDenied(pb);
+
+ // continue searching if EACCES
+- copy("/bin/true", "dir2/prog");
++ copy(TrueExe.path(), "dir2/prog");
+ equal(run(pb).exitValue(), True.exitValue());
+ new File("dir1/prog").delete();
+ new File("dir2/prog").delete();
+
+ new File("dir2/prog").mkdirs();
+- copy("/bin/true", "dir1/prog");
++ copy(TrueExe.path(), "dir1/prog");
+ equal(run(pb).exitValue(), True.exitValue());
+
+ // Check empty PATH component means current directory.
+@@ -460,10 +460,10 @@
+ pb.command(command);
+ File prog = new File("./prog");
+ // "Normal" binaries
+- copy("/bin/true", "./prog");
++ copy(TrueExe.path(), "./prog");
+ equal(run(pb).exitValue(),
+ True.exitValue());
+- copy("/bin/false", "./prog");
++ copy(FalseExe.path(), "./prog");
+ equal(run(pb).exitValue(),
+ False.exitValue());
+ prog.delete();
+@@ -518,12 +518,12 @@
+ new File("dir2/prog").delete();
+ new File("prog").delete();
+ new File("dir3").mkdirs();
+- copy("/bin/true", "dir1/prog");
+- copy("/bin/false", "dir3/prog");
++ copy(TrueExe.path(), "dir1/prog");
++ copy(FalseExe.path(), "dir3/prog");
+ pb.environment().put("PATH","dir3");
+ equal(run(pb).exitValue(), True.exitValue());
+- copy("/bin/true", "dir3/prog");
+- copy("/bin/false", "dir1/prog");
++ copy(TrueExe.path(), "dir3/prog");
++ copy(FalseExe.path(), "dir1/prog");
+ equal(run(pb).exitValue(), False.exitValue());
+
+ } finally {
+@@ -620,6 +620,13 @@
+ new File("/bin/false").exists());
+ }
+
++ static class BusyBox {
++ public static boolean is() { return is; }
++ private static final boolean is =
++ (! Windows.is() &&
++ new File("/bin/busybox").exists());
++ }
++
+ static class UnicodeOS {
+ public static boolean is() { return is; }
+ private static final String osName = System.getProperty("os.name");
+@@ -658,6 +665,45 @@
+ }
+ }
+
++ // On alpine linux, /bin/true and /bin/false are just links to /bin/busybox.
++ // Some tests copy /bin/true and /bin/false to files with a different filename.
++ // However, copying the busbox executable into a file with a different name
++ // won't result in the expected return codes. As workaround, we create
++ // executable files that can be copied and produce the exepected return
++ // values. We use this workaround, if we find the busybox executable.
++
++ private static class TrueExe {
++ public static String path() { return path; }
++ private static final String path = path0();
++ private static String path0(){
++ if (!BusyBox.is()) {
++ return "/bin/true";
++ }
++ else {
++ File trueExe = new File("true");
++ setFileContents(trueExe, "#!/bin/true\n");
++ trueExe.setExecutable(true);
++ return trueExe.getAbsolutePath();
++ }
++ }
++ }
++
++ private static class FalseExe {
++ public static String path() { return path; }
++ private static final String path = path0();
++ private static String path0(){
++ if (!BusyBox.is()) {
++ return "/bin/false";
++ }
++ else {
++ File falseExe = new File("false");
++ setFileContents(falseExe, "#!/bin/false\n");
++ falseExe.setExecutable(true);
++ return falseExe.getAbsolutePath();
++ }
++ }
++ }
++
+ static class EnglishUnix {
+ private static final Boolean is =
+ (! Windows.is() && isEnglish("LANG") && isEnglish("LC_ALL"));
+@@ -1961,7 +2007,7 @@
+ //----------------------------------------------------------------
+ try {
+ new File("suBdiR").mkdirs();
+- copy("/bin/true", "suBdiR/unliKely");
++ copy(TrueExe.path(), "suBdiR/unliKely");
+ final ProcessBuilder pb =
+ new ProcessBuilder(new String[]{"unliKely"});
+ pb.environment().put("PATH", "suBdiR");
+--- old/test/jdk/java/lang/ProcessHandle/InfoTest.java
++++ new/test/jdk/java/lang/ProcessHandle/InfoTest.java
+@@ -298,7 +298,14 @@
+ }
+ if (info.command().isPresent()) {
+ String command = info.command().get();
+- String expected = Platform.isWindows() ? "sleep.exe" : "sleep";
++ String expected = "sleep";
++ if (Platform.isWindows()) {
++ expected = "sleep.exe";
++ } else if (new File("/bin/busybox").exists()) {
++ // With busybox sleep is just a sym link to busybox.
++ // The busbox executable is seen as ProcessHandle.Info command.
++ expected = "busybox";
++ }
+ Assert.assertTrue(command.endsWith(expected), "Command: expected: \'" +
+ expected + "\', actual: " + command);
+
+
diff --git a/dev-java/openjdk/files/musl/11/fix-bootjdk-check.patch b/dev-java/openjdk/files/musl/11/fix-bootjdk-check.patch
new file mode 100644
index 0000000..3549f3a
--- /dev/null
+++ b/dev-java/openjdk/files/musl/11/fix-bootjdk-check.patch
@@ -0,0 +1,18 @@
+Author: Simon Frankenberger <simon-alpine@fraho.eu>
+Upstream: no
+Reason: The alpine builders print out a warning about sched_getaffinity() not working.
+ This causes the version check for the boot jdk to fail.
+ Patch the command to determine the version number to ignore any errors and warnings.
+
+--- old/make/autoconf/boot-jdk.m4
++++ new/make/autoconf/boot-jdk.m4
+@@ -74,7 +74,7 @@
+ BOOT_JDK_FOUND=no
+ else
+ # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+- BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $HEAD -n 1`
++ BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $GREP version | $HEAD -n 1`
+
+ # Extra M4 quote needed to protect [] in grep expression.
+ [FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION \
+
diff --git a/dev-java/openjdk/files/musl/11/ppc64le.patch b/dev-java/openjdk/files/musl/11/ppc64le.patch
new file mode 100644
index 0000000..c26755b
--- /dev/null
+++ b/dev-java/openjdk/files/musl/11/ppc64le.patch
@@ -0,0 +1,226 @@
+Author: Simon Frankenberger <simon-alpine@fraho.eu>
+Upstream: no
+Reason: Musl libc offers a different structure for context_t*,
+ so we need a patch to access the structure fields correctly.
+
+--- old/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp
++++ new/src/hotspot/cpu/ppc/macroAssembler_ppc.cpp
+@@ -1290,7 +1290,11 @@
+ // the safepoing polling page.
+ ucontext_t* uc = (ucontext_t*) ucontext;
+ // Set polling address.
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address addr = (address)uc->uc_mcontext.regs->gpr[ra] + (ssize_t)ds;
++#else // Musl
++ address addr = (address)uc->uc_mcontext.gp_regs[ra] + (ssize_t) ds;
++#endif
+ if (polling_address_ptr != NULL) {
+ *polling_address_ptr = addr;
+ }
+@@ -1311,15 +1315,24 @@
+ int rb = inv_rb_field(instruction);
+
+ // look up content of ra and rb in ucontext
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address ra_val=(address)uc->uc_mcontext.regs->gpr[ra];
+ long rb_val=(long)uc->uc_mcontext.regs->gpr[rb];
++#else // Musl
++ address ra_val=(address)uc->uc_mcontext.gp_regs[ra];
++ long rb_val=(long)uc->uc_mcontext.gp_regs[rb];
++#endif
+ return os::is_memory_serialize_page(thread, ra_val+rb_val);
+ } else if (is_stw(instruction) || is_stwu(instruction)) {
+ int ra = inv_ra_field(instruction);
+ int d1 = inv_d1_field(instruction);
+
+ // look up content of ra in ucontext
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address ra_val=(address)uc->uc_mcontext.regs->gpr[ra];
++#else // Musl
++ address ra_val=(address)uc->uc_mcontext.gp_regs[ra];
++#endif
+ return os::is_memory_serialize_page(thread, ra_val+d1);
+ } else {
+ return false;
+@@ -1382,11 +1395,20 @@
+ || (is_stdu(instruction) && rs == 1)) {
+ int ds = inv_ds_field(instruction);
+ // return banged address
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return ds+(address)uc->uc_mcontext.regs->gpr[ra];
++#else // Musl
++ return ds+(address)uc->uc_mcontext.gp_regs[ra];
++#endif
+ } else if (is_stdux(instruction) && rs == 1) {
+ int rb = inv_rb_field(instruction);
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ address sp = (address)uc->uc_mcontext.regs->gpr[1];
+ long rb_val = (long)uc->uc_mcontext.regs->gpr[rb];
++#else // Musl
++ address sp = (address)uc->uc_mcontext.gp_regs[1];
++ long rb_val = (long)uc->uc_mcontext.gp_regs[rb];
++#endif
+ return ra != 1 || rb_val >= 0 ? NULL // not a stack bang
+ : sp + rb_val; // banged address
+ }
+--- old/src/hotspot/cpu/ppc/vm_version_ppc.cpp
++++ new/src/hotspot/cpu/ppc/vm_version_ppc.cpp
+@@ -893,7 +893,7 @@
+ unsigned long auxv = getauxval(AT_HWCAP2);
+
+ if (auxv & PPC_FEATURE2_HTM_NOSC) {
+- if (auxv & PPC_FEATURE2_HAS_HTM) {
++ if (auxv & PPC_FEATURE2_HTM) {
+ // TM on POWER8 and POWER9 in compat mode (VM) is supported by the JVM.
+ // TM on POWER9 DD2.1 NV (baremetal) is not supported by the JVM (TM on
+ // POWER9 DD2.1 NV has a few issues that need a couple of firmware
+--- old/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp
++++ new/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp
+@@ -108,24 +108,42 @@
+ // - if uc was filled by getcontext(), it is undefined - getcontext() does not fill
+ // it because the volatile registers are not needed to make setcontext() work.
+ // Hopefully it was zero'd out beforehand.
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ guarantee(uc->uc_mcontext.regs != NULL, "only use ucontext_get_pc in sigaction context");
+ return (address)uc->uc_mcontext.regs->nip;
++#else // Musl
++ guarantee(uc->uc_mcontext.gp_regs != NULL, "only use ucontext_get_pc in sigaction context");
++ return (address)uc->uc_mcontext.gp_regs[32];
++#endif
+ }
+
+ // modify PC in ucontext.
+ // Note: Only use this for an ucontext handed down to a signal handler. See comment
+ // in ucontext_get_pc.
+ void os::Linux::ucontext_set_pc(ucontext_t * uc, address pc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ guarantee(uc->uc_mcontext.regs != NULL, "only use ucontext_set_pc in sigaction context");
+ uc->uc_mcontext.regs->nip = (unsigned long)pc;
++#else // Musl
++ guarantee(uc->uc_mcontext.gp_regs != NULL, "only use ucontext_set_pc in sigaction context");
++ uc->uc_mcontext.gp_regs[32] = (unsigned long)pc;
++#endif
+ }
+
+ static address ucontext_get_lr(const ucontext_t * uc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return (address)uc->uc_mcontext.regs->link;
++#else // Musl
++ return (address)uc->uc_mcontext.gp_regs[36];
++#endif
+ }
+
+ intptr_t* os::Linux::ucontext_get_sp(const ucontext_t * uc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return (intptr_t*)uc->uc_mcontext.regs->gpr[1/*REG_SP*/];
++#else // Musl
++ return (intptr_t*)uc->uc_mcontext.gp_regs[1/*REG_SP*/];
++#endif
+ }
+
+ intptr_t* os::Linux::ucontext_get_fp(const ucontext_t * uc) {
+@@ -133,7 +151,11 @@
+ }
+
+ static unsigned long ucontext_get_trap(const ucontext_t * uc) {
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ return uc->uc_mcontext.regs->trap;
++#else // Musl
++ return uc->uc_mcontext.gp_regs[40];
++#endif
+ }
+
+ ExtendedPC os::fetch_frame_from_context(const void* ucVoid,
+@@ -259,7 +281,13 @@
+ // 3.2.1 "Machine State Register"), however note that ISA notation for bit
+ // numbering is MSB 0, so for normal bit numbering (LSB 0) they come to be
+ // bits 33 and 34. It's not related to endianness, just a notation matter.
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ if (second_uc->uc_mcontext.regs->msr & 0x600000000) {
++#else // Musl
++ // why 33?
++ // see comment for glibc NGREG: "r0-r31, nip, msr, lr, etc."
++ if (second_uc->uc_mcontext.gp_regs[33] & 0x600000000) {
++#endif
+ if (TraceTraps) {
+ tty->print_cr("caught signal in transaction, "
+ "ignoring to jump to abort handler");
+@@ -586,6 +614,7 @@
+ const ucontext_t* uc = (const ucontext_t*)context;
+
+ st->print_cr("Registers:");
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ st->print("pc =" INTPTR_FORMAT " ", uc->uc_mcontext.regs->nip);
+ st->print("lr =" INTPTR_FORMAT " ", uc->uc_mcontext.regs->link);
+ st->print("ctr=" INTPTR_FORMAT " ", uc->uc_mcontext.regs->ctr);
+@@ -594,8 +623,18 @@
+ st->print("r%-2d=" INTPTR_FORMAT " ", i, uc->uc_mcontext.regs->gpr[i]);
+ if (i % 3 == 2) st->cr();
+ }
++#else // Musl
++ st->print("pc =" INTPTR_FORMAT " ", uc->uc_mcontext.gp_regs[32]);
++ st->print("lr =" INTPTR_FORMAT " ", uc->uc_mcontext.gp_regs[36]);
++ st->print("ctr=" INTPTR_FORMAT " ", uc->uc_mcontext.gp_regs[35]);
+ st->cr();
++ for (int i = 0; i < 32; i++) {
++ st->print("r%-2d=" INTPTR_FORMAT " ", i, uc->uc_mcontext.gp_regs[i]);
++ if (i % 3 == 2) st->cr();
++ }
++#endif
+ st->cr();
++ st->cr();
+
+ intptr_t *sp = (intptr_t *)os::Linux::ucontext_get_sp(uc);
+ st->print_cr("Top of Stack: (sp=" PTR_FORMAT ")", p2i(sp));
+@@ -618,12 +657,22 @@
+ st->print_cr("Register to memory mapping:");
+ st->cr();
+
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ st->print("pc ="); print_location(st, (intptr_t)uc->uc_mcontext.regs->nip);
+ st->print("lr ="); print_location(st, (intptr_t)uc->uc_mcontext.regs->link);
+ st->print("ctr ="); print_location(st, (intptr_t)uc->uc_mcontext.regs->ctr);
++#else // Musl
++ st->print("pc ="); print_location(st, (intptr_t)uc->uc_mcontext.gp_regs[32]);
++ st->print("lr ="); print_location(st, (intptr_t)uc->uc_mcontext.gp_regs[36]);
++ st->print("ctr ="); print_location(st, (intptr_t)uc->uc_mcontext.gp_regs[35]);
++#endif
+ for (int i = 0; i < 32; i++) {
+ st->print("r%-2d=", i);
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ print_location(st, uc->uc_mcontext.regs->gpr[i]);
++#else // Musl
++ print_location(st, uc->uc_mcontext.gp_regs[i]);
++#endif
+ }
+ st->cr();
+ }
+--- old/src/hotspot/os_cpu/linux_ppc/thread_linux_ppc.cpp
++++ new/src/hotspot/os_cpu/linux_ppc/thread_linux_ppc.cpp
+@@ -56,8 +56,13 @@
+ // if we were running Java code when SIGPROF came in.
+ if (isInJava) {
+ ucontext_t* uc = (ucontext_t*) ucontext;
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ frame ret_frame((intptr_t*)uc->uc_mcontext.regs->gpr[1/*REG_SP*/],
+ (address)uc->uc_mcontext.regs->nip);
++#else // Musl
++ frame ret_frame((intptr_t*)uc->uc_mcontext.gp_regs[1/*REG_SP*/],
++ (address)uc->uc_mcontext.gp_regs[32]);
++#endif
+
+ if (ret_frame.pc() == NULL) {
+ // ucontext wasn't useful
+@@ -70,7 +75,11 @@
+ if (m == NULL || !m->is_valid_method()) return false;
+ if (!Metaspace::contains((const void*)m->constMethod())) return false;
+
++#if defined(__GLIBC__) || defined(__UCLIBC__)
+ uint64_t reg_bcp = uc->uc_mcontext.regs->gpr[14/*R14_bcp*/];
++#else // Musl
++ uint64_t reg_bcp = uc->uc_mcontext.gp_regs[14/*R14_bcp*/];
++#endif
+ uint64_t istate_bcp = istate->bcp;
+ uint64_t code_start = (uint64_t)(m->code_base());
+ uint64_t code_end = (uint64_t)(m->code_base() + m->code_size());
+
diff --git a/dev-java/openjdk/files/musl/8/0001_musl_hotspot.patch b/dev-java/openjdk/files/musl/8/0001_musl_hotspot.patch
new file mode 100644
index 0000000..65bc133
--- /dev/null
+++ b/dev-java/openjdk/files/musl/8/0001_musl_hotspot.patch
@@ -0,0 +1,116 @@
+diff -Naur openjdk-8.265_p01/hotspot/src/os/linux/vm/jvm_linux.cpp openjdk-8.265_p01-copy/hotspot/src/os/linux/vm/jvm_linux.cpp
+--- openjdk-8.265_p01/hotspot/src/os/linux/vm/jvm_linux.cpp 2020-10-11 15:53:08.468010359 -0400
++++ openjdk-8.265_p01-copy/hotspot/src/os/linux/vm/jvm_linux.cpp 2020-10-11 20:42:02.152018764 -0400
+@@ -154,7 +154,9 @@
+ #ifdef SIGSTKFLT
+ "STKFLT", SIGSTKFLT, /* Stack fault. */
+ #endif
++#ifdef SIGCLD
+ "CLD", SIGCLD, /* Same as SIGCHLD (System V). */
++#endif
+ "CHLD", SIGCHLD, /* Child status has changed (POSIX). */
+ "CONT", SIGCONT, /* Continue (POSIX). */
+ "STOP", SIGSTOP, /* Stop, unblockable (POSIX). */
+diff -Naur openjdk-8.265_p01/hotspot/src/os/linux/vm/os_linux.cpp openjdk-8.265_p01-copy/hotspot/src/os/linux/vm/os_linux.cpp
+--- openjdk-8.265_p01/hotspot/src/os/linux/vm/os_linux.cpp 2020-10-11 15:53:08.468010359 -0400
++++ openjdk-8.265_p01-copy/hotspot/src/os/linux/vm/os_linux.cpp 2020-10-11 20:43:52.252018818 -0400
+@@ -95,7 +95,6 @@
+ # include <string.h>
+ # include <syscall.h>
+ # include <sys/sysinfo.h>
+-# include <gnu/libc-version.h>
+ # include <sys/ipc.h>
+ # include <sys/shm.h>
+ # include <link.h>
+@@ -581,6 +580,13 @@
+ // detecting pthread library
+
+ void os::Linux::libpthread_init() {
++#if 1
++ // Hard code Alpine Linux supported musl compatible settings
++ os::Linux::set_glibc_version("glibc 2.9");
++ os::Linux::set_libpthread_version("NPTL");
++ os::Linux::set_is_NPTL();
++ os::Linux::set_is_floating_stack();
++#else
+ // Save glibc and pthread version strings. Note that _CS_GNU_LIBC_VERSION
+ // and _CS_GNU_LIBPTHREAD_VERSION are supported in glibc >= 2.3.2. Use a
+ // generic name for earlier versions.
+@@ -639,6 +645,7 @@
+ if (os::Linux::is_NPTL() || os::Linux::supports_variable_stack_size()) {
+ os::Linux::set_is_floating_stack();
+ }
++#endif
+ }
+
+ /////////////////////////////////////////////////////////////////////////////
+@@ -2968,6 +2975,11 @@
+ extern "C" JNIEXPORT void numa_error(char *where) { }
+ extern "C" JNIEXPORT int fork1() { return fork(); }
+
++static void *dlvsym(void *handle, const char *name, const char *ver)
++{
++ return dlsym(handle, name);
++}
++
+ // Handle request to load libnuma symbol version 1.1 (API v1). If it fails
+ // load symbol from base version instead.
+ void* os::Linux::libnuma_dlsym(void* handle, const char *name) {
+diff -Naur openjdk-8.265_p01/hotspot/src/os/linux/vm/os_linux.inline.hpp openjdk-8.265_p01-copy/hotspot/src/os/linux/vm/os_linux.inline.hpp
+--- openjdk-8.265_p01/hotspot/src/os/linux/vm/os_linux.inline.hpp 2020-10-11 15:53:08.468010359 -0400
++++ openjdk-8.265_p01-copy/hotspot/src/os/linux/vm/os_linux.inline.hpp 2020-10-11 20:44:18.000018830 -0400
+@@ -33,7 +33,7 @@
+
+ #include <unistd.h>
+ #include <sys/socket.h>
+-#include <sys/poll.h>
++#include <poll.h>
+ #include <netdb.h>
+
+ inline void* os::thread_local_storage_at(int index) {
+diff -Naur openjdk-8.265_p01/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp openjdk-8.265_p01-copy/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp
+--- openjdk-8.265_p01/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp 2020-10-11 15:53:08.472010359 -0400
++++ openjdk-8.265_p01-copy/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp 2020-10-11 20:47:50.888018933 -0400
+@@ -72,7 +72,6 @@
+ # include <pwd.h>
+ # include <poll.h>
+ # include <ucontext.h>
+-# include <fpu_control.h>
+
+ #ifdef AMD64
+ #define REG_SP REG_RSP
+@@ -543,6 +542,9 @@
+ ShouldNotReachHere();
+ }
+
++#define _FPU_GETCW(cw) __asm__ __volatile__ ("fnstcw %0" : "=m" (*&cw))
++#define _FPU_SETCW(cw) __asm__ __volatile__ ("fldcw %0" : : "m" (*&cw))
++
+ void os::Linux::init_thread_fpu_state(void) {
+ #ifndef AMD64
+ // set fpu to 53 bit precision
+diff -Naur openjdk-8.265_p01/hotspot/src/os_cpu/linux_x86/vm/threadLS_linux_x86.hpp openjdk-8.265_p01-copy/hotspot/src/os_cpu/linux_x86/vm/threadLS_linux_x86.hpp
+--- openjdk-8.265_p01/hotspot/src/os_cpu/linux_x86/vm/threadLS_linux_x86.hpp 2020-10-11 15:53:08.472010359 -0400
++++ openjdk-8.265_p01-copy/hotspot/src/os_cpu/linux_x86/vm/threadLS_linux_x86.hpp 2020-10-11 20:48:23.452018949 -0400
+@@ -32,7 +32,9 @@
+ // map stack pointer to thread pointer - see notes in threadLS_linux_x86.cpp
+ #define SP_BITLENGTH 32
+ #define PAGE_SHIFT 12
++ #ifndef PAGE_SIZE
+ #define PAGE_SIZE (1UL << PAGE_SHIFT)
++ #endif
+ static Thread* _sp_map[1UL << (SP_BITLENGTH - PAGE_SHIFT)];
+
+ public:
+diff -Naur openjdk-8.265_p01/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp openjdk-8.265_p01-copy/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp
+--- openjdk-8.265_p01/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp 2020-10-11 15:53:08.572010359 -0400
++++ openjdk-8.265_p01-copy/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp 2020-10-11 20:49:02.568018968 -0400
+@@ -235,7 +235,7 @@
+ #elif defined(__APPLE__)
+ inline int g_isnan(double f) { return isnan(f); }
+ #elif defined(LINUX) || defined(_ALLBSD_SOURCE)
+-inline int g_isnan(float f) { return isnanf(f); }
++inline int g_isnan(float f) { return isnan(f); }
+ inline int g_isnan(double f) { return isnan(f); }
+ #else
+ #error "missing platform-specific definition here"
diff --git a/dev-java/openjdk/files/musl/8/0002_musl_hotspot_ppc.patch b/dev-java/openjdk/files/musl/8/0002_musl_hotspot_ppc.patch
new file mode 100644
index 0000000..bafdb7d
--- /dev/null
+++ b/dev-java/openjdk/files/musl/8/0002_musl_hotspot_ppc.patch
@@ -0,0 +1,24 @@
+diff -Naur openjdk-8.265_p01/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.cpp openjdk-8.265_p01-copy/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.cpp
+--- openjdk-8.265_p01/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.cpp 2020-10-11 15:53:08.452010359 -0400
++++ openjdk-8.265_p01-copy/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.cpp 2020-10-11 20:51:15.688019033 -0400
+@@ -44,6 +44,8 @@
+ #include "gc_implementation/g1/heapRegion.hpp"
+ #endif // INCLUDE_ALL_GCS
+
++#include <asm/ptrace.h>
++
+ #ifdef PRODUCT
+ #define BLOCK_COMMENT(str) // nothing
+ #else
+diff -Naur openjdk-8.265_p01/hotspot/src/os_cpu/linux_ppc/vm/thread_linux_ppc.cpp openjdk-8.265_p01-copy/hotspot/src/os_cpu/linux_ppc/vm/thread_linux_ppc.cpp
+--- openjdk-8.265_p01/hotspot/src/os_cpu/linux_ppc/vm/thread_linux_ppc.cpp 2020-10-11 15:53:08.472010359 -0400
++++ openjdk-8.265_p01-copy/hotspot/src/os_cpu/linux_ppc/vm/thread_linux_ppc.cpp 2020-10-11 20:51:42.444019045 -0400
+@@ -27,6 +27,8 @@
+ #include "runtime/frame.inline.hpp"
+ #include "runtime/thread.hpp"
+
++#include <asm/ptrace.h>
++
+ bool JavaThread::pd_get_top_frame_for_profiling(frame* fr_addr, void* ucontext, bool isInJava) {
+ assert(this->is_Java_thread(), "must be JavaThread");
+
diff --git a/dev-java/openjdk/files/musl/8/0003_musl_hotspot_aarch64.patch b/dev-java/openjdk/files/musl/8/0003_musl_hotspot_aarch64.patch
new file mode 100644
index 0000000..183a144
--- /dev/null
+++ b/dev-java/openjdk/files/musl/8/0003_musl_hotspot_aarch64.patch
@@ -0,0 +1,12 @@
+diff -Naur openjdk-8.265_p01/hotspot/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp openjdk-8.265_p01-copy/hotspot/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp
+--- openjdk-8.265_p01/hotspot/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp 2020-07-26 20:20:35.000000000 -0400
++++ openjdk-8.265_p01-copy/hotspot/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp 2020-10-11 21:49:21.268020723 -0400
+@@ -72,7 +72,7 @@
+ # include <pwd.h>
+ # include <poll.h>
+ # include <ucontext.h>
+-# include <fpu_control.h>
++# include <linux/types.h> /* provides __u64 */
+
+ #define REG_FP 29
+
diff --git a/dev-java/openjdk/files/musl/8/0004_musl_hotspot_noagent.patch b/dev-java/openjdk/files/musl/8/0004_musl_hotspot_noagent.patch
new file mode 100644
index 0000000..55da9d0
--- /dev/null
+++ b/dev-java/openjdk/files/musl/8/0004_musl_hotspot_noagent.patch
@@ -0,0 +1,85 @@
+diff -Naur openjdk-8.265_p01/common/autoconf/configure openjdk-8.265_p01-copy/common/autoconf/configure
+--- openjdk-8.265_p01/common/autoconf/configure 2020-10-11 15:53:08.360010359 -0400
++++ openjdk-8.265_p01-copy/common/autoconf/configure 2020-10-11 21:19:41.768019860 -0400
+@@ -103,7 +103,7 @@
+ }
+
+ # Check for local changes
+-check_hg_updates
++run_autogen_or_fail
+
+ if test -e $conf_custom_script_dir/generated-configure.sh; then
+ # Test if open configure is newer than custom configure, if so, custom needs to
+diff -Naur openjdk-8.265_p01/common/autoconf/jdk-options.m4 openjdk-8.265_p01-copy/common/autoconf/jdk-options.m4
+--- openjdk-8.265_p01/common/autoconf/jdk-options.m4 2020-10-11 15:53:08.364010359 -0400
++++ openjdk-8.265_p01-copy/common/autoconf/jdk-options.m4 2020-10-11 21:20:14.764019876 -0400
+@@ -151,7 +151,7 @@
+ AC_SUBST(JVM_VARIANT_ZEROSHARK)
+ AC_SUBST(JVM_VARIANT_CORE)
+
+- INCLUDE_SA=true
++ AC_CHECK_HEADER(thread_db.h,INCLUDE_SA=true,INCLUDE_SA=false)
+ if test "x$JVM_VARIANT_ZERO" = xtrue ; then
+ INCLUDE_SA=false
+ fi
+diff -Naur openjdk-8.265_p01/hotspot/make/linux/makefiles/defs.make openjdk-8.265_p01-copy/hotspot/make/linux/makefiles/defs.make
+--- openjdk-8.265_p01/hotspot/make/linux/makefiles/defs.make 2020-10-11 15:53:08.448010359 -0400
++++ openjdk-8.265_p01-copy/hotspot/make/linux/makefiles/defs.make 2020-10-11 21:21:24.716019910 -0400
+@@ -296,6 +296,9 @@
+
+ # Serviceability Binaries
+ # No SA Support for PPC, IA64, ARM or zero
++# or if thread_db.h missing (musl)
++
++ifneq ($(wildcard /usr/include/thread_db.h),)
+ ADD_SA_BINARIES/x86 = $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.$(LIBRARY_SUFFIX) \
+ $(EXPORT_LIB_DIR)/sa-jdi.jar
+ ADD_SA_BINARIES/sparc = $(EXPORT_JRE_LIB_ARCH_DIR)/libsaproc.$(LIBRARY_SUFFIX) \
+@@ -311,6 +314,11 @@
+ endif
+ endif
+ endif
++else
++ADD_SA_BINARIES/x86 =
++ADD_SA_BINARIES/sparc =
++ADD_SA_BINARIES/aarch64 =
++endif
+ ADD_SA_BINARIES/ppc =
+ ADD_SA_BINARIES/ia64 =
+ ADD_SA_BINARIES/arm =
+diff -Naur openjdk-8.265_p01/hotspot/make/linux/makefiles/sa.make openjdk-8.265_p01-copy/hotspot/make/linux/makefiles/sa.make
+--- openjdk-8.265_p01/hotspot/make/linux/makefiles/sa.make 2020-10-11 15:53:08.448010359 -0400
++++ openjdk-8.265_p01-copy/hotspot/make/linux/makefiles/sa.make 2020-10-11 21:22:39.556019946 -0400
+@@ -59,9 +59,11 @@
+
+ # if $(AGENT_DIR) does not exist, we don't build SA
+ # also, we don't build SA on Itanium or zero.
++# check for thread_db.h too (musl does not have it).
+
+-all:
+- if [ -d $(AGENT_DIR) -a "$(SRCARCH)" != "ia64" \
++all:
++ if [ -d $(AGENT_DIR) -a -f /usr/include/thread_db.h \
++ -a "$(SRCARCH)" != "ia64" \
+ -a "$(SRCARCH)" != "zero" ] ; then \
+ $(MAKE) -f sa.make $(GENERATED)/sa-jdi.jar; \
+ fi
+diff -Naur openjdk-8.265_p01/hotspot/make/linux/makefiles/saproc.make openjdk-8.265_p01-copy/hotspot/make/linux/makefiles/saproc.make
+--- openjdk-8.265_p01/hotspot/make/linux/makefiles/saproc.make 2020-10-11 15:53:08.448010359 -0400
++++ openjdk-8.265_p01-copy/hotspot/make/linux/makefiles/saproc.make 2020-10-11 21:23:13.672019963 -0400
+@@ -66,12 +66,15 @@
+
+ # if $(AGENT_DIR) does not exist, we don't build SA
+ # also, we don't build SA on Itanium or zero.
++# check for thread_db.h too (musl does not have it).
+
++ifneq ($(wildcard /usr/include/thread_db.h),)
+ ifneq ($(wildcard $(AGENT_DIR)),)
+ ifneq ($(filter-out ia64 zero,$(SRCARCH)),)
+ BUILDLIBSAPROC = $(LIBSAPROC)
+ endif
+ endif
++endif
+
+ ifneq ($(ALT_SASRCDIR),)
+ ALT_SAINCDIR=-I$(ALT_SASRCDIR) -DALT_SASRCDIR
diff --git a/dev-java/openjdk/files/musl/8/0005_musl_fix_libjvm_load.patch b/dev-java/openjdk/files/musl/8/0005_musl_fix_libjvm_load.patch
new file mode 100644
index 0000000..6d6b20b
--- /dev/null
+++ b/dev-java/openjdk/files/musl/8/0005_musl_fix_libjvm_load.patch
@@ -0,0 +1,12 @@
+diff -Naur openjdk-8.265_p01/jdk/src/solaris/bin/java_md_solinux.c openjdk-8.265_p01-copy/jdk/src/solaris/bin/java_md_solinux.c
+--- openjdk-8.265_p01/jdk/src/solaris/bin/java_md_solinux.c 2020-10-11 15:53:09.288010360 -0400
++++ openjdk-8.265_p01-copy/jdk/src/solaris/bin/java_md_solinux.c 2020-10-11 20:57:18.932019209 -0400
+@@ -291,6 +291,8 @@
+ char *dmllp = NULL;
+ char *p; /* a utility pointer */
+
++ return JNI_TRUE;
++
+ #ifdef AIX
+ /* We always have to set the LIBPATH on AIX because ld doesn't support $ORIGIN. */
+ return JNI_TRUE;
diff --git a/dev-java/openjdk/files/musl/8/0006_musl_jdk.patch b/dev-java/openjdk/files/musl/8/0006_musl_jdk.patch
new file mode 100644
index 0000000..52acbfa
--- /dev/null
+++ b/dev-java/openjdk/files/musl/8/0006_musl_jdk.patch
@@ -0,0 +1,83 @@
+diff -Naur openjdk-8.265_p01/jdk/src/share/native/com/sun/java/util/jar/pack/zip.cpp openjdk-8.265_p01-copy/jdk/src/share/native/com/sun/java/util/jar/pack/zip.cpp
+--- openjdk-8.265_p01/jdk/src/share/native/com/sun/java/util/jar/pack/zip.cpp 2020-10-11 15:53:09.224010360 -0400
++++ openjdk-8.265_p01-copy/jdk/src/share/native/com/sun/java/util/jar/pack/zip.cpp 2020-10-11 20:58:53.716019255 -0400
+@@ -46,6 +46,8 @@
+
+ #include "zip.h"
+
++#define uchar unsigned char
++
+ #ifdef NO_ZLIB
+
+ inline bool jar::deflate_bytes(bytes& head, bytes& tail) {
+diff -Naur openjdk-8.265_p01/jdk/src/share/native/com/sun/java/util/jar/pack/zip.h openjdk-8.265_p01-copy/jdk/src/share/native/com/sun/java/util/jar/pack/zip.h
+--- openjdk-8.265_p01/jdk/src/share/native/com/sun/java/util/jar/pack/zip.h 2020-10-11 15:53:09.224010360 -0400
++++ openjdk-8.265_p01-copy/jdk/src/share/native/com/sun/java/util/jar/pack/zip.h 2020-10-11 20:59:15.072019265 -0400
+@@ -23,9 +23,7 @@
+ * questions.
+ */
+
+-#define ushort unsigned short
+-#define uint unsigned int
+-#define uchar unsigned char
++#include <sys/types.h>
+
+ struct unpacker;
+
+diff -Naur openjdk-8.265_p01/jdk/src/share/native/sun/awt/medialib/mlib_types.h openjdk-8.265_p01-copy/jdk/src/share/native/sun/awt/medialib/mlib_types.h
+--- openjdk-8.265_p01/jdk/src/share/native/sun/awt/medialib/mlib_types.h 2020-10-11 15:53:09.236010360 -0400
++++ openjdk-8.265_p01-copy/jdk/src/share/native/sun/awt/medialib/mlib_types.h 2020-10-11 20:59:44.012019279 -0400
+@@ -27,6 +27,7 @@
+ #ifndef MLIB_TYPES_H
+ #define MLIB_TYPES_H
+
++#include <stddef.h> /* for NULL */
+ #include <limits.h>
+ #if defined(_MSC_VER)
+ #include <float.h> /* for FLT_MAX and DBL_MAX */
+diff -Naur openjdk-8.265_p01/jdk/src/solaris/native/java/net/Inet4AddressImpl.c openjdk-8.265_p01-copy/jdk/src/solaris/native/java/net/Inet4AddressImpl.c
+--- openjdk-8.265_p01/jdk/src/solaris/native/java/net/Inet4AddressImpl.c 2020-10-11 15:53:09.308010360 -0400
++++ openjdk-8.265_p01-copy/jdk/src/solaris/native/java/net/Inet4AddressImpl.c 2020-10-11 21:00:21.952019297 -0400
+@@ -47,7 +47,7 @@
+
+ #include "java_net_Inet4AddressImpl.h"
+
+-#if defined(__GLIBC__) || (defined(__FreeBSD__) && (__FreeBSD_version >= 601104))
++#if defined(__linux__) || (defined(__FreeBSD__) && (__FreeBSD_version >= 601104))
+ #define HAS_GLIBC_GETHOSTBY_R 1
+ #endif
+
+diff -Naur openjdk-8.265_p01/jdk/src/solaris/native/java/net/linux_close.c openjdk-8.265_p01-copy/jdk/src/solaris/native/java/net/linux_close.c
+--- openjdk-8.265_p01/jdk/src/solaris/native/java/net/linux_close.c 2020-10-11 15:53:09.308010360 -0400
++++ openjdk-8.265_p01-copy/jdk/src/solaris/native/java/net/linux_close.c 2020-10-11 21:01:22.872019327 -0400
+@@ -58,7 +58,7 @@
+ /*
+ * Signal to unblock thread
+ */
+-static int sigWakeup = (__SIGRTMAX - 2);
++static int sigWakeup;
+
+ /*
+ * fdTable holds one entry per file descriptor, up to a certain
+@@ -147,6 +147,9 @@
+ /*
+ * Setup the signal handler
+ */
++#ifndef __AIX
++ sigWakeup = SIGRTMAX - 2;
++#endif
+ sa.sa_handler = sig_wakeup;
+ sa.sa_flags = 0;
+ sigemptyset(&sa.sa_mask);
+diff -Naur openjdk-8.265_p01/jdk/src/solaris/native/sun/nio/ch/NativeThread.c openjdk-8.265_p01-copy/jdk/src/solaris/native/sun/nio/ch/NativeThread.c
+--- openjdk-8.265_p01/jdk/src/solaris/native/sun/nio/ch/NativeThread.c 2020-10-11 15:53:09.316010360 -0400
++++ openjdk-8.265_p01-copy/jdk/src/solaris/native/sun/nio/ch/NativeThread.c 2020-10-11 21:02:12.156019351 -0400
+@@ -36,7 +36,7 @@
+ #include <pthread.h>
+ #include <sys/signal.h>
+ /* Also defined in net/linux_close.c */
+- #define INTERRUPT_SIGNAL (__SIGRTMAX - 2)
++ #define INTERRUPT_SIGNAL (SIGRTMAX - 2)
+ #elif __solaris__
+ #include <thread.h>
+ #include <signal.h>
diff --git a/dev-java/openjdk/files/musl/8/0007_musl_jdk_includes.patch b/dev-java/openjdk/files/musl/8/0007_musl_jdk_includes.patch
new file mode 100644
index 0000000..ec70c70
--- /dev/null
+++ b/dev-java/openjdk/files/musl/8/0007_musl_jdk_includes.patch
@@ -0,0 +1,144 @@
+diff -Naur openjdk-8.265_p01/jdk/src/aix/native/java/net/aix_close.c openjdk-8.265_p01-copy/jdk/src/aix/native/java/net/aix_close.c
+--- openjdk-8.265_p01/jdk/src/aix/native/java/net/aix_close.c 2020-10-11 15:53:09.260010360 -0400
++++ openjdk-8.265_p01-copy/jdk/src/aix/native/java/net/aix_close.c 2020-10-11 21:03:15.540019382 -0400
+@@ -54,7 +54,7 @@
+ #include <unistd.h>
+ #include <errno.h>
+
+-#include <sys/poll.h>
++#include <poll.h>
+
+ /*
+ * Stack allocated by thread when doing blocking operation
+diff -Naur openjdk-8.265_p01/jdk/src/aix/native/sun/nio/ch/AixNativeThread.c openjdk-8.265_p01-copy/jdk/src/aix/native/sun/nio/ch/AixNativeThread.c
+--- openjdk-8.265_p01/jdk/src/aix/native/sun/nio/ch/AixNativeThread.c 2020-10-11 15:53:09.260010360 -0400
++++ openjdk-8.265_p01-copy/jdk/src/aix/native/sun/nio/ch/AixNativeThread.c 2020-10-11 21:03:39.704019393 -0400
+@@ -32,7 +32,7 @@
+ #include "sun_nio_ch_NativeThread.h"
+
+ #include <pthread.h>
+-#include <sys/signal.h>
++#include <signal.h>
+
+ /* Also defined in src/aix/native/java/net/aix_close.c */
+ #define INTERRUPT_SIGNAL (SIGRTMAX - 1)
+diff -Naur openjdk-8.265_p01/jdk/src/aix/native/sun/nio/ch/AixPollPort.c openjdk-8.265_p01-copy/jdk/src/aix/native/sun/nio/ch/AixPollPort.c
+--- openjdk-8.265_p01/jdk/src/aix/native/sun/nio/ch/AixPollPort.c 2020-10-11 15:53:09.260010360 -0400
++++ openjdk-8.265_p01-copy/jdk/src/aix/native/sun/nio/ch/AixPollPort.c 2020-10-11 21:03:55.880019401 -0400
+@@ -34,7 +34,7 @@
+ #include <unistd.h>
+ #include <sys/types.h>
+ #include <sys/socket.h>
+-#include <sys/poll.h>
++#include <poll.h>
+ #include <sys/pollset.h>
+ #include <fcntl.h>
+ #include <stddef.h>
+diff -Naur openjdk-8.265_p01/jdk/src/macosx/javavm/export/jvm_md.h openjdk-8.265_p01-copy/jdk/src/macosx/javavm/export/jvm_md.h
+--- openjdk-8.265_p01/jdk/src/macosx/javavm/export/jvm_md.h 2020-10-11 15:53:09.268010360 -0400
++++ openjdk-8.265_p01-copy/jdk/src/macosx/javavm/export/jvm_md.h 2020-10-11 21:04:16.324019411 -0400
+@@ -60,7 +60,7 @@
+ #include <sys/stat.h>
+ #include <fcntl.h>
+ #include <errno.h>
+-#include <sys/signal.h>
++#include <signal.h>
+
+ /* O Flags */
+
+diff -Naur openjdk-8.265_p01/jdk/src/solaris/javavm/export/jvm_md.h openjdk-8.265_p01-copy/jdk/src/solaris/javavm/export/jvm_md.h
+--- openjdk-8.265_p01/jdk/src/solaris/javavm/export/jvm_md.h 2020-10-11 15:53:09.304010360 -0400
++++ openjdk-8.265_p01-copy/jdk/src/solaris/javavm/export/jvm_md.h 2020-10-11 21:04:38.324019422 -0400
+@@ -65,7 +65,7 @@
+ #include <sys/stat.h>
+ #include <fcntl.h>
+ #include <errno.h>
+-#include <sys/signal.h>
++#include <signal.h>
+
+ /* O Flags */
+
+diff -Naur openjdk-8.265_p01/jdk/src/solaris/native/java/net/PlainSocketImpl.c openjdk-8.265_p01-copy/jdk/src/solaris/native/java/net/PlainSocketImpl.c
+--- openjdk-8.265_p01/jdk/src/solaris/native/java/net/PlainSocketImpl.c 2020-10-11 15:53:09.308010360 -0400
++++ openjdk-8.265_p01-copy/jdk/src/solaris/native/java/net/PlainSocketImpl.c 2020-10-11 21:05:07.272019436 -0400
+@@ -28,7 +28,7 @@
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ #if defined(__linux__) && !defined(USE_SELECT)
+-#include <sys/poll.h>
++#include <poll.h>
+ #endif
+ #include <netinet/tcp.h> /* Defines TCP_NODELAY, needed for 2.6 */
+ #include <netinet/in.h>
+diff -Naur openjdk-8.265_p01/jdk/src/solaris/native/java/net/bsd_close.c openjdk-8.265_p01-copy/jdk/src/solaris/native/java/net/bsd_close.c
+--- openjdk-8.265_p01/jdk/src/solaris/native/java/net/bsd_close.c 2020-10-11 15:53:09.308010360 -0400
++++ openjdk-8.265_p01-copy/jdk/src/solaris/native/java/net/bsd_close.c 2020-10-11 21:05:21.300019443 -0400
+@@ -38,7 +38,7 @@
+ #include <sys/uio.h>
+ #include <unistd.h>
+ #include <errno.h>
+-#include <sys/poll.h>
++#include <poll.h>
+
+ /*
+ * Stack allocated by thread when doing blocking operation
+diff -Naur openjdk-8.265_p01/jdk/src/solaris/native/java/net/net_util_md.h openjdk-8.265_p01-copy/jdk/src/solaris/native/java/net/net_util_md.h
+--- openjdk-8.265_p01/jdk/src/solaris/native/java/net/net_util_md.h 2020-10-11 15:53:09.308010360 -0400
++++ openjdk-8.265_p01-copy/jdk/src/solaris/native/java/net/net_util_md.h 2020-10-11 21:05:34.772019449 -0400
+@@ -33,7 +33,7 @@
+ #include <unistd.h>
+
+ #ifndef USE_SELECT
+-#include <sys/poll.h>
++#include <poll.h>
+ #endif
+
+
+diff -Naur openjdk-8.265_p01/jdk/src/solaris/native/sun/nio/ch/DevPollArrayWrapper.c openjdk-8.265_p01-copy/jdk/src/solaris/native/sun/nio/ch/DevPollArrayWrapper.c
+--- openjdk-8.265_p01/jdk/src/solaris/native/sun/nio/ch/DevPollArrayWrapper.c 2020-10-11 15:53:09.316010360 -0400
++++ openjdk-8.265_p01-copy/jdk/src/solaris/native/sun/nio/ch/DevPollArrayWrapper.c 2020-10-11 21:05:53.824019458 -0400
+@@ -28,7 +28,7 @@
+ #include "jvm.h"
+ #include "jlong.h"
+ #include "sun_nio_ch_DevPollArrayWrapper.h"
+-#include <sys/poll.h>
++#include <poll.h>
+ #include <unistd.h>
+ #include <sys/time.h>
+
+diff -Naur openjdk-8.265_p01/jdk/src/solaris/native/sun/nio/ch/NativeThread.c openjdk-8.265_p01-copy/jdk/src/solaris/native/sun/nio/ch/NativeThread.c
+--- openjdk-8.265_p01/jdk/src/solaris/native/sun/nio/ch/NativeThread.c 2020-10-11 15:53:09.316010360 -0400
++++ openjdk-8.265_p01-copy/jdk/src/solaris/native/sun/nio/ch/NativeThread.c 2020-10-11 21:06:07.272019465 -0400
+@@ -34,7 +34,7 @@
+
+ #ifdef __linux__
+ #include <pthread.h>
+- #include <sys/signal.h>
++ #include <signal.h>
+ /* Also defined in net/linux_close.c */
+ #define INTERRUPT_SIGNAL (__SIGRTMAX - 2)
+ #elif __solaris__
+diff -Naur openjdk-8.265_p01/jdk/src/solaris/native/sun/nio/ch/Net.c openjdk-8.265_p01-copy/jdk/src/solaris/native/sun/nio/ch/Net.c
+--- openjdk-8.265_p01/jdk/src/solaris/native/sun/nio/ch/Net.c 2020-10-11 15:53:09.316010360 -0400
++++ openjdk-8.265_p01-copy/jdk/src/solaris/native/sun/nio/ch/Net.c 2020-10-11 21:06:25.348019474 -0400
+@@ -23,7 +23,7 @@
+ * questions.
+ */
+
+-#include <sys/poll.h>
++#include <poll.h>
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ #include <string.h>
+diff -Naur openjdk-8.265_p01/jdk/src/solaris/transport/socket/socket_md.c openjdk-8.265_p01-copy/jdk/src/solaris/transport/socket/socket_md.c
+--- openjdk-8.265_p01/jdk/src/solaris/transport/socket/socket_md.c 2020-10-11 15:53:09.316010360 -0400
++++ openjdk-8.265_p01-copy/jdk/src/solaris/transport/socket/socket_md.c 2020-10-11 21:06:44.348019483 -0400
+@@ -37,7 +37,7 @@
+ #include <thread.h>
+ #else
+ #include <pthread.h>
+-#include <sys/poll.h>
++#include <poll.h>
+ #endif
+
+ #include "socket_md.h"
diff --git a/dev-java/openjdk/files/musl/8/0008_musl_jdk_execinfo.patch b/dev-java/openjdk/files/musl/8/0008_musl_jdk_execinfo.patch
new file mode 100644
index 0000000..85c113d
--- /dev/null
+++ b/dev-java/openjdk/files/musl/8/0008_musl_jdk_execinfo.patch
@@ -0,0 +1,21 @@
+diff -Naur openjdk-8.265_p01/jdk/src/solaris/native/sun/xawt/XToolkit.c openjdk-8.265_p01-copy/jdk/src/solaris/native/sun/xawt/XToolkit.c
+--- openjdk-8.265_p01/jdk/src/solaris/native/sun/xawt/XToolkit.c 2020-10-11 15:53:09.316010360 -0400
++++ openjdk-8.265_p01-copy/jdk/src/solaris/native/sun/xawt/XToolkit.c 2020-10-11 21:09:12.892019555 -0400
+@@ -27,7 +27,7 @@
+ #include <X11/Xutil.h>
+ #include <X11/Xos.h>
+ #include <X11/Xatom.h>
+-#ifdef __linux__
++#if defined(__linux__) && defined(__GLIBC__) && ! defined(__UCLIBC__)
+ #include <execinfo.h>
+ #endif
+
+@@ -803,7 +803,7 @@
+ return ret;
+ }
+
+-#ifdef __linux__
++#if defined(__linux__) && defined(__GLIBC__) && ! defined(__UCLIBC__)
+ void print_stack(void)
+ {
+ void *array[10];
diff --git a/dev-java/openjdk/files/musl/8/0009_fix_jdk_ipv6_init.patch b/dev-java/openjdk/files/musl/8/0009_fix_jdk_ipv6_init.patch
new file mode 100644
index 0000000..a9d9aea
--- /dev/null
+++ b/dev-java/openjdk/files/musl/8/0009_fix_jdk_ipv6_init.patch
@@ -0,0 +1,43 @@
+diff -Naur openjdk-8.265_p01/jdk/src/solaris/native/java/net/net_util_md.c openjdk-8.265_p01-copy/jdk/src/solaris/native/java/net/net_util_md.c
+--- openjdk-8.265_p01/jdk/src/solaris/native/java/net/net_util_md.c 2020-10-11 15:53:09.308010360 -0400
++++ openjdk-8.265_p01-copy/jdk/src/solaris/native/java/net/net_util_md.c 2020-10-11 21:32:57.480020246 -0400
+@@ -662,7 +662,7 @@
+
+ static struct localinterface *localifs = 0;
+ static int localifsSize = 0; /* size of array */
+-static int nifs = 0; /* number of entries used in array */
++static int nifs = -1; /* number of entries used in array */
+
+ /* not thread safe: make sure called once from one thread */
+
+@@ -674,6 +674,10 @@
+ int index, x1, x2, x3;
+ unsigned int u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,ua,ub,uc,ud,ue,uf;
+
++ if (nifs >= 0)
++ return ;
++ nifs = 0;
++
+ if ((f = fopen("/proc/net/if_inet6", "r")) == NULL) {
+ return ;
+ }
+@@ -702,7 +706,7 @@
+ localifs = (struct localinterface *) realloc (
+ localifs, sizeof (struct localinterface)* (localifsSize+5));
+ if (localifs == 0) {
+- nifs = 0;
++ nifs = -1;
+ fclose (f);
+ return;
+ }
+@@ -725,9 +729,7 @@
+ static int getLocalScopeID (char *addr) {
+ struct localinterface *lif;
+ int i;
+- if (localifs == 0) {
+- initLocalIfs();
+- }
++ initLocalIfs();
+ for (i=0, lif=localifs; i<nifs; i++, lif++) {
+ if (memcmp (addr, lif->localaddr, 16) == 0) {
+ return lif->index;
diff --git a/dev-java/openjdk/files/musl/8/0010_fix_jdk_close_fds.patch b/dev-java/openjdk/files/musl/8/0010_fix_jdk_close_fds.patch
new file mode 100644
index 0000000..ed60b2c
--- /dev/null
+++ b/dev-java/openjdk/files/musl/8/0010_fix_jdk_close_fds.patch
@@ -0,0 +1,103 @@
+diff -Naur openjdk-8.265_p01/jdk/src/solaris/native/java/lang/childproc.c openjdk-8.265_p01-copy/jdk/src/solaris/native/java/lang/childproc.c
+--- openjdk-8.265_p01/jdk/src/solaris/native/java/lang/childproc.c 2020-10-11 15:53:09.308010360 -0400
++++ openjdk-8.265_p01-copy/jdk/src/solaris/native/java/lang/childproc.c 2020-10-11 21:38:33.888020409 -0400
+@@ -30,6 +30,7 @@
+ #include <string.h>
+ #include <unistd.h>
+ #include <limits.h>
++#include <poll.h>
+
+ #include "childproc.h"
+
+@@ -57,59 +58,46 @@
+ }
+
+ int
+-isAsciiDigit(char c)
+-{
+- return c >= '0' && c <= '9';
+-}
+-
+-#ifdef _ALLBSD_SOURCE
+-#define FD_DIR "/dev/fd"
+-#define dirent64 dirent
+-#define readdir64 readdir
+-#elif defined(_AIX)
+-/* AIX does not understand '/proc/self' - it requires the real process ID */
+-#define FD_DIR aix_fd_dir
+-#else
+-#define FD_DIR "/proc/self/fd"
+-#endif
+-
+-int
+ closeDescriptors(void)
+ {
+- DIR *dp;
+- struct dirent64 *dirp;
+ int from_fd = FAIL_FILENO + 1;
++ struct pollfd pfds[1024];
++ int i, total, nclosed = 0;
++ int max_fd = sysconf(_SC_OPEN_MAX);
+
+- /* We're trying to close all file descriptors, but opendir() might
+- * itself be implemented using a file descriptor, and we certainly
+- * don't want to close that while it's in use. We assume that if
+- * opendir() is implemented using a file descriptor, then it uses
+- * the lowest numbered file descriptor, just like open(). So we
+- * close a couple explicitly. */
+-
+- close(from_fd); /* for possible use by opendir() */
+- close(from_fd + 1); /* another one for good luck */
+-
+-#if defined(_AIX)
+- /* AIX does not understand '/proc/self' - it requires the real process ID */
+- char aix_fd_dir[32]; /* the pid has at most 19 digits */
+- snprintf(aix_fd_dir, 32, "/proc/%d/fd", getpid());
+-#endif
+-
+- if ((dp = opendir(FD_DIR)) == NULL)
++ if (max_fd < 0)
+ return 0;
+
+- /* We use readdir64 instead of readdir to work around Solaris bug
+- * 6395699: /proc/self/fd fails to report file descriptors >= 1024 on Solaris 9
+- */
+- while ((dirp = readdir64(dp)) != NULL) {
+- int fd;
+- if (isAsciiDigit(dirp->d_name[0]) &&
+- (fd = strtol(dirp->d_name, NULL, 10)) >= from_fd + 2)
+- close(fd);
++ /* init events */
++ total = max_fd - from_fd;
++ for (i = 0; i < (total < 1024 ? total : 1024); i++) {
++ pfds[i].events = 0;
+ }
+
+- closedir(dp);
++ while (from_fd < max_fd) {
++ int nfds, r = 0;
++
++ total = max_fd - from_fd;
++ nfds = total < 1024 ? total : 1024;
++
++ for (i = 0; i < nfds; i++)
++ pfds[i].fd = from_fd + i;
++
++ do {
++ r = poll(pfds, nfds, 0);
++ } while (r == -1 && errno == EINTR);
++
++ if (r < 0)
++ return 0;
++
++
++ for (i = 0; i < nfds; i++)
++ if (pfds[i].revents != POLLNVAL) {
++ nclosed++;
++ close(pfds[i].fd);
++ }
++ from_fd += nfds;
++ }
+
+ return 1;
+ }
diff --git a/dev-java/openjdk/files/openjdk-11.env.sh b/dev-java/openjdk/files/openjdk-11.env.sh
new file mode 100644
index 0000000..96c4be7
--- /dev/null
+++ b/dev-java/openjdk/files/openjdk-11.env.sh
@@ -0,0 +1,16 @@
+# Copyright 1999-2018 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+VERSION="OpenJDK ${PV}"
+JAVA_HOME="${EPREFIX}/usr/$(get_libdir)/${PN}-${SLOT}"
+JDK_HOME="${EPREFIX}/usr/$(get_libdir)/${PN}-${SLOT}"
+JAVAC="\${JAVA_HOME}/bin/javac"
+PATH="\${JAVA_HOME}/bin"
+ROOTPATH="\${JAVA_HOME}/bin"
+LDPATH="\${JAVA_HOME}/lib/:\${JAVA_HOME}/lib/server/"
+MANPATH=""
+PROVIDES_TYPE="JDK JRE"
+PROVIDES_VERSION="${SLOT}"
+BOOTCLASSPATH=""
+GENERATION="2"
+ENV_VARS="JAVA_HOME JDK_HOME JAVAC PATH ROOTPATH LDPATH MANPATH"
diff --git a/dev-java/openjdk/files/openjdk-8.env.sh b/dev-java/openjdk/files/openjdk-8.env.sh
new file mode 100644
index 0000000..e85a08c
--- /dev/null
+++ b/dev-java/openjdk/files/openjdk-8.env.sh
@@ -0,0 +1,16 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+VERSION="OpenJDK ${PV}"
+JAVA_HOME="${EPREFIX}/usr/$(get_libdir)/${PN}-${SLOT}"
+JDK_HOME="${EPREFIX}/usr/$(get_libdir)/${PN}-${SLOT}"
+JAVAC="\${JAVA_HOME}/bin/javac"
+PATH="\${JAVA_HOME}/bin"
+ROOTPATH="\${JAVA_HOME}/bin"
+LDPATH="\${JAVA_HOME}/lib/:\${JAVA_HOME}/lib/server/"
+MANPATH="\${JAVA_HOME}/man"
+PROVIDES_TYPE="JDK JRE"
+PROVIDES_VERSION="1.${SLOT}"
+BOOTCLASSPATH="\${JAVA_HOME}/jre/lib/resources.jar:\${JAVA_HOME}/jre/lib/rt.jar:\${JAVA_HOME}/jre/lib/jsse.jar:\${JAVA_HOME}/jre/lib/jce.jar:\${JAVA_HOME}/jre/lib/charsets.jar:\${JAVA_HOME}/jre/lib/jfr.jar"
+GENERATION="2"
+ENV_VARS="JAVA_HOME JDK_HOME JAVAC PATH ROOTPATH LDPATH MANPATH"
diff --git a/dev-java/openjdk/metadata.xml b/dev-java/openjdk/metadata.xml
new file mode 100644
index 0000000..24efdf8
--- /dev/null
+++ b/dev-java/openjdk/metadata.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="person">
+ <email>gyakovlev@gentoo.org</email>
+ <name>Georgy Yakovlev</name>
+ </maintainer>
+ <maintainer type="project">
+ <email>java@gentoo.org</email>
+ <name>Java</name>
+ </maintainer>
+ <longdescription>
+ Java™ is the world's leading programming language and platform.
+ The code for Java is open source and available at OpenJDK™.
+ </longdescription>
+ <slots>
+ <slot name="8">Java™ 8 is Java™ 1.8, where 8 is the version number, and 1.8 is the version string</slot>
+ <slot name="11">Java™ version 11</slot>
+ </slots>
+ <use>
+ <flag name="headless-awt">Don't install the X backend for AWT, needed by some GUIs</flag>
+ <flag name="gentoo-vm">Allow this JDK to be recognised by Gentoo (package manager, eselect, java-config, EXPERIMENTAL!)</flag>
+ <flag name="javafx" restrict="&lt;=dev-java/openjdk-9">Provide JavaFX support via <pkg>dev-java/openjfx</pkg></flag>
+ <flag name="javafx" restrict="&gt;=dev-java/openjdk-11">Import OpenJFX modules at build time, via <pkg>dev-java/openjfx</pkg></flag>
+ <flag name="jbootstrap">Build OpenJDK twice, the second time using the result of the first</flag>
+ <flag name="source">Install JVM sources</flag>
+ <flag name="systemtap" restrict="&gt;=dev-java/openjdk-11">Enable SystemTAP/DTrace tracing</flag>
+ </use>
+</pkgmetadata>
diff --git a/dev-java/openjdk/openjdk-11.0.8_p10.ebuild b/dev-java/openjdk/openjdk-11.0.8_p10.ebuild
new file mode 100644
index 0000000..7eb8e19
--- /dev/null
+++ b/dev-java/openjdk/openjdk-11.0.8_p10.ebuild
@@ -0,0 +1,289 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit autotools check-reqs flag-o-matic java-pkg-2 java-vm-2 multiprocessing pax-utils toolchain-funcs
+
+# we need -ga tag to fetch tarball and unpack it, but exact number everywhere else to
+# set build version properly
+MY_PV="${PV%_p*}-ga"
+SLOT="${MY_PV%%[.+]*}"
+
+DESCRIPTION="Open source implementation of the Java programming language"
+HOMEPAGE="https://openjdk.java.net"
+SRC_URI="https://hg.${PN}.java.net/jdk-updates/jdk${SLOT}u/archive/jdk-${MY_PV}.tar.bz2 -> ${P}.tar.bz2"
+
+LICENSE="GPL-2"
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc64"
+
+IUSE="alsa cups debug doc examples gentoo-vm headless-awt javafx +jbootstrap +pch selinux source systemtap"
+
+COMMON_DEPEND="
+ media-libs/freetype:2=
+ media-libs/giflib:0/7
+ media-libs/libpng:0=
+ media-libs/lcms:2=
+ sys-libs/zlib
+ virtual/jpeg:0=
+ systemtap? ( dev-util/systemtap )
+"
+
+# Many libs are required to build, but not to run, make is possible to remove
+# by listing conditionally in RDEPEND unconditionally in DEPEND
+RDEPEND="
+ ${COMMON_DEPEND}
+ >=sys-apps/baselayout-java-0.1.0-r1
+ !headless-awt? (
+ x11-libs/libX11
+ x11-libs/libXext
+ x11-libs/libXi
+ x11-libs/libXrandr
+ x11-libs/libXrender
+ x11-libs/libXt
+ x11-libs/libXtst
+ )
+ alsa? ( media-libs/alsa-lib )
+ cups? ( net-print/cups )
+ selinux? ( sec-policy/selinux-java )
+"
+
+DEPEND="
+ ${COMMON_DEPEND}
+ app-arch/zip
+ media-libs/alsa-lib
+ net-print/cups
+ x11-base/xorg-proto
+ x11-libs/libX11
+ x11-libs/libXext
+ x11-libs/libXi
+ x11-libs/libXrandr
+ x11-libs/libXrender
+ x11-libs/libXt
+ x11-libs/libXtst
+ javafx? ( dev-java/openjfx:${SLOT}= )
+ || (
+ dev-java/openjdk-bin:${SLOT}
+ dev-java/openjdk:${SLOT}
+ )
+"
+
+REQUIRED_USE="javafx? ( alsa !headless-awt )"
+
+S="${WORKDIR}/jdk${SLOT}u-jdk-${MY_PV}"
+
+# The space required to build varies wildly depending on USE flags,
+# ranging from 2GB to 16GB. This function is certainly not exact but
+# should be close enough to be useful.
+openjdk_check_requirements() {
+ local M
+ M=2048
+ M=$(( $(usex jbootstrap 2 1) * $M ))
+ M=$(( $(usex debug 3 1) * $M ))
+ M=$(( $(usex doc 320 0) + $(usex source 128 0) + 192 + $M ))
+
+ CHECKREQS_DISK_BUILD=${M}M check-reqs_pkg_${EBUILD_PHASE}
+}
+
+pkg_pretend() {
+ openjdk_check_requirements
+ if [[ ${MERGE_TYPE} != binary ]]; then
+ has ccache ${FEATURES} && die "FEATURES=ccache doesn't work with ${PN}, bug #677876"
+ fi
+}
+
+pkg_setup() {
+ openjdk_check_requirements
+ java-vm-2_pkg_setup
+
+ JAVA_PKG_WANT_BUILD_VM="openjdk-${SLOT} openjdk-bin-${SLOT}"
+ JAVA_PKG_WANT_SOURCE="${SLOT}"
+ JAVA_PKG_WANT_TARGET="${SLOT}"
+
+ # The nastiness below is necessary while the gentoo-vm USE flag is
+ # masked. First we call java-pkg-2_pkg_setup if it looks like the
+ # flag was unmasked against one of the possible build VMs. If not,
+ # we try finding one of them in their expected locations. This would
+ # have been slightly less messy if openjdk-bin had been installed to
+ # /opt/${PN}-${SLOT} or if there was a mechanism to install a VM env
+ # file but disable it so that it would not normally be selectable.
+
+ local vm
+ for vm in ${JAVA_PKG_WANT_BUILD_VM}; do
+ if [[ -d ${EPREFIX}/usr/lib/jvm/${vm} ]]; then
+ java-pkg-2_pkg_setup
+ return
+ fi
+ done
+
+ if has_version --host-root dev-java/openjdk:${SLOT}; then
+ export JDK_HOME=${EPREFIX}/usr/$(get_libdir)/openjdk-${SLOT}
+ else
+ if [[ ${MERGE_TYPE} != "binary" ]]; then
+ JDK_HOME=$(best_version --host-root dev-java/openjdk-bin:${SLOT})
+ [[ -n ${JDK_HOME} ]] || die "Build VM not found!"
+ JDK_HOME=${JDK_HOME#*/}
+ JDK_HOME=${EPREFIX}/opt/${JDK_HOME%-r*}
+ export JDK_HOME
+ fi
+ fi
+}
+
+src_prepare() {
+ default
+
+ # conditionally apply patches for musl compatibility
+ if use elibc_musl; then
+ eapply "${FILESDIR}/musl/${SLOT}/build.patch"
+ eapply "${FILESDIR}/musl/${SLOT}/fix-bootjdk-check.patch"
+ eapply "${FILESDIR}/musl/${SLOT}/ppc64le.patch"
+ eapply "${FILESDIR}/musl/${SLOT}/aarch64.patch"
+ fi
+
+ # conditionally remove not compilable module (hotspot jdk.hotspot.agent)
+ # this needs libthread_db which is only provided by glibc
+ #
+ # haven't found any way to disable this module so just remove it.
+ if use elibc_musl; then
+ rm -rf "${S}"/src/jdk.hotspot.agent || die "failed to remove HotSpot agent"
+ fi
+
+ chmod +x configure || die
+}
+
+src_configure() {
+ # Work around stack alignment issue, bug #647954. in case we ever have x86
+ use x86 && append-flags -mincoming-stack-boundary=2
+
+ # Work around -fno-common ( GCC10 default ), bug #713180
+ append-flags -fcommon
+
+ # Enabling full docs appears to break doc building. If not
+ # explicitly disabled, the flag will get auto-enabled if pandoc and
+ # graphviz are detected. pandoc has loads of dependencies anyway.
+
+ local myconf=(
+ --disable-ccache
+ --enable-full-docs=no
+ --with-boot-jdk="${JDK_HOME}"
+ --with-extra-cflags="${CFLAGS}"
+ --with-extra-cxxflags="${CXXFLAGS}"
+ --with-extra-ldflags="${LDFLAGS}"
+ --with-giflib=system
+ --with-lcms=system
+ --with-libjpeg=system
+ --with-libpng=system
+ --with-native-debug-symbols=$(usex debug internal none)
+ --with-vendor-name="Gentoo"
+ --with-vendor-url="https://gentoo.org"
+ --with-vendor-bug-url="https://bugs.gentoo.org"
+ --with-vendor-vm-bug-url="https://bugs.openjdk.java.net"
+ --with-vendor-version-string="${PVR}"
+ --with-version-pre=""
+ --with-version-string="${PV%_p*}"
+ --with-version-build="${PV#*_p}"
+ --with-zlib=system
+ --enable-dtrace=$(usex systemtap yes no)
+ --enable-headless-only=$(usex headless-awt yes no)
+ )
+
+ if use javafx; then
+ local zip="${EROOT%/}/usr/$(get_libdir)/openjfx-${SLOT}/javafx-exports.zip"
+ if [[ -r ${zip} ]]; then
+ myconf+=( --with-import-modules="${zip}" )
+ else
+ die "${zip} not found or not readable"
+ fi
+ fi
+
+ # PaX breaks pch, bug #601016
+ if use pch && ! host-is-pax; then
+ myconf+=( --enable-precompiled-headers )
+ else
+ myconf+=( --disable-precompiled-headers )
+ fi
+
+ (
+ unset _JAVA_OPTIONS JAVA JAVA_TOOL_OPTIONS JAVAC XARGS
+ CFLAGS= CXXFLAGS= LDFLAGS= \
+ CONFIG_SITE=/dev/null \
+ econf "${myconf[@]}"
+ )
+}
+
+src_compile() {
+ local myemakeargs=(
+ JOBS=$(makeopts_jobs)
+ LOG=debug
+ CFLAGS_WARNINGS_ARE_ERRORS= # No -Werror
+ $(usex doc docs '')
+ $(usex jbootstrap bootcycle-images product-images)
+ )
+ emake "${myemakeargs[@]}" -j1 #nowarn
+}
+
+src_install() {
+ local dest="/usr/$(get_libdir)/${PN}-${SLOT}"
+ local ddest="${ED}${dest#/}"
+
+ cd "${S}"/build/*-release/images/jdk || die
+
+ # Create files used as storage for system preferences.
+ mkdir .systemPrefs || die
+ touch .systemPrefs/.system.lock || die
+ touch .systemPrefs/.systemRootModFile || die
+
+ # Oracle and IcedTea have libjsoundalsa.so depending on
+ # libasound.so.2 but OpenJDK only has libjsound.so. Weird.
+ if ! use alsa ; then
+ rm -v lib/libjsound.* || die
+ fi
+
+ if ! use examples ; then
+ rm -vr demo/ || die
+ fi
+
+ if ! use source ; then
+ rm -v lib/src.zip || die
+ fi
+
+ rm -v lib/security/cacerts || die
+
+ dodir "${dest}"
+ cp -pPR * "${ddest}" || die
+
+ dosym ../../../../../etc/ssl/certs/java/cacerts "${dest}"/lib/security/cacerts
+
+ # must be done before running itself
+ java-vm_set-pax-markings "${ddest}"
+
+ einfo "Creating the Class Data Sharing archives and disabling usage tracking"
+ "${ddest}/bin/java" -server -Xshare:dump -Djdk.disableLastUsageTracking || die
+
+ use gentoo-vm && java-vm_install-env "${FILESDIR}"/${PN}-${SLOT}.env.sh
+ java-vm_revdep-mask
+ java-vm_sandbox-predict /dev/random /proc/self/coredump_filter
+
+ if use doc ; then
+ docinto html
+ dodoc -r "${S}"/build/*-release/images/docs/*
+ dosym ../../../usr/share/doc/"${PF}" /usr/share/doc/"${PN}-${SLOT}"
+ fi
+}
+
+pkg_postinst() {
+ java-vm-2_pkg_postinst
+
+ if use gentoo-vm ; then
+ ewarn "WARNING! You have enabled the gentoo-vm USE flag, making this JDK"
+ ewarn "recognised by the system. This will almost certainly break"
+ ewarn "many java ebuilds as they are not ready for openjdk-11"
+ else
+ ewarn "The experimental gentoo-vm USE flag has not been enabled so this JDK"
+ ewarn "will not be recognised by the system. For example, simply calling"
+ ewarn "\"java\" will launch a different JVM. This is necessary until Gentoo"
+ ewarn "fully supports Java ${SLOT}. This JDK must therefore be invoked using its"
+ ewarn "absolute location under ${EPREFIX}/usr/$(get_libdir)/${PN}-${SLOT}."
+ fi
+}
+
diff --git a/dev-java/openjdk/openjdk-11.0.9_p11.ebuild b/dev-java/openjdk/openjdk-11.0.9_p11.ebuild
new file mode 100644
index 0000000..af0cd66
--- /dev/null
+++ b/dev-java/openjdk/openjdk-11.0.9_p11.ebuild
@@ -0,0 +1,288 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit autotools check-reqs flag-o-matic java-pkg-2 java-vm-2 multiprocessing pax-utils toolchain-funcs
+
+# we need -ga tag to fetch tarball and unpack it, but exact number everywhere else to
+# set build version properly
+MY_PV="${PV%_p*}-ga"
+SLOT="${MY_PV%%[.+]*}"
+
+DESCRIPTION="Open source implementation of the Java programming language"
+HOMEPAGE="https://openjdk.java.net"
+SRC_URI="https://hg.${PN}.java.net/jdk-updates/jdk${SLOT}u/archive/jdk-${MY_PV}.tar.bz2 -> ${P}.tar.bz2"
+
+LICENSE="GPL-2"
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc64"
+
+IUSE="alsa cups debug doc examples gentoo-vm headless-awt javafx +jbootstrap +pch selinux source systemtap"
+
+COMMON_DEPEND="
+ media-libs/freetype:2=
+ media-libs/giflib:0/7
+ media-libs/libpng:0=
+ media-libs/lcms:2=
+ sys-libs/zlib
+ virtual/jpeg:0=
+ systemtap? ( dev-util/systemtap )
+"
+
+# Many libs are required to build, but not to run, make is possible to remove
+# by listing conditionally in RDEPEND unconditionally in DEPEND
+RDEPEND="
+ ${COMMON_DEPEND}
+ >=sys-apps/baselayout-java-0.1.0-r1
+ !headless-awt? (
+ x11-libs/libX11
+ x11-libs/libXext
+ x11-libs/libXi
+ x11-libs/libXrandr
+ x11-libs/libXrender
+ x11-libs/libXt
+ x11-libs/libXtst
+ )
+ alsa? ( media-libs/alsa-lib )
+ cups? ( net-print/cups )
+ selinux? ( sec-policy/selinux-java )
+"
+
+DEPEND="
+ ${COMMON_DEPEND}
+ app-arch/zip
+ media-libs/alsa-lib
+ net-print/cups
+ x11-base/xorg-proto
+ x11-libs/libX11
+ x11-libs/libXext
+ x11-libs/libXi
+ x11-libs/libXrandr
+ x11-libs/libXrender
+ x11-libs/libXt
+ x11-libs/libXtst
+ javafx? ( dev-java/openjfx:${SLOT}= )
+ || (
+ dev-java/openjdk-bin:${SLOT}
+ dev-java/openjdk:${SLOT}
+ )
+"
+
+REQUIRED_USE="javafx? ( alsa !headless-awt )"
+
+S="${WORKDIR}/jdk${SLOT}u-jdk-${MY_PV}"
+
+# The space required to build varies wildly depending on USE flags,
+# ranging from 2GB to 16GB. This function is certainly not exact but
+# should be close enough to be useful.
+openjdk_check_requirements() {
+ local M
+ M=2048
+ M=$(( $(usex jbootstrap 2 1) * $M ))
+ M=$(( $(usex debug 3 1) * $M ))
+ M=$(( $(usex doc 320 0) + $(usex source 128 0) + 192 + $M ))
+
+ CHECKREQS_DISK_BUILD=${M}M check-reqs_pkg_${EBUILD_PHASE}
+}
+
+pkg_pretend() {
+ openjdk_check_requirements
+ if [[ ${MERGE_TYPE} != binary ]]; then
+ has ccache ${FEATURES} && die "FEATURES=ccache doesn't work with ${PN}, bug #677876"
+ fi
+}
+
+pkg_setup() {
+ openjdk_check_requirements
+ java-vm-2_pkg_setup
+
+ JAVA_PKG_WANT_BUILD_VM="openjdk-${SLOT} openjdk-bin-${SLOT}"
+ JAVA_PKG_WANT_SOURCE="${SLOT}"
+ JAVA_PKG_WANT_TARGET="${SLOT}"
+
+ # The nastiness below is necessary while the gentoo-vm USE flag is
+ # masked. First we call java-pkg-2_pkg_setup if it looks like the
+ # flag was unmasked against one of the possible build VMs. If not,
+ # we try finding one of them in their expected locations. This would
+ # have been slightly less messy if openjdk-bin had been installed to
+ # /opt/${PN}-${SLOT} or if there was a mechanism to install a VM env
+ # file but disable it so that it would not normally be selectable.
+
+ local vm
+ for vm in ${JAVA_PKG_WANT_BUILD_VM}; do
+ if [[ -d ${EPREFIX}/usr/lib/jvm/${vm} ]]; then
+ java-pkg-2_pkg_setup
+ return
+ fi
+ done
+
+ if has_version --host-root dev-java/openjdk:${SLOT}; then
+ export JDK_HOME=${EPREFIX}/usr/$(get_libdir)/openjdk-${SLOT}
+ else
+ if [[ ${MERGE_TYPE} != "binary" ]]; then
+ JDK_HOME=$(best_version --host-root dev-java/openjdk-bin:${SLOT})
+ [[ -n ${JDK_HOME} ]] || die "Build VM not found!"
+ JDK_HOME=${JDK_HOME#*/}
+ JDK_HOME=${EPREFIX}/opt/${JDK_HOME%-r*}
+ export JDK_HOME
+ fi
+ fi
+}
+
+src_prepare() {
+ default
+
+ # conditionally apply patches for musl compatibility
+ if use elibc_musl; then
+ eapply "${FILESDIR}/musl/${SLOT}/build.patch"
+ eapply "${FILESDIR}/musl/${SLOT}/fix-bootjdk-check.patch"
+ eapply "${FILESDIR}/musl/${SLOT}/ppc64le.patch"
+ eapply "${FILESDIR}/musl/${SLOT}/aarch64.patch"
+ fi
+
+ # conditionally remove not compilable module (hotspot jdk.hotspot.agent)
+ # this needs libthread_db which is only provided by glibc
+ #
+ # haven't found any way to disable this module so just remove it.
+ if use elibc_musl; then
+ rm -rf "${S}"/src/jdk.hotspot.agent || die "failed to remove HotSpot agent"
+ fi
+
+ chmod +x configure || die
+}
+
+src_configure() {
+ # Work around stack alignment issue, bug #647954. in case we ever have x86
+ use x86 && append-flags -mincoming-stack-boundary=2
+
+ # Work around -fno-common ( GCC10 default ), bug #713180
+ append-flags -fcommon
+
+ # Enabling full docs appears to break doc building. If not
+ # explicitly disabled, the flag will get auto-enabled if pandoc and
+ # graphviz are detected. pandoc has loads of dependencies anyway.
+
+ local myconf=(
+ --disable-ccache
+ --enable-full-docs=no
+ --with-boot-jdk="${JDK_HOME}"
+ --with-extra-cflags="${CFLAGS}"
+ --with-extra-cxxflags="${CXXFLAGS}"
+ --with-extra-ldflags="${LDFLAGS}"
+ --with-giflib=system
+ --with-lcms=system
+ --with-libjpeg=system
+ --with-libpng=system
+ --with-native-debug-symbols=$(usex debug internal none)
+ --with-vendor-name="Gentoo"
+ --with-vendor-url="https://gentoo.org"
+ --with-vendor-bug-url="https://bugs.gentoo.org"
+ --with-vendor-vm-bug-url="https://bugs.openjdk.java.net"
+ --with-vendor-version-string="${PVR}"
+ --with-version-pre=""
+ --with-version-string="${PV%_p*}"
+ --with-version-build="${PV#*_p}"
+ --with-zlib=system
+ --enable-dtrace=$(usex systemtap yes no)
+ --enable-headless-only=$(usex headless-awt yes no)
+ )
+
+ if use javafx; then
+ local zip="${EROOT%/}/usr/$(get_libdir)/openjfx-${SLOT}/javafx-exports.zip"
+ if [[ -r ${zip} ]]; then
+ myconf+=( --with-import-modules="${zip}" )
+ else
+ die "${zip} not found or not readable"
+ fi
+ fi
+
+ # PaX breaks pch, bug #601016
+ if use pch && ! host-is-pax; then
+ myconf+=( --enable-precompiled-headers )
+ else
+ myconf+=( --disable-precompiled-headers )
+ fi
+
+ (
+ unset _JAVA_OPTIONS JAVA JAVA_TOOL_OPTIONS JAVAC XARGS
+ CFLAGS= CXXFLAGS= LDFLAGS= \
+ CONFIG_SITE=/dev/null \
+ econf "${myconf[@]}"
+ )
+}
+
+src_compile() {
+ local myemakeargs=(
+ JOBS=$(makeopts_jobs)
+ LOG=debug
+ CFLAGS_WARNINGS_ARE_ERRORS= # No -Werror
+ $(usex doc docs '')
+ $(usex jbootstrap bootcycle-images product-images)
+ )
+ emake "${myemakeargs[@]}" -j1 #nowarn
+}
+
+src_install() {
+ local dest="/usr/$(get_libdir)/${PN}-${SLOT}"
+ local ddest="${ED}${dest#/}"
+
+ cd "${S}"/build/*-release/images/jdk || die
+
+ # Create files used as storage for system preferences.
+ mkdir .systemPrefs || die
+ touch .systemPrefs/.system.lock || die
+ touch .systemPrefs/.systemRootModFile || die
+
+ # Oracle and IcedTea have libjsoundalsa.so depending on
+ # libasound.so.2 but OpenJDK only has libjsound.so. Weird.
+ if ! use alsa ; then
+ rm -v lib/libjsound.* || die
+ fi
+
+ if ! use examples ; then
+ rm -vr demo/ || die
+ fi
+
+ if ! use source ; then
+ rm -v lib/src.zip || die
+ fi
+
+ rm -v lib/security/cacerts || die
+
+ dodir "${dest}"
+ cp -pPR * "${ddest}" || die
+
+ dosym ../../../../../etc/ssl/certs/java/cacerts "${dest}"/lib/security/cacerts
+
+ # must be done before running itself
+ java-vm_set-pax-markings "${ddest}"
+
+ einfo "Creating the Class Data Sharing archives and disabling usage tracking"
+ "${ddest}/bin/java" -server -Xshare:dump -Djdk.disableLastUsageTracking || die
+
+ use gentoo-vm && java-vm_install-env "${FILESDIR}"/${PN}-${SLOT}.env.sh
+ java-vm_revdep-mask
+ java-vm_sandbox-predict /dev/random /proc/self/coredump_filter
+
+ if use doc ; then
+ docinto html
+ dodoc -r "${S}"/build/*-release/images/docs/*
+ dosym ../../../usr/share/doc/"${PF}" /usr/share/doc/"${PN}-${SLOT}"
+ fi
+}
+
+pkg_postinst() {
+ java-vm-2_pkg_postinst
+
+ if use gentoo-vm ; then
+ ewarn "WARNING! You have enabled the gentoo-vm USE flag, making this JDK"
+ ewarn "recognised by the system. This will almost certainly break"
+ ewarn "many java ebuilds as they are not ready for openjdk-11"
+ else
+ ewarn "The experimental gentoo-vm USE flag has not been enabled so this JDK"
+ ewarn "will not be recognised by the system. For example, simply calling"
+ ewarn "\"java\" will launch a different JVM. This is necessary until Gentoo"
+ ewarn "fully supports Java ${SLOT}. This JDK must therefore be invoked using its"
+ ewarn "absolute location under ${EPREFIX}/usr/$(get_libdir)/${PN}-${SLOT}."
+ fi
+}
diff --git a/dev-java/openjdk/openjdk-8.265_p01.ebuild b/dev-java/openjdk/openjdk-8.265_p01.ebuild
new file mode 100644
index 0000000..4af9ae6
--- /dev/null
+++ b/dev-java/openjdk/openjdk-8.265_p01.ebuild
@@ -0,0 +1,268 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit check-reqs eapi7-ver flag-o-matic java-pkg-2 java-vm-2 multiprocessing pax-utils toolchain-funcs
+
+# we need latest -ga tag from hg, but want to keep build number as well
+# as _p component of the gentoo version string.
+
+MY_PV=$(ver_rs 1 'u' 2 '-' ${PV%_p*}-ga)
+MY_PN_AARCH64="${PN}-aarch64-shenandoah"
+MY_PV_AARCH64="$(ver_rs 1 'u' 2 '-' ${PV/_p/-b})"
+MY_P_AARCH64="${MY_PN_AARCH64/#${PN}-}-jdk${MY_PV_AARCH64}"
+
+BASE_URI="https://hg.${PN}.java.net/jdk8u/jdk8u"
+AARCH64_URI="https://hg.${PN}.java.net/aarch64-port/jdk8u-shenandoah"
+
+DESCRIPTION="Open source implementation of the Java programming language"
+HOMEPAGE="https://openjdk.java.net"
+SRC_URI="
+ !arm64? (
+ ${BASE_URI}/archive/jdk${MY_PV}.tar.bz2 -> ${P}.tar.bz2
+ ${BASE_URI}/corba/archive/jdk${MY_PV}.tar.bz2 -> ${PN}-corba-${PV}.tar.bz2
+ ${BASE_URI}/hotspot/archive/jdk${MY_PV}.tar.bz2 -> ${PN}-hotspot-${PV}.tar.bz2
+ ${BASE_URI}/jaxp/archive/jdk${MY_PV}.tar.bz2 -> ${PN}-jaxp-${PV}.tar.bz2
+ ${BASE_URI}/jaxws/archive/jdk${MY_PV}.tar.bz2 -> ${PN}-jaxws-${PV}.tar.bz2
+ ${BASE_URI}/jdk/archive/jdk${MY_PV}.tar.bz2 -> ${PN}-jdk-${PV}.tar.bz2
+ ${BASE_URI}/langtools/archive/jdk${MY_PV}.tar.bz2 -> ${PN}-langtools-${PV}.tar.bz2
+ ${BASE_URI}/nashorn/archive/jdk${MY_PV}.tar.bz2 -> ${PN}-nashorn-${PV}.tar.bz2
+ )
+ arm64? (
+ ${AARCH64_URI}/archive/${MY_P_AARCH64}.tar.bz2 -> ${MY_PN_AARCH64}-${PV}.tar.bz2
+ ${AARCH64_URI}/corba/archive/${MY_P_AARCH64}.tar.bz2 -> ${MY_PN_AARCH64}-corba-${PV}.tar.bz2
+ ${AARCH64_URI}/hotspot/archive/${MY_P_AARCH64}.tar.bz2 -> ${MY_PN_AARCH64}-hotspot-${PV}.tar.bz2
+ ${AARCH64_URI}/jaxp/archive/${MY_P_AARCH64}.tar.bz2 -> ${MY_PN_AARCH64}-jaxp-${PV}.tar.bz2
+ ${AARCH64_URI}/jaxws/archive/${MY_P_AARCH64}.tar.bz2 -> ${MY_PN_AARCH64}-jaxws-${PV}.tar.bz2
+ ${AARCH64_URI}/jdk/archive/${MY_P_AARCH64}.tar.bz2 -> ${MY_PN_AARCH64}-jdk-${PV}.tar.bz2
+ ${AARCH64_URI}/langtools/archive/${MY_P_AARCH64}.tar.bz2 -> ${MY_PN_AARCH64}-langtools-${PV}.tar.bz2
+ ${AARCH64_URI}/nashorn/archive/${MY_P_AARCH64}.tar.bz2 -> ${MY_PN_AARCH64}-nashorn-jdk${PV}.tar.bz2
+ )
+"
+
+LICENSE="GPL-2"
+SLOT="$(ver_cut 1)"
+KEYWORDS="amd64 arm64 ppc64 x86"
+IUSE="alsa debug cups doc examples headless-awt javafx +jbootstrap +pch selinux source"
+
+COMMON_DEPEND="
+ media-libs/freetype:2=
+ media-libs/giflib:0/7
+ sys-libs/zlib
+"
+# Many libs are required to build, but not to run, make is possible to remove
+# by listing conditionally in RDEPEND unconditionally in DEPEND
+RDEPEND="
+ ${COMMON_DEPEND}
+ >=sys-apps/baselayout-java-0.1.0-r1
+ !headless-awt? (
+ x11-libs/libX11
+ x11-libs/libXext
+ x11-libs/libXi
+ x11-libs/libXrender
+ x11-libs/libXt
+ x11-libs/libXtst
+ )
+ alsa? ( media-libs/alsa-lib )
+ cups? ( net-print/cups )
+ selinux? ( sec-policy/selinux-java )
+"
+
+DEPEND="
+ ${COMMON_DEPEND}
+ app-arch/zip
+ media-libs/alsa-lib
+ net-print/cups
+ x11-base/xorg-proto
+ x11-libs/libX11
+ x11-libs/libXext
+ x11-libs/libXi
+ x11-libs/libXrender
+ x11-libs/libXt
+ x11-libs/libXtst
+ || (
+ dev-java/openjdk-bin:${SLOT}
+ dev-java/icedtea-bin:${SLOT}
+ dev-java/openjdk:${SLOT}
+ dev-java/icedtea:${SLOT}
+ )
+"
+
+PDEPEND="javafx? ( dev-java/openjfx:${SLOT} )"
+
+# The space required to build varies wildly depending on USE flags,
+# ranging from 2GB to 16GB. This function is certainly not exact but
+# should be close enough to be useful.
+openjdk_check_requirements() {
+ local M
+ M=2048
+ M=$(( $(usex debug 3 1) * $M ))
+ M=$(( $(usex jbootstrap 2 1) * $M ))
+ M=$(( $(usex doc 320 0) + $(usex source 128 0) + 192 + $M ))
+
+ CHECKREQS_DISK_BUILD=${M}M check-reqs_pkg_${EBUILD_PHASE}
+}
+
+pkg_pretend() {
+ openjdk_check_requirements
+ if [[ ${MERGE_TYPE} != binary ]]; then
+ has ccache ${FEATURES} && die "FEATURES=ccache doesn't work with ${PN}, bug #677876"
+ fi
+}
+
+pkg_setup() {
+ openjdk_check_requirements
+
+ JAVA_PKG_WANT_BUILD_VM="openjdk-${SLOT} openjdk-bin-${SLOT} icedtea-${SLOT} icedtea-bin-${SLOT}"
+ JAVA_PKG_WANT_SOURCE="${SLOT}"
+ JAVA_PKG_WANT_TARGET="${SLOT}"
+
+ java-vm-2_pkg_setup
+ java-pkg-2_pkg_setup
+}
+
+src_unpack() {
+ default
+ mv -v "jdk${SLOT}u"* "${P}" || die
+
+ local repo
+ for repo in corba hotspot jdk jaxp jaxws langtools nashorn; do
+ mv -v "${repo}-"* "${P}/${repo}" || die
+ done
+}
+
+src_prepare() {
+ default
+
+ # new warnings in new gcc https://bugs.gentoo.org/685426
+ sed -i '/^WARNINGS_ARE_ERRORS/ s/-Werror/-Wno-error/' \
+ hotspot/make/linux/makefiles/gcc.make || die
+
+ # conditionally apply patches for musl compatibility
+ if use elibc_musl; then
+ eapply "${FILESDIR}/musl/${SLOT}/0001_musl_hotspot.patch"
+ eapply "${FILESDIR}/musl/${SLOT}/0002_musl_hotspot_ppc.patch"
+ eapply "${FILESDIR}/musl/${SLOT}/0004_musl_hotspot_noagent.patch"
+ eapply "${FILESDIR}/musl/${SLOT}/0005_musl_fix_libjvm_load.patch"
+ eapply "${FILESDIR}/musl/${SLOT}/0006_musl_jdk.patch"
+ eapply "${FILESDIR}/musl/${SLOT}/0007_musl_jdk_includes.patch"
+ eapply "${FILESDIR}/musl/${SLOT}/0008_musl_jdk_execinfo.patch"
+ eapply "${FILESDIR}/musl/${SLOT}/0009_fix_jdk_ipv6_init.patch"
+ eapply "${FILESDIR}/musl/${SLOT}/0010_fix_jdk_close_fds.patch"
+ fi
+
+ # apply this patch here as the sources are not available unless ARCH == arm64
+ if use elibc_musl && use arm64; then
+ eapply "${FILESDIR}/patches/${PN}-${SLOT}/0003_musl_hotspot_aarch64.patch"
+ fi
+
+ chmod +x configure || die
+}
+
+src_configure() {
+ # general build info found here:
+ #https://hg.openjdk.java.net/jdk8/jdk8/raw-file/tip/README-builds.html
+
+ # Work around stack alignment issue, bug #647954.
+ use x86 && append-flags -mincoming-stack-boundary=2
+
+ # Work around -fno-common ( GCC10 default ), bug #706638
+ append-flags -fcommon
+
+ tc-export_build_env CC CXX PKG_CONFIG STRIP
+
+ local myconf=(
+ --disable-ccache
+ --enable-unlimited-crypto
+ --with-boot-jdk="${JDK_HOME}"
+ --with-extra-cflags="${CFLAGS}"
+ --with-extra-cxxflags="${CXXFLAGS}"
+ --with-extra-ldflags="${LDFLAGS}"
+ --with-giflib=system
+ --with-jtreg=no
+ --with-jobs=1
+ --with-num-cores=1
+ --with-update-version="$(ver_cut 2)"
+ --with-build-number="b$(ver_cut 4)"
+ --with-milestone="fcs" # magic variable that means "release version"
+ --with-vendor-name="Gentoo"
+ --with-vendor-url="https://gentoo.org"
+ --with-vendor-bug-url="https://bugs.gentoo.org"
+ --with-vendor-vm-bug-url="https://bugs.openjdk.java.net"
+ --with-zlib=system
+ --with-native-debug-symbols=$(usex debug internal none)
+ $(usex headless-awt --disable-headful '')
+ )
+
+ # PaX breaks pch, bug #601016
+ if use pch && ! host-is-pax; then
+ myconf+=( --enable-precompiled-headers )
+ else
+ myconf+=( --disable-precompiled-headers )
+ fi
+
+ (
+ unset _JAVA_OPTIONS JAVA JAVA_TOOL_OPTIONS JAVAC XARGS
+ CFLAGS= CXXFLAGS= LDFLAGS= \
+ CONFIG_SITE=/dev/null \
+ CONFIG_SHELL="${EPREFIX}/bin/bash"
+ econf "${myconf[@]}"
+ )
+}
+
+src_compile() {
+ local myemakeargs=(
+ JOBS=$(makeopts_jobs)
+ LOG=debug
+ $(usex doc docs '')
+ $(usex jbootstrap bootcycle-images images)
+ )
+ emake "${myemakeargs[@]}" -j1 #nowarn
+}
+
+src_install() {
+ local dest="/usr/$(get_libdir)/${PN}-${SLOT}"
+ local ddest="${ED%/}/${dest#/}"
+
+ cd "${S}"/build/*-release/images/j2sdk-image || die
+
+ if ! use alsa; then
+ rm -v jre/lib/$(get_system_arch)/libjsoundalsa.* || die
+ fi
+
+ # build system does not remove that
+ if use headless-awt ; then
+ rm -fvr jre/lib/$(get_system_arch)/lib*{[jx]awt,splashscreen}* \
+ {,jre/}bin/policytool bin/appletviewer || die
+ fi
+
+ if ! use examples ; then
+ rm -vr demo/ || die
+ fi
+
+ if ! use source ; then
+ rm -v src.zip || die
+ fi
+
+ dodir "${dest}"
+ cp -pPR * "${ddest}" || die
+
+ dosym ../../../../../../etc/ssl/certs/java/cacerts "${dest}"/jre/lib/security/cacerts
+
+ java-vm_install-env "${FILESDIR}"/${PN}-${SLOT}.env.sh
+ java-vm_set-pax-markings "${ddest}"
+ java-vm_revdep-mask
+ java-vm_sandbox-predict /dev/random /proc/self/coredump_filter
+
+ if use doc ; then
+ docinto html
+ dodoc -r "${S}"/build/*-release/docs/*
+ fi
+}
+
+pkg_postinst() {
+ java-vm-2_pkg_postinst
+ einfo "JavaWebStart functionality provided by icedtea-web package"
+}
+
diff --git a/dev-java/openjdk/openjdk-8.272_p10.ebuild b/dev-java/openjdk/openjdk-8.272_p10.ebuild
new file mode 100644
index 0000000..28b42be
--- /dev/null
+++ b/dev-java/openjdk/openjdk-8.272_p10.ebuild
@@ -0,0 +1,267 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit check-reqs eapi7-ver flag-o-matic java-pkg-2 java-vm-2 multiprocessing pax-utils toolchain-funcs
+
+# we need latest -ga tag from hg, but want to keep build number as well
+# as _p component of the gentoo version string.
+
+MY_PV=$(ver_rs 1 'u' 2 '-' ${PV%_p*}-ga)
+MY_PN_AARCH64="${PN}-aarch64-shenandoah"
+MY_PV_AARCH64="$(ver_rs 1 'u' 2 '-' ${PV/_p/-b})"
+MY_P_AARCH64="${MY_PN_AARCH64/#${PN}-}-jdk${MY_PV_AARCH64}"
+
+BASE_URI="https://hg.${PN}.java.net/jdk8u/jdk8u"
+AARCH64_URI="https://hg.${PN}.java.net/aarch64-port/jdk8u-shenandoah"
+
+DESCRIPTION="Open source implementation of the Java programming language"
+HOMEPAGE="https://openjdk.java.net"
+SRC_URI="
+ !arm64? (
+ ${BASE_URI}/archive/jdk${MY_PV}.tar.bz2 -> ${P}.tar.bz2
+ ${BASE_URI}/corba/archive/jdk${MY_PV}.tar.bz2 -> ${PN}-corba-${PV}.tar.bz2
+ ${BASE_URI}/hotspot/archive/jdk${MY_PV}.tar.bz2 -> ${PN}-hotspot-${PV}.tar.bz2
+ ${BASE_URI}/jaxp/archive/jdk${MY_PV}.tar.bz2 -> ${PN}-jaxp-${PV}.tar.bz2
+ ${BASE_URI}/jaxws/archive/jdk${MY_PV}.tar.bz2 -> ${PN}-jaxws-${PV}.tar.bz2
+ ${BASE_URI}/jdk/archive/jdk${MY_PV}.tar.bz2 -> ${PN}-jdk-${PV}.tar.bz2
+ ${BASE_URI}/langtools/archive/jdk${MY_PV}.tar.bz2 -> ${PN}-langtools-${PV}.tar.bz2
+ ${BASE_URI}/nashorn/archive/jdk${MY_PV}.tar.bz2 -> ${PN}-nashorn-${PV}.tar.bz2
+ )
+ arm64? (
+ ${AARCH64_URI}/archive/${MY_P_AARCH64}.tar.bz2 -> ${MY_PN_AARCH64}-${PV}.tar.bz2
+ ${AARCH64_URI}/corba/archive/${MY_P_AARCH64}.tar.bz2 -> ${MY_PN_AARCH64}-corba-${PV}.tar.bz2
+ ${AARCH64_URI}/hotspot/archive/${MY_P_AARCH64}.tar.bz2 -> ${MY_PN_AARCH64}-hotspot-${PV}.tar.bz2
+ ${AARCH64_URI}/jaxp/archive/${MY_P_AARCH64}.tar.bz2 -> ${MY_PN_AARCH64}-jaxp-${PV}.tar.bz2
+ ${AARCH64_URI}/jaxws/archive/${MY_P_AARCH64}.tar.bz2 -> ${MY_PN_AARCH64}-jaxws-${PV}.tar.bz2
+ ${AARCH64_URI}/jdk/archive/${MY_P_AARCH64}.tar.bz2 -> ${MY_PN_AARCH64}-jdk-${PV}.tar.bz2
+ ${AARCH64_URI}/langtools/archive/${MY_P_AARCH64}.tar.bz2 -> ${MY_PN_AARCH64}-langtools-${PV}.tar.bz2
+ ${AARCH64_URI}/nashorn/archive/${MY_P_AARCH64}.tar.bz2 -> ${MY_PN_AARCH64}-nashorn-jdk${PV}.tar.bz2
+ )
+"
+
+LICENSE="GPL-2"
+SLOT="$(ver_cut 1)"
+KEYWORDS="amd64 ~arm64 ppc64 x86"
+IUSE="alsa debug cups doc examples headless-awt javafx +jbootstrap +pch selinux source"
+
+COMMON_DEPEND="
+ media-libs/freetype:2=
+ media-libs/giflib:0/7
+ sys-libs/zlib
+"
+# Many libs are required to build, but not to run, make is possible to remove
+# by listing conditionally in RDEPEND unconditionally in DEPEND
+RDEPEND="
+ ${COMMON_DEPEND}
+ >=sys-apps/baselayout-java-0.1.0-r1
+ !headless-awt? (
+ x11-libs/libX11
+ x11-libs/libXext
+ x11-libs/libXi
+ x11-libs/libXrender
+ x11-libs/libXt
+ x11-libs/libXtst
+ )
+ alsa? ( media-libs/alsa-lib )
+ cups? ( net-print/cups )
+ selinux? ( sec-policy/selinux-java )
+"
+
+DEPEND="
+ ${COMMON_DEPEND}
+ app-arch/zip
+ media-libs/alsa-lib
+ net-print/cups
+ x11-base/xorg-proto
+ x11-libs/libX11
+ x11-libs/libXext
+ x11-libs/libXi
+ x11-libs/libXrender
+ x11-libs/libXt
+ x11-libs/libXtst
+ || (
+ dev-java/openjdk-bin:${SLOT}
+ dev-java/icedtea-bin:${SLOT}
+ dev-java/openjdk:${SLOT}
+ dev-java/icedtea:${SLOT}
+ )
+"
+
+PDEPEND="javafx? ( dev-java/openjfx:${SLOT} )"
+
+# The space required to build varies wildly depending on USE flags,
+# ranging from 2GB to 16GB. This function is certainly not exact but
+# should be close enough to be useful.
+openjdk_check_requirements() {
+ local M
+ M=2048
+ M=$(( $(usex debug 3 1) * $M ))
+ M=$(( $(usex jbootstrap 2 1) * $M ))
+ M=$(( $(usex doc 320 0) + $(usex source 128 0) + 192 + $M ))
+
+ CHECKREQS_DISK_BUILD=${M}M check-reqs_pkg_${EBUILD_PHASE}
+}
+
+pkg_pretend() {
+ openjdk_check_requirements
+ if [[ ${MERGE_TYPE} != binary ]]; then
+ has ccache ${FEATURES} && die "FEATURES=ccache doesn't work with ${PN}, bug #677876"
+ fi
+}
+
+pkg_setup() {
+ openjdk_check_requirements
+
+ JAVA_PKG_WANT_BUILD_VM="openjdk-${SLOT} openjdk-bin-${SLOT} icedtea-${SLOT} icedtea-bin-${SLOT}"
+ JAVA_PKG_WANT_SOURCE="${SLOT}"
+ JAVA_PKG_WANT_TARGET="${SLOT}"
+
+ java-vm-2_pkg_setup
+ java-pkg-2_pkg_setup
+}
+
+src_unpack() {
+ default
+ mv -v "jdk${SLOT}u"* "${P}" || die
+
+ local repo
+ for repo in corba hotspot jdk jaxp jaxws langtools nashorn; do
+ mv -v "${repo}-"* "${P}/${repo}" || die
+ done
+}
+
+src_prepare() {
+ default
+
+ # new warnings in new gcc https://bugs.gentoo.org/685426
+ sed -i '/^WARNINGS_ARE_ERRORS/ s/-Werror/-Wno-error/' \
+ hotspot/make/linux/makefiles/gcc.make || die
+
+ # conditionally apply patches for musl compatibility
+ if use elibc_musl; then
+ eapply "${FILESDIR}/musl/${SLOT}/0001_musl_hotspot.patch"
+ eapply "${FILESDIR}/musl/${SLOT}/0002_musl_hotspot_ppc.patch"
+ eapply "${FILESDIR}/musl/${SLOT}/0004_musl_hotspot_noagent.patch"
+ eapply "${FILESDIR}/musl/${SLOT}/0005_musl_fix_libjvm_load.patch"
+ eapply "${FILESDIR}/musl/${SLOT}/0006_musl_jdk.patch"
+ eapply "${FILESDIR}/musl/${SLOT}/0007_musl_jdk_includes.patch"
+ eapply "${FILESDIR}/musl/${SLOT}/0008_musl_jdk_execinfo.patch"
+ eapply "${FILESDIR}/musl/${SLOT}/0009_fix_jdk_ipv6_init.patch"
+ eapply "${FILESDIR}/musl/${SLOT}/0010_fix_jdk_close_fds.patch"
+ fi
+
+ # apply this patch here as the sources are not available unless ARCH == arm64
+ if use elibc_musl && use arm64; then
+ eapply "${FILESDIR}/patches/${PN}-${SLOT}/0003_musl_hotspot_aarch64.patch"
+ fi
+
+ chmod +x configure || die
+}
+
+src_configure() {
+ # general build info found here:
+ #https://hg.openjdk.java.net/jdk8/jdk8/raw-file/tip/README-builds.html
+
+ # Work around stack alignment issue, bug #647954.
+ use x86 && append-flags -mincoming-stack-boundary=2
+
+ # Work around -fno-common ( GCC10 default ), bug #706638
+ append-flags -fcommon
+
+ tc-export_build_env CC CXX PKG_CONFIG STRIP
+
+ local myconf=(
+ --disable-ccache
+ --enable-unlimited-crypto
+ --with-boot-jdk="${JDK_HOME}"
+ --with-extra-cflags="${CFLAGS}"
+ --with-extra-cxxflags="${CXXFLAGS}"
+ --with-extra-ldflags="${LDFLAGS}"
+ --with-giflib=system
+ --with-jtreg=no
+ --with-jobs=1
+ --with-num-cores=1
+ --with-update-version="$(ver_cut 2)"
+ --with-build-number="b$(ver_cut 4)"
+ --with-milestone="fcs" # magic variable that means "release version"
+ --with-vendor-name="Gentoo"
+ --with-vendor-url="https://gentoo.org"
+ --with-vendor-bug-url="https://bugs.gentoo.org"
+ --with-vendor-vm-bug-url="https://bugs.openjdk.java.net"
+ --with-zlib=system
+ --with-native-debug-symbols=$(usex debug internal none)
+ $(usex headless-awt --disable-headful '')
+ )
+
+ # PaX breaks pch, bug #601016
+ if use pch && ! host-is-pax; then
+ myconf+=( --enable-precompiled-headers )
+ else
+ myconf+=( --disable-precompiled-headers )
+ fi
+
+ (
+ unset _JAVA_OPTIONS JAVA JAVA_TOOL_OPTIONS JAVAC XARGS
+ CFLAGS= CXXFLAGS= LDFLAGS= \
+ CONFIG_SITE=/dev/null \
+ CONFIG_SHELL="${EPREFIX}/bin/bash"
+ econf "${myconf[@]}"
+ )
+}
+
+src_compile() {
+ local myemakeargs=(
+ JOBS=$(makeopts_jobs)
+ LOG=debug
+ $(usex doc docs '')
+ $(usex jbootstrap bootcycle-images images)
+ )
+ emake "${myemakeargs[@]}" -j1 #nowarn
+}
+
+src_install() {
+ local dest="/usr/$(get_libdir)/${PN}-${SLOT}"
+ local ddest="${ED%/}/${dest#/}"
+
+ cd "${S}"/build/*-release/images/j2sdk-image || die
+
+ if ! use alsa; then
+ rm -v jre/lib/$(get_system_arch)/libjsoundalsa.* || die
+ fi
+
+ # build system does not remove that
+ if use headless-awt ; then
+ rm -fvr jre/lib/$(get_system_arch)/lib*{[jx]awt,splashscreen}* \
+ {,jre/}bin/policytool bin/appletviewer || die
+ fi
+
+ if ! use examples ; then
+ rm -vr demo/ || die
+ fi
+
+ if ! use source ; then
+ rm -v src.zip || die
+ fi
+
+ dodir "${dest}"
+ cp -pPR * "${ddest}" || die
+
+ dosym ../../../../../../etc/ssl/certs/java/cacerts "${dest}"/jre/lib/security/cacerts
+
+ java-vm_install-env "${FILESDIR}"/${PN}-${SLOT}.env.sh
+ java-vm_set-pax-markings "${ddest}"
+ java-vm_revdep-mask
+ java-vm_sandbox-predict /dev/random /proc/self/coredump_filter
+
+ if use doc ; then
+ docinto html
+ dodoc -r "${S}"/build/*-release/docs/*
+ fi
+}
+
+pkg_postinst() {
+ java-vm-2_pkg_postinst
+ einfo "JavaWebStart functionality provided by icedtea-web package"
+}